···1616 - "mediatek,mt7981-thermal", "mediatek,mt7986-thermal" : For MT7981 SoC1717 - "mediatek,mt7986-thermal" : For MT7986 SoC1818 - "mediatek,mt8183-thermal" : For MT8183 family of SoCs1919+ - "mediatek,mt8365-thermal" : For MT8365 family of SoCs1920 - "mediatek,mt8516-thermal", "mediatek,mt2701-thermal : For MT8516 family of SoCs2021- reg: Address range of the thermal controller2122- interrupts: IRQ for the thermal controller
···53535454struct db8500_thermal_zone {5555 struct thermal_zone_device *tz;5656+ struct device *dev;5657 unsigned long interpolated_temp;5758 unsigned int cur_index;5859};···115114 idx -= 1;116115117116 db8500_thermal_update_config(th, idx, next_low, next_high);118118- dev_dbg(&th->tz->device,117117+ dev_dbg(th->dev,119118 "PRCMU set max %ld, min %ld\n", next_high, next_low);120119121120 thermal_zone_device_update(th->tz, THERMAL_EVENT_UNSPECIFIED);···137136138137 db8500_thermal_update_config(th, idx, next_low, next_high);139138140140- dev_dbg(&th->tz->device,139139+ dev_dbg(th->dev,141140 "PRCMU set max %ld, min %ld\n", next_high, next_low);142141 } else if (idx == num_points - 1)143142 /* So we roof out 1 degree over the max point */···157156 th = devm_kzalloc(dev, sizeof(*th), GFP_KERNEL);158157 if (!th)159158 return -ENOMEM;159159+160160+ th->dev = dev;160161161162 low_irq = platform_get_irq_byname(pdev, "IRQ_HOTMON_LOW");162163 if (low_irq < 0)
···544544{545545 struct hisi_thermal_data *data;546546 struct device *dev = &pdev->dev;547547- struct resource *res;548547 int i, ret;549548550549 data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);···554555 platform_set_drvdata(pdev, data);555556 data->ops = of_device_get_match_data(dev);556557557557- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);558558- data->regs = devm_ioremap_resource(dev, res);558558+ data->regs = devm_platform_ioremap_resource(pdev, 0);559559 if (IS_ERR(data->regs))560560 return PTR_ERR(data->regs);561561
+1-1
drivers/thermal/imx8mm_thermal.c
···282282 * strongly recommended to update such old DTs to get correct283283 * temperature compensation values for each SoC.284284 */285285- if (!of_find_property(pdev->dev.of_node, "nvmem-cells", NULL)) {285285+ if (!of_property_present(pdev->dev.of_node, "nvmem-cells")) {286286 dev_warn(dev,287287 "No OCOTP nvmem reference found, SoC-specific calibration not loaded. Please update your DT.\n");288288 return 0;
+9-14
drivers/thermal/imx_thermal.c
···330330 return 0;331331}332332333333-static int imx_get_crit_temp(struct thermal_zone_device *tz, int *temp)334334-{335335- *temp = trips[IMX_TRIP_CRITICAL].temperature;336336-337337- return 0;338338-}339339-340340-static int imx_set_trip_temp(struct thermal_zone_device *tz, int trip,333333+static int imx_set_trip_temp(struct thermal_zone_device *tz, int trip_id,341334 int temp)342335{343336 struct imx_thermal_data *data = thermal_zone_device_priv(tz);337337+ struct thermal_trip trip;344338 int ret;345339346340 ret = pm_runtime_resume_and_get(data->dev);347341 if (ret < 0)348342 return ret;349343344344+ ret = __thermal_zone_get_trip(tz, trip_id, &trip);345345+ if (ret)346346+ return ret;347347+350348 /* do not allow changing critical threshold */351351- if (trip == IMX_TRIP_CRITICAL)349349+ if (trip.type == THERMAL_TRIP_CRITICAL)352350 return -EPERM;353351354352 /* do not allow passive to be set higher than critical */355353 if (temp < 0 || temp > trips[IMX_TRIP_CRITICAL].temperature)356354 return -EINVAL;357357-358358- trips[IMX_TRIP_PASSIVE].temperature = temp;359355360356 imx_set_alarm_temp(data, temp);361357···380384 .unbind = imx_unbind,381385 .get_temp = imx_get_temp,382386 .change_mode = imx_change_mode,383383- .get_crit_temp = imx_get_crit_temp,384387 .set_trip_temp = imx_set_trip_temp,385388};386389···566571567572 np = of_get_cpu_node(data->policy->cpu, NULL);568573569569- if (!np || !of_find_property(np, "#cooling-cells", NULL)) {574574+ if (!np || !of_property_present(np, "#cooling-cells")) {570575 data->cdev = cpufreq_cooling_register(data->policy);571576 if (IS_ERR(data->cdev)) {572577 ret = PTR_ERR(data->cdev);···643648644649 platform_set_drvdata(pdev, data);645650646646- if (of_find_property(pdev->dev.of_node, "nvmem-cells", NULL)) {651651+ if (of_property_present(pdev->dev.of_node, "nvmem-cells")) {647652 ret = imx_init_from_nvmem_cells(pdev);648653 if (ret)649654 return dev_err_probe(&pdev->dev, ret,
+90-17
drivers/thermal/mediatek/auxadc_thermal.c
···3131#define AUXADC_CON2_V 0x0103232#define AUXADC_DATA(channel) (0x14 + (channel) * 4)33333434+#define APMIXED_SYS_TS_CON0 0x6003435#define APMIXED_SYS_TS_CON1 0x60435363637/* Thermal Controller Registers */···282281/* The calibration coefficient of sensor */283282#define MT7986_CALIBRATION 165284283284284+/* MT8365 */285285+#define MT8365_TEMP_AUXADC_CHANNEL 11286286+#define MT8365_CALIBRATION 164287287+#define MT8365_NUM_CONTROLLER 1288288+#define MT8365_NUM_BANKS 1289289+#define MT8365_NUM_SENSORS 3290290+#define MT8365_NUM_SENSORS_PER_ZONE 3291291+#define MT8365_TS1 0292292+#define MT8365_TS2 1293293+#define MT8365_TS3 2294294+285295struct mtk_thermal;286296287297struct thermal_bank_cfg {···319307 bool need_switch_bank;320308 struct thermal_bank_cfg bank_data[MAX_NUM_ZONES];321309 enum mtk_thermal_version version;310310+ u32 apmixed_buffer_ctl_reg;311311+ u32 apmixed_buffer_ctl_mask;312312+ u32 apmixed_buffer_ctl_set;322313};323314324315struct mtk_thermal {···447432static const int mt7986_vts_index[MT7986_NUM_SENSORS] = { VTS1 };448433static const int mt7986_tc_offset[MT7986_NUM_CONTROLLER] = { 0x0, };449434435435+/* MT8365 thermal sensor data */436436+static const int mt8365_bank_data[MT8365_NUM_SENSORS] = {437437+ MT8365_TS1, MT8365_TS2, MT8365_TS3438438+};439439+440440+static const int mt8365_msr[MT8365_NUM_SENSORS_PER_ZONE] = {441441+ TEMP_MSR0, TEMP_MSR1, TEMP_MSR2442442+};443443+444444+static const int mt8365_adcpnp[MT8365_NUM_SENSORS_PER_ZONE] = {445445+ TEMP_ADCPNP0, TEMP_ADCPNP1, TEMP_ADCPNP2446446+};447447+448448+static const int mt8365_mux_values[MT8365_NUM_SENSORS] = { 0, 1, 2 };449449+static const int mt8365_tc_offset[MT8365_NUM_CONTROLLER] = { 0 };450450+451451+static const int mt8365_vts_index[MT8365_NUM_SENSORS] = { VTS1, VTS2, VTS3 };452452+450453/*451454 * The MT8173 thermal controller has four banks. Each bank can read up to452455 * four temperature sensors simultaneously. The MT8173 has a total of 5···540507};541508542509/*510510+ * The MT8365 thermal controller has one bank, which can read up to511511+ * four temperature sensors simultaneously. The MT8365 has a total of 3512512+ * temperature sensors.513513+ *514514+ * The thermal core only gets the maximum temperature of this one bank,515515+ * so the bank concept wouldn't be necessary here. However, the SVS (Smart516516+ * Voltage Scaling) unit makes its decisions based on the same bank517517+ * data.518518+ */519519+static const struct mtk_thermal_data mt8365_thermal_data = {520520+ .auxadc_channel = MT8365_TEMP_AUXADC_CHANNEL,521521+ .num_banks = MT8365_NUM_BANKS,522522+ .num_sensors = MT8365_NUM_SENSORS,523523+ .vts_index = mt8365_vts_index,524524+ .cali_val = MT8365_CALIBRATION,525525+ .num_controller = MT8365_NUM_CONTROLLER,526526+ .controller_offset = mt8365_tc_offset,527527+ .need_switch_bank = false,528528+ .bank_data = {529529+ {530530+ .num_sensors = MT8365_NUM_SENSORS,531531+ .sensors = mt8365_bank_data532532+ },533533+ },534534+ .msr = mt8365_msr,535535+ .adcpnp = mt8365_adcpnp,536536+ .sensor_mux_values = mt8365_mux_values,537537+ .version = MTK_THERMAL_V1,538538+ .apmixed_buffer_ctl_reg = APMIXED_SYS_TS_CON0,539539+ .apmixed_buffer_ctl_mask = (u32) ~GENMASK(29, 28),540540+ .apmixed_buffer_ctl_set = 0,541541+};542542+543543+/*543544 * The MT2712 thermal controller has one bank, which can read up to544545 * four temperature sensors simultaneously. The MT2712 has a total of 4545546 * temperature sensors.···627560 .adcpnp = mt7622_adcpnp,628561 .sensor_mux_values = mt7622_mux_values,629562 .version = MTK_THERMAL_V2,563563+ .apmixed_buffer_ctl_reg = APMIXED_SYS_TS_CON1,564564+ .apmixed_buffer_ctl_mask = GENMASK(31, 6) | BIT(3),565565+ .apmixed_buffer_ctl_set = BIT(0),630566};631567632568/*···815745 temp = mt->raw_to_mcelsius(816746 mt, conf->bank_data[bank->id].sensors[i], raw);817747818818-819819- /*820820- * The first read of a sensor often contains very high bogus821821- * temperature value. Filter these out so that the system does822822- * not immediately shut down.823823- */824824- if (temp > 200000)825825- temp = 0;826748827749 if (temp > max)828750 max = temp;···11361074 {11371075 .compatible = "mediatek,mt8183-thermal",11381076 .data = (void *)&mt8183_thermal_data,10771077+ },10781078+ {10791079+ .compatible = "mediatek,mt8365-thermal",10801080+ .data = (void *)&mt8365_thermal_data,11391081 }, {11401082 },11411083};11421084MODULE_DEVICE_TABLE(of, mtk_thermal_of_match);1143108511441144-static void mtk_thermal_turn_on_buffer(void __iomem *apmixed_base)10861086+static void mtk_thermal_turn_on_buffer(struct mtk_thermal *mt,10871087+ void __iomem *apmixed_base)11451088{11461146- int tmp;10891089+ u32 tmp;1147109011481148- tmp = readl(apmixed_base + APMIXED_SYS_TS_CON1);11491149- tmp &= ~(0x37);11501150- tmp |= 0x1;11511151- writel(tmp, apmixed_base + APMIXED_SYS_TS_CON1);10911091+ if (!mt->conf->apmixed_buffer_ctl_reg)10921092+ return;10931093+10941094+ tmp = readl(apmixed_base + mt->conf->apmixed_buffer_ctl_reg);10951095+ tmp &= mt->conf->apmixed_buffer_ctl_mask;10961096+ tmp |= mt->conf->apmixed_buffer_ctl_set;10971097+ writel(tmp, apmixed_base + mt->conf->apmixed_buffer_ctl_reg);11521098 udelay(200);11531099}11541100···12541184 goto err_disable_clk_auxadc;12551185 }1256118612571257- if (mt->conf->version != MTK_THERMAL_V1) {12581258- mtk_thermal_turn_on_buffer(apmixed_base);11871187+ mtk_thermal_turn_on_buffer(mt, apmixed_base);11881188+11891189+ if (mt->conf->version != MTK_THERMAL_V2)12591190 mtk_thermal_release_periodic_ts(mt, auxadc_base);12601260- }1261119112621192 if (mt->conf->version == MTK_THERMAL_V1)12631193 mt->raw_to_mcelsius = raw_to_mcelsius_v1;···12721202 auxadc_phys_base, ctrl_id);1273120312741204 platform_set_drvdata(pdev, mt);12051205+12061206+ /* Delay for thermal banks to be ready */12071207+ msleep(30);1275120812761209 tzdev = devm_thermal_of_zone_register(&pdev->dev, 0, mt,12771210 &mtk_thermal_ops);
···2323#include "ti-bandgap.h"2424#include "../thermal_hwmon.h"25252626+#define TI_BANDGAP_UPDATE_INTERVAL_MS 2502727+2628/* common data structures */2729struct ti_thermal_data {2830 struct cpufreq_policy *policy;···161159 char *domain)162160{163161 struct ti_thermal_data *data;164164- int interval;165162166163 data = ti_bandgap_get_sensor_data(bgp, id);167164···178177 return PTR_ERR(data->ti_thermal);179178 }180179181181- interval = jiffies_to_msecs(data->ti_thermal->polling_delay_jiffies);182182-183180 ti_bandgap_set_sensor_data(bgp, id, data);184184- ti_bandgap_write_update_interval(bgp, data->sensor_id, interval);181181+ ti_bandgap_write_update_interval(bgp, data->sensor_id,182182+ TI_BANDGAP_UPDATE_INTERVAL_MS);185183186184 if (devm_thermal_add_hwmon_sysfs(bgp->dev, data->ti_thermal))187185 dev_warn(bgp->dev, "failed to add hwmon sysfs attributes\n");···223223 * using DT, then it must be aware that the cooling device224224 * loading has to happen via cpufreq driver.225225 */226226- if (of_find_property(np, "#thermal-sensor-cells", NULL))226226+ if (of_property_present(np, "#thermal-sensor-cells"))227227 return 0;228228229229 data = ti_bandgap_get_sensor_data(bgp, id);
···8484);8585#endif /* _TRACE_THERMAL_POWER_ALLOCATOR_H */86868787+#undef TRACE_INCLUDE_PATH8888+#define TRACE_INCLUDE_PATH .8989+9090+#undef TRACE_INCLUDE_FILE9191+#define TRACE_INCLUDE_FILE thermal_trace_ipa9292+8793/* This part must be outside protection */8894#include <trace/define_trace.h>