mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-24 12:00:58 +07:00
staging: iio: ad7780: generates pattern_mask from PAT bits
Previously, all pattern_masks and patterns in the chip_info table were hardcoded. Now they are generated using the PAT macros, as described in the datasheets. Signed-off-by: Giuliano Belinassi <giuliano.belinassi@usp.br> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
parent
23da6a1511
commit
c036a324c0
@ -22,14 +22,22 @@
|
||||
#include <linux/iio/sysfs.h>
|
||||
#include <linux/iio/adc/ad_sigma_delta.h>
|
||||
|
||||
#define AD7780_RDY BIT(7)
|
||||
#define AD7780_FILTER BIT(6)
|
||||
#define AD7780_ERR BIT(5)
|
||||
#define AD7780_ID1 BIT(4)
|
||||
#define AD7780_ID0 BIT(3)
|
||||
#define AD7780_GAIN BIT(2)
|
||||
#define AD7780_PAT1 BIT(1)
|
||||
#define AD7780_PAT0 BIT(0)
|
||||
#define AD7780_RDY BIT(7)
|
||||
#define AD7780_FILTER BIT(6)
|
||||
#define AD7780_ERR BIT(5)
|
||||
#define AD7780_ID1 BIT(4)
|
||||
#define AD7780_ID0 BIT(3)
|
||||
#define AD7780_GAIN BIT(2)
|
||||
#define AD7780_PAT1 BIT(1)
|
||||
#define AD7780_PAT0 BIT(0)
|
||||
|
||||
#define AD7780_PATTERN (AD7780_PAT0)
|
||||
#define AD7780_PATTERN_MASK (AD7780_PAT0 | AD7780_PAT1)
|
||||
|
||||
#define AD7170_PAT2 BIT(2)
|
||||
|
||||
#define AD7170_PATTERN (AD7780_PAT0 | AD7170_PAT2)
|
||||
#define AD7170_PATTERN_MASK (AD7780_PAT0 | AD7780_PAT1 | AD7170_PAT2)
|
||||
|
||||
struct ad7780_chip_info {
|
||||
struct iio_chan_spec channel;
|
||||
@ -136,26 +144,26 @@ static const struct ad_sigma_delta_info ad7780_sigma_delta_info = {
|
||||
static const struct ad7780_chip_info ad7780_chip_info_tbl[] = {
|
||||
[ID_AD7170] = {
|
||||
.channel = AD7780_CHANNEL(12, 24),
|
||||
.pattern = 0x5,
|
||||
.pattern_mask = 0x7,
|
||||
.pattern = AD7170_PATTERN,
|
||||
.pattern_mask = AD7170_PATTERN_MASK,
|
||||
.is_ad778x = false,
|
||||
},
|
||||
[ID_AD7171] = {
|
||||
.channel = AD7780_CHANNEL(16, 24),
|
||||
.pattern = 0x5,
|
||||
.pattern_mask = 0x7,
|
||||
.pattern = AD7170_PATTERN,
|
||||
.pattern_mask = AD7170_PATTERN_MASK,
|
||||
.is_ad778x = false,
|
||||
},
|
||||
[ID_AD7780] = {
|
||||
.channel = AD7780_CHANNEL(24, 32),
|
||||
.pattern = 0x1,
|
||||
.pattern_mask = 0x3,
|
||||
.pattern = AD7780_PATTERN,
|
||||
.pattern_mask = AD7780_PATTERN_MASK,
|
||||
.is_ad778x = true,
|
||||
},
|
||||
[ID_AD7781] = {
|
||||
.channel = AD7780_CHANNEL(20, 32),
|
||||
.pattern = 0x1,
|
||||
.pattern_mask = 0x3,
|
||||
.pattern = AD7780_PATTERN,
|
||||
.pattern_mask = AD7780_PATTERN_MASK,
|
||||
.is_ad778x = true,
|
||||
},
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user