From: <Victor.Duicu@microchip.com>
To: <linux@roeck-us.net>, <robh@kernel.org>, <krzk+dt@kernel.org>,
<conor+dt@kernel.org>, <corbet@lwn.net>
Cc: <Marius.Cristea@microchip.com>, <linux-hwmon@vger.kernel.org>,
<devicetree@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<linux-doc@vger.kernel.org>
Subject: Re: [PATCH v3 2/2] hwmon: add support for MCP998X
Date: Tue, 3 Feb 2026 13:31:28 +0000 [thread overview]
Message-ID: <05303055c7fae6ee4f190b69039c3a4f0d8217fe.camel@microchip.com> (raw)
In-Reply-To: <c5e1aaeb-d832-44ac-ba19-77f162b4f31d@roeck-us.net>
On Mon, 2026-02-02 at 07:18 -0800, Guenter Roeck wrote:
>
...
> > > > + case hwmon_temp_max_hyst:
> > > > + if (channel)
> > > > + addr =
> > > > MCP9982_EXT_HIGH_LIMIT_ADDR(channel);
> > > > + else
> > > > + addr =
> > > > MCP9982_INTERNAL_HIGH_LIMIT_ADDR;
> > > > + ret = mcp9982_read_limit(priv, addr,
> > > > val);
> > > > + if (ret)
> > > > + return ret;
> > > > +
> > > > + ret = regmap_read(priv->regmap,
> > > > MCP9982_HYS_ADDR, &hyst);
> > > > + if (ret)
> > > > + return ret;
> > > > +
> > > > + *val -= (hyst & 0xFF) * 1000;
> > >
> > > What is the mask for ? The chip registers are 8 bit wide.
> > >
> > > > + *val = clamp_val(*val, -64000, 191875);
> > >
> > > Clamping on reads is highly unusual. Why is this needed ?
> >
> > There are instances when the hysteresis limit could be outside
> > the range of temperatures.
> >
> > For example, if the high limit is set to -45000 and the
> > hysteresis
> > is set to 20000, the high limit hysteresis is -65000 which is
> > outside
> > the range of supported temperatures.
> >
> > The hysteresis is set related to the critical temperature (that
> > is
> > higher then the "high limit") but it will be applied also to the
> > "high
> > temperature". In this case the hysteresis is valid for critical but
> > it
> > will be out of range for the "high temp".
> >
> "Supported" is irrelevant. Question is what is written into and
> reported by
> the chip. It may be "out of range", but the value is still written
> into
> the chip. So the question is: How does the chip react to the "out of
> range"
> values ? I suspect that it technically still works, even if the value
> is not
> officially supported. That should be reflected in the reported
> values.
> More specifically, if setting the hysteresis in your example to 19000
> instead of 20000 triggers a different response from the chip, that
> needs
> to be reflected in the reported values.
The driver reads the limit and hysteresis values and calculates
their difference. The result is only displayed and not saved in a
register. The result is clamped to be within the range of
supported values.
In my example setting hysteresis value to 19000 does not trigger
a different response from the chip.
next prev parent reply other threads:[~2026-02-03 13:31 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-27 15:18 [PATCH v3 0/2] add support in hwmon " victor.duicu
2026-01-27 15:18 ` [PATCH v3 1/2] dt-bindings: hwmon: add support " victor.duicu
2026-02-03 19:15 ` Guenter Roeck
2026-02-06 14:17 ` Victor.Duicu
2026-02-06 16:49 ` Krzysztof Kozlowski
2026-02-06 16:51 ` Krzysztof Kozlowski
2026-02-06 16:47 ` Krzysztof Kozlowski
2026-02-09 14:46 ` Victor.Duicu
2026-01-27 15:18 ` [PATCH v3 2/2] " victor.duicu
2026-01-27 18:51 ` Guenter Roeck
2026-02-02 8:15 ` Victor.Duicu
2026-02-02 15:18 ` Guenter Roeck
2026-02-03 13:31 ` Victor.Duicu [this message]
2026-01-27 22:23 ` kernel test robot
2026-02-03 19:45 ` Guenter Roeck
2026-02-03 20:09 ` Guenter Roeck
2026-02-03 20:45 ` Guenter Roeck
2026-02-06 16:55 ` [PATCH v3 0/2] add support in hwmon " Krzysztof Kozlowski
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=05303055c7fae6ee4f190b69039c3a4f0d8217fe.camel@microchip.com \
--to=victor.duicu@microchip.com \
--cc=Marius.Cristea@microchip.com \
--cc=conor+dt@kernel.org \
--cc=corbet@lwn.net \
--cc=devicetree@vger.kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=robh@kernel.org \
/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®