summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorManaf Meethalavalappu Pallikunhi <manafm@codeaurora.org>2016-02-03 16:23:58 +0530
committerKyle Yan <kyan@codeaurora.org>2016-06-29 15:00:39 -0700
commitd2cb754944203ad811590854d6fc97b3ad68aa5b (patch)
treefa497a6a74d761b93350a8a4e2d4e4a18c27aeb0 /drivers
parent9ba8db37da2ded19a883560e443aadad544d4dcb (diff)
msm: thermal: Maintain state in the mitigation device monitor
If KTM get a trip threshold trigger notification and if the temperature stays the same as the recent trip threshold, KTM will re-activate the recently triggered threshold, resulting in back to back interrupts. To avoid this add support in KTM to maintain the recently triggered threshold state and then re-active the threshold based on the last threshold trip. This state is updated for mitigation features like VDD MX retention, CX phase control, VDD restriction, OCR monitor and external clients like CPR low temperature monitor etc. CRs-Fixed: 969112 972634 Change-Id: I44c0a93e1507a9f0b8a65e5c2ce5a98962bb335b Signed-off-by: Manaf Meethalavalappu Pallikunhi <manafm@codeaurora.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/regulator/cpr-regulator.c14
-rw-r--r--drivers/thermal/msm_thermal.c25
2 files changed, 30 insertions, 9 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;