diff options
| -rw-r--r-- | drivers/regulator/cpr-regulator.c | 14 | ||||
| -rw-r--r-- | drivers/thermal/msm_thermal.c | 25 | ||||
| -rw-r--r-- | include/linux/msm_thermal.h | 3 |
3 files changed, 32 insertions, 10 deletions
diff --git a/drivers/regulator/cpr-regulator.c b/drivers/regulator/cpr-regulator.c index 49941e368756..7afaacf4b4c2 100644 --- a/drivers/regulator/cpr-regulator.c +++ b/drivers/regulator/cpr-regulator.c @@ -5166,10 +5166,16 @@ static void tsens_threshold_notify(struct therm_threshold *tsens_cb_data) break; } - rc = sensor_mgr_set_threshold(tsens_cb_data->sensor_id, - tsens_cb_data->threshold); - if (rc < 0) - cpr_err(cpr_vreg, "Failed to set temp. threshold, rc=%d\n", rc); + if (tsens_cb_data->cur_state != tsens_cb_data->trip_triggered) { + rc = sensor_mgr_set_threshold(tsens_cb_data->sensor_id, + tsens_cb_data->threshold); + if (rc < 0) + cpr_err(cpr_vreg, + "Failed to set temp. threshold, rc=%d\n", rc); + else + tsens_cb_data->cur_state = + tsens_cb_data->trip_triggered; + } } static int cpr_check_tsens(struct cpr_regulator *cpr_vreg) diff --git a/drivers/thermal/msm_thermal.c b/drivers/thermal/msm_thermal.c index b5cac6cfad60..f36108542738 100644 --- a/drivers/thermal/msm_thermal.c +++ b/drivers/thermal/msm_thermal.c @@ -2794,8 +2794,12 @@ static void vdd_mx_notify(struct therm_threshold *trig_thresh) pr_err("Failed to remove vdd mx restriction\n"); } mutex_unlock(&vdd_mx_mutex); - sensor_mgr_set_threshold(trig_thresh->sensor_id, + + if (trig_thresh->cur_state != trig_thresh->trip_triggered) { + sensor_mgr_set_threshold(trig_thresh->sensor_id, trig_thresh->threshold); + trig_thresh->cur_state = trig_thresh->trip_triggered; + } } static void msm_thermal_bite(int zone_id, int temp) @@ -4165,8 +4169,11 @@ static void cx_phase_ctrl_notify(struct therm_threshold *trig_thresh) cx_phase_unlock_exit: mutex_unlock(&cx_mutex); cx_phase_ctrl_exit: - sensor_mgr_set_threshold(trig_thresh->sensor_id, + if (trig_thresh->cur_state != trig_thresh->trip_triggered) { + sensor_mgr_set_threshold(trig_thresh->sensor_id, trig_thresh->threshold); + trig_thresh->cur_state = trig_thresh->trip_triggered; + } return; } @@ -4294,8 +4301,11 @@ static void vdd_restriction_notify(struct therm_threshold *trig_thresh) unlock_and_exit: mutex_unlock(&vdd_rstr_mutex); set_and_exit: - sensor_mgr_set_threshold(trig_thresh->sensor_id, + if (trig_thresh->cur_state != trig_thresh->trip_triggered) { + sensor_mgr_set_threshold(trig_thresh->sensor_id, trig_thresh->threshold); + trig_thresh->cur_state = trig_thresh->trip_triggered; + } return; } @@ -4343,8 +4353,11 @@ static void ocr_notify(struct therm_threshold *trig_thresh) unlock_and_exit: mutex_unlock(&ocr_mutex); set_and_exit: - sensor_mgr_set_threshold(trig_thresh->sensor_id, - trig_thresh->threshold); + if (trig_thresh->cur_state != trig_thresh->trip_triggered) { + sensor_mgr_set_threshold(trig_thresh->sensor_id, + trig_thresh->threshold); + trig_thresh->cur_state = trig_thresh->trip_triggered; + } return; } @@ -4579,6 +4592,7 @@ int sensor_mgr_init_threshold(struct threshold_info *thresh_inp, thresh_ptr[i].notify = callback; thresh_ptr[i].trip_triggered = -1; thresh_ptr[i].parent = thresh_inp; + thresh_ptr[i].cur_state = -1; thresh_ptr[i].threshold[0].temp = high_temp * tsens_scaling_factor; thresh_ptr[i].threshold[0].trip = @@ -4599,6 +4613,7 @@ int sensor_mgr_init_threshold(struct threshold_info *thresh_inp, thresh_ptr->notify = callback; thresh_ptr->trip_triggered = -1; thresh_ptr->parent = thresh_inp; + thresh_ptr->cur_state = -1; thresh_ptr->threshold[0].temp = high_temp * tsens_scaling_factor; thresh_ptr->threshold[0].trip = THERMAL_TRIP_CONFIGURABLE_HI; diff --git a/include/linux/msm_thermal.h b/include/linux/msm_thermal.h index ab9f70002630..52331a5897f2 100644 --- a/include/linux/msm_thermal.h +++ b/include/linux/msm_thermal.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2015, The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2016, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -91,6 +91,7 @@ struct therm_threshold { int32_t trip_triggered; void (*notify)(struct therm_threshold *); struct threshold_info *parent; + int32_t cur_state; }; struct threshold_info { |
