More thermal control updates for 6.13-rc1

- Add SAR2130P compatible to DT bindings in the QCom Tsens driver (Dmitry
    Baryshkov).
 
  - Add static annotation to arrays describing platform sensors in the
    LVTS Mediatek driver (Colin Ian King).
 
  - Switch back to struct platform_driver::remove() from the previous
    callbacks prototype rework (Uwe Kleine-König).
 
  - Add MSM8937 compatible to DT bindings and its support in the QCom
    Tsens driver (Barnabás Czémán).
 
  - Remove a pointless sign test on an unsigned value in k3_bgp_read_temp()
    in the k3_j72xx_bandgap driver (Rex Nie).
 
  - Fix a pointer reference loss when realloc() fails in the thermal
    library (Zhang Jiao).
 -----BEGIN PGP SIGNATURE-----
 
 iQJGBAABCAAwFiEE4fcc61cGeeHD/fCwgsRv/nhiVHEFAmdA4iQSHHJqd0Byand5
 c29ja2kubmV0AAoJEILEb/54YlRxIzEP/2ldTTMI81LBlWMfdHe1TZgqart20LJB
 2Zsl45awrNgWCMqWMyFtTq3Mzim0Jss8RWt1B3HP05w/ig2O6svI2FyxKtqZTEhg
 w8VRrbFR4klg8apWbf5d4MojhMAtEmHiBJ/8OkPYR/3Sl+712TE35YA0dxhn8vvV
 4I9h7585nOhAskm0pIqBjBSvbdUq4ake27TSeB/EZk2lVwAXL8LAMT9h1uwlWTWz
 6B79TxQoJ6SYB/Xl/uIgQ5ShULKcBjlc9ofAsyNX41BCDVwSso/I9J9dW1y/VcRt
 RcNglAtWWMcAs6e6+iySvO1Vbn6FIbj7xapDtnRLePV5fes2PuLFrMAvxyjk55Sx
 LGcU+oTBUI9tEf0ywxj9/kDK9mn+zvAbv2OEp9VihT1AdTyBnQ5o70MhwAhFs7h2
 IfpbTs9flxvM6KlT9/qFdD25uqelhuV4ElnTjKuUEapMxn55YcIt5dszZcCf25T+
 L7ybCQ3PV9mYCkGOrig+dpcZeo9YDBevhb5F6jG3yR/SXInxalRHYiia9gIh43p2
 qgGIYYW/B/nk+TSq8bYowXslgREvwjEQEmkZpQVyQWyO1kTnwdeaTRo7IaKnEk58
 1LVcFkD6UVy5dZu0Q93h+dEO18wWkOFX4/uJJ7trw9DMr68bw+gzgQV/JFk5R077
 mfXi95PR3VgW
 =cXi4
 -----END PGP SIGNATURE-----

Merge tag 'thermal-6.13-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 a few thermal drivers used on ARM platforms and thermal
  tools:

   - Add SAR2130P compatible to DT bindings in the QCom Tsens driver
     (Dmitry Baryshkov)

   - Add static annotation to arrays describing platform sensors in the
     LVTS Mediatek driver (Colin Ian King)

   - Switch back to struct platform_driver::remove() from the previous
     callbacks prototype rework (Uwe Kleine-König)

   - Add MSM8937 compatible to DT bindings and its support in the QCom
     Tsens driver (Barnabás Czémán)

   - Remove a pointless sign test on an unsigned value in
     k3_bgp_read_temp() in the k3_j72xx_bandgap driver (Rex Nie)

   - Fix a pointer reference loss when realloc() fails in the thermal
     library (Zhang Jiao)"

* tag 'thermal-6.13-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
  tools/thermal: Fix common realloc mistake
  thermal/drivers/k3_j72xx_bandgap: Simplify code in k3_bgp_read_temp()
  thermal/drivers/qcom/tsens-v1: Add support for MSM8937 tsens
  dt-bindings: thermal: tsens: Add MSM8937
  thermal: Switch back to struct platform_driver::remove()
  thermal/drivers/mediatek/lvts_thermal: Make read-only arrays static const
  dt-bindings: thermal: qcom-tsens: Add SAR2130P compatible
This commit is contained in:
Linus Torvalds 2024-11-22 19:43:18 -08:00
commit eb78332b10
36 changed files with 62 additions and 49 deletions

View File

@ -39,6 +39,7 @@ properties:
- description: v1 of TSENS
items:
- enum:
- qcom,msm8937-tsens
- qcom,msm8956-tsens
- qcom,msm8976-tsens
- qcom,qcs404-tsens
@ -53,6 +54,7 @@ properties:
- qcom,qcm2290-tsens
- qcom,sa8255p-tsens
- qcom,sa8775p-tsens
- qcom,sar2130p-tsens
- qcom,sc7180-tsens
- qcom,sc7280-tsens
- qcom,sc8180x-tsens

View File

@ -333,7 +333,7 @@ static struct platform_driver amlogic_thermal_driver = {
.of_match_table = of_amlogic_thermal_match,
},
.probe = amlogic_thermal_probe,
.remove_new = amlogic_thermal_remove,
.remove = amlogic_thermal_remove,
};
module_platform_driver(amlogic_thermal_driver);

View File

@ -970,7 +970,7 @@ static void armada_thermal_exit(struct platform_device *pdev)
static struct platform_driver armada_thermal_driver = {
.probe = armada_thermal_probe,
.remove_new = armada_thermal_exit,
.remove = armada_thermal_exit,
.driver = {
.name = "armada_thermal",
.of_match_table = armada_thermal_id_table,

View File

@ -268,7 +268,7 @@ static void bcm2835_thermal_remove(struct platform_device *pdev)
static struct platform_driver bcm2835_thermal_driver = {
.probe = bcm2835_thermal_probe,
.remove_new = bcm2835_thermal_remove,
.remove = bcm2835_thermal_remove,
.driver = {
.name = "bcm2835_thermal",
.of_match_table = bcm2835_thermal_of_match_table,

View File

@ -80,7 +80,7 @@ MODULE_DEVICE_TABLE(of, ns_thermal_of_match);
static struct platform_driver ns_thermal_driver = {
.probe = ns_thermal_probe,
.remove_new = ns_thermal_remove,
.remove = ns_thermal_remove,
.driver = {
.name = "ns-thermal",
.of_match_table = ns_thermal_of_match,

View File

@ -250,7 +250,7 @@ static void da9062_thermal_remove(struct platform_device *pdev)
static struct platform_driver da9062_thermal_driver = {
.probe = da9062_thermal_probe,
.remove_new = da9062_thermal_remove,
.remove = da9062_thermal_remove,
.driver = {
.name = "da9062-thermal",
.of_match_table = da9062_compatible_reg_id_table,

View File

@ -170,7 +170,7 @@ MODULE_DEVICE_TABLE(of, dove_thermal_id_table);
static struct platform_driver dove_thermal_driver = {
.probe = dove_thermal_probe,
.remove_new = dove_thermal_exit,
.remove = dove_thermal_exit,
.driver = {
.name = "dove_thermal",
.of_match_table = dove_thermal_id_table,

View File

@ -640,7 +640,7 @@ static struct platform_driver hisi_thermal_driver = {
.of_match_table = of_hisi_thermal_match,
},
.probe = hisi_thermal_probe,
.remove_new = hisi_thermal_remove,
.remove = hisi_thermal_remove,
};
module_platform_driver(hisi_thermal_driver);

View File

@ -399,7 +399,7 @@ static struct platform_driver imx8mm_tmu = {
.of_match_table = imx8mm_tmu_table,
},
.probe = imx8mm_tmu_probe,
.remove_new = imx8mm_tmu_remove,
.remove = imx8mm_tmu_remove,
};
module_platform_driver(imx8mm_tmu);

View File

@ -861,7 +861,7 @@ static struct platform_driver imx_thermal = {
.of_match_table = of_imx_thermal_match,
},
.probe = imx_thermal_probe,
.remove_new = imx_thermal_remove,
.remove = imx_thermal_remove,
};
module_platform_driver(imx_thermal);

View File

@ -707,7 +707,7 @@ MODULE_DEVICE_TABLE(acpi, int3400_thermal_match);
static struct platform_driver int3400_thermal_driver = {
.probe = int3400_thermal_probe,
.remove_new = int3400_thermal_remove,
.remove = int3400_thermal_remove,
.driver = {
.name = "int3400 thermal",
.acpi_match_table = ACPI_PTR(int3400_thermal_match),

View File

@ -60,7 +60,7 @@ static SIMPLE_DEV_PM_OPS(int3401_proc_thermal_pm, int3401_thermal_suspend,
static struct platform_driver int3401_driver = {
.probe = int3401_add,
.remove_new = int3401_remove,
.remove = int3401_remove,
.driver = {
.name = "int3401 thermal",
.acpi_match_table = int3401_device_ids,

View File

@ -89,7 +89,7 @@ MODULE_DEVICE_TABLE(acpi, int3402_thermal_match);
static struct platform_driver int3402_thermal_driver = {
.probe = int3402_thermal_probe,
.remove_new = int3402_thermal_remove,
.remove = int3402_thermal_remove,
.driver = {
.name = "int3402 thermal",
.acpi_match_table = int3402_thermal_match,

View File

@ -281,7 +281,7 @@ MODULE_DEVICE_TABLE(acpi, int3403_device_ids);
static struct platform_driver int3403_driver = {
.probe = int3403_add,
.remove_new = int3403_remove,
.remove = int3403_remove,
.driver = {
.name = "int3403 thermal",
.acpi_match_table = int3403_device_ids,

View File

@ -195,7 +195,7 @@ MODULE_DEVICE_TABLE(acpi, int3406_thermal_match);
static struct platform_driver int3406_thermal_driver = {
.probe = int3406_thermal_probe,
.remove_new = int3406_thermal_remove,
.remove = int3406_thermal_remove,
.driver = {
.name = "int3406 thermal",
.acpi_match_table = int3406_thermal_match,

View File

@ -250,7 +250,7 @@ MODULE_DEVICE_TABLE(of, of_k3_bandgap_match);
static struct platform_driver k3_bandgap_sensor_driver = {
.probe = k3_bandgap_probe,
.remove_new = k3_bandgap_remove,
.remove = k3_bandgap_remove,
.driver = {
.name = "k3-soc-thermal",
.of_match_table = of_k3_bandgap_match,

View File

@ -238,7 +238,7 @@ static inline int k3_bgp_read_temp(struct k3_thermal_data *devdata,
K3_VTM_TS_STAT_DTEMP_MASK;
dtemp = vtm_get_best_value(s0, s1, s2);
if (dtemp < 0 || dtemp >= TABLE_SIZE)
if (dtemp >= TABLE_SIZE)
return -EINVAL;
*temp = derived_table[dtemp];
@ -594,7 +594,7 @@ MODULE_DEVICE_TABLE(of, of_k3_j72xx_bandgap_match);
static struct platform_driver k3_j72xx_bandgap_sensor_driver = {
.probe = k3_j72xx_bandgap_probe,
.remove_new = k3_j72xx_bandgap_remove,
.remove = k3_j72xx_bandgap_remove,
.driver = {
.name = "k3-j72xx-soc-thermal",
.of_match_table = of_k3_j72xx_bandgap_match,

View File

@ -102,7 +102,7 @@ MODULE_DEVICE_TABLE(of, kirkwood_thermal_id_table);
static struct platform_driver kirkwood_thermal_driver = {
.probe = kirkwood_thermal_probe,
.remove_new = kirkwood_thermal_exit,
.remove = kirkwood_thermal_exit,
.driver = {
.name = "kirkwood_thermal",
.of_match_table = kirkwood_thermal_id_table,

View File

@ -329,7 +329,7 @@ static int lvts_get_temp(struct thermal_zone_device *tz, int *temp)
static void lvts_update_irq_mask(struct lvts_ctrl *lvts_ctrl)
{
u32 masks[] = {
static const u32 masks[] = {
LVTS_MONINT_OFFSET_SENSOR0,
LVTS_MONINT_OFFSET_SENSOR1,
LVTS_MONINT_OFFSET_SENSOR2,
@ -424,7 +424,7 @@ static irqreturn_t lvts_ctrl_irq_handler(struct lvts_ctrl *lvts_ctrl)
{
irqreturn_t iret = IRQ_NONE;
u32 value;
u32 masks[] = {
static const u32 masks[] = {
LVTS_INT_SENSOR0,
LVTS_INT_SENSOR1,
LVTS_INT_SENSOR2,
@ -1788,7 +1788,7 @@ static const struct dev_pm_ops lvts_pm_ops = {
static struct platform_driver lvts_driver = {
.probe = lvts_probe,
.remove_new = lvts_remove,
.remove = lvts_remove,
.driver = {
.name = "mtk-lvts-thermal",
.of_match_table = lvts_of_match,

View File

@ -162,6 +162,19 @@ struct tsens_plat_data data_tsens_v1 = {
.fields = tsens_v1_regfields,
};
static const struct tsens_ops ops_common = {
.init = init_common,
.calibrate = tsens_calibrate_common,
.get_temp = get_temp_tsens_valid,
};
struct tsens_plat_data data_8937 = {
.num_sensors = 11,
.ops = &ops_common,
.feat = &tsens_v1_feat,
.fields = tsens_v1_regfields,
};
static const struct tsens_ops ops_8956 = {
.init = init_8956,
.calibrate = tsens_calibrate_common,
@ -175,15 +188,9 @@ struct tsens_plat_data data_8956 = {
.fields = tsens_v1_regfields,
};
static const struct tsens_ops ops_8976 = {
.init = init_common,
.calibrate = tsens_calibrate_common,
.get_temp = get_temp_tsens_valid,
};
struct tsens_plat_data data_8976 = {
.num_sensors = 11,
.ops = &ops_8976,
.ops = &ops_common,
.feat = &tsens_v1_feat,
.fields = tsens_v1_regfields,
};

View File

@ -1119,6 +1119,9 @@ static const struct of_device_id tsens_table[] = {
}, {
.compatible = "qcom,msm8916-tsens",
.data = &data_8916,
}, {
.compatible = "qcom,msm8937-tsens",
.data = &data_8937,
}, {
.compatible = "qcom,msm8939-tsens",
.data = &data_8939,
@ -1360,7 +1363,7 @@ static void tsens_remove(struct platform_device *pdev)
static struct platform_driver tsens_driver = {
.probe = tsens_probe,
.remove_new = tsens_remove,
.remove = tsens_remove,
.driver = {
.name = "qcom-tsens",
.pm = &tsens_pm_ops,

View File

@ -647,7 +647,7 @@ extern struct tsens_plat_data data_8960;
extern struct tsens_plat_data data_8226, data_8909, data_8916, data_8939, data_8974, data_9607;
/* TSENS v1 targets */
extern struct tsens_plat_data data_tsens_v1, data_8976, data_8956;
extern struct tsens_plat_data data_tsens_v1, data_8937, data_8976, data_8956;
/* TSENS v2 targets */
extern struct tsens_plat_data data_8996, data_ipq8074, data_tsens_v2;

View File

@ -603,7 +603,7 @@ static struct platform_driver rcar_gen3_thermal_driver = {
.of_match_table = rcar_gen3_thermal_dt_ids,
},
.probe = rcar_gen3_thermal_probe,
.remove_new = rcar_gen3_thermal_remove,
.remove = rcar_gen3_thermal_remove,
};
module_platform_driver(rcar_gen3_thermal_driver);

View File

@ -579,7 +579,7 @@ static struct platform_driver rcar_thermal_driver = {
.of_match_table = rcar_thermal_dt_ids,
},
.probe = rcar_thermal_probe,
.remove_new = rcar_thermal_remove,
.remove = rcar_thermal_remove,
};
module_platform_driver(rcar_thermal_driver);

View File

@ -240,7 +240,7 @@ static struct platform_driver rzg2l_thermal_driver = {
.of_match_table = rzg2l_thermal_dt_ids,
},
.probe = rzg2l_thermal_probe,
.remove_new = rzg2l_thermal_remove,
.remove = rzg2l_thermal_remove,
};
module_platform_driver(rzg2l_thermal_driver);

View File

@ -1689,7 +1689,7 @@ static struct platform_driver rockchip_thermal_driver = {
.of_match_table = of_rockchip_thermal_match,
},
.probe = rockchip_thermal_probe,
.remove_new = rockchip_thermal_remove,
.remove = rockchip_thermal_remove,
};
module_platform_driver(rockchip_thermal_driver);

View File

@ -1164,7 +1164,7 @@ static struct platform_driver exynos_tmu_driver = {
.of_match_table = exynos_tmu_match,
},
.probe = exynos_tmu_probe,
.remove_new = exynos_tmu_remove,
.remove = exynos_tmu_remove,
};
module_platform_driver(exynos_tmu_driver);

View File

@ -173,7 +173,7 @@ MODULE_DEVICE_TABLE(of, spear_thermal_id_table);
static struct platform_driver spear_thermal_driver = {
.probe = spear_thermal_probe,
.remove_new = spear_thermal_exit,
.remove = spear_thermal_exit,
.driver = {
.name = "spear_thermal",
.pm = &spear_thermal_pm_ops,

View File

@ -534,7 +534,7 @@ static const struct dev_pm_ops sprd_thermal_pm_ops = {
static struct platform_driver sprd_thermal_driver = {
.probe = sprd_thm_probe,
.remove_new = sprd_thm_remove,
.remove = sprd_thm_remove,
.driver = {
.name = "sprd-thermal",
.pm = &sprd_thermal_pm_ops,

View File

@ -174,7 +174,7 @@ static struct platform_driver st_mmap_thermal_driver = {
.of_match_table = st_mmap_thermal_of_match,
},
.probe = st_mmap_probe,
.remove_new = st_mmap_remove,
.remove = st_mmap_remove,
};
module_platform_driver(st_mmap_thermal_driver);

View File

@ -582,7 +582,7 @@ static struct platform_driver stm_thermal_driver = {
.of_match_table = stm_thermal_of_match,
},
.probe = stm_thermal_probe,
.remove_new = stm_thermal_remove,
.remove = stm_thermal_remove,
};
module_platform_driver(stm_thermal_driver);

View File

@ -2269,7 +2269,7 @@ static SIMPLE_DEV_PM_OPS(tegra_soctherm_pm, soctherm_suspend, soctherm_resume);
static struct platform_driver tegra_soctherm_driver = {
.probe = tegra_soctherm_probe,
.remove_new = tegra_soctherm_remove,
.remove = tegra_soctherm_remove,
.driver = {
.name = "tegra_soctherm",
.pm = &tegra_soctherm_pm,

View File

@ -315,7 +315,7 @@ MODULE_DEVICE_TABLE(of, tegra_bpmp_thermal_of_match);
static struct platform_driver tegra_bpmp_thermal_driver = {
.probe = tegra_bpmp_thermal_probe,
.remove_new = tegra_bpmp_thermal_remove,
.remove = tegra_bpmp_thermal_remove,
.driver = {
.name = "tegra-bpmp-thermal",
.of_match_table = tegra_bpmp_thermal_of_match,

View File

@ -1281,7 +1281,7 @@ MODULE_DEVICE_TABLE(of, of_ti_bandgap_match);
static struct platform_driver ti_bandgap_sensor_driver = {
.probe = ti_bandgap_probe,
.remove_new = ti_bandgap_remove,
.remove = ti_bandgap_remove,
.driver = {
.name = "ti-soc-thermal",
.pm = DEV_PM_OPS,

View File

@ -371,7 +371,7 @@ MODULE_DEVICE_TABLE(of, uniphier_tm_dt_ids);
static struct platform_driver uniphier_tm_driver = {
.probe = uniphier_tm_probe,
.remove_new = uniphier_tm_remove,
.remove = uniphier_tm_remove,
.driver = {
.name = "uniphier-thermal",
.of_match_table = uniphier_tm_dt_ids,

View File

@ -259,6 +259,7 @@ static int thermometer_add_tz(const char *path, const char *name, int polling,
{
int fd;
char tz_path[PATH_MAX];
struct tz *tz;
sprintf(tz_path, CLASS_THERMAL"/%s/temp", path);
@ -268,13 +269,13 @@ static int thermometer_add_tz(const char *path, const char *name, int polling,
return -1;
}
thermometer->tz = realloc(thermometer->tz,
sizeof(*thermometer->tz) * (thermometer->nr_tz + 1));
if (!thermometer->tz) {
tz = realloc(thermometer->tz, sizeof(*thermometer->tz) * (thermometer->nr_tz + 1));
if (!tz) {
ERROR("Failed to allocate thermometer->tz\n");
return -1;
}
thermometer->tz = tz;
thermometer->tz[thermometer->nr_tz].fd_temp = fd;
thermometer->tz[thermometer->nr_tz].name = strdup(name);
thermometer->tz[thermometer->nr_tz].polling = polling;