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

Commit d090ce30 authored by Jishnu Prakash's avatar Jishnu Prakash
Browse files

thermal: adc-tm: Correct a macro expression for PMIC7 ADC_TM



Correct expression in macro ADC_TM_UPPER_MASK. Correct
calculation of value written to ADC_TM measurement enable
register.

Change-Id: I14a6f585bb0cee678aa6eee749ba3e983ba47173
Signed-off-by: default avatarJishnu Prakash <jprakash@codeaurora.org>
parent 0a928fdb
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2019, The Linux Foundation. All rights reserved.
 * Copyright (c) 2019-2020, The Linux Foundation. All rights reserved.
 */

#include <linux/module.h>
@@ -61,7 +61,7 @@
#define ADC_TM_HIGH_THR0		0x4b
#define ADC_TM_HIGH_THR1		0x4c
#define ADC_TM_LOWER_MASK(n)			((n) & GENMASK(7, 0))
#define ADC_TM_UPPER_MASK(n)			((n) & GENMASK(15, 8) >> 8)
#define ADC_TM_UPPER_MASK(n)			(((n) & GENMASK(15, 8)) >> 8)

#define ADC_TM_MEAS_IRQ_EN		0x4d
#define ADC_TM_MEAS_EN			BIT(7)
@@ -166,7 +166,7 @@ static int adc_tm7_configure(struct adc_tm_sensor *sensor)
	buf[11] = ADC_TM_LOWER_MASK(mask);
	buf[12] = ADC_TM_UPPER_MASK(mask);

	buf[13] |= (sensor->meas_en | sensor->high_thr_en << 1 |
	buf[13] = (sensor->meas_en | sensor->high_thr_en << 1 |
				sensor->low_thr_en);

	ret = adc_tm_write_reg(chip, ADC_TM_SID, buf, 14);