From: sashiko-bot@kernel.org
To: "John Erasmus Mari Geronimo" <johnerasmusmari.geronimo@analog.com>
Cc: linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org,
robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v4 3/3] hwmon: (lm75) add MAX31875 support
Date: Fri, 23 Oct 2026 09:27:36 +0000 [thread overview]
Message-ID: <sashiko-outbox-182591@kernel.org> (raw)
In-Reply-To: <20261023091550.1494-4-johnerasmusmari.geronimo@analog.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] hwmon: (lm75) wrong shutdown bit used for max31875 in probe and PM callbacks
--
commit 35ce43dc6fc53387d6a1aa3a7019a45b202c43af
Author: John Erasmus Mari Geronimo <johnerasmusmari.geronimo@analog.com>
hwmon: (lm75) add MAX31875 support
This commit adds support for the Analog Devices / Maxim MAX31875 I2C
temperature sensor to the lm75 hwmon driver, configuring its 16-bit
configuration register, resolution, conversion rate, and alarm bit.
> diff --git a/drivers/hwmon/lm75.c b/drivers/hwmon/lm75.c
> index 2d2d752aeac9d..349648fd08e15 100644
> --- a/drivers/hwmon/lm75.c
> +++ b/drivers/hwmon/lm75.c
[ ... ]
> @@ -222,6 +223,16 @@ static const struct lm75_params device_params[] = {
> .default_resolution = 16,
> .default_sample_time = MSEC_PER_SEC / 20,
> },
> + [max31875] = {
> + .config_reg_16bits = true,
> + .set_mask = 2 << 13, /* 10-bit resolution */
> + .clr_mask = 3 << 13 | 3 << 9, /* resolution, 4 s conversion rate */
> + .default_resolution = 10,
> + .default_sample_time = 4000,
> + .num_sample_times = 4,
> + .sample_times = (unsigned int []){ 125, 250, 1000, 4000 },
> + .alarm = true,
> + },
[Severity: Medium]
Does the driver manipulate the wrong shutdown bit for max31875 during
probe and system suspend/resume?
For devices with config_reg_16bits set to true, lm75_i2c_reg_read() and
lm75_i2c_reg_write() use i2c_smbus_read_word_data() and
i2c_smbus_write_word_data(), placing the first I2C byte (datasheet D15:D8)
into bits 7:0 of the register value and the second I2C byte (datasheet
D7:D0) into bits 15:8.
Under this layout, MAX31875 places One-Shot (D8) at BIT(0) and Shutdown
(D0) at BIT(8), whereas LM75_SHUTDOWN is defined as 0x01 (BIT(0)).
In drivers/hwmon/lm75.c, lm75_generic_probe() calls lm75_write_config():
static inline int lm75_write_config(struct lm75_data *data, u16 set_mask,
u16 clr_mask)
{
return regmap_update_bits(data->regmap, LM75_REG_CONF,
clr_mask | set_mask | LM75_SHUTDOWN, set_mask);
}
And the power management callbacks in drivers/hwmon/lm75.c also use
LM75_SHUTDOWN:
static int lm75_suspend(struct device *dev)
{
struct lm75_data *data = dev_get_drvdata(dev);
return regmap_update_bits(data->regmap, LM75_REG_CONF, LM75_SHUTDOWN, LM75_SHUTDOWN);
}
static int lm75_resume(struct device *dev)
{
struct lm75_data *data = dev_get_drvdata(dev);
return regmap_update_bits(data->regmap, LM75_REG_CONF, LM75_SHUTDOWN, 0);
}
Because device_params[max31875].clr_mask does not include BIT(8) and
lm75_write_config(), lm75_suspend(), and lm75_resume() operate on
LM75_SHUTDOWN (BIT(0)), won't system suspend and resume toggle the
One-Shot bit instead of placing the chip into shutdown mode, and won't
lm75_generic_probe() fail to clear the shutdown bit if the sensor was
already in shutdown mode prior to probe?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261023091550.1494-1-johnerasmusmari.geronimo@analog.com?part=3
next prev parent reply other threads:[~2026-10-23 9:27 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-23 9:15 [PATCH v4 0/3] hwmon: (lm75) add MAX31875 support John Erasmus Mari Geronimo
2026-10-23 9:15 ` [PATCH v4 1/3] dt-bindings: hwmon: lm75: add MAX31875 John Erasmus Mari Geronimo
2026-10-26 0:23 ` Guenter Roeck
2026-10-23 9:15 ` [PATCH v4 2/3] hwmon: (lm75) add MAX31875 documentation John Erasmus Mari Geronimo
2026-10-26 0:23 ` Guenter Roeck
2026-10-23 9:15 ` [PATCH v4 3/3] hwmon: (lm75) add MAX31875 support John Erasmus Mari Geronimo
2026-10-23 9:27 ` sashiko-bot [this message]
2026-10-26 0:24 ` 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=sashiko-outbox-182591@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=johnerasmusmari.geronimo@analog.com \
--cc=linux-hwmon@vger.kernel.org \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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