From: Wolfram Sang <wsa+renesas@sang-engineering.com>
To: Marcus Folkesson <marcus.folkesson@gmail.com>
Cc: Peter Rosin <peda@axentia.se>,
Michael Hennerich <michael.hennerich@analog.com>,
Bartosz Golaszewski <brgl@bgdev.pl>,
Andi Shyti <andi.shyti@kernel.org>,
Andy Shevchenko <andriy.shevchenko@intel.com>,
Bartosz Golaszewski <brgl@kernel.org>,
linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v9 1/5] i2c: core: add callback to change bus frequency
Date: Tue, 26 May 2026 21:47:47 +0200 [thread overview]
Message-ID: <ahX44_rzaRlTLSLU@shikoro> (raw)
In-Reply-To: <20260324-i2c-mux-v9-1-5292b0608243@gmail.com>
Hi Marcus,
finally I found some time... thank you for your patience!
Some comments here, but I have high level questions first to be
discussed in patch 5. Maybe we should start there...
> + int (*set_clk_freq)(struct i2c_adapter *adap, u32 clock_hz); /* Optional */
Shouldn't this rather go into 'struct i2c_algorithm'?
> +static inline int
> +__i2c_adapter_set_clk_freq(struct i2c_adapter *adapter, u32 clock_hz)
> +{
> + if (adapter->set_clk_freq)
> + return adapter->set_clk_freq(adapter, clock_hz);
So, Sashiko mentions[1] that setting 'adapter->clock_hz' below is not
executed. This is fine in my book because the requested new rate might
not be the actually used rate. However, I agree that it must be
documented that the callback is required to set 'clock_hz'. Or maybe
even better, the callback should return the newly set value and this
function then updates the variable?
[1] https://sashiko.dev/#/patchset/20260324-i2c-mux-v9-0-5292b0608243%40gmail.com
> +
> + /*
> + * 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.
> + */
> + adapter->clock_hz = clock_hz;
> + return 0;
So, Sashiko is IMO correct with asking what happens if setting the new
freq in the root adapter fails? There is no path to restore the old
values for the children then, or did I miss it?
Happy hacking,
Wolfram
next prev parent reply other threads:[~2026-05-26 19:48 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-24 13:54 [PATCH v9 0/5] I2C Mux per channel bus speed Marcus Folkesson
2026-03-24 13:54 ` [PATCH v9 1/5] i2c: core: add callback to change bus frequency Marcus Folkesson
2026-05-26 19:47 ` Wolfram Sang [this message]
2026-03-24 13:54 ` [PATCH v9 2/5] i2c: mux: add support for per channel " Marcus Folkesson
2026-03-24 14:10 ` Andy Shevchenko
2026-03-26 11:39 ` Marcus Folkesson
2026-03-24 13:54 ` [PATCH v9 3/5] i2c: davinci: calculate bus freq from Hz instead of kHz Marcus Folkesson
2026-03-24 13:54 ` [PATCH v9 4/5] i2c: davinci: add support for setting bus frequency Marcus Folkesson
2026-03-24 13:54 ` [PATCH v9 5/5] docs: i2c: i2c-topology: add section about bus speed Marcus Folkesson
2026-05-26 19:48 ` Wolfram Sang
2026-03-26 12:17 ` [PATCH v9 0/5] I2C Mux per channel " Marcus Folkesson
2026-04-13 7:45 ` Marcus Folkesson
2026-05-08 13:14 ` Marcus Folkesson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ahX44_rzaRlTLSLU@shikoro \
--to=wsa+renesas@sang-engineering.com \
--cc=andi.shyti@kernel.org \
--cc=andriy.shevchenko@intel.com \
--cc=brgl@bgdev.pl \
--cc=brgl@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marcus.folkesson@gmail.com \
--cc=michael.hennerich@analog.com \
--cc=peda@axentia.se \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox