mirror of
https://github.com/torvalds/linux.git
synced 2026-05-27 08:33:17 +02:00
iio: adc: ad7380: enable regmap cache
Enable regmap cache, to avoid useless access on spi bus. Reviewed-by: David Lechner <dlechner@baylibre.com> Signed-off-by: Julien Stephan <jstephan@baylibre.com> Link: https://patch.msgid.link/20250108-ad7380-add-alert-support-v4-2-1751802471ba@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
parent
39bc50e00f
commit
85e5605279
|
|
@ -663,6 +663,20 @@ static int ad7380_regmap_reg_read(void *context, unsigned int reg,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static const struct reg_default ad7380_reg_defaults[] = {
|
||||
{ AD7380_REG_ADDR_ALERT_LOW_TH, 0x800 },
|
||||
{ AD7380_REG_ADDR_ALERT_HIGH_TH, 0x7FF },
|
||||
};
|
||||
|
||||
static const struct regmap_range ad7380_volatile_reg_ranges[] = {
|
||||
regmap_reg_range(AD7380_REG_ADDR_CONFIG2, AD7380_REG_ADDR_ALERT),
|
||||
};
|
||||
|
||||
static const struct regmap_access_table ad7380_volatile_regs = {
|
||||
.yes_ranges = ad7380_volatile_reg_ranges,
|
||||
.n_yes_ranges = ARRAY_SIZE(ad7380_volatile_reg_ranges),
|
||||
};
|
||||
|
||||
static const struct regmap_config ad7380_regmap_config = {
|
||||
.reg_bits = 3,
|
||||
.val_bits = 12,
|
||||
|
|
@ -670,6 +684,10 @@ static const struct regmap_config ad7380_regmap_config = {
|
|||
.reg_write = ad7380_regmap_reg_write,
|
||||
.max_register = AD7380_REG_ADDR_ALERT_HIGH_TH,
|
||||
.can_sleep = true,
|
||||
.reg_defaults = ad7380_reg_defaults,
|
||||
.num_reg_defaults = ARRAY_SIZE(ad7380_reg_defaults),
|
||||
.volatile_table = &ad7380_volatile_regs,
|
||||
.cache_type = REGCACHE_MAPLE,
|
||||
};
|
||||
|
||||
static int ad7380_debugfs_reg_access(struct iio_dev *indio_dev, u32 reg,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user