diff mbox series

iio: adc: ti-ads1015: Add edge trigger support

Message ID 20230831182502.154899-1-marex@denx.de (mailing list archive)
State Accepted
Headers show
Series iio: adc: ti-ads1015: Add edge trigger support | expand

Commit Message

Marek Vasut Aug. 31, 2023, 6:25 p.m. UTC
The comparator generates an edge on the IRQ like and stays in the
configured state until cleared. Support edge triggered IRQs as well
as not all controllers do support level triggered IRQ.

Signed-off-by: Marek Vasut <marex@denx.de>
---
Cc: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Jonathan Cameron <jic23@kernel.org>
Cc: Lars-Peter Clausen <lars@metafoo.de>
Cc: Marek Vasut <marex@denx.de>
Cc: linux-iio@vger.kernel.org
---
 drivers/iio/adc/ti-ads1015.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Jonathan Cameron Sept. 3, 2023, noon UTC | #1
On Thu, 31 Aug 2023 20:25:02 +0200
Marek Vasut <marex@denx.de> wrote:

> The comparator generates an edge on the IRQ like and stays in the
> configured state until cleared. Support edge triggered IRQs as well
> as not all controllers do support level triggered IRQ.
> 
> Signed-off-by: Marek Vasut <marex@denx.de>

Hi Marek,

Seems safe enough change given the latch is enabled. 

I guess it's not really a fix, but I'd be fine with a request
for this to be added to stable if you like.

Applied to the togreg branch of iio.git and pushed out as testing
only until I can rebase on rc1.

Thanks,

Jonathan


> ---
> Cc: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
> Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Cc: Jonathan Cameron <jic23@kernel.org>
> Cc: Lars-Peter Clausen <lars@metafoo.de>
> Cc: Marek Vasut <marex@denx.de>
> Cc: linux-iio@vger.kernel.org
> ---
>  drivers/iio/adc/ti-ads1015.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/iio/adc/ti-ads1015.c b/drivers/iio/adc/ti-ads1015.c
> index 075c75a875449..addee45ed40ad 100644
> --- a/drivers/iio/adc/ti-ads1015.c
> +++ b/drivers/iio/adc/ti-ads1015.c
> @@ -1047,11 +1047,13 @@ static int ads1015_probe(struct i2c_client *client)
>  			1 << ADS1015_CFG_COMP_LAT_SHIFT;
>  
>  		switch (irq_trig) {
> +		case IRQF_TRIGGER_FALLING:
>  		case IRQF_TRIGGER_LOW:
>  			cfg_comp |= ADS1015_CFG_COMP_POL_LOW <<
>  					ADS1015_CFG_COMP_POL_SHIFT;
>  			break;
>  		case IRQF_TRIGGER_HIGH:
> +		case IRQF_TRIGGER_RISING:
>  			cfg_comp |= ADS1015_CFG_COMP_POL_HIGH <<
>  					ADS1015_CFG_COMP_POL_SHIFT;
>  			break;
Marek Vasut Sept. 3, 2023, 4:02 p.m. UTC | #2
On 9/3/23 14:00, Jonathan Cameron wrote:
> On Thu, 31 Aug 2023 20:25:02 +0200
> Marek Vasut <marex@denx.de> wrote:
> 
>> The comparator generates an edge on the IRQ like and stays in the
>> configured state until cleared. Support edge triggered IRQs as well
>> as not all controllers do support level triggered IRQ.
>>
>> Signed-off-by: Marek Vasut <marex@denx.de>
> 
> Hi Marek,
> 
> Seems safe enough change given the latch is enabled.
> 
> I guess it's not really a fix, but I'd be fine with a request
> for this to be added to stable if you like.

It isn't really a fix, so next release is fine.

> Applied to the togreg branch of iio.git and pushed out as testing
> only until I can rebase on rc1.

Thanks
diff mbox series

Patch

diff --git a/drivers/iio/adc/ti-ads1015.c b/drivers/iio/adc/ti-ads1015.c
index 075c75a875449..addee45ed40ad 100644
--- a/drivers/iio/adc/ti-ads1015.c
+++ b/drivers/iio/adc/ti-ads1015.c
@@ -1047,11 +1047,13 @@  static int ads1015_probe(struct i2c_client *client)
 			1 << ADS1015_CFG_COMP_LAT_SHIFT;
 
 		switch (irq_trig) {
+		case IRQF_TRIGGER_FALLING:
 		case IRQF_TRIGGER_LOW:
 			cfg_comp |= ADS1015_CFG_COMP_POL_LOW <<
 					ADS1015_CFG_COMP_POL_SHIFT;
 			break;
 		case IRQF_TRIGGER_HIGH:
+		case IRQF_TRIGGER_RISING:
 			cfg_comp |= ADS1015_CFG_COMP_POL_HIGH <<
 					ADS1015_CFG_COMP_POL_SHIFT;
 			break;