From: Marcus Folkesson <marcus.folkesson@gmail.com>
To: Andy Shevchenko <andriy.shevchenko@intel.com>
Cc: Wolfram Sang <wsa+renesas@sang-engineering.com>,
Peter Rosin <peda@axentia.se>,
Michael Hennerich <michael.hennerich@analog.com>,
Bartosz Golaszewski <brgl@bgdev.pl>,
Andi Shyti <andi.shyti@kernel.org>,
Bartosz Golaszewski <brgl@kernel.org>,
linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v5 2/5] i2c: mux: add support for per channel bus frequency
Date: Sat, 14 Feb 2026 13:30:29 +0100 [thread overview]
Message-ID: <aZBq5QGHFcQYAONv@gmail.com> (raw)
In-Reply-To: <aY8JRikJpM4v5BcM@black.igk.intel.com>
[-- Attachment #1: Type: text/plain, Size: 2429 bytes --]
Hi Andy!
Thank you for your comments, good and observant as usual :-)
On Fri, Feb 13, 2026 at 12:21:42PM +0100, Andy Shevchenko wrote:
[...]
> > +static int i2c_mux_select_chan(struct i2c_adapter *adap, u32 chan_id)
> > +{
> > + struct i2c_mux_priv *priv = adap->algo_data;
> > + struct i2c_mux_core *muxc = priv->muxc;
> > + struct i2c_adapter *parent = muxc->parent;
> > + struct i2c_mux_core *mux_locked_ancestor = NULL;
> > + struct i2c_adapter *root;
> > + int ret;
> > +
> > + if (priv->adap.clock_hz && priv->adap.clock_hz != parent->clock_hz) {
> > + mux_locked_ancestor = i2c_mux_topmost_mux_locked(adap);
> > + root = i2c_root_adapter(&adap->dev);
> > +
> > + /*
> > + * If there's a mux-locked mux in our ancestry, lock the parent
> > + * of the topmost one. Mux-locked muxes don't propagate locking
> > + * to their parents, so we must explicitly acquire the lock above
> > + * the highest mux-locked ancestor to reach the root adapter.
> > + */
> > + if (mux_locked_ancestor)
> > + i2c_lock_bus(mux_locked_ancestor->parent, I2C_LOCK_ROOT_ADAPTER);
> > +
> > + ret = i2c_adapter_set_clk_freq(root, priv->adap.clock_hz);
> > +
> > + if (mux_locked_ancestor)
> > + i2c_unlock_bus(mux_locked_ancestor->parent, I2C_LOCK_ROOT_ADAPTER);
>
> > + if (ret < 0) {
>
> Would it (ever) have any positive returned values?
> Ditto for other similar cases.
Nope, I will change to if (ret).
>
> > + dev_err(&adap->dev,
> > + "Failed to set clock frequency %dHz on root adapter %s: %d\n",
> > + priv->adap.clock_hz, root->name, ret);
> > +
> > + return ret;
> > + }
> > + }
> > +
> > + return muxc->select(muxc, priv->chan_id);
> > +}
>
> ...
>
> > @@ -223,6 +317,7 @@ struct i2c_adapter *i2c_root_adapter(struct device *dev)
> > }
> > EXPORT_SYMBOL_GPL(i2c_root_adapter);
> >
> > +
> > struct i2c_mux_core *i2c_mux_alloc(struct i2c_adapter *parent,
>
> Stray and unneeded change.
I will remove it.
>
> > struct device *dev, int max_adapters,
> > int sizeof_priv, u32 flags,
>
> ...
>
> > + of_property_read_u32(child, "clock-frequency", &priv->adap.clock_hz);
>
> Why OF-centric APIs? Muxes may and do appear on other systems as well.
> Okay, this function seems fully OF-centric :-(
:-/
>
> --
> With Best Regards,
> Andy Shevchenko
>
Best regards,
Marcus Folkesson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2026-02-14 12:30 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-13 11:06 [PATCH v5 0/5] I2C Mux per channel bus speed Marcus Folkesson
2026-02-13 11:06 ` [PATCH v5 1/5] i2c: core: add callback to change bus frequency Marcus Folkesson
2026-02-13 11:14 ` Andy Shevchenko
2026-02-16 9:22 ` Marcus Folkesson
2026-02-16 9:31 ` Andy Shevchenko
2026-02-13 11:06 ` [PATCH v5 2/5] i2c: mux: add support for per channel " Marcus Folkesson
2026-02-13 11:21 ` Andy Shevchenko
2026-02-14 12:30 ` Marcus Folkesson [this message]
2026-02-14 18:32 ` Andy Shevchenko
2026-02-13 11:48 ` Peter Rosin
2026-02-13 16:05 ` Marcus Folkesson
2026-02-13 16:35 ` Peter Rosin
2026-02-13 11:06 ` [PATCH v5 3/5] i2c: davinci: calculate bus freq from Hz instead of kHz Marcus Folkesson
2026-02-13 11:06 ` [PATCH v5 4/5] i2c: davinci: add support for setting bus frequency Marcus Folkesson
2026-02-13 11:06 ` [PATCH v5 5/5] docs: i2c: i2c-topology: add section about bus speed Marcus Folkesson
2026-02-13 16:07 ` kernel test robot
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=aZBq5QGHFcQYAONv@gmail.com \
--to=marcus.folkesson@gmail.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=michael.hennerich@analog.com \
--cc=peda@axentia.se \
--cc=wsa+renesas@sang-engineering.com \
/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