ASoC: add snd_soc_component_read32
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Mon, 6 Nov 2017 01:48:19 +0000 (01:48 +0000)
committerMark Brown <broonie@kernel.org>
Wed, 8 Nov 2017 21:19:36 +0000 (21:19 +0000)
Current codec drivers are using snd_soc_read(). It will be replaced
into snd_soc_component_read(), but these 2 are using different style.
For example, it will be

- val = snd_soc_read(xxx, reg);
+ ret = snd_soc_component_read(xxx, reg, &val);
+ if (ret < 0) {
+ ...
+ }

To more smooth replace, let's add snd_soc_component_read32
which is copied from snd_soc_read()

- val = snd_soc_read(xxx, reg);
+ val = snd_soc_component_read32(xxx, reg);

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
include/sound/soc.h
sound/soc/soc-io.c

index 6c808527a4f6a211a8a6b30085b6bb5d9c7f3b36..747588273c96662dfaee6fc14a9b7b51a7282c6d 100644 (file)
@@ -1498,6 +1498,8 @@ static inline int snd_soc_cache_sync(struct snd_soc_codec *codec)
 /* component IO */
 int snd_soc_component_read(struct snd_soc_component *component,
        unsigned int reg, unsigned int *val);
+unsigned int snd_soc_component_read32(struct snd_soc_component *component,
+                                     unsigned int reg);
 int snd_soc_component_write(struct snd_soc_component *component,
        unsigned int reg, unsigned int val);
 int snd_soc_component_update_bits(struct snd_soc_component *component,
index 9b3939049cefc357581200063108124c3adf8907..20340ade20a789803c7ec02d9bf3ad569db1e68d 100644 (file)
@@ -41,6 +41,20 @@ int snd_soc_component_read(struct snd_soc_component *component,
 }
 EXPORT_SYMBOL_GPL(snd_soc_component_read);
 
+unsigned int snd_soc_component_read32(struct snd_soc_component *component,
+                                     unsigned int reg)
+{
+       unsigned int val;
+       int ret;
+
+       ret = snd_soc_component_read(component, reg, &val);
+       if (ret < 0)
+               return -1;
+
+       return val;
+}
+EXPORT_SYMBOL_GPL(snd_soc_component_read32);
+
 /**
  * snd_soc_component_write() - Write register value
  * @component: Component to write to