Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bf15badb authored by Manaf Meethalavalappu Pallikunhi's avatar Manaf Meethalavalappu Pallikunhi
Browse files

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



Currently VDD restriction feature monitors all tsens for low
temperature condition. There can be interrupt storm due to
temperature oscillation between trigger and clear thresholds
of all these sensors. It may lead to power issues due to frequent
tsens interrupt wake up.

Add support to monitor only one sensor for VDD restriction feature.
It helps to configure one optimal sensor for this feature if above
mentioned scenario is a concern. Add an optional devicetree property
"qcom,vdd-restriction-sensor-id" to specify sensor id to monitor.
If not defined, monitor all tsens for VDD restriction.

Change-Id: I9a36952cbcb40ebca4de5e8357529842b2f77187
Signed-off-by: default avatarManaf Meethalavalappu Pallikunhi <manafm@codeaurora.org>
parent 12960623
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -55,6 +55,9 @@ Optional properties
			key voltage rails, in degC.
			key voltage rails, in degC.
- qcom,vdd-restriction-temp-hysteresis: When temperature is above this threshold
- qcom,vdd-restriction-temp-hysteresis: When temperature is above this threshold
			will disable vdd restriction on key rails, in degC.
			will disable vdd restriction on key rails, in degC.
- qcom,vdd-restriction-sensor-id: sensor id, which needs to be monitored for vdd restriction.
			If this optional property is defined, msm_thermal will monitor only this
			sensor, otherwise by default it will monitor all TSENS for this feature.
- qcom,pmic-sw-mode-temp: Threshold temperature to disable auto mode on the
- qcom,pmic-sw-mode-temp: Threshold temperature to disable auto mode on the
			rail, in degC. If this property exists,
			rail, in degC. If this property exists,
			qcom,pmic-sw-mode-temp-hysteresis and
			qcom,pmic-sw-mode-temp-hysteresis and
@@ -273,6 +276,7 @@ Example:
		qcom,pmic-sw-mode-regs = "vdd-dig";
		qcom,pmic-sw-mode-regs = "vdd-dig";
		qcom,vdd-restriction-temp = <5>;
		qcom,vdd-restriction-temp = <5>;
		qcom,vdd-restriction-temp-hysteresis = <10>;
		qcom,vdd-restriction-temp-hysteresis = <10>;
		qcom,vdd-restriction-sensor-id = <0>;
		vdd-dig-supply=<&pm8841_s2_floor_corner>
		vdd-dig-supply=<&pm8841_s2_floor_corner>
		qcom,mx-restriction-temp = <5>;
		qcom,mx-restriction-temp = <5>;
		qcom,mx-restriction-temp-hysteresis = <10>;
		qcom,mx-restriction-temp-hysteresis = <10>;
+12 −1
Original line number Original line Diff line number Diff line
@@ -6102,6 +6102,13 @@ static int probe_vdd_rstr(struct device_node *node,
	if (ret)
	if (ret)
		goto read_node_fail;
		goto read_node_fail;


	/*
	 * Monitor only this sensor if defined, otherwise monitor all tsens
	 */
	key = "qcom,vdd-restriction-sensor-id";
	if (of_property_read_u32(node, key, &data->vdd_rstr_sensor_id))
		data->vdd_rstr_sensor_id = MONITOR_ALL_TSENS;

	for_each_child_of_node(node, child_node) {
	for_each_child_of_node(node, child_node) {
		rails_cnt++;
		rails_cnt++;
	}
	}
@@ -6174,7 +6181,7 @@ static int probe_vdd_rstr(struct device_node *node,
			goto read_node_fail;
			goto read_node_fail;
		}
		}
		ret = sensor_mgr_init_threshold(&thresh[MSM_VDD_RESTRICTION],
		ret = sensor_mgr_init_threshold(&thresh[MSM_VDD_RESTRICTION],
			MONITOR_ALL_TSENS,
			data->vdd_rstr_sensor_id,
			data->vdd_rstr_temp_hyst_degC, data->vdd_rstr_temp_degC,
			data->vdd_rstr_temp_hyst_degC, data->vdd_rstr_temp_degC,
			vdd_restriction_notify);
			vdd_restriction_notify);
		if (ret) {
		if (ret) {
@@ -7110,6 +7117,10 @@ static void thermal_vdd_config_read(struct seq_file *m, void *data)
				msm_thermal_info.vdd_rstr_temp_degC);
				msm_thermal_info.vdd_rstr_temp_degC);
		seq_printf(m, "threshold clear:%d degC\n",
		seq_printf(m, "threshold clear:%d degC\n",
				msm_thermal_info.vdd_rstr_temp_hyst_degC);
				msm_thermal_info.vdd_rstr_temp_hyst_degC);
		if (msm_thermal_info.vdd_rstr_sensor_id != MONITOR_ALL_TSENS)
			seq_printf(m, "tsens sensor:tsens_tz_sensor%d\n",
				msm_thermal_info.vdd_rstr_sensor_id);

		for (i = 0; i < rails_cnt; i++) {
		for (i = 0; i < rails_cnt; i++) {
			if (!strcmp(rails[i].name, "vdd-dig")
			if (!strcmp(rails[i].name, "vdd-dig")
				&& rails[i].num_levels)
				&& rails[i].num_levels)
+2 −1
Original line number Original line Diff line number Diff line
/*
/*
 * Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
 * Copyright (c) 2012-2016,2018, The Linux Foundation. All rights reserved.
 *
 *
 * This program is free software; you can redistribute it and/or modify
 * 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
 * it under the terms of the GNU General Public License version 2 and
@@ -54,6 +54,7 @@ struct msm_thermal_data {
	uint32_t freq_limit;
	uint32_t freq_limit;
	int32_t vdd_rstr_temp_degC;
	int32_t vdd_rstr_temp_degC;
	int32_t vdd_rstr_temp_hyst_degC;
	int32_t vdd_rstr_temp_hyst_degC;
	int32_t vdd_rstr_sensor_id;
	int32_t vdd_mx_min;
	int32_t vdd_mx_min;
	int32_t vdd_cx_min;
	int32_t vdd_cx_min;
	int32_t psm_temp_degC;
	int32_t psm_temp_degC;