aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2017-11-05 20:48:19 -0500
committerMark Brown <broonie@kernel.org>2017-11-08 16:19:36 -0500
commit738b49efe6c6ba485e2b45265db535c58bbd54e7 (patch)
treeb8bb133a375e144777e805338fe697c77dcc53cd
parent69941bab7c7aeaa7bf7e84397e294c17f0b7c6df (diff)
ASoC: add snd_soc_component_read32
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>
-rw-r--r--include/sound/soc.h2
-rw-r--r--sound/soc/soc-io.c14
2 files changed, 16 insertions, 0 deletions
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 6c808527a4f6..747588273c96 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -1498,6 +1498,8 @@ static inline int snd_soc_cache_sync(struct snd_soc_codec *codec)
1498/* component IO */ 1498/* component IO */
1499int snd_soc_component_read(struct snd_soc_component *component, 1499int snd_soc_component_read(struct snd_soc_component *component,
1500 unsigned int reg, unsigned int *val); 1500 unsigned int reg, unsigned int *val);
1501unsigned int snd_soc_component_read32(struct snd_soc_component *component,
1502 unsigned int reg);
1501int snd_soc_component_write(struct snd_soc_component *component, 1503int snd_soc_component_write(struct snd_soc_component *component,
1502 unsigned int reg, unsigned int val); 1504 unsigned int reg, unsigned int val);
1503int snd_soc_component_update_bits(struct snd_soc_component *component, 1505int snd_soc_component_update_bits(struct snd_soc_component *component,
diff --git a/sound/soc/soc-io.c b/sound/soc/soc-io.c
index 9b3939049cef..20340ade20a7 100644
--- a/sound/soc/soc-io.c
+++ b/sound/soc/soc-io.c
@@ -41,6 +41,20 @@ int snd_soc_component_read(struct snd_soc_component *component,
41} 41}
42EXPORT_SYMBOL_GPL(snd_soc_component_read); 42EXPORT_SYMBOL_GPL(snd_soc_component_read);
43 43
44unsigned int snd_soc_component_read32(struct snd_soc_component *component,
45 unsigned int reg)
46{
47 unsigned int val;
48 int ret;
49
50 ret = snd_soc_component_read(component, reg, &val);
51 if (ret < 0)
52 return -1;
53
54 return val;
55}
56EXPORT_SYMBOL_GPL(snd_soc_component_read32);
57
44/** 58/**
45 * snd_soc_component_write() - Write register value 59 * snd_soc_component_write() - Write register value
46 * @component: Component to write to 60 * @component: Component to write to