Commit c8633465 authored by Marek Vasut's avatar Marek Vasut Committed by Jonathan Cameron

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: default avatarMarek Vasut <marex@denx.de>
Reviewed-by: default avatarAndy Shevchenko <andy@kernel.org>
Cc: Daniel Baluta <daniel.baluta@nxp.com>
Link: https://lore.kernel.org/r/20220328194725.149150-3-marex@denx.deSigned-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent 94d9f3cb
......@@ -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[] = {
......
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