summaryrefslogtreecommitdiff
path: root/sound/soc/codecs/pcm5102a.c
diff options
context:
space:
mode:
authorSrinivas Kandagatla <srinivas.kandagatla@linaro.org>2021-01-26 17:17:48 +0000
committerMark Brown <broonie@kernel.org>2021-01-27 13:06:51 +0000
commit1da0b9899abdbc7103d3ec6b1a888efda41dbb59 (patch)
treefb681f7b0d04203d09d4e10e7ea42248a04101a7 /sound/soc/codecs/pcm5102a.c
parented9ce1ed2239909c23d48c723c6549417c476246 (diff)
ASoC: soc-component: add snd_soc_component_read/write_field()
It's often the case that we would write or read a particular field in register. With the current soc_component apis, reading a particular field in register would involve first read the register and then perform shift operations. Ex: to read from a field mask of 0xf0 val = snd_soc_component_read(component, reg); field = ((val & 0xf0) >> 0x4); This is sometimes prone to errors and code become less readable! With this new api we could just do field = snd_soc_component_read_field(component, reg, 0xf0); this makes it bit simple, easy to write and less error prone! This also applies to writing! There are various places in kernel which provides such field interfaces however soc_component seems to be missing this. This patch is inspired by FIELD_GET/FIELD_PREP macros in include/linux/bitfield.h Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Link: https://lore.kernel.org/r/20210126171749.1863-1-srinivas.kandagatla@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/codecs/pcm5102a.c')
0 files changed, 0 insertions, 0 deletions