blob: 3c5096afa255bff8ec02a40131b6c68cb866d864 [file] [log] [blame]
developer25af4d22023-11-15 17:35:51 +08001From 0dc695c6d7e86562bb185214a271a2d4614d3f96 Mon Sep 17 00:00:00 2001
2From: Maso Huang <maso.huang@mediatek.com>
3Date: Thu, 16 Nov 2023 12:05:02 +0800
4Subject: [PATCH] v6.7 MT7986 ASoC platform driver
5
6---
7 sound/soc/mediatek/Kconfig | 20 +
8 sound/soc/mediatek/Makefile | 1 +
9 sound/soc/mediatek/mt7986/Makefile | 9 +
10 sound/soc/mediatek/mt7986/mt7986-afe-common.h | 49 ++
11 sound/soc/mediatek/mt7986/mt7986-afe-pcm.c | 640 ++++++++++++++++++
12 sound/soc/mediatek/mt7986/mt7986-dai-etdm.c | 428 ++++++++++++
13 sound/soc/mediatek/mt7986/mt7986-reg.h | 196 ++++++
14 sound/soc/mediatek/mt7986/mt7986-wm8960.c | 177 +++++
15 8 files changed, 1520 insertions(+)
16 create mode 100644 sound/soc/mediatek/mt7986/Makefile
17 create mode 100644 sound/soc/mediatek/mt7986/mt7986-afe-common.h
18 create mode 100644 sound/soc/mediatek/mt7986/mt7986-afe-pcm.c
19 create mode 100644 sound/soc/mediatek/mt7986/mt7986-dai-etdm.c
20 create mode 100644 sound/soc/mediatek/mt7986/mt7986-reg.h
21 create mode 100644 sound/soc/mediatek/mt7986/mt7986-wm8960.c
22
23diff --git a/sound/soc/mediatek/Kconfig b/sound/soc/mediatek/Kconfig
24index 111e44b..99d36c4 100644
25--- a/sound/soc/mediatek/Kconfig
26+++ b/sound/soc/mediatek/Kconfig
27@@ -53,6 +53,26 @@ config SND_SOC_MT6797_MT6351
28 Select Y if you have such device.
29 If unsure select "N".
30
31+config SND_SOC_MT7986
32+ tristate "ASoC support for Mediatek MT7986 chip"
33+ depends on ARCH_MEDIATEK
34+ select SND_SOC_MEDIATEK
35+ help
36+ This adds ASoC platform driver support for MediaTek MT7986 chip
37+ that can be used with other codecs.
38+ Select Y if you have such device.
39+ If unsure select "N".
40+
41+config SND_SOC_MT7986_WM8960
42+ tristate "ASoc Audio driver for MT7986 with WM8960 codec"
43+ depends on SND_SOC_MT7986 && I2C
44+ select SND_SOC_WM8960
45+ help
46+ This adds support for ASoC machine driver for MediaTek MT7986
47+ boards with the WM8960 codecs.
48+ Select Y if you have such device.
49+ If unsure select "N".
50+
51 config SND_SOC_MT8173
52 tristate "ASoC support for Mediatek MT8173 chip"
53 depends on ARCH_MEDIATEK
54diff --git a/sound/soc/mediatek/Makefile b/sound/soc/mediatek/Makefile
55index 76032ca..657325a 100644
56--- a/sound/soc/mediatek/Makefile
57+++ b/sound/soc/mediatek/Makefile
58@@ -2,5 +2,6 @@
59 obj-$(CONFIG_SND_SOC_MEDIATEK) += common/
60 obj-$(CONFIG_SND_SOC_MT2701) += mt2701/
61 obj-$(CONFIG_SND_SOC_MT6797) += mt6797/
62+obj-$(CONFIG_SND_SOC_MT7986) += mt7986/
63 obj-$(CONFIG_SND_SOC_MT8173) += mt8173/
64 obj-$(CONFIG_SND_SOC_MT8183) += mt8183/
65diff --git a/sound/soc/mediatek/mt7986/Makefile b/sound/soc/mediatek/mt7986/Makefile
66new file mode 100644
67index 0000000..fc4c825
68--- /dev/null
69+++ b/sound/soc/mediatek/mt7986/Makefile
70@@ -0,0 +1,9 @@
71+# SPDX-License-Identifier: GPL-2.0
72+
73+# platform driver
74+snd-soc-mt7986-afe-objs := \
75+ mt7986-afe-pcm.o \
76+ mt7986-dai-etdm.o
77+
78+obj-$(CONFIG_SND_SOC_MT7986) += snd-soc-mt7986-afe.o
79+obj-$(CONFIG_SND_SOC_MT7986_WM8960) += mt7986-wm8960.o
80diff --git a/sound/soc/mediatek/mt7986/mt7986-afe-common.h b/sound/soc/mediatek/mt7986/mt7986-afe-common.h
81new file mode 100644
82index 0000000..fc3bb31
83--- /dev/null
84+++ b/sound/soc/mediatek/mt7986/mt7986-afe-common.h
85@@ -0,0 +1,49 @@
86+/* SPDX-License-Identifier: GPL-2.0 */
87+/*
88+ * mt7986-afe-common.h -- MediaTek 7986 audio driver definitions
89+ *
90+ * Copyright (c) 2023 MediaTek Inc.
91+ * Authors: Vic Wu <vic.wu@mediatek.com>
92+ * Maso Huang <maso.huang@mediatek.com>
93+ */
94+
95+#ifndef _MT_7986_AFE_COMMON_H_
96+#define _MT_7986_AFE_COMMON_H_
97+
98+#include <sound/soc.h>
99+#include <linux/clk.h>
100+#include <linux/list.h>
101+#include <linux/regmap.h>
102+#include "../common/mtk-base-afe.h"
103+
104+enum {
105+ MT7986_MEMIF_DL1,
106+ MT7986_MEMIF_VUL12,
107+ MT7986_MEMIF_NUM,
108+ MT7986_DAI_ETDM = MT7986_MEMIF_NUM,
109+ MT7986_DAI_NUM,
110+};
111+
112+enum {
113+ MT7986_IRQ_0,
114+ MT7986_IRQ_1,
115+ MT7986_IRQ_2,
116+ MT7986_IRQ_NUM,
117+};
118+
119+struct mt7986_afe_private {
120+ struct clk_bulk_data *clks;
121+ int num_clks;
122+
123+ int pm_runtime_bypass_reg_ctl;
124+
125+ /* dai */
126+ void *dai_priv[MT7986_DAI_NUM];
127+};
128+
129+unsigned int mt7986_afe_rate_transform(struct device *dev,
130+ unsigned int rate);
131+
132+/* dai register */
133+int mt7986_dai_etdm_register(struct mtk_base_afe *afe);
134+#endif
135diff --git a/sound/soc/mediatek/mt7986/mt7986-afe-pcm.c b/sound/soc/mediatek/mt7986/mt7986-afe-pcm.c
136new file mode 100644
137index 0000000..e2f8c51
138--- /dev/null
139+++ b/sound/soc/mediatek/mt7986/mt7986-afe-pcm.c
140@@ -0,0 +1,640 @@
141+// SPDX-License-Identifier: GPL-2.0
142+/*
143+ * MediaTek ALSA SoC AFE platform driver for MT7986
144+ *
145+ * Copyright (c) 2023 MediaTek Inc.
146+ * Authors: Vic Wu <vic.wu@mediatek.com>
147+ * Maso Huang <maso.huang@mediatek.com>
148+ */
149+
150+#include <linux/clk.h>
151+#include <linux/delay.h>
152+#include <linux/module.h>
153+#include <linux/of.h>
154+#include <linux/of_address.h>
155+#include <linux/pm_runtime.h>
156+
157+#include "mt7986-afe-common.h"
158+#include "mt7986-reg.h"
159+#include "../common/mtk-afe-platform-driver.h"
160+#include "../common/mtk-afe-fe-dai.h"
161+
162+enum {
163+ MTK_AFE_RATE_8K = 0,
164+ MTK_AFE_RATE_11K = 1,
165+ MTK_AFE_RATE_12K = 2,
166+ MTK_AFE_RATE_16K = 4,
167+ MTK_AFE_RATE_22K = 5,
168+ MTK_AFE_RATE_24K = 6,
169+ MTK_AFE_RATE_32K = 8,
170+ MTK_AFE_RATE_44K = 9,
171+ MTK_AFE_RATE_48K = 10,
172+ MTK_AFE_RATE_88K = 13,
173+ MTK_AFE_RATE_96K = 14,
174+ MTK_AFE_RATE_176K = 17,
175+ MTK_AFE_RATE_192K = 18,
176+};
177+
178+enum {
179+ CLK_INFRA_AUD_BUS_CK = 0,
180+ CLK_INFRA_AUD_26M_CK,
181+ CLK_INFRA_AUD_L_CK,
182+ CLK_INFRA_AUD_AUD_CK,
183+ CLK_INFRA_AUD_EG2_CK,
184+ CLK_NUM
185+};
186+
187+static const char *aud_clks[CLK_NUM] = {
188+ [CLK_INFRA_AUD_BUS_CK] = "aud_bus_ck",
189+ [CLK_INFRA_AUD_26M_CK] = "aud_26m_ck",
190+ [CLK_INFRA_AUD_L_CK] = "aud_l_ck",
191+ [CLK_INFRA_AUD_AUD_CK] = "aud_aud_ck",
192+ [CLK_INFRA_AUD_EG2_CK] = "aud_eg2_ck",
193+};
194+
195+unsigned int mt7986_afe_rate_transform(struct device *dev, unsigned int rate)
196+{
197+ switch (rate) {
198+ case 8000:
199+ return MTK_AFE_RATE_8K;
200+ case 11025:
201+ return MTK_AFE_RATE_11K;
202+ case 12000:
203+ return MTK_AFE_RATE_12K;
204+ case 16000:
205+ return MTK_AFE_RATE_16K;
206+ case 22050:
207+ return MTK_AFE_RATE_22K;
208+ case 24000:
209+ return MTK_AFE_RATE_24K;
210+ case 32000:
211+ return MTK_AFE_RATE_32K;
212+ case 44100:
213+ return MTK_AFE_RATE_44K;
214+ case 48000:
215+ return MTK_AFE_RATE_48K;
216+ case 88200:
217+ return MTK_AFE_RATE_88K;
218+ case 96000:
219+ return MTK_AFE_RATE_96K;
220+ case 176400:
221+ return MTK_AFE_RATE_176K;
222+ case 192000:
223+ return MTK_AFE_RATE_192K;
224+ default:
225+ dev_warn(dev, "%s(), rate %u invalid, using %d!!!\n",
226+ __func__, rate, MTK_AFE_RATE_48K);
227+ return MTK_AFE_RATE_48K;
228+ }
229+}
230+
231+static const struct snd_pcm_hardware mt7986_afe_hardware = {
232+ .info = SNDRV_PCM_INFO_MMAP |
233+ SNDRV_PCM_INFO_INTERLEAVED |
234+ SNDRV_PCM_INFO_MMAP_VALID,
235+ .formats = SNDRV_PCM_FMTBIT_S16_LE |
236+ SNDRV_PCM_FMTBIT_S24_LE |
237+ SNDRV_PCM_FMTBIT_S32_LE,
238+ .period_bytes_min = 256,
239+ .period_bytes_max = 4 * 48 * 1024,
240+ .periods_min = 2,
241+ .periods_max = 256,
242+ .buffer_bytes_max = 8 * 48 * 1024,
243+ .fifo_size = 0,
244+};
245+
246+static int mt7986_memif_fs(struct snd_pcm_substream *substream,
247+ unsigned int rate)
248+{
249+ struct snd_soc_pcm_runtime *rtd = substream->private_data;
250+ struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME);
251+ struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component);
252+
253+ return mt7986_afe_rate_transform(afe->dev, rate);
254+}
255+
256+static int mt7986_irq_fs(struct snd_pcm_substream *substream,
257+ unsigned int rate)
258+{
259+ struct snd_soc_pcm_runtime *rtd = substream->private_data;
260+ struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME);
261+ struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component);
262+
263+ return mt7986_afe_rate_transform(afe->dev, rate);
264+}
265+
266+#define MTK_PCM_RATES (SNDRV_PCM_RATE_8000_48000 |\
267+ SNDRV_PCM_RATE_88200 |\
268+ SNDRV_PCM_RATE_96000 |\
269+ SNDRV_PCM_RATE_176400 |\
270+ SNDRV_PCM_RATE_192000)
271+
272+#define MTK_PCM_FORMATS (SNDRV_PCM_FMTBIT_S16_LE |\
273+ SNDRV_PCM_FMTBIT_S24_LE |\
274+ SNDRV_PCM_FMTBIT_S32_LE)
275+
276+static struct snd_soc_dai_driver mt7986_memif_dai_driver[] = {
277+ /* FE DAIs: memory intefaces to CPU */
278+ {
279+ .name = "DL1",
280+ .id = MT7986_MEMIF_DL1,
281+ .playback = {
282+ .stream_name = "DL1",
283+ .channels_min = 1,
284+ .channels_max = 2,
285+ .rates = MTK_PCM_RATES,
286+ .formats = MTK_PCM_FORMATS,
287+ },
288+ .ops = &mtk_afe_fe_ops,
289+ },
290+ {
291+ .name = "UL1",
292+ .id = MT7986_MEMIF_VUL12,
293+ .capture = {
294+ .stream_name = "UL1",
295+ .channels_min = 1,
296+ .channels_max = 2,
297+ .rates = MTK_PCM_RATES,
298+ .formats = MTK_PCM_FORMATS,
299+ },
300+ .ops = &mtk_afe_fe_ops,
301+ },
302+};
303+
304+static const struct snd_kcontrol_new o018_mix[] = {
305+ SOC_DAPM_SINGLE_AUTODISABLE("I150_Switch", AFE_CONN018_4, 22, 1, 0),
306+};
307+
308+static const struct snd_kcontrol_new o019_mix[] = {
309+ SOC_DAPM_SINGLE_AUTODISABLE("I151_Switch", AFE_CONN019_4, 23, 1, 0),
310+};
311+
312+static const struct snd_soc_dapm_widget mt7986_memif_widgets[] = {
313+ /* DL */
314+ SND_SOC_DAPM_MIXER("I032", SND_SOC_NOPM, 0, 0, NULL, 0),
315+ SND_SOC_DAPM_MIXER("I033", SND_SOC_NOPM, 0, 0, NULL, 0),
316+
317+ /* UL */
318+ SND_SOC_DAPM_MIXER("O018", SND_SOC_NOPM, 0, 0,
319+ o018_mix, ARRAY_SIZE(o018_mix)),
320+ SND_SOC_DAPM_MIXER("O019", SND_SOC_NOPM, 0, 0,
321+ o019_mix, ARRAY_SIZE(o019_mix)),
322+};
323+
324+static const struct snd_soc_dapm_route mt7986_memif_routes[] = {
325+ {"I032", NULL, "DL1"},
326+ {"I033", NULL, "DL1"},
327+ {"UL1", NULL, "O018"},
328+ {"UL1", NULL, "O019"},
329+ {"O018", "I150_Switch", "I150"},
330+ {"O019", "I151_Switch", "I151"},
331+};
332+
333+static const struct snd_soc_component_driver mt7986_afe_pcm_dai_component = {
334+ .name = "mt7986-afe-pcm-dai",
335+};
336+
337+static const struct mtk_base_memif_data memif_data[MT7986_MEMIF_NUM] = {
338+ [MT7986_MEMIF_DL1] = {
339+ .name = "DL1",
340+ .id = MT7986_MEMIF_DL1,
341+ .reg_ofs_base = AFE_DL0_BASE,
342+ .reg_ofs_cur = AFE_DL0_CUR,
343+ .reg_ofs_end = AFE_DL0_END,
344+ .reg_ofs_base_msb = AFE_DL0_BASE_MSB,
345+ .reg_ofs_cur_msb = AFE_DL0_CUR_MSB,
346+ .reg_ofs_end_msb = AFE_DL0_END_MSB,
347+ .fs_reg = AFE_DL0_CON0,
348+ .fs_shift = DL0_MODE_SFT,
349+ .fs_maskbit = DL0_MODE_MASK,
350+ .mono_reg = AFE_DL0_CON0,
351+ .mono_shift = DL0_MONO_SFT,
352+ .enable_reg = AFE_DL0_CON0,
353+ .enable_shift = DL0_ON_SFT,
354+ .hd_reg = AFE_DL0_CON0,
355+ .hd_shift = DL0_HD_MODE_SFT,
356+ .hd_align_reg = AFE_DL0_CON0,
357+ .hd_align_mshift = DL0_HALIGN_SFT,
358+ .pbuf_reg = AFE_DL0_CON0,
359+ .pbuf_shift = DL0_PBUF_SIZE_SFT,
360+ .minlen_reg = AFE_DL0_CON0,
361+ .minlen_shift = DL0_MINLEN_SFT,
362+ },
363+ [MT7986_MEMIF_VUL12] = {
364+ .name = "VUL12",
365+ .id = MT7986_MEMIF_VUL12,
366+ .reg_ofs_base = AFE_VUL0_BASE,
367+ .reg_ofs_cur = AFE_VUL0_CUR,
368+ .reg_ofs_end = AFE_VUL0_END,
369+ .reg_ofs_base_msb = AFE_VUL0_BASE_MSB,
370+ .reg_ofs_cur_msb = AFE_VUL0_CUR_MSB,
371+ .reg_ofs_end_msb = AFE_VUL0_END_MSB,
372+ .fs_reg = AFE_VUL0_CON0,
373+ .fs_shift = VUL0_MODE_SFT,
374+ .fs_maskbit = VUL0_MODE_MASK,
375+ .mono_reg = AFE_VUL0_CON0,
376+ .mono_shift = VUL0_MONO_SFT,
377+ .enable_reg = AFE_VUL0_CON0,
378+ .enable_shift = VUL0_ON_SFT,
379+ .hd_reg = AFE_VUL0_CON0,
380+ .hd_shift = VUL0_HD_MODE_SFT,
381+ .hd_align_reg = AFE_VUL0_CON0,
382+ .hd_align_mshift = VUL0_HALIGN_SFT,
383+ },
384+};
385+
386+static const struct mtk_base_irq_data irq_data[MT7986_IRQ_NUM] = {
387+ [MT7986_IRQ_0] = {
388+ .id = MT7986_IRQ_0,
389+ .irq_cnt_reg = AFE_IRQ0_MCU_CFG1,
390+ .irq_cnt_shift = AFE_IRQ_CNT_SHIFT,
391+ .irq_cnt_maskbit = AFE_IRQ_CNT_MASK,
392+ .irq_fs_reg = AFE_IRQ0_MCU_CFG0,
393+ .irq_fs_shift = IRQ_MCU_MODE_SFT,
394+ .irq_fs_maskbit = IRQ_MCU_MODE_MASK,
395+ .irq_en_reg = AFE_IRQ0_MCU_CFG0,
396+ .irq_en_shift = IRQ_MCU_ON_SFT,
397+ .irq_clr_reg = AFE_IRQ_MCU_CLR,
398+ .irq_clr_shift = IRQ0_MCU_CLR_SFT,
399+ },
400+ [MT7986_IRQ_1] = {
401+ .id = MT7986_IRQ_1,
402+ .irq_cnt_reg = AFE_IRQ1_MCU_CFG1,
403+ .irq_cnt_shift = AFE_IRQ_CNT_SHIFT,
404+ .irq_cnt_maskbit = AFE_IRQ_CNT_MASK,
405+ .irq_fs_reg = AFE_IRQ1_MCU_CFG0,
406+ .irq_fs_shift = IRQ_MCU_MODE_SFT,
407+ .irq_fs_maskbit = IRQ_MCU_MODE_MASK,
408+ .irq_en_reg = AFE_IRQ1_MCU_CFG0,
409+ .irq_en_shift = IRQ_MCU_ON_SFT,
410+ .irq_clr_reg = AFE_IRQ_MCU_CLR,
411+ .irq_clr_shift = IRQ1_MCU_CLR_SFT,
412+ },
413+ [MT7986_IRQ_2] = {
414+ .id = MT7986_IRQ_2,
415+ .irq_cnt_reg = AFE_IRQ2_MCU_CFG1,
416+ .irq_cnt_shift = AFE_IRQ_CNT_SHIFT,
417+ .irq_cnt_maskbit = AFE_IRQ_CNT_MASK,
418+ .irq_fs_reg = AFE_IRQ2_MCU_CFG0,
419+ .irq_fs_shift = IRQ_MCU_MODE_SFT,
420+ .irq_fs_maskbit = IRQ_MCU_MODE_MASK,
421+ .irq_en_reg = AFE_IRQ2_MCU_CFG0,
422+ .irq_en_shift = IRQ_MCU_ON_SFT,
423+ .irq_clr_reg = AFE_IRQ_MCU_CLR,
424+ .irq_clr_shift = IRQ2_MCU_CLR_SFT,
425+ },
426+};
427+
428+static bool mt7986_is_volatile_reg(struct device *dev, unsigned int reg)
429+{
430+ /*
431+ * Those auto-gen regs are read-only, so put it as volatile because
432+ * volatile registers cannot be cached, which means that they cannot
433+ * be set when power is off
434+ */
435+
436+ switch (reg) {
437+ case AFE_DL0_CUR_MSB:
438+ case AFE_DL0_CUR:
439+ case AFE_DL0_RCH_MON:
440+ case AFE_DL0_LCH_MON:
441+ case AFE_VUL0_CUR_MSB:
442+ case AFE_VUL0_CUR:
443+ case AFE_IRQ_MCU_STATUS:
444+ case AFE_MEMIF_RD_MON:
445+ case AFE_MEMIF_WR_MON:
446+ return true;
447+ default:
448+ return false;
449+ };
450+}
451+
452+static const struct regmap_config mt7986_afe_regmap_config = {
453+ .reg_bits = 32,
454+ .reg_stride = 4,
455+ .val_bits = 32,
456+ .volatile_reg = mt7986_is_volatile_reg,
457+ .max_register = AFE_MAX_REGISTER,
458+ .num_reg_defaults_raw = ((AFE_MAX_REGISTER / 4) + 1),
459+};
460+
461+static int mt7986_init_clock(struct mtk_base_afe *afe)
462+{
463+ struct mt7986_afe_private *afe_priv = afe->platform_priv;
464+ int ret, i;
465+
466+ afe_priv->clks = devm_kcalloc(afe->dev, CLK_NUM,
467+ sizeof(*afe_priv->clks), GFP_KERNEL);
468+ if (!afe_priv->clks)
469+ return -ENOMEM;
470+ afe_priv->num_clks = CLK_NUM;
471+
472+ for (i = 0; i < afe_priv->num_clks; i++)
473+ afe_priv->clks[i].id = aud_clks[i];
474+
475+ ret = devm_clk_bulk_get(afe->dev, afe_priv->num_clks, afe_priv->clks);
476+ if (ret) {
477+ dev_err(afe->dev, "Failed to get clocks\n");
478+ return ret;
479+ }
480+
481+ return 0;
482+}
483+
484+static irqreturn_t mt7986_afe_irq_handler(int irq_id, void *dev)
485+{
486+ struct mtk_base_afe *afe = dev;
487+ struct mtk_base_afe_irq *irq;
488+ u32 mcu_en, status, status_mcu;
489+ int i, ret;
490+ irqreturn_t irq_ret = IRQ_HANDLED;
491+
492+ /* get irq that is sent to MCU */
493+ regmap_read(afe->regmap, AFE_IRQ_MCU_EN, &mcu_en);
494+
495+ ret = regmap_read(afe->regmap, AFE_IRQ_MCU_STATUS, &status);
496+ /* only care IRQ which is sent to MCU */
497+ status_mcu = status & mcu_en & AFE_IRQ_STATUS_BITS;
498+
499+ if (ret || status_mcu == 0) {
500+ dev_err(afe->dev, "%s(), irq status err, ret %d, status 0x%x, mcu_en 0x%x\n",
501+ __func__, ret, status, mcu_en);
502+
503+ irq_ret = IRQ_NONE;
504+ goto err_irq;
505+ }
506+
507+ for (i = 0; i < MT7986_MEMIF_NUM; i++) {
508+ struct mtk_base_afe_memif *memif = &afe->memif[i];
509+
510+ if (!memif->substream)
511+ continue;
512+
513+ if (memif->irq_usage < 0)
514+ continue;
515+
516+ irq = &afe->irqs[memif->irq_usage];
517+
518+ if (status_mcu & (1 << irq->irq_data->irq_en_shift))
519+ snd_pcm_period_elapsed(memif->substream);
520+ }
521+
522+err_irq:
523+ /* clear irq */
524+ regmap_write(afe->regmap, AFE_IRQ_MCU_CLR, status_mcu);
525+
526+ return irq_ret;
527+}
528+
529+static int mt7986_afe_runtime_suspend(struct device *dev)
530+{
531+ struct mtk_base_afe *afe = dev_get_drvdata(dev);
532+ struct mt7986_afe_private *afe_priv = afe->platform_priv;
533+
534+ if (!afe->regmap || afe_priv->pm_runtime_bypass_reg_ctl)
535+ goto skip_regmap;
536+
537+ /* disable clk*/
538+ regmap_update_bits(afe->regmap, AUDIO_TOP_CON4, 0x3fff, 0x3fff);
539+ regmap_update_bits(afe->regmap, AUDIO_ENGEN_CON0, AUD_APLL2_EN_MASK, 0);
540+ regmap_update_bits(afe->regmap, AUDIO_ENGEN_CON0, AUD_26M_EN_MASK, 0);
541+
542+ /* make sure all irq status are cleared, twice intended */
543+ regmap_update_bits(afe->regmap, AFE_IRQ_MCU_CLR, 0xffff, 0xffff);
544+
545+skip_regmap:
546+ clk_bulk_disable_unprepare(afe_priv->num_clks, afe_priv->clks);
547+
548+ return 0;
549+}
550+
551+static int mt7986_afe_runtime_resume(struct device *dev)
552+{
553+ struct mtk_base_afe *afe = dev_get_drvdata(dev);
554+ struct mt7986_afe_private *afe_priv = afe->platform_priv;
555+ int ret;
556+
557+ ret = clk_bulk_prepare_enable(afe_priv->num_clks, afe_priv->clks);
558+ if (ret) {
559+ dev_err(afe->dev, "Failed to enable clocks\n");
560+ return ret;
561+ }
562+
563+ if (!afe->regmap || afe_priv->pm_runtime_bypass_reg_ctl)
564+ return 0;
565+
566+ /* enable clk*/
567+ regmap_update_bits(afe->regmap, AUDIO_TOP_CON4, 0x3fff, 0);
568+ regmap_update_bits(afe->regmap, AUDIO_ENGEN_CON0, AUD_APLL2_EN_MASK,
569+ AUD_APLL2_EN);
570+ regmap_update_bits(afe->regmap, AUDIO_ENGEN_CON0, AUD_26M_EN_MASK,
571+ AUD_26M_EN);
572+
573+ return 0;
574+}
575+
576+static int mt7986_afe_component_probe(struct snd_soc_component *component)
577+{
578+ return mtk_afe_add_sub_dai_control(component);
579+}
580+
581+static const struct snd_soc_component_driver mt7986_afe_component = {
582+ .name = AFE_PCM_NAME,
583+ .ops = &mtk_afe_pcm_ops,
584+ .pcm_new = mtk_afe_pcm_new,
585+ .pcm_free = mtk_afe_pcm_free,
586+ .probe = mt7986_afe_component_probe,
587+};
588+
589+static int mt7986_dai_memif_register(struct mtk_base_afe *afe)
590+{
591+ struct mtk_base_afe_dai *dai;
592+
593+ dai = devm_kzalloc(afe->dev, sizeof(*dai), GFP_KERNEL);
594+ if (!dai)
595+ return -ENOMEM;
596+
597+ list_add(&dai->list, &afe->sub_dais);
598+
599+ dai->dai_drivers = mt7986_memif_dai_driver;
600+ dai->num_dai_drivers = ARRAY_SIZE(mt7986_memif_dai_driver);
601+
602+ dai->dapm_widgets = mt7986_memif_widgets;
603+ dai->num_dapm_widgets = ARRAY_SIZE(mt7986_memif_widgets);
604+ dai->dapm_routes = mt7986_memif_routes;
605+ dai->num_dapm_routes = ARRAY_SIZE(mt7986_memif_routes);
606+
607+ return 0;
608+}
609+
610+typedef int (*dai_register_cb)(struct mtk_base_afe *);
611+static const dai_register_cb dai_register_cbs[] = {
612+ mt7986_dai_etdm_register,
613+ mt7986_dai_memif_register,
614+};
615+
616+static int mt7986_afe_pcm_dev_probe(struct platform_device *pdev)
617+{
618+ struct mtk_base_afe *afe;
619+ struct mt7986_afe_private *afe_priv;
620+ struct device *dev;
621+ int i, irq_id, ret;
622+
623+ afe = devm_kzalloc(&pdev->dev, sizeof(*afe), GFP_KERNEL);
624+ if (!afe)
625+ return -ENOMEM;
626+ platform_set_drvdata(pdev, afe);
627+
628+ afe->platform_priv = devm_kzalloc(&pdev->dev, sizeof(*afe_priv),
629+ GFP_KERNEL);
630+ if (!afe->platform_priv)
631+ return -ENOMEM;
632+
633+ afe_priv = afe->platform_priv;
634+ afe->dev = &pdev->dev;
635+ dev = afe->dev;
636+
637+ afe->base_addr = devm_platform_ioremap_resource(pdev, 0);
638+ if (IS_ERR(afe->base_addr))
639+ return PTR_ERR(afe->base_addr);
640+
641+ /* initial audio related clock */
642+ ret = mt7986_init_clock(afe);
643+ if (ret) {
644+ dev_err(dev, "Cannot initialize clocks\n");
645+ return ret;
646+ }
647+
648+ pm_runtime_enable(dev);
649+
650+ /* enable clock for regcache get default value from hw */
651+ afe_priv->pm_runtime_bypass_reg_ctl = true;
652+ pm_runtime_get_sync(&pdev->dev);
653+
654+ afe->regmap = devm_regmap_init_mmio(&pdev->dev, afe->base_addr,
655+ &mt7986_afe_regmap_config);
656+
657+ pm_runtime_put_sync(&pdev->dev);
658+ if (IS_ERR(afe->regmap))
659+ return PTR_ERR(afe->regmap);
660+
661+ afe_priv->pm_runtime_bypass_reg_ctl = false;
662+
663+ /* init memif */
664+ afe->memif_size = MT7986_MEMIF_NUM;
665+ afe->memif = devm_kcalloc(dev, afe->memif_size, sizeof(*afe->memif),
666+ GFP_KERNEL);
667+ if (!afe->memif)
668+ return -ENOMEM;
669+
670+ for (i = 0; i < afe->memif_size; i++) {
671+ afe->memif[i].data = &memif_data[i];
672+ afe->memif[i].irq_usage = -1;
673+ }
674+
675+ mutex_init(&afe->irq_alloc_lock);
676+
677+ /* irq initialize */
678+ afe->irqs_size = MT7986_IRQ_NUM;
679+ afe->irqs = devm_kcalloc(dev, afe->irqs_size, sizeof(*afe->irqs),
680+ GFP_KERNEL);
681+ if (!afe->irqs)
682+ return -ENOMEM;
683+
684+ for (i = 0; i < afe->irqs_size; i++)
685+ afe->irqs[i].irq_data = &irq_data[i];
686+
687+ /* request irq */
688+ irq_id = platform_get_irq(pdev, 0);
689+ if (irq_id < 0) {
690+ ret = irq_id;
691+ dev_err(dev, "No irq found\n");
692+ return ret;
693+ }
694+ ret = devm_request_irq(dev, irq_id, mt7986_afe_irq_handler,
695+ IRQF_TRIGGER_NONE, "asys-isr", (void *)afe);
696+ if (ret) {
697+ dev_err(dev, "Failed to request irq for asys-isr\n");
698+ return ret;
699+ }
700+
701+ /* init sub_dais */
702+ INIT_LIST_HEAD(&afe->sub_dais);
703+
704+ for (i = 0; i < ARRAY_SIZE(dai_register_cbs); i++) {
705+ ret = dai_register_cbs[i](afe);
706+ if (ret) {
707+ dev_err(dev, "DAI register failed, i: %d\n", i);
708+ return ret;
709+ }
710+ }
711+
712+ /* init dai_driver and component_driver */
713+ ret = mtk_afe_combine_sub_dai(afe);
714+ if (ret) {
715+ dev_err(dev, "mtk_afe_combine_sub_dai fail\n");
716+ return ret;
717+ }
718+
719+ afe->mtk_afe_hardware = &mt7986_afe_hardware;
720+ afe->memif_fs = mt7986_memif_fs;
721+ afe->irq_fs = mt7986_irq_fs;
722+
723+ afe->runtime_resume = mt7986_afe_runtime_resume;
724+ afe->runtime_suspend = mt7986_afe_runtime_suspend;
725+
726+ /* register component */
727+ ret = devm_snd_soc_register_component(&pdev->dev,
728+ &mt7986_afe_component,
729+ NULL, 0);
730+ if (ret) {
731+ dev_err(dev, "Cannot register AFE component\n");
732+ return ret;
733+ }
734+
735+ ret = devm_snd_soc_register_component(afe->dev,
736+ &mt7986_afe_pcm_dai_component,
737+ afe->dai_drivers,
738+ afe->num_dai_drivers);
739+ if (ret) {
740+ dev_err(dev, "Cannot register PCM DAI component\n");
741+ return ret;
742+ }
743+
744+ return 0;
745+}
746+
747+static int mt7986_afe_pcm_dev_remove(struct platform_device *pdev)
748+{
749+ pm_runtime_disable(&pdev->dev);
750+ if (!pm_runtime_status_suspended(&pdev->dev))
751+ mt7986_afe_runtime_suspend(&pdev->dev);
752+
753+ return 0;
754+}
755+
756+static const struct of_device_id mt7986_afe_pcm_dt_match[] = {
757+ { .compatible = "mediatek,mt7986-afe" },
758+ { /* sentinel */ }
759+};
760+MODULE_DEVICE_TABLE(of, mt7986_afe_pcm_dt_match);
761+
762+static const struct dev_pm_ops mt7986_afe_pm_ops = {
763+ SET_RUNTIME_PM_OPS(mt7986_afe_runtime_suspend,
764+ mt7986_afe_runtime_resume, NULL)
765+};
766+
767+static struct platform_driver mt7986_afe_pcm_driver = {
768+ .driver = {
769+ .name = "mt7986-audio",
770+ .of_match_table = mt7986_afe_pcm_dt_match,
771+ .pm = &mt7986_afe_pm_ops,
772+ },
773+ .probe = mt7986_afe_pcm_dev_probe,
774+ .remove = mt7986_afe_pcm_dev_remove,
775+};
776+module_platform_driver(mt7986_afe_pcm_driver);
777+
778+MODULE_DESCRIPTION("MediaTek SoC AFE platform driver for ALSA MT7986");
779+MODULE_AUTHOR("Vic Wu <vic.wu@mediatek.com>");
780+MODULE_LICENSE("GPL");
781diff --git a/sound/soc/mediatek/mt7986/mt7986-dai-etdm.c b/sound/soc/mediatek/mt7986/mt7986-dai-etdm.c
782new file mode 100644
783index 0000000..192f55a
784--- /dev/null
785+++ b/sound/soc/mediatek/mt7986/mt7986-dai-etdm.c
786@@ -0,0 +1,428 @@
787+// SPDX-License-Identifier: GPL-2.0
788+/*
789+ * MediaTek ALSA SoC Audio DAI eTDM Control
790+ *
791+ * Copyright (c) 2023 MediaTek Inc.
792+ * Authors: Vic Wu <vic.wu@mediatek.com>
793+ * Maso Huang <maso.huang@mediatek.com>
794+ */
795+
796+#include <linux/bitfield.h>
797+#include <linux/bitops.h>
798+#include <linux/regmap.h>
799+#include <sound/pcm_params.h>
800+#include "mt7986-afe-common.h"
801+#include "mt7986-reg.h"
802+
803+#define HOPPING_CLK 0
804+#define APLL_CLK 1
805+#define MTK_DAI_ETDM_FORMAT_I2S 0
806+#define MTK_DAI_ETDM_FORMAT_DSPA 4
807+#define MTK_DAI_ETDM_FORMAT_DSPB 5
808+
809+enum {
810+ MTK_ETDM_RATE_8K = 0,
811+ MTK_ETDM_RATE_12K = 1,
812+ MTK_ETDM_RATE_16K = 2,
813+ MTK_ETDM_RATE_24K = 3,
814+ MTK_ETDM_RATE_32K = 4,
815+ MTK_ETDM_RATE_48K = 5,
816+ MTK_ETDM_RATE_96K = 7,
817+ MTK_ETDM_RATE_192K = 9,
818+ MTK_ETDM_RATE_11K = 16,
819+ MTK_ETDM_RATE_22K = 17,
820+ MTK_ETDM_RATE_44K = 18,
821+ MTK_ETDM_RATE_88K = 19,
822+ MTK_ETDM_RATE_176K = 20,
823+};
824+
825+struct mtk_dai_etdm_priv {
826+ bool bck_inv;
827+ bool lrck_inv;
828+ bool slave_mode;
829+ unsigned int format;
830+};
831+
832+static unsigned int mt7986_etdm_rate_transform(struct device *dev, unsigned int rate)
833+{
834+ switch (rate) {
835+ case 8000:
836+ return MTK_ETDM_RATE_8K;
837+ case 11025:
838+ return MTK_ETDM_RATE_11K;
839+ case 12000:
840+ return MTK_ETDM_RATE_12K;
841+ case 16000:
842+ return MTK_ETDM_RATE_16K;
843+ case 22050:
844+ return MTK_ETDM_RATE_22K;
845+ case 24000:
846+ return MTK_ETDM_RATE_24K;
847+ case 32000:
848+ return MTK_ETDM_RATE_32K;
849+ case 44100:
850+ return MTK_ETDM_RATE_44K;
851+ case 48000:
852+ return MTK_ETDM_RATE_48K;
853+ case 88200:
854+ return MTK_ETDM_RATE_88K;
855+ case 96000:
856+ return MTK_ETDM_RATE_96K;
857+ case 176400:
858+ return MTK_ETDM_RATE_176K;
859+ case 192000:
860+ return MTK_ETDM_RATE_192K;
861+ default:
862+ dev_warn(dev, "%s(), rate %u invalid, using %d!!!\n",
863+ __func__, rate, MTK_ETDM_RATE_48K);
864+ return MTK_ETDM_RATE_48K;
865+ }
866+}
867+
868+static int get_etdm_wlen(unsigned int bitwidth)
869+{
870+ return bitwidth <= 16 ? 16 : 32;
871+}
872+
873+/* dai component */
874+/* interconnection */
875+
876+static const struct snd_kcontrol_new o124_mix[] = {
877+ SOC_DAPM_SINGLE_AUTODISABLE("I032_Switch", AFE_CONN124_1, 0, 1, 0),
878+};
879+
880+static const struct snd_kcontrol_new o125_mix[] = {
881+ SOC_DAPM_SINGLE_AUTODISABLE("I033_Switch", AFE_CONN125_1, 1, 1, 0),
882+};
883+
884+static const struct snd_soc_dapm_widget mtk_dai_etdm_widgets[] = {
885+
886+ /* DL */
887+ SND_SOC_DAPM_MIXER("I150", SND_SOC_NOPM, 0, 0, NULL, 0),
888+ SND_SOC_DAPM_MIXER("I151", SND_SOC_NOPM, 0, 0, NULL, 0),
889+ /* UL */
890+ SND_SOC_DAPM_MIXER("O124", SND_SOC_NOPM, 0, 0, o124_mix, ARRAY_SIZE(o124_mix)),
891+ SND_SOC_DAPM_MIXER("O125", SND_SOC_NOPM, 0, 0, o125_mix, ARRAY_SIZE(o125_mix)),
892+};
893+
894+static const struct snd_soc_dapm_route mtk_dai_etdm_routes[] = {
895+ {"I150", NULL, "ETDM Capture"},
896+ {"I151", NULL, "ETDM Capture"},
897+ {"ETDM Playback", NULL, "O124"},
898+ {"ETDM Playback", NULL, "O125"},
899+ {"O124", "I032_Switch", "I032"},
900+ {"O125", "I033_Switch", "I033"},
901+};
902+
903+/* dai ops */
904+static int mtk_dai_etdm_startup(struct snd_pcm_substream *substream,
905+ struct snd_soc_dai *dai)
906+{
907+ struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai);
908+ struct mt7986_afe_private *afe_priv = afe->platform_priv;
909+ int ret;
910+
911+ ret = clk_bulk_prepare_enable(afe_priv->num_clks, afe_priv->clks);
912+ if (ret) {
913+ dev_err(afe->dev, "Failed to enable clocks\n");
914+ return ret;
915+ }
916+
917+ regmap_update_bits(afe->regmap, AUDIO_TOP_CON2, CLK_OUT5_PDN_MASK, 0);
918+ regmap_update_bits(afe->regmap, AUDIO_TOP_CON2, CLK_IN5_PDN_MASK, 0);
919+
920+ return 0;
921+}
922+
923+static void mtk_dai_etdm_shutdown(struct snd_pcm_substream *substream,
924+ struct snd_soc_dai *dai)
925+{
926+ struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai);
927+ struct mt7986_afe_private *afe_priv = afe->platform_priv;
928+
929+ regmap_update_bits(afe->regmap, AUDIO_TOP_CON2, CLK_OUT5_PDN_MASK,
930+ CLK_OUT5_PDN);
931+ regmap_update_bits(afe->regmap, AUDIO_TOP_CON2, CLK_IN5_PDN_MASK,
932+ CLK_IN5_PDN);
933+
934+ clk_bulk_disable_unprepare(afe_priv->num_clks, afe_priv->clks);
935+}
936+
937+static unsigned int get_etdm_ch_fixup(unsigned int channels)
938+{
939+ if (channels > 16)
940+ return 24;
941+ else if (channels > 8)
942+ return 16;
943+ else if (channels > 4)
944+ return 8;
945+ else if (channels > 2)
946+ return 4;
947+ else
948+ return 2;
949+}
950+
951+static int mtk_dai_etdm_config(struct mtk_base_afe *afe,
952+ struct snd_pcm_hw_params *params,
953+ struct snd_soc_dai *dai,
954+ int stream)
955+{
956+ struct mt7986_afe_private *afe_priv = afe->platform_priv;
957+ struct mtk_dai_etdm_priv *etdm_data = afe_priv->dai_priv[dai->id];
958+ unsigned int rate = params_rate(params);
959+ unsigned int etdm_rate = mt7986_etdm_rate_transform(afe->dev, rate);
960+ unsigned int afe_rate = mt7986_afe_rate_transform(afe->dev, rate);
961+ unsigned int channels = params_channels(params);
962+ unsigned int bit_width = params_width(params);
963+ unsigned int wlen = get_etdm_wlen(bit_width);
964+ unsigned int val = 0;
965+ unsigned int mask = 0;
966+
967+ dev_dbg(afe->dev, "%s(), stream %d, rate %u, bitwidth %u\n",
968+ __func__, stream, rate, bit_width);
969+
970+ /* CON0 */
971+ mask |= ETDM_BIT_LEN_MASK;
972+ val |= FIELD_PREP(ETDM_BIT_LEN_MASK, bit_width - 1);
973+ mask |= ETDM_WRD_LEN_MASK;
974+ val |= FIELD_PREP(ETDM_WRD_LEN_MASK, wlen - 1);
975+ mask |= ETDM_FMT_MASK;
976+ val |= FIELD_PREP(ETDM_FMT_MASK, etdm_data->format);
977+ mask |= ETDM_CH_NUM_MASK;
978+ val |= FIELD_PREP(ETDM_CH_NUM_MASK, get_etdm_ch_fixup(channels) - 1);
979+ mask |= RELATCH_SRC_MASK;
980+ val |= FIELD_PREP(RELATCH_SRC_MASK, APLL_CLK);
981+
982+ switch (stream) {
983+ case SNDRV_PCM_STREAM_PLAYBACK:
984+ /* set ETDM_OUT5_CON0 */
985+ regmap_update_bits(afe->regmap, ETDM_OUT5_CON0, mask, val);
986+
987+ /* set ETDM_OUT5_CON4 */
988+ regmap_update_bits(afe->regmap, ETDM_OUT5_CON4,
989+ OUT_RELATCH_MASK, OUT_RELATCH(afe_rate));
990+ regmap_update_bits(afe->regmap, ETDM_OUT5_CON4,
991+ OUT_CLK_SRC_MASK, OUT_CLK_SRC(APLL_CLK));
992+ regmap_update_bits(afe->regmap, ETDM_OUT5_CON4,
993+ OUT_SEL_FS_MASK, OUT_SEL_FS(etdm_rate));
994+
995+ /* set ETDM_OUT5_CON5 */
996+ regmap_update_bits(afe->regmap, ETDM_OUT5_CON5,
997+ ETDM_CLK_DIV_MASK, ETDM_CLK_DIV);
998+ break;
999+ case SNDRV_PCM_STREAM_CAPTURE:
1000+ /* set ETDM_IN5_CON0 */
1001+ regmap_update_bits(afe->regmap, ETDM_IN5_CON0, mask, val);
1002+ regmap_update_bits(afe->regmap, ETDM_IN5_CON0,
1003+ ETDM_SYNC_MASK, ETDM_SYNC);
1004+
1005+ /* set ETDM_IN5_CON2 */
1006+ regmap_update_bits(afe->regmap, ETDM_IN5_CON2,
1007+ IN_CLK_SRC_MASK, IN_CLK_SRC(APLL_CLK));
1008+
1009+ /* set ETDM_IN5_CON3 */
1010+ regmap_update_bits(afe->regmap, ETDM_IN5_CON3,
1011+ IN_SEL_FS_MASK, IN_SEL_FS(etdm_rate));
1012+
1013+ /* set ETDM_IN5_CON4 */
1014+ regmap_update_bits(afe->regmap, ETDM_IN5_CON4,
1015+ IN_RELATCH_MASK, IN_RELATCH(afe_rate));
1016+ break;
1017+ default:
1018+ break;
1019+ }
1020+
1021+ return 0;
1022+}
1023+
1024+static int mtk_dai_etdm_hw_params(struct snd_pcm_substream *substream,
1025+ struct snd_pcm_hw_params *params,
1026+ struct snd_soc_dai *dai)
1027+{
1028+ unsigned int rate = params_rate(params);
1029+ struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai);
1030+
1031+ switch (rate) {
1032+ case 8000:
1033+ case 12000:
1034+ case 16000:
1035+ case 24000:
1036+ case 32000:
1037+ case 48000:
1038+ case 96000:
1039+ case 192000:
1040+ mtk_dai_etdm_config(afe, params, dai, SNDRV_PCM_STREAM_PLAYBACK);
1041+ mtk_dai_etdm_config(afe, params, dai, SNDRV_PCM_STREAM_CAPTURE);
1042+ return 0;
1043+ default:
1044+ dev_err(afe->dev,
1045+ "Sample rate %d invalid. Supported rates: 8/12/16/24/32/48/96/192 kHz\n",
1046+ rate);
1047+ return -EINVAL;
1048+ }
1049+}
1050+
1051+static int mtk_dai_etdm_trigger(struct snd_pcm_substream *substream, int cmd,
1052+ struct snd_soc_dai *dai)
1053+{
1054+ struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai);
1055+
1056+ dev_dbg(afe->dev, "%s(), cmd %d, dai id %d\n", __func__, cmd, dai->id);
1057+ switch (cmd) {
1058+ case SNDRV_PCM_TRIGGER_START:
1059+ case SNDRV_PCM_TRIGGER_RESUME:
1060+ regmap_update_bits(afe->regmap, ETDM_IN5_CON0, ETDM_EN_MASK,
1061+ ETDM_EN);
1062+ regmap_update_bits(afe->regmap, ETDM_OUT5_CON0, ETDM_EN_MASK,
1063+ ETDM_EN);
1064+ break;
1065+ case SNDRV_PCM_TRIGGER_STOP:
1066+ case SNDRV_PCM_TRIGGER_SUSPEND:
1067+ regmap_update_bits(afe->regmap, ETDM_IN5_CON0, ETDM_EN_MASK,
1068+ 0);
1069+ regmap_update_bits(afe->regmap, ETDM_OUT5_CON0, ETDM_EN_MASK,
1070+ 0);
1071+ break;
1072+ default:
1073+ break;
1074+ }
1075+
1076+ return 0;
1077+}
1078+
1079+static int mtk_dai_etdm_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
1080+{
1081+ struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai);
1082+ struct mt7986_afe_private *afe_priv = afe->platform_priv;
1083+ struct mtk_dai_etdm_priv *etdm_data;
1084+ void *priv_data;
1085+
1086+ switch (dai->id) {
1087+ case MT7986_DAI_ETDM:
1088+ break;
1089+ default:
1090+ dev_warn(afe->dev, "%s(), id %d not support\n",
1091+ __func__, dai->id);
1092+ return -EINVAL;
1093+ }
1094+
1095+ priv_data = devm_kzalloc(afe->dev, sizeof(struct mtk_dai_etdm_priv),
1096+ GFP_KERNEL);
1097+ if (!priv_data)
1098+ return -ENOMEM;
1099+
1100+ afe_priv->dai_priv[dai->id] = priv_data;
1101+ etdm_data = afe_priv->dai_priv[dai->id];
1102+
1103+ switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
1104+ case SND_SOC_DAIFMT_I2S:
1105+ etdm_data->format = MTK_DAI_ETDM_FORMAT_I2S;
1106+ break;
1107+ case SND_SOC_DAIFMT_DSP_A:
1108+ etdm_data->format = MTK_DAI_ETDM_FORMAT_DSPA;
1109+ break;
1110+ case SND_SOC_DAIFMT_DSP_B:
1111+ etdm_data->format = MTK_DAI_ETDM_FORMAT_DSPB;
1112+ break;
1113+ default:
1114+ return -EINVAL;
1115+ }
1116+
1117+ switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
1118+ case SND_SOC_DAIFMT_NB_NF:
1119+ etdm_data->bck_inv = false;
1120+ etdm_data->lrck_inv = false;
1121+ break;
1122+ case SND_SOC_DAIFMT_NB_IF:
1123+ etdm_data->bck_inv = false;
1124+ etdm_data->lrck_inv = true;
1125+ break;
1126+ case SND_SOC_DAIFMT_IB_NF:
1127+ etdm_data->bck_inv = true;
1128+ etdm_data->lrck_inv = false;
1129+ break;
1130+ case SND_SOC_DAIFMT_IB_IF:
1131+ etdm_data->bck_inv = true;
1132+ etdm_data->lrck_inv = true;
1133+ break;
1134+ default:
1135+ return -EINVAL;
1136+ }
1137+
1138+ switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
1139+ case SND_SOC_DAIFMT_CBM_CFM:
1140+ etdm_data->slave_mode = true;
1141+ break;
1142+ case SND_SOC_DAIFMT_CBS_CFS:
1143+ etdm_data->slave_mode = false;
1144+ break;
1145+ default:
1146+ return -EINVAL;
1147+ }
1148+
1149+ return 0;
1150+}
1151+
1152+static const struct snd_soc_dai_ops mtk_dai_etdm_ops = {
1153+ .startup = mtk_dai_etdm_startup,
1154+ .shutdown = mtk_dai_etdm_shutdown,
1155+ .hw_params = mtk_dai_etdm_hw_params,
1156+ .trigger = mtk_dai_etdm_trigger,
1157+ .set_fmt = mtk_dai_etdm_set_fmt,
1158+};
1159+
1160+/* dai driver */
1161+#define MTK_ETDM_RATES (SNDRV_PCM_RATE_8000_48000 |\
1162+ SNDRV_PCM_RATE_88200 |\
1163+ SNDRV_PCM_RATE_96000 |\
1164+ SNDRV_PCM_RATE_176400 |\
1165+ SNDRV_PCM_RATE_192000)
1166+
1167+#define MTK_ETDM_FORMATS (SNDRV_PCM_FMTBIT_S16_LE |\
1168+ SNDRV_PCM_FMTBIT_S24_LE |\
1169+ SNDRV_PCM_FMTBIT_S32_LE)
1170+
1171+static struct snd_soc_dai_driver mtk_dai_etdm_driver[] = {
1172+ {
1173+ .name = "ETDM",
1174+ .id = MT7986_DAI_ETDM,
1175+ .capture = {
1176+ .stream_name = "ETDM Capture",
1177+ .channels_min = 1,
1178+ .channels_max = 2,
1179+ .rates = MTK_ETDM_RATES,
1180+ .formats = MTK_ETDM_FORMATS,
1181+ },
1182+ .playback = {
1183+ .stream_name = "ETDM Playback",
1184+ .channels_min = 1,
1185+ .channels_max = 2,
1186+ .rates = MTK_ETDM_RATES,
1187+ .formats = MTK_ETDM_FORMATS,
1188+ },
1189+ .ops = &mtk_dai_etdm_ops,
1190+ .symmetric_rates = 1,
1191+ .symmetric_samplebits = 1,
1192+ },
1193+};
1194+
1195+int mt7986_dai_etdm_register(struct mtk_base_afe *afe)
1196+{
1197+ struct mtk_base_afe_dai *dai;
1198+
1199+ dai = devm_kzalloc(afe->dev, sizeof(*dai), GFP_KERNEL);
1200+ if (!dai)
1201+ return -ENOMEM;
1202+
1203+ list_add(&dai->list, &afe->sub_dais);
1204+
1205+ dai->dai_drivers = mtk_dai_etdm_driver;
1206+ dai->num_dai_drivers = ARRAY_SIZE(mtk_dai_etdm_driver);
1207+
1208+ dai->dapm_widgets = mtk_dai_etdm_widgets;
1209+ dai->num_dapm_widgets = ARRAY_SIZE(mtk_dai_etdm_widgets);
1210+ dai->dapm_routes = mtk_dai_etdm_routes;
1211+ dai->num_dapm_routes = ARRAY_SIZE(mtk_dai_etdm_routes);
1212+
1213+ return 0;
1214+}
1215diff --git a/sound/soc/mediatek/mt7986/mt7986-reg.h b/sound/soc/mediatek/mt7986/mt7986-reg.h
1216new file mode 100644
1217index 0000000..c2b2007
1218--- /dev/null
1219+++ b/sound/soc/mediatek/mt7986/mt7986-reg.h
1220@@ -0,0 +1,196 @@
1221+/* SPDX-License-Identifier: GPL-2.0 */
1222+/*
1223+ * mt7986-reg.h -- MediaTek 7986 audio driver reg definition
1224+ *
1225+ * Copyright (c) 2023 MediaTek Inc.
1226+ * Authors: Vic Wu <vic.wu@mediatek.com>
1227+ * Maso Huang <maso.huang@mediatek.com>
1228+ */
1229+
1230+#ifndef _MT7986_REG_H_
1231+#define _MT7986_REG_H_
1232+
1233+#define AUDIO_TOP_CON2 0x0008
1234+#define AUDIO_TOP_CON4 0x0010
1235+#define AUDIO_ENGEN_CON0 0x0014
1236+#define AFE_IRQ_MCU_EN 0x0100
1237+#define AFE_IRQ_MCU_STATUS 0x0120
1238+#define AFE_IRQ_MCU_CLR 0x0128
1239+#define AFE_IRQ0_MCU_CFG0 0x0140
1240+#define AFE_IRQ0_MCU_CFG1 0x0144
1241+#define AFE_IRQ1_MCU_CFG0 0x0148
1242+#define AFE_IRQ1_MCU_CFG1 0x014c
1243+#define AFE_IRQ2_MCU_CFG0 0x0150
1244+#define AFE_IRQ2_MCU_CFG1 0x0154
1245+#define ETDM_IN5_CON0 0x13f0
1246+#define ETDM_IN5_CON1 0x13f4
1247+#define ETDM_IN5_CON2 0x13f8
1248+#define ETDM_IN5_CON3 0x13fc
1249+#define ETDM_IN5_CON4 0x1400
1250+#define ETDM_OUT5_CON0 0x1570
1251+#define ETDM_OUT5_CON4 0x1580
1252+#define ETDM_OUT5_CON5 0x1584
1253+#define ETDM_4_7_COWORK_CON0 0x15e0
1254+#define ETDM_4_7_COWORK_CON1 0x15e4
1255+#define AFE_CONN018_1 0x1b44
1256+#define AFE_CONN018_4 0x1b50
1257+#define AFE_CONN019_1 0x1b64
1258+#define AFE_CONN019_4 0x1b70
1259+#define AFE_CONN124_1 0x2884
1260+#define AFE_CONN124_4 0x2890
1261+#define AFE_CONN125_1 0x28a4
1262+#define AFE_CONN125_4 0x28b0
1263+#define AFE_CONN_RS_0 0x3920
1264+#define AFE_CONN_RS_3 0x392c
1265+#define AFE_CONN_16BIT_0 0x3960
1266+#define AFE_CONN_16BIT_3 0x396c
1267+#define AFE_CONN_24BIT_0 0x3980
1268+#define AFE_CONN_24BIT_3 0x398c
1269+#define AFE_MEMIF_CON0 0x3d98
1270+#define AFE_MEMIF_RD_MON 0x3da0
1271+#define AFE_MEMIF_WR_MON 0x3da4
1272+#define AFE_DL0_BASE_MSB 0x3e40
1273+#define AFE_DL0_BASE 0x3e44
1274+#define AFE_DL0_CUR_MSB 0x3e48
1275+#define AFE_DL0_CUR 0x3e4c
1276+#define AFE_DL0_END_MSB 0x3e50
1277+#define AFE_DL0_END 0x3e54
1278+#define AFE_DL0_RCH_MON 0x3e58
1279+#define AFE_DL0_LCH_MON 0x3e5c
1280+#define AFE_DL0_CON0 0x3e60
1281+#define AFE_VUL0_BASE_MSB 0x4220
1282+#define AFE_VUL0_BASE 0x4224
1283+#define AFE_VUL0_CUR_MSB 0x4228
1284+#define AFE_VUL0_CUR 0x422c
1285+#define AFE_VUL0_END_MSB 0x4230
1286+#define AFE_VUL0_END 0x4234
1287+#define AFE_VUL0_CON0 0x4238
1288+
1289+#define AFE_MAX_REGISTER AFE_VUL0_CON0
1290+#define AFE_IRQ_STATUS_BITS 0x7
1291+#define AFE_IRQ_CNT_SHIFT 0
1292+#define AFE_IRQ_CNT_MASK 0xffffff
1293+
1294+/* AUDIO_TOP_CON2 */
1295+#define CLK_OUT5_PDN BIT(14)
1296+#define CLK_OUT5_PDN_MASK BIT(14)
1297+#define CLK_IN5_PDN BIT(7)
1298+#define CLK_IN5_PDN_MASK BIT(7)
1299+
1300+/* AUDIO_TOP_CON4 */
1301+#define PDN_APLL_TUNER2 BIT(12)
1302+#define PDN_APLL_TUNER2_MASK BIT(12)
1303+
1304+/* AUDIO_ENGEN_CON0 */
1305+#define AUD_APLL2_EN BIT(3)
1306+#define AUD_APLL2_EN_MASK BIT(3)
1307+#define AUD_26M_EN BIT(0)
1308+#define AUD_26M_EN_MASK BIT(0)
1309+
1310+/* AFE_DL0_CON0 */
1311+#define DL0_ON_SFT 28
1312+#define DL0_ON_MASK 0x1
1313+#define DL0_ON_MASK_SFT BIT(28)
1314+#define DL0_MINLEN_SFT 20
1315+#define DL0_MINLEN_MASK 0xf
1316+#define DL0_MINLEN_MASK_SFT (0xf << 20)
1317+#define DL0_MODE_SFT 8
1318+#define DL0_MODE_MASK 0x1f
1319+#define DL0_MODE_MASK_SFT (0x1f << 8)
1320+#define DL0_PBUF_SIZE_SFT 5
1321+#define DL0_PBUF_SIZE_MASK 0x3
1322+#define DL0_PBUF_SIZE_MASK_SFT (0x3 << 5)
1323+#define DL0_MONO_SFT 4
1324+#define DL0_MONO_MASK 0x1
1325+#define DL0_MONO_MASK_SFT BIT(4)
1326+#define DL0_HALIGN_SFT 2
1327+#define DL0_HALIGN_MASK 0x1
1328+#define DL0_HALIGN_MASK_SFT BIT(2)
1329+#define DL0_HD_MODE_SFT 0
1330+#define DL0_HD_MODE_MASK 0x3
1331+#define DL0_HD_MODE_MASK_SFT (0x3 << 0)
1332+
1333+/* AFE_VUL0_CON0 */
1334+#define VUL0_ON_SFT 28
1335+#define VUL0_ON_MASK 0x1
1336+#define VUL0_ON_MASK_SFT BIT(28)
1337+#define VUL0_MODE_SFT 8
1338+#define VUL0_MODE_MASK 0x1f
1339+#define VUL0_MODE_MASK_SFT (0x1f << 8)
1340+#define VUL0_MONO_SFT 4
1341+#define VUL0_MONO_MASK 0x1
1342+#define VUL0_MONO_MASK_SFT BIT(4)
1343+#define VUL0_HALIGN_SFT 2
1344+#define VUL0_HALIGN_MASK 0x1
1345+#define VUL0_HALIGN_MASK_SFT BIT(2)
1346+#define VUL0_HD_MODE_SFT 0
1347+#define VUL0_HD_MODE_MASK 0x3
1348+#define VUL0_HD_MODE_MASK_SFT (0x3 << 0)
1349+
1350+/* AFE_IRQ_MCU_CON */
1351+#define IRQ_MCU_MODE_SFT 4
1352+#define IRQ_MCU_MODE_MASK 0x1f
1353+#define IRQ_MCU_MODE_MASK_SFT (0x1f << 4)
1354+#define IRQ_MCU_ON_SFT 0
1355+#define IRQ_MCU_ON_MASK 0x1
1356+#define IRQ_MCU_ON_MASK_SFT BIT(0)
1357+#define IRQ0_MCU_CLR_SFT 0
1358+#define IRQ0_MCU_CLR_MASK 0x1
1359+#define IRQ0_MCU_CLR_MASK_SFT BIT(0)
1360+#define IRQ1_MCU_CLR_SFT 1
1361+#define IRQ1_MCU_CLR_MASK 0x1
1362+#define IRQ1_MCU_CLR_MASK_SFT BIT(1)
1363+#define IRQ2_MCU_CLR_SFT 2
1364+#define IRQ2_MCU_CLR_MASK 0x1
1365+#define IRQ2_MCU_CLR_MASK_SFT BIT(2)
1366+
1367+/* ETDM_IN5_CON2 */
1368+#define IN_CLK_SRC(x) ((x) << 10)
1369+#define IN_CLK_SRC_SFT 10
1370+#define IN_CLK_SRC_MASK GENMASK(12, 10)
1371+
1372+/* ETDM_IN5_CON3 */
1373+#define IN_SEL_FS(x) ((x) << 26)
1374+#define IN_SEL_FS_SFT 26
1375+#define IN_SEL_FS_MASK GENMASK(30, 26)
1376+
1377+/* ETDM_IN5_CON4 */
1378+#define IN_RELATCH(x) ((x) << 20)
1379+#define IN_RELATCH_SFT 20
1380+#define IN_RELATCH_MASK GENMASK(24, 20)
1381+#define IN_CLK_INV BIT(18)
1382+#define IN_CLK_INV_MASK BIT(18)
1383+
1384+/* ETDM_IN5_CON0 & ETDM_OUT5_CON0 */
1385+#define RELATCH_SRC_MASK GENMASK(30, 28)
1386+#define ETDM_CH_NUM_MASK GENMASK(27, 23)
1387+#define ETDM_WRD_LEN_MASK GENMASK(20, 16)
1388+#define ETDM_BIT_LEN_MASK GENMASK(15, 11)
1389+#define ETDM_FMT_MASK GENMASK(8, 6)
1390+#define ETDM_SYNC BIT(1)
1391+#define ETDM_SYNC_MASK BIT(1)
1392+#define ETDM_EN BIT(0)
1393+#define ETDM_EN_MASK BIT(0)
1394+
1395+/* ETDM_OUT5_CON4 */
1396+#define OUT_RELATCH(x) ((x) << 24)
1397+#define OUT_RELATCH_SFT 24
1398+#define OUT_RELATCH_MASK GENMASK(28, 24)
1399+#define OUT_CLK_SRC(x) ((x) << 6)
1400+#define OUT_CLK_SRC_SFT 6
1401+#define OUT_CLK_SRC_MASK GENMASK(8, 6)
1402+#define OUT_SEL_FS(x) (x)
1403+#define OUT_SEL_FS_SFT 0
1404+#define OUT_SEL_FS_MASK GENMASK(4, 0)
1405+
1406+/* ETDM_OUT5_CON5 */
1407+#define ETDM_CLK_DIV BIT(12)
1408+#define ETDM_CLK_DIV_MASK BIT(12)
1409+#define OUT_CLK_INV BIT(9)
1410+#define OUT_CLK_INV_MASK BIT(9)
1411+
1412+/* ETDM_4_7_COWORK_CON0 */
1413+#define OUT_SEL(x) ((x) << 12)
1414+#define OUT_SEL_SFT 12
1415+#define OUT_SEL_MASK GENMASK(15, 12)
1416+#endif
1417diff --git a/sound/soc/mediatek/mt7986/mt7986-wm8960.c b/sound/soc/mediatek/mt7986/mt7986-wm8960.c
1418new file mode 100644
1419index 0000000..c1390b3
1420--- /dev/null
1421+++ b/sound/soc/mediatek/mt7986/mt7986-wm8960.c
1422@@ -0,0 +1,177 @@
1423+// SPDX-License-Identifier: GPL-2.0
1424+/*
1425+ * mt7986-wm8960.c -- MT7986-WM8960 ALSA SoC machine driver
1426+ *
1427+ * Copyright (c) 2023 MediaTek Inc.
1428+ * Authors: Vic Wu <vic.wu@mediatek.com>
1429+ * Maso Huang <maso.huang@mediatek.com>
1430+ */
1431+
1432+#include <linux/module.h>
1433+#include <sound/soc.h>
1434+
1435+#include "mt7986-afe-common.h"
1436+
1437+static const struct snd_soc_dapm_widget mt7986_wm8960_widgets[] = {
1438+ SND_SOC_DAPM_HP("Headphone", NULL),
1439+ SND_SOC_DAPM_MIC("AMIC", NULL),
1440+};
1441+
1442+static const struct snd_kcontrol_new mt7986_wm8960_controls[] = {
1443+ SOC_DAPM_PIN_SWITCH("Headphone"),
1444+ SOC_DAPM_PIN_SWITCH("AMIC"),
1445+};
1446+
1447+SND_SOC_DAILINK_DEFS(playback,
1448+ DAILINK_COMP_ARRAY(COMP_CPU("DL1")),
1449+ DAILINK_COMP_ARRAY(COMP_DUMMY()),
1450+ DAILINK_COMP_ARRAY(COMP_EMPTY()));
1451+
1452+SND_SOC_DAILINK_DEFS(capture,
1453+ DAILINK_COMP_ARRAY(COMP_CPU("UL1")),
1454+ DAILINK_COMP_ARRAY(COMP_DUMMY()),
1455+ DAILINK_COMP_ARRAY(COMP_EMPTY()));
1456+
1457+SND_SOC_DAILINK_DEFS(codec,
1458+ DAILINK_COMP_ARRAY(COMP_CPU("ETDM")),
1459+ DAILINK_COMP_ARRAY(COMP_CODEC(NULL, "wm8960-hifi")),
1460+ DAILINK_COMP_ARRAY(COMP_EMPTY()));
1461+
1462+static struct snd_soc_dai_link mt7986_wm8960_dai_links[] = {
1463+ /* FE */
1464+ {
1465+ .name = "wm8960-playback",
1466+ .stream_name = "wm8960-playback",
1467+ .trigger = {SND_SOC_DPCM_TRIGGER_POST,
1468+ SND_SOC_DPCM_TRIGGER_POST},
1469+ .dynamic = 1,
1470+ .dpcm_playback = 1,
1471+ SND_SOC_DAILINK_REG(playback),
1472+ },
1473+ {
1474+ .name = "wm8960-capture",
1475+ .stream_name = "wm8960-capture",
1476+ .trigger = {SND_SOC_DPCM_TRIGGER_POST,
1477+ SND_SOC_DPCM_TRIGGER_POST},
1478+ .dynamic = 1,
1479+ .dpcm_capture = 1,
1480+ SND_SOC_DAILINK_REG(capture),
1481+ },
1482+ /* BE */
1483+ {
1484+ .name = "wm8960-codec",
1485+ .no_pcm = 1,
1486+ .dai_fmt = SND_SOC_DAIFMT_I2S |
1487+ SND_SOC_DAIFMT_NB_NF |
1488+ SND_SOC_DAIFMT_CBS_CFS |
1489+ SND_SOC_DAIFMT_GATED,
1490+ .dpcm_playback = 1,
1491+ .dpcm_capture = 1,
1492+ SND_SOC_DAILINK_REG(codec),
1493+ },
1494+};
1495+
1496+static struct snd_soc_card mt7986_wm8960_card = {
1497+ .name = "mt7986-wm8960",
1498+ .owner = THIS_MODULE,
1499+ .dai_link = mt7986_wm8960_dai_links,
1500+ .num_links = ARRAY_SIZE(mt7986_wm8960_dai_links),
1501+ .controls = mt7986_wm8960_controls,
1502+ .num_controls = ARRAY_SIZE(mt7986_wm8960_controls),
1503+ .dapm_widgets = mt7986_wm8960_widgets,
1504+ .num_dapm_widgets = ARRAY_SIZE(mt7986_wm8960_widgets),
1505+};
1506+
1507+static int mt7986_wm8960_machine_probe(struct platform_device *pdev)
1508+{
1509+ struct snd_soc_card *card = &mt7986_wm8960_card;
1510+ struct snd_soc_dai_link *dai_link;
1511+ struct device_node *platform, *codec;
1512+ struct device_node *platform_dai_node, *codec_dai_node;
1513+ int ret, i;
1514+
1515+ card->dev = &pdev->dev;
1516+
1517+ platform = of_get_child_by_name(pdev->dev.of_node, "platform");
1518+
1519+ if (platform) {
1520+ platform_dai_node = of_parse_phandle(platform, "sound-dai", 0);
1521+ of_node_put(platform);
1522+
1523+ if (!platform_dai_node) {
1524+ dev_err(&pdev->dev, "Failed to parse platform/sound-dai property\n");
1525+ return -EINVAL;
1526+ }
1527+ } else {
1528+ dev_err(&pdev->dev, "Property 'platform' missing or invalid\n");
1529+ return -EINVAL;
1530+ }
1531+
1532+ for_each_card_prelinks(card, i, dai_link) {
1533+ if (dai_link->platforms->name)
1534+ continue;
1535+ dai_link->platforms->of_node = platform_dai_node;
1536+ }
1537+
1538+ codec = of_get_child_by_name(pdev->dev.of_node, "codec");
1539+
1540+ if (codec) {
1541+ codec_dai_node = of_parse_phandle(codec, "sound-dai", 0);
1542+ of_node_put(codec);
1543+
1544+ if (!codec_dai_node) {
1545+ of_node_put(platform_dai_node);
1546+ dev_err(&pdev->dev, "Failed to parse codec/sound-dai property\n");
1547+ return -EINVAL;
1548+ }
1549+ } else {
1550+ of_node_put(platform_dai_node);
1551+ dev_err(&pdev->dev, "Property 'codec' missing or invalid\n");
1552+ return -EINVAL;
1553+ }
1554+
1555+ for_each_card_prelinks(card, i, dai_link) {
1556+ if (dai_link->codecs->name)
1557+ continue;
1558+ dai_link->codecs->of_node = codec_dai_node;
1559+ }
1560+
1561+ ret = snd_soc_of_parse_audio_routing(card, "audio-routing");
1562+ if (ret) {
1563+ dev_err(&pdev->dev, "Failed to parse audio-routing: %d\n", ret);
1564+ goto err_of_node_put;
1565+ }
1566+
1567+ ret = devm_snd_soc_register_card(&pdev->dev, card);
1568+ if (ret) {
1569+ dev_err(&pdev->dev, "%s snd_soc_register_card fail: %d\n", __func__, ret);
1570+ goto err_of_node_put;
1571+ }
1572+
1573+err_of_node_put:
1574+ of_node_put(platform_dai_node);
1575+ of_node_put(codec_dai_node);
1576+ return ret;
1577+}
1578+
1579+static const struct of_device_id mt7986_wm8960_machine_dt_match[] = {
1580+ {.compatible = "mediatek,mt7986-wm8960-sound"},
1581+ { /* sentinel */ }
1582+};
1583+MODULE_DEVICE_TABLE(of, mt7986_wm8960_machine_dt_match);
1584+
1585+static struct platform_driver mt7986_wm8960_machine = {
1586+ .driver = {
1587+ .name = "mt7986-wm8960",
1588+ .of_match_table = mt7986_wm8960_machine_dt_match,
1589+ },
1590+ .probe = mt7986_wm8960_machine_probe,
1591+};
1592+
1593+module_platform_driver(mt7986_wm8960_machine);
1594+
1595+/* Module information */
1596+MODULE_DESCRIPTION("MT7986 WM8960 ALSA SoC machine driver");
1597+MODULE_AUTHOR("Vic Wu <vic.wu@mediatek.com>");
1598+MODULE_LICENSE("GPL");
1599+MODULE_ALIAS("mt7986 wm8960 soc card");
1600--
16012.18.0
1602