public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] usb: usb3503: fix build warning
@ 2014-07-10  4:23 Joonyoung Shim
  2014-07-10  4:23 ` [PATCH 2/3] usb: usb3503: add PM functions Joonyoung Shim
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Joonyoung Shim @ 2014-07-10  4:23 UTC (permalink / raw)
  To: linux-usb, linux-kernel
  Cc: gregkh, m.szyprowski, broonie, tobetter, jy0922.shim

This fixes below build warning.

drivers/usb/misc/usb3503.c: In function ‘usb3503_probe’:
drivers/usb/misc/usb3503.c:195:11: warning: ‘err’ may be used uninitialized in this function [-Wmaybe-uninitialized]
    dev_err(dev, "unable to request refclk (%d)\n", err);
           ^
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
---
 drivers/usb/misc/usb3503.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/misc/usb3503.c b/drivers/usb/misc/usb3503.c
index f43c619..652855b 100644
--- a/drivers/usb/misc/usb3503.c
+++ b/drivers/usb/misc/usb3503.c
@@ -192,7 +192,8 @@ static int usb3503_probe(struct usb3503 *hub)
 
 		clk = devm_clk_get(dev, "refclk");
 		if (IS_ERR(clk) && PTR_ERR(clk) != -ENOENT) {
-			dev_err(dev, "unable to request refclk (%d)\n", err);
+			dev_err(dev, "unable to request refclk (%ld)\n",
+					PTR_ERR(clk));
 			return PTR_ERR(clk);
 		}
 
-- 
1.8.1.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/3] usb: usb3503: add PM functions
  2014-07-10  4:23 [PATCH 1/3] usb: usb3503: fix build warning Joonyoung Shim
@ 2014-07-10  4:23 ` Joonyoung Shim
  2014-07-10  4:23 ` [PATCH 3/3] USB: add reset resume quirk for usb3503 Joonyoung Shim
  2014-07-10  4:52 ` [PATCH 1/3] usb: usb3503: fix build warning Sachin Kamat
  2 siblings, 0 replies; 6+ messages in thread
From: Joonyoung Shim @ 2014-07-10  4:23 UTC (permalink / raw)
  To: linux-usb, linux-kernel
  Cc: gregkh, m.szyprowski, broonie, tobetter, jy0922.shim

The usb3503 needs to switch to standby mode while suspending and should
switch to hub mode when resumed. Also we can control clock on PM
function.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
---
 drivers/usb/misc/usb3503.c | 34 ++++++++++++++++++++++++++++++++--
 1 file changed, 32 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/misc/usb3503.c b/drivers/usb/misc/usb3503.c
index 652855b..47cb143 100644
--- a/drivers/usb/misc/usb3503.c
+++ b/drivers/usb/misc/usb3503.c
@@ -149,8 +149,6 @@ static int usb3503_switch_mode(struct usb3503 *hub, enum usb3503_mode mode)
 
 	case USB3503_MODE_STANDBY:
 		usb3503_reset(hub, 0);
-
-		hub->mode = mode;
 		dev_info(dev, "switched to STANDBY mode\n");
 		break;
 
@@ -347,6 +345,37 @@ static int usb3503_platform_probe(struct platform_device *pdev)
 	return usb3503_probe(hub);
 }
 
+#ifdef CONFIG_PM_SLEEP
+static int usb3503_i2c_suspend(struct device *dev)
+{
+	struct i2c_client *client = to_i2c_client(dev);
+	struct usb3503 *hub = i2c_get_clientdata(client);
+
+	usb3503_switch_mode(hub, USB3503_MODE_STANDBY);
+
+	if (hub->clk)
+		clk_disable_unprepare(hub->clk);
+
+	return 0;
+}
+
+static int usb3503_i2c_resume(struct device *dev)
+{
+	struct i2c_client *client = to_i2c_client(dev);
+	struct usb3503 *hub = i2c_get_clientdata(client);
+
+	if (hub->clk)
+		clk_prepare_enable(hub->clk);
+
+	usb3503_switch_mode(hub, hub->mode);
+
+	return 0;
+}
+#endif
+
+static SIMPLE_DEV_PM_OPS(usb3503_i2c_pm_ops, usb3503_i2c_suspend,
+		usb3503_i2c_resume);
+
 static const struct i2c_device_id usb3503_id[] = {
 	{ USB3503_I2C_NAME, 0 },
 	{ }
@@ -365,6 +394,7 @@ MODULE_DEVICE_TABLE(of, usb3503_of_match);
 static struct i2c_driver usb3503_i2c_driver = {
 	.driver = {
 		.name = USB3503_I2C_NAME,
+		.pm = &usb3503_i2c_pm_ops,
 		.of_match_table = of_match_ptr(usb3503_of_match),
 	},
 	.probe		= usb3503_i2c_probe,
-- 
1.8.1.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/3] USB: add reset resume quirk for usb3503
  2014-07-10  4:23 [PATCH 1/3] usb: usb3503: fix build warning Joonyoung Shim
  2014-07-10  4:23 ` [PATCH 2/3] usb: usb3503: add PM functions Joonyoung Shim
@ 2014-07-10  4:23 ` Joonyoung Shim
  2014-07-10  4:52 ` [PATCH 1/3] usb: usb3503: fix build warning Sachin Kamat
  2 siblings, 0 replies; 6+ messages in thread
From: Joonyoung Shim @ 2014-07-10  4:23 UTC (permalink / raw)
  To: linux-usb, linux-kernel
  Cc: gregkh, m.szyprowski, broonie, tobetter, jy0922.shim

The usb device will autoresume from choose_wakeup() if it is
autosuspended with the wrong wakeup setting, but below errors occur
because usb3503 misc driver will switch to standby mode when suspended.

As add USB_QUIRK_RESET_RESUME, it can stop setting wrong wakeup from
autosuspend_check().

[    7.734717] usb 1-3: reset high-speed USB device number 3 using exynos-ehci
[    7.854658] usb 1-3: device descriptor read/64, error -71
[    8.079657] usb 1-3: device descriptor read/64, error -71
[    8.294664] usb 1-3: reset high-speed USB device number 3 using exynos-ehci
[    8.414658] usb 1-3: device descriptor read/64, error -71
[    8.639657] usb 1-3: device descriptor read/64, error -71
[    8.854667] usb 1-3: reset high-speed USB device number 3 using exynos-ehci
[    9.264598] usb 1-3: device not accepting address 3, error -71
[    9.374655] usb 1-3: reset high-speed USB device number 3 using exynos-ehci
[    9.784601] usb 1-3: device not accepting address 3, error -71
[    9.784838] usb usb1-port3: device 1-3 not suspended yet

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
---
 drivers/usb/core/quirks.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
index 739ee8e..2c9ba407 100644
--- a/drivers/usb/core/quirks.c
+++ b/drivers/usb/core/quirks.c
@@ -152,6 +152,9 @@ static const struct usb_device_id usb_quirk_list[] = {
 	/* INTEL VALUE SSD */
 	{ USB_DEVICE(0x8086, 0xf1a5), .driver_info = USB_QUIRK_RESET_RESUME },
 
+	/* USB3503 */
+	{ USB_DEVICE(0x0424, 0x3503), .driver_info = USB_QUIRK_RESET_RESUME },
+
 	{ }  /* terminating entry must be last */
 };
 
-- 
1.8.1.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/3] usb: usb3503: fix build warning
  2014-07-10  4:23 [PATCH 1/3] usb: usb3503: fix build warning Joonyoung Shim
  2014-07-10  4:23 ` [PATCH 2/3] usb: usb3503: add PM functions Joonyoung Shim
  2014-07-10  4:23 ` [PATCH 3/3] USB: add reset resume quirk for usb3503 Joonyoung Shim
@ 2014-07-10  4:52 ` Sachin Kamat
  2014-07-10  5:05   ` Greg Kroah-Hartman
  2 siblings, 1 reply; 6+ messages in thread
From: Sachin Kamat @ 2014-07-10  4:52 UTC (permalink / raw)
  To: Joonyoung Shim
  Cc: Linux USB Mailing List, open list, Greg Kroah-Hartman,
	Marek Szyprowski, Mark Brown, tobetter

Hi Joonyoung,

On Thu, Jul 10, 2014 at 9:53 AM, Joonyoung Shim <jy0922.shim@samsung.com> wrote:
> This fixes below build warning.
>
> drivers/usb/misc/usb3503.c: In function ‘usb3503_probe’:
> drivers/usb/misc/usb3503.c:195:11: warning: ‘err’ may be used uninitialized in this function [-Wmaybe-uninitialized]
>     dev_err(dev, "unable to request refclk (%d)\n", err);
>            ^

This has been fixed and availabe in Greg's usb-next tree.
https://git.kernel.org/cgit/linux/kernel/git/gregkh/usb.git/commit/?h=usb-next&id=ec5734c41bee2ee7c938a8f34853d31cada7e67a

-- 
Regards,
Sachin.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/3] usb: usb3503: fix build warning
  2014-07-10  4:52 ` [PATCH 1/3] usb: usb3503: fix build warning Sachin Kamat
@ 2014-07-10  5:05   ` Greg Kroah-Hartman
  2014-07-10  5:11     ` Joonyoung Shim
  0 siblings, 1 reply; 6+ messages in thread
From: Greg Kroah-Hartman @ 2014-07-10  5:05 UTC (permalink / raw)
  To: Sachin Kamat
  Cc: Joonyoung Shim, Linux USB Mailing List, open list,
	Marek Szyprowski, Mark Brown, tobetter

On Thu, Jul 10, 2014 at 10:22:46AM +0530, Sachin Kamat wrote:
> Hi Joonyoung,
> 
> On Thu, Jul 10, 2014 at 9:53 AM, Joonyoung Shim <jy0922.shim@samsung.com> wrote:
> > This fixes below build warning.
> >
> > drivers/usb/misc/usb3503.c: In function ‘usb3503_probe’:
> > drivers/usb/misc/usb3503.c:195:11: warning: ‘err’ may be used uninitialized in this function [-Wmaybe-uninitialized]
> >     dev_err(dev, "unable to request refclk (%d)\n", err);
> >            ^
> 
> This has been fixed and availabe in Greg's usb-next tree.
> https://git.kernel.org/cgit/linux/kernel/git/gregkh/usb.git/commit/?h=usb-next&id=ec5734c41bee2ee7c938a8f34853d31cada7e67a

Yes, Joonyoung, can you refresh this against my latest tree and resend
anything that is still needed in this series?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/3] usb: usb3503: fix build warning
  2014-07-10  5:05   ` Greg Kroah-Hartman
@ 2014-07-10  5:11     ` Joonyoung Shim
  0 siblings, 0 replies; 6+ messages in thread
From: Joonyoung Shim @ 2014-07-10  5:11 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Sachin Kamat
  Cc: Linux USB Mailing List, open list, Marek Szyprowski, Mark Brown,
	tobetter

On 07/10/2014 02:05 PM, Greg Kroah-Hartman wrote:
> On Thu, Jul 10, 2014 at 10:22:46AM +0530, Sachin Kamat wrote:
>> Hi Joonyoung,
>>
>> On Thu, Jul 10, 2014 at 9:53 AM, Joonyoung Shim <jy0922.shim@samsung.com> wrote:
>>> This fixes below build warning.
>>>
>>> drivers/usb/misc/usb3503.c: In function ‘usb3503_probe’:
>>> drivers/usb/misc/usb3503.c:195:11: warning: ‘err’ may be used uninitialized in this function [-Wmaybe-uninitialized]
>>>     dev_err(dev, "unable to request refclk (%d)\n", err);
>>>            ^
>>
>> This has been fixed and availabe in Greg's usb-next tree.
>> https://git.kernel.org/cgit/linux/kernel/git/gregkh/usb.git/commit/?h=usb-next&id=ec5734c41bee2ee7c938a8f34853d31cada7e67a
> 
> Yes, Joonyoung, can you refresh this against my latest tree and resend
> anything that is still needed in this series?
> 

Aha, i missed it, ok i will resend.

Thanks.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-07-10  5:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-10  4:23 [PATCH 1/3] usb: usb3503: fix build warning Joonyoung Shim
2014-07-10  4:23 ` [PATCH 2/3] usb: usb3503: add PM functions Joonyoung Shim
2014-07-10  4:23 ` [PATCH 3/3] USB: add reset resume quirk for usb3503 Joonyoung Shim
2014-07-10  4:52 ` [PATCH 1/3] usb: usb3503: fix build warning Sachin Kamat
2014-07-10  5:05   ` Greg Kroah-Hartman
2014-07-10  5:11     ` Joonyoung Shim

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox