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

Merge tag 'thermal-6.2-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull more thermal control updates from Rafael Wysocki:
"These are updates of assorted thermal drivers, mostly for ARM
platforms, generally isolated and fairly straightforward, and the
recent Intel HFI driver fix for systems without HFI support.

Specifics:

- Avoid clearing the HFI status bit on systems without HFI support
which triggers unchecked MSR access errors (Srinivas Pandruvada)

- Add sm8450 and sm8550 QCom compatible string to DT bindings (Luca
Weiss, Neil Armstrong)

- Use devm_platform_get_and_ioremap_resource on the ST platform to
group two calls into a single one (Minghao Chi)

- Use GENMASK instead of bitmaps and validate the temperature after
reading it in the imx8mm_thermal driver (Marcus Folkesson)

- Convert generic-adc-thermal to DT schema (Rob Herring)

- Fix debug print message with inverted logic in the k3_j72xx_bandgap
driver (Keerthy)

- Fix memory leak on thermal_of_zone_register() failure (Ido
Schimmel)

- Add support for IPQ8074 in the tsens thermal driver along with the
DT bindings (Robert Marko)

- Fix and rework the debugfs code in the tsens driver (Christian
Marangi)

- Add calibration and DT documentation for the imx8mm driver (Marek
Vasut)

- Add DT bindings and compatible for the Mediatek SoCs mt7981 and
mt7983 (Daniel Golle)

- Don't show an error message if it happens at probe time while it
will be deferred on the QCom SPMI ADC driver (Johan Hovold)

- Add HWMon support for the imx8mm board (Alexander Stein)

- Remove pointless include from the power allocator governor
(Christophe JAILLET)

- Add interrupt DT bindings for QCom SoCs SC8280XP, SM6350 and SM8450
(Krzysztof Kozlowski)

- Fix inaccurate warning message for the QCom tsens gen2 (Luca Weiss)

- Demote error log of thermal zone register to debug in the tsens
QCom driver (Manivannan Sadhasivam)

- Consolidate the the efuse values and the errata handling in the TI
Bandgap driver (Bryan Brattlof)

- Document Renesas RZ/Five as compatible with RZ/G2UL in the DT
bindings (Lad Prabhakar)

- Fix the irq handler return value in the LMh driver (Bjorn
Andersson)

- Delete empty platform remove callback from imx_sc_thermal (Uwe
Kleine-König)"

* tag 'thermal-6.2-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (35 commits)
thermal/drivers/imx_sc_thermal: Drop empty platform remove function
thermal/drivers/qcom/lmh: Fix irq handler return value
dt-bindings: thermal: qcom-tsens: Add compatible for sm8550
thermal/drivers/st: Use devm_platform_get_and_ioremap_resource()
dt-bindings: thermal: rzg2l-thermal: Document RZ/Five SoC
dt-bindings: thermal: k3-j72xx: conditionally require efuse reg range
dt-bindings: thermal: k3-j72xx: elaborate on binding description
thermal/drivers/k3_j72xx_bandgap: Map fuse_base only for erratum workaround
thermal/drivers/k3_j72xx_bandgap: Remove fuse_base from structure
thermal/drivers/k3_j72xx_bandgap: Use bool for i2128 erratum flag
thermal/drivers/k3_j72xx_bandgap: Simplify k3_thermal_get_temp() function
thermal/drivers/qcom: Demote error log of thermal zone register to debug
thermal/drivers/qcom/temp-alarm: Fix inaccurate warning for gen2
dt-bindings: thermal: qcom-tsens: narrow interrupts for SC8280XP, SM6350 and SM8450
thermal/core/power allocator: Remove a useless include
thermal/drivers/imx8mm: Add hwmon support
thermal: qcom-spmi-adc-tm5: suppress probe-deferral error message
dt-bindings: thermal: mediatek: add compatible string for MT7986 and MT7981 SoC
thermal: ti-soc-thermal: Drop comma after SoC match table sentinel
thermal/drivers/imx: Add support for loading calibration data from OCOTP
...

+514 -191
+84
Documentation/devicetree/bindings/thermal/generic-adc-thermal.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/generic-adc-thermal.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: General Purpose Analog To Digital Converter (ADC) based thermal sensor 8 + 9 + maintainers: 10 + - Laxman Dewangan <ldewangan@nvidia.com> 11 + 12 + description: 13 + On some of platforms, thermal sensor like thermistors are connected to 14 + one of ADC channel and sensor resistance is read via voltage across the 15 + sensor resistor. The voltage read across the sensor is mapped to 16 + temperature using voltage-temperature lookup table. 17 + 18 + properties: 19 + compatible: 20 + const: generic-adc-thermal 21 + 22 + '#thermal-sensor-cells': 23 + const: 0 24 + 25 + io-channels: 26 + maxItems: 1 27 + 28 + io-channel-names: 29 + const: sensor-channel 30 + 31 + temperature-lookup-table: 32 + description: | 33 + Lookup table to map the relation between ADC value and temperature. 34 + When ADC is read, the value is looked up on the table to get the 35 + equivalent temperature. 36 + 37 + If not specified, driver assumes the ADC channel gives milliCelsius 38 + directly. 39 + $ref: /schemas/types.yaml#/definitions/int32-matrix 40 + items: 41 + items: 42 + - description: Temperature in milliCelsius 43 + - description: ADC read value 44 + 45 + required: 46 + - compatible 47 + - '#thermal-sensor-cells' 48 + - io-channels 49 + - io-channel-names 50 + 51 + additionalProperties: false 52 + 53 + examples: 54 + - | 55 + #include <dt-bindings/thermal/thermal.h> 56 + 57 + thermal-sensor { 58 + compatible = "generic-adc-thermal"; 59 + #thermal-sensor-cells = <0>; 60 + io-channels = <&ads1015 1>; 61 + io-channel-names = "sensor-channel"; 62 + temperature-lookup-table = < 63 + (-40000) 2578 64 + (-39000) 2577 65 + (-38000) 2576 66 + (-37000) 2575 67 + (-36000) 2574 68 + (-35000) 2573 69 + (-34000) 2572 70 + (-33000) 2571 71 + (-32000) 2569 72 + (-31000) 2568 73 + (-30000) 2567 74 + /* skip */ 75 + 118000 254 76 + 119000 247 77 + 120000 240 78 + 121000 233 79 + 122000 226 80 + 123000 220 81 + 124000 214 82 + 125000 208>; 83 + }; 84 + ...
+7
Documentation/devicetree/bindings/thermal/imx8mm-thermal.yaml
··· 32 32 clocks: 33 33 maxItems: 1 34 34 35 + nvmem-cells: 36 + maxItems: 1 37 + description: Phandle to the calibration data provided by ocotp 38 + 39 + nvmem-cell-names: 40 + const: calib 41 + 35 42 "#thermal-sensor-cells": 36 43 description: | 37 44 Number of cells required to uniquely identify the thermal
+2
Documentation/devicetree/bindings/thermal/mediatek-thermal.txt
··· 13 13 - "mediatek,mt2701-thermal" : For MT2701 family of SoCs 14 14 - "mediatek,mt2712-thermal" : For MT2712 family of SoCs 15 15 - "mediatek,mt7622-thermal" : For MT7622 SoC 16 + - "mediatek,mt7981-thermal", "mediatek,mt7986-thermal" : For MT7981 SoC 17 + - "mediatek,mt7986-thermal" : For MT7986 SoC 16 18 - "mediatek,mt8183-thermal" : For MT8183 family of SoCs 17 19 - "mediatek,mt8516-thermal", "mediatek,mt2701-thermal : For MT8516 family of SoCs 18 20 - reg: Address range of the thermal controller
+74 -15
Documentation/devicetree/bindings/thermal/qcom-tsens.yaml
··· 58 58 - qcom,sm8150-tsens 59 59 - qcom,sm8250-tsens 60 60 - qcom,sm8350-tsens 61 + - qcom,sm8450-tsens 62 + - qcom,sm8550-tsens 61 63 - const: qcom,tsens-v2 64 + 65 + - description: v2 of TSENS with combined interrupt 66 + enum: 67 + - qcom,ipq8074-tsens 62 68 63 69 reg: 64 70 items: ··· 73 67 74 68 interrupts: 75 69 minItems: 1 76 - items: 77 - - description: Combined interrupt if upper or lower threshold crossed 78 - - description: Interrupt if critical threshold crossed 70 + maxItems: 2 79 71 80 72 interrupt-names: 81 73 minItems: 1 82 - items: 83 - - const: uplow 84 - - const: critical 74 + maxItems: 2 85 75 86 76 nvmem-cells: 87 77 minItems: 1 ··· 131 129 then: 132 130 properties: 133 131 interrupts: 134 - maxItems: 1 132 + items: 133 + - description: Combined interrupt if upper or lower threshold crossed 135 134 interrupt-names: 136 - maxItems: 1 137 - 138 - else: 139 - properties: 140 - interrupts: 141 - minItems: 2 142 - interrupt-names: 143 - minItems: 2 135 + items: 136 + - const: uplow 144 137 145 138 - if: 146 139 properties: 147 140 compatible: 148 141 contains: 149 142 enum: 143 + - qcom,msm8953-tsens 144 + - qcom,msm8996-tsens 145 + - qcom,msm8998-tsens 146 + - qcom,sc7180-tsens 147 + - qcom,sc7280-tsens 148 + - qcom,sc8180x-tsens 149 + - qcom,sc8280xp-tsens 150 + - qcom,sdm630-tsens 151 + - qcom,sdm845-tsens 152 + - qcom,sm6350-tsens 153 + - qcom,sm8150-tsens 154 + - qcom,sm8250-tsens 155 + - qcom,sm8350-tsens 156 + - qcom,sm8450-tsens 157 + - qcom,tsens-v2 158 + then: 159 + properties: 160 + interrupts: 161 + items: 162 + - description: Combined interrupt if upper or lower threshold crossed 163 + - description: Interrupt if critical threshold crossed 164 + interrupt-names: 165 + items: 166 + - const: uplow 167 + - const: critical 168 + 169 + - if: 170 + properties: 171 + compatible: 172 + contains: 173 + enum: 174 + - qcom,ipq8074-tsens 175 + then: 176 + properties: 177 + interrupts: 178 + items: 179 + - description: Combined interrupt if upper, lower or critical thresholds crossed 180 + interrupt-names: 181 + items: 182 + - const: combined 183 + 184 + - if: 185 + properties: 186 + compatible: 187 + contains: 188 + enum: 189 + - qcom,ipq8074-tsens 150 190 - qcom,tsens-v0_1 151 191 - qcom,tsens-v1 152 192 - qcom,tsens-v2 ··· 269 225 interrupt-names = "uplow", "critical"; 270 226 271 227 #qcom,sensors = <13>; 228 + #thermal-sensor-cells = <1>; 229 + }; 230 + 231 + - | 232 + #include <dt-bindings/interrupt-controller/arm-gic.h> 233 + // Example 4 (for any IPQ8074 based SoC-s): 234 + tsens4: thermal-sensor@4a9000 { 235 + compatible = "qcom,ipq8074-tsens"; 236 + reg = <0x4a9000 0x1000>, 237 + <0x4a8000 0x1000>; 238 + 239 + interrupts = <GIC_SPI 184 IRQ_TYPE_LEVEL_HIGH>; 240 + interrupt-names = "combined"; 241 + 242 + #qcom,sensors = <16>; 272 243 #thermal-sensor-cells = <1>; 273 244 }; 274 245 ...
+1 -1
Documentation/devicetree/bindings/thermal/rzg2l-thermal.yaml
··· 17 17 compatible: 18 18 items: 19 19 - enum: 20 - - renesas,r9a07g043-tsu # RZ/G2UL 20 + - renesas,r9a07g043-tsu # RZ/G2UL and RZ/Five 21 21 - renesas,r9a07g044-tsu # RZ/G2{L,LC} 22 22 - renesas,r9a07g054-tsu # RZ/V2L 23 23 - const: renesas,rzg2l-tsu
-95
Documentation/devicetree/bindings/thermal/thermal-generic-adc.txt
··· 1 - General Purpose Analog To Digital Converter (ADC) based thermal sensor. 2 - 3 - On some of platforms, thermal sensor like thermistors are connected to 4 - one of ADC channel and sensor resistance is read via voltage across the 5 - sensor resistor. The voltage read across the sensor is mapped to 6 - temperature using voltage-temperature lookup table. 7 - 8 - Required properties: 9 - =================== 10 - - compatible: Must be "generic-adc-thermal". 11 - - #thermal-sensor-cells: Should be 1. See Documentation/devicetree/bindings/thermal/thermal-sensor.yaml for a description 12 - of this property. 13 - Optional properties: 14 - =================== 15 - - temperature-lookup-table: Two dimensional array of Integer; lookup table 16 - to map the relation between ADC value and 17 - temperature. When ADC is read, the value is 18 - looked up on the table to get the equivalent 19 - temperature. 20 - 21 - The first value of the each row of array is the 22 - temperature in milliCelsius and second value of 23 - the each row of array is the ADC read value. 24 - 25 - If not specified, driver assumes the ADC channel 26 - gives milliCelsius directly. 27 - 28 - Example : 29 - #include <dt-bindings/thermal/thermal.h> 30 - 31 - i2c@7000c400 { 32 - ads1015: ads1015@4a { 33 - reg = <0x4a>; 34 - compatible = "ads1015"; 35 - sampling-frequency = <3300>; 36 - #io-channel-cells = <1>; 37 - }; 38 - }; 39 - 40 - tboard_thermistor: thermal-sensor { 41 - compatible = "generic-adc-thermal"; 42 - #thermal-sensor-cells = <0>; 43 - io-channels = <&ads1015 1>; 44 - io-channel-names = "sensor-channel"; 45 - temperature-lookup-table = < (-40000) 2578 46 - (-39000) 2577 47 - (-38000) 2576 48 - (-37000) 2575 49 - (-36000) 2574 50 - (-35000) 2573 51 - (-34000) 2572 52 - (-33000) 2571 53 - (-32000) 2569 54 - (-31000) 2568 55 - (-30000) 2567 56 - :::::::::: 57 - 118000 254 58 - 119000 247 59 - 120000 240 60 - 121000 233 61 - 122000 226 62 - 123000 220 63 - 124000 214 64 - 125000 208>; 65 - }; 66 - 67 - dummy_cool_dev: dummy-cool-dev { 68 - compatible = "dummy-cooling-dev"; 69 - #cooling-cells = <2>; /* min followed by max */ 70 - }; 71 - 72 - thermal-zones { 73 - Tboard { 74 - polling-delay = <15000>; /* milliseconds */ 75 - polling-delay-passive = <0>; /* milliseconds */ 76 - thermal-sensors = <&tboard_thermistor>; 77 - 78 - trips { 79 - therm_est_trip: therm_est_trip { 80 - temperature = <40000>; 81 - type = "active"; 82 - hysteresis = <1000>; 83 - }; 84 - }; 85 - 86 - cooling-maps { 87 - map0 { 88 - trip = <&therm_est_trip>; 89 - cooling-device = <&dummy_cool_dev THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; 90 - contribution = <100>; 91 - }; 92 - 93 - }; 94 - }; 95 - };
+34 -1
Documentation/devicetree/bindings/thermal/ti,j72xx-thermal.yaml
··· 9 9 maintainers: 10 10 - Keerthy <j-keerthy@ti.com> 11 11 12 + description: | 13 + The TI K3 family of SoCs typically have a Voltage & Thermal 14 + Management (VTM) device to control up to 8 temperature diode 15 + sensors to measure silicon junction temperatures from different 16 + hotspots of the chip as well as provide temperature, interrupt 17 + and alerting information. 18 + 19 + The following polynomial equation can then be used to convert 20 + value returned by this device into a temperature in Celsius 21 + 22 + Temp(C) = (-9.2627e-12) * x^4 + (6.0373e-08) * x^3 + \ 23 + (-1.7058e-04) * x^2 + (3.2512e-01) * x + (-4.9003e+01) 24 + 12 25 properties: 13 26 compatible: 14 27 enum: ··· 32 19 items: 33 20 - description: VTM cfg1 register space 34 21 - description: VTM cfg2 register space 35 - - description: VTM efuse register space 22 + - description: | 23 + A software trimming method must be applied to some Jacinto 24 + devices to function properly. This eFuse region provides 25 + the information needed for these SoCs to report 26 + temperatures accurately. 27 + minItems: 2 36 28 37 29 power-domains: 38 30 maxItems: 1 39 31 40 32 "#thermal-sensor-cells": 41 33 const: 1 34 + 35 + allOf: 36 + - if: 37 + properties: 38 + compatible: 39 + contains: 40 + const: ti,j721e-vtm 41 + then: 42 + properties: 43 + reg: 44 + minItems: 3 45 + else: 46 + properties: 47 + reg: 48 + maxItems: 2 42 49 43 50 required: 44 51 - compatible
-1
drivers/thermal/gov_power_allocator.c
··· 8 8 9 9 #define pr_fmt(fmt) "Power allocator: " fmt 10 10 11 - #include <linux/rculist.h> 12 11 #include <linux/slab.h> 13 12 #include <linux/thermal.h> 14 13
+177 -3
drivers/thermal/imx8mm_thermal.c
··· 10 10 #include <linux/err.h> 11 11 #include <linux/io.h> 12 12 #include <linux/module.h> 13 + #include <linux/nvmem-consumer.h> 13 14 #include <linux/of.h> 14 15 #include <linux/of_device.h> 15 16 #include <linux/platform_device.h> 17 + #include <linux/slab.h> 16 18 #include <linux/thermal.h> 17 19 18 20 #include "thermal_core.h" 21 + #include "thermal_hwmon.h" 19 22 20 23 #define TER 0x0 /* TMU enable */ 21 24 #define TPS 0x4 22 25 #define TRITSR 0x20 /* TMU immediate temp */ 26 + /* TMU calibration data registers */ 27 + #define TASR 0x28 28 + #define TASR_BUF_SLOPE_MASK GENMASK(19, 16) 29 + #define TASR_BUF_VREF_MASK GENMASK(4, 0) /* TMU_V1 */ 30 + #define TASR_BUF_VERF_SEL_MASK GENMASK(1, 0) /* TMU_V2 */ 31 + #define TCALIV(n) (0x30 + ((n) * 4)) 32 + #define TCALIV_EN BIT(31) 33 + #define TCALIV_HR_MASK GENMASK(23, 16) /* TMU_V1 */ 34 + #define TCALIV_RT_MASK GENMASK(7, 0) /* TMU_V1 */ 35 + #define TCALIV_SNSR105C_MASK GENMASK(27, 16) /* TMU_V2 */ 36 + #define TCALIV_SNSR25C_MASK GENMASK(11, 0) /* TMU_V2 */ 37 + #define TRIM 0x3c 38 + #define TRIM_BJT_CUR_MASK GENMASK(23, 20) 39 + #define TRIM_BGR_MASK GENMASK(31, 28) 40 + #define TRIM_VLSB_MASK GENMASK(15, 12) 41 + #define TRIM_EN_CH BIT(7) 23 42 24 43 #define TER_ADC_PD BIT(30) 25 44 #define TER_EN BIT(31) 26 - #define TRITSR_TEMP0_VAL_MASK 0xff 27 - #define TRITSR_TEMP1_VAL_MASK 0xff0000 45 + #define TRITSR_TEMP0_VAL_MASK GENMASK(7, 0) 46 + #define TRITSR_TEMP1_VAL_MASK GENMASK(23, 16) 28 47 29 48 #define PROBE_SEL_ALL GENMASK(31, 30) 30 49 31 50 #define probe_status_offset(x) (30 + x) 32 51 #define SIGN_BIT BIT(7) 33 52 #define TEMP_VAL_MASK GENMASK(6, 0) 53 + 54 + /* TMU OCOTP calibration data bitfields */ 55 + #define ANA0_EN BIT(25) 56 + #define ANA0_BUF_VREF_MASK GENMASK(24, 20) 57 + #define ANA0_BUF_SLOPE_MASK GENMASK(19, 16) 58 + #define ANA0_HR_MASK GENMASK(15, 8) 59 + #define ANA0_RT_MASK GENMASK(7, 0) 60 + #define TRIM2_VLSB_MASK GENMASK(23, 20) 61 + #define TRIM2_BGR_MASK GENMASK(19, 16) 62 + #define TRIM2_BJT_CUR_MASK GENMASK(15, 12) 63 + #define TRIM2_BUF_SLOP_SEL_MASK GENMASK(11, 8) 64 + #define TRIM2_BUF_VERF_SEL_MASK GENMASK(7, 6) 65 + #define TRIM3_TCA25_0_LSB_MASK GENMASK(31, 28) 66 + #define TRIM3_TCA40_0_MASK GENMASK(27, 16) 67 + #define TRIM4_TCA40_1_MASK GENMASK(31, 20) 68 + #define TRIM4_TCA105_0_MASK GENMASK(19, 8) 69 + #define TRIM4_TCA25_0_MSB_MASK GENMASK(7, 0) 70 + #define TRIM5_TCA105_1_MASK GENMASK(23, 12) 71 + #define TRIM5_TCA25_1_MASK GENMASK(11, 0) 34 72 35 73 #define VER1_TEMP_LOW_LIMIT 10000 36 74 #define VER2_TEMP_LOW_LIMIT -40000 ··· 103 65 u32 val; 104 66 105 67 val = readl_relaxed(tmu->base + TRITSR) & TRITSR_TEMP0_VAL_MASK; 68 + 69 + /* 70 + * Do not validate against the V bit (bit 31) due to errata 71 + * ERR051272: TMU: Bit 31 of registers TMU_TSCR/TMU_TRITSR/TMU_TRATSR invalid 72 + */ 73 + 106 74 *temp = val * 1000; 107 - if (*temp < VER1_TEMP_LOW_LIMIT) 75 + if (*temp < VER1_TEMP_LOW_LIMIT || *temp > VER2_TEMP_HIGH_LIMIT) 108 76 return -EAGAIN; 109 77 110 78 return 0; ··· 172 128 writel_relaxed(val, tmu->base + TPS); 173 129 } 174 130 131 + static int imx8mm_tmu_probe_set_calib_v1(struct platform_device *pdev, 132 + struct imx8mm_tmu *tmu) 133 + { 134 + struct device *dev = &pdev->dev; 135 + u32 ana0; 136 + int ret; 137 + 138 + ret = nvmem_cell_read_u32(&pdev->dev, "calib", &ana0); 139 + if (ret) { 140 + dev_warn(dev, "Failed to read OCOTP nvmem cell (%d).\n", ret); 141 + return ret; 142 + } 143 + 144 + writel(FIELD_PREP(TASR_BUF_VREF_MASK, 145 + FIELD_GET(ANA0_BUF_VREF_MASK, ana0)) | 146 + FIELD_PREP(TASR_BUF_SLOPE_MASK, 147 + FIELD_GET(ANA0_BUF_SLOPE_MASK, ana0)), 148 + tmu->base + TASR); 149 + 150 + writel(FIELD_PREP(TCALIV_RT_MASK, FIELD_GET(ANA0_RT_MASK, ana0)) | 151 + FIELD_PREP(TCALIV_HR_MASK, FIELD_GET(ANA0_HR_MASK, ana0)) | 152 + ((ana0 & ANA0_EN) ? TCALIV_EN : 0), 153 + tmu->base + TCALIV(0)); 154 + 155 + return 0; 156 + } 157 + 158 + static int imx8mm_tmu_probe_set_calib_v2(struct platform_device *pdev, 159 + struct imx8mm_tmu *tmu) 160 + { 161 + struct device *dev = &pdev->dev; 162 + struct nvmem_cell *cell; 163 + u32 trim[4] = { 0 }; 164 + size_t len; 165 + void *buf; 166 + 167 + cell = nvmem_cell_get(dev, "calib"); 168 + if (IS_ERR(cell)) 169 + return PTR_ERR(cell); 170 + 171 + buf = nvmem_cell_read(cell, &len); 172 + nvmem_cell_put(cell); 173 + 174 + if (IS_ERR(buf)) 175 + return PTR_ERR(buf); 176 + 177 + memcpy(trim, buf, min(len, sizeof(trim))); 178 + kfree(buf); 179 + 180 + if (len != 16) { 181 + dev_err(dev, 182 + "OCOTP nvmem cell length is %zu, must be 16.\n", len); 183 + return -EINVAL; 184 + } 185 + 186 + /* Blank sample hardware */ 187 + if (!trim[0] && !trim[1] && !trim[2] && !trim[3]) { 188 + /* Use a default 25C binary codes */ 189 + writel(FIELD_PREP(TCALIV_SNSR25C_MASK, 0x63c), 190 + tmu->base + TCALIV(0)); 191 + writel(FIELD_PREP(TCALIV_SNSR25C_MASK, 0x63c), 192 + tmu->base + TCALIV(1)); 193 + return 0; 194 + } 195 + 196 + writel(FIELD_PREP(TASR_BUF_VERF_SEL_MASK, 197 + FIELD_GET(TRIM2_BUF_VERF_SEL_MASK, trim[0])) | 198 + FIELD_PREP(TASR_BUF_SLOPE_MASK, 199 + FIELD_GET(TRIM2_BUF_SLOP_SEL_MASK, trim[0])), 200 + tmu->base + TASR); 201 + 202 + writel(FIELD_PREP(TRIM_BJT_CUR_MASK, 203 + FIELD_GET(TRIM2_BJT_CUR_MASK, trim[0])) | 204 + FIELD_PREP(TRIM_BGR_MASK, FIELD_GET(TRIM2_BGR_MASK, trim[0])) | 205 + FIELD_PREP(TRIM_VLSB_MASK, FIELD_GET(TRIM2_VLSB_MASK, trim[0])) | 206 + TRIM_EN_CH, 207 + tmu->base + TRIM); 208 + 209 + writel(FIELD_PREP(TCALIV_SNSR25C_MASK, 210 + FIELD_GET(TRIM3_TCA25_0_LSB_MASK, trim[1]) | 211 + (FIELD_GET(TRIM4_TCA25_0_MSB_MASK, trim[2]) << 4)) | 212 + FIELD_PREP(TCALIV_SNSR105C_MASK, 213 + FIELD_GET(TRIM4_TCA105_0_MASK, trim[2])), 214 + tmu->base + TCALIV(0)); 215 + 216 + writel(FIELD_PREP(TCALIV_SNSR25C_MASK, 217 + FIELD_GET(TRIM5_TCA25_1_MASK, trim[3])) | 218 + FIELD_PREP(TCALIV_SNSR105C_MASK, 219 + FIELD_GET(TRIM5_TCA105_1_MASK, trim[3])), 220 + tmu->base + TCALIV(1)); 221 + 222 + writel(FIELD_PREP(TCALIV_SNSR25C_MASK, 223 + FIELD_GET(TRIM3_TCA40_0_MASK, trim[1])) | 224 + FIELD_PREP(TCALIV_SNSR105C_MASK, 225 + FIELD_GET(TRIM4_TCA40_1_MASK, trim[2])), 226 + tmu->base + TCALIV(2)); 227 + 228 + return 0; 229 + } 230 + 231 + static int imx8mm_tmu_probe_set_calib(struct platform_device *pdev, 232 + struct imx8mm_tmu *tmu) 233 + { 234 + struct device *dev = &pdev->dev; 235 + 236 + /* 237 + * Lack of calibration data OCOTP reference is not considered 238 + * fatal to retain compatibility with old DTs. It is however 239 + * strongly recommended to update such old DTs to get correct 240 + * temperature compensation values for each SoC. 241 + */ 242 + if (!of_find_property(pdev->dev.of_node, "nvmem-cells", NULL)) { 243 + dev_warn(dev, 244 + "No OCOTP nvmem reference found, SoC-specific calibration not loaded. Please update your DT.\n"); 245 + return 0; 246 + } 247 + 248 + if (tmu->socdata->version == TMU_VER1) 249 + return imx8mm_tmu_probe_set_calib_v1(pdev, tmu); 250 + 251 + return imx8mm_tmu_probe_set_calib_v2(pdev, tmu); 252 + } 253 + 175 254 static int imx8mm_tmu_probe(struct platform_device *pdev) 176 255 { 177 256 const struct thermal_soc_data *data; ··· 343 176 goto disable_clk; 344 177 } 345 178 tmu->sensors[i].hw_id = i; 179 + 180 + if (devm_thermal_add_hwmon_sysfs(tmu->sensors[i].tzd)) 181 + dev_warn(&pdev->dev, "failed to add hwmon sysfs attributes\n"); 346 182 } 347 183 348 184 platform_set_drvdata(pdev, tmu); 185 + 186 + ret = imx8mm_tmu_probe_set_calib(pdev, tmu); 187 + if (ret) 188 + goto disable_clk; 349 189 350 190 /* enable all the probes for V2 TMU */ 351 191 if (tmu->socdata->version == TMU_VER2)
-6
drivers/thermal/imx_sc_thermal.c
··· 127 127 return 0; 128 128 } 129 129 130 - static int imx_sc_thermal_remove(struct platform_device *pdev) 131 - { 132 - return 0; 133 - } 134 - 135 130 static int imx_sc_sensors[] = { IMX_SC_R_SYSTEM, IMX_SC_R_PMIC_0, -1 }; 136 131 137 132 static const struct of_device_id imx_sc_thermal_table[] = { ··· 137 142 138 143 static struct platform_driver imx_sc_thermal_driver = { 139 144 .probe = imx_sc_thermal_probe, 140 - .remove = imx_sc_thermal_remove, 141 145 .driver = { 142 146 .name = "imx-sc-thermal", 143 147 .of_match_table = imx_sc_thermal_table,
+4 -1
drivers/thermal/intel/therm_throt.c
··· 194 194 #define THERM_STATUS_PROCHOT_LOG BIT(1) 195 195 196 196 #define THERM_STATUS_CLEAR_CORE_MASK (BIT(1) | BIT(3) | BIT(5) | BIT(7) | BIT(9) | BIT(11) | BIT(13) | BIT(15)) 197 - #define THERM_STATUS_CLEAR_PKG_MASK (BIT(1) | BIT(3) | BIT(5) | BIT(7) | BIT(9) | BIT(11) | BIT(26)) 197 + #define THERM_STATUS_CLEAR_PKG_MASK (BIT(1) | BIT(3) | BIT(5) | BIT(7) | BIT(9) | BIT(11)) 198 198 199 199 /* 200 200 * Clear the bits in package thermal status register for bit = 1 ··· 211 211 } else { 212 212 msr = MSR_IA32_PACKAGE_THERM_STATUS; 213 213 msr_val = THERM_STATUS_CLEAR_PKG_MASK; 214 + if (boot_cpu_has(X86_FEATURE_HFI)) 215 + msr_val |= BIT(26); 216 + 214 217 } 215 218 216 219 msr_val &= ~bit_mask;
+35 -32
drivers/thermal/k3_j72xx_bandgap.c
··· 177 177 struct device *dev; 178 178 void __iomem *base; 179 179 void __iomem *cfg2_base; 180 - void __iomem *fuse_base; 181 180 struct k3_thermal_data *ts_data[K3_VTM_MAX_NUM_TS]; 182 181 }; 183 182 ··· 248 249 /* Get temperature callback function for thermal zone */ 249 250 static int k3_thermal_get_temp(struct thermal_zone_device *tz, int *temp) 250 251 { 251 - struct k3_thermal_data *data = tz->devdata; 252 - int ret = 0; 253 - 254 - ret = k3_bgp_read_temp(data, temp); 255 - if (ret) 256 - return ret; 257 - 258 - return ret; 252 + return k3_bgp_read_temp(tz->devdata, temp); 259 253 } 260 254 261 255 static const struct thermal_zone_device_ops k3_of_thermal_ops = { ··· 275 283 } 276 284 277 285 static void get_efuse_values(int id, struct k3_thermal_data *data, int *err, 278 - struct k3_j72xx_bandgap *bgp) 286 + void __iomem *fuse_base) 279 287 { 280 288 int i, tmp, pow; 281 289 int ct_offsets[5][K3_VTM_CORRECTION_TEMP_CNT] = { ··· 297 305 /* Extract the offset value using bit-mask */ 298 306 if (ct_offsets[id][i] == -1 && i == 1) { 299 307 /* 25C offset Case of Sensor 2 split between 2 regs */ 300 - tmp = (readl(bgp->fuse_base + 0x8) & 0xE0000000) >> (29); 301 - tmp |= ((readl(bgp->fuse_base + 0xC) & 0x1F) << 3); 308 + tmp = (readl(fuse_base + 0x8) & 0xE0000000) >> (29); 309 + tmp |= ((readl(fuse_base + 0xC) & 0x1F) << 3); 302 310 pow = tmp & 0x80; 303 311 } else if (ct_offsets[id][i] == -1 && i == 2) { 304 312 /* 125C Case of Sensor 3 split between 2 regs */ 305 - tmp = (readl(bgp->fuse_base + 0x4) & 0xF8000000) >> (27); 306 - tmp |= ((readl(bgp->fuse_base + 0x8) & 0xF) << 5); 313 + tmp = (readl(fuse_base + 0x4) & 0xF8000000) >> (27); 314 + tmp |= ((readl(fuse_base + 0x8) & 0xF) << 5); 307 315 pow = tmp & 0x100; 308 316 } else { 309 - tmp = readl(bgp->fuse_base + ct_offsets[id][i]); 317 + tmp = readl(fuse_base + ct_offsets[id][i]); 310 318 tmp &= ct_bm[id][i]; 311 319 tmp = tmp >> __ffs(ct_bm[id][i]); 312 320 ··· 339 347 } 340 348 341 349 struct k3_j72xx_bandgap_data { 342 - unsigned int has_errata_i2128; 350 + const bool has_errata_i2128; 343 351 }; 344 352 345 353 static int k3_j72xx_bandgap_probe(struct platform_device *pdev) ··· 350 358 struct device *dev = &pdev->dev; 351 359 struct k3_j72xx_bandgap *bgp; 352 360 struct k3_thermal_data *data; 353 - int workaround_needed = 0; 361 + bool workaround_needed = false; 354 362 const struct k3_j72xx_bandgap_data *driver_data; 355 363 struct thermal_zone_device *ti_thermal; 356 364 int *ref_table; 357 365 struct err_values err_vals; 366 + void __iomem *fuse_base; 358 367 359 368 const s64 golden_factors[] = { 360 369 -490019999999999936, ··· 386 393 if (IS_ERR(bgp->cfg2_base)) 387 394 return PTR_ERR(bgp->cfg2_base); 388 395 389 - res = platform_get_resource(pdev, IORESOURCE_MEM, 2); 390 - bgp->fuse_base = devm_ioremap_resource(dev, res); 391 - if (IS_ERR(bgp->fuse_base)) 392 - return PTR_ERR(bgp->fuse_base); 393 - 394 396 driver_data = of_device_get_match_data(dev); 395 397 if (driver_data) 396 398 workaround_needed = driver_data->has_errata_i2128; 399 + 400 + /* 401 + * Some of TI's J721E SoCs require a software trimming procedure 402 + * for the temperature monitors to function properly. To determine 403 + * if this particular SoC is NOT affected, both bits in the 404 + * WKUP_SPARE_FUSE0[31:30] will be set (0xC0000000) indicating 405 + * when software trimming should NOT be applied. 406 + * 407 + * https://www.ti.com/lit/er/sprz455c/sprz455c.pdf 408 + */ 409 + if (workaround_needed) { 410 + res = platform_get_resource(pdev, IORESOURCE_MEM, 2); 411 + fuse_base = devm_ioremap_resource(dev, res); 412 + if (IS_ERR(fuse_base)) 413 + return PTR_ERR(fuse_base); 414 + 415 + if ((readl(fuse_base) & 0xc0000000) == 0xc0000000) 416 + workaround_needed = false; 417 + } 418 + 419 + dev_dbg(bgp->dev, "Work around %sneeded\n", 420 + workaround_needed ? "" : "not "); 397 421 398 422 pm_runtime_enable(dev); 399 423 ret = pm_runtime_get_sync(dev); ··· 444 434 goto err_free_ref_table; 445 435 } 446 436 447 - /* Workaround not needed if bit30/bit31 is set even for J721e */ 448 - if (workaround_needed && (readl(bgp->fuse_base + 0x0) & 0xc0000000) == 0xc0000000) 449 - workaround_needed = false; 450 - 451 - dev_dbg(bgp->dev, "Work around %sneeded\n", 452 - workaround_needed ? "not " : ""); 453 - 454 437 if (!workaround_needed) 455 438 init_table(5, ref_table, golden_factors); 456 439 else ··· 462 459 err_vals.refs[1] = PLUS30CREF; 463 460 err_vals.refs[2] = PLUS125CREF; 464 461 err_vals.refs[3] = PLUS150CREF; 465 - get_efuse_values(id, &data[id], err_vals.errs, bgp); 462 + get_efuse_values(id, &data[id], err_vals.errs, fuse_base); 466 463 } 467 464 468 465 if (id == 0 && workaround_needed) ··· 532 529 } 533 530 534 531 static const struct k3_j72xx_bandgap_data k3_j72xx_bandgap_j721e_data = { 535 - .has_errata_i2128 = 1, 532 + .has_errata_i2128 = true, 536 533 }; 537 534 538 535 static const struct k3_j72xx_bandgap_data k3_j72xx_bandgap_j7200_data = { 539 - .has_errata_i2128 = 0, 536 + .has_errata_i2128 = false, 540 537 }; 541 538 542 539 static const struct of_device_id of_k3_j72xx_bandgap_match[] = {
+1 -1
drivers/thermal/qcom/lmh.c
··· 45 45 if (irq) 46 46 generic_handle_irq(irq); 47 47 48 - return 0; 48 + return IRQ_HANDLED; 49 49 } 50 50 51 51 static void lmh_enable_interrupt(struct irq_data *d)
+3 -5
drivers/thermal/qcom/qcom-spmi-adc-tm5.c
··· 678 678 &adc_tm5_thermal_ops); 679 679 if (IS_ERR(tzd)) { 680 680 if (PTR_ERR(tzd) == -ENODEV) { 681 - dev_warn(adc_tm->dev, "thermal sensor on channel %d is not used\n", 681 + dev_dbg(adc_tm->dev, "thermal sensor on channel %d is not used\n", 682 682 adc_tm->channels[i].channel); 683 683 continue; 684 684 } ··· 1030 1030 return irq; 1031 1031 1032 1032 ret = adc_tm5_get_dt_data(adc_tm, node); 1033 - if (ret) { 1034 - dev_err(dev, "get dt data failed: %d\n", ret); 1035 - return ret; 1036 - } 1033 + if (ret) 1034 + return dev_err_probe(dev, ret, "get dt data failed\n"); 1037 1035 1038 1036 ret = adc_tm->data->init(adc_tm); 1039 1037 if (ret) {
+2 -1
drivers/thermal/qcom/qcom-spmi-temp-alarm.c
··· 252 252 disable_s2_shutdown = true; 253 253 else 254 254 dev_warn(chip->dev, 255 - "No ADC is configured and critical temperature is above the maximum stage 2 threshold of 140 C! Configuring stage 2 shutdown at 140 C.\n"); 255 + "No ADC is configured and critical temperature %d mC is above the maximum stage 2 threshold of %ld mC! Configuring stage 2 shutdown at %ld mC.\n", 256 + temp, stage2_threshold_max, stage2_threshold_max); 256 257 } 257 258 258 259 skip:
+3
drivers/thermal/qcom/tsens-8960.c
··· 269 269 static struct tsens_features tsens_8960_feat = { 270 270 .ver_major = VER_0, 271 271 .crit_int = 0, 272 + .combo_int = 0, 272 273 .adc = 1, 273 274 .srot_split = 0, 274 275 .max_sensors = 11, 276 + .trip_min_temp = -40000, 277 + .trip_max_temp = 120000, 275 278 }; 276 279 277 280 struct tsens_plat_data data_8960 = {
+3
drivers/thermal/qcom/tsens-v0_1.c
··· 539 539 static struct tsens_features tsens_v0_1_feat = { 540 540 .ver_major = VER_0_1, 541 541 .crit_int = 0, 542 + .combo_int = 0, 542 543 .adc = 1, 543 544 .srot_split = 1, 544 545 .max_sensors = 11, 546 + .trip_min_temp = -40000, 547 + .trip_max_temp = 120000, 545 548 }; 546 549 547 550 static const struct reg_field tsens_v0_1_regfields[MAX_REGFIELDS] = {
+3
drivers/thermal/qcom/tsens-v1.c
··· 302 302 static struct tsens_features tsens_v1_feat = { 303 303 .ver_major = VER_1_X, 304 304 .crit_int = 0, 305 + .combo_int = 0, 305 306 .adc = 1, 306 307 .srot_split = 1, 307 308 .max_sensors = 11, 309 + .trip_min_temp = -40000, 310 + .trip_max_temp = 120000, 308 311 }; 309 312 310 313 static const struct reg_field tsens_v1_regfields[MAX_REGFIELDS] = {
+20
drivers/thermal/qcom/tsens-v2.c
··· 31 31 static struct tsens_features tsens_v2_feat = { 32 32 .ver_major = VER_2_X, 33 33 .crit_int = 1, 34 + .combo_int = 0, 34 35 .adc = 0, 35 36 .srot_split = 1, 36 37 .max_sensors = 16, 38 + .trip_min_temp = -40000, 39 + .trip_max_temp = 120000, 40 + }; 41 + 42 + static struct tsens_features ipq8074_feat = { 43 + .ver_major = VER_2_X, 44 + .crit_int = 1, 45 + .combo_int = 1, 46 + .adc = 0, 47 + .srot_split = 1, 48 + .max_sensors = 16, 49 + .trip_min_temp = 0, 50 + .trip_max_temp = 204000, 37 51 }; 38 52 39 53 static const struct reg_field tsens_v2_regfields[MAX_REGFIELDS] = { ··· 112 98 struct tsens_plat_data data_tsens_v2 = { 113 99 .ops = &ops_generic_v2, 114 100 .feat = &tsens_v2_feat, 101 + .fields = tsens_v2_regfields, 102 + }; 103 + 104 + struct tsens_plat_data data_ipq8074 = { 105 + .ops = &ops_generic_v2, 106 + .feat = &ipq8074_feat, 115 107 .fields = tsens_v2_regfields, 116 108 }; 117 109
+46 -22
drivers/thermal/qcom/tsens.c
··· 532 532 return IRQ_HANDLED; 533 533 } 534 534 535 + /** 536 + * tsens_combined_irq_thread() - Threaded interrupt handler for combined interrupts 537 + * @irq: irq number 538 + * @data: tsens controller private data 539 + * 540 + * Handle the combined interrupt as if it were 2 separate interrupts, so call the 541 + * critical handler first and then the up/low one. 542 + * 543 + * Return: IRQ_HANDLED 544 + */ 545 + static irqreturn_t tsens_combined_irq_thread(int irq, void *data) 546 + { 547 + irqreturn_t ret; 548 + 549 + ret = tsens_critical_irq_thread(irq, data); 550 + if (ret != IRQ_HANDLED) 551 + return ret; 552 + 553 + return tsens_irq_thread(irq, data); 554 + } 555 + 535 556 static int tsens_set_trips(struct thermal_zone_device *tz, int low, int high) 536 557 { 537 558 struct tsens_sensor *s = tz->devdata; ··· 573 552 dev_dbg(dev, "[%u] %s: proposed thresholds: (%d:%d)\n", 574 553 hw_id, __func__, low, high); 575 554 576 - cl_high = clamp_val(high, -40000, 120000); 577 - cl_low = clamp_val(low, -40000, 120000); 555 + cl_high = clamp_val(high, priv->feat->trip_min_temp, priv->feat->trip_max_temp); 556 + cl_low = clamp_val(low, priv->feat->trip_min_temp, priv->feat->trip_max_temp); 578 557 579 558 high_val = tsens_mC_to_hw(s, cl_high); 580 559 low_val = tsens_mC_to_hw(s, cl_low); ··· 713 692 return ret; 714 693 seq_printf(s, "%d.%d.%d\n", maj_ver, min_ver, step_ver); 715 694 } else { 716 - seq_puts(s, "0.1.0\n"); 695 + seq_printf(s, "0.%d.0\n", priv->feat->ver_major); 717 696 } 718 697 719 698 return 0; ··· 725 704 static void tsens_debug_init(struct platform_device *pdev) 726 705 { 727 706 struct tsens_priv *priv = platform_get_drvdata(pdev); 728 - struct dentry *root, *file; 729 707 730 - root = debugfs_lookup("tsens", NULL); 731 - if (!root) 708 + priv->debug_root = debugfs_lookup("tsens", NULL); 709 + if (!priv->debug_root) 732 710 priv->debug_root = debugfs_create_dir("tsens", NULL); 733 - else 734 - priv->debug_root = root; 735 - 736 - file = debugfs_lookup("version", priv->debug_root); 737 - if (!file) 738 - debugfs_create_file("version", 0444, priv->debug_root, 739 - pdev, &dbg_version_fops); 740 711 741 712 /* A directory for each instance of the TSENS IP */ 742 713 priv->debug = debugfs_create_dir(dev_name(&pdev->dev), priv->debug_root); 714 + debugfs_create_file("version", 0444, priv->debug, pdev, &dbg_version_fops); 743 715 debugfs_create_file("sensors", 0444, priv->debug, pdev, &dbg_sensors_fops); 744 716 } 745 717 #else ··· 932 918 if (tsens_version(priv) >= VER_0_1) 933 919 tsens_enable_irq(priv); 934 920 935 - tsens_debug_init(op); 936 - 937 921 err_put_device: 938 922 put_device(&op->dev); 939 923 return ret; ··· 971 959 { 972 960 .compatible = "qcom,ipq8064-tsens", 973 961 .data = &data_8960, 962 + }, { 963 + .compatible = "qcom,ipq8074-tsens", 964 + .data = &data_ipq8074, 974 965 }, { 975 966 .compatible = "qcom,mdm9607-tsens", 976 967 .data = &data_9607, ··· 1086 1071 tsens_mC_to_hw(priv->sensor, 0)); 1087 1072 } 1088 1073 1089 - ret = tsens_register_irq(priv, "uplow", tsens_irq_thread); 1090 - if (ret < 0) 1091 - return ret; 1074 + if (priv->feat->combo_int) { 1075 + ret = tsens_register_irq(priv, "combined", 1076 + tsens_combined_irq_thread); 1077 + } else { 1078 + ret = tsens_register_irq(priv, "uplow", tsens_irq_thread); 1079 + if (ret < 0) 1080 + return ret; 1092 1081 1093 - if (priv->feat->crit_int) 1094 - ret = tsens_register_irq(priv, "critical", 1095 - tsens_critical_irq_thread); 1082 + if (priv->feat->crit_int) 1083 + ret = tsens_register_irq(priv, "critical", 1084 + tsens_critical_irq_thread); 1085 + } 1096 1086 1097 1087 return ret; 1098 1088 } ··· 1173 1153 } 1174 1154 } 1175 1155 1176 - return tsens_register(priv); 1156 + ret = tsens_register(priv); 1157 + if (!ret) 1158 + tsens_debug_init(pdev); 1159 + 1160 + return ret; 1177 1161 } 1178 1162 1179 1163 static int tsens_remove(struct platform_device *pdev)
+7 -1
drivers/thermal/qcom/tsens.h
··· 493 493 * struct tsens_features - Features supported by the IP 494 494 * @ver_major: Major number of IP version 495 495 * @crit_int: does the IP support critical interrupts? 496 + * @combo_int: does the IP use one IRQ for up, low and critical thresholds? 496 497 * @adc: do the sensors only output adc code (instead of temperature)? 497 498 * @srot_split: does the IP neatly splits the register space into SROT and TM, 498 499 * with SROT only being available to secure boot firmware? 499 500 * @has_watchdog: does this IP support watchdog functionality? 500 501 * @max_sensors: maximum sensors supported by this version of the IP 502 + * @trip_min_temp: minimum trip temperature supported by this version of the IP 503 + * @trip_max_temp: maximum trip temperature supported by this version of the IP 501 504 */ 502 505 struct tsens_features { 503 506 unsigned int ver_major; 504 507 unsigned int crit_int:1; 508 + unsigned int combo_int:1; 505 509 unsigned int adc:1; 506 510 unsigned int srot_split:1; 507 511 unsigned int has_watchdog:1; 508 512 unsigned int max_sensors; 513 + int trip_min_temp; 514 + int trip_max_temp; 509 515 }; 510 516 511 517 /** ··· 597 591 extern struct tsens_plat_data data_tsens_v1, data_8976; 598 592 599 593 /* TSENS v2 targets */ 600 - extern struct tsens_plat_data data_8996, data_tsens_v2; 594 + extern struct tsens_plat_data data_8996, data_ipq8074, data_tsens_v2; 601 595 602 596 #endif /* __QCOM_TSENS_H__ */
+1 -3
drivers/thermal/st/stm_thermal.c
··· 488 488 static int stm_thermal_probe(struct platform_device *pdev) 489 489 { 490 490 struct stm_thermal_sensor *sensor; 491 - struct resource *res; 492 491 void __iomem *base; 493 492 int ret; 494 493 ··· 505 506 506 507 sensor->dev = &pdev->dev; 507 508 508 - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 509 - base = devm_ioremap_resource(&pdev->dev, res); 509 + base = devm_platform_get_and_ioremap_resource(pdev, 0, NULL); 510 510 if (IS_ERR(base)) 511 511 return PTR_ERR(base); 512 512
+6 -2
drivers/thermal/thermal_of.c
··· 604 604 if (IS_ERR(np)) { 605 605 if (PTR_ERR(np) != -ENODEV) 606 606 pr_err("Failed to find thermal zone for %pOFn id=%d\n", sensor, id); 607 - return ERR_CAST(np); 607 + ret = PTR_ERR(np); 608 + goto out_kfree_of_ops; 608 609 } 609 610 610 611 trips = thermal_of_trips_init(np, &ntrips); 611 612 if (IS_ERR(trips)) { 612 613 pr_err("Failed to find trip points for %pOFn id=%d\n", sensor, id); 613 - return ERR_CAST(trips); 614 + ret = PTR_ERR(trips); 615 + goto out_kfree_of_ops; 614 616 } 615 617 616 618 ret = thermal_of_monitor_init(np, &delay, &pdelay); ··· 661 659 kfree(tzp); 662 660 out_kfree_trips: 663 661 kfree(trips); 662 + out_kfree_of_ops: 663 + kfree(of_ops); 664 664 665 665 return ERR_PTR(ret); 666 666 }
+1 -1
drivers/thermal/ti-soc-thermal/ti-bandgap.c
··· 878 878 */ 879 879 static const struct soc_device_attribute soc_no_cpu_notifier[] = { 880 880 { .machine = "OMAP4430" }, 881 - { /* sentinel */ }, 881 + { /* sentinel */ } 882 882 }; 883 883 884 884 /*** Device driver call backs ***/