diff mbox series

[1/2] iio:adc:qcom-spmi-vadc: add default scale to LR_MUX2_BAT_ID channel

Message ID 20210113151808.4628-2-jonathan.albrieux@gmail.com (mailing list archive)
State New, archived
Headers show
Series Allow VADC_LR_MUX2_BAT_ID channel proper reading | expand

Commit Message

Jonathan Albrieux Jan. 13, 2021, 3:18 p.m. UTC
Checking at both msm8909-pm8916.dtsi and msm8916.dtsi from downstream
it is indicated that "batt_id" channel has to be scaled with the default
function:

	chan@31 {
		label = "batt_id";
		reg = <0x31>;
		qcom,decimation = <0>;
		qcom,pre-div-channel-scaling = <0>;
		qcom,calibration-type = "ratiometric";
		qcom,scale-function = <0>;
		qcom,hw-settle-time = <0xb>;
		qcom,fast-avg-setup = <0>;
	};

Change LR_MUX2_BAT_ID scaling accordingly.

Signed-off-by: Jonathan Albrieux <jonathan.albrieux@gmail.com>
---
 drivers/iio/adc/qcom-spmi-vadc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Bjorn Andersson Jan. 15, 2021, 4:30 p.m. UTC | #1
On Wed 13 Jan 09:18 CST 2021, Jonathan Albrieux wrote:

> Checking at both msm8909-pm8916.dtsi and msm8916.dtsi from downstream
> it is indicated that "batt_id" channel has to be scaled with the default
> function:
> 
> 	chan@31 {
> 		label = "batt_id";
> 		reg = <0x31>;
> 		qcom,decimation = <0>;
> 		qcom,pre-div-channel-scaling = <0>;
> 		qcom,calibration-type = "ratiometric";
> 		qcom,scale-function = <0>;
> 		qcom,hw-settle-time = <0xb>;
> 		qcom,fast-avg-setup = <0>;
> 	};
> 
> Change LR_MUX2_BAT_ID scaling accordingly.
> 

Acked-by: Bjorn Andersson <bjorn.andersson@linaro.org>

Not entirely sure, but looking at the history I think this used to work
- but it's obvious that no one has read this channel for a while...

But I think below is a regression and should be mentioned:

Fixes: 7c271eea7b8a ("iio: adc: spmi-vadc: Changes to support different scaling")

> Signed-off-by: Jonathan Albrieux <jonathan.albrieux@gmail.com>

Jonathan Cameron, if you merge this through your tree I can take the dts
addition through the Qualcomm tree.

Regards,
Bjorn

> ---
>  drivers/iio/adc/qcom-spmi-vadc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/adc/qcom-spmi-vadc.c b/drivers/iio/adc/qcom-spmi-vadc.c
> index b0388f8a69f4..7e7d408452ec 100644
> --- a/drivers/iio/adc/qcom-spmi-vadc.c
> +++ b/drivers/iio/adc/qcom-spmi-vadc.c
> @@ -598,7 +598,7 @@ static const struct vadc_channels vadc_chans[] = {
>  	VADC_CHAN_NO_SCALE(P_MUX16_1_3, 1)
>  
>  	VADC_CHAN_NO_SCALE(LR_MUX1_BAT_THERM, 0)
> -	VADC_CHAN_NO_SCALE(LR_MUX2_BAT_ID, 0)
> +	VADC_CHAN_VOLT(LR_MUX2_BAT_ID, 0, SCALE_DEFAULT)
>  	VADC_CHAN_NO_SCALE(LR_MUX3_XO_THERM, 0)
>  	VADC_CHAN_NO_SCALE(LR_MUX4_AMUX_THM1, 0)
>  	VADC_CHAN_NO_SCALE(LR_MUX5_AMUX_THM2, 0)
> -- 
> 2.17.1
>
Jonathan Cameron Jan. 16, 2021, 5:47 p.m. UTC | #2
On Fri, 15 Jan 2021 10:30:49 -0600
Bjorn Andersson <bjorn.andersson@linaro.org> wrote:

> On Wed 13 Jan 09:18 CST 2021, Jonathan Albrieux wrote:
> 
> > Checking at both msm8909-pm8916.dtsi and msm8916.dtsi from downstream
> > it is indicated that "batt_id" channel has to be scaled with the default
> > function:
> > 
> > 	chan@31 {
> > 		label = "batt_id";
> > 		reg = <0x31>;
> > 		qcom,decimation = <0>;
> > 		qcom,pre-div-channel-scaling = <0>;
> > 		qcom,calibration-type = "ratiometric";
> > 		qcom,scale-function = <0>;
> > 		qcom,hw-settle-time = <0xb>;
> > 		qcom,fast-avg-setup = <0>;
> > 	};
> > 
> > Change LR_MUX2_BAT_ID scaling accordingly.
> >   
> 
> Acked-by: Bjorn Andersson <bjorn.andersson@linaro.org>
> 
> Not entirely sure, but looking at the history I think this used to work
> - but it's obvious that no one has read this channel for a while...
> 
> But I think below is a regression and should be mentioned:
> 
> Fixes: 7c271eea7b8a ("iio: adc: spmi-vadc: Changes to support different scaling")
> 

Yikes that was a while ago :)

> > Signed-off-by: Jonathan Albrieux <jonathan.albrieux@gmail.com>  
> 
> Jonathan Cameron, if you merge this through your tree I can take the dts
> addition through the Qualcomm tree.

Applied to the fixes-togreg branch of iio.git and marked for stable.

I'm not going to rush this one given age of the bug, but if I happen to
have anything else going it'll make it before the end of this cycle.

Thanks,

Jonathan

> 
> Regards,
> Bjorn
> 
> > ---
> >  drivers/iio/adc/qcom-spmi-vadc.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/iio/adc/qcom-spmi-vadc.c b/drivers/iio/adc/qcom-spmi-vadc.c
> > index b0388f8a69f4..7e7d408452ec 100644
> > --- a/drivers/iio/adc/qcom-spmi-vadc.c
> > +++ b/drivers/iio/adc/qcom-spmi-vadc.c
> > @@ -598,7 +598,7 @@ static const struct vadc_channels vadc_chans[] = {
> >  	VADC_CHAN_NO_SCALE(P_MUX16_1_3, 1)
> >  
> >  	VADC_CHAN_NO_SCALE(LR_MUX1_BAT_THERM, 0)
> > -	VADC_CHAN_NO_SCALE(LR_MUX2_BAT_ID, 0)
> > +	VADC_CHAN_VOLT(LR_MUX2_BAT_ID, 0, SCALE_DEFAULT)
> >  	VADC_CHAN_NO_SCALE(LR_MUX3_XO_THERM, 0)
> >  	VADC_CHAN_NO_SCALE(LR_MUX4_AMUX_THM1, 0)
> >  	VADC_CHAN_NO_SCALE(LR_MUX5_AMUX_THM2, 0)
> > -- 
> > 2.17.1
> >
Jonathan Albrieux Jan. 16, 2021, 6:52 p.m. UTC | #3
On Sat, Jan 16, 2021 at 05:47:35PM +0000, Jonathan Cameron wrote:
> On Fri, 15 Jan 2021 10:30:49 -0600
> Bjorn Andersson <bjorn.andersson@linaro.org> wrote:
> 
> > On Wed 13 Jan 09:18 CST 2021, Jonathan Albrieux wrote:
> > 
> > > Checking at both msm8909-pm8916.dtsi and msm8916.dtsi from downstream
> > > it is indicated that "batt_id" channel has to be scaled with the default
> > > function:
> > > 
> > > 	chan@31 {
> > > 		label = "batt_id";
> > > 		reg = <0x31>;
> > > 		qcom,decimation = <0>;
> > > 		qcom,pre-div-channel-scaling = <0>;
> > > 		qcom,calibration-type = "ratiometric";
> > > 		qcom,scale-function = <0>;
> > > 		qcom,hw-settle-time = <0xb>;
> > > 		qcom,fast-avg-setup = <0>;
> > > 	};
> > > 
> > > Change LR_MUX2_BAT_ID scaling accordingly.
> > >   
> > 
> > Acked-by: Bjorn Andersson <bjorn.andersson@linaro.org>
> > 
> > Not entirely sure, but looking at the history I think this used to work
> > - but it's obvious that no one has read this channel for a while...
> > 
> > But I think below is a regression and should be mentioned:
> > 
> > Fixes: 7c271eea7b8a ("iio: adc: spmi-vadc: Changes to support different scaling")
> > 
> 
> Yikes that was a while ago :)
> 
> > > Signed-off-by: Jonathan Albrieux <jonathan.albrieux@gmail.com>  
> > 
> > Jonathan Cameron, if you merge this through your tree I can take the dts
> > addition through the Qualcomm tree.
> 
> Applied to the fixes-togreg branch of iio.git and marked for stable.
> 
> I'm not going to rush this one given age of the bug, but if I happen to
> have anything else going it'll make it before the end of this cycle.
> 
> Thanks,
> 
> Jonathan
> 
> > 
> > Regards,
> > Bjorn
> > 
> > > ---
> > >  drivers/iio/adc/qcom-spmi-vadc.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > 
> > > diff --git a/drivers/iio/adc/qcom-spmi-vadc.c b/drivers/iio/adc/qcom-spmi-vadc.c
> > > index b0388f8a69f4..7e7d408452ec 100644
> > > --- a/drivers/iio/adc/qcom-spmi-vadc.c
> > > +++ b/drivers/iio/adc/qcom-spmi-vadc.c
> > > @@ -598,7 +598,7 @@ static const struct vadc_channels vadc_chans[] = {
> > >  	VADC_CHAN_NO_SCALE(P_MUX16_1_3, 1)
> > >  
> > >  	VADC_CHAN_NO_SCALE(LR_MUX1_BAT_THERM, 0)
> > > -	VADC_CHAN_NO_SCALE(LR_MUX2_BAT_ID, 0)
> > > +	VADC_CHAN_VOLT(LR_MUX2_BAT_ID, 0, SCALE_DEFAULT)
> > >  	VADC_CHAN_NO_SCALE(LR_MUX3_XO_THERM, 0)
> > >  	VADC_CHAN_NO_SCALE(LR_MUX4_AMUX_THM1, 0)
> > >  	VADC_CHAN_NO_SCALE(LR_MUX5_AMUX_THM2, 0)
> > > -- 
> > > 2.17.1
> > >   
> 
Thank you Bjorn, thank you Jonathan,

Regards,

Jonathan
diff mbox series

Patch

diff --git a/drivers/iio/adc/qcom-spmi-vadc.c b/drivers/iio/adc/qcom-spmi-vadc.c
index b0388f8a69f4..7e7d408452ec 100644
--- a/drivers/iio/adc/qcom-spmi-vadc.c
+++ b/drivers/iio/adc/qcom-spmi-vadc.c
@@ -598,7 +598,7 @@  static const struct vadc_channels vadc_chans[] = {
 	VADC_CHAN_NO_SCALE(P_MUX16_1_3, 1)
 
 	VADC_CHAN_NO_SCALE(LR_MUX1_BAT_THERM, 0)
-	VADC_CHAN_NO_SCALE(LR_MUX2_BAT_ID, 0)
+	VADC_CHAN_VOLT(LR_MUX2_BAT_ID, 0, SCALE_DEFAULT)
 	VADC_CHAN_NO_SCALE(LR_MUX3_XO_THERM, 0)
 	VADC_CHAN_NO_SCALE(LR_MUX4_AMUX_THM1, 0)
 	VADC_CHAN_NO_SCALE(LR_MUX5_AMUX_THM2, 0)