linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RESEND] [PATCH 1/2] iio: adc: qcom-spmi-vadc: Use right ratiometric range for 8998,660,845
@ 2020-09-26 17:18 kholk11
  2020-09-26 17:18 ` [PATCH 2/2] dt-bindings: qcom-spmi-vadc: Document qcom,spmi-vadc-8998 compatible kholk11
  2020-11-29 13:12 ` [RESEND] [PATCH 1/2] iio: adc: qcom-spmi-vadc: Use right ratiometric range for 8998,660,845 Jonathan Cameron
  0 siblings, 2 replies; 4+ messages in thread
From: kholk11 @ 2020-09-26 17:18 UTC (permalink / raw)
  To: agross
  Cc: bjorn.andersson, jic23, robh+dt, kholk11, marijns95, konradybcio,
	martin.botka1, linux-arm-msm, phone-devel, linux-kernel,
	linux-iio

From: AngeloGioacchino Del Regno <kholk11@gmail.com>

The ratiometric range for MSM8998, SDM630/636/660 and SDM845 is 1875mV
instead of the standard 1800mV: address this by adding a new compatible
"qcom,spmi-vadc-8998" and assigning the different range to the machines
declaring this one.

Signed-off-by: AngeloGioacchino Del Regno <kholk11@gmail.com>
---
 drivers/iio/adc/qcom-spmi-vadc.c   | 10 +++++++++-
 drivers/iio/adc/qcom-vadc-common.h |  1 +
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/adc/qcom-spmi-vadc.c b/drivers/iio/adc/qcom-spmi-vadc.c
index b0388f8a69f4..59a94ea7bf78 100644
--- a/drivers/iio/adc/qcom-spmi-vadc.c
+++ b/drivers/iio/adc/qcom-spmi-vadc.c
@@ -101,6 +101,7 @@ struct vadc_channel_prop {
  * @dev: pointer to struct device.
  * @base: base address for the ADC peripheral.
  * @nchannels: number of VADC channels.
+ * @ratio_range: ratiometric range for ref points.
  * @chan_props: array of VADC channel properties.
  * @iio_chans: array of IIO channels specification.
  * @are_ref_measured: are reference points measured.
@@ -114,6 +115,7 @@ struct vadc_priv {
 	struct device		 *dev;
 	u16			 base;
 	unsigned int		 nchannels;
+	unsigned int		 ratio_range;
 	struct vadc_channel_prop *chan_props;
 	struct iio_chan_spec	 *iio_chans;
 	bool			 are_ref_measured;
@@ -355,7 +357,7 @@ static int vadc_measure_ref_points(struct vadc_priv *vadc)
 	u16 read_1, read_2;
 	int ret;
 
-	vadc->graph[VADC_CALIB_RATIOMETRIC].dx = VADC_RATIOMETRIC_RANGE;
+	vadc->graph[VADC_CALIB_RATIOMETRIC].dx = vadc->ratio_range;
 	vadc->graph[VADC_CALIB_ABSOLUTE].dx = VADC_ABSOLUTE_RANGE_UV;
 
 	prop = vadc_get_channel(vadc, VADC_REF_1250MV);
@@ -885,6 +887,11 @@ static int vadc_probe(struct platform_device *pdev)
 	if (ret)
 		return ret;
 
+	if (of_device_is_compatible(node, "qcom,spmi-vadc-8998"))
+		vadc->ratio_range = VADC_RATIOMETRIC_RANGE_8998;
+	else
+		vadc->ratio_range = VADC_RATIOMETRIC_RANGE;
+
 	irq_eoc = platform_get_irq(pdev, 0);
 	if (irq_eoc < 0) {
 		if (irq_eoc == -EPROBE_DEFER || irq_eoc == -EINVAL)
@@ -918,6 +925,7 @@ static int vadc_probe(struct platform_device *pdev)
 
 static const struct of_device_id vadc_match_table[] = {
 	{ .compatible = "qcom,spmi-vadc" },
+	{ .compatible = "qcom-spmi-vadc-8998" },
 	{ }
 };
 MODULE_DEVICE_TABLE(of, vadc_match_table);
diff --git a/drivers/iio/adc/qcom-vadc-common.h b/drivers/iio/adc/qcom-vadc-common.h
index 17b2fc4d8bf2..b10d5fd59034 100644
--- a/drivers/iio/adc/qcom-vadc-common.h
+++ b/drivers/iio/adc/qcom-vadc-common.h
@@ -16,6 +16,7 @@
 
 #define VADC_ABSOLUTE_RANGE_UV			625000
 #define VADC_RATIOMETRIC_RANGE			1800
+#define VADC_RATIOMETRIC_RANGE_8998		1875
 
 #define VADC_DEF_PRESCALING			0 /* 1:1 */
 #define VADC_DEF_DECIMATION			0 /* 512 */
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] dt-bindings: qcom-spmi-vadc: Document qcom,spmi-vadc-8998 compatible
  2020-09-26 17:18 [RESEND] [PATCH 1/2] iio: adc: qcom-spmi-vadc: Use right ratiometric range for 8998,660,845 kholk11
@ 2020-09-26 17:18 ` kholk11
  2020-11-29 13:12 ` [RESEND] [PATCH 1/2] iio: adc: qcom-spmi-vadc: Use right ratiometric range for 8998,660,845 Jonathan Cameron
  1 sibling, 0 replies; 4+ messages in thread
From: kholk11 @ 2020-09-26 17:18 UTC (permalink / raw)
  To: agross
  Cc: bjorn.andersson, jic23, robh+dt, kholk11, marijns95, konradybcio,
	martin.botka1, linux-arm-msm, phone-devel, linux-kernel,
	linux-iio

From: AngeloGioacchino Del Regno <kholk11@gmail.com>

This compatible is used in the qcom-spmi-vadc driver to select a
variation in the ratiometric range, valid for MSM8998-style VADCs,
like MSM8998 itself, SDM630, SDM636, SDM660, SDM845 and others.

Signed-off-by: AngeloGioacchino Del Regno <kholk11@gmail.com>
---
 Documentation/devicetree/bindings/iio/adc/qcom,spmi-vadc.yaml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/iio/adc/qcom,spmi-vadc.yaml b/Documentation/devicetree/bindings/iio/adc/qcom,spmi-vadc.yaml
index 0ca992465a21..e9f0ebba5e2a 100644
--- a/Documentation/devicetree/bindings/iio/adc/qcom,spmi-vadc.yaml
+++ b/Documentation/devicetree/bindings/iio/adc/qcom,spmi-vadc.yaml
@@ -26,6 +26,7 @@ properties:
       - items:
           - enum:
               - qcom,spmi-vadc
+              - qcom,spmi-vadc-8998
               - qcom,spmi-adc5
               - qcom,spmi-adc-rev2
               - qcom,spmi-adc7
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [RESEND] [PATCH 1/2] iio: adc: qcom-spmi-vadc: Use right ratiometric range for 8998,660,845
  2020-09-26 17:18 [RESEND] [PATCH 1/2] iio: adc: qcom-spmi-vadc: Use right ratiometric range for 8998,660,845 kholk11
  2020-09-26 17:18 ` [PATCH 2/2] dt-bindings: qcom-spmi-vadc: Document qcom,spmi-vadc-8998 compatible kholk11
@ 2020-11-29 13:12 ` Jonathan Cameron
  2021-02-21 16:40   ` Jonathan Cameron
  1 sibling, 1 reply; 4+ messages in thread
From: Jonathan Cameron @ 2020-11-29 13:12 UTC (permalink / raw)
  To: kholk11
  Cc: agross, bjorn.andersson, robh+dt, marijns95, konradybcio,
	martin.botka1, linux-arm-msm, phone-devel, linux-kernel,
	linux-iio

On Sat, 26 Sep 2020 19:18:34 +0200
kholk11@gmail.com wrote:

> From: AngeloGioacchino Del Regno <kholk11@gmail.com>
> 
> The ratiometric range for MSM8998, SDM630/636/660 and SDM845 is 1875mV
> instead of the standard 1800mV: address this by adding a new compatible
> "qcom,spmi-vadc-8998" and assigning the different range to the machines
> declaring this one.
> 
> Signed-off-by: AngeloGioacchino Del Regno <kholk11@gmail.com>

@Bjorn

Could you take a quick look at this pair of patches.  It's been sat in
my queue waiting for appropriate review for rather too long!
(mainly because I've been rather lax in checking on status of older
series really - sorry about that :(

Thanks

Jonathan

> ---
>  drivers/iio/adc/qcom-spmi-vadc.c   | 10 +++++++++-
>  drivers/iio/adc/qcom-vadc-common.h |  1 +
>  2 files changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/adc/qcom-spmi-vadc.c b/drivers/iio/adc/qcom-spmi-vadc.c
> index b0388f8a69f4..59a94ea7bf78 100644
> --- a/drivers/iio/adc/qcom-spmi-vadc.c
> +++ b/drivers/iio/adc/qcom-spmi-vadc.c
> @@ -101,6 +101,7 @@ struct vadc_channel_prop {
>   * @dev: pointer to struct device.
>   * @base: base address for the ADC peripheral.
>   * @nchannels: number of VADC channels.
> + * @ratio_range: ratiometric range for ref points.
>   * @chan_props: array of VADC channel properties.
>   * @iio_chans: array of IIO channels specification.
>   * @are_ref_measured: are reference points measured.
> @@ -114,6 +115,7 @@ struct vadc_priv {
>  	struct device		 *dev;
>  	u16			 base;
>  	unsigned int		 nchannels;
> +	unsigned int		 ratio_range;
>  	struct vadc_channel_prop *chan_props;
>  	struct iio_chan_spec	 *iio_chans;
>  	bool			 are_ref_measured;
> @@ -355,7 +357,7 @@ static int vadc_measure_ref_points(struct vadc_priv *vadc)
>  	u16 read_1, read_2;
>  	int ret;
>  
> -	vadc->graph[VADC_CALIB_RATIOMETRIC].dx = VADC_RATIOMETRIC_RANGE;
> +	vadc->graph[VADC_CALIB_RATIOMETRIC].dx = vadc->ratio_range;
>  	vadc->graph[VADC_CALIB_ABSOLUTE].dx = VADC_ABSOLUTE_RANGE_UV;
>  
>  	prop = vadc_get_channel(vadc, VADC_REF_1250MV);
> @@ -885,6 +887,11 @@ static int vadc_probe(struct platform_device *pdev)
>  	if (ret)
>  		return ret;
>  
> +	if (of_device_is_compatible(node, "qcom,spmi-vadc-8998"))
> +		vadc->ratio_range = VADC_RATIOMETRIC_RANGE_8998;
> +	else
> +		vadc->ratio_range = VADC_RATIOMETRIC_RANGE;
> +
>  	irq_eoc = platform_get_irq(pdev, 0);
>  	if (irq_eoc < 0) {
>  		if (irq_eoc == -EPROBE_DEFER || irq_eoc == -EINVAL)
> @@ -918,6 +925,7 @@ static int vadc_probe(struct platform_device *pdev)
>  
>  static const struct of_device_id vadc_match_table[] = {
>  	{ .compatible = "qcom,spmi-vadc" },
> +	{ .compatible = "qcom-spmi-vadc-8998" },
>  	{ }
>  };
>  MODULE_DEVICE_TABLE(of, vadc_match_table);
> diff --git a/drivers/iio/adc/qcom-vadc-common.h b/drivers/iio/adc/qcom-vadc-common.h
> index 17b2fc4d8bf2..b10d5fd59034 100644
> --- a/drivers/iio/adc/qcom-vadc-common.h
> +++ b/drivers/iio/adc/qcom-vadc-common.h
> @@ -16,6 +16,7 @@
>  
>  #define VADC_ABSOLUTE_RANGE_UV			625000
>  #define VADC_RATIOMETRIC_RANGE			1800
> +#define VADC_RATIOMETRIC_RANGE_8998		1875
>  
>  #define VADC_DEF_PRESCALING			0 /* 1:1 */
>  #define VADC_DEF_DECIMATION			0 /* 512 */


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RESEND] [PATCH 1/2] iio: adc: qcom-spmi-vadc: Use right ratiometric range for 8998,660,845
  2020-11-29 13:12 ` [RESEND] [PATCH 1/2] iio: adc: qcom-spmi-vadc: Use right ratiometric range for 8998,660,845 Jonathan Cameron
@ 2021-02-21 16:40   ` Jonathan Cameron
  0 siblings, 0 replies; 4+ messages in thread
From: Jonathan Cameron @ 2021-02-21 16:40 UTC (permalink / raw)
  To: kholk11
  Cc: agross, bjorn.andersson, robh+dt, marijns95, konradybcio,
	martin.botka1, linux-arm-msm, phone-devel, linux-kernel,
	linux-iio

On Sun, 29 Nov 2020 13:12:33 +0000
Jonathan Cameron <jic23@kernel.org> wrote:

> On Sat, 26 Sep 2020 19:18:34 +0200
> kholk11@gmail.com wrote:
> 
> > From: AngeloGioacchino Del Regno <kholk11@gmail.com>
> > 
> > The ratiometric range for MSM8998, SDM630/636/660 and SDM845 is 1875mV
> > instead of the standard 1800mV: address this by adding a new compatible
> > "qcom,spmi-vadc-8998" and assigning the different range to the machines
> > declaring this one.
> > 
> > Signed-off-by: AngeloGioacchino Del Regno <kholk11@gmail.com>  
> 
> @Bjorn
> 
> Could you take a quick look at this pair of patches.  It's been sat in
> my queue waiting for appropriate review for rather too long!
> (mainly because I've been rather lax in checking on status of older
> series really - sorry about that :(

I still have these marked as outstanding.  Please take a look.

Thanks,

Jonathan

> 
> Thanks
> 
> Jonathan
> 
> > ---
> >  drivers/iio/adc/qcom-spmi-vadc.c   | 10 +++++++++-
> >  drivers/iio/adc/qcom-vadc-common.h |  1 +
> >  2 files changed, 10 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/iio/adc/qcom-spmi-vadc.c b/drivers/iio/adc/qcom-spmi-vadc.c
> > index b0388f8a69f4..59a94ea7bf78 100644
> > --- a/drivers/iio/adc/qcom-spmi-vadc.c
> > +++ b/drivers/iio/adc/qcom-spmi-vadc.c
> > @@ -101,6 +101,7 @@ struct vadc_channel_prop {
> >   * @dev: pointer to struct device.
> >   * @base: base address for the ADC peripheral.
> >   * @nchannels: number of VADC channels.
> > + * @ratio_range: ratiometric range for ref points.
> >   * @chan_props: array of VADC channel properties.
> >   * @iio_chans: array of IIO channels specification.
> >   * @are_ref_measured: are reference points measured.
> > @@ -114,6 +115,7 @@ struct vadc_priv {
> >  	struct device		 *dev;
> >  	u16			 base;
> >  	unsigned int		 nchannels;
> > +	unsigned int		 ratio_range;
> >  	struct vadc_channel_prop *chan_props;
> >  	struct iio_chan_spec	 *iio_chans;
> >  	bool			 are_ref_measured;
> > @@ -355,7 +357,7 @@ static int vadc_measure_ref_points(struct vadc_priv *vadc)
> >  	u16 read_1, read_2;
> >  	int ret;
> >  
> > -	vadc->graph[VADC_CALIB_RATIOMETRIC].dx = VADC_RATIOMETRIC_RANGE;
> > +	vadc->graph[VADC_CALIB_RATIOMETRIC].dx = vadc->ratio_range;
> >  	vadc->graph[VADC_CALIB_ABSOLUTE].dx = VADC_ABSOLUTE_RANGE_UV;
> >  
> >  	prop = vadc_get_channel(vadc, VADC_REF_1250MV);
> > @@ -885,6 +887,11 @@ static int vadc_probe(struct platform_device *pdev)
> >  	if (ret)
> >  		return ret;
> >  
> > +	if (of_device_is_compatible(node, "qcom,spmi-vadc-8998"))
> > +		vadc->ratio_range = VADC_RATIOMETRIC_RANGE_8998;
> > +	else
> > +		vadc->ratio_range = VADC_RATIOMETRIC_RANGE;
> > +
> >  	irq_eoc = platform_get_irq(pdev, 0);
> >  	if (irq_eoc < 0) {
> >  		if (irq_eoc == -EPROBE_DEFER || irq_eoc == -EINVAL)
> > @@ -918,6 +925,7 @@ static int vadc_probe(struct platform_device *pdev)
> >  
> >  static const struct of_device_id vadc_match_table[] = {
> >  	{ .compatible = "qcom,spmi-vadc" },
> > +	{ .compatible = "qcom-spmi-vadc-8998" },
> >  	{ }
> >  };
> >  MODULE_DEVICE_TABLE(of, vadc_match_table);
> > diff --git a/drivers/iio/adc/qcom-vadc-common.h b/drivers/iio/adc/qcom-vadc-common.h
> > index 17b2fc4d8bf2..b10d5fd59034 100644
> > --- a/drivers/iio/adc/qcom-vadc-common.h
> > +++ b/drivers/iio/adc/qcom-vadc-common.h
> > @@ -16,6 +16,7 @@
> >  
> >  #define VADC_ABSOLUTE_RANGE_UV			625000
> >  #define VADC_RATIOMETRIC_RANGE			1800
> > +#define VADC_RATIOMETRIC_RANGE_8998		1875
> >  
> >  #define VADC_DEF_PRESCALING			0 /* 1:1 */
> >  #define VADC_DEF_DECIMATION			0 /* 512 */  
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-02-21 16:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-26 17:18 [RESEND] [PATCH 1/2] iio: adc: qcom-spmi-vadc: Use right ratiometric range for 8998,660,845 kholk11
2020-09-26 17:18 ` [PATCH 2/2] dt-bindings: qcom-spmi-vadc: Document qcom,spmi-vadc-8998 compatible kholk11
2020-11-29 13:12 ` [RESEND] [PATCH 1/2] iio: adc: qcom-spmi-vadc: Use right ratiometric range for 8998,660,845 Jonathan Cameron
2021-02-21 16:40   ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).