[v2,4/7] ASoC: pcm3168a: add .get_fmt support

Message ID 87v97oaifa.wl-kuninori.morimoto.gx@renesas.com
State New
Headers show
Series
  • ASoC: adds new .get_fmt support
Related show

Commit Message

Kuninori Morimoto May 12, 2021, 12:45 a.m.
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

pcm3168a supports .get_fmt by this patch

Link: https://lore.kernel.org/r/871rb3hypy.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
v1 -> v2
	- possible to be clock/frame master is depends on board,
	  and has picky limitation. don't select it here.

 sound/soc/codecs/pcm3168a.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

Patch

diff --git a/sound/soc/codecs/pcm3168a.c b/sound/soc/codecs/pcm3168a.c
index 821e7395f90f..c6c327241e26 100644
--- a/sound/soc/codecs/pcm3168a.c
+++ b/sound/soc/codecs/pcm3168a.c
@@ -353,6 +353,24 @@  static void pcm3168a_update_fixup_pcm_stream(struct snd_soc_dai *dai)
 	}
 }
 
+static u64 pcm3168a_get_dai_fmt(struct snd_soc_dai *dai)
+{
+	/*
+	 * It can be clock/frame provider,
+	 * (= SND_SOC_POSSIBLE_DAIFMT_CBP_CFP)
+	 * but has picky limitation.
+	 * Select it manually if you want, not automatically.
+	 */
+
+	return  SND_SOC_POSSIBLE_DAIFMT_I2S	|
+		SND_SOC_POSSIBLE_DAIFMT_LEFT_J	|
+		SND_SOC_POSSIBLE_DAIFMT_RIGHT_J	|
+		SND_SOC_POSSIBLE_DAIFMT_DSP_A	|
+		SND_SOC_POSSIBLE_DAIFMT_DSP_B	|
+		SND_SOC_POSSIBLE_DAIFMT_CBC_CFC	|
+		SND_SOC_POSSIBLE_DAIFMT_NB_NF;
+}
+
 static int pcm3168a_set_dai_fmt(struct snd_soc_dai *dai, unsigned int format)
 {
 	struct snd_soc_component *component = dai->component;
@@ -574,6 +592,7 @@  static int pcm3168a_hw_params(struct snd_pcm_substream *substream,
 }
 
 static const struct snd_soc_dai_ops pcm3168a_dai_ops = {
+	.get_fmt	= pcm3168a_get_dai_fmt,
 	.set_fmt	= pcm3168a_set_dai_fmt,
 	.set_sysclk	= pcm3168a_set_dai_sysclk,
 	.hw_params	= pcm3168a_hw_params,