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

Commit 83c0a539 authored by Ram Chandrasekar's avatar Ram Chandrasekar
Browse files

drivers: thermal: lmh-dcvsh: Validate the input threshold



It is possible that the set_trips callback can send INT_MAX for the high
threshold. In those cases, LMH DCVSh driver has to ignore those thresholds,
because the high value means that there is no active high threshold.

Update the DCVSh driver to validate the threshold input before
programming it in the hardware. The driver will error out for any high
threshold input greater than 120C.

Change-Id: Ice282e4e84b4247f68445226627ad6d14311f94d
Signed-off-by: default avatarRam Chandrasekar <rkumbako@codeaurora.org>
parent c6d522c5
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -57,6 +57,7 @@
#define LIMITS_DOMAIN_MIN           0x444D494E

#define LIMITS_TEMP_DEFAULT         75000
#define LIMITS_TEMP_HIGH_THRESH_MAX 120000
#define LIMITS_LOW_THRESHOLD_OFFSET 500
#define LIMITS_POLLING_DELAY_MS     10
#define LIMITS_CLUSTER_0_REQ        0x179C1B04
@@ -259,7 +260,7 @@ static int lmh_set_trips(void *data, int low, int high)
	struct limits_dcvs_hw *hw = (struct limits_dcvs_hw *)data;
	int ret = 0;

	if (high < LIMITS_LOW_THRESHOLD_OFFSET || low < 0) {
	if (high >= LIMITS_TEMP_HIGH_THRESH_MAX || low < 0) {
		pr_err("Value out of range low:%d high:%d\n",
				low, high);
		return -EINVAL;