mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Mahapatra, Amit Kumar" <amit.kumar-mahapatra@amd.com>
To: Andy Shevchenko <andriy.shevchenko@intel.com>
Cc: "Jonathan Cameron" <jic23@kernel.org>,
	"Simek, Michal" <michal.simek@amd.com>,
	"Potthuri, Sai Krishna" <sai.krishna.potthuri@amd.com>,
	"David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	"Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"amitrkcian2002@gmail.com" <amitrkcian2002@gmail.com>
Subject: RE: [PATCH 2/6] iio: adc: versal-sysmon: validate temperature hysteresis
Date: Mon, 16 Nov 2026 04:19:46 +0000	[thread overview]
Message-ID: <DS7PR12MB95039DF1B995E46FFB63D404DC7C2@DS7PR12MB9503.namprd12.prod.outlook.com> (raw)
In-Reply-To: <avIi2pDCcaKDx3Ro@ashevche-desk.local>

AMD General

Hello Andy,

> -----Original Message-----
> From: Andy Shevchenko <andriy.shevchenko@intel.com>
> Sent: Tuesday, November 10, 2026 1:16 AM
> To: Mahapatra, Amit Kumar <amit.kumar-mahapatra@amd.com>
> Cc: Jonathan Cameron <jic23@kernel.org>; Simek, Michal
> <michal.simek@amd.com>; Potthuri, Sai Krishna <sai.krishna.potthuri@amd.com>;
> David Lechner <dlechner@baylibre.com>; Nuno Sá <nuno.sa@analog.com>; Andy
> Shevchenko <andy@kernel.org>; Rob Herring <robh@kernel.org>; Krzysztof
> Kozlowski <krzk+dt@kernel.org>; Conor Dooley <conor+dt@kernel.org>; linux-
> iio@vger.kernel.org; devicetree@vger.kernel.org; linux-arm-
> kernel@lists.infradead.org; linux-kernel@vger.kernel.org;
> amitrkcian2002@gmail.com
> Subject: Re: [PATCH 2/6] iio: adc: versal-sysmon: validate temperature hysteresis
>
> On Fri, Nov 06, 2026 at 11:35:00AM +0000, Mahapatra, Amit Kumar wrote:
> > > -----Original Message-----
> > > From: Andy Shevchenko <andriy.shevchenko@intel.com>
> > > Sent: Tuesday, November 3, 2026 3:39 PM On Mon, Nov 02, 2026 at
> > > 05:51:08PM +0530, Amit Kumar Mahapatra wrote:
>
> ...
>
> > > >     sysmon_q8p7_to_millicelsius(upper_reg, &upper_mc);
> > > >     sysmon_q8p7_to_millicelsius(lower_reg, &lower_mc);
> > > > -   *hysteresis = upper_mc - lower_mc;
> > > > +   *hysteresis = max(upper_mc - lower_mc, 0);
> > >
> > > But you can use abs_diff() and let it make the problem of the supplier.
> >
> > I went with max() because an inverted pair (lower above upper) doesn't
> > really describe a hysteresis, so treating it as zero seemed the safest
> > reading. With abs_diff(), an inverted 80/90 pair would be read as
> > 10 degrees, and the next threshold write would then set the lower
> > threshold to 70.
>
> Bu where did it come from? HW or DT? If the latter, we may just reject the wrong
> values at probe time, no?

It comes from the hardware, not DT. sysmon_init_hysteresis() reads the two
threshold registers. There is no DT property for them, so there's nothing to reject
when parsing DT.

Regards,
Amit
>
> --
> With Best Regards,
> Andy Shevchenko
>


  reply	other threads:[~2026-11-16  4:19 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-02 12:21 [PATCH 0/6] iio: adc: versal-sysmon: Add OT alarm, shutdown and thermal zone support Amit Kumar Mahapatra
2026-11-02 12:21 ` [PATCH 1/6] iio: adc: versal-sysmon: fix race in interrupt teardown Amit Kumar Mahapatra
2026-11-03  7:05   ` Prasanna Kumar T S M
2026-11-07 23:27   ` Jonathan Cameron
2026-11-02 12:21 ` [PATCH 2/6] iio: adc: versal-sysmon: validate temperature hysteresis Amit Kumar Mahapatra
2026-11-03 10:08   ` Andy Shevchenko
2026-11-06 11:35     ` Mahapatra, Amit Kumar
2026-11-09 19:45       ` Andy Shevchenko
2026-11-16  4:19         ` Mahapatra, Amit Kumar [this message]
2026-11-02 12:21 ` [PATCH 3/6] iio: adc: versal-sysmon: disable interrupts on shutdown Amit Kumar Mahapatra
2026-11-03  7:07   ` Prasanna Kumar T S M
2026-11-03 10:10   ` Andy Shevchenko
2026-11-07 23:30     ` Jonathan Cameron
2026-11-07 23:32   ` Jonathan Cameron
2026-11-16  4:20     ` Mahapatra, Amit Kumar
2026-11-02 12:21 ` [PATCH 4/6] iio: adc: versal-sysmon: add over-temperature alarm events Amit Kumar Mahapatra
2026-11-07 23:43   ` Jonathan Cameron
2026-11-16  5:42     ` Mahapatra, Amit Kumar
2026-11-02 12:21 ` [PATCH 5/6] arm64: versal-net: Add SysMon and thermal zone Amit Kumar Mahapatra
2026-11-02 14:53   ` Michal Simek
2026-11-06 11:46     ` Mahapatra, Amit Kumar
2026-11-02 12:21 ` [PATCH 6/6] MAINTAINERS: update Versal SysMon maintainers Amit Kumar Mahapatra
2026-11-02 12:53   ` Michal Simek
2026-11-06 11:46   ` Sai Krishna Potthuri

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=DS7PR12MB95039DF1B995E46FFB63D404DC7C2@DS7PR12MB9503.namprd12.prod.outlook.com \
    --to=amit.kumar-mahapatra@amd.com \
    --cc=amitrkcian2002@gmail.com \
    --cc=andriy.shevchenko@intel.com \
    --cc=andy@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=jic23@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michal.simek@amd.com \
    --cc=nuno.sa@analog.com \
    --cc=robh@kernel.org \
    --cc=sai.krishna.potthuri@amd.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®