Changeset 772 for GPL/trunk/alsa-kernel/include/sound/soc.h
- Timestamp:
- Apr 19, 2025, 8:08:37 PM (4 months ago)
- Location:
- GPL/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
GPL/trunk
- Property svn:mergeinfo changed
/GPL/branches/uniaud32-6.6-LTS (added) merged: 765,768-769 /GPL/branches/uniaud32-exp (added) merged: 735-741,743-744,748-751,753-760,762-764 /GPL/branches/uniaud32-next merged: 718-734
- Property svn:mergeinfo changed
-
GPL/trunk/alsa-kernel/include/sound/soc.h
r703 r772 32 32 ((unsigned long)&(struct soc_mixer_control) \ 33 33 {.reg = xreg, .rreg = xreg, .shift = shift_left, \ 34 .rshift = shift_right, .max = xmax, .platform_max = xmax,\34 .rshift = shift_right, .max = xmax, \ 35 35 .invert = xinvert, .autodisable = xautodisable}) 36 36 #define SOC_DOUBLE_S_VALUE(xreg, shift_left, shift_right, xmin, xmax, xsign_bit, xinvert, xautodisable) \ 37 37 ((unsigned long)&(struct soc_mixer_control) \ 38 38 {.reg = xreg, .rreg = xreg, .shift = shift_left, \ 39 .rshift = shift_right, .min = xmin, .max = xmax, .platform_max = xmax,\39 .rshift = shift_right, .min = xmin, .max = xmax, \ 40 40 .sign_bit = xsign_bit, .invert = xinvert, .autodisable = xautodisable}) 41 41 #define SOC_SINGLE_VALUE(xreg, xshift, xmax, xinvert, xautodisable) \ … … 43 43 #define SOC_SINGLE_VALUE_EXT(xreg, xmax, xinvert) \ 44 44 ((unsigned long)&(struct soc_mixer_control) \ 45 {.reg = xreg, .max = xmax, . platform_max = xmax, .invert = xinvert})45 {.reg = xreg, .max = xmax, .invert = xinvert}) 46 46 #define SOC_DOUBLE_R_VALUE(xlreg, xrreg, xshift, xmax, xinvert) \ 47 47 ((unsigned long)&(struct soc_mixer_control) \ 48 48 {.reg = xlreg, .rreg = xrreg, .shift = xshift, .rshift = xshift, \ 49 .max = xmax, . platform_max = xmax, .invert = xinvert})49 .max = xmax, .invert = xinvert}) 50 50 #define SOC_DOUBLE_R_S_VALUE(xlreg, xrreg, xshift, xmin, xmax, xsign_bit, xinvert) \ 51 51 ((unsigned long)&(struct soc_mixer_control) \ 52 52 {.reg = xlreg, .rreg = xrreg, .shift = xshift, .rshift = xshift, \ 53 .max = xmax, .min = xmin, . platform_max = xmax, .sign_bit = xsign_bit, \53 .max = xmax, .min = xmin, .sign_bit = xsign_bit, \ 54 54 .invert = xinvert}) 55 55 #define SOC_DOUBLE_R_RANGE_VALUE(xlreg, xrreg, xshift, xmin, xmax, xinvert) \ 56 56 ((unsigned long)&(struct soc_mixer_control) \ 57 57 {.reg = xlreg, .rreg = xrreg, .shift = xshift, .rshift = xshift, \ 58 .min = xmin, .max = xmax, . platform_max = xmax, .invert = xinvert})58 .min = xmin, .max = xmax, .invert = xinvert}) 59 59 #define SOC_SINGLE(xname, reg, shift, max, invert) \ 60 60 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ … … 69 69 {.reg = xreg, .rreg = xreg, .shift = xshift, \ 70 70 .rshift = xshift, .min = xmin, .max = xmax, \ 71 . platform_max = xmax, .invert = xinvert} }71 .invert = xinvert} } 72 72 #define SOC_SINGLE_TLV(xname, reg, shift, max, invert, tlv_array) \ 73 73 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ … … 100 100 {.reg = xreg, .rreg = xreg, .shift = xshift, \ 101 101 .rshift = xshift, .min = xmin, .max = xmax, \ 102 . platform_max = xmax, .invert = xinvert} }102 .invert = xinvert} } 103 103 #define SOC_DOUBLE(xname, reg, shift_left, shift_right, max, invert) \ 104 104 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\ … … 137 137 .private_value = SOC_DOUBLE_VALUE(reg, shift_left, shift_right, \ 138 138 max, invert, 0) } 139 #define SOC_DOUBLE_SX_TLV(xname, xreg, shift_left, shift_right, xmin, xmax, tlv_array) \ 140 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \ 141 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ 142 SNDRV_CTL_ELEM_ACCESS_READWRITE, \ 143 .tlv.p = (tlv_array), \ 144 .info = snd_soc_info_volsw_sx, \ 145 .get = snd_soc_get_volsw_sx, \ 146 .put = snd_soc_put_volsw_sx, \ 147 .private_value = (unsigned long)&(struct soc_mixer_control) \ 148 {.reg = xreg, .rreg = xreg, \ 149 .shift = shift_left, .rshift = shift_right, \ 150 .max = xmax, .min = xmin} } 139 151 #define SOC_DOUBLE_R_TLV(xname, reg_left, reg_right, xshift, xmax, xinvert, tlv_array) \ 140 152 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\ … … 177 189 .private_value = SOC_DOUBLE_R_S_VALUE(reg_left, reg_right, xshift, \ 178 190 xmin, xmax, xsign_bit, xinvert) } 191 #define SOC_SINGLE_S_TLV(xname, xreg, xshift, xmin, xmax, xsign_bit, xinvert, tlv_array) \ 192 SOC_DOUBLE_R_S_TLV(xname, xreg, xreg, xshift, xmin, xmax, xsign_bit, xinvert, tlv_array) 179 193 #define SOC_SINGLE_S8_TLV(xname, xreg, xmin, xmax, tlv_array) \ 180 194 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \ … … 186 200 .private_value = (unsigned long)&(struct soc_mixer_control) \ 187 201 {.reg = xreg, .rreg = xreg, \ 188 .min = xmin, .max = xmax, .platform_max = xmax,\202 .min = xmin, .max = xmax, \ 189 203 .sign_bit = 7,} } 190 204 #define SOC_DOUBLE_S8_TLV(xname, xreg, xmin, xmax, tlv_array) \ … … 260 274 {.reg = xreg, .rreg = xreg, .shift = xshift, \ 261 275 .rshift = xshift, .min = xmin, .max = xmax, \ 262 . platform_max = xmax, .invert = xinvert} }276 .invert = xinvert} } 263 277 #define SOC_DOUBLE_EXT_TLV(xname, xreg, shift_left, shift_right, xmax, xinvert,\ 264 278 xhandler_get, xhandler_put, tlv_array) \ … … 281 295 .private_value = SOC_DOUBLE_R_VALUE(reg_left, reg_right, xshift, \ 282 296 xmax, xinvert) } 297 #define SOC_DOUBLE_R_S_EXT_TLV(xname, reg_left, reg_right, xshift, xmin, xmax, \ 298 xsign_bit, xinvert, xhandler_get, xhandler_put, \ 299 tlv_array) \ 300 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \ 301 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ 302 SNDRV_CTL_ELEM_ACCESS_READWRITE, \ 303 .tlv.p = (tlv_array), \ 304 .info = snd_soc_info_volsw, \ 305 .get = xhandler_get, .put = xhandler_put, \ 306 .private_value = SOC_DOUBLE_R_S_VALUE(reg_left, reg_right, xshift, \ 307 xmin, xmax, xsign_bit, xinvert) } 308 #define SOC_SINGLE_S_EXT_TLV(xname, xreg, xshift, xmin, xmax, \ 309 xsign_bit, xinvert, xhandler_get, xhandler_put, \ 310 tlv_array) \ 311 SOC_DOUBLE_R_S_EXT_TLV(xname, xreg, xreg, xshift, xmin, xmax, \ 312 xsign_bit, xinvert, xhandler_get, xhandler_put, \ 313 tlv_array) 283 314 #define SOC_SINGLE_BOOL_EXT(xname, xdata, xhandler_get, xhandler_put) \ 284 315 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ … … 390 421 struct snd_soc_jack_gpio; 391 422 392 typedef int (*hw_write_t)(void *,const char* ,int);393 394 423 enum snd_soc_pcm_subclass { 395 424 SND_SOC_PCM_CLASS_PCM = 0, … … 398 427 399 428 int snd_soc_register_card(struct snd_soc_card *card); 400 intsnd_soc_unregister_card(struct snd_soc_card *card);429 void snd_soc_unregister_card(struct snd_soc_card *card); 401 430 int devm_snd_soc_register_card(struct device *dev, struct snd_soc_card *card); 402 431 #ifdef CONFIG_PM_SLEEP … … 486 515 int snd_soc_calc_bclk(int fs, int sample_size, int channels, int tdm_slots); 487 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, 518 int tdm_width, int tdm_slots, int slot_multiple); 488 519 489 520 /* set runtime hw params */ … … 577 608 struct snd_ctl_elem_value *ucontrol); 578 609 610 enum snd_soc_trigger_order { 611 /* start stop */ 612 SND_SOC_TRIGGER_ORDER_DEFAULT = 0, /* Link->Component->DAI DAI->Component->Link */ 613 SND_SOC_TRIGGER_ORDER_LDC, /* Link->DAI->Component Component->DAI->Link */ 614 615 SND_SOC_TRIGGER_ORDER_MAX, 616 }; 617 579 618 /* SoC PCM stream information */ 580 619 struct snd_soc_pcm_stream { … … 603 642 void (*shutdown)(struct snd_compr_stream *); 604 643 int (*set_params)(struct snd_compr_stream *); 605 int (*trigger)(struct snd_compr_stream *);606 644 }; 607 645 … … 614 652 struct device_node *of_node; 615 653 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; 659 unsigned int ch_mask; 616 660 }; 617 661 … … 644 688 unsigned int num_codecs; 645 689 690 struct snd_soc_dai_link_codec_ch_map *codec_ch_maps; 646 691 /* 647 692 * You MAY specify the link's platform/PCM/DMA driver, either by … … 654 699 int id; /* optional ID for machine driver link identification */ 655 700 656 const struct snd_soc_pcm_stream *params; 657 unsigned int num_params; 701 /* 702 * for Codec2Codec 703 */ 704 const struct snd_soc_pcm_stream *c2c_params; 705 unsigned int num_c2c_params; 658 706 659 707 unsigned int dai_fmt; /* format to set on init */ … … 674 722 const struct snd_soc_ops *ops; 675 723 const struct snd_soc_compr_ops *compr_ops; 724 725 /* 726 * soc_pcm_trigger() start/stop sequence. 727 * see also 728 * snd_soc_component_driver 729 * soc_pcm_trigger() 730 */ 731 enum snd_soc_trigger_order trigger_start; 732 enum snd_soc_trigger_order trigger_stop; 676 733 677 734 /* Mark this pcm with non atomic ops */ … … 713 770 unsigned int ignore:1; 714 771 715 /* This flag will reorder stop sequence. By enabling this flag716 * DMA controller stop sequence will be invoked first followed by717 * CPU DAI driver stop sequence718 */719 unsigned int stop_dma_first:1;720 721 772 #ifdef CONFIG_SND_SOC_TOPOLOGY 722 773 struct snd_soc_dobj dobj; /* For topology */ … … 724 775 }; 725 776 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 781 726 782 static inline struct snd_soc_dai_link_component* 727 asoc_link_to_cpu(struct snd_soc_dai_link *link, int n) {783 snd_soc_link_to_cpu(struct snd_soc_dai_link *link, int n) { 728 784 return &(link)->cpus[n]; 729 785 } 730 786 731 787 static inline struct snd_soc_dai_link_component* 732 asoc_link_to_codec(struct snd_soc_dai_link *link, int n) {788 snd_soc_link_to_codec(struct snd_soc_dai_link *link, int n) { 733 789 return &(link)->codecs[n]; 734 790 } 735 791 736 792 static inline struct snd_soc_dai_link_component* 737 asoc_link_to_platform(struct snd_soc_dai_link *link, int n) {793 snd_soc_link_to_platform(struct snd_soc_dai_link *link, int n) { 738 794 return &(link)->platforms[n]; 739 795 } … … 742 798 for ((i) = 0; \ 743 799 ((i) < link->num_codecs) && \ 744 ((codec) = asoc_link_to_codec(link, i)); \800 ((codec) = snd_soc_link_to_codec(link, i)); \ 745 801 (i)++) 746 802 … … 748 804 for ((i) = 0; \ 749 805 ((i) < link->num_platforms) && \ 750 ((platform) = asoc_link_to_platform(link, i)); \806 ((platform) = snd_soc_link_to_platform(link, i)); \ 751 807 (i)++) 752 808 … … 754 810 for ((i) = 0; \ 755 811 ((i) < link->num_cpus) && \ 756 ((cpu) = asoc_link_to_cpu(link, i)); \812 ((cpu) = snd_soc_link_to_cpu(link, i)); \ 757 813 (i)++) 758 814 … … 844 900 #define COMP_DUMMY() { .name = "snd-soc-dummy", .dai_name = "snd-soc-dummy-dai", } 845 901 902 /* REMOVE ME */ 903 #define asoc_dummy_dlc snd_soc_dummy_dlc 904 846 905 extern struct snd_soc_dai_link_component null_dailink_component[0]; 906 extern struct snd_soc_dai_link_component snd_soc_dummy_dlc; 847 907 848 908 … … 881 941 char dmi_longname[80]; 882 942 #endif /* CONFIG_DMI */ 943 944 #ifdef CONFIG_PCI 945 /* 946 * PCI does not define 0 as invalid, so pci_subsystem_set indicates 947 * whether a value has been written to these fields. 948 */ 949 unsigned short pci_subsystem_vendor; 950 unsigned short pci_subsystem_device; 951 bool pci_subsystem_set; 952 #endif /* CONFIG_PCI */ 953 883 954 char topology_shortname[32]; 884 955 … … 894 965 enum snd_soc_pcm_subclass pcm_subclass; 895 966 896 spinlock_t dpcm_lock;897 898 967 int (*probe)(struct snd_soc_card *card); 899 968 int (*late_probe)(struct snd_soc_card *card); 969 void (*fixup_controls)(struct snd_soc_card *card); 900 970 int (*remove)(struct snd_soc_card *card); 901 971 … … 1023 1093 list_for_each_entry_safe(w, _w, &card->widgets, list) 1024 1094 1095 1096 static inline int snd_soc_card_is_instantiated(struct snd_soc_card *card) 1097 { 1098 return card && card->instantiated; 1099 } 1100 1025 1101 /* SoC machine DAI configuration, glues a codec and cpu DAI together */ 1026 1102 struct snd_soc_pcm_runtime { … … 1030 1106 struct snd_pcm_ops ops; 1031 1107 1032 unsigned int params_select; /* currently selectedparam for dai link */1108 unsigned int c2c_params_select; /* currently selected c2c_param for dai link */ 1033 1109 1034 1110 /* Dynamic PCM BE runtime data */ 1035 struct snd_soc_dpcm_runtime dpcm[2]; 1111 struct snd_soc_dpcm_runtime dpcm[SNDRV_PCM_STREAM_LAST + 1]; 1112 struct snd_soc_dapm_widget *c2c_widget[SNDRV_PCM_STREAM_LAST + 1]; 1036 1113 1037 1114 long pmdown_time; … … 1045 1122 * see 1046 1123 * soc_new_pcm_runtime() 1047 * asoc_rtd_to_cpu()1048 * asoc_rtd_to_codec()1124 * snd_soc_rtd_to_cpu() 1125 * snd_soc_rtd_to_codec() 1049 1126 */ 1050 1127 struct snd_soc_dai **dais; 1051 unsigned int num_codecs;1052 unsigned int num_cpus;1053 1054 struct snd_soc_dapm_widget *playback_widget;1055 struct snd_soc_dapm_widget *capture_widget;1056 1128 1057 1129 struct delayed_work delayed_work; … … 1074 1146 unsigned int fe_compr:1; /* for Dynamic PCM */ 1075 1147 1148 bool initialized; 1149 1076 1150 int num_components; 1077 1151 struct snd_soc_component *components[]; /* CPU/Codec/Platform */ 1078 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 1158 1079 1159 /* see soc_new_pcm_runtime() */ 1080 #define asoc_rtd_to_cpu(rtd, n) (rtd)->dais[n]1081 #define asoc_rtd_to_codec(rtd, n) (rtd)->dais[n + (rtd)->num_cpus]1082 #define asoc_substream_to_rtd(substream) \1160 #define snd_soc_rtd_to_cpu(rtd, n) (rtd)->dais[n] 1161 #define snd_soc_rtd_to_codec(rtd, n) (rtd)->dais[n + (rtd)->dai_link->num_cpus] 1162 #define snd_soc_substream_to_rtd(substream) \ 1083 1163 (struct snd_soc_pcm_runtime *)snd_pcm_substream_chip(substream) 1084 1164 … … 1089 1169 #define for_each_rtd_cpu_dais(rtd, i, dai) \ 1090 1170 for ((i) = 0; \ 1091 ((i) < rtd-> num_cpus) && ((dai) = asoc_rtd_to_cpu(rtd, i)); \1171 ((i) < rtd->dai_link->num_cpus) && ((dai) = snd_soc_rtd_to_cpu(rtd, i)); \ 1092 1172 (i)++) 1093 1173 #define for_each_rtd_codec_dais(rtd, i, dai) \ 1094 1174 for ((i) = 0; \ 1095 ((i) < rtd-> num_codecs) && ((dai) = asoc_rtd_to_codec(rtd, i)); \1175 ((i) < rtd->dai_link->num_codecs) && ((dai) = snd_soc_rtd_to_codec(rtd, i)); \ 1096 1176 (i)++) 1097 1177 #define for_each_rtd_dais(rtd, i, dai) \ 1098 1178 for ((i) = 0; \ 1099 ((i) < (rtd)-> num_cpus + (rtd)->num_codecs) &&\1179 ((i) < (rtd)->dai_link->num_cpus + (rtd)->dai_link->num_codecs) && \ 1100 1180 ((dai) = (rtd)->dais[i]); \ 1101 1181 (i)++) … … 1105 1185 /* mixer control */ 1106 1186 struct soc_mixer_control { 1107 int min, max, platform_max; 1187 /* Minimum and maximum specified as written to the hardware */ 1188 int min, max; 1189 /* Limited maximum value specified as presented through the control */ 1190 int platform_max; 1108 1191 int reg, rreg; 1109 1192 unsigned int shift, rshift; … … 1214 1297 int snd_soc_of_parse_audio_simple_widgets(struct snd_soc_card *card, 1215 1298 const char *propname); 1299 int snd_soc_of_parse_pin_switches(struct snd_soc_card *card, const char *prop); 1216 1300 int snd_soc_of_get_slot_mask(struct device_node *np, 1217 1301 const char *prop_name, … … 1240 1324 int snd_soc_of_parse_aux_devs(struct snd_soc_card *card, const char *propname); 1241 1325 1242 unsigned int snd_soc_daifmt_clock_provider_flip ed(unsigned int dai_fmt);1326 unsigned int snd_soc_daifmt_clock_provider_flipped(unsigned int dai_fmt); 1243 1327 unsigned int snd_soc_daifmt_clock_provider_from_bitmap(unsigned int bit_frame); 1244 1328 … … 1256 1340 snd_soc_daifmt_parse_clock_provider_as_bitmap(np, prefix)) 1257 1341 1342 int snd_soc_get_stream_cpu(struct snd_soc_dai_link *dai_link, int stream); 1343 int snd_soc_get_dlc(const struct of_phandle_args *args, 1344 struct snd_soc_dai_link_component *dlc); 1345 int snd_soc_of_get_dlc(struct device_node *of_node, 1346 struct of_phandle_args *args, 1347 struct snd_soc_dai_link_component *dlc, 1348 int index); 1258 1349 int snd_soc_get_dai_id(struct device_node *ep); 1259 1350 int snd_soc_get_dai_name(const struct of_phandle_args *args, 1260 1351 const char **dai_name); 1261 1352 int snd_soc_of_get_dai_name(struct device_node *of_node, 1262 const char **dai_name );1353 const char **dai_name, int index); 1263 1354 int snd_soc_of_get_dai_link_codecs(struct device *dev, 1264 1355 struct device_node *of_node, 1265 1356 struct snd_soc_dai_link *dai_link); 1266 1357 void snd_soc_of_put_dai_link_codecs(struct snd_soc_dai_link *dai_link); 1267 1268 int snd_soc_add_pcm_runtime(struct snd_soc_card *card, 1269 struct snd_soc_dai_link *dai_link); 1358 int snd_soc_of_get_dai_link_cpus(struct device *dev, 1359 struct device_node *of_node, 1360 struct snd_soc_dai_link *dai_link); 1361 void snd_soc_of_put_dai_link_cpus(struct snd_soc_dai_link *dai_link); 1362 1363 int snd_soc_add_pcm_runtimes(struct snd_soc_card *card, 1364 struct snd_soc_dai_link *dai_link, 1365 int num_dai_link); 1270 1366 void snd_soc_remove_pcm_runtime(struct snd_soc_card *card, 1271 1367 struct snd_soc_pcm_runtime *rtd); 1272 1368 1369 void snd_soc_dlc_use_cpu_as_platform(struct snd_soc_dai_link_component *platforms, 1370 struct snd_soc_dai_link_component *cpus); 1371 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); 1273 1374 struct snd_soc_dai *snd_soc_register_dai(struct snd_soc_component *component, 1274 1375 struct snd_soc_dai_driver *dai_drv, … … 1324 1425 extern const struct dev_pm_ops snd_soc_pm_ops; 1325 1426 1326 /* Helper functions */ 1327 static inline void snd_soc_dapm_mutex_lock(struct snd_soc_dapm_context *dapm) 1328 { 1329 mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME); 1330 } 1331 1332 static inline void snd_soc_dapm_mutex_unlock(struct snd_soc_dapm_context *dapm) 1333 { 1334 mutex_unlock(&dapm->card->dapm_mutex); 1335 } 1427 /* 1428 * DAPM helper functions 1429 */ 1430 enum snd_soc_dapm_subclass { 1431 SND_SOC_DAPM_CLASS_ROOT = 0, 1432 SND_SOC_DAPM_CLASS_RUNTIME = 1, 1433 }; 1434 1435 static inline void _snd_soc_dapm_mutex_lock_root_c(struct snd_soc_card *card) 1436 { 1437 mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_ROOT); 1438 } 1439 1440 static inline void _snd_soc_dapm_mutex_lock_c(struct snd_soc_card *card) 1441 { 1442 mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME); 1443 } 1444 1445 static inline void _snd_soc_dapm_mutex_unlock_c(struct snd_soc_card *card) 1446 { 1447 mutex_unlock(&card->dapm_mutex); 1448 } 1449 1450 static inline void _snd_soc_dapm_mutex_assert_held_c(struct snd_soc_card *card) 1451 { 1452 lockdep_assert_held(&card->dapm_mutex); 1453 } 1454 1455 static inline void _snd_soc_dapm_mutex_lock_root_d(struct snd_soc_dapm_context *dapm) 1456 { 1457 _snd_soc_dapm_mutex_lock_root_c(dapm->card); 1458 } 1459 1460 static inline void _snd_soc_dapm_mutex_lock_d(struct snd_soc_dapm_context *dapm) 1461 { 1462 _snd_soc_dapm_mutex_lock_c(dapm->card); 1463 } 1464 1465 static inline void _snd_soc_dapm_mutex_unlock_d(struct snd_soc_dapm_context *dapm) 1466 { 1467 _snd_soc_dapm_mutex_unlock_c(dapm->card); 1468 } 1469 1470 static inline void _snd_soc_dapm_mutex_assert_held_d(struct snd_soc_dapm_context *dapm) 1471 { 1472 _snd_soc_dapm_mutex_assert_held_c(dapm->card); 1473 } 1474 1475 #define snd_soc_dapm_mutex_lock_root(x) _Generic((x), \ 1476 struct snd_soc_card * : _snd_soc_dapm_mutex_lock_root_c, \ 1477 struct snd_soc_dapm_context * : _snd_soc_dapm_mutex_lock_root_d)(x) 1478 #define snd_soc_dapm_mutex_lock(x) _Generic((x), \ 1479 struct snd_soc_card * : _snd_soc_dapm_mutex_lock_c, \ 1480 struct snd_soc_dapm_context * : _snd_soc_dapm_mutex_lock_d)(x) 1481 #define snd_soc_dapm_mutex_unlock(x) _Generic((x), \ 1482 struct snd_soc_card * : _snd_soc_dapm_mutex_unlock_c, \ 1483 struct snd_soc_dapm_context * : _snd_soc_dapm_mutex_unlock_d)(x) 1484 #define snd_soc_dapm_mutex_assert_held(x) _Generic((x), \ 1485 struct snd_soc_card * : _snd_soc_dapm_mutex_assert_held_c, \ 1486 struct snd_soc_dapm_context * : _snd_soc_dapm_mutex_assert_held_d)(x) 1487 1488 /* 1489 * PCM helper functions 1490 */ 1491 static inline void _snd_soc_dpcm_mutex_lock_c(struct snd_soc_card *card) 1492 { 1493 mutex_lock_nested(&card->pcm_mutex, card->pcm_subclass); 1494 } 1495 1496 static inline void _snd_soc_dpcm_mutex_unlock_c(struct snd_soc_card *card) 1497 { 1498 mutex_unlock(&card->pcm_mutex); 1499 } 1500 1501 static inline void _snd_soc_dpcm_mutex_assert_held_c(struct snd_soc_card *card) 1502 { 1503 lockdep_assert_held(&card->pcm_mutex); 1504 } 1505 1506 static inline void _snd_soc_dpcm_mutex_lock_r(struct snd_soc_pcm_runtime *rtd) 1507 { 1508 _snd_soc_dpcm_mutex_lock_c(rtd->card); 1509 } 1510 1511 static inline void _snd_soc_dpcm_mutex_unlock_r(struct snd_soc_pcm_runtime *rtd) 1512 { 1513 _snd_soc_dpcm_mutex_unlock_c(rtd->card); 1514 } 1515 1516 static inline void _snd_soc_dpcm_mutex_assert_held_r(struct snd_soc_pcm_runtime *rtd) 1517 { 1518 _snd_soc_dpcm_mutex_assert_held_c(rtd->card); 1519 } 1520 1521 #define snd_soc_dpcm_mutex_lock(x) _Generic((x), \ 1522 struct snd_soc_card * : _snd_soc_dpcm_mutex_lock_c, \ 1523 struct snd_soc_pcm_runtime * : _snd_soc_dpcm_mutex_lock_r)(x) 1524 1525 #define snd_soc_dpcm_mutex_unlock(x) _Generic((x), \ 1526 struct snd_soc_card * : _snd_soc_dpcm_mutex_unlock_c, \ 1527 struct snd_soc_pcm_runtime * : _snd_soc_dpcm_mutex_unlock_r)(x) 1528 1529 #define snd_soc_dpcm_mutex_assert_held(x) _Generic((x), \ 1530 struct snd_soc_card * : _snd_soc_dpcm_mutex_assert_held_c, \ 1531 struct snd_soc_pcm_runtime * : _snd_soc_dpcm_mutex_assert_held_r)(x) 1336 1532 1337 1533 #include <sound/soc-component.h>
Note:
See TracChangeset
for help on using the changeset viewer.