From: sathyanarayanan kuppuswamy <sathyanarayanan.kuppuswamy@linux.intel.com>
To: Heikki Krogerus <heikki.krogerus@linux.intel.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Hans de Goede <hdegoede@redhat.com>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Guenter Roeck <linux@roeck-us.net>,
linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org
Subject: Re: [PATCH v3 4/4] usb: roles: intel_xhci: Enable runtime PM
Date: Thu, 24 May 2018 11:16:02 -0700 [thread overview]
Message-ID: <fbc90f91-1965-d612-ae33-ac1fa450ea47@linux.intel.com> (raw)
In-Reply-To: <20180524081827.37861-5-heikki.krogerus@linux.intel.com>
Hi,
On 05/24/2018 01:18 AM, Heikki Krogerus wrote:
> This fixes an issue where the mux does not get configured
> when the parent device is suspended. The registers for this
> mux are mapped to the parent device MMIO (usually xHCI PCI
> device), so in order for the driver to be able to program
> the registers, the parent device must be resumed.
>
> Reported-by: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com>
> Fixes: f6fb9ec02be1 ("usb: roles: Add Intel xHCI USB role switch driver")
> Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Tested-by: Kuppuswamy Sathyanarayanan
<sathyanarayanan.kuppuswamy@linux.intel.com>
> ---
> drivers/usb/roles/intel-xhci-usb-role-switch.c | 14 +++++++++++++-
> 1 file changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/usb/roles/intel-xhci-usb-role-switch.c b/drivers/usb/roles/intel-xhci-usb-role-switch.c
> index 6e922b50b674..1fb3dd0f1dfa 100644
> --- a/drivers/usb/roles/intel-xhci-usb-role-switch.c
> +++ b/drivers/usb/roles/intel-xhci-usb-role-switch.c
> @@ -18,6 +18,7 @@
> #include <linux/kernel.h>
> #include <linux/module.h>
> #include <linux/platform_device.h>
> +#include <linux/pm_runtime.h>
> #include <linux/usb/role.h>
>
> /* register definition */
> @@ -56,6 +57,8 @@ static int intel_xhci_usb_set_role(struct device *dev, enum usb_role role)
> return -EIO;
> }
>
> + pm_runtime_get_sync(dev);
> +
> /* Set idpin value as requested */
> val = readl(data->base + DUAL_ROLE_CFG0);
> switch (role) {
> @@ -84,13 +87,17 @@ static int intel_xhci_usb_set_role(struct device *dev, enum usb_role role)
> /* Polling on CFG1 register to confirm mode switch.*/
> do {
> val = readl(data->base + DUAL_ROLE_CFG1);
> - if (!!(val & HOST_MODE) == (role == USB_ROLE_HOST))
> + if (!!(val & HOST_MODE) == (role == USB_ROLE_HOST)) {
> + pm_runtime_put(dev);
> return 0;
> + }
>
> /* Interval for polling is set to about 5 - 10 ms */
> usleep_range(5000, 10000);
> } while (time_before(jiffies, timeout));
>
> + pm_runtime_put(dev);
> +
> dev_warn(dev, "Timeout waiting for role-switch\n");
> return -ETIMEDOUT;
> }
> @@ -101,7 +108,9 @@ static enum usb_role intel_xhci_usb_get_role(struct device *dev)
> enum usb_role role;
> u32 val;
>
> + pm_runtime_get_sync(dev);
> val = readl(data->base + DUAL_ROLE_CFG0);
> + pm_runtime_put(dev);
>
> if (!(val & SW_IDPIN))
> role = USB_ROLE_HOST;
> @@ -142,6 +151,9 @@ static int intel_xhci_usb_probe(struct platform_device *pdev)
> if (IS_ERR(data->role_sw))
> return PTR_ERR(data->role_sw);
>
> + pm_runtime_set_active(dev);
> + pm_runtime_enable(dev);
> +
> return 0;
> }
>
--
Sathyanarayanan Kuppuswamy
Linux kernel developer
prev parent reply other threads:[~2018-05-24 18:16 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-24 8:18 [PATCH v3 0/4] usb: typec: fixes for Cherry Trails Heikki Krogerus
2018-05-24 8:18 ` [PATCH v3 1/4] usb: roles: intel_xhci: Always allow user control Heikki Krogerus
2018-05-24 8:18 ` [PATCH v3 2/4] platform: x86: intel_cht_int33fe: Fix dependencies Heikki Krogerus
2018-05-24 8:18 ` [PATCH v3 3/4] usb: typec: fusb302: Fix debugfs issue Heikki Krogerus
2018-05-24 9:18 ` Guenter Roeck
2018-05-24 8:18 ` [PATCH v3 4/4] usb: roles: intel_xhci: Enable runtime PM Heikki Krogerus
2018-05-24 18:16 ` sathyanarayanan kuppuswamy [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=fbc90f91-1965-d612-ae33-ac1fa450ea47@linux.intel.com \
--to=sathyanarayanan.kuppuswamy@linux.intel.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=hdegoede@redhat.com \
--cc=heikki.krogerus@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=linux@roeck-us.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome