From: Daniel Lezcano <daniel.lezcano@linaro.org>
To: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>,
Lukasz Luba <lukasz.luba@arm.com>, Rob Herring <robh@kernel.org>,
linux-pm@vger.kernel.org,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
Conor Dooley <conor+dt@kernel.org>,
Christian Marangi <ansuelsmth@gmail.com>,
Zhang Rui <rui.zhang@intel.com>
Subject: Re: [PATCH v5 2/2] thermal: Add support for Airoha EN7581 thermal sensor
Date: Fri, 2 May 2025 11:42:50 +0200 [thread overview]
Message-ID: <356bc97a-bd75-4894-98fe-d7fb0e02e1c1@linaro.org> (raw)
In-Reply-To: <20250226003608.8973-2-ansuelsmth@gmail.com>
Hi Angelo,
AFAIR, the LVTS driver had issues with the interrupts.
This driver proposed by Ansuel Smith looks very similar to the LVTS and
there are some comments regarding errors with the documentation below
which may appy to the LVTS driver too.
Would you mind to check ?
See below.
On 26/02/2025 01:35, Christian Marangi wrote:
> Add support for Airoha EN7581 thermal sensor. This provide support for
> reading the CPU or SoC Package sensor and to setup trip points for hot
> and critical condition. An interrupt is fired to react on this and
> doesn't require passive poll to read the temperature.
>
> The thermal regs provide a way to read the ADC value from an external
> register placed in the Chip SCU regs. Monitor will read this value and
> fire an interrupt if the trip condition configured is reached.
>
> The Thermal Trip and Interrupt logic is conceptually similar to Mediatek
> LVTS Thermal but differ in register mapping and actual function/bug
> workaround. The implementation only share some register names but from
> functionality observation it's very different and used only for the
> basic function of periodically poll the temp and trip the interrupt.
>
> Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
> ---
[ ... ]
> +#define EN7581_HINTEN1 BIT(6)
> +#define EN7581_CINTEN1 BIT(5)
> +#define EN7581_NOHOTINTEN0 BIT(4)
> +/* Similar to COLD and HOT also these seems to be swapped in documentation */
> +#define EN7581_LOFSINTEN0 BIT(3) /* In documentation: BIT(2) */
> +#define EN7581_HOFSINTEN0 BIT(2) /* In documentation: BIT(3) */
> +/* It seems documentation have these swapped as the HW
> + * - Fire BIT(1) when lower than EN7581_COLD_THRE
> + * - Fire BIT(0) and BIT(5) when higher than EN7581_HOT2NORMAL_THRE or
> + * EN7581_HOT_THRE
> + */
> +#define EN7581_CINTEN0 BIT(1) /* In documentation: BIT(0) */
> +#define EN7581_HINTEN0 BIT(0) /* In documentation: BIT(1) */
> +#define EN7581_TEMPMONINTSTS 0x810
> +#define EN7581_STAGE3_INT_STAT BIT(31)
> +#define EN7581_STAGE2_INT_STAT BIT(30)
> +#define EN7581_STAGE1_INT_STAT BIT(29)
> +#define EN7581_FILTER_INT_STAT_3 BIT(28)
[ ... ]
> +#define EN7581_NOHOTINTSTS0 BIT(4)
> +/* Similar to COLD and HOT also these seems to be swapped in documentation */
> +#define EN7581_LOFSINTSTS0 BIT(3) /* In documentation: BIT(2) */
> +#define EN7581_HOFSINTSTS0 BIT(2) /* In documentation: BIT(3) */
> +/* It seems documentation have these swapped as the HW
> + * - Fire BIT(1) when lower than EN7581_COLD_THRE
> + * - Fire BIT(0) and BIT(5) when higher than EN7581_HOT2NORMAL_THRE or
> + * EN7581_HOT_THRE
> + *
> + * To clear things, we swap the define but we keep them documented here.
> + */
> +#define EN7581_CINTSTS0 BIT(1) /* In documentation: BIT(0) */
> +#define EN7581_HINTSTS0 BIT(0) /* In documentation: BIT(1)*/
> +/* Monitor will take the bigger threshold between HOT2NORMAL and HOT
> + * and will fire both HOT2NORMAL and HOT interrupt when higher than the 2
> + *
> + * It has also been observed that not setting HOT2NORMAL makes the monitor
> + * treat COLD threshold as HOT2NORMAL.
> + */
> +#define EN7581_TEMPH2NTHRE 0x824
> +/* It seems HOT2NORMAL is actually NORMAL2HOT */
> +#define EN7581_HOT2NORMAL_THRE GENMASK(11, 0)
> +#define EN7581_TEMPHTHRE 0x828
> +#define EN7581_HOT_THRE GENMASK(11, 0)
> +/* Monitor will use this as HOT2NORMAL (fire interrupt when lower than...)*/
> +#define EN7581_TEMPCTHRE 0x82c
> +#define EN7581_COLD_THRE GENMASK(11, 0)
> +/* Also LOW and HIGH offset register are swapped */
> +#define EN7581_TEMPOFFSETL 0x830 /* In documentation: 0x834 */
> +#define EN7581_LOW_OFFSET GENMASK(11, 0)
> +#define EN7581_TEMPOFFSETH 0x834 /* In documentation: 0x830 */
> +#define EN7581_HIGH_OFFSET GENMASK(11, 0)
> +#define EN7581_TEMPMSRCTL0 0x838
[ ... ]
--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs
Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
next prev parent reply other threads:[~2025-05-02 9:42 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-26 0:35 [PATCH v5 1/2] dt-bindings: thermal: Add support for Airoha EN7581 thermal sensor Christian Marangi
2025-02-26 0:35 ` [PATCH v5 2/2] " Christian Marangi
2025-05-02 9:42 ` Daniel Lezcano [this message]
2025-05-02 13:30 ` Daniel Lezcano
2025-05-02 15:00 ` Christian Marangi
2025-05-07 7:29 ` Daniel Lezcano
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=356bc97a-bd75-4894-98fe-d7fb0e02e1c1@linaro.org \
--to=daniel.lezcano@linaro.org \
--cc=angelogioacchino.delregno@collabora.com \
--cc=ansuelsmth@gmail.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=lukasz.luba@arm.com \
--cc=rafael@kernel.org \
--cc=robh@kernel.org \
--cc=rui.zhang@intel.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