diff mbox series

[4/5] i2c: imx-lpi2c: improve i2c driver probe priority

Message ID 20240829093722.2714921-4-carlos.song@nxp.com
State Superseded
Delegated to: Andi Shyti
Headers show
Series [1/5] i2c: imx-lpi2c: add target mode support | expand

Commit Message

Carlos Song Aug. 29, 2024, 9:37 a.m. UTC
From: Carlos Song <carlos.song@nxp.com>

Some i2c devices such as PMICs need i2c bus available early.
Use subsys_initcall to improve i2c driver probe priority.

Signed-off-by: Carlos Song <carlos.song@nxp.com>
Signed-off-by: Frank Li <Frank.Li@nxp.com>
---
 drivers/i2c/busses/i2c-imx-lpi2c.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

Comments

Stefan Wahren Aug. 29, 2024, 10:16 a.m. UTC | #1
Hi Carlos,

Am 29.08.24 um 11:37 schrieb carlos.song@nxp.com:
> From: Carlos Song <carlos.song@nxp.com>
>
> Some i2c devices such as PMICs need i2c bus available early.
> Use subsys_initcall to improve i2c driver probe priority.
thanks for providing this patch.

Please try to be more specific, which devices/platform has been effected
by this issue. It would be nice to provide to kind of
link/reference/discussion.

Best regards
>
> Signed-off-by: Carlos Song <carlos.song@nxp.com>
> Signed-off-by: Frank Li <Frank.Li@nxp.com>
> ---
>   drivers/i2c/busses/i2c-imx-lpi2c.c | 12 +++++++++++-
>   1 file changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/i2c/busses/i2c-imx-lpi2c.c b/drivers/i2c/busses/i2c-imx-lpi2c.c
> index 0159ade235ef..210d505db76d 100644
> --- a/drivers/i2c/busses/i2c-imx-lpi2c.c
> +++ b/drivers/i2c/busses/i2c-imx-lpi2c.c
> @@ -1487,7 +1487,17 @@ static struct platform_driver lpi2c_imx_driver = {
>   	},
>   };
>
> -module_platform_driver(lpi2c_imx_driver);
> +static int __init lpi2c_imx_init(void)
> +{
> +	return platform_driver_register(&lpi2c_imx_driver);
> +}
> +subsys_initcall(lpi2c_imx_init);
> +
> +static void __exit lpi2c_imx_exit(void)
> +{
> +	platform_driver_unregister(&lpi2c_imx_driver);
> +}
> +module_exit(lpi2c_imx_exit);
>
>   MODULE_AUTHOR("Gao Pan <pandy.gao@nxp.com>");
>   MODULE_DESCRIPTION("I2C adapter driver for LPI2C bus");
Carlos Song Aug. 30, 2024, 8:53 a.m. UTC | #2
> -----Original Message-----
> From: Stefan Wahren <wahrenst@gmx.net>
> Sent: Thursday, August 29, 2024 6:16 PM
> To: Carlos Song <carlos.song@nxp.com>; Aisheng Dong
> <aisheng.dong@nxp.com>; andi.shyti@kernel.org; shawnguo@kernel.org;
> s.hauer@pengutronix.de; kernel@pengutronix.de; festevam@gmail.com
> Cc: linux-i2c@vger.kernel.org; imx@lists.linux.dev;
> linux-arm-kernel@lists.infradead.org; linux-kernel@vger.kernel.org
> Subject: [EXT] Re: [PATCH 4/5] i2c: imx-lpi2c: improve i2c driver probe priority
> 
> 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
> 
> 
> Hi Carlos,
> 
> Am 29.08.24 um 11:37 schrieb carlos.song@nxp.com:
> > From: Carlos Song <carlos.song@nxp.com>
> >
> > Some i2c devices such as PMICs need i2c bus available early.
> > Use subsys_initcall to improve i2c driver probe priority.
> thanks for providing this patch.
> 
> Please try to be more specific, which devices/platform has been effected by this
> issue. It would be nice to provide to kind of link/reference/discussion.
>
Hi, Thanks you!

Some I2C peripherals, like PMICs for voltage and power supply adjustment, need to be probed early
in the boot process to configure the system. Additionally, some boards have switches ,where some device need to be
chosen by a GPIO expander manipulating the corresponding GPIO pad. So GPIO expander also needs to be probed early
before these switched devices' driver probing. To guarantee their correct function, this patch was introduced.

This patch has been in our local repository for a long time, so I don't find any detailed documentation about its purpose or the platforms it affects.
Sorry about it. Since I2C is an important basic bus, many devices rely on it, so probed early seems reasonable, then I send it out.

> Best regards
> >
> > Signed-off-by: Carlos Song <carlos.song@nxp.com>
> > Signed-off-by: Frank Li <Frank.Li@nxp.com>
> > ---
> >   drivers/i2c/busses/i2c-imx-lpi2c.c | 12 +++++++++++-
> >   1 file changed, 11 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/i2c/busses/i2c-imx-lpi2c.c
> > b/drivers/i2c/busses/i2c-imx-lpi2c.c
> > index 0159ade235ef..210d505db76d 100644
> > --- a/drivers/i2c/busses/i2c-imx-lpi2c.c
> > +++ b/drivers/i2c/busses/i2c-imx-lpi2c.c
> > @@ -1487,7 +1487,17 @@ static struct platform_driver lpi2c_imx_driver = {
> >       },
> >   };
> >
> > -module_platform_driver(lpi2c_imx_driver);
> > +static int __init lpi2c_imx_init(void) {
> > +     return platform_driver_register(&lpi2c_imx_driver);
> > +}
> > +subsys_initcall(lpi2c_imx_init);
> > +
> > +static void __exit lpi2c_imx_exit(void) {
> > +     platform_driver_unregister(&lpi2c_imx_driver);
> > +}
> > +module_exit(lpi2c_imx_exit);
> >
> >   MODULE_AUTHOR("Gao Pan <pandy.gao@nxp.com>");
> >   MODULE_DESCRIPTION("I2C adapter driver for LPI2C bus");
diff mbox series

Patch

diff --git a/drivers/i2c/busses/i2c-imx-lpi2c.c b/drivers/i2c/busses/i2c-imx-lpi2c.c
index 0159ade235ef..210d505db76d 100644
--- a/drivers/i2c/busses/i2c-imx-lpi2c.c
+++ b/drivers/i2c/busses/i2c-imx-lpi2c.c
@@ -1487,7 +1487,17 @@  static struct platform_driver lpi2c_imx_driver = {
 	},
 };
 
-module_platform_driver(lpi2c_imx_driver);
+static int __init lpi2c_imx_init(void)
+{
+	return platform_driver_register(&lpi2c_imx_driver);
+}
+subsys_initcall(lpi2c_imx_init);
+
+static void __exit lpi2c_imx_exit(void)
+{
+	platform_driver_unregister(&lpi2c_imx_driver);
+}
+module_exit(lpi2c_imx_exit);
 
 MODULE_AUTHOR("Gao Pan <pandy.gao@nxp.com>");
 MODULE_DESCRIPTION("I2C adapter driver for LPI2C bus");