Ignore:
Timestamp:
Apr 19, 2025, 8:08:37 PM (4 months ago)
Author:
David Azarewicz
Message:

Merge in changes from 6.6-LTS branch.
Fixed additional 25+ problems.

Location:
GPL/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • GPL/trunk

  • GPL/trunk/alsa-kernel/include/sound/soc.h

    r703 r772  
    3232        ((unsigned long)&(struct soc_mixer_control) \
    3333        {.reg = xreg, .rreg = xreg, .shift = shift_left, \
    34         .rshift = shift_right, .max = xmax, .platform_max = xmax, \
     34        .rshift = shift_right, .max = xmax, \
    3535        .invert = xinvert, .autodisable = xautodisable})
    3636#define SOC_DOUBLE_S_VALUE(xreg, shift_left, shift_right, xmin, xmax, xsign_bit, xinvert, xautodisable) \
    3737        ((unsigned long)&(struct soc_mixer_control) \
    3838        {.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, \
    4040        .sign_bit = xsign_bit, .invert = xinvert, .autodisable = xautodisable})
    4141#define SOC_SINGLE_VALUE(xreg, xshift, xmax, xinvert, xautodisable) \
     
    4343#define SOC_SINGLE_VALUE_EXT(xreg, xmax, xinvert) \
    4444        ((unsigned long)&(struct soc_mixer_control) \
    45         {.reg = xreg, .max = xmax, .platform_max = xmax, .invert = xinvert})
     45        {.reg = xreg, .max = xmax, .invert = xinvert})
    4646#define SOC_DOUBLE_R_VALUE(xlreg, xrreg, xshift, xmax, xinvert) \
    4747        ((unsigned long)&(struct soc_mixer_control) \
    4848        {.reg = xlreg, .rreg = xrreg, .shift = xshift, .rshift = xshift, \
    49         .max = xmax, .platform_max = xmax, .invert = xinvert})
     49        .max = xmax, .invert = xinvert})
    5050#define SOC_DOUBLE_R_S_VALUE(xlreg, xrreg, xshift, xmin, xmax, xsign_bit, xinvert) \
    5151        ((unsigned long)&(struct soc_mixer_control) \
    5252        {.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, \
    5454        .invert = xinvert})
    5555#define SOC_DOUBLE_R_RANGE_VALUE(xlreg, xrreg, xshift, xmin, xmax, xinvert) \
    5656        ((unsigned long)&(struct soc_mixer_control) \
    5757        {.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})
    5959#define SOC_SINGLE(xname, reg, shift, max, invert) \
    6060{       .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
     
    6969                {.reg = xreg, .rreg = xreg, .shift = xshift, \
    7070                 .rshift = xshift,  .min = xmin, .max = xmax, \
    71                  .platform_max = xmax, .invert = xinvert} }
     71                 .invert = xinvert} }
    7272#define SOC_SINGLE_TLV(xname, reg, shift, max, invert, tlv_array) \
    7373{       .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
     
    100100                {.reg = xreg, .rreg = xreg, .shift = xshift, \
    101101                 .rshift = xshift, .min = xmin, .max = xmax, \
    102                  .platform_max = xmax, .invert = xinvert} }
     102                 .invert = xinvert} }
    103103#define SOC_DOUBLE(xname, reg, shift_left, shift_right, max, invert) \
    104104{       .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
     
    137137        .private_value = SOC_DOUBLE_VALUE(reg, shift_left, shift_right, \
    138138                                          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} }
    139151#define SOC_DOUBLE_R_TLV(xname, reg_left, reg_right, xshift, xmax, xinvert, tlv_array) \
    140152{       .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
     
    177189        .private_value = SOC_DOUBLE_R_S_VALUE(reg_left, reg_right, xshift, \
    178190                                            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)
    179193#define SOC_SINGLE_S8_TLV(xname, xreg, xmin, xmax, tlv_array) \
    180194{       .iface  = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
     
    186200        .private_value = (unsigned long)&(struct soc_mixer_control) \
    187201        {.reg = xreg, .rreg = xreg,  \
    188          .min = xmin, .max = xmax, .platform_max = xmax, \
     202         .min = xmin, .max = xmax, \
    189203        .sign_bit = 7,} }
    190204#define SOC_DOUBLE_S8_TLV(xname, xreg, xmin, xmax, tlv_array) \
     
    260274                {.reg = xreg, .rreg = xreg, .shift = xshift, \
    261275                 .rshift = xshift, .min = xmin, .max = xmax, \
    262                  .platform_max = xmax, .invert = xinvert} }
     276                 .invert = xinvert} }
    263277#define SOC_DOUBLE_EXT_TLV(xname, xreg, shift_left, shift_right, xmax, xinvert,\
    264278         xhandler_get, xhandler_put, tlv_array) \
     
    281295        .private_value = SOC_DOUBLE_R_VALUE(reg_left, reg_right, xshift, \
    282296                                            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)
    283314#define SOC_SINGLE_BOOL_EXT(xname, xdata, xhandler_get, xhandler_put) \
    284315{       .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
     
    390421struct snd_soc_jack_gpio;
    391422
    392 typedef int (*hw_write_t)(void *,const char* ,int);
    393 
    394423enum snd_soc_pcm_subclass {
    395424        SND_SOC_PCM_CLASS_PCM   = 0,
     
    398427
    399428int snd_soc_register_card(struct snd_soc_card *card);
    400 int snd_soc_unregister_card(struct snd_soc_card *card);
     429void snd_soc_unregister_card(struct snd_soc_card *card);
    401430int devm_snd_soc_register_card(struct device *dev, struct snd_soc_card *card);
    402431#ifdef CONFIG_PM_SLEEP
     
    486515int snd_soc_calc_bclk(int fs, int sample_size, int channels, int tdm_slots);
    487516int snd_soc_params_to_bclk(struct snd_pcm_hw_params *parms);
     517int snd_soc_tdm_params_to_bclk(struct snd_pcm_hw_params *params,
     518                               int tdm_width, int tdm_slots, int slot_multiple);
    488519
    489520/* set runtime hw params */
     
    577608        struct snd_ctl_elem_value *ucontrol);
    578609
     610enum 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
    579618/* SoC PCM stream information */
    580619struct snd_soc_pcm_stream {
     
    603642        void (*shutdown)(struct snd_compr_stream *);
    604643        int (*set_params)(struct snd_compr_stream *);
    605         int (*trigger)(struct snd_compr_stream *);
    606644};
    607645
     
    614652        struct device_node *of_node;
    615653        const char *dai_name;
     654        struct of_phandle_args *dai_args;
     655};
     656
     657struct snd_soc_dai_link_codec_ch_map {
     658        unsigned int connected_cpu_id;
     659        unsigned int ch_mask;
    616660};
    617661
     
    644688        unsigned int num_codecs;
    645689
     690        struct snd_soc_dai_link_codec_ch_map *codec_ch_maps;
    646691        /*
    647692         * You MAY specify the link's platform/PCM/DMA driver, either by
     
    654699        int id; /* optional ID for machine driver link identification */
    655700
    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;
    658706
    659707        unsigned int dai_fmt;           /* format to set on init */
     
    674722        const struct snd_soc_ops *ops;
    675723        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;
    676733
    677734        /* Mark this pcm with non atomic ops */
     
    713770        unsigned int ignore:1;
    714771
    715         /* This flag will reorder stop sequence. By enabling this flag
    716          * DMA controller stop sequence will be invoked first followed by
    717          * CPU DAI driver stop sequence
    718          */
    719         unsigned int stop_dma_first:1;
    720 
    721772#ifdef CONFIG_SND_SOC_TOPOLOGY
    722773        struct snd_soc_dobj dobj; /* For topology */
     
    724775};
    725776
     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
    726782static inline struct snd_soc_dai_link_component*
    727 asoc_link_to_cpu(struct snd_soc_dai_link *link, int n) {
     783snd_soc_link_to_cpu(struct snd_soc_dai_link *link, int n) {
    728784        return &(link)->cpus[n];
    729785}
    730786
    731787static inline struct snd_soc_dai_link_component*
    732 asoc_link_to_codec(struct snd_soc_dai_link *link, int n) {
     788snd_soc_link_to_codec(struct snd_soc_dai_link *link, int n) {
    733789        return &(link)->codecs[n];
    734790}
    735791
    736792static inline struct snd_soc_dai_link_component*
    737 asoc_link_to_platform(struct snd_soc_dai_link *link, int n) {
     793snd_soc_link_to_platform(struct snd_soc_dai_link *link, int n) {
    738794        return &(link)->platforms[n];
    739795}
     
    742798        for ((i) = 0;                                                   \
    743799             ((i) < link->num_codecs) &&                                \
    744                      ((codec) = asoc_link_to_codec(link, i));           \
     800                     ((codec) = snd_soc_link_to_codec(link, i));                \
    745801             (i)++)
    746802
     
    748804        for ((i) = 0;                                                   \
    749805             ((i) < link->num_platforms) &&                             \
    750                      ((platform) = asoc_link_to_platform(link, i));     \
     806                     ((platform) = snd_soc_link_to_platform(link, i));  \
    751807             (i)++)
    752808
     
    754810        for ((i) = 0;                                                   \
    755811             ((i) < link->num_cpus) &&                                  \
    756                      ((cpu) = asoc_link_to_cpu(link, i));               \
     812                     ((cpu) = snd_soc_link_to_cpu(link, i));            \
    757813             (i)++)
    758814
     
    844900#define COMP_DUMMY()                    { .name = "snd-soc-dummy", .dai_name = "snd-soc-dummy-dai", }
    845901
     902/* REMOVE ME */
     903#define asoc_dummy_dlc          snd_soc_dummy_dlc
     904
    846905extern struct snd_soc_dai_link_component null_dailink_component[0];
     906extern struct snd_soc_dai_link_component snd_soc_dummy_dlc;
    847907
    848908
     
    881941        char dmi_longname[80];
    882942#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
    883954        char topology_shortname[32];
    884955
     
    894965        enum snd_soc_pcm_subclass pcm_subclass;
    895966
    896         spinlock_t dpcm_lock;
    897 
    898967        int (*probe)(struct snd_soc_card *card);
    899968        int (*late_probe)(struct snd_soc_card *card);
     969        void (*fixup_controls)(struct snd_soc_card *card);
    900970        int (*remove)(struct snd_soc_card *card);
    901971
     
    10231093        list_for_each_entry_safe(w, _w, &card->widgets, list)
    10241094
     1095
     1096static inline int snd_soc_card_is_instantiated(struct snd_soc_card *card)
     1097{
     1098        return card && card->instantiated;
     1099}
     1100
    10251101/* SoC machine DAI configuration, glues a codec and cpu DAI together */
    10261102struct snd_soc_pcm_runtime {
     
    10301106        struct snd_pcm_ops ops;
    10311107
    1032         unsigned int params_select; /* currently selected param for dai link */
     1108        unsigned int c2c_params_select; /* currently selected c2c_param for dai link */
    10331109
    10341110        /* 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];
    10361113
    10371114        long pmdown_time;
     
    10451122         * see
    10461123         *      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()
    10491126         */
    10501127        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;
    10561128
    10571129        struct delayed_work delayed_work;
     
    10741146        unsigned int fe_compr:1; /* for Dynamic PCM */
    10751147
     1148        bool initialized;
     1149
    10761150        int num_components;
    10771151        struct snd_soc_component *components[]; /* CPU/Codec/Platform */
    10781152};
     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
    10791159/* 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) \
    10831163        (struct snd_soc_pcm_runtime *)snd_pcm_substream_chip(substream)
    10841164
     
    10891169#define for_each_rtd_cpu_dais(rtd, i, dai)                              \
    10901170        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)); \
    10921172             (i)++)
    10931173#define for_each_rtd_codec_dais(rtd, i, dai)                            \
    10941174        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)); \
    10961176             (i)++)
    10971177#define for_each_rtd_dais(rtd, i, dai)                                  \
    10981178        for ((i) = 0;                                                   \
    1099              ((i) < (rtd)->num_cpus + (rtd)->num_codecs) &&             \
     1179             ((i) < (rtd)->dai_link->num_cpus + (rtd)->dai_link->num_codecs) && \
    11001180                     ((dai) = (rtd)->dais[i]);                          \
    11011181             (i)++)
     
    11051185/* mixer control */
    11061186struct 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;
    11081191        int reg, rreg;
    11091192        unsigned int shift, rshift;
     
    12141297int snd_soc_of_parse_audio_simple_widgets(struct snd_soc_card *card,
    12151298                                          const char *propname);
     1299int snd_soc_of_parse_pin_switches(struct snd_soc_card *card, const char *prop);
    12161300int snd_soc_of_get_slot_mask(struct device_node *np,
    12171301                             const char *prop_name,
     
    12401324int snd_soc_of_parse_aux_devs(struct snd_soc_card *card, const char *propname);
    12411325
    1242 unsigned int snd_soc_daifmt_clock_provider_fliped(unsigned int dai_fmt);
     1326unsigned int snd_soc_daifmt_clock_provider_flipped(unsigned int dai_fmt);
    12431327unsigned int snd_soc_daifmt_clock_provider_from_bitmap(unsigned int bit_frame);
    12441328
     
    12561340                snd_soc_daifmt_parse_clock_provider_as_bitmap(np, prefix))
    12571341
     1342int snd_soc_get_stream_cpu(struct snd_soc_dai_link *dai_link, int stream);
     1343int snd_soc_get_dlc(const struct of_phandle_args *args,
     1344                    struct snd_soc_dai_link_component *dlc);
     1345int 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);
    12581349int snd_soc_get_dai_id(struct device_node *ep);
    12591350int snd_soc_get_dai_name(const struct of_phandle_args *args,
    12601351                         const char **dai_name);
    12611352int snd_soc_of_get_dai_name(struct device_node *of_node,
    1262                             const char **dai_name);
     1353                            const char **dai_name, int index);
    12631354int snd_soc_of_get_dai_link_codecs(struct device *dev,
    12641355                                   struct device_node *of_node,
    12651356                                   struct snd_soc_dai_link *dai_link);
    12661357void 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);
     1358int snd_soc_of_get_dai_link_cpus(struct device *dev,
     1359                                 struct device_node *of_node,
     1360                                 struct snd_soc_dai_link *dai_link);
     1361void snd_soc_of_put_dai_link_cpus(struct snd_soc_dai_link *dai_link);
     1362
     1363int snd_soc_add_pcm_runtimes(struct snd_soc_card *card,
     1364                             struct snd_soc_dai_link *dai_link,
     1365                             int num_dai_link);
    12701366void snd_soc_remove_pcm_runtime(struct snd_soc_card *card,
    12711367                                struct snd_soc_pcm_runtime *rtd);
    12721368
     1369void snd_soc_dlc_use_cpu_as_platform(struct snd_soc_dai_link_component *platforms,
     1370                                     struct snd_soc_dai_link_component *cpus);
     1371struct of_phandle_args *snd_soc_copy_dai_args(struct device *dev,
     1372                                              struct of_phandle_args *args);
     1373struct snd_soc_dai *snd_soc_get_dai_via_args(struct of_phandle_args *dai_args);
    12731374struct snd_soc_dai *snd_soc_register_dai(struct snd_soc_component *component,
    12741375                                         struct snd_soc_dai_driver *dai_drv,
     
    13241425extern const struct dev_pm_ops snd_soc_pm_ops;
    13251426
    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 */
     1430enum snd_soc_dapm_subclass {
     1431        SND_SOC_DAPM_CLASS_ROOT         = 0,
     1432        SND_SOC_DAPM_CLASS_RUNTIME      = 1,
     1433};
     1434
     1435static 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
     1440static 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
     1445static inline void _snd_soc_dapm_mutex_unlock_c(struct snd_soc_card *card)
     1446{
     1447        mutex_unlock(&card->dapm_mutex);
     1448}
     1449
     1450static inline void _snd_soc_dapm_mutex_assert_held_c(struct snd_soc_card *card)
     1451{
     1452        lockdep_assert_held(&card->dapm_mutex);
     1453}
     1454
     1455static 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
     1460static 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
     1465static 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
     1470static 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 */
     1491static 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
     1496static inline void _snd_soc_dpcm_mutex_unlock_c(struct snd_soc_card *card)
     1497{
     1498        mutex_unlock(&card->pcm_mutex);
     1499}
     1500
     1501static inline void _snd_soc_dpcm_mutex_assert_held_c(struct snd_soc_card *card)
     1502{
     1503        lockdep_assert_held(&card->pcm_mutex);
     1504}
     1505
     1506static 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
     1511static 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
     1516static 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)
    13361532
    13371533#include <sound/soc-component.h>
Note: See TracChangeset for help on using the changeset viewer.