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

Commit 7b16a3a6 authored by qctecmdr Service's avatar qctecmdr Service Committed by Gerrit - the friendly Code Review server
Browse files

Merge "drivers: thermal: Add support to modify passive/polling delay to of_thermal"

parents 9a0b22fb a759bf9e
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -175,6 +175,10 @@ Optional property:
			2000mW, while on a 10'' tablet is around
			4500mW.

- wake-capable-sensor:	Set to true if thermal zone sensor is wake up capable
  Type: bool		and cooling devices binded to this thermal zone are not
  Size: none		affected during suspend.

Note: The delay properties are bound to the maximum dT/dt (temperature
derivative over time) in two situations for a thermal zone:
(i)  - when passive cooling is activated (polling-delay-passive); and
+8 −1
Original line number Diff line number Diff line
/*
 * Copyright (c) 2018, The Linux Foundation. All rights reserved.
 * Copyright (c) 2018-2019, 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
@@ -533,6 +533,7 @@
		polling-delay = <0>;
		thermal-governor = "step_wise";
		thermal-sensors = <&pm6150_tz>;
		wake-capable-sensor;

		trips {
			pm6150_trip0: trip0 {
@@ -558,6 +559,7 @@
		polling-delay = <0>;
		thermal-governor = "step_wise";
		thermal-sensors = <&pm6150_bcl 0>;
		wake-capable-sensor;

		trips {
			ibat_lvl0:ibat-lvl0 {
@@ -573,6 +575,7 @@
		polling-delay = <0>;
		thermal-governor = "step_wise";
		thermal-sensors = <&pm6150_bcl 1>;
		wake-capable-sensor;

		trips {
			ibat_lvl1:ibat-lvl1 {
@@ -588,6 +591,7 @@
		polling-delay = <0>;
		thermal-governor = "low_limits_cap";
		thermal-sensors = <&pm6150_bcl 2>;
		wake-capable-sensor;
		tracks-low;

		trips {
@@ -604,6 +608,7 @@
		polling-delay = <0>;
		thermal-governor = "low_limits_cap";
		thermal-sensors = <&pm6150_bcl 3>;
		wake-capable-sensor;
		tracks-low;

		trips {
@@ -620,6 +625,7 @@
		polling-delay = <0>;
		thermal-governor = "low_limits_cap";
		thermal-sensors = <&pm6150_bcl 4>;
		wake-capable-sensor;
		tracks-low;

		trips {
@@ -636,6 +642,7 @@
		polling-delay = <0>;
		thermal-governor = "low_limits_cap";
		thermal-sensors = <&bcl_soc>;
		wake-capable-sensor;
		tracks-low;

		trips {
+4 −0
Original line number Diff line number Diff line
@@ -431,6 +431,7 @@
		polling-delay = <0>;
		thermal-governor = "step_wise";
		thermal-sensors = <&pm6150l_tz>;
		wake-capable-sensor;

		trips {
			pm6150l_trip0: trip0 {
@@ -456,6 +457,7 @@
		polling-delay = <0>;
		thermal-governor = "low_limits_cap";
		thermal-sensors = <&pm6150l_bcl 2>;
		wake-capable-sensor;
		tracks-low;

		trips {
@@ -472,6 +474,7 @@
		polling-delay = <0>;
		thermal-governor = "low_limits_cap";
		thermal-sensors = <&pm6150l_bcl 3>;
		wake-capable-sensor;
		tracks-low;

		trips {
@@ -488,6 +491,7 @@
		polling-delay = <0>;
		thermal-governor = "low_limits_cap";
		thermal-sensors = <&pm6150l_bcl 4>;
		wake-capable-sensor;
		tracks-low;

		trips {
+63 −0
Original line number Diff line number Diff line
@@ -102,6 +102,7 @@
		polling-delay = <0>;
		thermal-governor = "user_space";
		thermal-sensors = <&tsens0 0>;
		wake-capable-sensor;
		trips {
			active-config0 {
				temperature = <125000>;
@@ -121,6 +122,7 @@
		polling-delay = <0>;
		thermal-governor = "user_space";
		thermal-sensors = <&tsens0 1>;
		wake-capable-sensor;
		trips {
			active-config0 {
				temperature = <125000>;
@@ -140,6 +142,7 @@
		polling-delay = <0>;
		thermal-governor = "user_space";
		thermal-sensors = <&tsens0 2>;
		wake-capable-sensor;
		trips {
			active-config0 {
				temperature = <125000>;
@@ -159,6 +162,7 @@
		polling-delay = <0>;
		thermal-governor = "user_space";
		thermal-sensors = <&tsens0 3>;
		wake-capable-sensor;
		trips {
			active-config0 {
				temperature = <125000>;
@@ -178,6 +182,7 @@
		polling-delay = <0>;
		thermal-sensors = <&tsens0 4>;
		thermal-governor = "user_space";
		wake-capable-sensor;
		trips {
			active-config0 {
				temperature = <125000>;
@@ -197,6 +202,7 @@
		polling-delay = <0>;
		thermal-sensors = <&tsens0 5>;
		thermal-governor = "user_space";
		wake-capable-sensor;
		trips {
			active-config0 {
				temperature = <125000>;
@@ -216,6 +222,7 @@
		polling-delay = <0>;
		thermal-sensors = <&tsens0 6>;
		thermal-governor = "user_space";
		wake-capable-sensor;
		trips {
			active-config0 {
				temperature = <125000>;
@@ -235,6 +242,7 @@
		polling-delay = <0>;
		thermal-sensors = <&tsens0 7>;
		thermal-governor = "user_space";
		wake-capable-sensor;
		trips {
			active-config0 {
				temperature = <125000>;
@@ -254,6 +262,7 @@
		polling-delay = <0>;
		thermal-sensors = <&tsens0 8>;
		thermal-governor = "user_space";
		wake-capable-sensor;
		trips {
			active-config0 {
				temperature = <125000>;
@@ -273,6 +282,7 @@
		polling-delay = <0>;
		thermal-sensors = <&tsens0 9>;
		thermal-governor = "user_space";
		wake-capable-sensor;
		trips {
			active-config0 {
				temperature = <125000>;
@@ -292,6 +302,7 @@
		polling-delay = <0>;
		thermal-sensors = <&tsens0 10>;
		thermal-governor = "user_space";
		wake-capable-sensor;
		trips {
			active-config0 {
				temperature = <125000>;
@@ -311,6 +322,7 @@
		polling-delay = <0>;
		thermal-sensors = <&tsens0 11>;
		thermal-governor = "user_space";
		wake-capable-sensor;
		trips {
			active-config0 {
				temperature = <125000>;
@@ -330,6 +342,7 @@
		polling-delay = <0>;
		thermal-sensors = <&tsens0 12>;
		thermal-governor = "user_space";
		wake-capable-sensor;
		trips {
			active-config0 {
				temperature = <125000>;
@@ -349,6 +362,7 @@
		polling-delay = <0>;
		thermal-sensors = <&tsens0 13>;
		thermal-governor = "user_space";
		wake-capable-sensor;
		trips {
			active-config0 {
				temperature = <125000>;
@@ -368,6 +382,7 @@
		polling-delay = <0>;
		thermal-sensors = <&tsens0 14>;
		thermal-governor = "user_space";
		wake-capable-sensor;
		trips {
			active-config0 {
				temperature = <125000>;
@@ -387,6 +402,7 @@
		polling-delay = <0>;
		thermal-sensors = <&tsens1 0>;
		thermal-governor = "user_space";
		wake-capable-sensor;
		trips {
			active-config0 {
				temperature = <125000>;
@@ -406,6 +422,7 @@
		polling-delay = <0>;
		thermal-sensors = <&tsens1 1>;
		thermal-governor = "user_space";
		wake-capable-sensor;
		trips {
			active-config0 {
				temperature = <125000>;
@@ -425,6 +442,7 @@
		polling-delay = <0>;
		thermal-sensors = <&tsens1 2>;
		thermal-governor = "user_space";
		wake-capable-sensor;
		trips {
			active-config0 {
				temperature = <125000>;
@@ -444,6 +462,7 @@
		polling-delay = <0>;
		thermal-sensors = <&tsens1 3>;
		thermal-governor = "user_space";
		wake-capable-sensor;
		trips {
			active-config0 {
				temperature = <125000>;
@@ -463,6 +482,7 @@
		polling-delay = <0>;
		thermal-sensors = <&tsens1 4>;
		thermal-governor = "user_space";
		wake-capable-sensor;
		trips {
			active-config0 {
				temperature = <125000>;
@@ -482,6 +502,7 @@
		polling-delay = <0>;
		thermal-sensors = <&tsens1 5>;
		thermal-governor = "user_space";
		wake-capable-sensor;
		trips {
			active-config0 {
				temperature = <125000>;
@@ -501,6 +522,7 @@
		polling-delay = <0>;
		thermal-sensors = <&tsens1 6>;
		thermal-governor = "user_space";
		wake-capable-sensor;
		trips {
			active-config0 {
				temperature = <125000>;
@@ -520,6 +542,7 @@
		polling-delay = <0>;
		thermal-sensors = <&tsens1 7>;
		thermal-governor = "user_space";
		wake-capable-sensor;
		trips {
			active-config0 {
				temperature = <125000>;
@@ -539,6 +562,7 @@
		polling-delay = <0>;
		thermal-sensors = <&tsens1 8>;
		thermal-governor = "user_space";
		wake-capable-sensor;
		trips {
			active-config0 {
				temperature = <125000>;
@@ -558,6 +582,7 @@
		polling-delay = <0>;
		thermal-sensors = <&tsens1 9>;
		thermal-governor = "user_space";
		wake-capable-sensor;
		trips {
			active-config0 {
				temperature = <125000>;
@@ -577,6 +602,7 @@
		polling-delay = <0>;
		thermal-governor = "user_space";
		thermal-sensors = <&pm6150_adc_tm ADC_XO_THERM_PU2>;
		wake-capable-sensor;
		trips {
			active-config0 {
				temperature = <125000>;
@@ -591,6 +617,7 @@
		polling-delay = <0>;
		thermal-governor = "user_space";
		thermal-sensors = <&pm6150_adc_tm ADC_AMUX_THM2_PU2>;
		wake-capable-sensor;
		trips {
			active-config0 {
				temperature = <125000>;
@@ -605,6 +632,7 @@
		polling-delay = <0>;
		thermal-governor = "user_space";
		thermal-sensors = <&pm6150_adc_tm ADC_AMUX_THM3_PU2>;
		wake-capable-sensor;
		trips {
			active-config0 {
				temperature = <125000>;
@@ -619,6 +647,7 @@
		polling-delay = <0>;
		thermal-governor = "user_space";
		thermal-sensors = <&pm6150_adc_tm ADC_AMUX_THM4_PU2>;
		wake-capable-sensor;
		trips {
			active-config0 {
				temperature = <125000>;
@@ -633,6 +662,7 @@
		polling-delay = <0>;
		thermal-governor = "user_space";
		thermal-sensors = <&pm6150l_adc_tm ADC_AMUX_THM1_PU2>;
		wake-capable-sensor;
		trips {
			active-config0 {
				temperature = <125000>;
@@ -647,6 +677,7 @@
		polling-delay = <0>;
		thermal-governor = "user_space";
		thermal-sensors = <&pm6150l_adc_tm ADC_AMUX_THM3_PU2>;
		wake-capable-sensor;
		trips {
			active-config0 {
				temperature = <125000>;
@@ -661,6 +692,7 @@
		polling-delay = <0>;
		thermal-governor = "user_space";
		thermal-sensors = <&pm6150l_adc_tm ADC_GPIO4_PU2>;
		wake-capable-sensor;
		trips {
			active-config0 {
				temperature = <125000>;
@@ -675,6 +707,7 @@
		polling-delay = <0>;
		thermal-governor = "user_space";
		thermal-sensors = <&lmh_dcvs0>;
		wake-capable-sensor;

		trips {
			active-config {
@@ -690,6 +723,7 @@
		polling-delay = <0>;
		thermal-governor = "user_space";
		thermal-sensors = <&lmh_dcvs1>;
		wake-capable-sensor;

		trips {
			active-config {
@@ -704,6 +738,7 @@
		polling-delay-passive = <10>;
		polling-delay = <100>;
		thermal-governor = "step_wise";
		wake-capable-sensor;
		trips {
			gpu_trip: gpu-trip {
				temperature = <95000>;
@@ -724,6 +759,7 @@
		polling-delay-passive = <0>;
		polling-delay = <0>;
		thermal-governor = "step_wise";
		wake-capable-sensor;
		trips {
			silver-trip {
				temperature = <120000>;
@@ -737,6 +773,7 @@
		polling-delay-passive = <0>;
		polling-delay = <0>;
		thermal-governor = "step_wise";
		wake-capable-sensor;
		trips {
			gold-trip {
				temperature = <120000>;
@@ -751,6 +788,7 @@
		polling-delay = <0>;
		thermal-governor = "step_wise";
		thermal-sensors = <&tsens0 1>;
		wake-capable-sensor;
		trips {
			cpu0_config: cpu0-config {
				temperature = <110000>;
@@ -773,6 +811,7 @@
		polling-delay = <0>;
		thermal-governor = "step_wise";
		thermal-sensors = <&tsens0 2>;
		wake-capable-sensor;
		trips {
			cpu1_config: cpu1-config {
				temperature = <110000>;
@@ -795,6 +834,7 @@
		polling-delay = <0>;
		thermal-governor = "step_wise";
		thermal-sensors = <&tsens0 3>;
		wake-capable-sensor;
		trips {
			cpu2_config: cpu2-config {
				temperature = <110000>;
@@ -817,6 +857,7 @@
		polling-delay = <0>;
		thermal-governor = "step_wise";
		thermal-sensors = <&tsens0 4>;
		wake-capable-sensor;
		trips {
			cpu3_config: cpu3-config {
				temperature = <110000>;
@@ -839,6 +880,7 @@
		polling-delay = <0>;
		thermal-governor = "step_wise";
		thermal-sensors = <&tsens0 5>;
		wake-capable-sensor;
		trips {
			cpu4_config: cpu4-config {
				temperature = <110000>;
@@ -861,6 +903,7 @@
		polling-delay = <0>;
		thermal-governor = "step_wise";
		thermal-sensors = <&tsens0 6>;
		wake-capable-sensor;
		trips {
			cpu5_config: cpu5-config {
				temperature = <110000>;
@@ -883,6 +926,7 @@
		polling-delay = <0>;
		thermal-governor = "step_wise";
		thermal-sensors = <&tsens0 9>;
		wake-capable-sensor;
		trips {
			cpu6_0_config: cpu6-0-config {
				temperature = <110000>;
@@ -905,6 +949,7 @@
		polling-delay = <0>;
		thermal-governor = "step_wise";
		thermal-sensors = <&tsens0 10>;
		wake-capable-sensor;
		trips {
			cpu6_1_config: cpu6-1-config {
				temperature = <110000>;
@@ -927,6 +972,7 @@
		polling-delay = <0>;
		thermal-governor = "step_wise";
		thermal-sensors = <&tsens0 11>;
		wake-capable-sensor;
		trips {
			cpu7_0_config: cpu7-0-config {
				temperature = <110000>;
@@ -949,6 +995,7 @@
		polling-delay = <0>;
		thermal-governor = "step_wise";
		thermal-sensors = <&tsens0 12>;
		wake-capable-sensor;
		trips {
			cpu7_1_config: cpu7-1-config {
				temperature = <110000>;
@@ -971,6 +1018,7 @@
		polling-delay = <0>;
		thermal-governor = "low_limits_floor";
		thermal-sensors = <&tsens0 0>;
		wake-capable-sensor;
		tracks-low;
		trips {
			aoss0_trip: aoss0-trip {
@@ -1021,6 +1069,7 @@
		polling-delay = <0>;
		thermal-governor = "low_limits_floor";
		thermal-sensors = <&tsens0 1>;
		wake-capable-sensor;
		tracks-low;
		trips {
			cpu_0_0_trip: cpu-0-0-trip {
@@ -1071,6 +1120,7 @@
		polling-delay = <0>;
		thermal-governor = "low_limits_floor";
		thermal-sensors = <&tsens0 9>;
		wake-capable-sensor;
		tracks-low;
		trips {
			cpu_1_0_trip: cpu-1-0-trip {
@@ -1121,6 +1171,7 @@
		polling-delay = <0>;
		thermal-governor = "low_limits_floor";
		thermal-sensors = <&tsens0 13>;
		wake-capable-sensor;
		tracks-low;
		trips {
			gpuss_0_trip: gpuss-0-trip {
@@ -1171,6 +1222,7 @@
		polling-delay = <0>;
		thermal-governor = "low_limits_floor";
		thermal-sensors = <&tsens1 1>;
		wake-capable-sensor;
		tracks-low;
		trips {
			cwlan_trip: cwlan-trip {
@@ -1221,6 +1273,7 @@
		polling-delay = <0>;
		thermal-governor = "low_limits_floor";
		thermal-sensors = <&tsens1 2>;
		wake-capable-sensor;
		tracks-low;
		trips {
			audio_trip: audio-trip {
@@ -1271,6 +1324,7 @@
		polling-delay = <0>;
		thermal-governor = "low_limits_floor";
		thermal-sensors = <&tsens1 3>;
		wake-capable-sensor;
		tracks-low;
		trips {
			ddr_trip: ddr-trip {
@@ -1321,6 +1375,7 @@
		polling-delay = <0>;
		thermal-governor = "low_limits_floor";
		thermal-sensors = <&tsens1 4>;
		wake-capable-sensor;
		tracks-low;
		trips {
			q6_hvx_trip: q6-hvx-trip {
@@ -1371,6 +1426,7 @@
		polling-delay = <0>;
		thermal-governor = "low_limits_floor";
		thermal-sensors = <&tsens1 5>;
		wake-capable-sensor;
		tracks-low;
		trips {
			camera_trip: camera-trip {
@@ -1421,6 +1477,7 @@
		polling-delay = <0>;
		thermal-governor = "low_limits_floor";
		thermal-sensors = <&tsens1 6>;
		wake-capable-sensor;
		tracks-low;
		trips {
			mdm_core_trip: mdm-core-trip {
@@ -1471,6 +1528,7 @@
		polling-delay = <0>;
		thermal-governor = "low_limits_floor";
		thermal-sensors = <&tsens1 7>;
		wake-capable-sensor;
		tracks-low;
		trips {
			mdm_dsp_trip: mdm-dsp-lowf-trip {
@@ -1521,6 +1579,7 @@
		polling-delay = <0>;
		thermal-governor = "low_limits_floor";
		thermal-sensors = <&tsens1 8>;
		wake-capable-sensor;
		tracks-low;
		trips {
			npu_trip: npu-trip {
@@ -1571,6 +1630,7 @@
		polling-delay = <0>;
		thermal-governor = "low_limits_floor";
		thermal-sensors = <&tsens1 9>;
		wake-capable-sensor;
		tracks-low;
		trips {
			video_trip: video-trip {
@@ -1621,6 +1681,7 @@
		polling-delay = <0>;
		thermal-sensors = <&tsens1 8>;
		thermal-governor = "step_wise";
		wake-capable-sensor;
		trips {
			npu_trip0: npu-trip0 {
				temperature = <95000>;
@@ -1643,6 +1704,7 @@
		polling-delay = <0>;
		thermal-sensors = <&tsens1 4>;
		thermal-governor = "step_wise";
		wake-capable-sensor;
		trips {
			q6_hvx_trip0: q6-hvx-trip0 {
				temperature = <95000>;
@@ -1686,6 +1748,7 @@
		polling-delay = <0>;
		thermal-governor = "step_wise";
		thermal-sensors = <&pm6150_adc_tm ADC_AMUX_THM4_PU2>;
		wake-capable-sensor;
		trips {
			batt_trip0: batt-trip0 {
				temperature = <43000>;
+36 −0
Original line number Diff line number Diff line
@@ -81,6 +81,7 @@ struct __sensor_param {
 * @slope: slope of the temperature adjustment curve
 * @offset: offset of the temperature adjustment curve
 * @default_disable: Keep the thermal zone disabled by default
 * @is_wakeable: Ignore post suspend thermal zone re-evaluation
 * @tzd: thermal zone device pointer for this sensor
 * @ntrips: number of trip points
 * @trips: an array of trip points (0..ntrips - 1)
@@ -98,6 +99,7 @@ struct __thermal_zone {
	int offset;
	struct thermal_zone_device *tzd;
	bool default_disable;
	bool is_wakeable;

	/* trip data */
	int ntrips;
@@ -512,6 +514,33 @@ static int of_thermal_get_crit_temp(struct thermal_zone_device *tz,
	return -EINVAL;
}

static bool of_thermal_is_wakeable(struct thermal_zone_device *tz)
{
	struct __thermal_zone *data = tz->devdata;

	return data->is_wakeable;
}

static int of_thermal_set_polling_delay(struct thermal_zone_device *tz,
				    int delay)
{
	struct __thermal_zone *data = tz->devdata;

	data->polling_delay = delay;

	return 0;
}

static int of_thermal_set_passive_delay(struct thermal_zone_device *tz,
				    int delay)
{
	struct __thermal_zone *data = tz->devdata;

	data->passive_delay = delay;

	return 0;
}

static int of_thermal_aggregate_trip_types(struct thermal_zone_device *tz,
		unsigned int trip_type_mask, int *low, int *high)
{
@@ -637,6 +666,10 @@ static struct thermal_zone_device_ops of_thermal_ops = {

	.bind = of_thermal_bind,
	.unbind = of_thermal_unbind,

	.is_wakeable = of_thermal_is_wakeable,
	.set_polling_delay = of_thermal_set_polling_delay,
	.set_passive_delay = of_thermal_set_passive_delay,
};

static struct thermal_zone_of_device_ops of_virt_ops = {
@@ -1255,6 +1288,9 @@ __init *thermal_of_build_thermal_zone(struct device_node *np)

	tz->default_disable = of_property_read_bool(np,
					"disable-thermal-zone");

	tz->is_wakeable = of_property_read_bool(np,
					"wake-capable-sensor");
	/*
	 * REVIST: for now, the thermal framework supports only
	 * one sensor per thermal zone. Thus, we are considering
Loading