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

TOMOYO Linux Cross Reference
Linux/sound/soc/intel/boards/sof_sdw_common.h

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-only
  2  *  Copyright (c) 2020 Intel Corporation
  3  */
  4 
  5 /*
  6  *  sof_sdw_common.h - prototypes for common helpers
  7  */
  8 
  9 #ifndef SND_SOC_SOF_SDW_COMMON_H
 10 #define SND_SOC_SOF_SDW_COMMON_H
 11 
 12 #include <linux/bits.h>
 13 #include <linux/types.h>
 14 #include <sound/soc.h>
 15 #include "sof_hdmi_common.h"
 16 
 17 #define MAX_NO_PROPS 2
 18 #define MAX_HDMI_NUM 4
 19 #define SDW_UNUSED_DAI_ID -1
 20 #define SDW_JACK_OUT_DAI_ID 0
 21 #define SDW_JACK_IN_DAI_ID 1
 22 #define SDW_AMP_OUT_DAI_ID 2
 23 #define SDW_AMP_IN_DAI_ID 3
 24 #define SDW_DMIC_DAI_ID 4
 25 #define SDW_MAX_CPU_DAIS 16
 26 #define SDW_INTEL_BIDIR_PDI_BASE 2
 27 
 28 #define SDW_MAX_LINKS           4
 29 
 30 /* 8 combinations with 4 links + unused group 0 */
 31 #define SDW_MAX_GROUPS 9
 32 
 33 enum {
 34         SOF_PRE_TGL_HDMI_COUNT = 3,
 35         SOF_TGL_HDMI_COUNT = 4,
 36 };
 37 
 38 enum {
 39         SOF_I2S_SSP0 = BIT(0),
 40         SOF_I2S_SSP1 = BIT(1),
 41         SOF_I2S_SSP2 = BIT(2),
 42         SOF_I2S_SSP3 = BIT(3),
 43         SOF_I2S_SSP4 = BIT(4),
 44         SOF_I2S_SSP5 = BIT(5),
 45 };
 46 
 47 #define SOF_JACK_JDSRC(quirk)           ((quirk) & GENMASK(3, 0))
 48 /* Deprecated and no longer supported by the code */
 49 #define SOF_SDW_FOUR_SPK                BIT(4)
 50 #define SOF_SDW_TGL_HDMI                BIT(5)
 51 #define SOF_SDW_PCH_DMIC                BIT(6)
 52 #define SOF_SSP_PORT(x)         (((x) & GENMASK(5, 0)) << 7)
 53 #define SOF_SSP_GET_PORT(quirk) (((quirk) >> 7) & GENMASK(5, 0))
 54 /* Deprecated and no longer supported by the code */
 55 #define SOF_SDW_NO_AGGREGATION          BIT(14)
 56 /* If a CODEC has an optional speaker output, this quirk will enable it */
 57 #define SOF_CODEC_SPKR                  BIT(15)
 58 /*
 59  * If the CODEC has additional devices attached directly to it.
 60  *
 61  * For the cs42l43:
 62  *   - 0 - No speaker output
 63  *   - SOF_CODEC_SPKR - CODEC internal speaker
 64  *   - SOF_SIDECAR_AMPS - 2x Sidecar amplifiers + CODEC internal speaker
 65  *   - SOF_CODEC_SPKR | SOF_SIDECAR_AMPS - Not currently supported
 66  */
 67 #define SOF_SIDECAR_AMPS                BIT(16)
 68 
 69 /* BT audio offload: reserve 3 bits for future */
 70 #define SOF_BT_OFFLOAD_SSP_SHIFT        15
 71 #define SOF_BT_OFFLOAD_SSP_MASK (GENMASK(17, 15))
 72 #define SOF_BT_OFFLOAD_SSP(quirk)       \
 73         (((quirk) << SOF_BT_OFFLOAD_SSP_SHIFT) & SOF_BT_OFFLOAD_SSP_MASK)
 74 #define SOF_SSP_BT_OFFLOAD_PRESENT      BIT(18)
 75 
 76 #define SOF_SDW_DAI_TYPE_JACK           0
 77 #define SOF_SDW_DAI_TYPE_AMP            1
 78 #define SOF_SDW_DAI_TYPE_MIC            2
 79 
 80 #define SOF_SDW_MAX_DAI_NUM             8
 81 
 82 struct sof_sdw_codec_info;
 83 
 84 struct sof_sdw_dai_info {
 85         const bool direction[2]; /* playback & capture support */
 86         const char *dai_name;
 87         const int dai_type;
 88         const int dailink[2]; /* dailink id for each direction */
 89         const struct snd_kcontrol_new *controls;
 90         const int num_controls;
 91         const struct snd_soc_dapm_widget *widgets;
 92         const int num_widgets;
 93         int  (*init)(struct snd_soc_card *card,
 94                      struct snd_soc_dai_link *dai_links,
 95                      struct sof_sdw_codec_info *info,
 96                      bool playback);
 97         int (*exit)(struct snd_soc_card *card, struct snd_soc_dai_link *dai_link);
 98         int (*rtd_init)(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai);
 99         bool rtd_init_done; /* Indicate that the rtd_init callback is done */
100         unsigned long quirk;
101 };
102 
103 struct sof_sdw_codec_info {
104         const int part_id;
105         const int version_id;
106         const char *codec_name;
107         int amp_num;
108         const u8 acpi_id[ACPI_ID_LEN];
109         const bool ignore_pch_dmic;
110         const struct snd_soc_ops *ops;
111         struct sof_sdw_dai_info dais[SOF_SDW_MAX_DAI_NUM];
112         const int dai_num;
113 
114         int (*codec_card_late_probe)(struct snd_soc_card *card);
115 
116         int  (*count_sidecar)(struct snd_soc_card *card,
117                               int *num_dais, int *num_devs);
118         int  (*add_sidecar)(struct snd_soc_card *card,
119                             struct snd_soc_dai_link **dai_links,
120                             struct snd_soc_codec_conf **codec_conf);
121 };
122 
123 struct mc_private {
124         struct snd_soc_card card;
125         struct snd_soc_jack sdw_headset;
126         struct sof_hdmi_private hdmi;
127         struct device *headset_codec_dev; /* only one headset per card */
128         struct device *amp_dev1, *amp_dev2;
129         /* To store SDW Pin index for each SoundWire link */
130         unsigned int sdw_pin_index[SDW_MAX_LINKS];
131         bool append_dai_type;
132         bool ignore_pch_dmic;
133 };
134 
135 extern unsigned long sof_sdw_quirk;
136 
137 int sdw_startup(struct snd_pcm_substream *substream);
138 int sdw_prepare(struct snd_pcm_substream *substream);
139 int sdw_trigger(struct snd_pcm_substream *substream, int cmd);
140 int sdw_hw_params(struct snd_pcm_substream *substream,
141                   struct snd_pcm_hw_params *params);
142 int sdw_hw_free(struct snd_pcm_substream *substream);
143 void sdw_shutdown(struct snd_pcm_substream *substream);
144 
145 /* generic HDMI support */
146 int sof_sdw_hdmi_init(struct snd_soc_pcm_runtime *rtd);
147 
148 int sof_sdw_hdmi_card_late_probe(struct snd_soc_card *card);
149 
150 /* DMIC support */
151 int sof_sdw_dmic_init(struct snd_soc_pcm_runtime *rtd);
152 
153 /* RT711 support */
154 int sof_sdw_rt711_init(struct snd_soc_card *card,
155                        struct snd_soc_dai_link *dai_links,
156                        struct sof_sdw_codec_info *info,
157                        bool playback);
158 int sof_sdw_rt711_exit(struct snd_soc_card *card, struct snd_soc_dai_link *dai_link);
159 
160 /* RT711-SDCA support */
161 int sof_sdw_rt_sdca_jack_init(struct snd_soc_card *card,
162                               struct snd_soc_dai_link *dai_links,
163                               struct sof_sdw_codec_info *info,
164                               bool playback);
165 int sof_sdw_rt_sdca_jack_exit(struct snd_soc_card *card, struct snd_soc_dai_link *dai_link);
166 
167 /* RT1308 I2S support */
168 extern const struct snd_soc_ops sof_sdw_rt1308_i2s_ops;
169 
170 /* generic amp support */
171 int sof_sdw_rt_amp_init(struct snd_soc_card *card,
172                         struct snd_soc_dai_link *dai_links,
173                         struct sof_sdw_codec_info *info,
174                         bool playback);
175 int sof_sdw_rt_amp_exit(struct snd_soc_card *card, struct snd_soc_dai_link *dai_link);
176 
177 /* MAXIM codec support */
178 int sof_sdw_maxim_init(struct snd_soc_card *card,
179                        struct snd_soc_dai_link *dai_links,
180                        struct sof_sdw_codec_info *info,
181                        bool playback);
182 
183 /* CS42L43 support */
184 int sof_sdw_cs42l43_spk_init(struct snd_soc_card *card,
185                              struct snd_soc_dai_link *dai_links,
186                              struct sof_sdw_codec_info *info,
187                              bool playback);
188 
189 /* CS AMP support */
190 int bridge_cs35l56_count_sidecar(struct snd_soc_card *card,
191                                  int *num_dais, int *num_devs);
192 int bridge_cs35l56_add_sidecar(struct snd_soc_card *card,
193                                struct snd_soc_dai_link **dai_links,
194                                struct snd_soc_codec_conf **codec_conf);
195 int bridge_cs35l56_spk_init(struct snd_soc_card *card,
196                             struct snd_soc_dai_link *dai_links,
197                             struct sof_sdw_codec_info *info,
198                             bool playback);
199 
200 int sof_sdw_cs_amp_init(struct snd_soc_card *card,
201                         struct snd_soc_dai_link *dai_links,
202                         struct sof_sdw_codec_info *info,
203                         bool playback);
204 
205 /* dai_link init callbacks */
206 
207 int cs42l42_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai);
208 int cs42l43_hs_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai);
209 int cs42l43_spk_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai);
210 int cs42l43_dmic_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai);
211 int cs_spk_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai);
212 int maxim_spk_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai);
213 int rt5682_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai);
214 int rt700_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai);
215 int rt711_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai);
216 int rt712_spk_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai);
217 int rt722_spk_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai);
218 int rt_dmic_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai);
219 int rt_amp_spk_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai);
220 int rt_sdca_jack_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai);
221 
222 #endif
223 

~ [ 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