[v2,2/2] pinctrl: pinctrl-imx8mq: Add support PM operations
diff mbox series

Message ID 1553522352-20214-2-git-send-email-abel.vesa@nxp.com
State New
Headers show
Series
  • [v2,1/2] pinctrl: pinctrl-imx: Add suspend/resume for LPSR
Related show

Commit Message

Abel Vesa March 25, 2019, 1:59 p.m. UTC
Add suspend/resume pm ops to the pinctrl i.MX8MQ driver.
Make the suspend late and the resume early since some of the
pins might be needed active very late.
These call the pinctrl-imx generic handlers.

Signed-off-by: Abel Vesa <abel.vesa@nxp.com>
---
 drivers/pinctrl/freescale/pinctrl-imx8mq.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

Comments

Dong Aisheng April 4, 2019, 6:51 a.m. UTC | #1
> From: Abel Vesa
> Sent: Monday, March 25, 2019 10:00 PM
> 
> Add suspend/resume pm ops to the pinctrl i.MX8MQ driver.
> Make the suspend late and the resume early since some of the pins might be
> needed active very late.
> These call the pinctrl-imx generic handlers.
> 
> Signed-off-by: Abel Vesa <abel.vesa@nxp.com>
> ---
>  drivers/pinctrl/freescale/pinctrl-imx8mq.c | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
> 
> diff --git a/drivers/pinctrl/freescale/pinctrl-imx8mq.c
> b/drivers/pinctrl/freescale/pinctrl-imx8mq.c
> index 8d39af5..2a212bc 100644
> --- a/drivers/pinctrl/freescale/pinctrl-imx8mq.c
> +++ b/drivers/pinctrl/freescale/pinctrl-imx8mq.c
> @@ -335,10 +335,26 @@ static int imx8mq_pinctrl_probe(struct
> platform_device *pdev)
>  	return imx_pinctrl_probe(pdev, &imx8mq_pinctrl_info);  }
> 
> +static int imx8mq_pinctrl_suspend(struct device *dev) {
> +	return imx_pinctrl_suspend(dev);
> +}
> +
> +static int imx8mq_pinctrl_resume(struct device *dev) {
> +	return imx_pinctrl_resume(dev);
> +}
> +
> +static const struct dev_pm_ops imx8mq_pinctrl_pm_ops = {

It looks we did not nothing special on the dev_pm_ops for platform drivers.
So do you think if we can move this into common pinctrl-imx.c?
Then platform driver does not need to implement the duplicated things?

Regards
Dong Aisheng

> +	SET_LATE_SYSTEM_SLEEP_PM_OPS(imx8mq_pinctrl_suspend,
> +					imx8mq_pinctrl_resume)
> +};
> +
>  static struct platform_driver imx8mq_pinctrl_driver = {
>  	.driver = {
>  		.name = "imx8mq-pinctrl",
>  		.of_match_table = of_match_ptr(imx8mq_pinctrl_of_match),
> +		.pm = &imx8mq_pinctrl_pm_ops,
>  		.suppress_bind_attrs = true,
>  	},
>  	.probe = imx8mq_pinctrl_probe,
> --
> 2.7.4

Patch
diff mbox series

diff --git a/drivers/pinctrl/freescale/pinctrl-imx8mq.c b/drivers/pinctrl/freescale/pinctrl-imx8mq.c
index 8d39af5..2a212bc 100644
--- a/drivers/pinctrl/freescale/pinctrl-imx8mq.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx8mq.c
@@ -335,10 +335,26 @@  static int imx8mq_pinctrl_probe(struct platform_device *pdev)
 	return imx_pinctrl_probe(pdev, &imx8mq_pinctrl_info);
 }
 
+static int imx8mq_pinctrl_suspend(struct device *dev)
+{
+	return imx_pinctrl_suspend(dev);
+}
+
+static int imx8mq_pinctrl_resume(struct device *dev)
+{
+	return imx_pinctrl_resume(dev);
+}
+
+static const struct dev_pm_ops imx8mq_pinctrl_pm_ops = {
+	SET_LATE_SYSTEM_SLEEP_PM_OPS(imx8mq_pinctrl_suspend,
+					imx8mq_pinctrl_resume)
+};
+
 static struct platform_driver imx8mq_pinctrl_driver = {
 	.driver = {
 		.name = "imx8mq-pinctrl",
 		.of_match_table = of_match_ptr(imx8mq_pinctrl_of_match),
+		.pm = &imx8mq_pinctrl_pm_ops,
 		.suppress_bind_attrs = true,
 	},
 	.probe = imx8mq_pinctrl_probe,