From: Peng Fan <peng.fan@oss.nxp.com>
To: Marcus Folkesson <marcus.folkesson@gmail.com>,
"Rafael J . Wysocki" <rafael@kernel.org>,
Daniel Lezcano <daniel.lezcano@linaro.org>,
Amit Kucheria <amitk@kernel.org>, Zhang Rui <rui.zhang@intel.com>,
Shawn Guo <shawnguo@kernel.org>,
Sascha Hauer <s.hauer@pengutronix.de>,
Pengutronix Kernel Team <kernel@pengutronix.de>,
Fabio Estevam <festevam@gmail.com>,
NXP Linux Team <linux-imx@nxp.com>,
Anson Huang <Anson.Huang@nxp.com>
Cc: linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] thermal: imx8mm_thermal: wait for a valid measurement
Date: Fri, 14 Oct 2022 09:20:21 +0800 [thread overview]
Message-ID: <1b247906-665f-8d14-82b3-c55467659644@oss.nxp.com> (raw)
In-Reply-To: <20221007073057.41803-1-marcus.folkesson@gmail.com>
On 10/7/2022 3:30 PM, Marcus Folkesson wrote:
> Check if first measurement is still pending or if temperature is out of
> range.
> Return and try again later if that is the case.
>
> Fixes: 5eed800a6811 ("thermal: imx8mm: Add support for i.MX8MM thermal monitoring unit")
> Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
NAK:
Please refer: https://www.nxp.com/docs/en/errata/IMX8MM_0N87W.pdf
ERR051272: TMU: Bit 31 of registers TMU_TSCR/TMU_TRITSR/TMU_TRATSR invalid
Thanks,
Peng.
> ---
>
> Notes:
> v2: Also invalidate if temperature > max (125 degrees C)
>
> drivers/thermal/imx8mm_thermal.c | 12 +++++++++---
> 1 file changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/thermal/imx8mm_thermal.c b/drivers/thermal/imx8mm_thermal.c
> index af666bd9e8d4..e42bf373cebc 100644
> --- a/drivers/thermal/imx8mm_thermal.c
> +++ b/drivers/thermal/imx8mm_thermal.c
> @@ -62,11 +62,17 @@ static int imx8mm_tmu_get_temp(void *data, int *temp)
> {
> struct tmu_sensor *sensor = data;
> struct imx8mm_tmu *tmu = sensor->priv;
> - u32 val;
> + bool ready;
> + unsigned long val;
> +
> + val = readl_relaxed(tmu->base + TRITSR);
> + ready = test_bit(probe_status_offset(1), &val);
> + if (!ready)
> + return -EAGAIN;
>
> - val = readl_relaxed(tmu->base + TRITSR) & TRITSR_TEMP0_VAL_MASK;
> + val = val & TRITSR_TEMP0_VAL_MASK;
> *temp = val * 1000;
> - if (*temp < VER1_TEMP_LOW_LIMIT)
> + if (*temp < VER1_TEMP_LOW_LIMIT || *temp > VER2_TEMP_HIGH_LIMIT)
> return -EAGAIN;
>
> return 0;
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2022-10-14 1:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-07 7:30 [PATCH v2] thermal: imx8mm_thermal: wait for a valid measurement Marcus Folkesson
2022-10-14 1:20 ` Peng Fan [this message]
2022-10-14 7:28 ` Marcus Folkesson
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=1b247906-665f-8d14-82b3-c55467659644@oss.nxp.com \
--to=peng.fan@oss.nxp.com \
--cc=Anson.Huang@nxp.com \
--cc=amitk@kernel.org \
--cc=daniel.lezcano@linaro.org \
--cc=festevam@gmail.com \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-imx@nxp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=marcus.folkesson@gmail.com \
--cc=rafael@kernel.org \
--cc=rui.zhang@intel.com \
--cc=s.hauer@pengutronix.de \
--cc=shawnguo@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;
as well as URLs for NNTP newsgroup(s).