diff mbox series

[v2] i2c: imx: switch different pinctrl state in different system power status

Message ID 20241218044114.143358-1-carlos.song@nxp.com
State New
Headers show
Series [v2] i2c: imx: switch different pinctrl state in different system power status | expand

Commit Message

Carlos Song Dec. 18, 2024, 4:41 a.m. UTC
Switch different pinctrl state in different system power status.

Signed-off-by: Carlos Song <carlos.song@nxp.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
---
Change for V2:
- Add Frank reviewed-by. No code change.
---
 drivers/i2c/busses/i2c-imx.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Oleksij Rempel Dec. 19, 2024, 6:02 a.m. UTC | #1
On Wed, Dec 18, 2024 at 12:41:14PM +0800, Carlos Song wrote:
> Switch different pinctrl state in different system power status.
> 
> Signed-off-by: Carlos Song <carlos.song@nxp.com>
> Reviewed-by: Frank Li <Frank.Li@nxp.com>
> ---
> Change for V2:
> - Add Frank reviewed-by. No code change.
> ---
>  drivers/i2c/busses/i2c-imx.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
> index b6ed270dd04b..350346a7892c 100644
> --- a/drivers/i2c/busses/i2c-imx.c
> +++ b/drivers/i2c/busses/i2c-imx.c
> @@ -1871,6 +1871,7 @@ static int i2c_imx_runtime_suspend(struct device *dev)
>  	struct imx_i2c_struct *i2c_imx = dev_get_drvdata(dev);
>  
>  	clk_disable(i2c_imx->clk);
> +	pinctrl_pm_select_sleep_state(dev);
>  
>  	return 0;
>  }
> @@ -1880,6 +1881,7 @@ static int i2c_imx_runtime_resume(struct device *dev)
>  	struct imx_i2c_struct *i2c_imx = dev_get_drvdata(dev);
>  	int ret;
>  
> +	pinctrl_pm_select_default_state(dev);

Both pinctrl_pm_select_sleep_state() and
pinctrl_pm_select_default_state() may fail. Please use return values.
Carlos Song Dec. 19, 2024, 7:02 a.m. UTC | #2
Thank you! I will fix it at V3.

> -----Original Message-----
> From: Oleksij Rempel <o.rempel@pengutronix.de>
> Sent: Thursday, December 19, 2024 2:02 PM
> To: Carlos Song <carlos.song@nxp.com>
> Cc: andi.shyti@kernel.org; Frank Li <frank.li@nxp.com>;
> kernel@pengutronix.de; shawnguo@kernel.org; s.hauer@pengutronix.de;
> festevam@gmail.com; linux-i2c@vger.kernel.org; imx@lists.linux.dev;
> linux-arm-kernel@lists.infradead.org; linux-kernel@vger.kernel.org
> Subject: [EXT] Re: [PATCH v2] i2c: imx: switch different pinctrl state in different
> system power status
>
> Caution: This is an external email. Please take care when clicking links or
> opening attachments. When in doubt, report the message using the 'Report this
> email' button
>
>
> On Wed, Dec 18, 2024 at 12:41:14PM +0800, Carlos Song wrote:
> > Switch different pinctrl state in different system power status.
> >
> > Signed-off-by: Carlos Song <carlos.song@nxp.com>
> > Reviewed-by: Frank Li <Frank.Li@nxp.com>
> > ---
> > Change for V2:
> > - Add Frank reviewed-by. No code change.
> > ---
> >  drivers/i2c/busses/i2c-imx.c | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/drivers/i2c/busses/i2c-imx.c
> > b/drivers/i2c/busses/i2c-imx.c index b6ed270dd04b..350346a7892c 100644
> > --- a/drivers/i2c/busses/i2c-imx.c
> > +++ b/drivers/i2c/busses/i2c-imx.c
> > @@ -1871,6 +1871,7 @@ static int i2c_imx_runtime_suspend(struct device
> *dev)
> >       struct imx_i2c_struct *i2c_imx = dev_get_drvdata(dev);
> >
> >       clk_disable(i2c_imx->clk);
> > +     pinctrl_pm_select_sleep_state(dev);
> >
> >       return 0;
> >  }
> > @@ -1880,6 +1881,7 @@ static int i2c_imx_runtime_resume(struct device
> *dev)
> >       struct imx_i2c_struct *i2c_imx = dev_get_drvdata(dev);
> >       int ret;
> >
> > +     pinctrl_pm_select_default_state(dev);
>
> Both pinctrl_pm_select_sleep_state() and
> pinctrl_pm_select_default_state() may fail. Please use return values.
>
> --
> Pengutronix e.K.                           |
> |
> Steuerwalder Str. 21                       |
> http://www.pen/
> gutronix.de%2F&data=05%7C02%7Ccarlos.song%40nxp.com%7C556bac4a4d18
> 45fe9c6e08dd1ff2b262%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7
> C638701849411172324%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOn
> RydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3
> D%3D%7C0%7C%7C%7C&sdata=Gd6mIwBSMo6f03z3rVIInaPZXQXhCeyFEHYYl
> ctBPZQ%3D&reserved=0  |
> 31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0
> |
> Amtsgericht Hildesheim, HRA 2686           | Fax:
> +49-5121-206917-5555 |
diff mbox series

Patch

diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
index b6ed270dd04b..350346a7892c 100644
--- a/drivers/i2c/busses/i2c-imx.c
+++ b/drivers/i2c/busses/i2c-imx.c
@@ -1871,6 +1871,7 @@  static int i2c_imx_runtime_suspend(struct device *dev)
 	struct imx_i2c_struct *i2c_imx = dev_get_drvdata(dev);
 
 	clk_disable(i2c_imx->clk);
+	pinctrl_pm_select_sleep_state(dev);
 
 	return 0;
 }
@@ -1880,6 +1881,7 @@  static int i2c_imx_runtime_resume(struct device *dev)
 	struct imx_i2c_struct *i2c_imx = dev_get_drvdata(dev);
 	int ret;
 
+	pinctrl_pm_select_default_state(dev);
 	ret = clk_enable(i2c_imx->clk);
 	if (ret)
 		dev_err(dev, "can't enable I2C clock, ret=%d\n", ret);