From e013a03286b6a744914c50239d3123b7723068df Mon Sep 17 00:00:00 2001 From: Peter Ujfalusi Date: Tue, 21 Sep 2021 07:12:06 +0300 Subject: [PATCH] ASoC: pcm512x: test regmap register accesses read i2c_1 in different stages. Signed-off-by: Peter Ujfalusi --- sound/soc/codecs/pcm512x.c | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/sound/soc/codecs/pcm512x.c b/sound/soc/codecs/pcm512x.c index 4dc844f3c1fc..d0382e9ac329 100644 --- a/sound/soc/codecs/pcm512x.c +++ b/sound/soc/codecs/pcm512x.c @@ -1166,6 +1166,7 @@ static int pcm512x_hw_params(struct snd_pcm_substream *substream, { struct snd_soc_component *component = dai->component; struct pcm512x_priv *pcm512x = snd_soc_component_get_drvdata(component); + unsigned int val; int alen; int gpio; int ret; @@ -1193,6 +1194,18 @@ static int pcm512x_hw_params(struct snd_pcm_substream *substream, return -EINVAL; } + ret = regmap_read(pcm512x->regmap, PCM512x_I2S_1, &val); + if (ret) { + dev_err(component->dev, "%s: failed to read I2S_1: %d\n", __func_, ret); + ret = regmap_read(pcm512x->regmap, PCM512x_PLL_EN, &val); + if (ret) + dev_err(component->dev, "%s: failed to read PLL_EN: %d\n", __func__, ret); + else + dev_err(component->dev, "%s: PLL_EN: %#x\n", __func__, val); + } else { + dev_err(component->dev, "%s: I2S_1: %#x\n", __func__, val); + } + ret = regmap_update_bits(pcm512x->regmap, PCM512x_I2S_1, PCM512x_ALEN, alen); if (ret != 0) { @@ -1335,6 +1348,7 @@ static int pcm512x_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) { struct snd_soc_component *component = dai->component; struct pcm512x_priv *pcm512x = snd_soc_component_get_drvdata(component); + unsigned int val; int afmt; int offset = 0; int clock_output; @@ -1396,18 +1410,28 @@ static int pcm512x_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) return -EINVAL; } + ret = regmap_read(pcm512x->regmap, PCM512x_I2S_1, &val); + if (ret) { + dev_err(component->dev, "%s: failed to read I2S_1: %d\n", __func_, ret); + ret = regmap_read(pcm512x->regmap, PCM512x_PLL_EN, &val); + if (ret) + dev_err(component->dev, "%s: failed to read PLL_EN: %d\n", __func__, ret); + else + dev_err(component->dev, "%s: PLL_EN: %#x\n", __func__, val); + } else { + dev_err(component->dev, "%s: I2S_1: %#x\n", __func__, val); + } + ret = regmap_update_bits(pcm512x->regmap, PCM512x_I2S_1, PCM512x_AFMT, afmt); if (ret != 0) { dev_err(component->dev, "Failed to set data format: %d\n", ret); - return ret; } ret = regmap_update_bits(pcm512x->regmap, PCM512x_I2S_2, 0xFF, offset); if (ret != 0) { dev_err(component->dev, "Failed to set data offset: %d\n", ret); - return ret; } pcm512x->fmt = fmt; -- 2.33.0