Ignore:
Timestamp:
Apr 21, 2025, 7:17:25 PM (4 months ago)
Author:
David Azarewicz
Message:

Merge from uniaud32-exp branch

Location:
GPL/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • GPL/trunk

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

    r772 r777  
    1111#define __LINUX_SND_SOC_H
    1212
     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>
    1322#include <linux/of.h>
    14 #include <linux/platform_device.h>
    1523#include <linux/types.h>
    16 #include <linux/notifier.h>
    1724#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>
    2229#include <sound/core.h>
    2330#include <sound/pcm.h>
    24 #include <sound/compress_driver.h>
    25 #include <sound/control.h>
    26 #include <sound/ac97_codec.h>
     31
     32struct module;
     33struct 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>
    2738
    2839/*
     
    149160                .shift = shift_left, .rshift = shift_right, \
    150161                .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} }
    151174#define SOC_DOUBLE_R_TLV(xname, reg_left, reg_right, xshift, xmax, xinvert, tlv_array) \
    152175{       .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
     
    400423        const struct soc_enum name = SOC_ENUM_SINGLE_VIRT(ARRAY_SIZE(xtexts), xtexts)
    401424
    402 struct device_node;
    403425struct snd_jack;
    404426struct snd_soc_card;
     
    415437struct snd_soc_jack_zone;
    416438struct snd_soc_jack_pin;
     439
    417440#include <sound/soc-dapm.h>
    418441#include <sound/soc-dpcm.h>
     
    512535/* Utility functions to get clock rates from various things */
    513536int 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);
     537int snd_soc_params_to_frame_size(const struct snd_pcm_hw_params *params);
    515538int 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,
     539int snd_soc_params_to_bclk(const struct snd_pcm_hw_params *parms);
     540int snd_soc_tdm_params_to_bclk(const struct snd_pcm_hw_params *params,
    518541                               int tdm_width, int tdm_slots, int slot_multiple);
    519542
     
    620643        const char *stream_name;
    621644        u64 formats;                    /* SNDRV_PCM_FMTBIT_* */
     645        u32 subformats;                 /* for S32_LE format, SNDRV_PCM_SUBFMTBIT_* */
    622646        unsigned int rates;             /* SNDRV_PCM_RATE_* */
    623647        unsigned int rate_min;          /* min rate */
     
    652676        struct device_node *of_node;
    653677        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 */
     717struct snd_soc_dai_link_ch_map {
     718        unsigned int cpu;
     719        unsigned int codec;
    659720        unsigned int ch_mask;
    660721};
     
    688749        unsigned int num_codecs;
    689750
    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
    691754        /*
    692755         * You MAY specify the link's platform/PCM/DMA driver, either by
     
    753816        unsigned int dynamic:1;
    754817
     818        /* REMOVE ME */
    755819        /* DPCM capture and Playback support */
    756820        unsigned int dpcm_capture:1;
     
    775839};
    776840
    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
     841static 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}
    781845
    782846static inline struct snd_soc_dai_link_component*
     
    811875             ((i) < link->num_cpus) &&                                  \
    812876                     ((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));          \
    813883             (i)++)
    814884
     
    876946        .num_platforms  = ARRAY_SIZE(platform)
    877947
    878 #define SND_SOC_DAILINK_REGx(_1, _2, _3, func, ...) func
    879948#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__)
    884950
    885951#define SND_SOC_DAILINK_DEF(name, def...)               \
     
    898964#define COMP_AUX(_name)                 { .name = _name }
    899965#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() */
    904967
    905968extern struct snd_soc_dai_link_component null_dailink_component[0];
     
    11451208        unsigned int pop_wait:1;
    11461209        unsigned int fe_compr:1; /* for Dynamic PCM */
    1147 
    1148         bool initialized;
    1149 
     1210        unsigned int initialized:1;
     1211
     1212        /* CPU/Codec/Platform */
    11501213        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};
    11581216
    11591217/* see soc_new_pcm_runtime()  */
    11601218#define snd_soc_rtd_to_cpu(rtd, n)   (rtd)->dais[n]
    11611219#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
     1221static inline struct snd_soc_pcm_runtime *
     1222snd_soc_substream_to_rtd(const struct snd_pcm_substream *substream)
     1223{
     1224        return snd_pcm_substream_chip(substream);
     1225}
    11641226
    11651227#define for_each_rtd_components(rtd, i, component)                      \
     
    11801242                     ((dai) = (rtd)->dais[i]);                          \
    11811243             (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)
    11821249
    11831250void snd_soc_close_delayed_work(struct snd_soc_pcm_runtime *rtd);
     
    12381305};
    12391306
    1240 static inline bool snd_soc_volsw_is_stereo(struct soc_mixer_control *mc)
     1307static inline bool snd_soc_volsw_is_stereo(const struct soc_mixer_control *mc)
    12411308{
    12421309        if (mc->reg == mc->rreg && mc->shift == mc->rshift)
     
    12501317}
    12511318
    1252 static inline unsigned int snd_soc_enum_val_to_item(struct soc_enum *e,
     1319static inline unsigned int snd_soc_enum_val_to_item(const struct soc_enum *e,
    12531320        unsigned int val)
    12541321{
     
    12651332}
    12661333
    1267 static inline unsigned int snd_soc_enum_item_to_val(struct soc_enum *e,
     1334static inline unsigned int snd_soc_enum_item_to_val(const struct soc_enum *e,
    12681335        unsigned int item)
    12691336{
     
    13401407                snd_soc_daifmt_parse_clock_provider_as_bitmap(np, prefix))
    13411408
    1342 int snd_soc_get_stream_cpu(struct snd_soc_dai_link *dai_link, int stream);
     1409int snd_soc_get_stream_cpu(const struct snd_soc_dai_link *dai_link, int stream);
    13431410int snd_soc_get_dlc(const struct of_phandle_args *args,
    13441411                    struct snd_soc_dai_link_component *dlc);
     
    13701437                                     struct snd_soc_dai_link_component *cpus);
    13711438struct 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);
     1440struct snd_soc_dai *snd_soc_get_dai_via_args(const struct of_phandle_args *dai_args);
    13741441struct snd_soc_dai *snd_soc_register_dai(struct snd_soc_component *component,
    13751442                                         struct snd_soc_dai_driver *dai_drv,
Note: See TracChangeset for help on using the changeset viewer.