[PATCH v5 1/5] i2c: core: add callback to change bus frequency

Marcus Folkesson marcus.folkesson at gmail.com
Mon Feb 16 01:22:00 PST 2026


Hi Andy,

On Fri, Feb 13, 2026 at 12:14:04PM +0100, Andy Shevchenko wrote:
> On Fri, Feb 13, 2026 at 12:06:50PM +0100, Marcus Folkesson wrote:
> > All devices on the same I2C bus share the same clock line and the bus
> > frequency has therefor be chosen so that all attached devices are able
> > to tolarate that clock rate. IOW, the bus speed must be set for the
> > slowest attached device.
> > 
> > With I2C multiplexers/switches on the other hand, it would be possible
> > to have different "domains" that runs with different speeds.
> > 
> > Prepare for such a feature by provide an optional callback function to
> > change bus frequency.
> 
> ...
> 
> > struct i2c_adapter {
> 
> > +	int clock_hz;
> 
> Why signed? Even inconsistent with the parameter of the below.
> 
> > +	int (*set_clk_freq)(struct i2c_adapter *adap, u32 clock_hz); /* Optional */
> 
> It's already a huge struct, can we make this compile-time chosen
> (when I²C muxes are not required, for example)?

Hrm, many bus drivers (k1, jz4780, stm32 to mention a few) already have
the clock value stored in their private data, so maybe it is better to
have this value in a uniform place in the i2c_adapter struct and make
those drivers use it instead?

Best regards,
Marcus Folkesson
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20260216/3fdaa747/attachment.sig>


More information about the linux-arm-kernel mailing list