Re: [PATCH v2 0/4] i2c: Support i2c_register_spd() on multiplexed bus segments

Heiner Kallweit
2024-02-22T22:05:12Z

On 21.02.2024 18:19, Wolfram Sang wrote:
> Hi Heiner,
>
>> Note: i801 creates the mux platform device, loading and probing of the
>> mux driver may be asynchronous. Therefore we can't call i2c_register_spd()
>> for the muxed segments from i801. Instead we have to add a flag to the
>> platform data, so that the mux driver knows it's supposed to call
>> i2c_register_spd().
>
> Has it been considered to use a bus_notifier and check for
> BUS_NOTIFY_BOUND_DRIVER?
>
I checked, and it looks like this:
Best would be to check for binding gpio mux driver to platform device
"i2c-mux-gpio" has completed. But the bus notification doesn't work for
platform devices.
Instead we can check for the BUS_NOTIFY_ADD_DEVICE event for the
child i2c adapters. This *should* work.
I tested that the events are properly recognized. However I don't have
hw with a muxed SMBUS, so I can't test the actual functionality.
I'll submit a RFC patch.

> I'd really like to keep it inside i801 if possible. First, all these
> flags in mux drivers only for this corner case are relatively intrusive.
> Second, selecting SMBUS for I2C_MUX is also a tad too much for my taste.
>
> I understand that removing CLASS_SPD is a worthy goal. So, if all fails
> we could still try this. But I'd think with bus_notifiers it should be
> possible to keep it all in i801.
>
> Do you think this could work?
>
> Happy hacking,
>
> Wolfram
>
Heiner