|
15 | 15 | #include <sound/soc_sdw_utils.h> |
16 | 16 |
|
17 | 17 | #define CODEC_NAME_SIZE 8 |
18 | | -#define CS_AMP_CHANNELS_PER_AMP 4 |
19 | 18 |
|
20 | 19 | int asoc_sdw_cs_spk_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai) |
21 | 20 | { |
@@ -49,51 +48,6 @@ int asoc_sdw_cs_spk_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai |
49 | 48 | } |
50 | 49 | EXPORT_SYMBOL_NS(asoc_sdw_cs_spk_rtd_init, SND_SOC_SDW_UTILS); |
51 | 50 |
|
52 | | -int asoc_sdw_cs_spk_feedback_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai) |
53 | | -{ |
54 | | - const struct snd_soc_dai_link *dai_link = rtd->dai_link; |
55 | | - const struct snd_soc_dai_link_ch_map *ch_map; |
56 | | - const struct snd_soc_dai_link_component *codec_dlc; |
57 | | - struct snd_soc_dai *codec_dai; |
58 | | - u8 ch_slot[8] = {}; |
59 | | - unsigned int amps_per_bus, ch_per_amp, mask; |
60 | | - int i, ret; |
61 | | - |
62 | | - WARN_ON(dai_link->num_cpus > ARRAY_SIZE(ch_slot)); |
63 | | - |
64 | | - /* |
65 | | - * CS35L56 has 4 TX channels. When the capture is aggregated the |
66 | | - * same bus slots will be allocated to all the amps on a bus. Only |
67 | | - * one amp on that bus can be transmitting in each slot so divide |
68 | | - * the available 4 slots between all the amps on a bus. |
69 | | - */ |
70 | | - amps_per_bus = dai_link->num_codecs / dai_link->num_cpus; |
71 | | - if ((amps_per_bus == 0) || (amps_per_bus > CS_AMP_CHANNELS_PER_AMP)) { |
72 | | - dev_err(rtd->card->dev, "Illegal num_codecs:%u / num_cpus:%u\n", |
73 | | - dai_link->num_codecs, dai_link->num_cpus); |
74 | | - return -EINVAL; |
75 | | - } |
76 | | - |
77 | | - ch_per_amp = CS_AMP_CHANNELS_PER_AMP / amps_per_bus; |
78 | | - |
79 | | - for_each_rtd_ch_maps(rtd, i, ch_map) { |
80 | | - codec_dlc = snd_soc_link_to_codec(rtd->dai_link, i); |
81 | | - codec_dai = snd_soc_find_dai(codec_dlc); |
82 | | - mask = GENMASK(ch_per_amp - 1, 0) << ch_slot[ch_map->cpu]; |
83 | | - |
84 | | - ret = snd_soc_dai_set_tdm_slot(codec_dai, 0, mask, 4, 32); |
85 | | - if (ret < 0) { |
86 | | - dev_err(rtd->card->dev, "Failed to set TDM slot:%d\n", ret); |
87 | | - return ret; |
88 | | - } |
89 | | - |
90 | | - ch_slot[ch_map->cpu] += ch_per_amp; |
91 | | - } |
92 | | - |
93 | | - return 0; |
94 | | -} |
95 | | -EXPORT_SYMBOL_NS(asoc_sdw_cs_spk_feedback_rtd_init, SND_SOC_SDW_UTILS); |
96 | | - |
97 | 51 | int asoc_sdw_cs_amp_init(struct snd_soc_card *card, |
98 | 52 | struct snd_soc_dai_link *dai_links, |
99 | 53 | struct asoc_sdw_codec_info *info, |
|
0 commit comments