linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* pca953x: Probing too early
@ 2024-08-20 20:02 Fabio Estevam
  2024-08-20 20:43 ` Andy Shevchenko
                   ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Fabio Estevam @ 2024-08-20 20:02 UTC (permalink / raw)
  To: Linus Walleij, Bartosz Golaszewski, Andy Shevchenko
  Cc: open list:GPIO SUBSYSTEM,
	open list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE

Hi,

I am seeing an issue with the PCA935X driver in 6.6.41 and
6.11.0-rc4-next-20240820.

The pca953x is getting probed before its I2C parent (i2c-2):

[    1.872917] pca953x 2-0020: supply vcc not found, using dummy regulator
[    1.889195] pca953x 2-0020: using no AI
[    1.893260] pca953x 2-0020: failed writing register
[    1.898258] pca953x 2-0020: probe with driver pca953x failed with error -11
[    1.905575] i2c i2c-2: IMX I2C adapter registered

This problem is seen on a custom imx8mp board.
I am not able to reproduce it on an imx8mm-evk.

If I select the pca953x as a module or insert a delay inside its
probe() function, it probes successfully.

The drivers/gpio/gpio-pca953x.c has the following comments:

/* register after i2c postcore initcall and before
 * subsys initcalls that may rely on these GPIOs
 */
subsys_initcall(pca953x_init);

but it seems this is not happening.

I have also tried to register it like this:

--- a/drivers/gpio/gpio-pca953x.c
+++ b/drivers/gpio/gpio-pca953x.c
@@ -1369,21 +1369,7 @@ static struct i2c_driver pca953x_driver = {
        .remove         = pca953x_remove,
        .id_table       = pca953x_id,
 };
-
-static int __init pca953x_init(void)
-{
-       return i2c_add_driver(&pca953x_driver);
-}
-/* register after i2c postcore initcall and before
- * subsys initcalls that may rely on these GPIOs
- */
-subsys_initcall(pca953x_init);
-
-static void __exit pca953x_exit(void)
-{
-       i2c_del_driver(&pca953x_driver);
-}
-module_exit(pca953x_exit);
+module_i2c_driver(pca953x_driver);
)

but this did not help either.

Does anyone have any suggestions on how to fix this problem when the
pca953x driver is built-in?

Thanks,

Fabio Estevam

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2024-08-21 10:55 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-20 20:02 pca953x: Probing too early Fabio Estevam
2024-08-20 20:43 ` Andy Shevchenko
2024-08-20 20:45 ` Frank Li
2024-08-20 20:50   ` Fabio Estevam
2024-08-20 21:04     ` Frank Li
2024-08-20 21:13       ` Fabio Estevam
2024-08-20 20:47 ` Fabio Estevam
2024-08-20 21:29   ` Andrew Lunn
2024-08-20 22:07     ` Andy Shevchenko
2024-08-20 23:56       ` Fabio Estevam
2024-08-20 22:22     ` Russell King (Oracle)
2024-08-20 23:18       ` Fabio Estevam
2024-08-21  0:50         ` Fabio Estevam
2024-08-21  5:12           ` Andy Shevchenko
2024-08-21  6:04           ` Oleksij Rempel
2024-08-21 10:55             ` Fabio Estevam

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).