iio: adc: ti-ads1015: Make channel event_spec optional
Pass event_spec and num_event_specs to ADS1015_V_CHAN and ADS1015_V_DIFF_CHAN macros, to make it possible to pass no event_spec at all for chips which have no comparator and thus no events. No functional change. Signed-off-by: Marek Vasut <marex@denx.de> Reviewed-by: Andy Shevchenko <andy@kernel.org> Cc: Daniel Baluta <daniel.baluta@nxp.com> Link: https://lore.kernel.org/r/20220328194725.149150-5-marex@denx.de Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
parent
fba6ca2a27
commit
6a954b9624
|
@ -134,7 +134,7 @@ static const struct iio_event_spec ads1015_events[] = {
|
|||
},
|
||||
};
|
||||
|
||||
#define ADS1015_V_CHAN(_chan, _addr, _realbits, _shift) { \
|
||||
#define ADS1015_V_CHAN(_chan, _addr, _realbits, _shift, _event_spec, _num_event_specs) { \
|
||||
.type = IIO_VOLTAGE, \
|
||||
.indexed = 1, \
|
||||
.address = _addr, \
|
||||
|
@ -150,12 +150,12 @@ static const struct iio_event_spec ads1015_events[] = {
|
|||
.shift = (_shift), \
|
||||
.endianness = IIO_CPU, \
|
||||
}, \
|
||||
.event_spec = ads1015_events, \
|
||||
.num_event_specs = ARRAY_SIZE(ads1015_events), \
|
||||
.event_spec = (_event_spec), \
|
||||
.num_event_specs = (_num_event_specs), \
|
||||
.datasheet_name = "AIN"#_chan, \
|
||||
}
|
||||
|
||||
#define ADS1015_V_DIFF_CHAN(_chan, _chan2, _addr, _realbits, _shift) { \
|
||||
#define ADS1015_V_DIFF_CHAN(_chan, _chan2, _addr, _realbits, _shift, _event_spec, _num_event_specs) { \
|
||||
.type = IIO_VOLTAGE, \
|
||||
.differential = 1, \
|
||||
.indexed = 1, \
|
||||
|
@ -173,8 +173,8 @@ static const struct iio_event_spec ads1015_events[] = {
|
|||
.shift = (_shift), \
|
||||
.endianness = IIO_CPU, \
|
||||
}, \
|
||||
.event_spec = ads1015_events, \
|
||||
.num_event_specs = ARRAY_SIZE(ads1015_events), \
|
||||
.event_spec = (_event_spec), \
|
||||
.num_event_specs = (_num_event_specs), \
|
||||
.datasheet_name = "AIN"#_chan"-AIN"#_chan2, \
|
||||
}
|
||||
|
||||
|
@ -248,26 +248,42 @@ static const struct regmap_config ads1015_regmap_config = {
|
|||
};
|
||||
|
||||
static const struct iio_chan_spec ads1015_channels[] = {
|
||||
ADS1015_V_DIFF_CHAN(0, 1, ADS1015_AIN0_AIN1, 12, 4),
|
||||
ADS1015_V_DIFF_CHAN(0, 3, ADS1015_AIN0_AIN3, 12, 4),
|
||||
ADS1015_V_DIFF_CHAN(1, 3, ADS1015_AIN1_AIN3, 12, 4),
|
||||
ADS1015_V_DIFF_CHAN(2, 3, ADS1015_AIN2_AIN3, 12, 4),
|
||||
ADS1015_V_CHAN(0, ADS1015_AIN0, 12, 4),
|
||||
ADS1015_V_CHAN(1, ADS1015_AIN1, 12, 4),
|
||||
ADS1015_V_CHAN(2, ADS1015_AIN2, 12, 4),
|
||||
ADS1015_V_CHAN(3, ADS1015_AIN3, 12, 4),
|
||||
ADS1015_V_DIFF_CHAN(0, 1, ADS1015_AIN0_AIN1, 12, 4,
|
||||
ads1015_events, ARRAY_SIZE(ads1015_events)),
|
||||
ADS1015_V_DIFF_CHAN(0, 3, ADS1015_AIN0_AIN3, 12, 4,
|
||||
ads1015_events, ARRAY_SIZE(ads1015_events)),
|
||||
ADS1015_V_DIFF_CHAN(1, 3, ADS1015_AIN1_AIN3, 12, 4,
|
||||
ads1015_events, ARRAY_SIZE(ads1015_events)),
|
||||
ADS1015_V_DIFF_CHAN(2, 3, ADS1015_AIN2_AIN3, 12, 4,
|
||||
ads1015_events, ARRAY_SIZE(ads1015_events)),
|
||||
ADS1015_V_CHAN(0, ADS1015_AIN0, 12, 4,
|
||||
ads1015_events, ARRAY_SIZE(ads1015_events)),
|
||||
ADS1015_V_CHAN(1, ADS1015_AIN1, 12, 4,
|
||||
ads1015_events, ARRAY_SIZE(ads1015_events)),
|
||||
ADS1015_V_CHAN(2, ADS1015_AIN2, 12, 4,
|
||||
ads1015_events, ARRAY_SIZE(ads1015_events)),
|
||||
ADS1015_V_CHAN(3, ADS1015_AIN3, 12, 4,
|
||||
ads1015_events, ARRAY_SIZE(ads1015_events)),
|
||||
IIO_CHAN_SOFT_TIMESTAMP(ADS1015_TIMESTAMP),
|
||||
};
|
||||
|
||||
static const struct iio_chan_spec ads1115_channels[] = {
|
||||
ADS1015_V_DIFF_CHAN(0, 1, ADS1015_AIN0_AIN1, 16, 0),
|
||||
ADS1015_V_DIFF_CHAN(0, 3, ADS1015_AIN0_AIN3, 16, 0),
|
||||
ADS1015_V_DIFF_CHAN(1, 3, ADS1015_AIN1_AIN3, 16, 0),
|
||||
ADS1015_V_DIFF_CHAN(2, 3, ADS1015_AIN2_AIN3, 16, 0),
|
||||
ADS1015_V_CHAN(0, ADS1015_AIN0, 16, 0),
|
||||
ADS1015_V_CHAN(1, ADS1015_AIN1, 16, 0),
|
||||
ADS1015_V_CHAN(2, ADS1015_AIN2, 16, 0),
|
||||
ADS1015_V_CHAN(3, ADS1015_AIN3, 16, 0),
|
||||
ADS1015_V_DIFF_CHAN(0, 1, ADS1015_AIN0_AIN1, 16, 0,
|
||||
ads1015_events, ARRAY_SIZE(ads1015_events)),
|
||||
ADS1015_V_DIFF_CHAN(0, 3, ADS1015_AIN0_AIN3, 16, 0,
|
||||
ads1015_events, ARRAY_SIZE(ads1015_events)),
|
||||
ADS1015_V_DIFF_CHAN(1, 3, ADS1015_AIN1_AIN3, 16, 0,
|
||||
ads1015_events, ARRAY_SIZE(ads1015_events)),
|
||||
ADS1015_V_DIFF_CHAN(2, 3, ADS1015_AIN2_AIN3, 16, 0,
|
||||
ads1015_events, ARRAY_SIZE(ads1015_events)),
|
||||
ADS1015_V_CHAN(0, ADS1015_AIN0, 16, 0,
|
||||
ads1015_events, ARRAY_SIZE(ads1015_events)),
|
||||
ADS1015_V_CHAN(1, ADS1015_AIN1, 16, 0,
|
||||
ads1015_events, ARRAY_SIZE(ads1015_events)),
|
||||
ADS1015_V_CHAN(2, ADS1015_AIN2, 16, 0,
|
||||
ads1015_events, ARRAY_SIZE(ads1015_events)),
|
||||
ADS1015_V_CHAN(3, ADS1015_AIN3, 16, 0,
|
||||
ads1015_events, ARRAY_SIZE(ads1015_events)),
|
||||
IIO_CHAN_SOFT_TIMESTAMP(ADS1015_TIMESTAMP),
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue