RE: [EXT] Re: [PATCH 4/5] i2c: imx-lpi2c: improve i2c driver probe priority

From: Carlos Song
Date: Fri Aug 30 2024 - 04:53:16 EST




> -----Original Message-----
> From: Stefan Wahren <wahrenst@xxxxxxx>
> Sent: Thursday, August 29, 2024 6:16 PM
> To: Carlos Song <carlos.song@xxxxxxx>; Aisheng Dong
> <aisheng.dong@xxxxxxx>; andi.shyti@xxxxxxxxxx; shawnguo@xxxxxxxxxx;
> s.hauer@xxxxxxxxxxxxxx; kernel@xxxxxxxxxxxxxx; festevam@xxxxxxxxx
> Cc: linux-i2c@xxxxxxxxxxxxxxx; imx@xxxxxxxxxxxxxxx;
> linux-arm-kernel@xxxxxxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx
> 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@xxxxxxx:
> > From: Carlos Song <carlos.song@xxxxxxx>
> >
> > 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@xxxxxxx>
> > Signed-off-by: Frank Li <Frank.Li@xxxxxxx>
> > ---
> > 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@xxxxxxx>");
> > MODULE_DESCRIPTION("I2C adapter driver for LPI2C bus");