Re: [PATCH v5 1/5] i2c: core: add callback to change bus frequency
From: Marcus Folkesson
Date: Mon Feb 16 2026 - 04:22:17 EST
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
Attachment:
signature.asc
Description: PGP signature