Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'thermal-v7.1-rc1' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/thermal/linux

Merge updates of assorted thermal drivers for 7.1-rc1 from Daniel
Lezcano:

"- Added an OF node address to output message to make sensor names more
distinguishable (Alexander Stein)

- Added hwmon support for the i.MX97 thermal sensor (Alexander Stein)

- Clamped correctly the results when doing value/temperature conversion
in the Spreadtrum driver (Thorsten Blum)

- Added the SDM670 compatible DT bindings for the Tsens and the lMH
drivers (Richard Acayan)

- Added the SM8750 compatible DT bindings for the Tsens (Manaf
Meethalavalappu Pallikunhi)

- Added the Eliza SoC compatible DT bindings for the Tsens (Krzysztof
Kozlowski)

- Fixed inverted condition check on error in the Spear driver (Gopi
Krishna Menon)

- Converted the DT bindings documentation into DT schema (Gopi Krishna
Menon)

- Used max() macro to increase readibility in the Broadcom STB thermal
sensor (Thorsten Blum)

- Removed stale @trim_offset kernel-doc entry (John Madieu)"

* tag 'thermal-v7.1-rc1' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/thermal/linux:
thermal: renesas: rzg3e: Remove stale @trim_offset kernel-doc entry
thermal/drivers/brcmstb_thermal: Use max to simplify brcmstb_get_temp
dt-bindings: thermal: st,thermal-spear1340: convert to dtschema
thermal/drivers/spear: Fix error condition for reading st,thermal-flags
dt-bindings: thermal: qcom-tsens: Add Eliza SoC TSENS
dt-bindings: thermal: qcom-tsens: Document the SM8750 Temperature Sensor
thermal/drivers/sprd: Use min instead of clamp in sprd_thm_temp_to_rawdata
dt-bindings: thermal: lmh: Add SDM670 compatible
dt-bindings: thermal: tsens: add SDM670 compatible
thermal/drivers/sprd: Fix raw temperature clamping in sprd_thm_rawdata_to_temp
thermal/drivers/sprd: Fix temperature clamping in sprd_thm_temp_to_rawdata
thermal/drivers/imx91: Add hwmon support
thermal/of: Add OF node address to output message

+63 -34
+3
Documentation/devicetree/bindings/thermal/qcom-lmh.yaml
··· 23 23 - qcom,sdm845-lmh 24 24 - qcom,sm8150-lmh 25 25 - items: 26 + - const: qcom,sdm670-lmh 27 + - const: qcom,sdm845-lmh 28 + - items: 26 29 - const: qcom,qcm2290-lmh 27 30 - const: qcom,sm8150-lmh 28 31
+3
Documentation/devicetree/bindings/thermal/qcom-tsens.yaml
··· 54 54 - description: v2 of TSENS 55 55 items: 56 56 - enum: 57 + - qcom,eliza-tsens 57 58 - qcom,glymur-tsens 58 59 - qcom,kaanapali-tsens 59 60 - qcom,milos-tsens ··· 72 71 - qcom,sc8180x-tsens 73 72 - qcom,sc8280xp-tsens 74 73 - qcom,sdm630-tsens 74 + - qcom,sdm670-tsens 75 75 - qcom,sdm845-tsens 76 76 - qcom,sm6115-tsens 77 77 - qcom,sm6350-tsens ··· 83 81 - qcom,sm8450-tsens 84 82 - qcom,sm8550-tsens 85 83 - qcom,sm8650-tsens 84 + - qcom,sm8750-tsens 86 85 - qcom,x1e80100-tsens 87 86 - const: qcom,tsens-v2 88 87
-14
Documentation/devicetree/bindings/thermal/spear-thermal.txt
··· 1 - * SPEAr Thermal 2 - 3 - Required properties: 4 - - compatible : "st,thermal-spear1340" 5 - - reg : Address range of the thermal registers 6 - - st,thermal-flags: flags used to enable thermal sensor 7 - 8 - Example: 9 - 10 - thermal@fc000000 { 11 - compatible = "st,thermal-spear1340"; 12 - reg = <0xfc000000 0x1000>; 13 - st,thermal-flags = <0x7000>; 14 - };
+36
Documentation/devicetree/bindings/thermal/st,thermal-spear1340.yaml
··· 1 + # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/thermal/st,thermal-spear1340.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: SPEAr Thermal Sensor 8 + 9 + maintainers: 10 + - Viresh Kumar <vireshk@kernel.org> 11 + 12 + properties: 13 + compatible: 14 + const: st,thermal-spear1340 15 + 16 + reg: 17 + maxItems: 1 18 + 19 + st,thermal-flags: 20 + description: flags used to enable thermal sensor 21 + $ref: /schemas/types.yaml#/definitions/uint32 22 + 23 + required: 24 + - compatible 25 + - reg 26 + - st,thermal-flags 27 + 28 + additionalProperties: false 29 + 30 + examples: 31 + - | 32 + thermal@fc000000 { 33 + compatible = "st,thermal-spear1340"; 34 + reg = <0xfc000000 0x1000>; 35 + st,thermal-flags = <0x7000>; 36 + };
+3 -5
drivers/thermal/broadcom/brcmstb_thermal.c
··· 16 16 #include <linux/irqreturn.h> 17 17 #include <linux/interrupt.h> 18 18 #include <linux/kernel.h> 19 + #include <linux/minmax.h> 19 20 #include <linux/module.h> 20 21 #include <linux/of.h> 21 22 #include <linux/platform_device.h> ··· 155 154 { 156 155 struct brcmstb_thermal_priv *priv = thermal_zone_device_priv(tz); 157 156 u32 val; 158 - long t; 157 + int t; 159 158 160 159 val = __raw_readl(priv->tmon_base + AVS_TMON_STATUS); 161 160 ··· 165 164 val = (val & AVS_TMON_STATUS_data_msk) >> AVS_TMON_STATUS_data_shift; 166 165 167 166 t = avs_tmon_code_to_temp(priv, val); 168 - if (t < 0) 169 - *temp = 0; 170 - else 171 - *temp = t; 167 + *temp = max(0, t); 172 168 173 169 return 0; 174 170 }
+4
drivers/thermal/imx91_thermal.c
··· 17 17 #include <linux/thermal.h> 18 18 #include <linux/units.h> 19 19 20 + #include "thermal_hwmon.h" 21 + 20 22 #define REG_SET 0x4 21 23 #define REG_CLR 0x8 22 24 #define REG_TOG 0xc ··· 319 317 if (IS_ERR(tmu->tzd)) 320 318 return dev_err_probe(dev, PTR_ERR(tmu->tzd), 321 319 "failed to register thermal zone sensor\n"); 320 + 321 + devm_thermal_add_hwmon_sysfs(dev, tmu->tzd); 322 322 323 323 irq = platform_get_irq(pdev, 0); 324 324 if (irq < 0)
-1
drivers/thermal/renesas/rzg3e_thermal.c
··· 93 93 * @info: chip type specific information 94 94 * @trmval0: calibration value 0 (b) 95 95 * @trmval1: calibration value 1 (c) 96 - * @trim_offset: offset for trim registers in syscon 97 96 * @lock: protects hardware access during conversions 98 97 */ 99 98 struct rzg3e_thermal_priv {
+1 -1
drivers/thermal/spear_thermal.c
··· 93 93 struct device_node *np = pdev->dev.of_node; 94 94 int ret = 0, val; 95 95 96 - if (!np || !of_property_read_u32(np, "st,thermal-flags", &val)) { 96 + if (!np || of_property_read_u32(np, "st,thermal-flags", &val)) { 97 97 dev_err(&pdev->dev, "Failed: DT Pdata not passed\n"); 98 98 return -EINVAL; 99 99 }
+3 -3
drivers/thermal/sprd_thermal.c
··· 178 178 static int sprd_thm_rawdata_to_temp(struct sprd_thermal_sensor *sen, 179 179 u32 rawdata) 180 180 { 181 - clamp(rawdata, (u32)SPRD_THM_RAW_DATA_LOW, (u32)SPRD_THM_RAW_DATA_HIGH); 181 + rawdata = clamp(rawdata, SPRD_THM_RAW_DATA_LOW, SPRD_THM_RAW_DATA_HIGH); 182 182 183 183 /* 184 184 * According to the thermal datasheet, the formula of converting ··· 192 192 { 193 193 u32 val; 194 194 195 - clamp(temp, (int)SPRD_THM_TEMP_LOW, (int)SPRD_THM_TEMP_HIGH); 195 + temp = clamp(temp, SPRD_THM_TEMP_LOW, SPRD_THM_TEMP_HIGH); 196 196 197 197 /* 198 198 * According to the thermal datasheet, the formula of converting ··· 201 201 */ 202 202 val = (temp + sen->cal_offset) / sen->cal_slope; 203 203 204 - return clamp(val, val, (u32)(SPRD_THM_RAW_DATA_HIGH - 1)); 204 + return min(val, SPRD_THM_RAW_DATA_HIGH - 1); 205 205 } 206 206 207 207 static int sprd_thm_read_temp(struct thermal_zone_device *tz, int *temp)
+10 -10
drivers/thermal/thermal_of.c
··· 144 144 count = of_count_phandle_with_args(child, "thermal-sensors", 145 145 "#thermal-sensor-cells"); 146 146 if (count <= 0) { 147 - pr_err("%pOFn: missing thermal sensor\n", child); 147 + pr_err("%pOFP: missing thermal sensor\n", child); 148 148 return ERR_PTR(-EINVAL); 149 149 } 150 150 ··· 156 156 "#thermal-sensor-cells", 157 157 i, &sensor_specs); 158 158 if (ret < 0) { 159 - pr_err("%pOFn: Failed to read thermal-sensors cells: %d\n", child, ret); 159 + pr_err("%pOFP: Failed to read thermal-sensors cells: %d\n", child, ret); 160 160 return ERR_PTR(ret); 161 161 } 162 162 163 163 of_node_put(sensor_specs.np); 164 164 if ((sensor == sensor_specs.np) && id == (sensor_specs.args_count ? 165 165 sensor_specs.args[0] : 0)) { 166 - pr_debug("sensor %pOFn id=%d belongs to %pOFn\n", sensor, id, child); 166 + pr_debug("sensor %pOFP id=%d belongs to %pOFP\n", sensor, id, child); 167 167 return no_free_ptr(child); 168 168 } 169 169 } ··· 180 180 if (ret == -EINVAL) { 181 181 *pdelay = 0; 182 182 } else if (ret < 0) { 183 - pr_err("%pOFn: Couldn't get polling-delay-passive: %d\n", np, ret); 183 + pr_err("%pOFP: Couldn't get polling-delay-passive: %d\n", np, ret); 184 184 return ret; 185 185 } 186 186 ··· 188 188 if (ret == -EINVAL) { 189 189 *delay = 0; 190 190 } else if (ret < 0) { 191 - pr_err("%pOFn: Couldn't get polling-delay: %d\n", np, ret); 191 + pr_err("%pOFP: Couldn't get polling-delay: %d\n", np, ret); 192 192 return ret; 193 193 } 194 194 ··· 380 380 np = of_thermal_zone_find(sensor, id); 381 381 if (IS_ERR(np)) { 382 382 if (PTR_ERR(np) != -ENODEV) 383 - pr_err("Failed to find thermal zone for %pOFn id=%d\n", sensor, id); 383 + pr_err("Failed to find thermal zone for %pOFP id=%d\n", sensor, id); 384 384 return ERR_CAST(np); 385 385 } 386 386 387 387 trips = thermal_of_trips_init(np, &ntrips); 388 388 if (IS_ERR(trips)) { 389 - pr_err("Failed to parse trip points for %pOFn id=%d\n", sensor, id); 389 + pr_err("Failed to parse trip points for %pOFP id=%d\n", sensor, id); 390 390 ret = PTR_ERR(trips); 391 391 goto out_of_node_put; 392 392 } 393 393 394 394 if (!trips) 395 - pr_info("No trip points found for %pOFn id=%d\n", sensor, id); 395 + pr_info("No trip points found for %pOFP id=%d\n", sensor, id); 396 396 397 397 ret = thermal_of_monitor_init(np, &delay, &pdelay); 398 398 if (ret) { 399 - pr_err("Failed to initialize monitoring delays from %pOFn\n", np); 399 + pr_err("Failed to initialize monitoring delays from %pOFP\n", np); 400 400 goto out_kfree_trips; 401 401 } 402 402 ··· 417 417 pdelay, delay); 418 418 if (IS_ERR(tz)) { 419 419 ret = PTR_ERR(tz); 420 - pr_err("Failed to register thermal zone %pOFn: %d\n", np, ret); 420 + pr_err("Failed to register thermal zone %pOFP: %d\n", np, ret); 421 421 goto out_kfree_trips; 422 422 } 423 423