[v2,6/7] ASoC: fsi: add .get_fmt support

Message ID 87sg2saif0.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>

fsi 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
	- don't select clock/frame master possibility,
	  because it is depends on complex board settings.

 sound/soc/sh/fsi.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

Patch

diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c
index 3c574792231b..caa07056e973 100644
--- a/sound/soc/sh/fsi.c
+++ b/sound/soc/sh/fsi.c
@@ -1627,6 +1627,24 @@  static int fsi_set_fmt_spdif(struct fsi_priv *fsi)
 	return 0;
 }
 
+static u64 fsi_dai_get_fmt(struct snd_soc_dai *dai)
+{
+	/*
+	 * It can be clock/frame master,
+	 * (= SND_SOC_POSSIBLE_DAIFMT_CBC_CFC)
+	 * but needs xck/ick/div, and these are depends on cpg.
+	 * Select it manually if you want, not automatically.
+	 */
+
+	return	SND_SOC_POSSIBLE_DAIFMT_I2S	|
+		SND_SOC_POSSIBLE_DAIFMT_LEFT_J	|
+		SND_SOC_POSSIBLE_DAIFMT_CBP_CFP	|
+		SND_SOC_POSSIBLE_DAIFMT_NB_NF	|
+		SND_SOC_POSSIBLE_DAIFMT_NB_IF	|
+		SND_SOC_POSSIBLE_DAIFMT_IB_NF	|
+		SND_SOC_POSSIBLE_DAIFMT_IB_IF;
+}
+
 static int fsi_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
 {
 	struct fsi_priv *fsi = fsi_get_priv_frm_dai(dai);
@@ -1698,6 +1716,7 @@  static const struct snd_soc_dai_ops fsi_dai_ops = {
 	.startup	= fsi_dai_startup,
 	.shutdown	= fsi_dai_shutdown,
 	.trigger	= fsi_dai_trigger,
+	.get_fmt	= fsi_dai_get_fmt,
 	.set_fmt	= fsi_dai_set_fmt,
 	.hw_params	= fsi_dai_hw_params,
 };