Skip to content

Commit

Permalink
regmap: sdw: check for invalid multi-register writes config
Browse files Browse the repository at this point in the history
SoundWire code as it is only supports Bulk register writes and
it does not support multi-register writes.

Any drivers that set can_multi_write and use regmap_multi_reg_write() will
easily endup with programming the hardware incorrectly without any errors.

So, add this check in bus code to be able to validate the drivers config.

Fixes: 5222720 ("regmap: sdw: Remove 8-bit value size restriction")
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20230523154747.5429-1-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Srinivas Kandagatla authored and Mark Brown committed May 24, 2023
1 parent 3981514 commit 95856d1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/base/regmap/regmap-sdw.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ static int regmap_sdw_config_check(const struct regmap_config *config)
if (config->pad_bits != 0)
return -ENOTSUPP;

/* Only bulk writes are supported not multi-register writes */
if (config->can_multi_write)
return -ENOTSUPP;

return 0;
}

Expand Down

0 comments on commit 95856d1

Please sign in to comment.