[PATCH v7 1/5] i2c: core: add callback to change bus frequency
Andy Shevchenko
andriy.shevchenko at intel.com
Mon Feb 23 06:53:56 PST 2026
On Mon, Feb 23, 2026 at 03:33: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.
>
> As a side effect, several bus drivers keep the bus speed in a
> private structure and can now have this value stored in a uniform way
> instead.
...
> + /*
> + * If the adapter is a root adapter without set_clk_freq implemented, this feature is not
> + * supported
> + */
> + if (!i2c_parent_is_i2c_adapter(adapter))
> + return -EOPNOTSUPP;
> +
> + /* Update the clock_hz for non-root adapters, even if set_clk_freq is not implemented,
> + * to allow * the clock frequency to be propagated to root adapters that do support it.
> + */
/*
* Please, keep the style of multi-line comment consistent
* and as per above.
*/
> + adapter->clock_hz = clock_hz;
> + return 0;
> +}
--
With Best Regards,
Andy Shevchenko
More information about the linux-arm-kernel
mailing list