public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] i2c: i801: Use I2C_CLASS_HWMON for i2c mux children
@ 2023-10-31 20:30 Heiner Kallweit
  2023-11-06 14:50 ` Jean Delvare
  0 siblings, 1 reply; 7+ messages in thread
From: Heiner Kallweit @ 2023-10-31 20:30 UTC (permalink / raw)
  To: Jean Delvare, Andi Shyti; +Cc: linux-i2c@vger.kernel.org

In case there ever should be a jc42-driven device on a muxed child bus,
we may end up with multiple logical devices, see linked discussion.

jc42 is the only remaining i2c client device driver supporting
I2C_CLASS_SPD, however it supports I2C_CLASS_HWMON too. Therefore
we can safely switch to I2C_CLASS_HWMON on the muxed child busses.
IMO it's more logical anyway that the muxed child busses support
the same class that the parent supports if it's not muxed.

This change is one further step towards removing I2C_CLASS_SPD.

Link: https://www.spinics.net/lists/linux-i2c/msg65458.html
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 drivers/i2c/busses/i2c-i801.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c
index 070999139..8c9bb2e09 100644
--- a/drivers/i2c/busses/i2c-i801.c
+++ b/drivers/i2c/busses/i2c-i801.c
@@ -1298,7 +1298,7 @@ static struct i801_mux_config i801_mux_config_asus_z8_d12 = {
 	.gpio_chip = "gpio_ich",
 	.values = { 0x02, 0x03 },
 	.n_values = 2,
-	.classes = { I2C_CLASS_SPD, I2C_CLASS_SPD },
+	.classes = { I2C_CLASS_HWMON, I2C_CLASS_HWMON },
 	.gpios = { 52, 53 },
 	.n_gpios = 2,
 };
@@ -1307,7 +1307,7 @@ static struct i801_mux_config i801_mux_config_asus_z8_d18 = {
 	.gpio_chip = "gpio_ich",
 	.values = { 0x02, 0x03, 0x01 },
 	.n_values = 3,
-	.classes = { I2C_CLASS_SPD, I2C_CLASS_SPD, I2C_CLASS_SPD },
+	.classes = { I2C_CLASS_HWMON, I2C_CLASS_HWMON, I2C_CLASS_HWMON },
 	.gpios = { 52, 53 },
 	.n_gpios = 2,
 };
@@ -1395,6 +1395,9 @@ static void i801_add_mux(struct i801_priv *priv)
 
 	mux_config = id->driver_data;
 
+	/* Parent and mux children class support must not overlap */
+	priv->adapter.class = 0;
+
 	/* Prepare the platform data */
 	memset(&gpio_data, 0, sizeof(struct i2c_mux_gpio_platform_data));
 	gpio_data.parent = priv->adapter.nr;
-- 
2.42.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-12-20 21:07 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-31 20:30 [PATCH] i2c: i801: Use I2C_CLASS_HWMON for i2c mux children Heiner Kallweit
2023-11-06 14:50 ` Jean Delvare
2023-11-07  8:04   ` Heiner Kallweit
2023-11-09 13:52     ` Jean Delvare
2023-11-09 16:34       ` Heiner Kallweit
2023-11-10 11:08         ` Jean Delvare
2023-12-20 21:07           ` Heiner Kallweit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox