summaryrefslogtreecommitdiff
path: root/sound/soc/codecs/tscs454.c
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2020-06-16 08:19:41 +0300
committerMark Brown <broonie@kernel.org>2020-06-22 17:13:36 +0300
commitcf6e26c71bfdff823fd40945b07666d75f1e1412 (patch)
tree442165e2d0a1605c68d5b3522772790e95afaa3c /sound/soc/codecs/tscs454.c
parent3bd057c8219d4006f2b436cea2ae5ac723067a51 (diff)
downloadlinux-cf6e26c71bfdff823fd40945b07666d75f1e1412.tar.xz
ASoC: soc-component: merge snd_soc_component_read() and snd_soc_component_read32()
We had read/write function for Codec, Platform, etc, but these has been merged into snd_soc_component_read/write(). Internally, it is using regmap or driver function. In read case, each styles are like below regmap ret = regmap_read(..., reg, &val); driver function val = xxx->read(..., reg); Because of this kind of different style, to keep same read style, when we merged each read function into snd_soc_component_read(), we created snd_soc_component_read32(), like below. commit 738b49efe6c6 ("ASoC: add snd_soc_component_read32") (1) val = snd_soc_component_read32(component, reg); (2) ret = snd_soc_component_read(component, reg, &val); Many drivers are using snd_soc_component_read32(), and some drivers are using snd_soc_component_read() today. In generally, we don't check read function successes, because, we will have many other issues at initial timing if read function didn't work. Now we can use soc_component_err() when error case. This means, it is easy to notice if error occurred. This patch aggressively merge snd_soc_component_read() and _read32(), and makes snd_soc_component_read/write() as generally style. This patch do 1) merge snd_soc_component_read() and snd_soc_component_read32() 2) it uses soc_component_err() when error case (easy to notice) 3) keeps read32 for now by #define 4) update snd_soc_component_read() for all drivers Because _read() user drivers are not too many, this patch changes all user drivers. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com> Link: https://lore.kernel.org/r/87sgev4mfl.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/codecs/tscs454.c')
-rw-r--r--sound/soc/codecs/tscs454.c24
1 files changed, 4 insertions, 20 deletions
diff --git a/sound/soc/codecs/tscs454.c b/sound/soc/codecs/tscs454.c
index c3587af9985c..d0af16b4db2f 100644
--- a/sound/soc/codecs/tscs454.c
+++ b/sound/soc/codecs/tscs454.c
@@ -353,12 +353,7 @@ static int write_coeff_ram(struct snd_soc_component *component, u8 *coeff_ram,
for (cnt = 0; cnt < coeff_cnt; cnt++, coeff_addr++) {
for (trys = 0; trys < DACCRSTAT_MAX_TRYS; trys++) {
- ret = snd_soc_component_read(component, r_stat, &val);
- if (ret < 0) {
- dev_err(component->dev,
- "Failed to read stat (%d)\n", ret);
- return ret;
- }
+ val = snd_soc_component_read(component, r_stat);
if (!val)
break;
}
@@ -444,12 +439,7 @@ static int coeff_ram_put(struct snd_kcontrol *kcontrol,
mutex_lock(&tscs454->pll1.lock);
mutex_lock(&tscs454->pll2.lock);
- ret = snd_soc_component_read(component, R_PLLSTAT, &val);
- if (ret < 0) {
- dev_err(component->dev, "Failed to read PLL status (%d)\n",
- ret);
- goto exit;
- }
+ val = snd_soc_component_read(component, R_PLLSTAT);
if (val) { /* PLLs locked */
ret = write_coeff_ram(component, coeff_ram,
r_stat, r_addr, r_wr,
@@ -2642,13 +2632,10 @@ static int tscs454_set_sysclk(struct snd_soc_dai *dai,
struct tscs454 *tscs454 = snd_soc_component_get_drvdata(component);
unsigned int val;
int bclk_dai;
- int ret;
dev_dbg(component->dev, "%s(): freq = %u\n", __func__, freq);
- ret = snd_soc_component_read(component, R_PLLCTL, &val);
- if (ret < 0)
- return ret;
+ val = snd_soc_component_read(component, R_PLLCTL);
bclk_dai = (val & FM_PLLCTL_BCLKSEL) >> FB_PLLCTL_BCLKSEL;
if (bclk_dai != dai->id)
@@ -3204,10 +3191,7 @@ static int tscs454_hw_params(struct snd_pcm_substream *substream,
}
if (!aifs_active(&tscs454->aifs_status)) { /* First active aif */
- ret = snd_soc_component_read(component, R_ISRC, &val);
- if (ret < 0)
- goto exit;
-
+ val = snd_soc_component_read(component, R_ISRC);
if ((val & FM_ISRC_IBR) == FV_IBR_48)
tscs454->internal_rate.pll = &tscs454->pll1;
else