From: Heiner Kallweit <hkallweit1@gmail.com>
To: Jean Delvare <jdelvare@suse.com>,
Andi Shyti <andi.shyti@kernel.org>, Peter Rosin <peda@axentia.se>,
Wolfram Sang <wsa@kernel.org>,
Peter Korsgaard <peter.korsgaard@barco.com>
Cc: "linux-i2c@vger.kernel.org" <linux-i2c@vger.kernel.org>
Subject: [PATCH v2 2/4] i2c: mux: add basic support for calling i2c_register_spd on muxed bus segments
Date: Sat, 13 Jan 2024 12:27:16 +0100 [thread overview]
Message-ID: <1fb4eb9e-6c7a-4c0c-b90e-4f53dc999b1c@gmail.com> (raw)
In-Reply-To: <9f37f64e-f5b8-4928-8716-6d2846c2688a@gmail.com>
This extension allows mux drivers to instruct i2c_mux_add_adapter to
call i2c_register_spd. First user of this feature will be gpio mux.
Note: In order to avoid a link error we have to ensure that I2C_SMBUS=y
if I2C_MUX=y.
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
v2:
- Select I2C_SMBUS to avoid a link error if I2C_MUX=y and I2C_SMBUS=m
---
drivers/i2c/Kconfig | 1 +
drivers/i2c/i2c-mux.c | 4 ++++
include/linux/i2c-mux.h | 1 +
3 files changed, 6 insertions(+)
diff --git a/drivers/i2c/Kconfig b/drivers/i2c/Kconfig
index 9388823bb..f57a4d3fe 100644
--- a/drivers/i2c/Kconfig
+++ b/drivers/i2c/Kconfig
@@ -61,6 +61,7 @@ config I2C_CHARDEV
config I2C_MUX
tristate "I2C bus multiplexing support"
+ select I2C_SMBUS
help
Say Y here if you want the I2C core to support the ability to
handle multiplexed I2C bus topologies, by presenting each
diff --git a/drivers/i2c/i2c-mux.c b/drivers/i2c/i2c-mux.c
index 57ff09f18..ada9c764f 100644
--- a/drivers/i2c/i2c-mux.c
+++ b/drivers/i2c/i2c-mux.c
@@ -22,6 +22,7 @@
#include <linux/acpi.h>
#include <linux/i2c.h>
#include <linux/i2c-mux.h>
+#include <linux/i2c-smbus.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/of.h>
@@ -429,6 +430,9 @@ int i2c_mux_add_adapter(struct i2c_mux_core *muxc,
dev_info(&parent->dev, "Added multiplexed i2c bus %d\n",
i2c_adapter_id(&priv->adap));
+ if (muxc->register_spd)
+ i2c_register_spd(&priv->adap);
+
muxc->adapter[muxc->num_adapters++] = &priv->adap;
return 0;
diff --git a/include/linux/i2c-mux.h b/include/linux/i2c-mux.h
index 98ef73b7c..ec51d9bc4 100644
--- a/include/linux/i2c-mux.h
+++ b/include/linux/i2c-mux.h
@@ -21,6 +21,7 @@ struct i2c_mux_core {
unsigned int mux_locked:1;
unsigned int arbitrator:1;
unsigned int gate:1;
+ unsigned int register_spd:1;
void *priv;
--
2.43.0
next prev parent reply other threads:[~2024-01-13 11:27 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-13 11:23 [PATCH v2 0/4] i2c: Support i2c_register_spd() on multiplexed bus segments Heiner Kallweit
2024-01-13 11:25 ` [PATCH v2 1/4] i2c: smbus: Prepare i2c_register_spd for usage on muxed segments Heiner Kallweit
2024-01-13 11:27 ` Heiner Kallweit [this message]
2024-01-13 11:28 ` [PATCH v2 3/4] i2c: mux: gpio: Allow to call i2c_register_spd on a muxed segment Heiner Kallweit
2024-01-13 11:28 ` [PATCH v2 4/4] i2c: i801: Call i2c_register_spd() on muxed bus segments Heiner Kallweit
2024-01-26 21:15 ` [PATCH v2 0/4] i2c: Support i2c_register_spd() on multiplexed " Heiner Kallweit
2024-02-21 17:19 ` Wolfram Sang
2024-02-21 19:46 ` Heiner Kallweit
2024-02-22 22:05 ` Heiner Kallweit
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=1fb4eb9e-6c7a-4c0c-b90e-4f53dc999b1c@gmail.com \
--to=hkallweit1@gmail.com \
--cc=andi.shyti@kernel.org \
--cc=jdelvare@suse.com \
--cc=linux-i2c@vger.kernel.org \
--cc=peda@axentia.se \
--cc=peter.korsgaard@barco.com \
--cc=wsa@kernel.org \
/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