All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iio: adc: ab8500-gpadc: Support non-hw-conversion
@ 2020-12-18 22:20 Linus Walleij
  2020-12-29 16:56 ` Jonathan Cameron
  0 siblings, 1 reply; 2+ messages in thread
From: Linus Walleij @ 2020-12-18 22:20 UTC (permalink / raw)
  To: Jonathan Cameron, linux-iio
  Cc: Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald-Stadler,
	Linus Walleij

The hardware conversion mode only exists in the AB8500
version of the chip, as it is lacking in the AB8505 it
will not be in the device tree and we should just not
even try to obtain it.

The driver already contains code to avoid using a
non-existing hardware conversion IRQ at conversion time.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/iio/adc/ab8500-gpadc.c | 30 ++++++++++++++++++------------
 1 file changed, 18 insertions(+), 12 deletions(-)

diff --git a/drivers/iio/adc/ab8500-gpadc.c b/drivers/iio/adc/ab8500-gpadc.c
index 1bb987a4acba..6f9a3e2d5533 100644
--- a/drivers/iio/adc/ab8500-gpadc.c
+++ b/drivers/iio/adc/ab8500-gpadc.c
@@ -1108,10 +1108,14 @@ static int ab8500_gpadc_probe(struct platform_device *pdev)
 		return gpadc->irq_sw;
 	}
 
-	gpadc->irq_hw = platform_get_irq_byname(pdev, "HW_CONV_END");
-	if (gpadc->irq_hw < 0) {
-		dev_err(dev, "failed to get platform hw_conv_end irq\n");
-		return gpadc->irq_hw;
+	if (is_ab8500(gpadc->ab8500)) {
+		gpadc->irq_hw = platform_get_irq_byname(pdev, "HW_CONV_END");
+		if (gpadc->irq_hw < 0) {
+			dev_err(dev, "failed to get platform hw_conv_end irq\n");
+			return gpadc->irq_hw;
+		}
+	} else {
+		gpadc->irq_hw = 0;
 	}
 
 	/* Initialize completion used to notify completion of conversion */
@@ -1128,14 +1132,16 @@ static int ab8500_gpadc_probe(struct platform_device *pdev)
 		return ret;
 	}
 
-	ret = devm_request_threaded_irq(dev, gpadc->irq_hw, NULL,
-		ab8500_bm_gpadcconvend_handler,	IRQF_NO_SUSPEND | IRQF_ONESHOT,
-		"ab8500-gpadc-hw", gpadc);
-	if (ret < 0) {
-		dev_err(dev,
-			"Failed to request hw conversion irq: %d\n",
-			gpadc->irq_hw);
-		return ret;
+	if (gpadc->irq_hw) {
+		ret = devm_request_threaded_irq(dev, gpadc->irq_hw, NULL,
+			ab8500_bm_gpadcconvend_handler,	IRQF_NO_SUSPEND | IRQF_ONESHOT,
+			"ab8500-gpadc-hw", gpadc);
+		if (ret < 0) {
+			dev_err(dev,
+				"Failed to request hw conversion irq: %d\n",
+				gpadc->irq_hw);
+			return ret;
+		}
 	}
 
 	/* The VTVout LDO used to power the AB8500 GPADC */
-- 
2.29.2


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

* Re: [PATCH] iio: adc: ab8500-gpadc: Support non-hw-conversion
  2020-12-18 22:20 [PATCH] iio: adc: ab8500-gpadc: Support non-hw-conversion Linus Walleij
@ 2020-12-29 16:56 ` Jonathan Cameron
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Cameron @ 2020-12-29 16:56 UTC (permalink / raw)
  To: Linus Walleij
  Cc: linux-iio, Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald-Stadler

On Fri, 18 Dec 2020 23:20:13 +0100
Linus Walleij <linus.walleij@linaro.org> wrote:

> The hardware conversion mode only exists in the AB8500
> version of the chip, as it is lacking in the AB8505 it
> will not be in the device tree and we should just not
> even try to obtain it.
> 
> The driver already contains code to avoid using a
> non-existing hardware conversion IRQ at conversion time.
> 
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Applied to the togreg branch of iio.git and pushed out as testing for all
the normal reasons.

Thanks,

Jonathan

> ---
>  drivers/iio/adc/ab8500-gpadc.c | 30 ++++++++++++++++++------------
>  1 file changed, 18 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/iio/adc/ab8500-gpadc.c b/drivers/iio/adc/ab8500-gpadc.c
> index 1bb987a4acba..6f9a3e2d5533 100644
> --- a/drivers/iio/adc/ab8500-gpadc.c
> +++ b/drivers/iio/adc/ab8500-gpadc.c
> @@ -1108,10 +1108,14 @@ static int ab8500_gpadc_probe(struct platform_device *pdev)
>  		return gpadc->irq_sw;
>  	}
>  
> -	gpadc->irq_hw = platform_get_irq_byname(pdev, "HW_CONV_END");
> -	if (gpadc->irq_hw < 0) {
> -		dev_err(dev, "failed to get platform hw_conv_end irq\n");
> -		return gpadc->irq_hw;
> +	if (is_ab8500(gpadc->ab8500)) {
> +		gpadc->irq_hw = platform_get_irq_byname(pdev, "HW_CONV_END");
> +		if (gpadc->irq_hw < 0) {
> +			dev_err(dev, "failed to get platform hw_conv_end irq\n");
> +			return gpadc->irq_hw;
> +		}
> +	} else {
> +		gpadc->irq_hw = 0;
>  	}
>  
>  	/* Initialize completion used to notify completion of conversion */
> @@ -1128,14 +1132,16 @@ static int ab8500_gpadc_probe(struct platform_device *pdev)
>  		return ret;
>  	}
>  
> -	ret = devm_request_threaded_irq(dev, gpadc->irq_hw, NULL,
> -		ab8500_bm_gpadcconvend_handler,	IRQF_NO_SUSPEND | IRQF_ONESHOT,
> -		"ab8500-gpadc-hw", gpadc);
> -	if (ret < 0) {
> -		dev_err(dev,
> -			"Failed to request hw conversion irq: %d\n",
> -			gpadc->irq_hw);
> -		return ret;
> +	if (gpadc->irq_hw) {
> +		ret = devm_request_threaded_irq(dev, gpadc->irq_hw, NULL,
> +			ab8500_bm_gpadcconvend_handler,	IRQF_NO_SUSPEND | IRQF_ONESHOT,
> +			"ab8500-gpadc-hw", gpadc);
> +		if (ret < 0) {
> +			dev_err(dev,
> +				"Failed to request hw conversion irq: %d\n",
> +				gpadc->irq_hw);
> +			return ret;
> +		}
>  	}
>  
>  	/* The VTVout LDO used to power the AB8500 GPADC */


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

end of thread, other threads:[~2020-12-29 16:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-18 22:20 [PATCH] iio: adc: ab8500-gpadc: Support non-hw-conversion Linus Walleij
2020-12-29 16:56 ` Jonathan Cameron

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.