mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-04 13:46:50 +07:00
iio:ad5064: Use a enum for the register map layout type
Currently the ad5064 only supports two different register map variations and this is represented by a bool. This patch changes since to a enum so we can support more variations in the future. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This commit is contained in:
parent
d23b2e8a5c
commit
4946ff5858
@ -49,6 +49,16 @@
|
|||||||
#define AD5064_LDAC_PWRDN_100K 0x2
|
#define AD5064_LDAC_PWRDN_100K 0x2
|
||||||
#define AD5064_LDAC_PWRDN_3STATE 0x3
|
#define AD5064_LDAC_PWRDN_3STATE 0x3
|
||||||
|
|
||||||
|
/**
|
||||||
|
* enum ad5064_regmap_type - Register layout variant
|
||||||
|
* @AD5064_REGMAP_ADI: Analog Devices register map layout
|
||||||
|
* @AD5064_REGMAP_LTC: LTC register map layout
|
||||||
|
*/
|
||||||
|
enum ad5064_regmap_type {
|
||||||
|
AD5064_REGMAP_ADI,
|
||||||
|
AD5064_REGMAP_LTC,
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* struct ad5064_chip_info - chip specific information
|
* struct ad5064_chip_info - chip specific information
|
||||||
* @shared_vref: whether the vref supply is shared between channels
|
* @shared_vref: whether the vref supply is shared between channels
|
||||||
@ -56,8 +66,7 @@
|
|||||||
internal vref.
|
internal vref.
|
||||||
* @channel: channel specification
|
* @channel: channel specification
|
||||||
* @num_channels: number of channels
|
* @num_channels: number of channels
|
||||||
* @powerdown_ltc: Use alternative power down addressing as required by
|
* @regmap_type: register map layout variant
|
||||||
* ltc2617 and others.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
struct ad5064_chip_info {
|
struct ad5064_chip_info {
|
||||||
@ -65,7 +74,7 @@ struct ad5064_chip_info {
|
|||||||
unsigned long internal_vref;
|
unsigned long internal_vref;
|
||||||
const struct iio_chan_spec *channels;
|
const struct iio_chan_spec *channels;
|
||||||
unsigned int num_channels;
|
unsigned int num_channels;
|
||||||
bool powerdown_ltc;
|
enum ad5064_regmap_type regmap_type;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ad5064_state;
|
struct ad5064_state;
|
||||||
@ -153,7 +162,7 @@ static int ad5064_sync_powerdown_mode(struct ad5064_state *st,
|
|||||||
unsigned int val, address;
|
unsigned int val, address;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (st->chip_info->powerdown_ltc) {
|
if (st->chip_info->regmap_type == AD5064_REGMAP_LTC) {
|
||||||
val = 0;
|
val = 0;
|
||||||
address = chan->address;
|
address = chan->address;
|
||||||
} else {
|
} else {
|
||||||
@ -393,171 +402,190 @@ static const struct ad5064_chip_info ad5064_chip_info_tbl[] = {
|
|||||||
.shared_vref = false,
|
.shared_vref = false,
|
||||||
.channels = ad5024_channels,
|
.channels = ad5024_channels,
|
||||||
.num_channels = 4,
|
.num_channels = 4,
|
||||||
|
.regmap_type = AD5064_REGMAP_ADI,
|
||||||
},
|
},
|
||||||
[ID_AD5025] = {
|
[ID_AD5025] = {
|
||||||
.shared_vref = false,
|
.shared_vref = false,
|
||||||
.channels = ad5025_channels,
|
.channels = ad5025_channels,
|
||||||
.num_channels = 2,
|
.num_channels = 2,
|
||||||
|
.regmap_type = AD5064_REGMAP_ADI,
|
||||||
},
|
},
|
||||||
[ID_AD5044] = {
|
[ID_AD5044] = {
|
||||||
.shared_vref = false,
|
.shared_vref = false,
|
||||||
.channels = ad5044_channels,
|
.channels = ad5044_channels,
|
||||||
.num_channels = 4,
|
.num_channels = 4,
|
||||||
|
.regmap_type = AD5064_REGMAP_ADI,
|
||||||
},
|
},
|
||||||
[ID_AD5045] = {
|
[ID_AD5045] = {
|
||||||
.shared_vref = false,
|
.shared_vref = false,
|
||||||
.channels = ad5045_channels,
|
.channels = ad5045_channels,
|
||||||
.num_channels = 2,
|
.num_channels = 2,
|
||||||
|
.regmap_type = AD5064_REGMAP_ADI,
|
||||||
},
|
},
|
||||||
[ID_AD5064] = {
|
[ID_AD5064] = {
|
||||||
.shared_vref = false,
|
.shared_vref = false,
|
||||||
.channels = ad5064_channels,
|
.channels = ad5064_channels,
|
||||||
.num_channels = 4,
|
.num_channels = 4,
|
||||||
|
.regmap_type = AD5064_REGMAP_ADI,
|
||||||
},
|
},
|
||||||
[ID_AD5064_1] = {
|
[ID_AD5064_1] = {
|
||||||
.shared_vref = true,
|
.shared_vref = true,
|
||||||
.channels = ad5064_channels,
|
.channels = ad5064_channels,
|
||||||
.num_channels = 4,
|
.num_channels = 4,
|
||||||
|
.regmap_type = AD5064_REGMAP_ADI,
|
||||||
},
|
},
|
||||||
[ID_AD5065] = {
|
[ID_AD5065] = {
|
||||||
.shared_vref = false,
|
.shared_vref = false,
|
||||||
.channels = ad5065_channels,
|
.channels = ad5065_channels,
|
||||||
.num_channels = 2,
|
.num_channels = 2,
|
||||||
|
.regmap_type = AD5064_REGMAP_ADI,
|
||||||
},
|
},
|
||||||
[ID_AD5628_1] = {
|
[ID_AD5628_1] = {
|
||||||
.shared_vref = true,
|
.shared_vref = true,
|
||||||
.internal_vref = 2500000,
|
.internal_vref = 2500000,
|
||||||
.channels = ad5024_channels,
|
.channels = ad5024_channels,
|
||||||
.num_channels = 8,
|
.num_channels = 8,
|
||||||
|
.regmap_type = AD5064_REGMAP_ADI,
|
||||||
},
|
},
|
||||||
[ID_AD5628_2] = {
|
[ID_AD5628_2] = {
|
||||||
.shared_vref = true,
|
.shared_vref = true,
|
||||||
.internal_vref = 5000000,
|
.internal_vref = 5000000,
|
||||||
.channels = ad5024_channels,
|
.channels = ad5024_channels,
|
||||||
.num_channels = 8,
|
.num_channels = 8,
|
||||||
|
.regmap_type = AD5064_REGMAP_ADI,
|
||||||
},
|
},
|
||||||
[ID_AD5629_1] = {
|
[ID_AD5629_1] = {
|
||||||
.shared_vref = true,
|
.shared_vref = true,
|
||||||
.internal_vref = 2500000,
|
.internal_vref = 2500000,
|
||||||
.channels = ad5629_channels,
|
.channels = ad5629_channels,
|
||||||
.num_channels = 8,
|
.num_channels = 8,
|
||||||
|
.regmap_type = AD5064_REGMAP_ADI,
|
||||||
},
|
},
|
||||||
[ID_AD5629_2] = {
|
[ID_AD5629_2] = {
|
||||||
.shared_vref = true,
|
.shared_vref = true,
|
||||||
.internal_vref = 5000000,
|
.internal_vref = 5000000,
|
||||||
.channels = ad5629_channels,
|
.channels = ad5629_channels,
|
||||||
.num_channels = 8,
|
.num_channels = 8,
|
||||||
|
.regmap_type = AD5064_REGMAP_ADI,
|
||||||
},
|
},
|
||||||
[ID_AD5648_1] = {
|
[ID_AD5648_1] = {
|
||||||
.shared_vref = true,
|
.shared_vref = true,
|
||||||
.internal_vref = 2500000,
|
.internal_vref = 2500000,
|
||||||
.channels = ad5044_channels,
|
.channels = ad5044_channels,
|
||||||
.num_channels = 8,
|
.num_channels = 8,
|
||||||
|
.regmap_type = AD5064_REGMAP_ADI,
|
||||||
},
|
},
|
||||||
[ID_AD5648_2] = {
|
[ID_AD5648_2] = {
|
||||||
.shared_vref = true,
|
.shared_vref = true,
|
||||||
.internal_vref = 5000000,
|
.internal_vref = 5000000,
|
||||||
.channels = ad5044_channels,
|
.channels = ad5044_channels,
|
||||||
.num_channels = 8,
|
.num_channels = 8,
|
||||||
|
.regmap_type = AD5064_REGMAP_ADI,
|
||||||
},
|
},
|
||||||
[ID_AD5666_1] = {
|
[ID_AD5666_1] = {
|
||||||
.shared_vref = true,
|
.shared_vref = true,
|
||||||
.internal_vref = 2500000,
|
.internal_vref = 2500000,
|
||||||
.channels = ad5064_channels,
|
.channels = ad5064_channels,
|
||||||
.num_channels = 4,
|
.num_channels = 4,
|
||||||
|
.regmap_type = AD5064_REGMAP_ADI,
|
||||||
},
|
},
|
||||||
[ID_AD5666_2] = {
|
[ID_AD5666_2] = {
|
||||||
.shared_vref = true,
|
.shared_vref = true,
|
||||||
.internal_vref = 5000000,
|
.internal_vref = 5000000,
|
||||||
.channels = ad5064_channels,
|
.channels = ad5064_channels,
|
||||||
.num_channels = 4,
|
.num_channels = 4,
|
||||||
|
.regmap_type = AD5064_REGMAP_ADI,
|
||||||
},
|
},
|
||||||
[ID_AD5668_1] = {
|
[ID_AD5668_1] = {
|
||||||
.shared_vref = true,
|
.shared_vref = true,
|
||||||
.internal_vref = 2500000,
|
.internal_vref = 2500000,
|
||||||
.channels = ad5064_channels,
|
.channels = ad5064_channels,
|
||||||
.num_channels = 8,
|
.num_channels = 8,
|
||||||
|
.regmap_type = AD5064_REGMAP_ADI,
|
||||||
},
|
},
|
||||||
[ID_AD5668_2] = {
|
[ID_AD5668_2] = {
|
||||||
.shared_vref = true,
|
.shared_vref = true,
|
||||||
.internal_vref = 5000000,
|
.internal_vref = 5000000,
|
||||||
.channels = ad5064_channels,
|
.channels = ad5064_channels,
|
||||||
.num_channels = 8,
|
.num_channels = 8,
|
||||||
|
.regmap_type = AD5064_REGMAP_ADI,
|
||||||
},
|
},
|
||||||
[ID_AD5669_1] = {
|
[ID_AD5669_1] = {
|
||||||
.shared_vref = true,
|
.shared_vref = true,
|
||||||
.internal_vref = 2500000,
|
.internal_vref = 2500000,
|
||||||
.channels = ad5669_channels,
|
.channels = ad5669_channels,
|
||||||
.num_channels = 8,
|
.num_channels = 8,
|
||||||
|
.regmap_type = AD5064_REGMAP_ADI,
|
||||||
},
|
},
|
||||||
[ID_AD5669_2] = {
|
[ID_AD5669_2] = {
|
||||||
.shared_vref = true,
|
.shared_vref = true,
|
||||||
.internal_vref = 5000000,
|
.internal_vref = 5000000,
|
||||||
.channels = ad5669_channels,
|
.channels = ad5669_channels,
|
||||||
.num_channels = 8,
|
.num_channels = 8,
|
||||||
|
.regmap_type = AD5064_REGMAP_ADI,
|
||||||
},
|
},
|
||||||
[ID_LTC2606] = {
|
[ID_LTC2606] = {
|
||||||
.shared_vref = true,
|
.shared_vref = true,
|
||||||
.internal_vref = 0,
|
.internal_vref = 0,
|
||||||
.channels = ltc2607_channels,
|
.channels = ltc2607_channels,
|
||||||
.num_channels = 1,
|
.num_channels = 1,
|
||||||
.powerdown_ltc = true,
|
.regmap_type = AD5064_REGMAP_LTC,
|
||||||
},
|
},
|
||||||
[ID_LTC2607] = {
|
[ID_LTC2607] = {
|
||||||
.shared_vref = true,
|
.shared_vref = true,
|
||||||
.internal_vref = 0,
|
.internal_vref = 0,
|
||||||
.channels = ltc2607_channels,
|
.channels = ltc2607_channels,
|
||||||
.num_channels = 2,
|
.num_channels = 2,
|
||||||
.powerdown_ltc = true,
|
.regmap_type = AD5064_REGMAP_LTC,
|
||||||
},
|
},
|
||||||
[ID_LTC2609] = {
|
[ID_LTC2609] = {
|
||||||
.shared_vref = false,
|
.shared_vref = false,
|
||||||
.internal_vref = 0,
|
.internal_vref = 0,
|
||||||
.channels = ltc2607_channels,
|
.channels = ltc2607_channels,
|
||||||
.num_channels = 4,
|
.num_channels = 4,
|
||||||
.powerdown_ltc = true,
|
.regmap_type = AD5064_REGMAP_LTC,
|
||||||
},
|
},
|
||||||
[ID_LTC2616] = {
|
[ID_LTC2616] = {
|
||||||
.shared_vref = true,
|
.shared_vref = true,
|
||||||
.internal_vref = 0,
|
.internal_vref = 0,
|
||||||
.channels = ltc2617_channels,
|
.channels = ltc2617_channels,
|
||||||
.num_channels = 1,
|
.num_channels = 1,
|
||||||
.powerdown_ltc = true,
|
.regmap_type = AD5064_REGMAP_LTC,
|
||||||
},
|
},
|
||||||
[ID_LTC2617] = {
|
[ID_LTC2617] = {
|
||||||
.shared_vref = true,
|
.shared_vref = true,
|
||||||
.internal_vref = 0,
|
.internal_vref = 0,
|
||||||
.channels = ltc2617_channels,
|
.channels = ltc2617_channels,
|
||||||
.num_channels = 2,
|
.num_channels = 2,
|
||||||
.powerdown_ltc = true,
|
.regmap_type = AD5064_REGMAP_LTC,
|
||||||
},
|
},
|
||||||
[ID_LTC2619] = {
|
[ID_LTC2619] = {
|
||||||
.shared_vref = false,
|
.shared_vref = false,
|
||||||
.internal_vref = 0,
|
.internal_vref = 0,
|
||||||
.channels = ltc2617_channels,
|
.channels = ltc2617_channels,
|
||||||
.num_channels = 4,
|
.num_channels = 4,
|
||||||
.powerdown_ltc = true,
|
.regmap_type = AD5064_REGMAP_LTC,
|
||||||
},
|
},
|
||||||
[ID_LTC2626] = {
|
[ID_LTC2626] = {
|
||||||
.shared_vref = true,
|
.shared_vref = true,
|
||||||
.internal_vref = 0,
|
.internal_vref = 0,
|
||||||
.channels = ltc2627_channels,
|
.channels = ltc2627_channels,
|
||||||
.num_channels = 1,
|
.num_channels = 1,
|
||||||
.powerdown_ltc = true,
|
.regmap_type = AD5064_REGMAP_LTC,
|
||||||
},
|
},
|
||||||
[ID_LTC2627] = {
|
[ID_LTC2627] = {
|
||||||
.shared_vref = true,
|
.shared_vref = true,
|
||||||
.internal_vref = 0,
|
.internal_vref = 0,
|
||||||
.channels = ltc2627_channels,
|
.channels = ltc2627_channels,
|
||||||
.num_channels = 2,
|
.num_channels = 2,
|
||||||
.powerdown_ltc = true,
|
.regmap_type = AD5064_REGMAP_LTC,
|
||||||
},
|
},
|
||||||
[ID_LTC2629] = {
|
[ID_LTC2629] = {
|
||||||
.shared_vref = false,
|
.shared_vref = false,
|
||||||
.internal_vref = 0,
|
.internal_vref = 0,
|
||||||
.channels = ltc2627_channels,
|
.channels = ltc2627_channels,
|
||||||
.num_channels = 4,
|
.num_channels = 4,
|
||||||
.powerdown_ltc = true,
|
.regmap_type = AD5064_REGMAP_LTC,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user