mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: "Yo-Jung (Leo) Lin" <leo.lin@canonical.com>,
	Jean Delvare <jdelvare@suse.com>,
	Andi Shyti <andi.shyti@kernel.org>,
	Wolfram Sang <wsa+renesas@sang-engineering.com>
Cc: "Chia-Lin Kao (AceLan)" <acelan.kao@canonical.com>,
	linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] i2c: smbus: pass write disabling bit to spd instantiating function
Date: Thu, 24 Apr 2025 05:22:13 -0700	[thread overview]
Message-ID: <b6f7c310-562a-494e-a1da-05a28666e1f0@roeck-us.net> (raw)
In-Reply-To: <20250424-for-upstream-i801-spd5118-no-instantiate-v1-1-627398268a1f@canonical.com>

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@canonical.com>

Reviewed-by: Guenter Roeck <linux@roeck-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 */
> 


  reply	other threads:[~2025-04-24 12:22 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-24  3:35 [PATCH 0/2] i2c: i801: Don't instantiate spd5118 under SPD Write Disable Yo-Jung (Leo) Lin
2025-04-24  3:35 ` [PATCH 1/2] i2c: smbus: pass write disabling bit to spd instantiating function Yo-Jung (Leo) Lin
2025-04-24 12:22   ` Guenter Roeck [this message]
2025-04-24 13:58   ` Andi Shyti
2025-04-24  3:35 ` [PATCH 2/2] i2c: i801: don't instantiate spd5118 if SPD Write Disable is set Yo-Jung (Leo) Lin
2025-04-24 12:21   ` Guenter Roeck

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=b6f7c310-562a-494e-a1da-05a28666e1f0@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=acelan.kao@canonical.com \
    --cc=andi.shyti@kernel.org \
    --cc=jdelvare@suse.com \
    --cc=leo.lin@canonical.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --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

all inboxes | Powered by JetHome®