Changeset 777 for GPL/trunk/alsa-kernel/include/sound/soc.h
- Timestamp:
- Apr 21, 2025, 7:17:25 PM (4 months ago)
- Location:
- GPL/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
GPL/trunk
- Property svn:mergeinfo changed
/GPL/branches/uniaud32-exp merged: 766-767,770-771,773-774
- Property svn:mergeinfo changed
-
GPL/trunk/alsa-kernel/include/sound/soc.h
r772 r777 11 11 #define __LINUX_SND_SOC_H 12 12 13 #include <linux/args.h> 14 #include <linux/array_size.h> 15 #include <linux/device.h> 16 #include <linux/errno.h> 17 #include <linux/interrupt.h> 18 #include <linux/lockdep.h> 19 #include <linux/log2.h> 20 #include <linux/mutex.h> 21 #include <linux/notifier.h> 13 22 #include <linux/of.h> 14 #include <linux/platform_device.h>15 23 #include <linux/types.h> 16 #include <linux/notifier.h>17 24 #include <linux/workqueue.h> 18 #include <linux/interrupt.h> 19 #include < linux/kernel.h>20 #include < linux/regmap.h>21 #include < linux/log2.h>25 26 #include <sound/ac97_codec.h> 27 #include <sound/compress_driver.h> 28 #include <sound/control.h> 22 29 #include <sound/core.h> 23 30 #include <sound/pcm.h> 24 #include <sound/compress_driver.h> 25 #include <sound/control.h> 26 #include <sound/ac97_codec.h> 31 32 struct module; 33 struct platform_device; 34 35 /* For the current users of sound/soc.h to avoid build issues */ 36 #include <linux/platform_device.h> 37 #include <linux/regmap.h> 27 38 28 39 /* … … 149 160 .shift = shift_left, .rshift = shift_right, \ 150 161 .max = xmax, .min = xmin} } 162 #define SOC_DOUBLE_RANGE_TLV(xname, xreg, xshift_left, xshift_right, xmin, xmax, \ 163 xinvert, tlv_array) \ 164 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\ 165 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\ 166 SNDRV_CTL_ELEM_ACCESS_READWRITE,\ 167 .tlv.p = (tlv_array), \ 168 .info = snd_soc_info_volsw, \ 169 .get = snd_soc_get_volsw, .put = snd_soc_put_volsw, \ 170 .private_value = (unsigned long)&(struct soc_mixer_control) \ 171 {.reg = xreg, .rreg = xreg, \ 172 .shift = xshift_left, .rshift = xshift_right, \ 173 .min = xmin, .max = xmax, .invert = xinvert} } 151 174 #define SOC_DOUBLE_R_TLV(xname, reg_left, reg_right, xshift, xmax, xinvert, tlv_array) \ 152 175 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\ … … 400 423 const struct soc_enum name = SOC_ENUM_SINGLE_VIRT(ARRAY_SIZE(xtexts), xtexts) 401 424 402 struct device_node;403 425 struct snd_jack; 404 426 struct snd_soc_card; … … 415 437 struct snd_soc_jack_zone; 416 438 struct snd_soc_jack_pin; 439 417 440 #include <sound/soc-dapm.h> 418 441 #include <sound/soc-dpcm.h> … … 512 535 /* Utility functions to get clock rates from various things */ 513 536 int snd_soc_calc_frame_size(int sample_size, int channels, int tdm_slots); 514 int snd_soc_params_to_frame_size( struct snd_pcm_hw_params *params);537 int snd_soc_params_to_frame_size(const struct snd_pcm_hw_params *params); 515 538 int snd_soc_calc_bclk(int fs, int sample_size, int channels, int tdm_slots); 516 int snd_soc_params_to_bclk( struct snd_pcm_hw_params *parms);517 int snd_soc_tdm_params_to_bclk( struct snd_pcm_hw_params *params,539 int snd_soc_params_to_bclk(const struct snd_pcm_hw_params *parms); 540 int snd_soc_tdm_params_to_bclk(const struct snd_pcm_hw_params *params, 518 541 int tdm_width, int tdm_slots, int slot_multiple); 519 542 … … 620 643 const char *stream_name; 621 644 u64 formats; /* SNDRV_PCM_FMTBIT_* */ 645 u32 subformats; /* for S32_LE format, SNDRV_PCM_SUBFMTBIT_* */ 622 646 unsigned int rates; /* SNDRV_PCM_RATE_* */ 623 647 unsigned int rate_min; /* min rate */ … … 652 676 struct device_node *of_node; 653 677 const char *dai_name; 654 struct of_phandle_args *dai_args; 655 }; 656 657 struct snd_soc_dai_link_codec_ch_map { 658 unsigned int connected_cpu_id; 678 const struct of_phandle_args *dai_args; 679 }; 680 681 /* 682 * [dai_link->ch_maps Image sample] 683 * 684 *------------------------- 685 * CPU0 <---> Codec0 686 * 687 * ch-map[0].cpu = 0 ch-map[0].codec = 0 688 * 689 *------------------------- 690 * CPU0 <---> Codec0 691 * CPU1 <---> Codec1 692 * CPU2 <---> Codec2 693 * 694 * ch-map[0].cpu = 0 ch-map[0].codec = 0 695 * ch-map[1].cpu = 1 ch-map[1].codec = 1 696 * ch-map[2].cpu = 2 ch-map[2].codec = 2 697 * 698 *------------------------- 699 * CPU0 <---> Codec0 700 * CPU1 <-+-> Codec1 701 * CPU2 <-/ 702 * 703 * ch-map[0].cpu = 0 ch-map[0].codec = 0 704 * ch-map[1].cpu = 1 ch-map[1].codec = 1 705 * ch-map[2].cpu = 2 ch-map[2].codec = 1 706 * 707 *------------------------- 708 * CPU0 <---> Codec0 709 * CPU1 <-+-> Codec1 710 * \-> Codec2 711 * 712 * ch-map[0].cpu = 0 ch-map[0].codec = 0 713 * ch-map[1].cpu = 1 ch-map[1].codec = 1 714 * ch-map[2].cpu = 1 ch-map[2].codec = 2 715 * 716 */ 717 struct snd_soc_dai_link_ch_map { 718 unsigned int cpu; 719 unsigned int codec; 659 720 unsigned int ch_mask; 660 721 }; … … 688 749 unsigned int num_codecs; 689 750 690 struct snd_soc_dai_link_codec_ch_map *codec_ch_maps; 751 /* num_ch_maps = max(num_cpu, num_codecs) */ 752 struct snd_soc_dai_link_ch_map *ch_maps; 753 691 754 /* 692 755 * You MAY specify the link's platform/PCM/DMA driver, either by … … 753 816 unsigned int dynamic:1; 754 817 818 /* REMOVE ME */ 755 819 /* DPCM capture and Playback support */ 756 820 unsigned int dpcm_capture:1; … … 775 839 }; 776 840 777 /* REMOVE ME */ 778 #define asoc_link_to_cpu snd_soc_link_to_cpu 779 #define asoc_link_to_codec snd_soc_link_to_codec 780 #define asoc_link_to_platform snd_soc_link_to_platform 841 static inline int snd_soc_link_num_ch_map(const struct snd_soc_dai_link *link) 842 { 843 return max(link->num_cpus, link->num_codecs); 844 } 781 845 782 846 static inline struct snd_soc_dai_link_component* … … 811 875 ((i) < link->num_cpus) && \ 812 876 ((cpu) = snd_soc_link_to_cpu(link, i)); \ 877 (i)++) 878 879 #define for_each_link_ch_maps(link, i, ch_map) \ 880 for ((i) = 0; \ 881 ((i) < snd_soc_link_num_ch_map(link) && \ 882 ((ch_map) = link->ch_maps + i)); \ 813 883 (i)++) 814 884 … … 876 946 .num_platforms = ARRAY_SIZE(platform) 877 947 878 #define SND_SOC_DAILINK_REGx(_1, _2, _3, func, ...) func879 948 #define SND_SOC_DAILINK_REG(...) \ 880 SND_SOC_DAILINK_REGx(__VA_ARGS__, \ 881 SND_SOC_DAILINK_REG3, \ 882 SND_SOC_DAILINK_REG2, \ 883 SND_SOC_DAILINK_REG1)(__VA_ARGS__) 949 CONCATENATE(SND_SOC_DAILINK_REG, COUNT_ARGS(__VA_ARGS__))(__VA_ARGS__) 884 950 885 951 #define SND_SOC_DAILINK_DEF(name, def...) \ … … 898 964 #define COMP_AUX(_name) { .name = _name } 899 965 #define COMP_CODEC_CONF(_name) { .name = _name } 900 #define COMP_DUMMY() { .name = "snd-soc-dummy", .dai_name = "snd-soc-dummy-dai", } 901 902 /* REMOVE ME */ 903 #define asoc_dummy_dlc snd_soc_dummy_dlc 966 #define COMP_DUMMY() /* see snd_soc_fill_dummy_dai() */ 904 967 905 968 extern struct snd_soc_dai_link_component null_dailink_component[0]; … … 1145 1208 unsigned int pop_wait:1; 1146 1209 unsigned int fe_compr:1; /* for Dynamic PCM */ 1147 1148 bool initialized; 1149 1210 unsigned int initialized:1; 1211 1212 /* CPU/Codec/Platform */ 1150 1213 int num_components; 1151 struct snd_soc_component *components[]; /* CPU/Codec/Platform */ 1152 }; 1153 1154 /* REMOVE ME */ 1155 #define asoc_rtd_to_cpu snd_soc_rtd_to_cpu 1156 #define asoc_rtd_to_codec snd_soc_rtd_to_codec 1157 #define asoc_substream_to_rtd snd_soc_substream_to_rtd 1214 struct snd_soc_component *components[] __counted_by(num_components); 1215 }; 1158 1216 1159 1217 /* see soc_new_pcm_runtime() */ 1160 1218 #define snd_soc_rtd_to_cpu(rtd, n) (rtd)->dais[n] 1161 1219 #define snd_soc_rtd_to_codec(rtd, n) (rtd)->dais[n + (rtd)->dai_link->num_cpus] 1162 #define snd_soc_substream_to_rtd(substream) \ 1163 (struct snd_soc_pcm_runtime *)snd_pcm_substream_chip(substream) 1220 1221 static inline struct snd_soc_pcm_runtime * 1222 snd_soc_substream_to_rtd(const struct snd_pcm_substream *substream) 1223 { 1224 return snd_pcm_substream_chip(substream); 1225 } 1164 1226 1165 1227 #define for_each_rtd_components(rtd, i, component) \ … … 1180 1242 ((dai) = (rtd)->dais[i]); \ 1181 1243 (i)++) 1244 #define for_each_rtd_dais_reverse(rtd, i, dai) \ 1245 for ((i) = (rtd)->dai_link->num_cpus + (rtd)->dai_link->num_codecs - 1; \ 1246 (i) >= 0 && ((dai) = (rtd)->dais[i]); \ 1247 (i)--) 1248 #define for_each_rtd_ch_maps(rtd, i, ch_maps) for_each_link_ch_maps(rtd->dai_link, i, ch_maps) 1182 1249 1183 1250 void snd_soc_close_delayed_work(struct snd_soc_pcm_runtime *rtd); … … 1238 1305 }; 1239 1306 1240 static inline bool snd_soc_volsw_is_stereo( struct soc_mixer_control *mc)1307 static inline bool snd_soc_volsw_is_stereo(const struct soc_mixer_control *mc) 1241 1308 { 1242 1309 if (mc->reg == mc->rreg && mc->shift == mc->rshift) … … 1250 1317 } 1251 1318 1252 static inline unsigned int snd_soc_enum_val_to_item( struct soc_enum *e,1319 static inline unsigned int snd_soc_enum_val_to_item(const struct soc_enum *e, 1253 1320 unsigned int val) 1254 1321 { … … 1265 1332 } 1266 1333 1267 static inline unsigned int snd_soc_enum_item_to_val( struct soc_enum *e,1334 static inline unsigned int snd_soc_enum_item_to_val(const struct soc_enum *e, 1268 1335 unsigned int item) 1269 1336 { … … 1340 1407 snd_soc_daifmt_parse_clock_provider_as_bitmap(np, prefix)) 1341 1408 1342 int snd_soc_get_stream_cpu( struct snd_soc_dai_link *dai_link, int stream);1409 int snd_soc_get_stream_cpu(const struct snd_soc_dai_link *dai_link, int stream); 1343 1410 int snd_soc_get_dlc(const struct of_phandle_args *args, 1344 1411 struct snd_soc_dai_link_component *dlc); … … 1370 1437 struct snd_soc_dai_link_component *cpus); 1371 1438 struct of_phandle_args *snd_soc_copy_dai_args(struct device *dev, 1372 struct of_phandle_args *args);1373 struct snd_soc_dai *snd_soc_get_dai_via_args( struct of_phandle_args *dai_args);1439 const struct of_phandle_args *args); 1440 struct snd_soc_dai *snd_soc_get_dai_via_args(const struct of_phandle_args *dai_args); 1374 1441 struct snd_soc_dai *snd_soc_register_dai(struct snd_soc_component *component, 1375 1442 struct snd_soc_dai_driver *dai_drv,
Note:
See TracChangeset
for help on using the changeset viewer.