Skip to content

Commit f12d60c

Browse files
MrVandlezcano
authored andcommitted
thermal/drivers/qoriq: Support version 2.1
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 <[email protected]> Signed-off-by: Daniel Lezcano <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 9301575 commit f12d60c

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

drivers/thermal/qoriq_thermal.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
* Site Register
5151
*/
5252
#define TRITSR_V BIT(31)
53+
#define TRITSR_TP5 BIT(9)
5354
#define REGS_V2_TMSAR(n) (0x304 + 16 * (n)) /* TMU monitoring
5455
* site adjustment register
5556
*/
@@ -117,10 +118,15 @@ static int tmu_get_temp(struct thermal_zone_device *tz, int *temp)
117118
10 * USEC_PER_MSEC))
118119
return -ENODATA;
119120

120-
if (qdata->ver == TMU_VER1)
121+
if (qdata->ver == TMU_VER1) {
121122
*temp = (val & GENMASK(7, 0)) * MILLIDEGREE_PER_DEGREE;
122-
else
123-
*temp = kelvin_to_millicelsius(val & GENMASK(8, 0));
123+
} else {
124+
if (val & TRITSR_TP5)
125+
*temp = milli_kelvin_to_millicelsius((val & GENMASK(8, 0)) *
126+
MILLIDEGREE_PER_DEGREE + 500);
127+
else
128+
*temp = kelvin_to_millicelsius(val & GENMASK(8, 0));
129+
}
124130

125131
return 0;
126132
}
@@ -234,7 +240,7 @@ static void qoriq_tmu_init_device(struct qoriq_tmu_data *data)
234240

235241
static const struct regmap_range qoriq_yes_ranges[] = {
236242
regmap_reg_range(REGS_TMR, REGS_TSCFGR),
237-
regmap_reg_range(REGS_TTRnCR(0), REGS_TTRnCR(3)),
243+
regmap_reg_range(REGS_TTRnCR(0), REGS_TTRnCR(15)),
238244
regmap_reg_range(REGS_V2_TEUMR(0), REGS_V2_TEUMR(2)),
239245
regmap_reg_range(REGS_V2_TMSAR(0), REGS_V2_TMSAR(15)),
240246
regmap_reg_range(REGS_IPBRR(0), REGS_IPBRR(1)),

0 commit comments

Comments
 (0)