iio: adc: ti-ads1015: Switch to static const writeable ranges table
Switch the driver from code implementing test whether a regmap register is writeable to static const tables describing the test. 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-3-marex@denx.de Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
parent
94d9f3cb97
commit
c86334652a
1 changed files with 9 additions and 12 deletions
|
@ -273,23 +273,20 @@ static void ads1015_event_channel_disable(struct ads1015_data *data, int chan)
|
|||
data->event_channel = ADS1015_CHANNELS;
|
||||
}
|
||||
|
||||
static bool ads1015_is_writeable_reg(struct device *dev, unsigned int reg)
|
||||
{
|
||||
switch (reg) {
|
||||
case ADS1015_CFG_REG:
|
||||
case ADS1015_LO_THRESH_REG:
|
||||
case ADS1015_HI_THRESH_REG:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
static const struct regmap_range ads1015_writeable_ranges[] = {
|
||||
regmap_reg_range(ADS1015_CFG_REG, ADS1015_HI_THRESH_REG),
|
||||
};
|
||||
|
||||
static const struct regmap_access_table ads1015_writeable_table = {
|
||||
.yes_ranges = ads1015_writeable_ranges,
|
||||
.n_yes_ranges = ARRAY_SIZE(ads1015_writeable_ranges),
|
||||
};
|
||||
|
||||
static const struct regmap_config ads1015_regmap_config = {
|
||||
.reg_bits = 8,
|
||||
.val_bits = 16,
|
||||
.max_register = ADS1015_HI_THRESH_REG,
|
||||
.writeable_reg = ads1015_is_writeable_reg,
|
||||
.wr_table = &ads1015_writeable_table,
|
||||
};
|
||||
|
||||
static const struct iio_chan_spec ads1015_channels[] = {
|
||||
|
|
Loading…
Add table
Reference in a new issue