[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b6f7c310-562a-494e-a1da-05a28666e1f0@roeck-us.net>
Date: Thu, 24 Apr 2025 05:22:13 -0700
From: Guenter Roeck <linux@...ck-us.net>
To: "Yo-Jung (Leo) Lin" <leo.lin@...onical.com>,
Jean Delvare <jdelvare@...e.com>, Andi Shyti <andi.shyti@...nel.org>,
Wolfram Sang <wsa+renesas@...g-engineering.com>
Cc: "Chia-Lin Kao (AceLan)" <acelan.kao@...onical.com>,
linux-i2c@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] i2c: smbus: pass write disabling bit to spd
instantiating function
On 4/23/25 20:35, Yo-Jung (Leo) Lin wrote:
> Some SMBus controllers may restrict writes to addresses where SPD
> sensors may reside. This may lead to some SPD sensors not functioning
> correctly, and might need extra handling. Pass this extra context to
> i2c_register_spd() so that it could be handled accordingly.
>
> Signed-off-by: Yo-Jung (Leo) Lin <leo.lin@...onical.com>
Reviewed-by: Guenter Roeck <linux@...ck-us.net>
> ---
> drivers/i2c/busses/i2c-i801.c | 6 ++++--
> drivers/i2c/busses/i2c-piix4.c | 2 +-
> drivers/i2c/i2c-smbus.c | 2 +-
> include/linux/i2c-smbus.h | 4 ++--
> 4 files changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c
> index 48e1af544b75..95619eb5e798 100644
> --- a/drivers/i2c/busses/i2c-i801.c
> +++ b/drivers/i2c/busses/i2c-i801.c
> @@ -1180,7 +1180,8 @@ static void i801_probe_optional_targets(struct i801_priv *priv)
> #ifdef CONFIG_I2C_I801_MUX
> if (!priv->mux_pdev)
> #endif
> - i2c_register_spd(&priv->adapter);
> + i2c_register_spd(&priv->adapter,
> + !!(priv->original_hstcfg & SMBHSTCFG_SPD_WD));
> }
> #else
> static void __init input_apanel_init(void) {}
> @@ -1283,7 +1284,8 @@ static int i801_notifier_call(struct notifier_block *nb, unsigned long action,
> return NOTIFY_DONE;
>
> /* Call i2c_register_spd for muxed child segments */
> - i2c_register_spd(to_i2c_adapter(dev));
> + i2c_register_spd(to_i2c_adapter(dev),
> + !!(priv->original_hstcfg & SMBHSTCFG_SPD_WD));
>
> return NOTIFY_OK;
> }
> diff --git a/drivers/i2c/busses/i2c-piix4.c b/drivers/i2c/busses/i2c-piix4.c
> index dd75916157f0..085d121a88f6 100644
> --- a/drivers/i2c/busses/i2c-piix4.c
> +++ b/drivers/i2c/busses/i2c-piix4.c
> @@ -971,7 +971,7 @@ static int piix4_add_adapter(struct pci_dev *dev, unsigned short smba,
> * This would allow the ee1004 to be probed incorrectly.
> */
> if (port == 0)
> - i2c_register_spd(adap);
> + i2c_register_spd(adap, false);
>
> *padap = adap;
> return 0;
> diff --git a/drivers/i2c/i2c-smbus.c b/drivers/i2c/i2c-smbus.c
> index 7d40e7aa3799..97e833895dd7 100644
> --- a/drivers/i2c/i2c-smbus.c
> +++ b/drivers/i2c/i2c-smbus.c
> @@ -372,7 +372,7 @@ EXPORT_SYMBOL_GPL(i2c_free_slave_host_notify_device);
> * - Only works on systems with 1 to 8 memory slots
> */
> #if IS_ENABLED(CONFIG_DMI)
> -void i2c_register_spd(struct i2c_adapter *adap)
> +void i2c_register_spd(struct i2c_adapter *adap, bool write_disabled)
> {
> int n, slot_count = 0, dimm_count = 0;
> u16 handle;
> diff --git a/include/linux/i2c-smbus.h b/include/linux/i2c-smbus.h
> index ced1c6ead52a..57bb3154eb47 100644
> --- a/include/linux/i2c-smbus.h
> +++ b/include/linux/i2c-smbus.h
> @@ -44,9 +44,9 @@ static inline void i2c_free_slave_host_notify_device(struct i2c_client *client)
> #endif
>
> #if IS_ENABLED(CONFIG_I2C_SMBUS) && IS_ENABLED(CONFIG_DMI)
> -void i2c_register_spd(struct i2c_adapter *adap);
> +void i2c_register_spd(struct i2c_adapter *adap, bool write_disabled);
> #else
> -static inline void i2c_register_spd(struct i2c_adapter *adap) { }
> +static inline void i2c_register_spd(struct i2c_adapter *adap, bool write_disabled) { }
> #endif
>
> #endif /* _LINUX_I2C_SMBUS_H */
>
Powered by blists - more mailing lists