ASoC: io: Remove hw_read() operation
Mark Brown
maintainerPATCH 1/1 ASoC: io: Remove hw_read() operation
From: Mark Brown <[email protected]>
We now no longer have any users of hw_read() in the kernel so remove the code in order to prevent any new users being added. Users should be using regmap.
--- include/sound/soc.h | 1 - sound/soc/soc-io.c | 13 ------------- 2 files changed, 14 deletions(-)
include/sound/soc.h +0 -1
@@ -706,7 +706,6 @@ struct snd_soc_codec {/* codec IO */ void *control_data;/* codec control (i2c/3wire) data */ hw_write_t hw_write; -unsigned int (*hw_read)(struct snd_soc_codec *,unsigned int );unsigned int (*read)(struct snd_soc_codec *,unsigned int );int (*write)(struct snd_soc_codec *,unsigned int ,unsigned int );void *reg_cache;
sound/soc/soc-io.c +0 -13
@@ -26,18 +26,6 @@ static int hw_write(struct snd_soc_codec *codec, unsigned int reg,return regmap_write (codec->control_data, reg, value); } -static unsigned int hw_read (struct snd_soc_codec *codec,unsigned int reg) -{ -int ret; -unsigned int val; - - ret =regmap_read (codec->control_data, reg, &val); -if (ret ==0 ) -return val; -else -return -1 ; -} -/** * snd_soc_codec_set_cache_io: Set up standard I/O functions. *
@@ -64,7 +52,6 @@ int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec,int ret; codec->write = hw_write; - codec->read = hw_read;switch (control) {case SND_SOC_REGMAP :
Signature · 1 line
1.9.0
Quoted 17 lines · Mark Brown
From: Mark Brown <[email protected]>
We now no longer have any users of
hw_read()in the kernel so remove the code in order to prevent any new users being added. Users should be using regmap.Signed-off-by Mark Brown <[email protected]>--- include/sound/soc.h | 1 - sound/soc/soc-io.c | 13 ------------- 2 files changed, 14 deletions(-)include/sound/soc.h +0
-0
include/sound/soc.h struct snd_soc_codec { · line 709
Quoted 4 lines
include/sound/soc.h +0
-1@@ -706,7 +706,6 @@ struct snd_soc_codec {/* codec IO */ void *control_data;/* codec control (i2c/3wire) data */ hw_write_t hw_write; -unsigned int (*hw_read)(struct snd_soc_codec *,unsigned int );
This part is OK.
Quoted 27 lines
include/sound/soc.h +0
-0unsigned int (*read)(struct snd_soc_codec *,unsigned int );int (*write)(struct snd_soc_codec *,unsigned int ,unsigned int );void *reg_cache;sound/soc/soc-io.c +0
-12@@ -26,18 +26,6 @@ static int hw_write(struct snd_soc_codec *codec, unsigned int reg,return regmap_write (codec->control_data, reg, value); } -static unsigned int hw_read (struct snd_soc_codec *codec,unsigned int reg) -{ -int ret; -unsigned int val; - - ret =regmap_read (codec->control_data, reg, &val); -if (ret ==0 ) -return val; -else -return -1 ; -} -/** * snd_soc_codec_set_cache_io: Set up standard I/O functions. *
sound/soc/soc-io.c int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec, · line 67
Quoted 4 lines
sound/soc/soc-io.c +0
-1@@ -64,7 +52,6 @@ int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec,int ret; codec->write = hw_write; - codec->read = hw_read;
But this part will break snd_soc_read() and with it basically every driver that has any controls or DAPM widgets.
I do have a set of patches that moves IO to the component level that will clean this all up quite a bit. I'm just waiting for Xiubo Li snd_soc_codec_set_cache_io() cleanup to be merged first, since it will make things a bit simpler.
Quoted 4 lines
sound/soc/soc-io.c +0
-0switch (control) {case SND_SOC_REGMAP :
Mark Brown
maintainerQuoted 5 lines · Lars-Peter Clausen
sound/soc/soc-io.c int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec, · line 67
Quoted 2 lines
sound/soc/soc-io.c +0
-1codec->write = hw_write; - codec->read = hw_read;But this part will break
snd_soc_read()and with it basically every driver that has any controls or DAPM widgets.
Bah, so it does.
Quoted 4 lines
I do have a set of patches that moves IO to the component level that will clean this all up quite a bit. I'm just waiting for Xiubo Li
snd_soc_codec_set_cache_io()cleanup to be merged first, since it will make things a bit simpler.
That seems to be going really slowly... in any case the real fix here is to get all the users converted over to regmap. We could also just do something similar to what we've done with update_bits() (where we did it for locking) which is going to be much quicker.
Quoted 8 lines · Mark Brown
Quoted 5 lines · Lars-Peter Clausen
sound/soc/soc-io.c int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec, · line 67
Quoted 2 lines
codec->write = hw_write;sound/soc/soc-io.c +0
-1- codec->read = hw_read;But this part will break
snd_soc_read()and with it basically every driver that has any controls or DAPM widgets.
Quoted 8 lines
Bah, so it does.
Quoted 4 lines
I do have a set of patches that moves IO to the component level that will clean this all up quite a bit. I'm just waiting for Xiubo Li
snd_soc_codec_set_cache_io()cleanup to be merged first, since it will make things a bit simpler.That seems to be going really slowly...
Yea, but we are not in a hurry. My plan was to get all the small independent driver cleanups necessary for componetization merged for 3.15 and then for 3.16 do the componetnization in the ASoC core.
Quoted 5 lines
in any case the real fix here
is to get all the users converted over to regmap. We could also just do something similar to what we've done withupdate_bits()(where we did it for locking) which is going to be much quicker.
So what the patchset does is add a regmap pointer to the component struct. For now it also adds snd_soc_component_{read,write,update_bits,update_bits_async} wrapper functions which have the same signature as the matching regmap function. Internally it does check if the regmap field of the component is set, if yes, just forwards the call to the matching regmap function. If not it falls back to the read, write callbacks setup by CODEC or platform drivers. Once every driver has been converted to regmap we can remove the fallback and make the function static inline.
- Lars
Mark Brown
maintainerQuoted 1 line · Lars-Peter Clausen
Yea, but we are not in a hurry. My plan was to get all the small
YM "yes". :)
Quoted 2 lines
independent driver cleanups necessary for componetization merged for 3.15 and then for 3.16 do the componetnization in the ASoC core.
I'm keen to avoid getting lots of people sitting on unmerged patches, it's a risk source due to interaction issues.
Quoted 10 lines
So what the patchset does is add a regmap pointer to the component struct. For now it also adds snd_soc_component_{read,write,update_bits,
update_bits_async} wrapper functions which have the same signature as the matching regmap function. Internally it does check if the regmap field of the component is set, if yes, just forwards the call to the matching regmap function. If not it falls back to the read, write callbacks setup by CODEC or platform drivers. Once every driver has been converted to regmap we can remove the fallback and make the function static inline.
Yes, that's what I'd expect and roughly what I was suggesting doing anyway inside the existing implementation (ie, not the new function but making the edit inside the existing functions).
I'm not sure I like the _component_ naming since it's getting a bit verbose, but on the other hand it probably should only be the core using this stuff (the drivers ought to be able to find their own regmaps, or at least doing the same lookup) so probably it doesn't matter terribly much.
Quoted 27 lines · Mark Brown
Quoted 1 line · Lars-Peter Clausen
Yea, but we are not in a hurry. My plan was to get all the small
YM "yes". :)
Quoted 2 lines
independent driver cleanups necessary for componetization merged for 3.15 and then for 3.16 do the componetnization in the ASoC core.
I'm keen to avoid getting lots of people sitting on unmerged patches, it's a risk source due to interaction issues.
Quoted 10 lines
So what the patchset does is add a regmap pointer to the component struct. For now it also adds snd_soc_component_{read,write,update_bits,
update_bits_async} wrapper functions which have the same signature as the matching regmap function. Internally it does check if the regmap field of the component is set, if yes, just forwards the call to the matching regmap function. If not it falls back to the read, write callbacks setup by CODEC or platform drivers. Once every driver has been converted to regmap we can remove the fallback and make the function static inline.Yes, that's what I'd expect and roughly what I was suggesting doing anyway inside the existing implementation (ie, not the new function but making the edit inside the existing functions).
Quoted 6 lines
I'm not sure I like the _component_ naming since it's getting a bit verbose, but on the other hand it probably should only be the core using this stuff (the drivers ought to be able to find their own regmaps, or at least doing the same lookup) so probably it doesn't matter terribly much.
Yes, it's only used in the core. There is still snd_soc_write(codec) and friends which wraps them like snd_soc_component_write(&codec->component). But on the long run I'd like to see all snd_soc_writes be removed from driver code.
- Lars
Mark Brown
maintainerQuoted 4 lines · Lars-Peter Clausen
Yes, it's only used in the core. There is still
snd_soc_write(codec)and friends which wraps them likesnd_soc_component_write(&codec->component). But on the long run I'd like to see allsnd_soc_writesbe removed from driver code.
I'm not entirely sure there - the repeated indirections we have aren't always the most pretty bit of the code we have, helpers wrapping the lookups can be useful.