~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/sound/soc/mediatek/mt8183/mt8183-dai-hostless.c

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 // SPDX-License-Identifier: GPL-2.0
  2 //
  3 // MediaTek ALSA SoC Audio DAI Hostless Control
  4 //
  5 // Copyright (c) 2018 MediaTek Inc.
  6 // Author: KaiChieh Chuang <kaichieh.chuang@mediatek.com>
  7 
  8 #include "mt8183-afe-common.h"
  9 
 10 /* dai component */
 11 static const struct snd_soc_dapm_route mtk_dai_hostless_routes[] = {
 12         /* Hostless ADDA Loopback */
 13         {"ADDA_DL_CH1", "ADDA_UL_CH1", "Hostless LPBK DL"},
 14         {"ADDA_DL_CH1", "ADDA_UL_CH2", "Hostless LPBK DL"},
 15         {"ADDA_DL_CH2", "ADDA_UL_CH1", "Hostless LPBK DL"},
 16         {"ADDA_DL_CH2", "ADDA_UL_CH2", "Hostless LPBK DL"},
 17         {"Hostless LPBK UL", NULL, "ADDA Capture"},
 18 
 19         /* Hostless Speech */
 20         {"ADDA_DL_CH1", "PCM_1_CAP_CH1", "Hostless Speech DL"},
 21         {"ADDA_DL_CH2", "PCM_1_CAP_CH1", "Hostless Speech DL"},
 22         {"ADDA_DL_CH2", "PCM_1_CAP_CH2", "Hostless Speech DL"},
 23         {"ADDA_DL_CH1", "PCM_2_CAP_CH1", "Hostless Speech DL"},
 24         {"ADDA_DL_CH2", "PCM_2_CAP_CH1", "Hostless Speech DL"},
 25         {"ADDA_DL_CH2", "PCM_2_CAP_CH2", "Hostless Speech DL"},
 26         {"PCM_1_PB_CH1", "ADDA_UL_CH1", "Hostless Speech DL"},
 27         {"PCM_1_PB_CH2", "ADDA_UL_CH2", "Hostless Speech DL"},
 28         {"PCM_2_PB_CH1", "ADDA_UL_CH1", "Hostless Speech DL"},
 29         {"PCM_2_PB_CH2", "ADDA_UL_CH2", "Hostless Speech DL"},
 30 
 31         {"Hostless Speech UL", NULL, "PCM 1 Capture"},
 32         {"Hostless Speech UL", NULL, "PCM 2 Capture"},
 33         {"Hostless Speech UL", NULL, "ADDA Capture"},
 34 };
 35 
 36 /* dai ops */
 37 static int mtk_dai_hostless_startup(struct snd_pcm_substream *substream,
 38                                     struct snd_soc_dai *dai)
 39 {
 40         struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai);
 41 
 42         return snd_soc_set_runtime_hwparams(substream, afe->mtk_afe_hardware);
 43 }
 44 
 45 static const struct snd_soc_dai_ops mtk_dai_hostless_ops = {
 46         .startup = mtk_dai_hostless_startup,
 47 };
 48 
 49 /* dai driver */
 50 #define MTK_HOSTLESS_RATES (SNDRV_PCM_RATE_8000_48000 |\
 51                            SNDRV_PCM_RATE_88200 |\
 52                            SNDRV_PCM_RATE_96000 |\
 53                            SNDRV_PCM_RATE_176400 |\
 54                            SNDRV_PCM_RATE_192000)
 55 
 56 #define MTK_HOSTLESS_FORMATS (SNDRV_PCM_FMTBIT_S16_LE |\
 57                              SNDRV_PCM_FMTBIT_S24_LE |\
 58                              SNDRV_PCM_FMTBIT_S32_LE)
 59 
 60 static struct snd_soc_dai_driver mtk_dai_hostless_driver[] = {
 61         {
 62                 .name = "Hostless LPBK DAI",
 63                 .id = MT8183_DAI_HOSTLESS_LPBK,
 64                 .playback = {
 65                         .stream_name = "Hostless LPBK DL",
 66                         .channels_min = 1,
 67                         .channels_max = 2,
 68                         .rates = MTK_HOSTLESS_RATES,
 69                         .formats = MTK_HOSTLESS_FORMATS,
 70                 },
 71                 .capture = {
 72                         .stream_name = "Hostless LPBK UL",
 73                         .channels_min = 1,
 74                         .channels_max = 2,
 75                         .rates = MTK_HOSTLESS_RATES,
 76                         .formats = MTK_HOSTLESS_FORMATS,
 77                 },
 78                 .ops = &mtk_dai_hostless_ops,
 79         },
 80         {
 81                 .name = "Hostless Speech DAI",
 82                 .id = MT8183_DAI_HOSTLESS_SPEECH,
 83                 .playback = {
 84                         .stream_name = "Hostless Speech DL",
 85                         .channels_min = 1,
 86                         .channels_max = 2,
 87                         .rates = MTK_HOSTLESS_RATES,
 88                         .formats = MTK_HOSTLESS_FORMATS,
 89                 },
 90                 .capture = {
 91                         .stream_name = "Hostless Speech UL",
 92                         .channels_min = 1,
 93                         .channels_max = 2,
 94                         .rates = MTK_HOSTLESS_RATES,
 95                         .formats = MTK_HOSTLESS_FORMATS,
 96                 },
 97                 .ops = &mtk_dai_hostless_ops,
 98         },
 99 };
100 
101 int mt8183_dai_hostless_register(struct mtk_base_afe *afe)
102 {
103         struct mtk_base_afe_dai *dai;
104 
105         dai = devm_kzalloc(afe->dev, sizeof(*dai), GFP_KERNEL);
106         if (!dai)
107                 return -ENOMEM;
108 
109         list_add(&dai->list, &afe->sub_dais);
110 
111         dai->dai_drivers = mtk_dai_hostless_driver;
112         dai->num_dai_drivers = ARRAY_SIZE(mtk_dai_hostless_driver);
113 
114         dai->dapm_routes = mtk_dai_hostless_routes;
115         dai->num_dapm_routes = ARRAY_SIZE(mtk_dai_hostless_routes);
116 
117         return 0;
118 }
119 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php