From f70575805708cabdedea7498aaa3f710fde4d920 Mon Sep 17 00:00:00 2001
From: hc <hc@nodka.com>
Date: Wed, 31 Jan 2024 03:29:01 +0000
Subject: [PATCH] add lvds1024*800

---
 kernel/sound/soc/meson/axg-tdm-interface.c |   60 ++++++++++++++++++++++++++++++++++--------------------------
 1 files changed, 34 insertions(+), 26 deletions(-)

diff --git a/kernel/sound/soc/meson/axg-tdm-interface.c b/kernel/sound/soc/meson/axg-tdm-interface.c
index 01cc551..87cac44 100644
--- a/kernel/sound/soc/meson/axg-tdm-interface.c
+++ b/kernel/sound/soc/meson/axg-tdm-interface.c
@@ -42,6 +42,7 @@
 	struct axg_tdm_stream *rx = (struct axg_tdm_stream *)
 		dai->capture_dma_data;
 	unsigned int tx_slots, rx_slots;
+	unsigned int fmt = 0;
 
 	tx_slots = axg_tdm_slots_total(tx_mask);
 	rx_slots = axg_tdm_slots_total(rx_mask);
@@ -52,36 +53,43 @@
 		return -EINVAL;
 	}
 
-	/*
-	 * Amend the dai driver channel number and let dpcm channel merge do
-	 * its job
-	 */
+	iface->slots = slots;
+
+	switch (slot_width) {
+	case 0:
+		slot_width = 32;
+		fallthrough;
+	case 32:
+		fmt |= SNDRV_PCM_FMTBIT_S32_LE;
+		fallthrough;
+	case 24:
+		fmt |= SNDRV_PCM_FMTBIT_S24_LE;
+		fmt |= SNDRV_PCM_FMTBIT_S20_LE;
+		fallthrough;
+	case 16:
+		fmt |= SNDRV_PCM_FMTBIT_S16_LE;
+		fallthrough;
+	case 8:
+		fmt |= SNDRV_PCM_FMTBIT_S8;
+		break;
+	default:
+		dev_err(dai->dev, "unsupported slot width: %d\n", slot_width);
+		return -EINVAL;
+	}
+
+	iface->slot_width = slot_width;
+
+	/* Amend the dai driver and let dpcm merge do its job */
 	if (tx) {
 		tx->mask = tx_mask;
 		dai->driver->playback.channels_max = tx_slots;
+		dai->driver->playback.formats = fmt;
 	}
 
 	if (rx) {
 		rx->mask = rx_mask;
 		dai->driver->capture.channels_max = rx_slots;
-	}
-
-	iface->slots = slots;
-
-	switch (slot_width) {
-	case 0:
-		/* defaults width to 32 if not provided */
-		iface->slot_width = 32;
-		break;
-	case 8:
-	case 16:
-	case 24:
-	case 32:
-		iface->slot_width = slot_width;
-		break;
-	default:
-		dev_err(dai->dev, "unsupported slot width: %d\n", slot_width);
-		return -EINVAL;
+		dai->driver->capture.formats = fmt;
 	}
 
 	return 0;
@@ -125,7 +133,7 @@
 	case SND_SOC_DAIFMT_CBS_CFM:
 	case SND_SOC_DAIFMT_CBM_CFS:
 		dev_err(dai->dev, "only CBS_CFS and CBM_CFM are supported\n");
-		/* Fall-through */
+		fallthrough;
 	default:
 		return -EINVAL;
 	}
@@ -148,7 +156,7 @@
 	}
 
 	/* Apply component wide rate symmetry */
-	if (dai->component->active) {
+	if (snd_soc_component_active(dai->component)) {
 		ret = snd_pcm_hw_constraint_single(substream->runtime,
 						   SNDRV_PCM_HW_PARAM_RATE,
 						   iface->rate);
@@ -305,8 +313,8 @@
 		}
 		break;
 
-	case SND_SOC_DAI_FORMAT_DSP_A:
-	case SND_SOC_DAI_FORMAT_DSP_B:
+	case SND_SOC_DAIFMT_DSP_A:
+	case SND_SOC_DAIFMT_DSP_B:
 		break;
 
 	default:

--
Gitblit v1.6.2