All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marek Szyprowski <m.szyprowski@samsung.com>
To: Joonyoung Shim <jy0922.shim@samsung.com>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: gregkh@linuxfoundation.org, broonie@linaro.org, tobetter@gmail.com
Subject: Re: [PATCH 1/2] usb: usb3503: add PM functions
Date: Mon, 14 Jul 2014 13:57:15 +0200	[thread overview]
Message-ID: <53C3C59B.20306@samsung.com> (raw)
In-Reply-To: <1404969755-30555-1-git-send-email-jy0922.shim@samsung.com>

Hello,

On 2014-07-10 07:22, Joonyoung Shim wrote:
> 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>

Acked-by: Marek Szyprowski <m.szyprowski@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,

Best regards
-- 
Marek Szyprowski, PhD
Samsung R&D Institute Poland


      parent reply	other threads:[~2014-07-14 11:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-10  5:22 [PATCH 1/2] usb: usb3503: add PM functions Joonyoung Shim
2014-07-10  5:22 ` [PATCH 2/2] USB: add reset resume quirk for usb3503 Joonyoung Shim
2014-07-14 11:57   ` Marek Szyprowski
2014-07-14 11:57 ` Marek Szyprowski [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=53C3C59B.20306@samsung.com \
    --to=m.szyprowski@samsung.com \
    --cc=broonie@linaro.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jy0922.shim@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=tobetter@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.