18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Mediatek ALSA SoC AFE platform driver for 2701 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Copyright (c) 2016 MediaTek Inc. 68c2ecf20Sopenharmony_ci * Author: Garlic Tseng <garlic.tseng@mediatek.com> 78c2ecf20Sopenharmony_ci * Ir Lian <ir.lian@mediatek.com> 88c2ecf20Sopenharmony_ci * Ryder Lee <ryder.lee@mediatek.com> 98c2ecf20Sopenharmony_ci */ 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ci#include <linux/delay.h> 128c2ecf20Sopenharmony_ci#include <linux/module.h> 138c2ecf20Sopenharmony_ci#include <linux/mfd/syscon.h> 148c2ecf20Sopenharmony_ci#include <linux/of.h> 158c2ecf20Sopenharmony_ci#include <linux/of_address.h> 168c2ecf20Sopenharmony_ci#include <linux/of_device.h> 178c2ecf20Sopenharmony_ci#include <linux/pm_runtime.h> 188c2ecf20Sopenharmony_ci 198c2ecf20Sopenharmony_ci#include "mt2701-afe-common.h" 208c2ecf20Sopenharmony_ci#include "mt2701-afe-clock-ctrl.h" 218c2ecf20Sopenharmony_ci#include "../common/mtk-afe-platform-driver.h" 228c2ecf20Sopenharmony_ci#include "../common/mtk-afe-fe-dai.h" 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_cistatic const struct snd_pcm_hardware mt2701_afe_hardware = { 258c2ecf20Sopenharmony_ci .info = SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED 268c2ecf20Sopenharmony_ci | SNDRV_PCM_INFO_RESUME | SNDRV_PCM_INFO_MMAP_VALID, 278c2ecf20Sopenharmony_ci .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE 288c2ecf20Sopenharmony_ci | SNDRV_PCM_FMTBIT_S32_LE, 298c2ecf20Sopenharmony_ci .period_bytes_min = 1024, 308c2ecf20Sopenharmony_ci .period_bytes_max = 1024 * 256, 318c2ecf20Sopenharmony_ci .periods_min = 4, 328c2ecf20Sopenharmony_ci .periods_max = 1024, 338c2ecf20Sopenharmony_ci .buffer_bytes_max = 1024 * 1024, 348c2ecf20Sopenharmony_ci .fifo_size = 0, 358c2ecf20Sopenharmony_ci}; 368c2ecf20Sopenharmony_ci 378c2ecf20Sopenharmony_cistruct mt2701_afe_rate { 388c2ecf20Sopenharmony_ci unsigned int rate; 398c2ecf20Sopenharmony_ci unsigned int regvalue; 408c2ecf20Sopenharmony_ci}; 418c2ecf20Sopenharmony_ci 428c2ecf20Sopenharmony_cistatic const struct mt2701_afe_rate mt2701_afe_i2s_rates[] = { 438c2ecf20Sopenharmony_ci { .rate = 8000, .regvalue = 0 }, 448c2ecf20Sopenharmony_ci { .rate = 12000, .regvalue = 1 }, 458c2ecf20Sopenharmony_ci { .rate = 16000, .regvalue = 2 }, 468c2ecf20Sopenharmony_ci { .rate = 24000, .regvalue = 3 }, 478c2ecf20Sopenharmony_ci { .rate = 32000, .regvalue = 4 }, 488c2ecf20Sopenharmony_ci { .rate = 48000, .regvalue = 5 }, 498c2ecf20Sopenharmony_ci { .rate = 96000, .regvalue = 6 }, 508c2ecf20Sopenharmony_ci { .rate = 192000, .regvalue = 7 }, 518c2ecf20Sopenharmony_ci { .rate = 384000, .regvalue = 8 }, 528c2ecf20Sopenharmony_ci { .rate = 7350, .regvalue = 16 }, 538c2ecf20Sopenharmony_ci { .rate = 11025, .regvalue = 17 }, 548c2ecf20Sopenharmony_ci { .rate = 14700, .regvalue = 18 }, 558c2ecf20Sopenharmony_ci { .rate = 22050, .regvalue = 19 }, 568c2ecf20Sopenharmony_ci { .rate = 29400, .regvalue = 20 }, 578c2ecf20Sopenharmony_ci { .rate = 44100, .regvalue = 21 }, 588c2ecf20Sopenharmony_ci { .rate = 88200, .regvalue = 22 }, 598c2ecf20Sopenharmony_ci { .rate = 176400, .regvalue = 23 }, 608c2ecf20Sopenharmony_ci { .rate = 352800, .regvalue = 24 }, 618c2ecf20Sopenharmony_ci}; 628c2ecf20Sopenharmony_ci 638c2ecf20Sopenharmony_cistatic const unsigned int mt2701_afe_backup_list[] = { 648c2ecf20Sopenharmony_ci AUDIO_TOP_CON0, 658c2ecf20Sopenharmony_ci AUDIO_TOP_CON4, 668c2ecf20Sopenharmony_ci AUDIO_TOP_CON5, 678c2ecf20Sopenharmony_ci ASYS_TOP_CON, 688c2ecf20Sopenharmony_ci AFE_CONN0, 698c2ecf20Sopenharmony_ci AFE_CONN1, 708c2ecf20Sopenharmony_ci AFE_CONN2, 718c2ecf20Sopenharmony_ci AFE_CONN3, 728c2ecf20Sopenharmony_ci AFE_CONN15, 738c2ecf20Sopenharmony_ci AFE_CONN16, 748c2ecf20Sopenharmony_ci AFE_CONN17, 758c2ecf20Sopenharmony_ci AFE_CONN18, 768c2ecf20Sopenharmony_ci AFE_CONN19, 778c2ecf20Sopenharmony_ci AFE_CONN20, 788c2ecf20Sopenharmony_ci AFE_CONN21, 798c2ecf20Sopenharmony_ci AFE_CONN22, 808c2ecf20Sopenharmony_ci AFE_DAC_CON0, 818c2ecf20Sopenharmony_ci AFE_MEMIF_PBUF_SIZE, 828c2ecf20Sopenharmony_ci}; 838c2ecf20Sopenharmony_ci 848c2ecf20Sopenharmony_cistatic int mt2701_dai_num_to_i2s(struct mtk_base_afe *afe, int num) 858c2ecf20Sopenharmony_ci{ 868c2ecf20Sopenharmony_ci struct mt2701_afe_private *afe_priv = afe->platform_priv; 878c2ecf20Sopenharmony_ci int val = num - MT2701_IO_I2S; 888c2ecf20Sopenharmony_ci 898c2ecf20Sopenharmony_ci if (val < 0 || val >= afe_priv->soc->i2s_num) { 908c2ecf20Sopenharmony_ci dev_err(afe->dev, "%s, num not available, num %d, val %d\n", 918c2ecf20Sopenharmony_ci __func__, num, val); 928c2ecf20Sopenharmony_ci return -EINVAL; 938c2ecf20Sopenharmony_ci } 948c2ecf20Sopenharmony_ci return val; 958c2ecf20Sopenharmony_ci} 968c2ecf20Sopenharmony_ci 978c2ecf20Sopenharmony_cistatic int mt2701_afe_i2s_fs(unsigned int sample_rate) 988c2ecf20Sopenharmony_ci{ 998c2ecf20Sopenharmony_ci int i; 1008c2ecf20Sopenharmony_ci 1018c2ecf20Sopenharmony_ci for (i = 0; i < ARRAY_SIZE(mt2701_afe_i2s_rates); i++) 1028c2ecf20Sopenharmony_ci if (mt2701_afe_i2s_rates[i].rate == sample_rate) 1038c2ecf20Sopenharmony_ci return mt2701_afe_i2s_rates[i].regvalue; 1048c2ecf20Sopenharmony_ci 1058c2ecf20Sopenharmony_ci return -EINVAL; 1068c2ecf20Sopenharmony_ci} 1078c2ecf20Sopenharmony_ci 1088c2ecf20Sopenharmony_cistatic int mt2701_afe_i2s_startup(struct snd_pcm_substream *substream, 1098c2ecf20Sopenharmony_ci struct snd_soc_dai *dai) 1108c2ecf20Sopenharmony_ci{ 1118c2ecf20Sopenharmony_ci struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai); 1128c2ecf20Sopenharmony_ci struct mt2701_afe_private *afe_priv = afe->platform_priv; 1138c2ecf20Sopenharmony_ci int i2s_num = mt2701_dai_num_to_i2s(afe, dai->id); 1148c2ecf20Sopenharmony_ci bool mode = afe_priv->soc->has_one_heart_mode; 1158c2ecf20Sopenharmony_ci 1168c2ecf20Sopenharmony_ci if (i2s_num < 0) 1178c2ecf20Sopenharmony_ci return i2s_num; 1188c2ecf20Sopenharmony_ci 1198c2ecf20Sopenharmony_ci return mt2701_afe_enable_mclk(afe, mode ? 1 : i2s_num); 1208c2ecf20Sopenharmony_ci} 1218c2ecf20Sopenharmony_ci 1228c2ecf20Sopenharmony_cistatic int mt2701_afe_i2s_path_disable(struct mtk_base_afe *afe, 1238c2ecf20Sopenharmony_ci struct mt2701_i2s_path *i2s_path, 1248c2ecf20Sopenharmony_ci int stream_dir) 1258c2ecf20Sopenharmony_ci{ 1268c2ecf20Sopenharmony_ci const struct mt2701_i2s_data *i2s_data = i2s_path->i2s_data[stream_dir]; 1278c2ecf20Sopenharmony_ci 1288c2ecf20Sopenharmony_ci if (--i2s_path->on[stream_dir] < 0) 1298c2ecf20Sopenharmony_ci i2s_path->on[stream_dir] = 0; 1308c2ecf20Sopenharmony_ci 1318c2ecf20Sopenharmony_ci if (i2s_path->on[stream_dir]) 1328c2ecf20Sopenharmony_ci return 0; 1338c2ecf20Sopenharmony_ci 1348c2ecf20Sopenharmony_ci /* disable i2s */ 1358c2ecf20Sopenharmony_ci regmap_update_bits(afe->regmap, i2s_data->i2s_ctrl_reg, 1368c2ecf20Sopenharmony_ci ASYS_I2S_CON_I2S_EN, 0); 1378c2ecf20Sopenharmony_ci 1388c2ecf20Sopenharmony_ci mt2701_afe_disable_i2s(afe, i2s_path, stream_dir); 1398c2ecf20Sopenharmony_ci 1408c2ecf20Sopenharmony_ci return 0; 1418c2ecf20Sopenharmony_ci} 1428c2ecf20Sopenharmony_ci 1438c2ecf20Sopenharmony_cistatic void mt2701_afe_i2s_shutdown(struct snd_pcm_substream *substream, 1448c2ecf20Sopenharmony_ci struct snd_soc_dai *dai) 1458c2ecf20Sopenharmony_ci{ 1468c2ecf20Sopenharmony_ci struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai); 1478c2ecf20Sopenharmony_ci struct mt2701_afe_private *afe_priv = afe->platform_priv; 1488c2ecf20Sopenharmony_ci int i2s_num = mt2701_dai_num_to_i2s(afe, dai->id); 1498c2ecf20Sopenharmony_ci struct mt2701_i2s_path *i2s_path; 1508c2ecf20Sopenharmony_ci bool mode = afe_priv->soc->has_one_heart_mode; 1518c2ecf20Sopenharmony_ci 1528c2ecf20Sopenharmony_ci if (i2s_num < 0) 1538c2ecf20Sopenharmony_ci return; 1548c2ecf20Sopenharmony_ci 1558c2ecf20Sopenharmony_ci i2s_path = &afe_priv->i2s_path[i2s_num]; 1568c2ecf20Sopenharmony_ci 1578c2ecf20Sopenharmony_ci if (i2s_path->occupied[substream->stream]) 1588c2ecf20Sopenharmony_ci i2s_path->occupied[substream->stream] = 0; 1598c2ecf20Sopenharmony_ci else 1608c2ecf20Sopenharmony_ci goto exit; 1618c2ecf20Sopenharmony_ci 1628c2ecf20Sopenharmony_ci mt2701_afe_i2s_path_disable(afe, i2s_path, substream->stream); 1638c2ecf20Sopenharmony_ci 1648c2ecf20Sopenharmony_ci /* need to disable i2s-out path when disable i2s-in */ 1658c2ecf20Sopenharmony_ci if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) 1668c2ecf20Sopenharmony_ci mt2701_afe_i2s_path_disable(afe, i2s_path, !substream->stream); 1678c2ecf20Sopenharmony_ci 1688c2ecf20Sopenharmony_ciexit: 1698c2ecf20Sopenharmony_ci /* disable mclk */ 1708c2ecf20Sopenharmony_ci mt2701_afe_disable_mclk(afe, mode ? 1 : i2s_num); 1718c2ecf20Sopenharmony_ci} 1728c2ecf20Sopenharmony_ci 1738c2ecf20Sopenharmony_cistatic int mt2701_i2s_path_enable(struct mtk_base_afe *afe, 1748c2ecf20Sopenharmony_ci struct mt2701_i2s_path *i2s_path, 1758c2ecf20Sopenharmony_ci int stream_dir, int rate) 1768c2ecf20Sopenharmony_ci{ 1778c2ecf20Sopenharmony_ci const struct mt2701_i2s_data *i2s_data = i2s_path->i2s_data[stream_dir]; 1788c2ecf20Sopenharmony_ci struct mt2701_afe_private *afe_priv = afe->platform_priv; 1798c2ecf20Sopenharmony_ci int reg, fs, w_len = 1; /* now we support bck 64bits only */ 1808c2ecf20Sopenharmony_ci unsigned int mask, val; 1818c2ecf20Sopenharmony_ci 1828c2ecf20Sopenharmony_ci /* no need to enable if already done */ 1838c2ecf20Sopenharmony_ci if (++i2s_path->on[stream_dir] != 1) 1848c2ecf20Sopenharmony_ci return 0; 1858c2ecf20Sopenharmony_ci 1868c2ecf20Sopenharmony_ci fs = mt2701_afe_i2s_fs(rate); 1878c2ecf20Sopenharmony_ci 1888c2ecf20Sopenharmony_ci mask = ASYS_I2S_CON_FS | 1898c2ecf20Sopenharmony_ci ASYS_I2S_CON_I2S_COUPLE_MODE | /* 0 */ 1908c2ecf20Sopenharmony_ci ASYS_I2S_CON_I2S_MODE | 1918c2ecf20Sopenharmony_ci ASYS_I2S_CON_WIDE_MODE; 1928c2ecf20Sopenharmony_ci 1938c2ecf20Sopenharmony_ci val = ASYS_I2S_CON_FS_SET(fs) | 1948c2ecf20Sopenharmony_ci ASYS_I2S_CON_I2S_MODE | 1958c2ecf20Sopenharmony_ci ASYS_I2S_CON_WIDE_MODE_SET(w_len); 1968c2ecf20Sopenharmony_ci 1978c2ecf20Sopenharmony_ci if (stream_dir == SNDRV_PCM_STREAM_CAPTURE) { 1988c2ecf20Sopenharmony_ci mask |= ASYS_I2S_IN_PHASE_FIX; 1998c2ecf20Sopenharmony_ci val |= ASYS_I2S_IN_PHASE_FIX; 2008c2ecf20Sopenharmony_ci reg = ASMI_TIMING_CON1; 2018c2ecf20Sopenharmony_ci } else { 2028c2ecf20Sopenharmony_ci if (afe_priv->soc->has_one_heart_mode) { 2038c2ecf20Sopenharmony_ci mask |= ASYS_I2S_CON_ONE_HEART_MODE; 2048c2ecf20Sopenharmony_ci val |= ASYS_I2S_CON_ONE_HEART_MODE; 2058c2ecf20Sopenharmony_ci } 2068c2ecf20Sopenharmony_ci reg = ASMO_TIMING_CON1; 2078c2ecf20Sopenharmony_ci } 2088c2ecf20Sopenharmony_ci 2098c2ecf20Sopenharmony_ci regmap_update_bits(afe->regmap, i2s_data->i2s_ctrl_reg, mask, val); 2108c2ecf20Sopenharmony_ci 2118c2ecf20Sopenharmony_ci regmap_update_bits(afe->regmap, reg, 2128c2ecf20Sopenharmony_ci i2s_data->i2s_asrc_fs_mask 2138c2ecf20Sopenharmony_ci << i2s_data->i2s_asrc_fs_shift, 2148c2ecf20Sopenharmony_ci fs << i2s_data->i2s_asrc_fs_shift); 2158c2ecf20Sopenharmony_ci 2168c2ecf20Sopenharmony_ci /* enable i2s */ 2178c2ecf20Sopenharmony_ci mt2701_afe_enable_i2s(afe, i2s_path, stream_dir); 2188c2ecf20Sopenharmony_ci 2198c2ecf20Sopenharmony_ci /* reset i2s hw status before enable */ 2208c2ecf20Sopenharmony_ci regmap_update_bits(afe->regmap, i2s_data->i2s_ctrl_reg, 2218c2ecf20Sopenharmony_ci ASYS_I2S_CON_RESET, ASYS_I2S_CON_RESET); 2228c2ecf20Sopenharmony_ci udelay(1); 2238c2ecf20Sopenharmony_ci regmap_update_bits(afe->regmap, i2s_data->i2s_ctrl_reg, 2248c2ecf20Sopenharmony_ci ASYS_I2S_CON_RESET, 0); 2258c2ecf20Sopenharmony_ci udelay(1); 2268c2ecf20Sopenharmony_ci regmap_update_bits(afe->regmap, i2s_data->i2s_ctrl_reg, 2278c2ecf20Sopenharmony_ci ASYS_I2S_CON_I2S_EN, ASYS_I2S_CON_I2S_EN); 2288c2ecf20Sopenharmony_ci return 0; 2298c2ecf20Sopenharmony_ci} 2308c2ecf20Sopenharmony_ci 2318c2ecf20Sopenharmony_cistatic int mt2701_afe_i2s_prepare(struct snd_pcm_substream *substream, 2328c2ecf20Sopenharmony_ci struct snd_soc_dai *dai) 2338c2ecf20Sopenharmony_ci{ 2348c2ecf20Sopenharmony_ci struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai); 2358c2ecf20Sopenharmony_ci struct mt2701_afe_private *afe_priv = afe->platform_priv; 2368c2ecf20Sopenharmony_ci int ret, i2s_num = mt2701_dai_num_to_i2s(afe, dai->id); 2378c2ecf20Sopenharmony_ci struct mt2701_i2s_path *i2s_path; 2388c2ecf20Sopenharmony_ci bool mode = afe_priv->soc->has_one_heart_mode; 2398c2ecf20Sopenharmony_ci 2408c2ecf20Sopenharmony_ci if (i2s_num < 0) 2418c2ecf20Sopenharmony_ci return i2s_num; 2428c2ecf20Sopenharmony_ci 2438c2ecf20Sopenharmony_ci i2s_path = &afe_priv->i2s_path[i2s_num]; 2448c2ecf20Sopenharmony_ci 2458c2ecf20Sopenharmony_ci if (i2s_path->occupied[substream->stream]) 2468c2ecf20Sopenharmony_ci return -EBUSY; 2478c2ecf20Sopenharmony_ci 2488c2ecf20Sopenharmony_ci ret = mt2701_mclk_configuration(afe, mode ? 1 : i2s_num); 2498c2ecf20Sopenharmony_ci if (ret) 2508c2ecf20Sopenharmony_ci return ret; 2518c2ecf20Sopenharmony_ci 2528c2ecf20Sopenharmony_ci i2s_path->occupied[substream->stream] = 1; 2538c2ecf20Sopenharmony_ci 2548c2ecf20Sopenharmony_ci /* need to enable i2s-out path when enable i2s-in */ 2558c2ecf20Sopenharmony_ci if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) 2568c2ecf20Sopenharmony_ci mt2701_i2s_path_enable(afe, i2s_path, !substream->stream, 2578c2ecf20Sopenharmony_ci substream->runtime->rate); 2588c2ecf20Sopenharmony_ci 2598c2ecf20Sopenharmony_ci mt2701_i2s_path_enable(afe, i2s_path, substream->stream, 2608c2ecf20Sopenharmony_ci substream->runtime->rate); 2618c2ecf20Sopenharmony_ci 2628c2ecf20Sopenharmony_ci return 0; 2638c2ecf20Sopenharmony_ci} 2648c2ecf20Sopenharmony_ci 2658c2ecf20Sopenharmony_cistatic int mt2701_afe_i2s_set_sysclk(struct snd_soc_dai *dai, int clk_id, 2668c2ecf20Sopenharmony_ci unsigned int freq, int dir) 2678c2ecf20Sopenharmony_ci{ 2688c2ecf20Sopenharmony_ci struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai); 2698c2ecf20Sopenharmony_ci struct mt2701_afe_private *afe_priv = afe->platform_priv; 2708c2ecf20Sopenharmony_ci int i2s_num = mt2701_dai_num_to_i2s(afe, dai->id); 2718c2ecf20Sopenharmony_ci bool mode = afe_priv->soc->has_one_heart_mode; 2728c2ecf20Sopenharmony_ci 2738c2ecf20Sopenharmony_ci if (i2s_num < 0) 2748c2ecf20Sopenharmony_ci return i2s_num; 2758c2ecf20Sopenharmony_ci 2768c2ecf20Sopenharmony_ci /* mclk */ 2778c2ecf20Sopenharmony_ci if (dir == SND_SOC_CLOCK_IN) { 2788c2ecf20Sopenharmony_ci dev_warn(dai->dev, "The SoCs doesn't support mclk input\n"); 2798c2ecf20Sopenharmony_ci return -EINVAL; 2808c2ecf20Sopenharmony_ci } 2818c2ecf20Sopenharmony_ci 2828c2ecf20Sopenharmony_ci afe_priv->i2s_path[mode ? 1 : i2s_num].mclk_rate = freq; 2838c2ecf20Sopenharmony_ci 2848c2ecf20Sopenharmony_ci return 0; 2858c2ecf20Sopenharmony_ci} 2868c2ecf20Sopenharmony_ci 2878c2ecf20Sopenharmony_cistatic int mt2701_btmrg_startup(struct snd_pcm_substream *substream, 2888c2ecf20Sopenharmony_ci struct snd_soc_dai *dai) 2898c2ecf20Sopenharmony_ci{ 2908c2ecf20Sopenharmony_ci struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai); 2918c2ecf20Sopenharmony_ci struct mt2701_afe_private *afe_priv = afe->platform_priv; 2928c2ecf20Sopenharmony_ci int ret; 2938c2ecf20Sopenharmony_ci 2948c2ecf20Sopenharmony_ci ret = mt2701_enable_btmrg_clk(afe); 2958c2ecf20Sopenharmony_ci if (ret) 2968c2ecf20Sopenharmony_ci return ret; 2978c2ecf20Sopenharmony_ci 2988c2ecf20Sopenharmony_ci afe_priv->mrg_enable[substream->stream] = 1; 2998c2ecf20Sopenharmony_ci 3008c2ecf20Sopenharmony_ci return 0; 3018c2ecf20Sopenharmony_ci} 3028c2ecf20Sopenharmony_ci 3038c2ecf20Sopenharmony_cistatic int mt2701_btmrg_hw_params(struct snd_pcm_substream *substream, 3048c2ecf20Sopenharmony_ci struct snd_pcm_hw_params *params, 3058c2ecf20Sopenharmony_ci struct snd_soc_dai *dai) 3068c2ecf20Sopenharmony_ci{ 3078c2ecf20Sopenharmony_ci struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai); 3088c2ecf20Sopenharmony_ci int stream_fs; 3098c2ecf20Sopenharmony_ci u32 val, msk; 3108c2ecf20Sopenharmony_ci 3118c2ecf20Sopenharmony_ci stream_fs = params_rate(params); 3128c2ecf20Sopenharmony_ci 3138c2ecf20Sopenharmony_ci if (stream_fs != 8000 && stream_fs != 16000) { 3148c2ecf20Sopenharmony_ci dev_err(afe->dev, "unsupported rate %d\n", stream_fs); 3158c2ecf20Sopenharmony_ci return -EINVAL; 3168c2ecf20Sopenharmony_ci } 3178c2ecf20Sopenharmony_ci 3188c2ecf20Sopenharmony_ci regmap_update_bits(afe->regmap, AFE_MRGIF_CON, 3198c2ecf20Sopenharmony_ci AFE_MRGIF_CON_I2S_MODE_MASK, 3208c2ecf20Sopenharmony_ci AFE_MRGIF_CON_I2S_MODE_32K); 3218c2ecf20Sopenharmony_ci 3228c2ecf20Sopenharmony_ci val = AFE_DAIBT_CON0_BT_FUNC_EN | AFE_DAIBT_CON0_BT_FUNC_RDY 3238c2ecf20Sopenharmony_ci | AFE_DAIBT_CON0_MRG_USE; 3248c2ecf20Sopenharmony_ci msk = val; 3258c2ecf20Sopenharmony_ci 3268c2ecf20Sopenharmony_ci if (stream_fs == 16000) 3278c2ecf20Sopenharmony_ci val |= AFE_DAIBT_CON0_BT_WIDE_MODE_EN; 3288c2ecf20Sopenharmony_ci 3298c2ecf20Sopenharmony_ci msk |= AFE_DAIBT_CON0_BT_WIDE_MODE_EN; 3308c2ecf20Sopenharmony_ci 3318c2ecf20Sopenharmony_ci regmap_update_bits(afe->regmap, AFE_DAIBT_CON0, msk, val); 3328c2ecf20Sopenharmony_ci 3338c2ecf20Sopenharmony_ci regmap_update_bits(afe->regmap, AFE_DAIBT_CON0, 3348c2ecf20Sopenharmony_ci AFE_DAIBT_CON0_DAIBT_EN, 3358c2ecf20Sopenharmony_ci AFE_DAIBT_CON0_DAIBT_EN); 3368c2ecf20Sopenharmony_ci regmap_update_bits(afe->regmap, AFE_MRGIF_CON, 3378c2ecf20Sopenharmony_ci AFE_MRGIF_CON_MRG_I2S_EN, 3388c2ecf20Sopenharmony_ci AFE_MRGIF_CON_MRG_I2S_EN); 3398c2ecf20Sopenharmony_ci regmap_update_bits(afe->regmap, AFE_MRGIF_CON, 3408c2ecf20Sopenharmony_ci AFE_MRGIF_CON_MRG_EN, 3418c2ecf20Sopenharmony_ci AFE_MRGIF_CON_MRG_EN); 3428c2ecf20Sopenharmony_ci return 0; 3438c2ecf20Sopenharmony_ci} 3448c2ecf20Sopenharmony_ci 3458c2ecf20Sopenharmony_cistatic void mt2701_btmrg_shutdown(struct snd_pcm_substream *substream, 3468c2ecf20Sopenharmony_ci struct snd_soc_dai *dai) 3478c2ecf20Sopenharmony_ci{ 3488c2ecf20Sopenharmony_ci struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai); 3498c2ecf20Sopenharmony_ci struct mt2701_afe_private *afe_priv = afe->platform_priv; 3508c2ecf20Sopenharmony_ci 3518c2ecf20Sopenharmony_ci /* if the other direction stream is not occupied */ 3528c2ecf20Sopenharmony_ci if (!afe_priv->mrg_enable[!substream->stream]) { 3538c2ecf20Sopenharmony_ci regmap_update_bits(afe->regmap, AFE_DAIBT_CON0, 3548c2ecf20Sopenharmony_ci AFE_DAIBT_CON0_DAIBT_EN, 0); 3558c2ecf20Sopenharmony_ci regmap_update_bits(afe->regmap, AFE_MRGIF_CON, 3568c2ecf20Sopenharmony_ci AFE_MRGIF_CON_MRG_EN, 0); 3578c2ecf20Sopenharmony_ci regmap_update_bits(afe->regmap, AFE_MRGIF_CON, 3588c2ecf20Sopenharmony_ci AFE_MRGIF_CON_MRG_I2S_EN, 0); 3598c2ecf20Sopenharmony_ci mt2701_disable_btmrg_clk(afe); 3608c2ecf20Sopenharmony_ci } 3618c2ecf20Sopenharmony_ci 3628c2ecf20Sopenharmony_ci afe_priv->mrg_enable[substream->stream] = 0; 3638c2ecf20Sopenharmony_ci} 3648c2ecf20Sopenharmony_ci 3658c2ecf20Sopenharmony_cistatic int mt2701_simple_fe_startup(struct snd_pcm_substream *substream, 3668c2ecf20Sopenharmony_ci struct snd_soc_dai *dai) 3678c2ecf20Sopenharmony_ci{ 3688c2ecf20Sopenharmony_ci struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai); 3698c2ecf20Sopenharmony_ci struct mtk_base_afe_memif *memif_tmp; 3708c2ecf20Sopenharmony_ci int stream_dir = substream->stream; 3718c2ecf20Sopenharmony_ci 3728c2ecf20Sopenharmony_ci /* can't run single DL & DLM at the same time */ 3738c2ecf20Sopenharmony_ci if (stream_dir == SNDRV_PCM_STREAM_PLAYBACK) { 3748c2ecf20Sopenharmony_ci memif_tmp = &afe->memif[MT2701_MEMIF_DLM]; 3758c2ecf20Sopenharmony_ci if (memif_tmp->substream) { 3768c2ecf20Sopenharmony_ci dev_warn(afe->dev, "memif is not available"); 3778c2ecf20Sopenharmony_ci return -EBUSY; 3788c2ecf20Sopenharmony_ci } 3798c2ecf20Sopenharmony_ci } 3808c2ecf20Sopenharmony_ci 3818c2ecf20Sopenharmony_ci return mtk_afe_fe_startup(substream, dai); 3828c2ecf20Sopenharmony_ci} 3838c2ecf20Sopenharmony_ci 3848c2ecf20Sopenharmony_cistatic int mt2701_simple_fe_hw_params(struct snd_pcm_substream *substream, 3858c2ecf20Sopenharmony_ci struct snd_pcm_hw_params *params, 3868c2ecf20Sopenharmony_ci struct snd_soc_dai *dai) 3878c2ecf20Sopenharmony_ci{ 3888c2ecf20Sopenharmony_ci struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai); 3898c2ecf20Sopenharmony_ci int stream_dir = substream->stream; 3908c2ecf20Sopenharmony_ci 3918c2ecf20Sopenharmony_ci /* single DL use PAIR_INTERLEAVE */ 3928c2ecf20Sopenharmony_ci if (stream_dir == SNDRV_PCM_STREAM_PLAYBACK) 3938c2ecf20Sopenharmony_ci regmap_update_bits(afe->regmap, 3948c2ecf20Sopenharmony_ci AFE_MEMIF_PBUF_SIZE, 3958c2ecf20Sopenharmony_ci AFE_MEMIF_PBUF_SIZE_DLM_MASK, 3968c2ecf20Sopenharmony_ci AFE_MEMIF_PBUF_SIZE_PAIR_INTERLEAVE); 3978c2ecf20Sopenharmony_ci 3988c2ecf20Sopenharmony_ci return mtk_afe_fe_hw_params(substream, params, dai); 3998c2ecf20Sopenharmony_ci} 4008c2ecf20Sopenharmony_ci 4018c2ecf20Sopenharmony_cistatic int mt2701_dlm_fe_startup(struct snd_pcm_substream *substream, 4028c2ecf20Sopenharmony_ci struct snd_soc_dai *dai) 4038c2ecf20Sopenharmony_ci{ 4048c2ecf20Sopenharmony_ci struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai); 4058c2ecf20Sopenharmony_ci struct mtk_base_afe_memif *memif_tmp; 4068c2ecf20Sopenharmony_ci const struct mtk_base_memif_data *memif_data; 4078c2ecf20Sopenharmony_ci int i; 4088c2ecf20Sopenharmony_ci 4098c2ecf20Sopenharmony_ci for (i = MT2701_MEMIF_DL1; i < MT2701_MEMIF_DL_SINGLE_NUM; ++i) { 4108c2ecf20Sopenharmony_ci memif_tmp = &afe->memif[i]; 4118c2ecf20Sopenharmony_ci if (memif_tmp->substream) 4128c2ecf20Sopenharmony_ci return -EBUSY; 4138c2ecf20Sopenharmony_ci } 4148c2ecf20Sopenharmony_ci 4158c2ecf20Sopenharmony_ci /* enable agent for all signal DL (due to hw design) */ 4168c2ecf20Sopenharmony_ci for (i = MT2701_MEMIF_DL1; i < MT2701_MEMIF_DL_SINGLE_NUM; ++i) { 4178c2ecf20Sopenharmony_ci memif_data = afe->memif[i].data; 4188c2ecf20Sopenharmony_ci regmap_update_bits(afe->regmap, 4198c2ecf20Sopenharmony_ci memif_data->agent_disable_reg, 4208c2ecf20Sopenharmony_ci 1 << memif_data->agent_disable_shift, 4218c2ecf20Sopenharmony_ci 0 << memif_data->agent_disable_shift); 4228c2ecf20Sopenharmony_ci } 4238c2ecf20Sopenharmony_ci 4248c2ecf20Sopenharmony_ci return mtk_afe_fe_startup(substream, dai); 4258c2ecf20Sopenharmony_ci} 4268c2ecf20Sopenharmony_ci 4278c2ecf20Sopenharmony_cistatic void mt2701_dlm_fe_shutdown(struct snd_pcm_substream *substream, 4288c2ecf20Sopenharmony_ci struct snd_soc_dai *dai) 4298c2ecf20Sopenharmony_ci{ 4308c2ecf20Sopenharmony_ci struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai); 4318c2ecf20Sopenharmony_ci const struct mtk_base_memif_data *memif_data; 4328c2ecf20Sopenharmony_ci int i; 4338c2ecf20Sopenharmony_ci 4348c2ecf20Sopenharmony_ci for (i = MT2701_MEMIF_DL1; i < MT2701_MEMIF_DL_SINGLE_NUM; ++i) { 4358c2ecf20Sopenharmony_ci memif_data = afe->memif[i].data; 4368c2ecf20Sopenharmony_ci regmap_update_bits(afe->regmap, 4378c2ecf20Sopenharmony_ci memif_data->agent_disable_reg, 4388c2ecf20Sopenharmony_ci 1 << memif_data->agent_disable_shift, 4398c2ecf20Sopenharmony_ci 1 << memif_data->agent_disable_shift); 4408c2ecf20Sopenharmony_ci } 4418c2ecf20Sopenharmony_ci 4428c2ecf20Sopenharmony_ci return mtk_afe_fe_shutdown(substream, dai); 4438c2ecf20Sopenharmony_ci} 4448c2ecf20Sopenharmony_ci 4458c2ecf20Sopenharmony_cistatic int mt2701_dlm_fe_hw_params(struct snd_pcm_substream *substream, 4468c2ecf20Sopenharmony_ci struct snd_pcm_hw_params *params, 4478c2ecf20Sopenharmony_ci struct snd_soc_dai *dai) 4488c2ecf20Sopenharmony_ci{ 4498c2ecf20Sopenharmony_ci struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai); 4508c2ecf20Sopenharmony_ci int channels = params_channels(params); 4518c2ecf20Sopenharmony_ci 4528c2ecf20Sopenharmony_ci regmap_update_bits(afe->regmap, 4538c2ecf20Sopenharmony_ci AFE_MEMIF_PBUF_SIZE, 4548c2ecf20Sopenharmony_ci AFE_MEMIF_PBUF_SIZE_DLM_MASK, 4558c2ecf20Sopenharmony_ci AFE_MEMIF_PBUF_SIZE_FULL_INTERLEAVE); 4568c2ecf20Sopenharmony_ci regmap_update_bits(afe->regmap, 4578c2ecf20Sopenharmony_ci AFE_MEMIF_PBUF_SIZE, 4588c2ecf20Sopenharmony_ci AFE_MEMIF_PBUF_SIZE_DLM_BYTE_MASK, 4598c2ecf20Sopenharmony_ci AFE_MEMIF_PBUF_SIZE_DLM_32BYTES); 4608c2ecf20Sopenharmony_ci regmap_update_bits(afe->regmap, 4618c2ecf20Sopenharmony_ci AFE_MEMIF_PBUF_SIZE, 4628c2ecf20Sopenharmony_ci AFE_MEMIF_PBUF_SIZE_DLM_CH_MASK, 4638c2ecf20Sopenharmony_ci AFE_MEMIF_PBUF_SIZE_DLM_CH(channels)); 4648c2ecf20Sopenharmony_ci 4658c2ecf20Sopenharmony_ci return mtk_afe_fe_hw_params(substream, params, dai); 4668c2ecf20Sopenharmony_ci} 4678c2ecf20Sopenharmony_ci 4688c2ecf20Sopenharmony_cistatic int mt2701_dlm_fe_trigger(struct snd_pcm_substream *substream, 4698c2ecf20Sopenharmony_ci int cmd, struct snd_soc_dai *dai) 4708c2ecf20Sopenharmony_ci{ 4718c2ecf20Sopenharmony_ci struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai); 4728c2ecf20Sopenharmony_ci struct mtk_base_afe_memif *memif_tmp = &afe->memif[MT2701_MEMIF_DL1]; 4738c2ecf20Sopenharmony_ci 4748c2ecf20Sopenharmony_ci switch (cmd) { 4758c2ecf20Sopenharmony_ci case SNDRV_PCM_TRIGGER_START: 4768c2ecf20Sopenharmony_ci case SNDRV_PCM_TRIGGER_RESUME: 4778c2ecf20Sopenharmony_ci regmap_update_bits(afe->regmap, memif_tmp->data->enable_reg, 4788c2ecf20Sopenharmony_ci 1 << memif_tmp->data->enable_shift, 4798c2ecf20Sopenharmony_ci 1 << memif_tmp->data->enable_shift); 4808c2ecf20Sopenharmony_ci mtk_afe_fe_trigger(substream, cmd, dai); 4818c2ecf20Sopenharmony_ci return 0; 4828c2ecf20Sopenharmony_ci case SNDRV_PCM_TRIGGER_STOP: 4838c2ecf20Sopenharmony_ci case SNDRV_PCM_TRIGGER_SUSPEND: 4848c2ecf20Sopenharmony_ci mtk_afe_fe_trigger(substream, cmd, dai); 4858c2ecf20Sopenharmony_ci regmap_update_bits(afe->regmap, memif_tmp->data->enable_reg, 4868c2ecf20Sopenharmony_ci 1 << memif_tmp->data->enable_shift, 0); 4878c2ecf20Sopenharmony_ci 4888c2ecf20Sopenharmony_ci return 0; 4898c2ecf20Sopenharmony_ci default: 4908c2ecf20Sopenharmony_ci return -EINVAL; 4918c2ecf20Sopenharmony_ci } 4928c2ecf20Sopenharmony_ci} 4938c2ecf20Sopenharmony_ci 4948c2ecf20Sopenharmony_cistatic int mt2701_memif_fs(struct snd_pcm_substream *substream, 4958c2ecf20Sopenharmony_ci unsigned int rate) 4968c2ecf20Sopenharmony_ci{ 4978c2ecf20Sopenharmony_ci struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); 4988c2ecf20Sopenharmony_ci int fs; 4998c2ecf20Sopenharmony_ci 5008c2ecf20Sopenharmony_ci if (asoc_rtd_to_cpu(rtd, 0)->id != MT2701_MEMIF_ULBT) 5018c2ecf20Sopenharmony_ci fs = mt2701_afe_i2s_fs(rate); 5028c2ecf20Sopenharmony_ci else 5038c2ecf20Sopenharmony_ci fs = (rate == 16000 ? 1 : 0); 5048c2ecf20Sopenharmony_ci 5058c2ecf20Sopenharmony_ci return fs; 5068c2ecf20Sopenharmony_ci} 5078c2ecf20Sopenharmony_ci 5088c2ecf20Sopenharmony_cistatic int mt2701_irq_fs(struct snd_pcm_substream *substream, unsigned int rate) 5098c2ecf20Sopenharmony_ci{ 5108c2ecf20Sopenharmony_ci return mt2701_afe_i2s_fs(rate); 5118c2ecf20Sopenharmony_ci} 5128c2ecf20Sopenharmony_ci 5138c2ecf20Sopenharmony_ci/* FE DAIs */ 5148c2ecf20Sopenharmony_cistatic const struct snd_soc_dai_ops mt2701_single_memif_dai_ops = { 5158c2ecf20Sopenharmony_ci .startup = mt2701_simple_fe_startup, 5168c2ecf20Sopenharmony_ci .shutdown = mtk_afe_fe_shutdown, 5178c2ecf20Sopenharmony_ci .hw_params = mt2701_simple_fe_hw_params, 5188c2ecf20Sopenharmony_ci .hw_free = mtk_afe_fe_hw_free, 5198c2ecf20Sopenharmony_ci .prepare = mtk_afe_fe_prepare, 5208c2ecf20Sopenharmony_ci .trigger = mtk_afe_fe_trigger, 5218c2ecf20Sopenharmony_ci}; 5228c2ecf20Sopenharmony_ci 5238c2ecf20Sopenharmony_cistatic const struct snd_soc_dai_ops mt2701_dlm_memif_dai_ops = { 5248c2ecf20Sopenharmony_ci .startup = mt2701_dlm_fe_startup, 5258c2ecf20Sopenharmony_ci .shutdown = mt2701_dlm_fe_shutdown, 5268c2ecf20Sopenharmony_ci .hw_params = mt2701_dlm_fe_hw_params, 5278c2ecf20Sopenharmony_ci .hw_free = mtk_afe_fe_hw_free, 5288c2ecf20Sopenharmony_ci .prepare = mtk_afe_fe_prepare, 5298c2ecf20Sopenharmony_ci .trigger = mt2701_dlm_fe_trigger, 5308c2ecf20Sopenharmony_ci}; 5318c2ecf20Sopenharmony_ci 5328c2ecf20Sopenharmony_ci/* I2S BE DAIs */ 5338c2ecf20Sopenharmony_cistatic const struct snd_soc_dai_ops mt2701_afe_i2s_ops = { 5348c2ecf20Sopenharmony_ci .startup = mt2701_afe_i2s_startup, 5358c2ecf20Sopenharmony_ci .shutdown = mt2701_afe_i2s_shutdown, 5368c2ecf20Sopenharmony_ci .prepare = mt2701_afe_i2s_prepare, 5378c2ecf20Sopenharmony_ci .set_sysclk = mt2701_afe_i2s_set_sysclk, 5388c2ecf20Sopenharmony_ci}; 5398c2ecf20Sopenharmony_ci 5408c2ecf20Sopenharmony_ci/* MRG BE DAIs */ 5418c2ecf20Sopenharmony_cistatic const struct snd_soc_dai_ops mt2701_btmrg_ops = { 5428c2ecf20Sopenharmony_ci .startup = mt2701_btmrg_startup, 5438c2ecf20Sopenharmony_ci .shutdown = mt2701_btmrg_shutdown, 5448c2ecf20Sopenharmony_ci .hw_params = mt2701_btmrg_hw_params, 5458c2ecf20Sopenharmony_ci}; 5468c2ecf20Sopenharmony_ci 5478c2ecf20Sopenharmony_cistatic struct snd_soc_dai_driver mt2701_afe_pcm_dais[] = { 5488c2ecf20Sopenharmony_ci /* FE DAIs: memory intefaces to CPU */ 5498c2ecf20Sopenharmony_ci { 5508c2ecf20Sopenharmony_ci .name = "PCMO0", 5518c2ecf20Sopenharmony_ci .id = MT2701_MEMIF_DL1, 5528c2ecf20Sopenharmony_ci .playback = { 5538c2ecf20Sopenharmony_ci .stream_name = "DL1", 5548c2ecf20Sopenharmony_ci .channels_min = 1, 5558c2ecf20Sopenharmony_ci .channels_max = 2, 5568c2ecf20Sopenharmony_ci .rates = SNDRV_PCM_RATE_8000_192000, 5578c2ecf20Sopenharmony_ci .formats = (SNDRV_PCM_FMTBIT_S16_LE 5588c2ecf20Sopenharmony_ci | SNDRV_PCM_FMTBIT_S24_LE 5598c2ecf20Sopenharmony_ci | SNDRV_PCM_FMTBIT_S32_LE) 5608c2ecf20Sopenharmony_ci }, 5618c2ecf20Sopenharmony_ci .ops = &mt2701_single_memif_dai_ops, 5628c2ecf20Sopenharmony_ci }, 5638c2ecf20Sopenharmony_ci { 5648c2ecf20Sopenharmony_ci .name = "PCM_multi", 5658c2ecf20Sopenharmony_ci .id = MT2701_MEMIF_DLM, 5668c2ecf20Sopenharmony_ci .playback = { 5678c2ecf20Sopenharmony_ci .stream_name = "DLM", 5688c2ecf20Sopenharmony_ci .channels_min = 1, 5698c2ecf20Sopenharmony_ci .channels_max = 8, 5708c2ecf20Sopenharmony_ci .rates = SNDRV_PCM_RATE_8000_192000, 5718c2ecf20Sopenharmony_ci .formats = (SNDRV_PCM_FMTBIT_S16_LE 5728c2ecf20Sopenharmony_ci | SNDRV_PCM_FMTBIT_S24_LE 5738c2ecf20Sopenharmony_ci | SNDRV_PCM_FMTBIT_S32_LE) 5748c2ecf20Sopenharmony_ci 5758c2ecf20Sopenharmony_ci }, 5768c2ecf20Sopenharmony_ci .ops = &mt2701_dlm_memif_dai_ops, 5778c2ecf20Sopenharmony_ci }, 5788c2ecf20Sopenharmony_ci { 5798c2ecf20Sopenharmony_ci .name = "PCM0", 5808c2ecf20Sopenharmony_ci .id = MT2701_MEMIF_UL1, 5818c2ecf20Sopenharmony_ci .capture = { 5828c2ecf20Sopenharmony_ci .stream_name = "UL1", 5838c2ecf20Sopenharmony_ci .channels_min = 1, 5848c2ecf20Sopenharmony_ci .channels_max = 2, 5858c2ecf20Sopenharmony_ci .rates = SNDRV_PCM_RATE_8000_48000, 5868c2ecf20Sopenharmony_ci .formats = (SNDRV_PCM_FMTBIT_S16_LE 5878c2ecf20Sopenharmony_ci | SNDRV_PCM_FMTBIT_S24_LE 5888c2ecf20Sopenharmony_ci | SNDRV_PCM_FMTBIT_S32_LE) 5898c2ecf20Sopenharmony_ci }, 5908c2ecf20Sopenharmony_ci .ops = &mt2701_single_memif_dai_ops, 5918c2ecf20Sopenharmony_ci }, 5928c2ecf20Sopenharmony_ci { 5938c2ecf20Sopenharmony_ci .name = "PCM1", 5948c2ecf20Sopenharmony_ci .id = MT2701_MEMIF_UL2, 5958c2ecf20Sopenharmony_ci .capture = { 5968c2ecf20Sopenharmony_ci .stream_name = "UL2", 5978c2ecf20Sopenharmony_ci .channels_min = 1, 5988c2ecf20Sopenharmony_ci .channels_max = 2, 5998c2ecf20Sopenharmony_ci .rates = SNDRV_PCM_RATE_8000_192000, 6008c2ecf20Sopenharmony_ci .formats = (SNDRV_PCM_FMTBIT_S16_LE 6018c2ecf20Sopenharmony_ci | SNDRV_PCM_FMTBIT_S24_LE 6028c2ecf20Sopenharmony_ci | SNDRV_PCM_FMTBIT_S32_LE) 6038c2ecf20Sopenharmony_ci 6048c2ecf20Sopenharmony_ci }, 6058c2ecf20Sopenharmony_ci .ops = &mt2701_single_memif_dai_ops, 6068c2ecf20Sopenharmony_ci }, 6078c2ecf20Sopenharmony_ci { 6088c2ecf20Sopenharmony_ci .name = "PCM_BT_DL", 6098c2ecf20Sopenharmony_ci .id = MT2701_MEMIF_DLBT, 6108c2ecf20Sopenharmony_ci .playback = { 6118c2ecf20Sopenharmony_ci .stream_name = "DLBT", 6128c2ecf20Sopenharmony_ci .channels_min = 1, 6138c2ecf20Sopenharmony_ci .channels_max = 1, 6148c2ecf20Sopenharmony_ci .rates = (SNDRV_PCM_RATE_8000 6158c2ecf20Sopenharmony_ci | SNDRV_PCM_RATE_16000), 6168c2ecf20Sopenharmony_ci .formats = SNDRV_PCM_FMTBIT_S16_LE, 6178c2ecf20Sopenharmony_ci }, 6188c2ecf20Sopenharmony_ci .ops = &mt2701_single_memif_dai_ops, 6198c2ecf20Sopenharmony_ci }, 6208c2ecf20Sopenharmony_ci { 6218c2ecf20Sopenharmony_ci .name = "PCM_BT_UL", 6228c2ecf20Sopenharmony_ci .id = MT2701_MEMIF_ULBT, 6238c2ecf20Sopenharmony_ci .capture = { 6248c2ecf20Sopenharmony_ci .stream_name = "ULBT", 6258c2ecf20Sopenharmony_ci .channels_min = 1, 6268c2ecf20Sopenharmony_ci .channels_max = 1, 6278c2ecf20Sopenharmony_ci .rates = (SNDRV_PCM_RATE_8000 6288c2ecf20Sopenharmony_ci | SNDRV_PCM_RATE_16000), 6298c2ecf20Sopenharmony_ci .formats = SNDRV_PCM_FMTBIT_S16_LE, 6308c2ecf20Sopenharmony_ci }, 6318c2ecf20Sopenharmony_ci .ops = &mt2701_single_memif_dai_ops, 6328c2ecf20Sopenharmony_ci }, 6338c2ecf20Sopenharmony_ci /* BE DAIs */ 6348c2ecf20Sopenharmony_ci { 6358c2ecf20Sopenharmony_ci .name = "I2S0", 6368c2ecf20Sopenharmony_ci .id = MT2701_IO_I2S, 6378c2ecf20Sopenharmony_ci .playback = { 6388c2ecf20Sopenharmony_ci .stream_name = "I2S0 Playback", 6398c2ecf20Sopenharmony_ci .channels_min = 1, 6408c2ecf20Sopenharmony_ci .channels_max = 2, 6418c2ecf20Sopenharmony_ci .rates = SNDRV_PCM_RATE_8000_192000, 6428c2ecf20Sopenharmony_ci .formats = (SNDRV_PCM_FMTBIT_S16_LE 6438c2ecf20Sopenharmony_ci | SNDRV_PCM_FMTBIT_S24_LE 6448c2ecf20Sopenharmony_ci | SNDRV_PCM_FMTBIT_S32_LE) 6458c2ecf20Sopenharmony_ci 6468c2ecf20Sopenharmony_ci }, 6478c2ecf20Sopenharmony_ci .capture = { 6488c2ecf20Sopenharmony_ci .stream_name = "I2S0 Capture", 6498c2ecf20Sopenharmony_ci .channels_min = 1, 6508c2ecf20Sopenharmony_ci .channels_max = 2, 6518c2ecf20Sopenharmony_ci .rates = SNDRV_PCM_RATE_8000_192000, 6528c2ecf20Sopenharmony_ci .formats = (SNDRV_PCM_FMTBIT_S16_LE 6538c2ecf20Sopenharmony_ci | SNDRV_PCM_FMTBIT_S24_LE 6548c2ecf20Sopenharmony_ci | SNDRV_PCM_FMTBIT_S32_LE) 6558c2ecf20Sopenharmony_ci 6568c2ecf20Sopenharmony_ci }, 6578c2ecf20Sopenharmony_ci .ops = &mt2701_afe_i2s_ops, 6588c2ecf20Sopenharmony_ci .symmetric_rates = 1, 6598c2ecf20Sopenharmony_ci }, 6608c2ecf20Sopenharmony_ci { 6618c2ecf20Sopenharmony_ci .name = "I2S1", 6628c2ecf20Sopenharmony_ci .id = MT2701_IO_2ND_I2S, 6638c2ecf20Sopenharmony_ci .playback = { 6648c2ecf20Sopenharmony_ci .stream_name = "I2S1 Playback", 6658c2ecf20Sopenharmony_ci .channels_min = 1, 6668c2ecf20Sopenharmony_ci .channels_max = 2, 6678c2ecf20Sopenharmony_ci .rates = SNDRV_PCM_RATE_8000_192000, 6688c2ecf20Sopenharmony_ci .formats = (SNDRV_PCM_FMTBIT_S16_LE 6698c2ecf20Sopenharmony_ci | SNDRV_PCM_FMTBIT_S24_LE 6708c2ecf20Sopenharmony_ci | SNDRV_PCM_FMTBIT_S32_LE) 6718c2ecf20Sopenharmony_ci }, 6728c2ecf20Sopenharmony_ci .capture = { 6738c2ecf20Sopenharmony_ci .stream_name = "I2S1 Capture", 6748c2ecf20Sopenharmony_ci .channels_min = 1, 6758c2ecf20Sopenharmony_ci .channels_max = 2, 6768c2ecf20Sopenharmony_ci .rates = SNDRV_PCM_RATE_8000_192000, 6778c2ecf20Sopenharmony_ci .formats = (SNDRV_PCM_FMTBIT_S16_LE 6788c2ecf20Sopenharmony_ci | SNDRV_PCM_FMTBIT_S24_LE 6798c2ecf20Sopenharmony_ci | SNDRV_PCM_FMTBIT_S32_LE) 6808c2ecf20Sopenharmony_ci }, 6818c2ecf20Sopenharmony_ci .ops = &mt2701_afe_i2s_ops, 6828c2ecf20Sopenharmony_ci .symmetric_rates = 1, 6838c2ecf20Sopenharmony_ci }, 6848c2ecf20Sopenharmony_ci { 6858c2ecf20Sopenharmony_ci .name = "I2S2", 6868c2ecf20Sopenharmony_ci .id = MT2701_IO_3RD_I2S, 6878c2ecf20Sopenharmony_ci .playback = { 6888c2ecf20Sopenharmony_ci .stream_name = "I2S2 Playback", 6898c2ecf20Sopenharmony_ci .channels_min = 1, 6908c2ecf20Sopenharmony_ci .channels_max = 2, 6918c2ecf20Sopenharmony_ci .rates = SNDRV_PCM_RATE_8000_192000, 6928c2ecf20Sopenharmony_ci .formats = (SNDRV_PCM_FMTBIT_S16_LE 6938c2ecf20Sopenharmony_ci | SNDRV_PCM_FMTBIT_S24_LE 6948c2ecf20Sopenharmony_ci | SNDRV_PCM_FMTBIT_S32_LE) 6958c2ecf20Sopenharmony_ci }, 6968c2ecf20Sopenharmony_ci .capture = { 6978c2ecf20Sopenharmony_ci .stream_name = "I2S2 Capture", 6988c2ecf20Sopenharmony_ci .channels_min = 1, 6998c2ecf20Sopenharmony_ci .channels_max = 2, 7008c2ecf20Sopenharmony_ci .rates = SNDRV_PCM_RATE_8000_192000, 7018c2ecf20Sopenharmony_ci .formats = (SNDRV_PCM_FMTBIT_S16_LE 7028c2ecf20Sopenharmony_ci | SNDRV_PCM_FMTBIT_S24_LE 7038c2ecf20Sopenharmony_ci | SNDRV_PCM_FMTBIT_S32_LE) 7048c2ecf20Sopenharmony_ci }, 7058c2ecf20Sopenharmony_ci .ops = &mt2701_afe_i2s_ops, 7068c2ecf20Sopenharmony_ci .symmetric_rates = 1, 7078c2ecf20Sopenharmony_ci }, 7088c2ecf20Sopenharmony_ci { 7098c2ecf20Sopenharmony_ci .name = "I2S3", 7108c2ecf20Sopenharmony_ci .id = MT2701_IO_4TH_I2S, 7118c2ecf20Sopenharmony_ci .playback = { 7128c2ecf20Sopenharmony_ci .stream_name = "I2S3 Playback", 7138c2ecf20Sopenharmony_ci .channels_min = 1, 7148c2ecf20Sopenharmony_ci .channels_max = 2, 7158c2ecf20Sopenharmony_ci .rates = SNDRV_PCM_RATE_8000_192000, 7168c2ecf20Sopenharmony_ci .formats = (SNDRV_PCM_FMTBIT_S16_LE 7178c2ecf20Sopenharmony_ci | SNDRV_PCM_FMTBIT_S24_LE 7188c2ecf20Sopenharmony_ci | SNDRV_PCM_FMTBIT_S32_LE) 7198c2ecf20Sopenharmony_ci }, 7208c2ecf20Sopenharmony_ci .capture = { 7218c2ecf20Sopenharmony_ci .stream_name = "I2S3 Capture", 7228c2ecf20Sopenharmony_ci .channels_min = 1, 7238c2ecf20Sopenharmony_ci .channels_max = 2, 7248c2ecf20Sopenharmony_ci .rates = SNDRV_PCM_RATE_8000_192000, 7258c2ecf20Sopenharmony_ci .formats = (SNDRV_PCM_FMTBIT_S16_LE 7268c2ecf20Sopenharmony_ci | SNDRV_PCM_FMTBIT_S24_LE 7278c2ecf20Sopenharmony_ci | SNDRV_PCM_FMTBIT_S32_LE) 7288c2ecf20Sopenharmony_ci }, 7298c2ecf20Sopenharmony_ci .ops = &mt2701_afe_i2s_ops, 7308c2ecf20Sopenharmony_ci .symmetric_rates = 1, 7318c2ecf20Sopenharmony_ci }, 7328c2ecf20Sopenharmony_ci { 7338c2ecf20Sopenharmony_ci .name = "MRG BT", 7348c2ecf20Sopenharmony_ci .id = MT2701_IO_MRG, 7358c2ecf20Sopenharmony_ci .playback = { 7368c2ecf20Sopenharmony_ci .stream_name = "BT Playback", 7378c2ecf20Sopenharmony_ci .channels_min = 1, 7388c2ecf20Sopenharmony_ci .channels_max = 1, 7398c2ecf20Sopenharmony_ci .rates = (SNDRV_PCM_RATE_8000 7408c2ecf20Sopenharmony_ci | SNDRV_PCM_RATE_16000), 7418c2ecf20Sopenharmony_ci .formats = SNDRV_PCM_FMTBIT_S16_LE, 7428c2ecf20Sopenharmony_ci }, 7438c2ecf20Sopenharmony_ci .capture = { 7448c2ecf20Sopenharmony_ci .stream_name = "BT Capture", 7458c2ecf20Sopenharmony_ci .channels_min = 1, 7468c2ecf20Sopenharmony_ci .channels_max = 1, 7478c2ecf20Sopenharmony_ci .rates = (SNDRV_PCM_RATE_8000 7488c2ecf20Sopenharmony_ci | SNDRV_PCM_RATE_16000), 7498c2ecf20Sopenharmony_ci .formats = SNDRV_PCM_FMTBIT_S16_LE, 7508c2ecf20Sopenharmony_ci }, 7518c2ecf20Sopenharmony_ci .ops = &mt2701_btmrg_ops, 7528c2ecf20Sopenharmony_ci .symmetric_rates = 1, 7538c2ecf20Sopenharmony_ci } 7548c2ecf20Sopenharmony_ci}; 7558c2ecf20Sopenharmony_ci 7568c2ecf20Sopenharmony_cistatic const struct snd_kcontrol_new mt2701_afe_o00_mix[] = { 7578c2ecf20Sopenharmony_ci SOC_DAPM_SINGLE_AUTODISABLE("I00 Switch", AFE_CONN0, 0, 1, 0), 7588c2ecf20Sopenharmony_ci}; 7598c2ecf20Sopenharmony_ci 7608c2ecf20Sopenharmony_cistatic const struct snd_kcontrol_new mt2701_afe_o01_mix[] = { 7618c2ecf20Sopenharmony_ci SOC_DAPM_SINGLE_AUTODISABLE("I01 Switch", AFE_CONN1, 1, 1, 0), 7628c2ecf20Sopenharmony_ci}; 7638c2ecf20Sopenharmony_ci 7648c2ecf20Sopenharmony_cistatic const struct snd_kcontrol_new mt2701_afe_o02_mix[] = { 7658c2ecf20Sopenharmony_ci SOC_DAPM_SINGLE_AUTODISABLE("I02 Switch", AFE_CONN2, 2, 1, 0), 7668c2ecf20Sopenharmony_ci}; 7678c2ecf20Sopenharmony_ci 7688c2ecf20Sopenharmony_cistatic const struct snd_kcontrol_new mt2701_afe_o03_mix[] = { 7698c2ecf20Sopenharmony_ci SOC_DAPM_SINGLE_AUTODISABLE("I03 Switch", AFE_CONN3, 3, 1, 0), 7708c2ecf20Sopenharmony_ci}; 7718c2ecf20Sopenharmony_ci 7728c2ecf20Sopenharmony_cistatic const struct snd_kcontrol_new mt2701_afe_o14_mix[] = { 7738c2ecf20Sopenharmony_ci SOC_DAPM_SINGLE_AUTODISABLE("I26 Switch", AFE_CONN14, 26, 1, 0), 7748c2ecf20Sopenharmony_ci}; 7758c2ecf20Sopenharmony_ci 7768c2ecf20Sopenharmony_cistatic const struct snd_kcontrol_new mt2701_afe_o15_mix[] = { 7778c2ecf20Sopenharmony_ci SOC_DAPM_SINGLE_AUTODISABLE("I12 Switch", AFE_CONN15, 12, 1, 0), 7788c2ecf20Sopenharmony_ci}; 7798c2ecf20Sopenharmony_ci 7808c2ecf20Sopenharmony_cistatic const struct snd_kcontrol_new mt2701_afe_o16_mix[] = { 7818c2ecf20Sopenharmony_ci SOC_DAPM_SINGLE_AUTODISABLE("I13 Switch", AFE_CONN16, 13, 1, 0), 7828c2ecf20Sopenharmony_ci}; 7838c2ecf20Sopenharmony_ci 7848c2ecf20Sopenharmony_cistatic const struct snd_kcontrol_new mt2701_afe_o17_mix[] = { 7858c2ecf20Sopenharmony_ci SOC_DAPM_SINGLE_AUTODISABLE("I14 Switch", AFE_CONN17, 14, 1, 0), 7868c2ecf20Sopenharmony_ci}; 7878c2ecf20Sopenharmony_ci 7888c2ecf20Sopenharmony_cistatic const struct snd_kcontrol_new mt2701_afe_o18_mix[] = { 7898c2ecf20Sopenharmony_ci SOC_DAPM_SINGLE_AUTODISABLE("I15 Switch", AFE_CONN18, 15, 1, 0), 7908c2ecf20Sopenharmony_ci}; 7918c2ecf20Sopenharmony_ci 7928c2ecf20Sopenharmony_cistatic const struct snd_kcontrol_new mt2701_afe_o19_mix[] = { 7938c2ecf20Sopenharmony_ci SOC_DAPM_SINGLE_AUTODISABLE("I16 Switch", AFE_CONN19, 16, 1, 0), 7948c2ecf20Sopenharmony_ci}; 7958c2ecf20Sopenharmony_ci 7968c2ecf20Sopenharmony_cistatic const struct snd_kcontrol_new mt2701_afe_o20_mix[] = { 7978c2ecf20Sopenharmony_ci SOC_DAPM_SINGLE_AUTODISABLE("I17 Switch", AFE_CONN20, 17, 1, 0), 7988c2ecf20Sopenharmony_ci}; 7998c2ecf20Sopenharmony_ci 8008c2ecf20Sopenharmony_cistatic const struct snd_kcontrol_new mt2701_afe_o21_mix[] = { 8018c2ecf20Sopenharmony_ci SOC_DAPM_SINGLE_AUTODISABLE("I18 Switch", AFE_CONN21, 18, 1, 0), 8028c2ecf20Sopenharmony_ci}; 8038c2ecf20Sopenharmony_ci 8048c2ecf20Sopenharmony_cistatic const struct snd_kcontrol_new mt2701_afe_o22_mix[] = { 8058c2ecf20Sopenharmony_ci SOC_DAPM_SINGLE_AUTODISABLE("I19 Switch", AFE_CONN22, 19, 1, 0), 8068c2ecf20Sopenharmony_ci}; 8078c2ecf20Sopenharmony_ci 8088c2ecf20Sopenharmony_cistatic const struct snd_kcontrol_new mt2701_afe_o31_mix[] = { 8098c2ecf20Sopenharmony_ci SOC_DAPM_SINGLE_AUTODISABLE("I35 Switch", AFE_CONN41, 9, 1, 0), 8108c2ecf20Sopenharmony_ci}; 8118c2ecf20Sopenharmony_ci 8128c2ecf20Sopenharmony_cistatic const struct snd_kcontrol_new mt2701_afe_i02_mix[] = { 8138c2ecf20Sopenharmony_ci SOC_DAPM_SINGLE("I2S0 Switch", SND_SOC_NOPM, 0, 1, 0), 8148c2ecf20Sopenharmony_ci}; 8158c2ecf20Sopenharmony_ci 8168c2ecf20Sopenharmony_cistatic const struct snd_kcontrol_new mt2701_afe_multi_ch_out_i2s0[] = { 8178c2ecf20Sopenharmony_ci SOC_DAPM_SINGLE_AUTODISABLE("Multich I2S0 Out Switch", 8188c2ecf20Sopenharmony_ci ASYS_I2SO1_CON, 26, 1, 0), 8198c2ecf20Sopenharmony_ci}; 8208c2ecf20Sopenharmony_ci 8218c2ecf20Sopenharmony_cistatic const struct snd_kcontrol_new mt2701_afe_multi_ch_out_i2s1[] = { 8228c2ecf20Sopenharmony_ci SOC_DAPM_SINGLE_AUTODISABLE("Multich I2S1 Out Switch", 8238c2ecf20Sopenharmony_ci ASYS_I2SO2_CON, 26, 1, 0), 8248c2ecf20Sopenharmony_ci}; 8258c2ecf20Sopenharmony_ci 8268c2ecf20Sopenharmony_cistatic const struct snd_kcontrol_new mt2701_afe_multi_ch_out_i2s2[] = { 8278c2ecf20Sopenharmony_ci SOC_DAPM_SINGLE_AUTODISABLE("Multich I2S2 Out Switch", 8288c2ecf20Sopenharmony_ci PWR2_TOP_CON, 17, 1, 0), 8298c2ecf20Sopenharmony_ci}; 8308c2ecf20Sopenharmony_ci 8318c2ecf20Sopenharmony_cistatic const struct snd_kcontrol_new mt2701_afe_multi_ch_out_i2s3[] = { 8328c2ecf20Sopenharmony_ci SOC_DAPM_SINGLE_AUTODISABLE("Multich I2S3 Out Switch", 8338c2ecf20Sopenharmony_ci PWR2_TOP_CON, 18, 1, 0), 8348c2ecf20Sopenharmony_ci}; 8358c2ecf20Sopenharmony_ci 8368c2ecf20Sopenharmony_cistatic const struct snd_soc_dapm_widget mt2701_afe_pcm_widgets[] = { 8378c2ecf20Sopenharmony_ci /* inter-connections */ 8388c2ecf20Sopenharmony_ci SND_SOC_DAPM_MIXER("I00", SND_SOC_NOPM, 0, 0, NULL, 0), 8398c2ecf20Sopenharmony_ci SND_SOC_DAPM_MIXER("I01", SND_SOC_NOPM, 0, 0, NULL, 0), 8408c2ecf20Sopenharmony_ci SND_SOC_DAPM_MIXER("I02", SND_SOC_NOPM, 0, 0, mt2701_afe_i02_mix, 8418c2ecf20Sopenharmony_ci ARRAY_SIZE(mt2701_afe_i02_mix)), 8428c2ecf20Sopenharmony_ci SND_SOC_DAPM_MIXER("I03", SND_SOC_NOPM, 0, 0, NULL, 0), 8438c2ecf20Sopenharmony_ci SND_SOC_DAPM_MIXER("I12", SND_SOC_NOPM, 0, 0, NULL, 0), 8448c2ecf20Sopenharmony_ci SND_SOC_DAPM_MIXER("I13", SND_SOC_NOPM, 0, 0, NULL, 0), 8458c2ecf20Sopenharmony_ci SND_SOC_DAPM_MIXER("I14", SND_SOC_NOPM, 0, 0, NULL, 0), 8468c2ecf20Sopenharmony_ci SND_SOC_DAPM_MIXER("I15", SND_SOC_NOPM, 0, 0, NULL, 0), 8478c2ecf20Sopenharmony_ci SND_SOC_DAPM_MIXER("I16", SND_SOC_NOPM, 0, 0, NULL, 0), 8488c2ecf20Sopenharmony_ci SND_SOC_DAPM_MIXER("I17", SND_SOC_NOPM, 0, 0, NULL, 0), 8498c2ecf20Sopenharmony_ci SND_SOC_DAPM_MIXER("I18", SND_SOC_NOPM, 0, 0, NULL, 0), 8508c2ecf20Sopenharmony_ci SND_SOC_DAPM_MIXER("I19", SND_SOC_NOPM, 0, 0, NULL, 0), 8518c2ecf20Sopenharmony_ci SND_SOC_DAPM_MIXER("I26", SND_SOC_NOPM, 0, 0, NULL, 0), 8528c2ecf20Sopenharmony_ci SND_SOC_DAPM_MIXER("I35", SND_SOC_NOPM, 0, 0, NULL, 0), 8538c2ecf20Sopenharmony_ci 8548c2ecf20Sopenharmony_ci SND_SOC_DAPM_MIXER("O00", SND_SOC_NOPM, 0, 0, mt2701_afe_o00_mix, 8558c2ecf20Sopenharmony_ci ARRAY_SIZE(mt2701_afe_o00_mix)), 8568c2ecf20Sopenharmony_ci SND_SOC_DAPM_MIXER("O01", SND_SOC_NOPM, 0, 0, mt2701_afe_o01_mix, 8578c2ecf20Sopenharmony_ci ARRAY_SIZE(mt2701_afe_o01_mix)), 8588c2ecf20Sopenharmony_ci SND_SOC_DAPM_MIXER("O02", SND_SOC_NOPM, 0, 0, mt2701_afe_o02_mix, 8598c2ecf20Sopenharmony_ci ARRAY_SIZE(mt2701_afe_o02_mix)), 8608c2ecf20Sopenharmony_ci SND_SOC_DAPM_MIXER("O03", SND_SOC_NOPM, 0, 0, mt2701_afe_o03_mix, 8618c2ecf20Sopenharmony_ci ARRAY_SIZE(mt2701_afe_o03_mix)), 8628c2ecf20Sopenharmony_ci SND_SOC_DAPM_MIXER("O14", SND_SOC_NOPM, 0, 0, mt2701_afe_o14_mix, 8638c2ecf20Sopenharmony_ci ARRAY_SIZE(mt2701_afe_o14_mix)), 8648c2ecf20Sopenharmony_ci SND_SOC_DAPM_MIXER("O15", SND_SOC_NOPM, 0, 0, mt2701_afe_o15_mix, 8658c2ecf20Sopenharmony_ci ARRAY_SIZE(mt2701_afe_o15_mix)), 8668c2ecf20Sopenharmony_ci SND_SOC_DAPM_MIXER("O16", SND_SOC_NOPM, 0, 0, mt2701_afe_o16_mix, 8678c2ecf20Sopenharmony_ci ARRAY_SIZE(mt2701_afe_o16_mix)), 8688c2ecf20Sopenharmony_ci SND_SOC_DAPM_MIXER("O17", SND_SOC_NOPM, 0, 0, mt2701_afe_o17_mix, 8698c2ecf20Sopenharmony_ci ARRAY_SIZE(mt2701_afe_o17_mix)), 8708c2ecf20Sopenharmony_ci SND_SOC_DAPM_MIXER("O18", SND_SOC_NOPM, 0, 0, mt2701_afe_o18_mix, 8718c2ecf20Sopenharmony_ci ARRAY_SIZE(mt2701_afe_o18_mix)), 8728c2ecf20Sopenharmony_ci SND_SOC_DAPM_MIXER("O19", SND_SOC_NOPM, 0, 0, mt2701_afe_o19_mix, 8738c2ecf20Sopenharmony_ci ARRAY_SIZE(mt2701_afe_o19_mix)), 8748c2ecf20Sopenharmony_ci SND_SOC_DAPM_MIXER("O20", SND_SOC_NOPM, 0, 0, mt2701_afe_o20_mix, 8758c2ecf20Sopenharmony_ci ARRAY_SIZE(mt2701_afe_o20_mix)), 8768c2ecf20Sopenharmony_ci SND_SOC_DAPM_MIXER("O21", SND_SOC_NOPM, 0, 0, mt2701_afe_o21_mix, 8778c2ecf20Sopenharmony_ci ARRAY_SIZE(mt2701_afe_o21_mix)), 8788c2ecf20Sopenharmony_ci SND_SOC_DAPM_MIXER("O22", SND_SOC_NOPM, 0, 0, mt2701_afe_o22_mix, 8798c2ecf20Sopenharmony_ci ARRAY_SIZE(mt2701_afe_o22_mix)), 8808c2ecf20Sopenharmony_ci SND_SOC_DAPM_MIXER("O31", SND_SOC_NOPM, 0, 0, mt2701_afe_o31_mix, 8818c2ecf20Sopenharmony_ci ARRAY_SIZE(mt2701_afe_o31_mix)), 8828c2ecf20Sopenharmony_ci 8838c2ecf20Sopenharmony_ci SND_SOC_DAPM_MIXER("I12I13", SND_SOC_NOPM, 0, 0, 8848c2ecf20Sopenharmony_ci mt2701_afe_multi_ch_out_i2s0, 8858c2ecf20Sopenharmony_ci ARRAY_SIZE(mt2701_afe_multi_ch_out_i2s0)), 8868c2ecf20Sopenharmony_ci SND_SOC_DAPM_MIXER("I14I15", SND_SOC_NOPM, 0, 0, 8878c2ecf20Sopenharmony_ci mt2701_afe_multi_ch_out_i2s1, 8888c2ecf20Sopenharmony_ci ARRAY_SIZE(mt2701_afe_multi_ch_out_i2s1)), 8898c2ecf20Sopenharmony_ci SND_SOC_DAPM_MIXER("I16I17", SND_SOC_NOPM, 0, 0, 8908c2ecf20Sopenharmony_ci mt2701_afe_multi_ch_out_i2s2, 8918c2ecf20Sopenharmony_ci ARRAY_SIZE(mt2701_afe_multi_ch_out_i2s2)), 8928c2ecf20Sopenharmony_ci SND_SOC_DAPM_MIXER("I18I19", SND_SOC_NOPM, 0, 0, 8938c2ecf20Sopenharmony_ci mt2701_afe_multi_ch_out_i2s3, 8948c2ecf20Sopenharmony_ci ARRAY_SIZE(mt2701_afe_multi_ch_out_i2s3)), 8958c2ecf20Sopenharmony_ci}; 8968c2ecf20Sopenharmony_ci 8978c2ecf20Sopenharmony_cistatic const struct snd_soc_dapm_route mt2701_afe_pcm_routes[] = { 8988c2ecf20Sopenharmony_ci {"I12", NULL, "DL1"}, 8998c2ecf20Sopenharmony_ci {"I13", NULL, "DL1"}, 9008c2ecf20Sopenharmony_ci {"I35", NULL, "DLBT"}, 9018c2ecf20Sopenharmony_ci 9028c2ecf20Sopenharmony_ci {"I2S0 Playback", NULL, "O15"}, 9038c2ecf20Sopenharmony_ci {"I2S0 Playback", NULL, "O16"}, 9048c2ecf20Sopenharmony_ci {"I2S1 Playback", NULL, "O17"}, 9058c2ecf20Sopenharmony_ci {"I2S1 Playback", NULL, "O18"}, 9068c2ecf20Sopenharmony_ci {"I2S2 Playback", NULL, "O19"}, 9078c2ecf20Sopenharmony_ci {"I2S2 Playback", NULL, "O20"}, 9088c2ecf20Sopenharmony_ci {"I2S3 Playback", NULL, "O21"}, 9098c2ecf20Sopenharmony_ci {"I2S3 Playback", NULL, "O22"}, 9108c2ecf20Sopenharmony_ci {"BT Playback", NULL, "O31"}, 9118c2ecf20Sopenharmony_ci 9128c2ecf20Sopenharmony_ci {"UL1", NULL, "O00"}, 9138c2ecf20Sopenharmony_ci {"UL1", NULL, "O01"}, 9148c2ecf20Sopenharmony_ci {"UL2", NULL, "O02"}, 9158c2ecf20Sopenharmony_ci {"UL2", NULL, "O03"}, 9168c2ecf20Sopenharmony_ci {"ULBT", NULL, "O14"}, 9178c2ecf20Sopenharmony_ci 9188c2ecf20Sopenharmony_ci {"I00", NULL, "I2S0 Capture"}, 9198c2ecf20Sopenharmony_ci {"I01", NULL, "I2S0 Capture"}, 9208c2ecf20Sopenharmony_ci {"I02", NULL, "I2S1 Capture"}, 9218c2ecf20Sopenharmony_ci {"I03", NULL, "I2S1 Capture"}, 9228c2ecf20Sopenharmony_ci /* I02,03 link to UL2, also need to open I2S0 */ 9238c2ecf20Sopenharmony_ci {"I02", "I2S0 Switch", "I2S0 Capture"}, 9248c2ecf20Sopenharmony_ci 9258c2ecf20Sopenharmony_ci {"I26", NULL, "BT Capture"}, 9268c2ecf20Sopenharmony_ci 9278c2ecf20Sopenharmony_ci {"I12I13", "Multich I2S0 Out Switch", "DLM"}, 9288c2ecf20Sopenharmony_ci {"I14I15", "Multich I2S1 Out Switch", "DLM"}, 9298c2ecf20Sopenharmony_ci {"I16I17", "Multich I2S2 Out Switch", "DLM"}, 9308c2ecf20Sopenharmony_ci {"I18I19", "Multich I2S3 Out Switch", "DLM"}, 9318c2ecf20Sopenharmony_ci 9328c2ecf20Sopenharmony_ci { "I12", NULL, "I12I13" }, 9338c2ecf20Sopenharmony_ci { "I13", NULL, "I12I13" }, 9348c2ecf20Sopenharmony_ci { "I14", NULL, "I14I15" }, 9358c2ecf20Sopenharmony_ci { "I15", NULL, "I14I15" }, 9368c2ecf20Sopenharmony_ci { "I16", NULL, "I16I17" }, 9378c2ecf20Sopenharmony_ci { "I17", NULL, "I16I17" }, 9388c2ecf20Sopenharmony_ci { "I18", NULL, "I18I19" }, 9398c2ecf20Sopenharmony_ci { "I19", NULL, "I18I19" }, 9408c2ecf20Sopenharmony_ci 9418c2ecf20Sopenharmony_ci { "O00", "I00 Switch", "I00" }, 9428c2ecf20Sopenharmony_ci { "O01", "I01 Switch", "I01" }, 9438c2ecf20Sopenharmony_ci { "O02", "I02 Switch", "I02" }, 9448c2ecf20Sopenharmony_ci { "O03", "I03 Switch", "I03" }, 9458c2ecf20Sopenharmony_ci { "O14", "I26 Switch", "I26" }, 9468c2ecf20Sopenharmony_ci { "O15", "I12 Switch", "I12" }, 9478c2ecf20Sopenharmony_ci { "O16", "I13 Switch", "I13" }, 9488c2ecf20Sopenharmony_ci { "O17", "I14 Switch", "I14" }, 9498c2ecf20Sopenharmony_ci { "O18", "I15 Switch", "I15" }, 9508c2ecf20Sopenharmony_ci { "O19", "I16 Switch", "I16" }, 9518c2ecf20Sopenharmony_ci { "O20", "I17 Switch", "I17" }, 9528c2ecf20Sopenharmony_ci { "O21", "I18 Switch", "I18" }, 9538c2ecf20Sopenharmony_ci { "O22", "I19 Switch", "I19" }, 9548c2ecf20Sopenharmony_ci { "O31", "I35 Switch", "I35" }, 9558c2ecf20Sopenharmony_ci}; 9568c2ecf20Sopenharmony_ci 9578c2ecf20Sopenharmony_cistatic int mt2701_afe_pcm_probe(struct snd_soc_component *component) 9588c2ecf20Sopenharmony_ci{ 9598c2ecf20Sopenharmony_ci struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component); 9608c2ecf20Sopenharmony_ci 9618c2ecf20Sopenharmony_ci snd_soc_component_init_regmap(component, afe->regmap); 9628c2ecf20Sopenharmony_ci 9638c2ecf20Sopenharmony_ci return 0; 9648c2ecf20Sopenharmony_ci} 9658c2ecf20Sopenharmony_ci 9668c2ecf20Sopenharmony_cistatic const struct snd_soc_component_driver mt2701_afe_pcm_dai_component = { 9678c2ecf20Sopenharmony_ci .probe = mt2701_afe_pcm_probe, 9688c2ecf20Sopenharmony_ci .name = "mt2701-afe-pcm-dai", 9698c2ecf20Sopenharmony_ci .dapm_widgets = mt2701_afe_pcm_widgets, 9708c2ecf20Sopenharmony_ci .num_dapm_widgets = ARRAY_SIZE(mt2701_afe_pcm_widgets), 9718c2ecf20Sopenharmony_ci .dapm_routes = mt2701_afe_pcm_routes, 9728c2ecf20Sopenharmony_ci .num_dapm_routes = ARRAY_SIZE(mt2701_afe_pcm_routes), 9738c2ecf20Sopenharmony_ci .suspend = mtk_afe_suspend, 9748c2ecf20Sopenharmony_ci .resume = mtk_afe_resume, 9758c2ecf20Sopenharmony_ci}; 9768c2ecf20Sopenharmony_ci 9778c2ecf20Sopenharmony_cistatic const struct mtk_base_memif_data memif_data[MT2701_MEMIF_NUM] = { 9788c2ecf20Sopenharmony_ci { 9798c2ecf20Sopenharmony_ci .name = "DL1", 9808c2ecf20Sopenharmony_ci .id = MT2701_MEMIF_DL1, 9818c2ecf20Sopenharmony_ci .reg_ofs_base = AFE_DL1_BASE, 9828c2ecf20Sopenharmony_ci .reg_ofs_cur = AFE_DL1_CUR, 9838c2ecf20Sopenharmony_ci .fs_reg = AFE_DAC_CON1, 9848c2ecf20Sopenharmony_ci .fs_shift = 0, 9858c2ecf20Sopenharmony_ci .fs_maskbit = 0x1f, 9868c2ecf20Sopenharmony_ci .mono_reg = AFE_DAC_CON3, 9878c2ecf20Sopenharmony_ci .mono_shift = 16, 9888c2ecf20Sopenharmony_ci .enable_reg = AFE_DAC_CON0, 9898c2ecf20Sopenharmony_ci .enable_shift = 1, 9908c2ecf20Sopenharmony_ci .hd_reg = AFE_MEMIF_HD_CON0, 9918c2ecf20Sopenharmony_ci .hd_shift = 0, 9928c2ecf20Sopenharmony_ci .agent_disable_reg = AUDIO_TOP_CON5, 9938c2ecf20Sopenharmony_ci .agent_disable_shift = 6, 9948c2ecf20Sopenharmony_ci .msb_reg = -1, 9958c2ecf20Sopenharmony_ci }, 9968c2ecf20Sopenharmony_ci { 9978c2ecf20Sopenharmony_ci .name = "DL2", 9988c2ecf20Sopenharmony_ci .id = MT2701_MEMIF_DL2, 9998c2ecf20Sopenharmony_ci .reg_ofs_base = AFE_DL2_BASE, 10008c2ecf20Sopenharmony_ci .reg_ofs_cur = AFE_DL2_CUR, 10018c2ecf20Sopenharmony_ci .fs_reg = AFE_DAC_CON1, 10028c2ecf20Sopenharmony_ci .fs_shift = 5, 10038c2ecf20Sopenharmony_ci .fs_maskbit = 0x1f, 10048c2ecf20Sopenharmony_ci .mono_reg = AFE_DAC_CON3, 10058c2ecf20Sopenharmony_ci .mono_shift = 17, 10068c2ecf20Sopenharmony_ci .enable_reg = AFE_DAC_CON0, 10078c2ecf20Sopenharmony_ci .enable_shift = 2, 10088c2ecf20Sopenharmony_ci .hd_reg = AFE_MEMIF_HD_CON0, 10098c2ecf20Sopenharmony_ci .hd_shift = 2, 10108c2ecf20Sopenharmony_ci .agent_disable_reg = AUDIO_TOP_CON5, 10118c2ecf20Sopenharmony_ci .agent_disable_shift = 7, 10128c2ecf20Sopenharmony_ci .msb_reg = -1, 10138c2ecf20Sopenharmony_ci }, 10148c2ecf20Sopenharmony_ci { 10158c2ecf20Sopenharmony_ci .name = "DL3", 10168c2ecf20Sopenharmony_ci .id = MT2701_MEMIF_DL3, 10178c2ecf20Sopenharmony_ci .reg_ofs_base = AFE_DL3_BASE, 10188c2ecf20Sopenharmony_ci .reg_ofs_cur = AFE_DL3_CUR, 10198c2ecf20Sopenharmony_ci .fs_reg = AFE_DAC_CON1, 10208c2ecf20Sopenharmony_ci .fs_shift = 10, 10218c2ecf20Sopenharmony_ci .fs_maskbit = 0x1f, 10228c2ecf20Sopenharmony_ci .mono_reg = AFE_DAC_CON3, 10238c2ecf20Sopenharmony_ci .mono_shift = 18, 10248c2ecf20Sopenharmony_ci .enable_reg = AFE_DAC_CON0, 10258c2ecf20Sopenharmony_ci .enable_shift = 3, 10268c2ecf20Sopenharmony_ci .hd_reg = AFE_MEMIF_HD_CON0, 10278c2ecf20Sopenharmony_ci .hd_shift = 4, 10288c2ecf20Sopenharmony_ci .agent_disable_reg = AUDIO_TOP_CON5, 10298c2ecf20Sopenharmony_ci .agent_disable_shift = 8, 10308c2ecf20Sopenharmony_ci .msb_reg = -1, 10318c2ecf20Sopenharmony_ci }, 10328c2ecf20Sopenharmony_ci { 10338c2ecf20Sopenharmony_ci .name = "DL4", 10348c2ecf20Sopenharmony_ci .id = MT2701_MEMIF_DL4, 10358c2ecf20Sopenharmony_ci .reg_ofs_base = AFE_DL4_BASE, 10368c2ecf20Sopenharmony_ci .reg_ofs_cur = AFE_DL4_CUR, 10378c2ecf20Sopenharmony_ci .fs_reg = AFE_DAC_CON1, 10388c2ecf20Sopenharmony_ci .fs_shift = 15, 10398c2ecf20Sopenharmony_ci .fs_maskbit = 0x1f, 10408c2ecf20Sopenharmony_ci .mono_reg = AFE_DAC_CON3, 10418c2ecf20Sopenharmony_ci .mono_shift = 19, 10428c2ecf20Sopenharmony_ci .enable_reg = AFE_DAC_CON0, 10438c2ecf20Sopenharmony_ci .enable_shift = 4, 10448c2ecf20Sopenharmony_ci .hd_reg = AFE_MEMIF_HD_CON0, 10458c2ecf20Sopenharmony_ci .hd_shift = 6, 10468c2ecf20Sopenharmony_ci .agent_disable_reg = AUDIO_TOP_CON5, 10478c2ecf20Sopenharmony_ci .agent_disable_shift = 9, 10488c2ecf20Sopenharmony_ci .msb_reg = -1, 10498c2ecf20Sopenharmony_ci }, 10508c2ecf20Sopenharmony_ci { 10518c2ecf20Sopenharmony_ci .name = "DL5", 10528c2ecf20Sopenharmony_ci .id = MT2701_MEMIF_DL5, 10538c2ecf20Sopenharmony_ci .reg_ofs_base = AFE_DL5_BASE, 10548c2ecf20Sopenharmony_ci .reg_ofs_cur = AFE_DL5_CUR, 10558c2ecf20Sopenharmony_ci .fs_reg = AFE_DAC_CON1, 10568c2ecf20Sopenharmony_ci .fs_shift = 20, 10578c2ecf20Sopenharmony_ci .fs_maskbit = 0x1f, 10588c2ecf20Sopenharmony_ci .mono_reg = AFE_DAC_CON3, 10598c2ecf20Sopenharmony_ci .mono_shift = 20, 10608c2ecf20Sopenharmony_ci .enable_reg = AFE_DAC_CON0, 10618c2ecf20Sopenharmony_ci .enable_shift = 5, 10628c2ecf20Sopenharmony_ci .hd_reg = AFE_MEMIF_HD_CON0, 10638c2ecf20Sopenharmony_ci .hd_shift = 8, 10648c2ecf20Sopenharmony_ci .agent_disable_reg = AUDIO_TOP_CON5, 10658c2ecf20Sopenharmony_ci .agent_disable_shift = 10, 10668c2ecf20Sopenharmony_ci .msb_reg = -1, 10678c2ecf20Sopenharmony_ci }, 10688c2ecf20Sopenharmony_ci { 10698c2ecf20Sopenharmony_ci .name = "DLM", 10708c2ecf20Sopenharmony_ci .id = MT2701_MEMIF_DLM, 10718c2ecf20Sopenharmony_ci .reg_ofs_base = AFE_DLMCH_BASE, 10728c2ecf20Sopenharmony_ci .reg_ofs_cur = AFE_DLMCH_CUR, 10738c2ecf20Sopenharmony_ci .fs_reg = AFE_DAC_CON1, 10748c2ecf20Sopenharmony_ci .fs_shift = 0, 10758c2ecf20Sopenharmony_ci .fs_maskbit = 0x1f, 10768c2ecf20Sopenharmony_ci .mono_reg = -1, 10778c2ecf20Sopenharmony_ci .mono_shift = -1, 10788c2ecf20Sopenharmony_ci .enable_reg = AFE_DAC_CON0, 10798c2ecf20Sopenharmony_ci .enable_shift = 7, 10808c2ecf20Sopenharmony_ci .hd_reg = AFE_MEMIF_PBUF_SIZE, 10818c2ecf20Sopenharmony_ci .hd_shift = 28, 10828c2ecf20Sopenharmony_ci .agent_disable_reg = AUDIO_TOP_CON5, 10838c2ecf20Sopenharmony_ci .agent_disable_shift = 12, 10848c2ecf20Sopenharmony_ci .msb_reg = -1, 10858c2ecf20Sopenharmony_ci }, 10868c2ecf20Sopenharmony_ci { 10878c2ecf20Sopenharmony_ci .name = "UL1", 10888c2ecf20Sopenharmony_ci .id = MT2701_MEMIF_UL1, 10898c2ecf20Sopenharmony_ci .reg_ofs_base = AFE_VUL_BASE, 10908c2ecf20Sopenharmony_ci .reg_ofs_cur = AFE_VUL_CUR, 10918c2ecf20Sopenharmony_ci .fs_reg = AFE_DAC_CON2, 10928c2ecf20Sopenharmony_ci .fs_shift = 0, 10938c2ecf20Sopenharmony_ci .fs_maskbit = 0x1f, 10948c2ecf20Sopenharmony_ci .mono_reg = AFE_DAC_CON4, 10958c2ecf20Sopenharmony_ci .mono_shift = 0, 10968c2ecf20Sopenharmony_ci .enable_reg = AFE_DAC_CON0, 10978c2ecf20Sopenharmony_ci .enable_shift = 10, 10988c2ecf20Sopenharmony_ci .hd_reg = AFE_MEMIF_HD_CON1, 10998c2ecf20Sopenharmony_ci .hd_shift = 0, 11008c2ecf20Sopenharmony_ci .agent_disable_reg = AUDIO_TOP_CON5, 11018c2ecf20Sopenharmony_ci .agent_disable_shift = 0, 11028c2ecf20Sopenharmony_ci .msb_reg = -1, 11038c2ecf20Sopenharmony_ci }, 11048c2ecf20Sopenharmony_ci { 11058c2ecf20Sopenharmony_ci .name = "UL2", 11068c2ecf20Sopenharmony_ci .id = MT2701_MEMIF_UL2, 11078c2ecf20Sopenharmony_ci .reg_ofs_base = AFE_UL2_BASE, 11088c2ecf20Sopenharmony_ci .reg_ofs_cur = AFE_UL2_CUR, 11098c2ecf20Sopenharmony_ci .fs_reg = AFE_DAC_CON2, 11108c2ecf20Sopenharmony_ci .fs_shift = 5, 11118c2ecf20Sopenharmony_ci .fs_maskbit = 0x1f, 11128c2ecf20Sopenharmony_ci .mono_reg = AFE_DAC_CON4, 11138c2ecf20Sopenharmony_ci .mono_shift = 2, 11148c2ecf20Sopenharmony_ci .enable_reg = AFE_DAC_CON0, 11158c2ecf20Sopenharmony_ci .enable_shift = 11, 11168c2ecf20Sopenharmony_ci .hd_reg = AFE_MEMIF_HD_CON1, 11178c2ecf20Sopenharmony_ci .hd_shift = 2, 11188c2ecf20Sopenharmony_ci .agent_disable_reg = AUDIO_TOP_CON5, 11198c2ecf20Sopenharmony_ci .agent_disable_shift = 1, 11208c2ecf20Sopenharmony_ci .msb_reg = -1, 11218c2ecf20Sopenharmony_ci }, 11228c2ecf20Sopenharmony_ci { 11238c2ecf20Sopenharmony_ci .name = "UL3", 11248c2ecf20Sopenharmony_ci .id = MT2701_MEMIF_UL3, 11258c2ecf20Sopenharmony_ci .reg_ofs_base = AFE_UL3_BASE, 11268c2ecf20Sopenharmony_ci .reg_ofs_cur = AFE_UL3_CUR, 11278c2ecf20Sopenharmony_ci .fs_reg = AFE_DAC_CON2, 11288c2ecf20Sopenharmony_ci .fs_shift = 10, 11298c2ecf20Sopenharmony_ci .fs_maskbit = 0x1f, 11308c2ecf20Sopenharmony_ci .mono_reg = AFE_DAC_CON4, 11318c2ecf20Sopenharmony_ci .mono_shift = 4, 11328c2ecf20Sopenharmony_ci .enable_reg = AFE_DAC_CON0, 11338c2ecf20Sopenharmony_ci .enable_shift = 12, 11348c2ecf20Sopenharmony_ci .hd_reg = AFE_MEMIF_HD_CON0, 11358c2ecf20Sopenharmony_ci .hd_shift = 0, 11368c2ecf20Sopenharmony_ci .agent_disable_reg = AUDIO_TOP_CON5, 11378c2ecf20Sopenharmony_ci .agent_disable_shift = 2, 11388c2ecf20Sopenharmony_ci .msb_reg = -1, 11398c2ecf20Sopenharmony_ci }, 11408c2ecf20Sopenharmony_ci { 11418c2ecf20Sopenharmony_ci .name = "UL4", 11428c2ecf20Sopenharmony_ci .id = MT2701_MEMIF_UL4, 11438c2ecf20Sopenharmony_ci .reg_ofs_base = AFE_UL4_BASE, 11448c2ecf20Sopenharmony_ci .reg_ofs_cur = AFE_UL4_CUR, 11458c2ecf20Sopenharmony_ci .fs_reg = AFE_DAC_CON2, 11468c2ecf20Sopenharmony_ci .fs_shift = 15, 11478c2ecf20Sopenharmony_ci .fs_maskbit = 0x1f, 11488c2ecf20Sopenharmony_ci .mono_reg = AFE_DAC_CON4, 11498c2ecf20Sopenharmony_ci .mono_shift = 6, 11508c2ecf20Sopenharmony_ci .enable_reg = AFE_DAC_CON0, 11518c2ecf20Sopenharmony_ci .enable_shift = 13, 11528c2ecf20Sopenharmony_ci .hd_reg = AFE_MEMIF_HD_CON0, 11538c2ecf20Sopenharmony_ci .hd_shift = 6, 11548c2ecf20Sopenharmony_ci .agent_disable_reg = AUDIO_TOP_CON5, 11558c2ecf20Sopenharmony_ci .agent_disable_shift = 3, 11568c2ecf20Sopenharmony_ci .msb_reg = -1, 11578c2ecf20Sopenharmony_ci }, 11588c2ecf20Sopenharmony_ci { 11598c2ecf20Sopenharmony_ci .name = "UL5", 11608c2ecf20Sopenharmony_ci .id = MT2701_MEMIF_UL5, 11618c2ecf20Sopenharmony_ci .reg_ofs_base = AFE_UL5_BASE, 11628c2ecf20Sopenharmony_ci .reg_ofs_cur = AFE_UL5_CUR, 11638c2ecf20Sopenharmony_ci .fs_reg = AFE_DAC_CON2, 11648c2ecf20Sopenharmony_ci .fs_shift = 20, 11658c2ecf20Sopenharmony_ci .mono_reg = AFE_DAC_CON4, 11668c2ecf20Sopenharmony_ci .mono_shift = 8, 11678c2ecf20Sopenharmony_ci .fs_maskbit = 0x1f, 11688c2ecf20Sopenharmony_ci .enable_reg = AFE_DAC_CON0, 11698c2ecf20Sopenharmony_ci .enable_shift = 14, 11708c2ecf20Sopenharmony_ci .hd_reg = AFE_MEMIF_HD_CON0, 11718c2ecf20Sopenharmony_ci .hd_shift = 8, 11728c2ecf20Sopenharmony_ci .agent_disable_reg = AUDIO_TOP_CON5, 11738c2ecf20Sopenharmony_ci .agent_disable_shift = 4, 11748c2ecf20Sopenharmony_ci .msb_reg = -1, 11758c2ecf20Sopenharmony_ci }, 11768c2ecf20Sopenharmony_ci { 11778c2ecf20Sopenharmony_ci .name = "DLBT", 11788c2ecf20Sopenharmony_ci .id = MT2701_MEMIF_DLBT, 11798c2ecf20Sopenharmony_ci .reg_ofs_base = AFE_ARB1_BASE, 11808c2ecf20Sopenharmony_ci .reg_ofs_cur = AFE_ARB1_CUR, 11818c2ecf20Sopenharmony_ci .fs_reg = AFE_DAC_CON3, 11828c2ecf20Sopenharmony_ci .fs_shift = 10, 11838c2ecf20Sopenharmony_ci .fs_maskbit = 0x1f, 11848c2ecf20Sopenharmony_ci .mono_reg = AFE_DAC_CON3, 11858c2ecf20Sopenharmony_ci .mono_shift = 22, 11868c2ecf20Sopenharmony_ci .enable_reg = AFE_DAC_CON0, 11878c2ecf20Sopenharmony_ci .enable_shift = 8, 11888c2ecf20Sopenharmony_ci .hd_reg = AFE_MEMIF_HD_CON0, 11898c2ecf20Sopenharmony_ci .hd_shift = 14, 11908c2ecf20Sopenharmony_ci .agent_disable_reg = AUDIO_TOP_CON5, 11918c2ecf20Sopenharmony_ci .agent_disable_shift = 13, 11928c2ecf20Sopenharmony_ci .msb_reg = -1, 11938c2ecf20Sopenharmony_ci }, 11948c2ecf20Sopenharmony_ci { 11958c2ecf20Sopenharmony_ci .name = "ULBT", 11968c2ecf20Sopenharmony_ci .id = MT2701_MEMIF_ULBT, 11978c2ecf20Sopenharmony_ci .reg_ofs_base = AFE_DAI_BASE, 11988c2ecf20Sopenharmony_ci .reg_ofs_cur = AFE_DAI_CUR, 11998c2ecf20Sopenharmony_ci .fs_reg = AFE_DAC_CON2, 12008c2ecf20Sopenharmony_ci .fs_shift = 30, 12018c2ecf20Sopenharmony_ci .fs_maskbit = 0x1, 12028c2ecf20Sopenharmony_ci .mono_reg = -1, 12038c2ecf20Sopenharmony_ci .mono_shift = -1, 12048c2ecf20Sopenharmony_ci .enable_reg = AFE_DAC_CON0, 12058c2ecf20Sopenharmony_ci .enable_shift = 17, 12068c2ecf20Sopenharmony_ci .hd_reg = AFE_MEMIF_HD_CON1, 12078c2ecf20Sopenharmony_ci .hd_shift = 20, 12088c2ecf20Sopenharmony_ci .agent_disable_reg = AUDIO_TOP_CON5, 12098c2ecf20Sopenharmony_ci .agent_disable_shift = 16, 12108c2ecf20Sopenharmony_ci .msb_reg = -1, 12118c2ecf20Sopenharmony_ci }, 12128c2ecf20Sopenharmony_ci}; 12138c2ecf20Sopenharmony_ci 12148c2ecf20Sopenharmony_cistatic const struct mtk_base_irq_data irq_data[MT2701_IRQ_ASYS_END] = { 12158c2ecf20Sopenharmony_ci { 12168c2ecf20Sopenharmony_ci .id = MT2701_IRQ_ASYS_IRQ1, 12178c2ecf20Sopenharmony_ci .irq_cnt_reg = ASYS_IRQ1_CON, 12188c2ecf20Sopenharmony_ci .irq_cnt_shift = 0, 12198c2ecf20Sopenharmony_ci .irq_cnt_maskbit = 0xffffff, 12208c2ecf20Sopenharmony_ci .irq_fs_reg = ASYS_IRQ1_CON, 12218c2ecf20Sopenharmony_ci .irq_fs_shift = 24, 12228c2ecf20Sopenharmony_ci .irq_fs_maskbit = 0x1f, 12238c2ecf20Sopenharmony_ci .irq_en_reg = ASYS_IRQ1_CON, 12248c2ecf20Sopenharmony_ci .irq_en_shift = 31, 12258c2ecf20Sopenharmony_ci .irq_clr_reg = ASYS_IRQ_CLR, 12268c2ecf20Sopenharmony_ci .irq_clr_shift = 0, 12278c2ecf20Sopenharmony_ci }, 12288c2ecf20Sopenharmony_ci { 12298c2ecf20Sopenharmony_ci .id = MT2701_IRQ_ASYS_IRQ2, 12308c2ecf20Sopenharmony_ci .irq_cnt_reg = ASYS_IRQ2_CON, 12318c2ecf20Sopenharmony_ci .irq_cnt_shift = 0, 12328c2ecf20Sopenharmony_ci .irq_cnt_maskbit = 0xffffff, 12338c2ecf20Sopenharmony_ci .irq_fs_reg = ASYS_IRQ2_CON, 12348c2ecf20Sopenharmony_ci .irq_fs_shift = 24, 12358c2ecf20Sopenharmony_ci .irq_fs_maskbit = 0x1f, 12368c2ecf20Sopenharmony_ci .irq_en_reg = ASYS_IRQ2_CON, 12378c2ecf20Sopenharmony_ci .irq_en_shift = 31, 12388c2ecf20Sopenharmony_ci .irq_clr_reg = ASYS_IRQ_CLR, 12398c2ecf20Sopenharmony_ci .irq_clr_shift = 1, 12408c2ecf20Sopenharmony_ci }, 12418c2ecf20Sopenharmony_ci { 12428c2ecf20Sopenharmony_ci .id = MT2701_IRQ_ASYS_IRQ3, 12438c2ecf20Sopenharmony_ci .irq_cnt_reg = ASYS_IRQ3_CON, 12448c2ecf20Sopenharmony_ci .irq_cnt_shift = 0, 12458c2ecf20Sopenharmony_ci .irq_cnt_maskbit = 0xffffff, 12468c2ecf20Sopenharmony_ci .irq_fs_reg = ASYS_IRQ3_CON, 12478c2ecf20Sopenharmony_ci .irq_fs_shift = 24, 12488c2ecf20Sopenharmony_ci .irq_fs_maskbit = 0x1f, 12498c2ecf20Sopenharmony_ci .irq_en_reg = ASYS_IRQ3_CON, 12508c2ecf20Sopenharmony_ci .irq_en_shift = 31, 12518c2ecf20Sopenharmony_ci .irq_clr_reg = ASYS_IRQ_CLR, 12528c2ecf20Sopenharmony_ci .irq_clr_shift = 2, 12538c2ecf20Sopenharmony_ci } 12548c2ecf20Sopenharmony_ci}; 12558c2ecf20Sopenharmony_ci 12568c2ecf20Sopenharmony_cistatic const struct mt2701_i2s_data mt2701_i2s_data[][2] = { 12578c2ecf20Sopenharmony_ci { 12588c2ecf20Sopenharmony_ci { ASYS_I2SO1_CON, 0, 0x1f }, 12598c2ecf20Sopenharmony_ci { ASYS_I2SIN1_CON, 0, 0x1f }, 12608c2ecf20Sopenharmony_ci }, 12618c2ecf20Sopenharmony_ci { 12628c2ecf20Sopenharmony_ci { ASYS_I2SO2_CON, 5, 0x1f }, 12638c2ecf20Sopenharmony_ci { ASYS_I2SIN2_CON, 5, 0x1f }, 12648c2ecf20Sopenharmony_ci }, 12658c2ecf20Sopenharmony_ci { 12668c2ecf20Sopenharmony_ci { ASYS_I2SO3_CON, 10, 0x1f }, 12678c2ecf20Sopenharmony_ci { ASYS_I2SIN3_CON, 10, 0x1f }, 12688c2ecf20Sopenharmony_ci }, 12698c2ecf20Sopenharmony_ci { 12708c2ecf20Sopenharmony_ci { ASYS_I2SO4_CON, 15, 0x1f }, 12718c2ecf20Sopenharmony_ci { ASYS_I2SIN4_CON, 15, 0x1f }, 12728c2ecf20Sopenharmony_ci }, 12738c2ecf20Sopenharmony_ci /* TODO - extend control registers supported by newer SoCs */ 12748c2ecf20Sopenharmony_ci}; 12758c2ecf20Sopenharmony_ci 12768c2ecf20Sopenharmony_cistatic irqreturn_t mt2701_asys_isr(int irq_id, void *dev) 12778c2ecf20Sopenharmony_ci{ 12788c2ecf20Sopenharmony_ci int id; 12798c2ecf20Sopenharmony_ci struct mtk_base_afe *afe = dev; 12808c2ecf20Sopenharmony_ci struct mtk_base_afe_memif *memif; 12818c2ecf20Sopenharmony_ci struct mtk_base_afe_irq *irq; 12828c2ecf20Sopenharmony_ci u32 status; 12838c2ecf20Sopenharmony_ci 12848c2ecf20Sopenharmony_ci regmap_read(afe->regmap, ASYS_IRQ_STATUS, &status); 12858c2ecf20Sopenharmony_ci regmap_write(afe->regmap, ASYS_IRQ_CLR, status); 12868c2ecf20Sopenharmony_ci 12878c2ecf20Sopenharmony_ci for (id = 0; id < MT2701_MEMIF_NUM; ++id) { 12888c2ecf20Sopenharmony_ci memif = &afe->memif[id]; 12898c2ecf20Sopenharmony_ci if (memif->irq_usage < 0) 12908c2ecf20Sopenharmony_ci continue; 12918c2ecf20Sopenharmony_ci 12928c2ecf20Sopenharmony_ci irq = &afe->irqs[memif->irq_usage]; 12938c2ecf20Sopenharmony_ci if (status & 1 << irq->irq_data->irq_clr_shift) 12948c2ecf20Sopenharmony_ci snd_pcm_period_elapsed(memif->substream); 12958c2ecf20Sopenharmony_ci } 12968c2ecf20Sopenharmony_ci 12978c2ecf20Sopenharmony_ci return IRQ_HANDLED; 12988c2ecf20Sopenharmony_ci} 12998c2ecf20Sopenharmony_ci 13008c2ecf20Sopenharmony_cistatic int mt2701_afe_runtime_suspend(struct device *dev) 13018c2ecf20Sopenharmony_ci{ 13028c2ecf20Sopenharmony_ci struct mtk_base_afe *afe = dev_get_drvdata(dev); 13038c2ecf20Sopenharmony_ci 13048c2ecf20Sopenharmony_ci return mt2701_afe_disable_clock(afe); 13058c2ecf20Sopenharmony_ci} 13068c2ecf20Sopenharmony_ci 13078c2ecf20Sopenharmony_cistatic int mt2701_afe_runtime_resume(struct device *dev) 13088c2ecf20Sopenharmony_ci{ 13098c2ecf20Sopenharmony_ci struct mtk_base_afe *afe = dev_get_drvdata(dev); 13108c2ecf20Sopenharmony_ci 13118c2ecf20Sopenharmony_ci return mt2701_afe_enable_clock(afe); 13128c2ecf20Sopenharmony_ci} 13138c2ecf20Sopenharmony_ci 13148c2ecf20Sopenharmony_cistatic int mt2701_afe_pcm_dev_probe(struct platform_device *pdev) 13158c2ecf20Sopenharmony_ci{ 13168c2ecf20Sopenharmony_ci struct mtk_base_afe *afe; 13178c2ecf20Sopenharmony_ci struct mt2701_afe_private *afe_priv; 13188c2ecf20Sopenharmony_ci struct device *dev; 13198c2ecf20Sopenharmony_ci int i, irq_id, ret; 13208c2ecf20Sopenharmony_ci 13218c2ecf20Sopenharmony_ci afe = devm_kzalloc(&pdev->dev, sizeof(*afe), GFP_KERNEL); 13228c2ecf20Sopenharmony_ci if (!afe) 13238c2ecf20Sopenharmony_ci return -ENOMEM; 13248c2ecf20Sopenharmony_ci 13258c2ecf20Sopenharmony_ci afe->platform_priv = devm_kzalloc(&pdev->dev, sizeof(*afe_priv), 13268c2ecf20Sopenharmony_ci GFP_KERNEL); 13278c2ecf20Sopenharmony_ci if (!afe->platform_priv) 13288c2ecf20Sopenharmony_ci return -ENOMEM; 13298c2ecf20Sopenharmony_ci 13308c2ecf20Sopenharmony_ci afe_priv = afe->platform_priv; 13318c2ecf20Sopenharmony_ci afe_priv->soc = of_device_get_match_data(&pdev->dev); 13328c2ecf20Sopenharmony_ci afe->dev = &pdev->dev; 13338c2ecf20Sopenharmony_ci dev = afe->dev; 13348c2ecf20Sopenharmony_ci 13358c2ecf20Sopenharmony_ci afe_priv->i2s_path = devm_kcalloc(dev, 13368c2ecf20Sopenharmony_ci afe_priv->soc->i2s_num, 13378c2ecf20Sopenharmony_ci sizeof(struct mt2701_i2s_path), 13388c2ecf20Sopenharmony_ci GFP_KERNEL); 13398c2ecf20Sopenharmony_ci if (!afe_priv->i2s_path) 13408c2ecf20Sopenharmony_ci return -ENOMEM; 13418c2ecf20Sopenharmony_ci 13428c2ecf20Sopenharmony_ci irq_id = platform_get_irq_byname(pdev, "asys"); 13438c2ecf20Sopenharmony_ci if (irq_id < 0) 13448c2ecf20Sopenharmony_ci return irq_id; 13458c2ecf20Sopenharmony_ci 13468c2ecf20Sopenharmony_ci ret = devm_request_irq(dev, irq_id, mt2701_asys_isr, 13478c2ecf20Sopenharmony_ci IRQF_TRIGGER_NONE, "asys-isr", (void *)afe); 13488c2ecf20Sopenharmony_ci if (ret) { 13498c2ecf20Sopenharmony_ci dev_err(dev, "could not request_irq for asys-isr\n"); 13508c2ecf20Sopenharmony_ci return ret; 13518c2ecf20Sopenharmony_ci } 13528c2ecf20Sopenharmony_ci 13538c2ecf20Sopenharmony_ci afe->regmap = syscon_node_to_regmap(dev->parent->of_node); 13548c2ecf20Sopenharmony_ci if (IS_ERR(afe->regmap)) { 13558c2ecf20Sopenharmony_ci dev_err(dev, "could not get regmap from parent\n"); 13568c2ecf20Sopenharmony_ci return PTR_ERR(afe->regmap); 13578c2ecf20Sopenharmony_ci } 13588c2ecf20Sopenharmony_ci 13598c2ecf20Sopenharmony_ci mutex_init(&afe->irq_alloc_lock); 13608c2ecf20Sopenharmony_ci 13618c2ecf20Sopenharmony_ci /* memif initialize */ 13628c2ecf20Sopenharmony_ci afe->memif_size = MT2701_MEMIF_NUM; 13638c2ecf20Sopenharmony_ci afe->memif = devm_kcalloc(dev, afe->memif_size, sizeof(*afe->memif), 13648c2ecf20Sopenharmony_ci GFP_KERNEL); 13658c2ecf20Sopenharmony_ci if (!afe->memif) 13668c2ecf20Sopenharmony_ci return -ENOMEM; 13678c2ecf20Sopenharmony_ci 13688c2ecf20Sopenharmony_ci for (i = 0; i < afe->memif_size; i++) { 13698c2ecf20Sopenharmony_ci afe->memif[i].data = &memif_data[i]; 13708c2ecf20Sopenharmony_ci afe->memif[i].irq_usage = -1; 13718c2ecf20Sopenharmony_ci } 13728c2ecf20Sopenharmony_ci 13738c2ecf20Sopenharmony_ci /* irq initialize */ 13748c2ecf20Sopenharmony_ci afe->irqs_size = MT2701_IRQ_ASYS_END; 13758c2ecf20Sopenharmony_ci afe->irqs = devm_kcalloc(dev, afe->irqs_size, sizeof(*afe->irqs), 13768c2ecf20Sopenharmony_ci GFP_KERNEL); 13778c2ecf20Sopenharmony_ci if (!afe->irqs) 13788c2ecf20Sopenharmony_ci return -ENOMEM; 13798c2ecf20Sopenharmony_ci 13808c2ecf20Sopenharmony_ci for (i = 0; i < afe->irqs_size; i++) 13818c2ecf20Sopenharmony_ci afe->irqs[i].irq_data = &irq_data[i]; 13828c2ecf20Sopenharmony_ci 13838c2ecf20Sopenharmony_ci /* I2S initialize */ 13848c2ecf20Sopenharmony_ci for (i = 0; i < afe_priv->soc->i2s_num; i++) { 13858c2ecf20Sopenharmony_ci afe_priv->i2s_path[i].i2s_data[SNDRV_PCM_STREAM_PLAYBACK] = 13868c2ecf20Sopenharmony_ci &mt2701_i2s_data[i][SNDRV_PCM_STREAM_PLAYBACK]; 13878c2ecf20Sopenharmony_ci afe_priv->i2s_path[i].i2s_data[SNDRV_PCM_STREAM_CAPTURE] = 13888c2ecf20Sopenharmony_ci &mt2701_i2s_data[i][SNDRV_PCM_STREAM_CAPTURE]; 13898c2ecf20Sopenharmony_ci } 13908c2ecf20Sopenharmony_ci 13918c2ecf20Sopenharmony_ci afe->mtk_afe_hardware = &mt2701_afe_hardware; 13928c2ecf20Sopenharmony_ci afe->memif_fs = mt2701_memif_fs; 13938c2ecf20Sopenharmony_ci afe->irq_fs = mt2701_irq_fs; 13948c2ecf20Sopenharmony_ci afe->reg_back_up_list = mt2701_afe_backup_list; 13958c2ecf20Sopenharmony_ci afe->reg_back_up_list_num = ARRAY_SIZE(mt2701_afe_backup_list); 13968c2ecf20Sopenharmony_ci afe->runtime_resume = mt2701_afe_runtime_resume; 13978c2ecf20Sopenharmony_ci afe->runtime_suspend = mt2701_afe_runtime_suspend; 13988c2ecf20Sopenharmony_ci 13998c2ecf20Sopenharmony_ci /* initial audio related clock */ 14008c2ecf20Sopenharmony_ci ret = mt2701_init_clock(afe); 14018c2ecf20Sopenharmony_ci if (ret) { 14028c2ecf20Sopenharmony_ci dev_err(dev, "init clock error\n"); 14038c2ecf20Sopenharmony_ci return ret; 14048c2ecf20Sopenharmony_ci } 14058c2ecf20Sopenharmony_ci 14068c2ecf20Sopenharmony_ci platform_set_drvdata(pdev, afe); 14078c2ecf20Sopenharmony_ci 14088c2ecf20Sopenharmony_ci pm_runtime_enable(dev); 14098c2ecf20Sopenharmony_ci if (!pm_runtime_enabled(dev)) { 14108c2ecf20Sopenharmony_ci ret = mt2701_afe_runtime_resume(dev); 14118c2ecf20Sopenharmony_ci if (ret) 14128c2ecf20Sopenharmony_ci goto err_pm_disable; 14138c2ecf20Sopenharmony_ci } 14148c2ecf20Sopenharmony_ci pm_runtime_get_sync(dev); 14158c2ecf20Sopenharmony_ci 14168c2ecf20Sopenharmony_ci ret = devm_snd_soc_register_component(&pdev->dev, &mtk_afe_pcm_platform, 14178c2ecf20Sopenharmony_ci NULL, 0); 14188c2ecf20Sopenharmony_ci if (ret) { 14198c2ecf20Sopenharmony_ci dev_warn(dev, "err_platform\n"); 14208c2ecf20Sopenharmony_ci goto err_platform; 14218c2ecf20Sopenharmony_ci } 14228c2ecf20Sopenharmony_ci 14238c2ecf20Sopenharmony_ci ret = devm_snd_soc_register_component(&pdev->dev, 14248c2ecf20Sopenharmony_ci &mt2701_afe_pcm_dai_component, 14258c2ecf20Sopenharmony_ci mt2701_afe_pcm_dais, 14268c2ecf20Sopenharmony_ci ARRAY_SIZE(mt2701_afe_pcm_dais)); 14278c2ecf20Sopenharmony_ci if (ret) { 14288c2ecf20Sopenharmony_ci dev_warn(dev, "err_dai_component\n"); 14298c2ecf20Sopenharmony_ci goto err_platform; 14308c2ecf20Sopenharmony_ci } 14318c2ecf20Sopenharmony_ci 14328c2ecf20Sopenharmony_ci return 0; 14338c2ecf20Sopenharmony_ci 14348c2ecf20Sopenharmony_cierr_platform: 14358c2ecf20Sopenharmony_ci pm_runtime_put_sync(dev); 14368c2ecf20Sopenharmony_cierr_pm_disable: 14378c2ecf20Sopenharmony_ci pm_runtime_disable(dev); 14388c2ecf20Sopenharmony_ci 14398c2ecf20Sopenharmony_ci return ret; 14408c2ecf20Sopenharmony_ci} 14418c2ecf20Sopenharmony_ci 14428c2ecf20Sopenharmony_cistatic int mt2701_afe_pcm_dev_remove(struct platform_device *pdev) 14438c2ecf20Sopenharmony_ci{ 14448c2ecf20Sopenharmony_ci pm_runtime_put_sync(&pdev->dev); 14458c2ecf20Sopenharmony_ci pm_runtime_disable(&pdev->dev); 14468c2ecf20Sopenharmony_ci if (!pm_runtime_status_suspended(&pdev->dev)) 14478c2ecf20Sopenharmony_ci mt2701_afe_runtime_suspend(&pdev->dev); 14488c2ecf20Sopenharmony_ci 14498c2ecf20Sopenharmony_ci return 0; 14508c2ecf20Sopenharmony_ci} 14518c2ecf20Sopenharmony_ci 14528c2ecf20Sopenharmony_cistatic const struct mt2701_soc_variants mt2701_soc_v1 = { 14538c2ecf20Sopenharmony_ci .i2s_num = 4, 14548c2ecf20Sopenharmony_ci}; 14558c2ecf20Sopenharmony_ci 14568c2ecf20Sopenharmony_cistatic const struct mt2701_soc_variants mt2701_soc_v2 = { 14578c2ecf20Sopenharmony_ci .has_one_heart_mode = true, 14588c2ecf20Sopenharmony_ci .i2s_num = 4, 14598c2ecf20Sopenharmony_ci}; 14608c2ecf20Sopenharmony_ci 14618c2ecf20Sopenharmony_cistatic const struct of_device_id mt2701_afe_pcm_dt_match[] = { 14628c2ecf20Sopenharmony_ci { .compatible = "mediatek,mt2701-audio", .data = &mt2701_soc_v1 }, 14638c2ecf20Sopenharmony_ci { .compatible = "mediatek,mt7622-audio", .data = &mt2701_soc_v2 }, 14648c2ecf20Sopenharmony_ci {}, 14658c2ecf20Sopenharmony_ci}; 14668c2ecf20Sopenharmony_ciMODULE_DEVICE_TABLE(of, mt2701_afe_pcm_dt_match); 14678c2ecf20Sopenharmony_ci 14688c2ecf20Sopenharmony_cistatic const struct dev_pm_ops mt2701_afe_pm_ops = { 14698c2ecf20Sopenharmony_ci SET_RUNTIME_PM_OPS(mt2701_afe_runtime_suspend, 14708c2ecf20Sopenharmony_ci mt2701_afe_runtime_resume, NULL) 14718c2ecf20Sopenharmony_ci}; 14728c2ecf20Sopenharmony_ci 14738c2ecf20Sopenharmony_cistatic struct platform_driver mt2701_afe_pcm_driver = { 14748c2ecf20Sopenharmony_ci .driver = { 14758c2ecf20Sopenharmony_ci .name = "mt2701-audio", 14768c2ecf20Sopenharmony_ci .of_match_table = mt2701_afe_pcm_dt_match, 14778c2ecf20Sopenharmony_ci#ifdef CONFIG_PM 14788c2ecf20Sopenharmony_ci .pm = &mt2701_afe_pm_ops, 14798c2ecf20Sopenharmony_ci#endif 14808c2ecf20Sopenharmony_ci }, 14818c2ecf20Sopenharmony_ci .probe = mt2701_afe_pcm_dev_probe, 14828c2ecf20Sopenharmony_ci .remove = mt2701_afe_pcm_dev_remove, 14838c2ecf20Sopenharmony_ci}; 14848c2ecf20Sopenharmony_ci 14858c2ecf20Sopenharmony_cimodule_platform_driver(mt2701_afe_pcm_driver); 14868c2ecf20Sopenharmony_ci 14878c2ecf20Sopenharmony_ciMODULE_DESCRIPTION("Mediatek ALSA SoC AFE platform driver for 2701"); 14888c2ecf20Sopenharmony_ciMODULE_AUTHOR("Garlic Tseng <garlic.tseng@mediatek.com>"); 14898c2ecf20Sopenharmony_ciMODULE_LICENSE("GPL v2"); 1490