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 <jprakash@codeaurora.org>
This commit is contained in:
Jishnu Prakash 2020-01-27 16:32:23 +05:30
commit d090ce3098

View file

@ -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 <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);