[v5,1/6] pinctrl: rockchip: add suspend/resume functions
diff mbox

Message ID 1414417650-19402-2-git-send-email-zyw@rock-chips.com
State New, archived
Headers show

Commit Message

Chris Zhong Oct. 27, 2014, 1:47 p.m. UTC
support suspend/resume of pinctrl, it allows handling sleep mode
for hogged pins in pinctrl

Signed-off-by: Chris Zhong <zyw@rock-chips.com>

Tested-by: Doug Anderson <dianders@chromium.org>
---

Changes in v5:
- reset-author
- use "__maybe_unused" annotation

Changes in v4:
- use SIMPLE_DEV_PM_OPS for suspend/resume struct

Changes in v3: None
Changes in v2: None

 drivers/pinctrl/pinctrl-rockchip.c |   18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

Comments

Douglas Anderson Oct. 27, 2014, 5:21 p.m. UTC | #1
Chris,

On Mon, Oct 27, 2014 at 6:47 AM, Chris Zhong <zyw@rock-chips.com> wrote:
> support suspend/resume of pinctrl, it allows handling sleep mode
> for hogged pins in pinctrl
>
> Signed-off-by: Chris Zhong <zyw@rock-chips.com>
>
> Tested-by: Doug Anderson <dianders@chromium.org>

Please no blank lines between tags.  I think this has been mentioned
before a few times.  No need to resend this patch, but please be
careful not to keep making this mistake.

> ---
>
> Changes in v5:
> - reset-author
> - use "__maybe_unused" annotation
>
> Changes in v4:
> - use SIMPLE_DEV_PM_OPS for suspend/resume struct
>
> Changes in v3: None
> Changes in v2: None
>
>  drivers/pinctrl/pinctrl-rockchip.c |   18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)

This looks right to me now and incorporates all review feedback I'm aware of.

Reviewed-by: Doug Anderson <dianders@chromium.org>
Heiko Stübner Oct. 27, 2014, 11:37 p.m. UTC | #2
Am Montag, 27. Oktober 2014, 21:47:25 schrieb Chris Zhong:
> support suspend/resume of pinctrl, it allows handling sleep mode
> for hogged pins in pinctrl
> 
> Signed-off-by: Chris Zhong <zyw@rock-chips.com>
> 
> Tested-by: Doug Anderson <dianders@chromium.org>

Tested-by: Heiko Stuebner <heiko@sntech.de>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>

> ---
> 
> Changes in v5:
> - reset-author
> - use "__maybe_unused" annotation
> 
> Changes in v4:
> - use SIMPLE_DEV_PM_OPS for suspend/resume struct
> 
> Changes in v3: None
> Changes in v2: None
> 
>  drivers/pinctrl/pinctrl-rockchip.c |   18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
> 
> diff --git a/drivers/pinctrl/pinctrl-rockchip.c
> b/drivers/pinctrl/pinctrl-rockchip.c index 016f457..172ad1d 100644
> --- a/drivers/pinctrl/pinctrl-rockchip.c
> +++ b/drivers/pinctrl/pinctrl-rockchip.c
> @@ -1770,6 +1770,23 @@ static struct rockchip_pin_ctrl
> *rockchip_pinctrl_get_soc_data( return ctrl;
>  }
> 
> +static int __maybe_unused rockchip_pinctrl_suspend(struct device *dev)
> +{
> +	struct rockchip_pinctrl *info = dev_get_drvdata(dev);
> +
> +	return pinctrl_force_sleep(info->pctl_dev);
> +}
> +
> +static int __maybe_unused rockchip_pinctrl_resume(struct device *dev)
> +{
> +	struct rockchip_pinctrl *info = dev_get_drvdata(dev);
> +
> +	return pinctrl_force_default(info->pctl_dev);
> +}
> +
> +static SIMPLE_DEV_PM_OPS(rockchip_pinctrl_dev_pm_ops,
> rockchip_pinctrl_suspend, +			 rockchip_pinctrl_resume);
> +
>  static int rockchip_pinctrl_probe(struct platform_device *pdev)
>  {
>  	struct rockchip_pinctrl *info;
> @@ -1983,6 +2000,7 @@ static struct platform_driver rockchip_pinctrl_driver
> = { .driver = {
>  		.name	= "rockchip-pinctrl",
>  		.owner	= THIS_MODULE,
> +		.pm = &rockchip_pinctrl_dev_pm_ops,
>  		.of_match_table = rockchip_pinctrl_dt_match,
>  	},
>  };
Linus Walleij Oct. 31, 2014, 7:25 a.m. UTC | #3
On Tue, Oct 28, 2014 at 12:37 AM, Heiko Stübner <heiko@sntech.de> wrote:
> Am Montag, 27. Oktober 2014, 21:47:25 schrieb Chris Zhong:
>> support suspend/resume of pinctrl, it allows handling sleep mode
>> for hogged pins in pinctrl
>>
>> Signed-off-by: Chris Zhong <zyw@rock-chips.com>
>>
>> Tested-by: Doug Anderson <dianders@chromium.org>
>
> Tested-by: Heiko Stuebner <heiko@sntech.de>
> Reviewed-by: Heiko Stuebner <heiko@sntech.de>

Heiko, please pick up this stuff too for your combined
branch.

Yours,
Linus Walleij

Patch
diff mbox

diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c
index 016f457..172ad1d 100644
--- a/drivers/pinctrl/pinctrl-rockchip.c
+++ b/drivers/pinctrl/pinctrl-rockchip.c
@@ -1770,6 +1770,23 @@  static struct rockchip_pin_ctrl *rockchip_pinctrl_get_soc_data(
 	return ctrl;
 }
 
+static int __maybe_unused rockchip_pinctrl_suspend(struct device *dev)
+{
+	struct rockchip_pinctrl *info = dev_get_drvdata(dev);
+
+	return pinctrl_force_sleep(info->pctl_dev);
+}
+
+static int __maybe_unused rockchip_pinctrl_resume(struct device *dev)
+{
+	struct rockchip_pinctrl *info = dev_get_drvdata(dev);
+
+	return pinctrl_force_default(info->pctl_dev);
+}
+
+static SIMPLE_DEV_PM_OPS(rockchip_pinctrl_dev_pm_ops, rockchip_pinctrl_suspend,
+			 rockchip_pinctrl_resume);
+
 static int rockchip_pinctrl_probe(struct platform_device *pdev)
 {
 	struct rockchip_pinctrl *info;
@@ -1983,6 +2000,7 @@  static struct platform_driver rockchip_pinctrl_driver = {
 	.driver = {
 		.name	= "rockchip-pinctrl",
 		.owner	= THIS_MODULE,
+		.pm = &rockchip_pinctrl_dev_pm_ops,
 		.of_match_table = rockchip_pinctrl_dt_match,
 	},
 };