Skip to content

Commit 5a77b6a

Browse files
committed
Merge tag 'thermal-v5.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux
Pull thermal updates from Daniel Lezcano: - Fix Kconfig typo "acces" -> "access" (Colin Ian King) - Use dev_error_probe() to simplify the error handling on imx and imx8 platforms (Anson Huang) - Use dedicated kobj_to_dev() instead of container_of() in the sysfs core code (Tian Tao) - Fix coding style by adding braces to a one line conditional statement on rcar (Geert Uytterhoeven) - Add DT binding documentation for the r8a774e1 platform and update the Kconfig description supporting RZ/G2 SoCs (Lad Prabhakar) - Simplify the return expression of stm_thermal_prepare on the stm32 platform (Qinglang Miao) - Fix the unit in the function documentation for the idle injection cooling device (Zhuguang Qing) - Remove an unecessary mutex_init() in the core code (Qinglang Miao) - Add support for keep alive events in the core code and the specific int340x (Srinivas Pandruvada) - Remove unused thermal zone variable in devfreq and cpufreq cooling devices (Zhuguang Qing) - Add the A100's THS controller support (Yangtao Li) - Add power management on the omap3's bandgap sensor (Adam Ford) - Fix a missing nlmsg_free in the netlink core error path (Jing Xiangfeng) * tag 'thermal-v5.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux: thermal: core: Adding missing nlmsg_free() in thermal_genl_sampling_temp() thermal: ti-soc-thermal: Enable addition power management thermal: sun8i: Add A100's THS controller support thermal: sun8i: add TEMP_CALIB_MASK for calibration data in sun50i_h6_ths_calibrate dt-bindings: thermal: sun8i: Add binding for A100's THS controller thermal: cooling: Remove unused variable *tz thermal: int340x: Add keep alive response method thermal: core: Add new event for sending keep alive notifications thermal: int340x: Provide notification for OEM variable change thermal: core: remove unnecessary mutex_init() thermal/idle_inject: Fix comment of idle_duration_us and name of latency_ns thermal: Kconfig: Update description for RCAR_GEN3_THERMAL config thermal: stm32: simplify the return expression of stm_thermal_prepare() dt-bindings: thermal: rcar-gen3-thermal: Add r8a774e1 support thermal: rcar_thermal: Add missing braces to conditional statement thermal: Use kobj_to_dev() instead of container_of() thermal: imx8mm: Use dev_err_probe() to simplify error handling thermal: imx: Use dev_err_probe() to simplify error handling drivers: thermal: Kconfig: fix spelling mistake "acces" -> "access"
2 parents 071a057 + 48b4585 commit 5a77b6a

22 files changed

Lines changed: 156 additions & 82 deletions

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ properties:
1717
- allwinner,sun8i-h3-ths
1818
- allwinner,sun8i-r40-ths
1919
- allwinner,sun50i-a64-ths
20+
- allwinner,sun50i-a100-ths
2021
- allwinner,sun50i-h5-ths
2122
- allwinner,sun50i-h6-ths
2223

@@ -61,7 +62,9 @@ allOf:
6162
properties:
6263
compatible:
6364
contains:
64-
const: allwinner,sun50i-h6-ths
65+
enum:
66+
- allwinner,sun50i-a100-ths
67+
- allwinner,sun50i-h6-ths
6568

6669
then:
6770
properties:
@@ -103,6 +106,7 @@ allOf:
103106
- const: allwinner,sun8i-h3-ths
104107
- const: allwinner,sun8i-r40-ths
105108
- const: allwinner,sun50i-a64-ths
109+
- const: allwinner,sun50i-a100-ths
106110
- const: allwinner,sun50i-h5-ths
107111
- const: allwinner,sun50i-h6-ths
108112

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ properties:
2020
enum:
2121
- renesas,r8a774a1-thermal # RZ/G2M
2222
- renesas,r8a774b1-thermal # RZ/G2N
23+
- renesas,r8a774e1-thermal # RZ/G2H
2324
- renesas,r8a7795-thermal # R-Car H3
2425
- renesas,r8a7796-thermal # R-Car M3-W
2526
- renesas,r8a77961-thermal # R-Car M3-W+

drivers/thermal/Kconfig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -346,13 +346,13 @@ config RCAR_THERMAL
346346
thermal framework.
347347

348348
config RCAR_GEN3_THERMAL
349-
tristate "Renesas R-Car Gen3 thermal driver"
349+
tristate "Renesas R-Car Gen3 and RZ/G2 thermal driver"
350350
depends on ARCH_RENESAS || COMPILE_TEST
351351
depends on HAS_IOMEM
352352
depends on OF
353353
help
354-
Enable this to plug the R-Car Gen3 thermal sensor driver into the Linux
355-
thermal framework.
354+
Enable this to plug the R-Car Gen3 or RZ/G2 thermal sensor driver into
355+
the Linux thermal framework.
356356

357357
config KIRKWOOD_THERMAL
358358
tristate "Temperature sensor on Marvell Kirkwood SoCs"

drivers/thermal/cpufreq_cooling.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,6 @@ static u32 get_dynamic_power(struct cpufreq_cooling_device *cpufreq_cdev,
182182
/**
183183
* cpufreq_get_requested_power() - get the current power
184184
* @cdev: &thermal_cooling_device pointer
185-
* @tz: a valid thermal zone device pointer
186185
* @power: pointer in which to store the resulting power
187186
*
188187
* Calculate the current power consumption of the cpus in milliwatts
@@ -203,7 +202,6 @@ static u32 get_dynamic_power(struct cpufreq_cooling_device *cpufreq_cdev,
203202
* Return: 0 on success, -E* if getting the static power failed.
204203
*/
205204
static int cpufreq_get_requested_power(struct thermal_cooling_device *cdev,
206-
struct thermal_zone_device *tz,
207205
u32 *power)
208206
{
209207
unsigned long freq;
@@ -253,7 +251,6 @@ static int cpufreq_get_requested_power(struct thermal_cooling_device *cdev,
253251
/**
254252
* cpufreq_state2power() - convert a cpu cdev state to power consumed
255253
* @cdev: &thermal_cooling_device pointer
256-
* @tz: a valid thermal zone device pointer
257254
* @state: cooling device state to be converted
258255
* @power: pointer in which to store the resulting power
259256
*
@@ -266,7 +263,6 @@ static int cpufreq_get_requested_power(struct thermal_cooling_device *cdev,
266263
* when calculating the static power.
267264
*/
268265
static int cpufreq_state2power(struct thermal_cooling_device *cdev,
269-
struct thermal_zone_device *tz,
270266
unsigned long state, u32 *power)
271267
{
272268
unsigned int freq, num_cpus, idx;
@@ -288,7 +284,6 @@ static int cpufreq_state2power(struct thermal_cooling_device *cdev,
288284
/**
289285
* cpufreq_power2state() - convert power to a cooling device state
290286
* @cdev: &thermal_cooling_device pointer
291-
* @tz: a valid thermal zone device pointer
292287
* @power: power in milliwatts to be converted
293288
* @state: pointer in which to store the resulting state
294289
*
@@ -306,8 +301,7 @@ static int cpufreq_state2power(struct thermal_cooling_device *cdev,
306301
* device.
307302
*/
308303
static int cpufreq_power2state(struct thermal_cooling_device *cdev,
309-
struct thermal_zone_device *tz, u32 power,
310-
unsigned long *state)
304+
u32 power, unsigned long *state)
311305
{
312306
unsigned int target_freq;
313307
u32 last_load, normalised_power;

drivers/thermal/cpuidle_cooling.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ static DEFINE_IDA(cpuidle_ida);
3030

3131
/**
3232
* cpuidle_cooling_runtime - Running time computation
33-
* @idle_duration_us: the idle cooling device
33+
* @idle_duration_us: CPU idle time to inject in microseconds
3434
* @state: a percentile based number
3535
*
3636
* The running duration is computed from the idle injection duration

drivers/thermal/devfreq_cooling.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,6 @@ static inline unsigned long get_total_power(struct devfreq_cooling_device *dfc,
229229

230230

231231
static int devfreq_cooling_get_requested_power(struct thermal_cooling_device *cdev,
232-
struct thermal_zone_device *tz,
233232
u32 *power)
234233
{
235234
struct devfreq_cooling_device *dfc = cdev->devdata;
@@ -289,7 +288,6 @@ static int devfreq_cooling_get_requested_power(struct thermal_cooling_device *cd
289288
}
290289

291290
static int devfreq_cooling_state2power(struct thermal_cooling_device *cdev,
292-
struct thermal_zone_device *tz,
293291
unsigned long state,
294292
u32 *power)
295293
{
@@ -308,7 +306,6 @@ static int devfreq_cooling_state2power(struct thermal_cooling_device *cdev,
308306
}
309307

310308
static int devfreq_cooling_power2state(struct thermal_cooling_device *cdev,
311-
struct thermal_zone_device *tz,
312309
u32 power, unsigned long *state)
313310
{
314311
struct devfreq_cooling_device *dfc = cdev->devdata;

drivers/thermal/gov_power_allocator.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ static u32 estimate_sustainable_power(struct thermal_zone_device *tz)
9696
if (instance->trip != params->trip_max_desired_temperature)
9797
continue;
9898

99-
if (power_actor_get_min_power(cdev, tz, &min_power))
99+
if (power_actor_get_min_power(cdev, &min_power))
100100
continue;
101101

102102
sustainable_power += min_power;
@@ -388,7 +388,7 @@ static int allocate_power(struct thermal_zone_device *tz,
388388
if (!cdev_is_power_actor(cdev))
389389
continue;
390390

391-
if (cdev->ops->get_requested_power(cdev, tz, &req_power[i]))
391+
if (cdev->ops->get_requested_power(cdev, &req_power[i]))
392392
continue;
393393

394394
if (!total_weight)
@@ -398,7 +398,7 @@ static int allocate_power(struct thermal_zone_device *tz,
398398

399399
weighted_req_power[i] = frac_to_int(weight * req_power[i]);
400400

401-
if (power_actor_get_max_power(cdev, tz, &max_power[i]))
401+
if (power_actor_get_max_power(cdev, &max_power[i]))
402402
continue;
403403

404404
total_req_power += req_power[i];

drivers/thermal/imx8mm_thermal.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -146,13 +146,9 @@ static int imx8mm_tmu_probe(struct platform_device *pdev)
146146
return PTR_ERR(tmu->base);
147147

148148
tmu->clk = devm_clk_get(&pdev->dev, NULL);
149-
if (IS_ERR(tmu->clk)) {
150-
ret = PTR_ERR(tmu->clk);
151-
if (ret != -EPROBE_DEFER)
152-
dev_err(&pdev->dev,
153-
"failed to get tmu clock: %d\n", ret);
154-
return ret;
155-
}
149+
if (IS_ERR(tmu->clk))
150+
return dev_err_probe(&pdev->dev, PTR_ERR(tmu->clk),
151+
"failed to get tmu clock\n");
156152

157153
ret = clk_prepare_enable(tmu->clk);
158154
if (ret) {

drivers/thermal/imx_thermal.c

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -716,14 +716,9 @@ static int imx_thermal_probe(struct platform_device *pdev)
716716

717717
if (of_find_property(pdev->dev.of_node, "nvmem-cells", NULL)) {
718718
ret = imx_init_from_nvmem_cells(pdev);
719-
if (ret) {
720-
if (ret == -EPROBE_DEFER)
721-
return ret;
722-
723-
dev_err(&pdev->dev, "failed to init from nvmem: %d\n",
724-
ret);
725-
return ret;
726-
}
719+
if (ret)
720+
return dev_err_probe(&pdev->dev, ret,
721+
"failed to init from nvmem\n");
727722
} else {
728723
ret = imx_init_from_tempmon_data(pdev);
729724
if (ret) {
@@ -746,14 +741,9 @@ static int imx_thermal_probe(struct platform_device *pdev)
746741
data->socdata->power_down_mask);
747742

748743
ret = imx_thermal_register_legacy_cooling(data);
749-
if (ret) {
750-
if (ret == -EPROBE_DEFER)
751-
return ret;
752-
753-
dev_err(&pdev->dev,
754-
"failed to register cpufreq cooling device: %d\n", ret);
755-
return ret;
756-
}
744+
if (ret)
745+
return dev_err_probe(&pdev->dev, ret,
746+
"failed to register cpufreq cooling device\n");
757747

758748
data->thermal_clk = devm_clk_get(&pdev->dev, NULL);
759749
if (IS_ERR(data->thermal_clk)) {

drivers/thermal/intel/int340x_thermal/int3400_thermal.c

Lines changed: 40 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
#define INT3400_THERMAL_TABLE_CHANGED 0x83
1616
#define INT3400_ODVP_CHANGED 0x88
17+
#define INT3400_KEEP_ALIVE 0xA0
1718

1819
enum int3400_thermal_uuid {
1920
INT3400_THERMAL_PASSIVE_1,
@@ -83,8 +84,33 @@ static struct bin_attribute *data_attributes[] = {
8384
NULL,
8485
};
8586

87+
static ssize_t imok_store(struct device *dev, struct device_attribute *attr,
88+
const char *buf, size_t count)
89+
{
90+
struct int3400_thermal_priv *priv = dev_get_drvdata(dev);
91+
acpi_status status;
92+
int input, ret;
93+
94+
ret = kstrtouint(buf, 10, &input);
95+
if (ret)
96+
return ret;
97+
status = acpi_execute_simple_method(priv->adev->handle, "IMOK", input);
98+
if (ACPI_FAILURE(status))
99+
return -EIO;
100+
101+
return count;
102+
}
103+
104+
static DEVICE_ATTR_WO(imok);
105+
106+
static struct attribute *imok_attr[] = {
107+
&dev_attr_imok.attr,
108+
NULL
109+
};
110+
86111
static const struct attribute_group data_attribute_group = {
87112
.bin_attrs = data_attributes,
113+
.attrs = imok_attr,
88114
};
89115

90116
static ssize_t available_uuids_show(struct device *dev,
@@ -349,30 +375,33 @@ static void int3400_notify(acpi_handle handle,
349375
{
350376
struct int3400_thermal_priv *priv = data;
351377
char *thermal_prop[5];
378+
int therm_event;
352379

353380
if (!priv)
354381
return;
355382

356383
switch (event) {
357384
case INT3400_THERMAL_TABLE_CHANGED:
358-
thermal_prop[0] = kasprintf(GFP_KERNEL, "NAME=%s",
359-
priv->thermal->type);
360-
thermal_prop[1] = kasprintf(GFP_KERNEL, "TEMP=%d",
361-
priv->thermal->temperature);
362-
thermal_prop[2] = kasprintf(GFP_KERNEL, "TRIP=");
363-
thermal_prop[3] = kasprintf(GFP_KERNEL, "EVENT=%d",
364-
THERMAL_TABLE_CHANGED);
365-
thermal_prop[4] = NULL;
366-
kobject_uevent_env(&priv->thermal->device.kobj, KOBJ_CHANGE,
367-
thermal_prop);
385+
therm_event = THERMAL_TABLE_CHANGED;
386+
break;
387+
case INT3400_KEEP_ALIVE:
388+
therm_event = THERMAL_EVENT_KEEP_ALIVE;
368389
break;
369390
case INT3400_ODVP_CHANGED:
370391
evaluate_odvp(priv);
392+
therm_event = THERMAL_DEVICE_POWER_CAPABILITY_CHANGED;
371393
break;
372394
default:
373395
/* Ignore unknown notification codes sent to INT3400 device */
374-
break;
396+
return;
375397
}
398+
399+
thermal_prop[0] = kasprintf(GFP_KERNEL, "NAME=%s", priv->thermal->type);
400+
thermal_prop[1] = kasprintf(GFP_KERNEL, "TEMP=%d", priv->thermal->temperature);
401+
thermal_prop[2] = kasprintf(GFP_KERNEL, "TRIP=");
402+
thermal_prop[3] = kasprintf(GFP_KERNEL, "EVENT=%d", therm_event);
403+
thermal_prop[4] = NULL;
404+
kobject_uevent_env(&priv->thermal->device.kobj, KOBJ_CHANGE, thermal_prop);
376405
}
377406

378407
static int int3400_thermal_get_temp(struct thermal_zone_device *thermal,

0 commit comments

Comments
 (0)