msm: thermal: Add support to monitor only one tsens for MX restriction

Currently VDD MX restriction feature monitors all tsens for low
temperature condition. Some targets which has higher MX restriction
thresholds shows frequent interrupts from multiple sensors causing
power impact.
Add support to monitor only one sensor for VDD MX restriction feature.
Add an optional device tree property "qcom,mx-restriction-sensor_id"
to specify sensor id for monitor. If not defined, monitor all tsens
for VDD MX restriction.

Change-Id: Ib709b00c27f43c2603ac8a08b75f2fbd5800983b
Signed-off-by: Manaf Meethalavalappu Pallikunhi <manafm@codeaurora.org>
This commit is contained in:
Manaf Meethalavalappu Pallikunhi 2016-01-28 23:09:30 +05:30 committed by Kyle Yan
parent 86eb5bd26d
commit be375a03c7
3 changed files with 19 additions and 1 deletions

View file

@ -224,6 +224,12 @@ Optional child nodes
qcom,mx-restriction-temp and qcom,mx-restriction-temp-hysteresis
should also be present. Also, if this property is defined, will
have to define vdd-cx-supply = <&phandle_of_regulator>.
- qcom,mx-restriction-sensor_id: sensor id, which needs to be monitored for requesting MX/CX
retention voltage. If this optional property is defined, msm_thermal
will monitor only this sensor, otherwise by default it will monitor
all TSENS for this feature. If this property exists, then the properties,
qcom,mx-restriction-temp, qcom,mx-restriction-temp-hysteresis and
qcom,mx-retention-min should also be defined to enable this feature.
- qcom,therm-reset-temp: Degree above which the KTM will initiate a secure watchdog reset.
When this property is defined, KTM will monitor all the tsens from
boot time and will initiate a secure watchdog reset if any of the
@ -269,6 +275,7 @@ Example:
qcom,mx-restriction-temp = <5>;
qcom,mx-restriction-temp-hysteresis = <10>;
qcom,mx-retention-min = <710000>;
qcom,mx-restriction-sensor_id = <2>;
vdd-mx-supply = <&pma8084_s1>;
qcom,cx-retention-min = <RPM_SMD_REGULATOR_LEVEL_RETENTION_PLUS>;
vdd-cx-supply = <&pmd9635_s5_level>;

View file

@ -5879,6 +5879,13 @@ static int probe_vdd_mx(struct device_node *node,
if (ret)
goto read_node_done;
/*
* Monitor only this sensor if defined, otherwise monitor all tsens
*/
key = "qcom,mx-restriction-sensor_id";
if (of_property_read_u32(node, key, &data->vdd_mx_sensor_id))
data->vdd_mx_sensor_id = MONITOR_ALL_TSENS;
vdd_mx = devm_regulator_get(&pdev->dev, "vdd-mx");
if (IS_ERR_OR_NULL(vdd_mx)) {
ret = PTR_ERR(vdd_mx);
@ -5905,7 +5912,7 @@ static int probe_vdd_mx(struct device_node *node,
}
ret = sensor_mgr_init_threshold(&thresh[MSM_VDD_MX_RESTRICTION],
MONITOR_ALL_TSENS,
data->vdd_mx_sensor_id,
data->vdd_mx_temp_degC + data->vdd_mx_temp_hyst_degC,
data->vdd_mx_temp_degC, vdd_mx_notify);
@ -6878,6 +6885,9 @@ static void thermal_mx_config_read(struct seq_file *m, void *data)
if (vdd_cx)
seq_printf(m, "cx retention value:%d\n",
msm_thermal_info.vdd_cx_min);
if (msm_thermal_info.vdd_mx_sensor_id != MONITOR_ALL_TSENS)
seq_printf(m, "tsens sensor:tsens_tz_sensor%d\n",
msm_thermal_info.vdd_mx_sensor_id);
}
}

View file

@ -74,6 +74,7 @@ struct msm_thermal_data {
int32_t cx_phase_request_key;
int32_t vdd_mx_temp_degC;
int32_t vdd_mx_temp_hyst_degC;
int32_t vdd_mx_sensor_id;
int32_t therm_reset_temp_degC;
};