Commit da4d3d6b authored by Alexandru Tachici's avatar Alexandru Tachici Committed by Jonathan Cameron

iio: adc: ad-sigma-delta: Allow custom IRQ flags

Before this patch the ad_sigma_delta implementation hardcoded
the irq trigger type to low, assuming that all Sigma-Delta ADCs
have the same interrupt-type.

This patch allows all drivers using the ad_sigma_delta layer to set the
irq trigger type to the one specified in the datasheet.
Signed-off-by: default avatarAlexandru Tachici <alexandru.tachici@analog.com>
Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent a4e6f40c
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/device.h> #include <linux/device.h>
#include <linux/err.h> #include <linux/err.h>
#include <linux/interrupt.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/regulator/consumer.h> #include <linux/regulator/consumer.h>
...@@ -224,6 +225,7 @@ static const struct ad_sigma_delta_info ad7124_sigma_delta_info = { ...@@ -224,6 +225,7 @@ static const struct ad_sigma_delta_info ad7124_sigma_delta_info = {
.addr_shift = 0, .addr_shift = 0,
.read_mask = BIT(6), .read_mask = BIT(6),
.data_reg = AD7124_DATA, .data_reg = AD7124_DATA,
.irq_flags = IRQF_TRIGGER_LOW,
}; };
static int ad7124_set_channel_odr(struct ad7124_state *st, static int ad7124_set_channel_odr(struct ad7124_state *st,
......
...@@ -203,6 +203,7 @@ static const struct ad_sigma_delta_info ad7780_sigma_delta_info = { ...@@ -203,6 +203,7 @@ static const struct ad_sigma_delta_info ad7780_sigma_delta_info = {
.set_mode = ad7780_set_mode, .set_mode = ad7780_set_mode,
.postprocess_sample = ad7780_postprocess_sample, .postprocess_sample = ad7780_postprocess_sample,
.has_registers = false, .has_registers = false,
.irq_flags = IRQF_TRIGGER_LOW,
}; };
#define AD7780_CHANNEL(bits, wordsize) \ #define AD7780_CHANNEL(bits, wordsize) \
......
...@@ -205,6 +205,7 @@ static const struct ad_sigma_delta_info ad7791_sigma_delta_info = { ...@@ -205,6 +205,7 @@ static const struct ad_sigma_delta_info ad7791_sigma_delta_info = {
.has_registers = true, .has_registers = true,
.addr_shift = 4, .addr_shift = 4,
.read_mask = BIT(3), .read_mask = BIT(3),
.irq_flags = IRQF_TRIGGER_LOW,
}; };
static int ad7791_read_raw(struct iio_dev *indio_dev, static int ad7791_read_raw(struct iio_dev *indio_dev,
......
...@@ -206,6 +206,7 @@ static const struct ad_sigma_delta_info ad7793_sigma_delta_info = { ...@@ -206,6 +206,7 @@ static const struct ad_sigma_delta_info ad7793_sigma_delta_info = {
.has_registers = true, .has_registers = true,
.addr_shift = 3, .addr_shift = 3,
.read_mask = BIT(6), .read_mask = BIT(6),
.irq_flags = IRQF_TRIGGER_LOW,
}; };
static const struct ad_sd_calib_data ad7793_calib_arr[6] = { static const struct ad_sd_calib_data ad7793_calib_arr[6] = {
......
...@@ -500,7 +500,7 @@ static int ad_sd_probe_trigger(struct iio_dev *indio_dev) ...@@ -500,7 +500,7 @@ static int ad_sd_probe_trigger(struct iio_dev *indio_dev)
ret = request_irq(sigma_delta->spi->irq, ret = request_irq(sigma_delta->spi->irq,
ad_sd_data_rdy_trig_poll, ad_sd_data_rdy_trig_poll,
IRQF_TRIGGER_LOW, sigma_delta->info->irq_flags,
indio_dev->name, indio_dev->name,
sigma_delta); sigma_delta);
if (ret) if (ret)
......
...@@ -40,6 +40,7 @@ struct iio_dev; ...@@ -40,6 +40,7 @@ struct iio_dev;
* @read_mask: Mask for the communications register having the read bit set. * @read_mask: Mask for the communications register having the read bit set.
* @data_reg: Address of the data register, if 0 the default address of 0x3 will * @data_reg: Address of the data register, if 0 the default address of 0x3 will
* be used. * be used.
* @irq_flags: flags for the interrupt used by the triggered buffer
*/ */
struct ad_sigma_delta_info { struct ad_sigma_delta_info {
int (*set_channel)(struct ad_sigma_delta *, unsigned int channel); int (*set_channel)(struct ad_sigma_delta *, unsigned int channel);
...@@ -49,6 +50,7 @@ struct ad_sigma_delta_info { ...@@ -49,6 +50,7 @@ struct ad_sigma_delta_info {
unsigned int addr_shift; unsigned int addr_shift;
unsigned int read_mask; unsigned int read_mask;
unsigned int data_reg; unsigned int data_reg;
unsigned long irq_flags;
}; };
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment