public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Marcus Folkesson <marcus.folkesson@gmail.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 1/5] i2c: core: add callback to change bus frequency
Date: Fri, 13 Feb 2026 12:14:04 +0100	[thread overview]
Message-ID: <aY8HfN3c3qcVbOJj@black.igk.intel.com> (raw)
In-Reply-To: <20260213-i2c-mux-v5-1-fb2cbf9979b3@gmail.com>

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)?

...

> +static inline int
> +i2c_adapter_set_clk_freq(struct i2c_adapter *adapter, u32 clock_hz)
> +{
> +	int ret = -EOPNOTSUPP;
> +
> +	if (adapter->set_clk_freq)
> +		ret = adapter->set_clk_freq(adapter, clock_hz);
> +
> +	return ret;

The 'ret' is redundant and can be dropped completely. This makes the function
2LoCs shorter.

> +}

-- 
With Best Regards,
Andy Shevchenko




  reply	other threads:[~2026-02-13 11:14 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 [this message]
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
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=aY8HfN3c3qcVbOJj@black.igk.intel.com \
    --to=andriy.shevchenko@intel.com \
    --cc=andi.shyti@kernel.org \
    --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 \
    --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