Skip to content

Commit ed302ad

Browse files
committed
Merge tag 'thermal-6.9-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull more thermal control updates from Rafael Wysocki: "These update thermal drivers for ARM platforms by adding new hardware support (r8a779h0, H616 THS), addressing issues (Mediatek LVTS, Mediatek MT7896, thermal-of) and cleaning up code. Specifics: - Fix memory leak in the error path at probe time in the Mediatek LVTS driver (Christophe Jaillet) - Fix control buffer enablement regression on Meditek MT7896 (Frank Wunderlich) - Drop spaces before TABs in different places: thermal-of, ST drivers and Makefile (Geert Uytterhoeven) - Adjust DT binding for NXP as fsl,tmu-range min/maxItems can vary among several SoC versions (Fabio Estevam) - Add support for the H616 THS controller on Sun8i platforms (Martin Botka) - Don't fail probe due to zone registration failure because there is no trip points defined in the DT (Mark Brown) - Support variable TMU array size for new platforms (Peng Fan) - Adjust the DT binding for thermal-of and make the polling time not required and assume it is zero when not found in the DT (Konrad Dybcio) - Add r8a779h0 support in both the DT and the rcar_gen3 driver (Geert Uytterhoeven)" * tag 'thermal-6.9-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: thermal/drivers/rcar_gen3: Add support for R-Car V4M dt-bindings: thermal: rcar-gen3-thermal: Add r8a779h0 support thermal/of: Assume polling-delay(-passive) 0 when absent dt-bindings: thermal-zones: Don't require polling-delay(-passive) thermal/drivers/qoriq: Fix getting tmu range thermal/drivers/sun8i: Don't fail probe due to zone registration failure thermal/drivers/sun8i: Add support for H616 THS controller thermal/drivers/sun8i: Add SRAM register access code thermal/drivers/sun8i: Extend H6 calibration to support 4 sensors thermal/drivers/sun8i: Explain unknown H6 register value dt-bindings: thermal: sun8i: Add H616 THS controller soc: sunxi: sram: export register 0 for THS on H616 dt-bindings: thermal: qoriq-thermal: Adjust fsl,tmu-range min/maxItems thermal: Drop spaces before TABs thermal/drivers/mediatek: Fix control buffer enablement on MT7896 thermal/drivers/mediatek/lvts_thermal: Fix a memory leak in an error handling path
2 parents 2f3c2b3 + 4e7193a commit ed302ad

File tree

14 files changed

+203
-58
lines changed

14 files changed

+203
-58
lines changed

Documentation/devicetree/bindings/thermal/allwinner,sun8i-a83t-ths.yaml

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ properties:
2121
- allwinner,sun50i-a100-ths
2222
- allwinner,sun50i-h5-ths
2323
- allwinner,sun50i-h6-ths
24+
- allwinner,sun50i-h616-ths
2425

2526
clocks:
2627
minItems: 1
@@ -50,6 +51,10 @@ properties:
5051
nvmem-cell-names:
5152
const: calibration
5253

54+
allwinner,sram:
55+
maxItems: 1
56+
description: phandle to device controlling temperate offset SYS_CFG register
57+
5358
# See Documentation/devicetree/bindings/thermal/thermal-sensor.yaml for details
5459
"#thermal-sensor-cells":
5560
enum:
@@ -65,6 +70,7 @@ allOf:
6570
- allwinner,sun20i-d1-ths
6671
- allwinner,sun50i-a100-ths
6772
- allwinner,sun50i-h6-ths
73+
- allwinner,sun50i-h616-ths
6874

6975
then:
7076
properties:
@@ -82,6 +88,17 @@ allOf:
8288
clock-names:
8389
minItems: 2
8490

91+
- if:
92+
not:
93+
properties:
94+
compatible:
95+
contains:
96+
const: allwinner,sun50i-h616-ths
97+
98+
then:
99+
properties:
100+
allwinner,sram: false
101+
85102
- if:
86103
properties:
87104
compatible:
@@ -101,17 +118,12 @@ allOf:
101118
const: 1
102119

103120
- if:
104-
properties:
105-
compatible:
106-
contains:
107-
enum:
108-
- allwinner,sun8i-h3-ths
109-
- allwinner,sun8i-r40-ths
110-
- allwinner,sun20i-d1-ths
111-
- allwinner,sun50i-a64-ths
112-
- allwinner,sun50i-a100-ths
113-
- allwinner,sun50i-h5-ths
114-
- allwinner,sun50i-h6-ths
121+
not:
122+
properties:
123+
compatible:
124+
contains:
125+
enum:
126+
- allwinner,sun8i-a83t-ths
115127

116128
then:
117129
required:

Documentation/devicetree/bindings/thermal/qoriq-thermal.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ properties:
3333
description: |
3434
The values to be programmed into TTRnCR, as specified by the SoC
3535
reference manual. The first cell is TTR0CR, the second is TTR1CR, etc.
36-
maxItems: 4
36+
minItems: 2
37+
maxItems: 7
3738

3839
fsl,tmu-calibration:
3940
$ref: /schemas/types.yaml#/definitions/uint32-matrix

Documentation/devicetree/bindings/thermal/rcar-gen3-thermal.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ properties:
2929
- renesas,r8a779a0-thermal # R-Car V3U
3030
- renesas,r8a779f0-thermal # R-Car S4-8
3131
- renesas,r8a779g0-thermal # R-Car V4H
32+
- renesas,r8a779h0-thermal # R-Car V4M
3233

3334
reg: true
3435

@@ -90,6 +91,7 @@ else:
9091
enum:
9192
- renesas,r8a779f0-thermal
9293
- renesas,r8a779g0-thermal
94+
- renesas,r8a779h0-thermal
9395
then:
9496
required:
9597
- interrupts

Documentation/devicetree/bindings/thermal/thermal-zones.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,8 +228,6 @@ patternProperties:
228228
additionalProperties: false
229229

230230
required:
231-
- polling-delay
232-
- polling-delay-passive
233231
- thermal-sensors
234232
- trips
235233

drivers/soc/sunxi/sunxi_sram.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,7 @@ EXPORT_SYMBOL(sunxi_sram_release);
287287
struct sunxi_sramc_variant {
288288
int num_emac_clocks;
289289
bool has_ldo_ctrl;
290+
bool has_ths_offset;
290291
};
291292

292293
static const struct sunxi_sramc_variant sun4i_a10_sramc_variant = {
@@ -308,8 +309,10 @@ static const struct sunxi_sramc_variant sun50i_a64_sramc_variant = {
308309

309310
static const struct sunxi_sramc_variant sun50i_h616_sramc_variant = {
310311
.num_emac_clocks = 2,
312+
.has_ths_offset = true,
311313
};
312314

315+
#define SUNXI_SRAM_THS_OFFSET_REG 0x0
313316
#define SUNXI_SRAM_EMAC_CLOCK_REG 0x30
314317
#define SUNXI_SYS_LDO_CTRL_REG 0x150
315318

@@ -318,6 +321,8 @@ static bool sunxi_sram_regmap_accessible_reg(struct device *dev,
318321
{
319322
const struct sunxi_sramc_variant *variant = dev_get_drvdata(dev);
320323

324+
if (reg == SUNXI_SRAM_THS_OFFSET_REG && variant->has_ths_offset)
325+
return true;
321326
if (reg >= SUNXI_SRAM_EMAC_CLOCK_REG &&
322327
reg < SUNXI_SRAM_EMAC_CLOCK_REG + variant->num_emac_clocks * 4)
323328
return true;
@@ -327,6 +332,20 @@ static bool sunxi_sram_regmap_accessible_reg(struct device *dev,
327332
return false;
328333
}
329334

335+
static void sunxi_sram_lock(void *_lock)
336+
{
337+
spinlock_t *lock = _lock;
338+
339+
spin_lock(lock);
340+
}
341+
342+
static void sunxi_sram_unlock(void *_lock)
343+
{
344+
spinlock_t *lock = _lock;
345+
346+
spin_unlock(lock);
347+
}
348+
330349
static struct regmap_config sunxi_sram_regmap_config = {
331350
.reg_bits = 32,
332351
.val_bits = 32,
@@ -336,6 +355,9 @@ static struct regmap_config sunxi_sram_regmap_config = {
336355
/* other devices have no business accessing other registers */
337356
.readable_reg = sunxi_sram_regmap_accessible_reg,
338357
.writeable_reg = sunxi_sram_regmap_accessible_reg,
358+
.lock = sunxi_sram_lock,
359+
.unlock = sunxi_sram_unlock,
360+
.lock_arg = &sram_lock,
339361
};
340362

341363
static int __init sunxi_sram_probe(struct platform_device *pdev)

drivers/thermal/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ obj-$(CONFIG_RCAR_GEN3_THERMAL) += rcar_gen3_thermal.o
4343
obj-$(CONFIG_RZG2L_THERMAL) += rzg2l_thermal.o
4444
obj-$(CONFIG_KIRKWOOD_THERMAL) += kirkwood_thermal.o
4545
obj-y += samsung/
46-
obj-$(CONFIG_DOVE_THERMAL) += dove_thermal.o
46+
obj-$(CONFIG_DOVE_THERMAL) += dove_thermal.o
4747
obj-$(CONFIG_DB8500_THERMAL) += db8500_thermal.o
4848
obj-$(CONFIG_ARMADA_THERMAL) += armada_thermal.o
4949
obj-$(CONFIG_IMX_THERMAL) += imx_thermal.o

drivers/thermal/mediatek/auxadc_thermal.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -690,6 +690,9 @@ static const struct mtk_thermal_data mt7986_thermal_data = {
690690
.adcpnp = mt7986_adcpnp,
691691
.sensor_mux_values = mt7986_mux_values,
692692
.version = MTK_THERMAL_V3,
693+
.apmixed_buffer_ctl_reg = APMIXED_SYS_TS_CON1,
694+
.apmixed_buffer_ctl_mask = GENMASK(31, 6) | BIT(3),
695+
.apmixed_buffer_ctl_set = BIT(0),
693696
};
694697

695698
static bool mtk_thermal_temp_is_valid(int temp)

drivers/thermal/mediatek/lvts_thermal.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -719,8 +719,10 @@ static int lvts_calibration_read(struct device *dev, struct lvts_domain *lvts_td
719719

720720
lvts_td->calib = devm_krealloc(dev, lvts_td->calib,
721721
lvts_td->calib_len + len, GFP_KERNEL);
722-
if (!lvts_td->calib)
722+
if (!lvts_td->calib) {
723+
kfree(efuse);
723724
return -ENOMEM;
725+
}
724726

725727
memcpy(lvts_td->calib + lvts_td->calib_len, efuse, len);
726728

drivers/thermal/qoriq_thermal.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@
5757
#define REGS_TTRnCR(n) (0xf10 + 4 * (n)) /* Temperature Range n
5858
* Control Register
5959
*/
60+
#define NUM_TTRCR_V1 4
61+
#define NUM_TTRCR_MAX 16
62+
6063
#define REGS_IPBRR(n) (0xbf8 + 4 * (n)) /* IP Block Revision
6164
* Register n
6265
*/
@@ -71,6 +74,7 @@ struct qoriq_sensor {
7174

7275
struct qoriq_tmu_data {
7376
int ver;
77+
u32 ttrcr[NUM_TTRCR_MAX];
7478
struct regmap *regmap;
7579
struct clk *clk;
7680
struct qoriq_sensor sensor[SITES_MAX];
@@ -182,25 +186,25 @@ static int qoriq_tmu_calibration(struct device *dev,
182186
struct qoriq_tmu_data *data)
183187
{
184188
int i, val, len;
185-
u32 range[4];
186189
const u32 *calibration;
187190
struct device_node *np = dev->of_node;
188191

189192
len = of_property_count_u32_elems(np, "fsl,tmu-range");
190-
if (len < 0 || len > 4) {
193+
if (len < 0 || (data->ver == TMU_VER1 && len > NUM_TTRCR_V1) ||
194+
(data->ver > TMU_VER1 && len > NUM_TTRCR_MAX)) {
191195
dev_err(dev, "invalid range data.\n");
192196
return len;
193197
}
194198

195-
val = of_property_read_u32_array(np, "fsl,tmu-range", range, len);
199+
val = of_property_read_u32_array(np, "fsl,tmu-range", data->ttrcr, len);
196200
if (val != 0) {
197201
dev_err(dev, "failed to read range data.\n");
198202
return val;
199203
}
200204

201205
/* Init temperature range registers */
202206
for (i = 0; i < len; i++)
203-
regmap_write(data->regmap, REGS_TTRnCR(i), range[i]);
207+
regmap_write(data->regmap, REGS_TTRnCR(i), data->ttrcr[i]);
204208

205209
calibration = of_get_property(np, "fsl,tmu-calibration", &len);
206210
if (calibration == NULL || len % 8) {

drivers/thermal/rcar_gen3_thermal.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,10 @@ static const struct of_device_id rcar_gen3_thermal_dt_ids[] = {
428428
.compatible = "renesas,r8a779g0-thermal",
429429
.data = &rcar_gen4_thermal_info,
430430
},
431+
{
432+
.compatible = "renesas,r8a779h0-thermal",
433+
.data = &rcar_gen4_thermal_info,
434+
},
431435
{},
432436
};
433437
MODULE_DEVICE_TABLE(of, rcar_gen3_thermal_dt_ids);

0 commit comments

Comments
 (0)