From d090ce309855dacef6512eeb850b1e99fa2cabe8 Mon Sep 17 00:00:00 2001 From: Jishnu Prakash Date: Mon, 27 Jan 2020 16:32:23 +0530 Subject: [PATCH] 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: Jishnu Prakash --- drivers/thermal/qcom/adc-tm7.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/thermal/qcom/adc-tm7.c b/drivers/thermal/qcom/adc-tm7.c index 1d4291a98ea2..f4c3cf3f89ef 100644 --- a/drivers/thermal/qcom/adc-tm7.c +++ b/drivers/thermal/qcom/adc-tm7.c @@ -1,6 +1,6 @@ // 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 @@ -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);