diff mbox series

[v2,7/7] ASoC: hdmi-codec: add .get_fmt support

Message ID 87r1icaiew.wl-kuninori.morimoto.gx@renesas.com
State New
Headers show
Series ASoC: adds new .get_fmt support | expand

Commit Message

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

hdmi-codec 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

 sound/soc/codecs/hdmi-codec.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
diff mbox series

Patch

diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c
index 1567ba196ab9..b3dcf28ad6ee 100644
--- a/sound/soc/codecs/hdmi-codec.c
+++ b/sound/soc/codecs/hdmi-codec.c
@@ -493,6 +493,27 @@  static int hdmi_codec_hw_params(struct snd_pcm_substream *substream,
 				       cf, &hp);
 }
 
+static u64 hdmi_codec_i2s_get_fmt(struct snd_soc_dai *dai)
+{
+	/*
+	 * This driver can select all SND_SOC_DAIFMT_CBx_CFx,
+	 * but need to be selected from Sound Card, not be auto selected.
+	 * Because it might be used from other driver.
+	 * For example,
+	 *	${LINUX}/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c
+	 */
+	return	SND_SOC_POSSIBLE_DAIFMT_NB_NF	|
+		SND_SOC_POSSIBLE_DAIFMT_NB_IF	|
+		SND_SOC_POSSIBLE_DAIFMT_IB_NF	|
+		SND_SOC_POSSIBLE_DAIFMT_IB_IF	|
+		SND_SOC_POSSIBLE_DAIFMT_I2S	|
+		SND_SOC_POSSIBLE_DAIFMT_DSP_A	|
+		SND_SOC_POSSIBLE_DAIFMT_DSP_B	|
+		SND_SOC_POSSIBLE_DAIFMT_RIGHT_J	|
+		SND_SOC_POSSIBLE_DAIFMT_LEFT_J	|
+		SND_SOC_POSSIBLE_DAIFMT_AC97;
+}
+
 static int hdmi_codec_i2s_set_fmt(struct snd_soc_dai *dai,
 				  unsigned int fmt)
 {
@@ -584,6 +605,7 @@  static const struct snd_soc_dai_ops hdmi_codec_i2s_dai_ops = {
 	.startup	= hdmi_codec_startup,
 	.shutdown	= hdmi_codec_shutdown,
 	.hw_params	= hdmi_codec_hw_params,
+	.get_fmt	= hdmi_codec_i2s_get_fmt,
 	.set_fmt	= hdmi_codec_i2s_set_fmt,
 	.mute_stream	= hdmi_codec_mute,
 };