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:
Alexander Stein 2023-12-12 08:52:51 +01:00 committed by Robert Foss
parent 2db4578ef6
commit c3b7857746
No known key found for this signature in database
GPG Key ID: 3EFD900F76D1D784

View File

@ -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,
};