From: "Peng Fan (OSS)" <peng.fan@oss.nxp.com>
To: rafael@kernel.org, daniel.lezcano@linaro.org,
shawnguo@kernel.org, s.hauer@pengutronix.de
Cc: amitk@kernel.org, rui.zhang@intel.com, andrew.smirnov@gmail.com,
linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com,
linux-arm-kernel@lists.infradead.org, alice.guo@nxp.com,
Peng Fan <peng.fan@nxp.com>
Subject: [PATCH 3/3] thermal: qoriq: support version 2.1
Date: Tue, 16 May 2023 16:37:46 +0800 [thread overview]
Message-ID: <20230516083746.63436-4-peng.fan@oss.nxp.com> (raw)
In-Reply-To: <20230516083746.63436-1-peng.fan@oss.nxp.com>
From: Peng Fan <peng.fan@nxp.com>
i.MX93 use TMU version 2.1, which supports:
- TRITSR_TP5(When this field is 1, you must add 0.5 K to the temperature
that TEMP reports. For example, if TEMP is 300 K and TP5=1, then the
final temperature is 300.5 K.)
- Has 16 TTRCR register: Temperature Range Control (TTRCR0 - TTRCR15)
This patch is to add this support.
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
drivers/thermal/qoriq_thermal.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/drivers/thermal/qoriq_thermal.c b/drivers/thermal/qoriq_thermal.c
index 53748c4a5be1..c710449b0c50 100644
--- a/drivers/thermal/qoriq_thermal.c
+++ b/drivers/thermal/qoriq_thermal.c
@@ -50,6 +50,7 @@
* Site Register
*/
#define TRITSR_V BIT(31)
+#define TRITSR_TP5 BIT(9)
#define REGS_V2_TMSAR(n) (0x304 + 16 * (n)) /* TMU monitoring
* site adjustment register
*/
@@ -117,10 +118,15 @@ static int tmu_get_temp(struct thermal_zone_device *tz, int *temp)
10 * USEC_PER_MSEC))
return -ENODATA;
- if (qdata->ver == TMU_VER1)
+ if (qdata->ver == TMU_VER1) {
*temp = (val & GENMASK(7, 0)) * MILLIDEGREE_PER_DEGREE;
- else
- *temp = kelvin_to_millicelsius(val & GENMASK(8, 0));
+ } else {
+ if (val & TRITSR_TP5)
+ *temp = milli_kelvin_to_millicelsius((val & GENMASK(8, 0)) *
+ MILLIDEGREE_PER_DEGREE + 500);
+ else
+ *temp = kelvin_to_millicelsius(val & GENMASK(8, 0));
+ }
return 0;
}
@@ -234,7 +240,7 @@ static void qoriq_tmu_init_device(struct qoriq_tmu_data *data)
static const struct regmap_range qoriq_yes_ranges[] = {
regmap_reg_range(REGS_TMR, REGS_TSCFGR),
- regmap_reg_range(REGS_TTRnCR(0), REGS_TTRnCR(3)),
+ regmap_reg_range(REGS_TTRnCR(0), REGS_TTRnCR(15)),
regmap_reg_range(REGS_V2_TEUMR(0), REGS_V2_TEUMR(2)),
regmap_reg_range(REGS_V2_TMSAR(0), REGS_V2_TMSAR(15)),
regmap_reg_range(REGS_IPBRR(0), REGS_IPBRR(1)),
--
2.37.1
WARNING: multiple messages have this Message-ID (diff)
From: "Peng Fan (OSS)" <peng.fan@oss.nxp.com>
To: rafael@kernel.org, daniel.lezcano@linaro.org,
shawnguo@kernel.org, s.hauer@pengutronix.de
Cc: amitk@kernel.org, rui.zhang@intel.com, andrew.smirnov@gmail.com,
linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com,
linux-arm-kernel@lists.infradead.org, alice.guo@nxp.com,
Peng Fan <peng.fan@nxp.com>
Subject: [PATCH 3/3] thermal: qoriq: support version 2.1
Date: Tue, 16 May 2023 16:37:46 +0800 [thread overview]
Message-ID: <20230516083746.63436-4-peng.fan@oss.nxp.com> (raw)
In-Reply-To: <20230516083746.63436-1-peng.fan@oss.nxp.com>
From: Peng Fan <peng.fan@nxp.com>
i.MX93 use TMU version 2.1, which supports:
- TRITSR_TP5(When this field is 1, you must add 0.5 K to the temperature
that TEMP reports. For example, if TEMP is 300 K and TP5=1, then the
final temperature is 300.5 K.)
- Has 16 TTRCR register: Temperature Range Control (TTRCR0 - TTRCR15)
This patch is to add this support.
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
drivers/thermal/qoriq_thermal.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/drivers/thermal/qoriq_thermal.c b/drivers/thermal/qoriq_thermal.c
index 53748c4a5be1..c710449b0c50 100644
--- a/drivers/thermal/qoriq_thermal.c
+++ b/drivers/thermal/qoriq_thermal.c
@@ -50,6 +50,7 @@
* Site Register
*/
#define TRITSR_V BIT(31)
+#define TRITSR_TP5 BIT(9)
#define REGS_V2_TMSAR(n) (0x304 + 16 * (n)) /* TMU monitoring
* site adjustment register
*/
@@ -117,10 +118,15 @@ static int tmu_get_temp(struct thermal_zone_device *tz, int *temp)
10 * USEC_PER_MSEC))
return -ENODATA;
- if (qdata->ver == TMU_VER1)
+ if (qdata->ver == TMU_VER1) {
*temp = (val & GENMASK(7, 0)) * MILLIDEGREE_PER_DEGREE;
- else
- *temp = kelvin_to_millicelsius(val & GENMASK(8, 0));
+ } else {
+ if (val & TRITSR_TP5)
+ *temp = milli_kelvin_to_millicelsius((val & GENMASK(8, 0)) *
+ MILLIDEGREE_PER_DEGREE + 500);
+ else
+ *temp = kelvin_to_millicelsius(val & GENMASK(8, 0));
+ }
return 0;
}
@@ -234,7 +240,7 @@ static void qoriq_tmu_init_device(struct qoriq_tmu_data *data)
static const struct regmap_range qoriq_yes_ranges[] = {
regmap_reg_range(REGS_TMR, REGS_TSCFGR),
- regmap_reg_range(REGS_TTRnCR(0), REGS_TTRnCR(3)),
+ regmap_reg_range(REGS_TTRnCR(0), REGS_TTRnCR(15)),
regmap_reg_range(REGS_V2_TEUMR(0), REGS_V2_TEUMR(2)),
regmap_reg_range(REGS_V2_TMSAR(0), REGS_V2_TMSAR(15)),
regmap_reg_range(REGS_IPBRR(0), REGS_IPBRR(1)),
--
2.37.1
_______________________________________________
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:[~2023-05-16 8:33 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-16 8:37 [PATCH 0/3] thermal: qoriq_thermal: support TMU 2.1 Peng Fan (OSS)
2023-05-16 8:37 ` Peng Fan (OSS)
2023-05-16 8:37 ` [PATCH 1/3] thermal: qoriq_thermal: No need to program site adjustment register Peng Fan (OSS)
2023-05-16 8:37 ` Peng Fan (OSS)
2023-05-16 8:37 ` [PATCH 2/3] thermal: qoriq_thermal: only enable supported sensors Peng Fan (OSS)
2023-05-16 8:37 ` Peng Fan (OSS)
2023-05-31 11:03 ` Daniel Lezcano
2023-05-31 11:03 ` Daniel Lezcano
2023-05-31 12:05 ` Peng Fan
2023-05-31 12:05 ` Peng Fan
2023-05-31 12:35 ` Daniel Lezcano
2023-05-31 12:35 ` Daniel Lezcano
2023-05-31 13:00 ` Peng Fan
2023-05-31 13:00 ` Peng Fan
2023-06-01 9:52 ` Peng Fan
2023-06-01 9:52 ` Peng Fan
2023-06-02 13:11 ` Daniel Lezcano
2023-06-02 13:11 ` Daniel Lezcano
2023-06-07 6:01 ` Sebastian Krzyszkowiak
2023-06-07 6:01 ` Sebastian Krzyszkowiak
2023-06-07 8:28 ` Daniel Lezcano
2023-06-07 8:28 ` Daniel Lezcano
2023-06-07 17:42 ` Sebastian Krzyszkowiak
2023-06-07 17:42 ` Sebastian Krzyszkowiak
2023-06-07 19:10 ` Daniel Lezcano
2023-06-07 19:10 ` Daniel Lezcano
2023-06-12 6:23 ` Sebastian Krzyszkowiak
2023-06-15 2:29 ` Peng Fan
2023-06-15 2:29 ` Peng Fan
2023-06-15 2:53 ` Sebastian Krzyszkowiak
2023-06-15 2:53 ` Sebastian Krzyszkowiak
2023-06-15 4:04 ` Peng Fan
2023-06-15 4:04 ` Peng Fan
2023-06-15 10:36 ` Daniel Lezcano
2023-06-15 10:36 ` Daniel Lezcano
2023-06-15 11:48 ` Daniel Lezcano
2023-06-15 11:48 ` Daniel Lezcano
2023-06-15 12:07 ` Peng Fan
2023-06-15 12:07 ` Peng Fan
2023-06-15 13:49 ` Daniel Lezcano
2023-06-15 13:49 ` Daniel Lezcano
2023-06-16 1:06 ` Peng Fan
2023-06-16 1:06 ` Peng Fan
2023-06-16 9:01 ` Daniel Lezcano
2023-06-16 9:01 ` Daniel Lezcano
2023-05-16 8:37 ` Peng Fan (OSS) [this message]
2023-05-16 8:37 ` [PATCH 3/3] thermal: qoriq: support version 2.1 Peng Fan (OSS)
2023-05-23 1:59 ` [PATCH 0/3] thermal: qoriq_thermal: support TMU 2.1 Alice Guo
2023-05-23 1:59 ` Alice Guo
2023-05-29 3:35 ` Peng Fan
2023-05-29 3:35 ` Peng Fan
2023-06-16 9:02 ` Daniel Lezcano
2023-06-16 9:02 ` 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=20230516083746.63436-4-peng.fan@oss.nxp.com \
--to=peng.fan@oss.nxp.com \
--cc=alice.guo@nxp.com \
--cc=amitk@kernel.org \
--cc=andrew.smirnov@gmail.com \
--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=peng.fan@nxp.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.