mirror of
https://github.com/torvalds/linux.git
synced 2026-06-02 03:24:19 +02:00
drm/bridge: tc358767: Use regmap_access_table for writeable registers
Using ranges it is easier to add more register where writing is not allowed, especially for sequences of registers. Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com> Reviewed-by: Robert Foss <rfoss@kernel.org> Signed-off-by: Robert Foss <rfoss@kernel.org> Link: https://patchwork.freedesktop.org/patch/msgid/20231212075257.75084-2-alexander.stein@ew.tq-group.com
This commit is contained in:
parent
2db4578ef6
commit
c3b7857746
|
|
@ -1992,12 +1992,15 @@ static const struct regmap_access_table tc_volatile_table = {
|
|||
.n_yes_ranges = ARRAY_SIZE(tc_volatile_ranges),
|
||||
};
|
||||
|
||||
static bool tc_writeable_reg(struct device *dev, unsigned int reg)
|
||||
{
|
||||
return (reg != TC_IDREG) &&
|
||||
(reg != DP0_LTSTAT) &&
|
||||
(reg != DP0_SNKLTCHGREQ);
|
||||
}
|
||||
static const struct regmap_range tc_non_writeable_ranges[] = {
|
||||
regmap_reg_range(TC_IDREG, TC_IDREG),
|
||||
regmap_reg_range(DP0_LTSTAT, DP0_SNKLTCHGREQ),
|
||||
};
|
||||
|
||||
static const struct regmap_access_table tc_writeable_table = {
|
||||
.no_ranges = tc_non_writeable_ranges,
|
||||
.n_no_ranges = ARRAY_SIZE(tc_non_writeable_ranges),
|
||||
};
|
||||
|
||||
static const struct regmap_config tc_regmap_config = {
|
||||
.name = "tc358767",
|
||||
|
|
@ -2008,7 +2011,7 @@ static const struct regmap_config tc_regmap_config = {
|
|||
.cache_type = REGCACHE_MAPLE,
|
||||
.readable_reg = tc_readable_reg,
|
||||
.volatile_table = &tc_volatile_table,
|
||||
.writeable_reg = tc_writeable_reg,
|
||||
.wr_table = &tc_writeable_table,
|
||||
.reg_format_endian = REGMAP_ENDIAN_BIG,
|
||||
.val_format_endian = REGMAP_ENDIAN_LITTLE,
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user