mirror of
https://github.com/torvalds/linux.git
synced 2026-05-26 08:02:27 +02:00
Thermal control fixes for 6.10-rc1
- Fix and clean up the MediaTek lvts_thermal driver (Julien Panis).
- Prevent invalid trip point handling from triggering spurious trip
point crossing events and allow passive polling to stop when a
passive trip point involved in it becomes invalid (Rafael Wysocki).
-----BEGIN PGP SIGNATURE-----
iQJGBAABCAAwFiEE4fcc61cGeeHD/fCwgsRv/nhiVHEFAmZMYXoSHHJqd0Byand5
c29ja2kubmV0AAoJEILEb/54YlRxWKsP/R4PjdTgXYKg1NOGjsBJB5kYUVJZZkgZ
Kr123fp2pmJZ7MI7AsoD3I6d0Z9Kfj2MEHgUYyU7anN+Ub+2JpQufK48CV/KoQSW
LSC2hJsgHqRaOmP9i+tNGvKY3lnRTCKlLGhK+uSNC5ghHaFJuF/3ihEXHm0RWm4N
w4VBN3y721wcHGNXCOeQRxM4dq6Z2Z2L5qWsgvEszPz9PwxflJ5ek2KfCyZDjtWu
zh7xhk6WQ8kHkft2XhrCD9/AVIESeBLO9arvHh3TXUiJHHijyY/oTOHFP6VZ2n/A
HZiJeRGKMNaBktkkuhCzQQbu0PpZ97GqCyrFc18wDFzdeiFSwd4vNYeeOBK+RyNo
tUrlfm9X1O5e4Rary9mQ7DW9LJJ6DJSao4FFH0+wh2cSfJtl2/03lg6/obmb8hXh
uuvKCLJUqoE6IF5bXL1943QWENGyCEHjvJWS46NuGSy+Ly8+khS49rPEfJg1Qj7g
F12+1GL0uryTDLbL5V+IOtjFtUE786j5bHrxHTsasIvzbNvbm/fHbP/7JJW3l/Wf
MDwMx7MaijNeHeO4cLGWnaWA4U9kaxsphYii7icuUjw55khqBbt+EmE3Npc/fVlM
mWVkEZBGWKKpZb2zww7WX6FgBSZb/SZjMoxTUu/2YQgrwwiMe1LIHUFC3U5OATVG
vKXn8ALYHSly
=EjP7
-----END PGP SIGNATURE-----
Merge tag 'thermal-6.10-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull thermal control fixes from Rafael Wysocki:
"These fix the MediaTek lvts_thermal driver and the handling of trip
points that start as invalid and are adjusted later by user space via
sysfs.
Specifics:
- Fix and clean up the MediaTek lvts_thermal driver (Julien Panis)
- Prevent invalid trip point handling from triggering spurious trip
point crossing events and allow passive polling to stop when a
passive trip point involved in it becomes invalid (Rafael Wysocki)"
* tag 'thermal-6.10-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
thermal: core: Fix the handling of invalid trip points
thermal/drivers/mediatek/lvts_thermal: Fix wrong lvts_ctrl index
thermal/drivers/mediatek/lvts_thermal: Remove unused members from struct lvts_ctrl_data
thermal/drivers/mediatek/lvts_thermal: Check NULL ptr on lvts_data
This commit is contained in:
commit
5b5a5ad5a5
|
|
@ -105,8 +105,6 @@ struct lvts_sensor_data {
|
|||
|
||||
struct lvts_ctrl_data {
|
||||
struct lvts_sensor_data lvts_sensor[LVTS_SENSOR_MAX];
|
||||
int cal_offset[LVTS_SENSOR_MAX];
|
||||
int num_lvts_sensor;
|
||||
u8 valid_sensor_mask;
|
||||
int offset;
|
||||
int mode;
|
||||
|
|
@ -118,9 +116,9 @@ struct lvts_ctrl_data {
|
|||
((s2) ? BIT(2) : 0) | \
|
||||
((s3) ? BIT(3) : 0))
|
||||
|
||||
#define lvts_for_each_valid_sensor(i, lvts_ctrl_data) \
|
||||
#define lvts_for_each_valid_sensor(i, lvts_ctrl) \
|
||||
for ((i) = 0; (i) < LVTS_SENSOR_MAX; (i)++) \
|
||||
if (!((lvts_ctrl_data)->valid_sensor_mask & BIT(i))) \
|
||||
if (!((lvts_ctrl)->valid_sensor_mask & BIT(i))) \
|
||||
continue; \
|
||||
else
|
||||
|
||||
|
|
@ -147,6 +145,7 @@ struct lvts_ctrl {
|
|||
const struct lvts_data *lvts_data;
|
||||
u32 calibration[LVTS_SENSOR_MAX];
|
||||
u32 hw_tshut_raw_temp;
|
||||
u8 valid_sensor_mask;
|
||||
int mode;
|
||||
void __iomem *base;
|
||||
int low_thresh;
|
||||
|
|
@ -358,7 +357,7 @@ static bool lvts_should_update_thresh(struct lvts_ctrl *lvts_ctrl, int high)
|
|||
if (high > lvts_ctrl->high_thresh)
|
||||
return true;
|
||||
|
||||
lvts_for_each_valid_sensor(i, lvts_ctrl->lvts_data->lvts_ctrl)
|
||||
lvts_for_each_valid_sensor(i, lvts_ctrl)
|
||||
if (lvts_ctrl->sensors[i].high_thresh == lvts_ctrl->high_thresh
|
||||
&& lvts_ctrl->sensors[i].low_thresh == lvts_ctrl->low_thresh)
|
||||
return false;
|
||||
|
|
@ -619,6 +618,8 @@ static int lvts_sensor_init(struct device *dev, struct lvts_ctrl *lvts_ctrl,
|
|||
lvts_sensor[i].high_thresh = INT_MIN;
|
||||
};
|
||||
|
||||
lvts_ctrl->valid_sensor_mask = lvts_ctrl_data->valid_sensor_mask;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -1114,7 +1115,7 @@ static int lvts_ctrl_start(struct device *dev, struct lvts_ctrl *lvts_ctrl)
|
|||
u32 *sensor_bitmap = lvts_ctrl->mode == LVTS_MSR_IMMEDIATE_MODE ?
|
||||
sensor_imm_bitmap : sensor_filt_bitmap;
|
||||
|
||||
lvts_for_each_valid_sensor(i, lvts_ctrl->lvts_data->lvts_ctrl) {
|
||||
lvts_for_each_valid_sensor(i, lvts_ctrl) {
|
||||
|
||||
int dt_id = lvts_sensors[i].dt_id;
|
||||
|
||||
|
|
@ -1271,6 +1272,8 @@ static int lvts_probe(struct platform_device *pdev)
|
|||
return -ENOMEM;
|
||||
|
||||
lvts_data = of_device_get_match_data(dev);
|
||||
if (!lvts_data)
|
||||
return -ENODEV;
|
||||
|
||||
lvts_td->clk = devm_clk_get_enabled(dev, NULL);
|
||||
if (IS_ERR(lvts_td->clk))
|
||||
|
|
|
|||
|
|
@ -1398,8 +1398,15 @@ thermal_zone_device_register_with_trips(const char *type,
|
|||
tz->device.class = thermal_class;
|
||||
tz->devdata = devdata;
|
||||
tz->num_trips = num_trips;
|
||||
for_each_trip_desc(tz, td)
|
||||
for_each_trip_desc(tz, td) {
|
||||
td->trip = *trip++;
|
||||
/*
|
||||
* Mark all thresholds as invalid to start with even though
|
||||
* this only matters for the trips that start as invalid and
|
||||
* become valid later.
|
||||
*/
|
||||
td->threshold = INT_MAX;
|
||||
}
|
||||
|
||||
thermal_set_delay_jiffies(&tz->passive_delay_jiffies, passive_delay);
|
||||
thermal_set_delay_jiffies(&tz->polling_delay_jiffies, polling_delay);
|
||||
|
|
|
|||
|
|
@ -152,6 +152,24 @@ void thermal_zone_set_trip_temp(struct thermal_zone_device *tz,
|
|||
if (trip->temperature == temp)
|
||||
return;
|
||||
|
||||
if (temp == THERMAL_TEMP_INVALID) {
|
||||
struct thermal_trip_desc *td = trip_to_trip_desc(trip);
|
||||
|
||||
if (trip->type == THERMAL_TRIP_PASSIVE &&
|
||||
tz->temperature >= td->threshold) {
|
||||
/*
|
||||
* The trip has been crossed, so the thermal zone's
|
||||
* passive count needs to be adjusted.
|
||||
*/
|
||||
tz->passive--;
|
||||
WARN_ON_ONCE(tz->passive < 0);
|
||||
}
|
||||
/*
|
||||
* Invalidate the threshold to avoid triggering a spurious
|
||||
* trip crossing notification when the trip becomes valid.
|
||||
*/
|
||||
td->threshold = INT_MAX;
|
||||
}
|
||||
trip->temperature = temp;
|
||||
thermal_notify_tz_trip_change(tz, trip);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user