mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Kurt Borja <kuurtb@gmail.com>,
	TINSAE TADESSE <tinsaetadesse2015@gmail.com>
Cc: Armin Wolf <W_Armin@gmx.de>,
	"linux-hwmon@vger.kernel.org" <linux-hwmon@vger.kernel.org>,
	linux-kernel@vger.kernel.org, Guenter Roeck <groeck7@gmail.com>
Subject: Re: [PATCH 1/3] hwmon: spd5118: Do not fail resume on temporary I2C errors
Date: Fri, 30 Jan 2026 18:06:59 -0800	[thread overview]
Message-ID: <516f5dfd-3e84-4938-bfea-5c52e884f1af@roeck-us.net> (raw)
In-Reply-To: <DG2EEU6SXFFE.20DWQUV1BW9QW@gmail.com>

On 1/30/26 17:54, Kurt Borja wrote:
> On Fri Jan 30, 2026 at 8:21 PM -05, Guenter Roeck wrote:
>> Hi Kurt,
>>
>> On 1/30/26 16:55, Kurt Borja wrote:
>>> On Tue Jan 27, 2026 at 6:41 PM -05, Guenter Roeck wrote:
>>>> Hi,
>>>>
>>>> On Tue, Jan 27, 2026 at 10:23:24PM +0300, TINSAE TADESSE wrote:
>>>>>
>>>>> Disabling CONFIG_SENSORS_SPD5118_DETECT completely avoids the issue on
>>>>> affected platforms,
>>>>> even without any code changes. This confirms that the failures are
>>>>> triggered specifically by automatic
>>>>> SPD5118 instantiation on systems where the i801 controller enforces
>>>>> SPD Write Disable.
>>>>
>>>> Thanks for confirming. Can you try if the patch below fixes the problem ?
>>>> It is a wild shot, but it might be worth a try.
>>>>
>>>> Thanks,
>>>> Guenter
>>>>
>>>> ---
>>>>   From b44c31c2c779a67827e3144b818cf21f5efacea1 Mon Sep 17 00:00:00 2001
>>>> From: Guenter Roeck <linux@roeck-us.net>
>>>> Date: Tue, 27 Jan 2026 15:32:32 -0800
>>>> Subject: [PATCH] hwmon: (spd5118) Explicitly enable temperature sensor in
>>>>    probe function
>>>>
>>>> Instantiating the driver does not make sense if the temperature sensor
>>>> is disabled, so enable it unconditionally in the probe function.
>>>>
>>>> If that fails, write operations to the chip are likely disabled
>>>> by the I2C controller. Bail out with an eror message if that happens.
>>>>
>>>> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
>>>> ---
>>>>    drivers/hwmon/spd5118.c | 5 +++++
>>>>    1 file changed, 5 insertions(+)
>>>>
>>>> diff --git a/drivers/hwmon/spd5118.c b/drivers/hwmon/spd5118.c
>>>> index 5da44571b6a0..3e0e780014f9 100644
>>>> --- a/drivers/hwmon/spd5118.c
>>>> +++ b/drivers/hwmon/spd5118.c
>>>> @@ -552,6 +552,11 @@ static int spd5118_common_probe(struct device *dev, struct regmap *regmap,
>>>>    	if (!spd5118_vendor_valid(bank, vendor))
>>>>    		return -ENODEV;
>>>>    
>>>> +	if (regmap_update_bits(regmap, SPD5118_REG_TEMP_CONFIG,
>>>> +			       SPD5118_TS_DISABLE, 0) < 0)
>>>> +		return dev_err_probe(dev, -ENODEV,
>>>> +				     "Failed to enable temperature sensor\n");
>>>> +
>>>>    	data->regmap = regmap;
>>>>    	mutex_init(&data->nvmem_lock);
>>>>    	dev_set_drvdata(dev, data);
>>>
>>> Hi Guenter,
>>>
>>> I'm experiencing the same issue reported in this thread. This patch does
>>> not fix it for me :(.
>>>
>> Thanks for a note. Well, it was a wild shot, so it is not entirely surprising
>> that it didn't work. I suspect regmap doesn't actually write the register
>> if the value is unchanged. Another option might be to try writing a value
> 
> I tried forcing the write with
> 
> 	bool change;
> 	err = regmap_update_bits_base(regmap, SPD5118_REG_TEMP_CONFIG,
> 				      SPD5118_TS_DISABLE, 0, &change, false, true);
> 	if (err)
> 		return dev_err_probe(dev, err,
> 				     "Failed to enable temperature sensor\n");
> 
> and it fails to probe
> 
> 	spd5118 17-0051: error -ENXIO: Failed to enable temperature sensor
> 	spd5118 17-0053: error -ENXIO: Failed to enable temperature sensor
> 

Nice, I didn't know about that API function. And, even better, 'change' can be NULL.

> 
>> (e.g., 0x01) into register 0x13 or 0x14. Those are "clear status" registers.
>> If that fails, we would know that the chip is write protected.
> 
> I'll try this later too.
> 

Don't bother. I'll write up a patch using regmap_update_bits_base().

Thanks!
Guenter

>>
>> Thanks,
>> Guenter
> 


  reply	other threads:[~2026-01-31  2:07 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-10 17:19 Tinsae Tadesse
2026-01-10 17:19 ` [PATCH 2/3] hwmon: spd5118: Retry temperature reads after " Tinsae Tadesse
2026-01-12 16:35   ` Guenter Roeck
2026-01-10 17:19 ` [PATCH 3/3] hwmon: spd5118: Avoid hardware access during suspend and resume Tinsae Tadesse
2026-01-12 14:42   ` Guenter Roeck
2026-01-10 22:27 ` [PATCH 1/3] hwmon: spd5118: Do not fail resume on temporary I2C errors Armin Wolf
2026-01-12 11:48   ` TINSAE TADESSE
2026-01-12 17:41     ` Armin Wolf
2026-01-12 18:07       ` Guenter Roeck
2026-01-12 14:37   ` TINSAE TADESSE
2026-01-12 16:36   ` Guenter Roeck
2026-01-12 17:46     ` Armin Wolf
2026-01-12 18:17       ` Guenter Roeck
2026-01-12 18:22         ` Armin Wolf
2026-01-12 19:11           ` Guenter Roeck
2026-01-13 19:33             ` TINSAE TADESSE
2026-01-13 19:16           ` TINSAE TADESSE
2026-01-13 23:58             ` Armin Wolf
2026-01-12 16:30 ` Guenter Roeck
2026-01-13 19:15   ` TINSAE TADESSE
2026-01-13 23:46     ` Guenter Roeck
     [not found]       ` <CAJ12PfP+Dbxd5fFAx-zAaJQ0B53Z1nXAiPbkmivk6smKajf1=Q@mail.gmail.com>
2026-01-14 14:23         ` Guenter Roeck
2026-01-15 13:50           ` TINSAE TADESSE
2026-01-16  6:24             ` Guenter Roeck
2026-01-24 14:45               ` TINSAE TADESSE
2026-01-24 19:11                 ` Armin Wolf
2026-01-25 22:36                   ` Guenter Roeck
2026-01-26  9:40                     ` Armin Wolf
2026-01-26 15:20                       ` Guenter Roeck
2026-01-27 10:35                     ` TINSAE TADESSE
2026-01-27 14:33                       ` Guenter Roeck
2026-01-27 19:23                         ` TINSAE TADESSE
2026-01-27 23:41                           ` Guenter Roeck
2026-01-31  0:55                             ` Kurt Borja
2026-01-31  1:21                               ` Guenter Roeck
2026-01-31  1:54                                 ` Kurt Borja
2026-01-31  2:06                                   ` Guenter Roeck [this message]
2026-01-31  9:22                                     ` Armin Wolf
2026-01-31 11:26                             ` TINSAE TADESSE
2026-01-31 19:50                       ` TINSAE TADESSE
2026-02-01  1:25                         ` Guenter Roeck
2026-02-01  7:30                           ` TINSAE TADESSE
2026-02-01 15:21                             ` Guenter Roeck
2026-02-02  7:03                               ` TINSAE TADESSE
2026-01-27 10:30                   ` TINSAE TADESSE

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=516f5dfd-3e84-4938-bfea-5c52e884f1af@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=W_Armin@gmx.de \
    --cc=groeck7@gmail.com \
    --cc=kuurtb@gmail.com \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tinsaetadesse2015@gmail.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®