Skip to contentSkip to conversation

ASoC: da7213: fix DAI_CLK_EN register bit overwrite

PATCH Superseded Logesh Kolandavel 2 participants 2 messages Apr 25, 2019 – Apr 26, 2019

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ASoC: da7213: fix DAI_CLK_EN register bit overwrite

From: Logesh <[email protected]>

If the da7213 codec is configured as Master with the DAPM power down delay time set, 'snd_soc_component_write' function overwrites the DAI_CLK_EN bit of DAI_CLK_MODE register which leads to audio play only once until it re-initialize after codec power up.

---
 sound/soc/codecs/da7213.c | 4 +++-
 sound/soc/codecs/da7213.h | 2 ++
 2 files changed, 5 insertions(+), 1 deletion(-)
sound/soc/codecs/da7213.c +3 -1
index 92d006a5283e..306e01684bda 100644
@@ -1305,7 +1305,9 @@ static int da7213_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)
 	/* By default only 64 BCLK per WCLK is supported */
 	dai_clk_mode |= DA7213_DAI_BCLKS_PER_WCLK_64;
 
-	snd_soc_component_write(component, DA7213_DAI_CLK_MODE, dai_clk_mode);
+	snd_soc_component_update_bits(component, DA7213_DAI_CLK_MODE,
+			    DA7213_DAI_CLK_POL_MASK | DA7213_DAI_WCLK_POL_MASK,
+			    dai_clk_mode);
 	snd_soc_component_update_bits(component, DA7213_DAI_CTRL, DA7213_DAI_FORMAT_MASK,
 			    dai_ctrl);
 	snd_soc_component_write(component, DA7213_DAI_OFFSET, dai_offset);
sound/soc/codecs/da7213.h +2 -0
index 5a78dba1dcb5..9d31efc3cfe5 100644
@@ -181,7 +181,9 @@
 #define DA7213_DAI_BCLKS_PER_WCLK_256				(0x3 << 0)
 #define DA7213_DAI_BCLKS_PER_WCLK_MASK				(0x3 << 0)
 #define DA7213_DAI_CLK_POL_INV					(0x1 << 2)
+#define DA7213_DAI_CLK_POL_MASK					(0x1 << 2)
 #define DA7213_DAI_WCLK_POL_INV					(0x1 << 3)
+#define DA7213_DAI_WCLK_POL_MASK				(0x1 << 3)
 #define DA7213_DAI_CLK_EN_MASK					(0x1 << 7)
 
 /* DA7213_DAI_CTRL = 0x29 */
Signature · 1 line
2.21.0
#1 lore raw
Quoted 27 lines · Logesh Kolandavel

From: Logesh <[email protected]>

If the da7213 codec is configured as Master with the DAPM power down delay time set, 'snd_soc_component_write' function overwrites the DAI_CLK_EN bit of DAI_CLK_MODE register which leads to audio play only once until it re-initialize after codec power up.

---
 sound/soc/codecs/da7213.c | 4 +++-
 sound/soc/codecs/da7213.h | 2 ++
 2 files changed, 5 insertions(+), 1 deletion(-)
sound/soc/codecs/da7213.c +2 -1
index 92d006a5283e..306e01684bda 100644
@@ -1305,7 +1305,9 @@ static int da7213_set_dai_fmt(struct snd_soc_dai
 *codec_dai, unsigned int fmt)
 	/* By default only 64 BCLK per WCLK is supported */
 	dai_clk_mode |= DA7213_DAI_BCLKS_PER_WCLK_64;
 
-	snd_soc_component_write(component, DA7213_DAI_CLK_MODE,
 dai_clk_mode);
+	snd_soc_component_update_bits(component,
 DA7213_DAI_CLK_MODE,
+			    DA7213_DAI_CLK_POL_MASK |
Quoted 1 line

DA7213_DAI_WCLK_POL_MASK,

We'll also need to add the mask DA7213_DAI_BCLKS_PER_WCLK_MASK' here as well as we're setting 'DA7213_DAI_BCLKS_PER_WCLK_64' for this register just prior to this call. Didn't spot that in earlier conversations.

Quoted 24 lines
sound/soc/codecs/da7213.c +1 -0
+			    dai_clk_mode);
 	snd_soc_component_update_bits(component, DA7213_DAI_CTRL,

DA7213_DAI_FORMAT_MASK,

sound/soc/codecs/da7213.c +0 -0
 			    dai_ctrl);
 	snd_soc_component_write(component, DA7213_DAI_OFFSET,

dai_offset);

sound/soc/codecs/da7213.h +2 -0
index 5a78dba1dcb5..9d31efc3cfe5 100644
@@ -181,7 +181,9 @@
 #define DA7213_DAI_BCLKS_PER_WCLK_256				(0x3 << 0)
 #define DA7213_DAI_BCLKS_PER_WCLK_MASK
 	(0x3 << 0)
 #define DA7213_DAI_CLK_POL_INV					(0x1 << 2)
+#define DA7213_DAI_CLK_POL_MASK
 	(0x1 << 2)
 #define DA7213_DAI_WCLK_POL_INV					(0x1 << 3)
+#define DA7213_DAI_WCLK_POL_MASK				(0x1 << 3)
 #define DA7213_DAI_CLK_EN_MASK					(0x1 << 7)

/* DA7213_DAI_CTRL = 0x29 */
--
2.21.0