iio: adc: qcom-spmi-adc5-gen3: Fix SID config when reading ADC channel

Currently, when reading an ADC channel the SID is always configured to 0.
This is causing incorrect readings for ADC and ADC TM channels. Fix this.

Change-Id: If6332c6ec83f04ce4294df27e5bdb784cc5d23be
Signed-off-by: Anjelique Melendez <quic_amelende@quicinc.com>
This commit is contained in:
Anjelique Melendez 2022-02-10 13:34:43 -08:00 committed by David Collins
parent 7ad32f5546
commit 2d1c9eacee

View File

@ -55,7 +55,7 @@ static LIST_HEAD(adc_tm_device_list);
#define ADC5_GEN3_CONV_ERR_CLR_REQ BIT(0)
#define ADC5_GEN3_SID 0x4f
#define ADC5_GEN3_SID_MASK 0xf
#define ADC5_GEN3_SID_MASK GENMASK(3, 0)
#define ADC5_GEN3_PERPH_CH 0x50
#define ADC5_GEN3_CHAN_CONV_REQ BIT(7)
@ -357,8 +357,7 @@ static int adc5_gen3_configure(struct adc5_chip *adc,
return ret;
/* Write SID */
buf[0] &= (u8) ~ADC5_GEN3_SID_MASK;
buf[0] &= prop->sid;
buf[0] = prop->sid & ADC5_GEN3_SID_MASK;
/*
* Use channel 0 by default for immediate conversion and
@ -821,8 +820,7 @@ static int adc_tm5_gen3_configure(struct adc5_channel_prop *prop)
return ret;
/* Write SID */
buf[0] &= (u8) ~ADC5_GEN3_SID_MASK;
buf[0] &= prop->sid;
buf[0] = prop->sid & ADC5_GEN3_SID_MASK;
/*
* Select TM channel and indicate there is an actual