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

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

Version: ~ [ linux-5.12-rc7 ] ~ [ linux-5.11.13 ] ~ [ linux-5.10.29 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.111 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.186 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.230 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.266 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.266 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.18.140 ] ~ [ linux-3.16.85 ] ~ [ linux-3.14.79 ] ~ [ linux-3.12.74 ] ~ [ 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.5 ] ~ [ 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 | Wiki (Japanese) | Wiki (English) | 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.

osdn.jp