diff mbox

[1/2] ASoC: ak4613: add use CTRL2::CKS = 00

Message ID 87poe6m6lz.wl%kuninori.morimoto.gx@renesas.com (mailing list archive)
State New, archived
Headers show

Commit Message

Kuninori Morimoto June 15, 2017, 12:39 a.m. UTC
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ak4613 CTRL2::CKS controls Speed Mode (Normal/Double/Quad) for Master
Mode. In default, Normal Mode uses 512fs, but in such case, requested
input clock for all mode will be same. Then, it might not be eble to
support correct output if input clock was not enough.
This patch uses 256fs, and reduse requested imput clock for Noral Mode.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com>
---
 sound/soc/codecs/ak4613.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Mark Brown June 15, 2017, 10:22 a.m. UTC | #1
On Thu, Jun 15, 2017 at 12:39:40AM +0000, Kuninori Morimoto wrote:

> ak4613 CTRL2::CKS controls Speed Mode (Normal/Double/Quad) for Master
> Mode. In default, Normal Mode uses 512fs, but in such case, requested
> input clock for all mode will be same. Then, it might not be eble to
> support correct output if input clock was not enough.
> This patch uses 256fs, and reduse requested imput clock for Noral Mode.

>  	snd_soc_update_bits(codec, CTRL1, FMT_MASK, fmt_ctrl);
> -	snd_soc_update_bits(codec, CTRL2, DFS_MASK, ctrl2);
> +
> +	/* CKS = 00 */
> +	snd_soc_update_bits(codec, CTRL2, (CKS_MASK | DFS_MASK), ctrl2);

This looks board specific - shouldn't we be setting the speed mode based
on a combination of the sampling rate and the master clock for the
device?
Kuninori Morimoto June 16, 2017, 12:07 a.m. UTC | #2
Hi Mark

> > ak4613 CTRL2::CKS controls Speed Mode (Normal/Double/Quad) for Master
> > Mode. In default, Normal Mode uses 512fs, but in such case, requested
> > input clock for all mode will be same. Then, it might not be eble to
> > support correct output if input clock was not enough.
> > This patch uses 256fs, and reduse requested imput clock for Noral Mode.
> 
> >  	snd_soc_update_bits(codec, CTRL1, FMT_MASK, fmt_ctrl);
> > -	snd_soc_update_bits(codec, CTRL2, DFS_MASK, ctrl2);
> > +
> > +	/* CKS = 00 */
> > +	snd_soc_update_bits(codec, CTRL2, (CKS_MASK | DFS_MASK), ctrl2);
> 
> This looks board specific - shouldn't we be setting the speed mode based
> on a combination of the sampling rate and the master clock for the
> device?  

I removed "FIXME" comments, but OK.
I will fixup this patch-set

Best regards
---
Kuninori Morimoto
diff mbox

Patch

diff --git a/sound/soc/codecs/ak4613.c b/sound/soc/codecs/ak4613.c
index 27c44c7..4584846 100644
--- a/sound/soc/codecs/ak4613.c
+++ b/sound/soc/codecs/ak4613.c
@@ -70,6 +70,7 @@ 
 #define FMT_MASK	(0xf8)
 
 /* CTRL2 */
+#define CKS_MASK		(3 << 4)
 #define DFS_MASK		(3 << 2)
 #define DFS_NORMAL_SPEED	(0 << 2)
 #define DFS_DOUBLE_SPEED	(1 << 2)
@@ -371,7 +372,9 @@  static int ak4613_dai_hw_params(struct snd_pcm_substream *substream,
 	fmt_ctrl = AUDIO_IFACE_TO_VAL(iface);
 
 	snd_soc_update_bits(codec, CTRL1, FMT_MASK, fmt_ctrl);
-	snd_soc_update_bits(codec, CTRL2, DFS_MASK, ctrl2);
+
+	/* CKS = 00 */
+	snd_soc_update_bits(codec, CTRL2, (CKS_MASK | DFS_MASK), ctrl2);
 
 	snd_soc_update_bits(codec, ICTRL, ICTRL_MASK, priv->ic);
 	snd_soc_update_bits(codec, OCTRL, OCTRL_MASK, priv->oc);