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

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

Location:
GPL/trunk
Files:
53 edited
3 copied

Legend:

Unmodified
Added
Removed
  • GPL/trunk

  • GPL/trunk/alsa-kernel/include/sound/ac97/codec.h

    r617 r772  
    6464        struct device_driver    driver;
    6565        int                     (*probe)(struct ac97_codec_device *);
    66         int                     (*remove)(struct ac97_codec_device *);
     66        void                    (*remove)(struct ac97_codec_device *dev);
    6767        void                    (*shutdown)(struct ac97_codec_device *);
    6868        const struct ac97_id    *id_table;
  • GPL/trunk/alsa-kernel/include/sound/ac97_codec.h

    r679 r772  
    336336void snd_ac97_suspend(struct snd_ac97 *ac97);
    337337void snd_ac97_resume(struct snd_ac97 *ac97);
     338#else
     339static inline void snd_ac97_suspend(struct snd_ac97 *ac97) {}
     340static inline void snd_ac97_resume(struct snd_ac97 *ac97) {}
    338341#endif
    339342int snd_ac97_reset(struct snd_ac97 *ac97, bool try_warm, unsigned int id,
  • GPL/trunk/alsa-kernel/include/sound/asequencer.h

    r679 r772  
    6666#define snd_seq_ev_is_reltime(ev)       (snd_seq_ev_timemode_type(ev) == SNDRV_SEQ_TIME_MODE_REL)
    6767
     68/* check whether the given event is a UMP event */
     69#ifndef TARGET_OS2
     70#define snd_seq_ev_is_ump(ev) \
     71        (IS_ENABLED(CONFIG_SND_SEQ_UMP) && ((ev)->flags & SNDRV_SEQ_EVENT_UMP))
     72#else
     73#define snd_seq_ev_is_ump(ev) \
     74        (0 && ((ev)->flags & SNDRV_SEQ_EVENT_UMP))
     75#endif
    6876/* queue sync port */
    6977#define snd_seq_queue_sync_port(q)      ((q) + 16)
  • GPL/trunk/alsa-kernel/include/sound/compress_driver.h

    r717 r772  
    149149struct snd_compr {
    150150        const char *name;
    151         struct device dev;
     151        struct device *dev;
    152152        struct snd_compr_ops *ops;
    153153        void *private_data;
  • GPL/trunk/alsa-kernel/include/sound/config.h

    r679 r772  
    2323#define CONFIG_PM
    2424#define CONFIG_PM_SLEEP
     25#define CONFIG_SND_CTL_INPUT_VALIDATION 0
    2526#ifdef DEBUG
    2627#define CONFIG_SND_DEBUG_DETECT
     
    3132#define CONFIG_SND_HDA_CODEC_CONEXANT
    3233#define CONFIG_SND_HDA_CODEC_CMEDIA
     34/* #define CONFIG_SND_HDA_CODEC_HDMI not yet supported */
    3335#define CONFIG_SND_HDA_CODEC_REALTEK
    3436#define CONFIG_SND_HDA_CODEC_SIGMATEL
    3537#define CONFIG_SND_HDA_CODEC_SI3054
    3638#define CONFIG_SND_HDA_CODEC_VIA
     39#define CONFIG_SND_HDA_COMPONENT
    3740#define CONFIG_SND_HDA_GENERIC
    3841#define CONFIG_SND_HDA_HWDEP
     42/* #define CONFIG_SND_HDA_I915 not yet supported */
    3943#define CONFIG_SND_HDA_PREALLOC_SIZE  64
    4044#define CONFIG_SND_OSSEMUL
  • GPL/trunk/alsa-kernel/include/sound/control.h

    r695 r772  
    2424
    2525/* internal flag for skipping validations */
    26 #ifdef CONFIG_SND_CTL_VALIDATION
     26#ifdef CONFIG_SND_CTL_DEBUG
    2727#define SNDRV_CTL_ELEM_ACCESS_SKIP_CHECK        (1 << 24)
    2828#define snd_ctl_skip_validation(info) \
     
    110110        wait_queue_head_t change_sleep;
    111111        spinlock_t read_lock;
    112         struct fasync_struct *fasync;
     112        struct snd_fasync *fasync;
    113113        int subscribed;                 /* read interface is activated */
    114114        struct list_head events;        /* waiting events for read */
     
    139139int snd_ctl_remove_id(struct snd_card * card, struct snd_ctl_elem_id *id);
    140140int snd_ctl_rename_id(struct snd_card * card, struct snd_ctl_elem_id *src_id, struct snd_ctl_elem_id *dst_id);
     141void snd_ctl_rename(struct snd_card *card, struct snd_kcontrol *kctl, const char *name);
    141142int snd_ctl_activate_id(struct snd_card *card, struct snd_ctl_elem_id *id, int active);
    142 struct snd_kcontrol *snd_ctl_find_numid(struct snd_card * card, unsigned int numid);
    143 struct snd_kcontrol *snd_ctl_find_id(struct snd_card * card, struct snd_ctl_elem_id *id);
     143struct snd_kcontrol *snd_ctl_find_numid_locked(struct snd_card *card, unsigned int numid);
     144struct snd_kcontrol *snd_ctl_find_numid(struct snd_card *card, unsigned int numid);
     145struct snd_kcontrol *snd_ctl_find_id_locked(struct snd_card *card, const struct snd_ctl_elem_id *id);
     146struct snd_kcontrol *snd_ctl_find_id(struct snd_card *card, const struct snd_ctl_elem_id *id);
     147
     148/**
     149 * snd_ctl_find_id_mixer - find the control instance with the given name string
     150 * @card: the card instance
     151 * @name: the name string
     152 *
     153 * Finds the control instance with the given name and
     154 * @SNDRV_CTL_ELEM_IFACE_MIXER. Other fields are set to zero.
     155 *
     156 * This is merely a wrapper to snd_ctl_find_id().
     157 *
     158 * Return: The pointer of the instance if found, or %NULL if not.
     159 */
     160static inline struct snd_kcontrol *
     161snd_ctl_find_id_mixer(struct snd_card *card, const char *name)
     162{
     163        struct snd_ctl_elem_id id = {0};
     164
     165        id.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
     166        strscpy(id.name, name, sizeof(id.name));
     167        return snd_ctl_find_id(card, &id);
     168}
    144169
    145170int snd_ctl_create(struct snd_card *card);
     
    237262        return _snd_ctl_add_follower(master, follower, 0);
    238263}
     264
     265int snd_ctl_add_followers(struct snd_card *card, struct snd_kcontrol *master,
     266                          const char * const *list);
    239267
    240268/**
  • GPL/trunk/alsa-kernel/include/sound/core.h

    r717 r772  
    1818#include <linux/stringify.h>
    1919#include <linux/printk.h>
     20#include <linux/xarray.h>
    2021
    2122/* number of supported soundcards */
     
    99100        struct list_head devices;       /* devices */
    100101
    101         struct device ctl_dev;          /* control device */
     102        struct device *ctl_dev;         /* control device */
    102103        unsigned int last_numid;        /* last used numeric ID */
    103         struct rw_semaphore controls_rwsem;     /* controls list lock */
     104        struct rw_semaphore controls_rwsem;     /* controls lock (list and values) */
    104105        rwlock_t ctl_files_rwlock;      /* ctl_files list lock */
    105106        int controls_count;             /* count of all controls */
     
    107108        struct list_head controls;      /* all controls for this card */
    108109        struct list_head ctl_files;     /* active control files */
     110#ifdef CONFIG_SND_CTL_FAST_LOOKUP
     111        struct xarray ctl_numids;       /* hash table for numids */
     112        struct xarray ctl_hash;         /* hash table for ctl id matching */
     113        bool ctl_hash_collision;        /* ctl_hash collision seen? */
     114#endif
    109115
    110116        struct snd_info_entry *proc_root;       /* root for soundcard specific files */
     
    230236extern int snd_major;
    231237extern int snd_ecards_limit;
    232 extern struct class *sound_class;
     238extern const struct class sound_class;
    233239#ifdef CONFIG_SND_DEBUG
    234240extern struct dentry *sound_debugfs_root;
     
    237243void snd_request_card(int card);
    238244
    239 void snd_device_initialize(struct device *dev, struct snd_card *card);
     245int snd_device_alloc(struct device **dev_p, struct snd_card *card);
    240246
    241247int snd_register_device(int type, struct snd_card *card, int dev,
     
    284290                      struct snd_card **card_ret);
    285291
    286 int snd_card_disconnect(struct snd_card *card);
     292void snd_card_disconnect(struct snd_card *card);
    287293void snd_card_disconnect_sync(struct snd_card *card);
    288 int snd_card_free(struct snd_card *card);
    289 int snd_card_free_when_closed(struct snd_card *card);
     294void snd_card_free(struct snd_card *card);
     295void snd_card_free_when_closed(struct snd_card *card);
    290296int snd_card_free_on_error(struct device *dev, int ret);
    291297void snd_card_set_id(struct snd_card *card, const char *id);
     
    543549#endif
    544550
     551/* async signal helpers */
     552struct snd_fasync;
     553
     554int snd_fasync_helper(int fd, struct file *file, int on,
     555                      struct snd_fasync **fasyncp);
     556void snd_kill_fasync(struct snd_fasync *fasync, int signal, int poll);
     557void snd_fasync_free(struct snd_fasync *fasync);
     558
    545559#endif /* __SOUND_CORE_H */
  • GPL/trunk/alsa-kernel/include/sound/da7219-aad.h

    r679 r772  
    4545};
    4646
     47enum da7219_aad_jack_ins_det_pty {
     48        DA7219_AAD_JACK_INS_DET_PTY_LOW = 0,
     49        DA7219_AAD_JACK_INS_DET_PTY_HIGH,
     50};
     51
    4752enum da7219_aad_jack_det_rate {
    4853        DA7219_AAD_JACK_DET_RATE_32_64MS = 0,
     
    8186        enum da7219_aad_mic_det_thr mic_det_thr;
    8287        enum da7219_aad_jack_ins_deb jack_ins_deb;
     88        enum da7219_aad_jack_ins_det_pty jack_ins_det_pty;
    8389        enum da7219_aad_jack_det_rate jack_det_rate;
    8490        enum da7219_aad_jack_rem_deb jack_rem_deb;
  • GPL/trunk/alsa-kernel/include/sound/designware_i2s.h

    r679 r772  
    2222};
    2323
     24struct dw_i2s_dev;
     25
    2426struct i2s_platform_data {
    2527        #define DWC_I2S_PLAY    (1 << 0)
     
    4345        bool (*filter)(struct dma_chan *chan, void *slave);
    4446        int (*i2s_clk_cfg)(struct i2s_clk_config_data *config);
     47        int (*i2s_pd_init)(struct dw_i2s_dev *dev);
    4548};
    4649
  • GPL/trunk/alsa-kernel/include/sound/dmaengine_pcm.h

    r695 r772  
    1616 *   substream
    1717 * @substream: PCM substream
     18 *
     19 * Return: DMA transfer direction
    1820 */
    1921static inline enum dma_transfer_direction
     
    3537        struct dma_chan *chan);
    3638int snd_dmaengine_pcm_close(struct snd_pcm_substream *substream);
     39int snd_dmaengine_pcm_sync_stop(struct snd_pcm_substream *substream);
    3740
    3841int snd_dmaengine_pcm_open_request_chan(struct snd_pcm_substream *substream,
     
    6164 * src_addr_width member, not bytes) that can be send to or received from the
    6265 * DAI in one burst.
    63  * @slave_id: Slave requester id for the DMA channel.
    6466 * @filter_data: Custom DMA channel filter data, this will usually be used when
    6567 * requesting the DMA channel.
     
    7577        enum dma_slave_buswidth addr_width;
    7678        u32 maxburst;
    77         unsigned int slave_id;
    7879        void *filter_data;
    7980        const char *chan_name;
     
    143144        int (*process)(struct snd_pcm_substream *substream,
    144145                       int channel, unsigned long hwoff,
    145                        void *buf, unsigned long bytes);
     146                       unsigned long bytes);
    146147        dma_filter_fn compat_filter_fn;
    147148        struct device *dma_dev;
  • GPL/trunk/alsa-kernel/include/sound/emu10k1.h

    r717 r772  
    2626
    2727#define EMUPAGESIZE     4096
    28 #define MAXREQVOICES    8
    2928#define MAXPAGES0       4096    /* 32 bit mode */
    3029#define MAXPAGES1       8192    /* 31 bit mode */
    31 #define RESERVED        0
    32 #define NUM_MIDI        16
    3330#define NUM_G           64              /* use all channels */
    34 #define NUM_FXSENDS     4
    3531#define NUM_EFX_PLAYBACK    16
    3632
     
    4036
    4137#define TMEMSIZE        256*1024
    42 #define TMEMSIZEREG     4
    4338
    4439#define IP_TO_CP(ip) ((ip == 0) ? 0 : (((0x00001000uL | (ip & 0x00000FFFL)) << (((ip >> 12) & 0x000FL) + 4)) & 0xFFFF0000uL))
     40
     41// This is used to define hardware bit-fields (sub-registers) by combining
     42// the bit shift and count with the actual register address. The passed
     43// mask must represent a single run of adjacent bits.
     44// The non-concatenating (_NC) variant should be used directly only for
     45// sub-registers that do not follow the <register>_<field> naming pattern.
     46#define SUB_REG_NC(reg, field, mask) \
     47        enum { \
     48                field ## _MASK = mask, \
     49                field = reg | \
     50                        (__builtin_ctz(mask) << 16) | \
     51                        (__builtin_popcount(mask) << 24), \
     52        };
     53#define SUB_REG(reg, field, mask) SUB_REG_NC(reg, reg ## _ ## field, mask)
     54
     55// Macros for manipulating values of bit-fields declared using the above macros.
     56// Best used with constant register addresses, as otherwise quite some code is
     57// generated. The actual register read/write functions handle combined addresses
     58// automatically, so use of these macros conveys no advantage when accessing a
     59// single sub-register at a time.
     60#define REG_SHIFT(r) (((r) >> 16) & 0x1f)
     61#define REG_SIZE(r) (((r) >> 24) & 0x1f)
     62#define REG_MASK0(r) ((1U << REG_SIZE(r)) - 1U)
     63#define REG_MASK(r) (REG_MASK0(r) << REG_SHIFT(r))
     64#define REG_VAL_GET(r, v) ((v & REG_MASK(r)) >> REG_SHIFT(r))
     65#define REG_VAL_PUT(r, v) ((v) << REG_SHIFT(r))
     66
     67// List terminator for snd_emu10k1_ptr_write_multiple()
     68#define REGLIST_END ~0
    4569
    4670// Audigy specify registers are prefixed with 'A_'
     
    6791#define IPR_P16V                0x80000000      /* Bit set when the CA0151 P16V chip wishes
    6892                                                   to interrupt */
    69 #define IPR_GPIOMSG             0x20000000      /* GPIO message interrupt (RE'd, still not sure
    70                                                    which INTE bits enable it)                   */
     93#define IPR_WATERMARK_REACHED   0x40000000
     94#define IPR_A_GPIO              0x20000000      /* GPIO input pin change                        */
    7195
    7296/* The next two interrupts are for the midi port on the Audigy Drive (A_MPU1)                   */
     
    96120#define IPR_MIDIRECVBUFEMPTY    0x00000080      /* MIDI UART receive buffer empty               */
    97121#define IPR_CHANNELLOOP         0x00000040      /* Channel (half) loop interrupt(s) pending     */
     122                                                /* The interrupt is triggered shortly after     */
     123                                                /* CCR_READADDRESS has crossed the boundary;    */
     124                                                /* due to the cache, this runs ahead of the     */
     125                                                /* actual playback position.                    */
    98126#define IPR_CHANNELNUMBERMASK   0x0000003f      /* When IPR_CHANNELLOOP is set, indicates the   */
    99127                                                /* highest set channel in CLIPL, CLIPH, HLIPL,  */
    100                                                 /* or HLIPH.  When IP is written with CL set,   */
     128                                                /* or HLIPH.  When IPR is written with CL set,  */
    101129                                                /* the bit in H/CLIPL or H/CLIPH corresponding  */
    102                                                 /* to the CIN value written will be cleared.    */
     130                                                /* to the CN value written will be cleared.     */
    103131
    104132#define INTE                    0x0c            /* Interrupt enable register                    */
     
    128156                                                /* lockups if enabled.                          */
    129157
     158#define INTE_A_GPIOENABLE       0x00040000      /* Enable GPIO input change interrupts          */
     159
    130160/* The next two interrupts are for the midi port on the Audigy Drive (A_MPU1)                   */
    131161#define INTE_A_MIDITXENABLE2    0x00020000      /* Enable MIDI transmit-buffer-empty interrupts */
    132162#define INTE_A_MIDIRXENABLE2    0x00010000      /* Enable MIDI receive-buffer-empty interrupts  */
    133163
     164#define INTE_A_SPDIF_BUFFULL_ENABLE     0x00008000
     165#define INTE_A_SPDIF_HALFBUFFULL_ENABLE 0x00004000
    134166
    135167#define INTE_SAMPLERATETRACKER  0x00002000      /* Enable sample rate tracker interrupts        */
     
    150182
    151183#define WC                      0x10            /* Wall Clock register                          */
     184#ifndef TARGET_OS2
     185SUB_REG(WC, SAMPLECOUNTER,      0x03FFFFC0)     /* Sample periods elapsed since reset           */
     186SUB_REG(WC, CURRENTCHANNEL,     0x0000003F)     /* Channel [0..63] currently being serviced     */
     187                                                /* NOTE: Each channel takes 1/64th of a sample  */
     188                                                /* period to be serviced.                       */
     189
     190#else
    152191#define WC_SAMPLECOUNTER_MASK   0x03FFFFC0      /* Sample periods elapsed since reset           */
    153192#define WC_SAMPLECOUNTER        0x14060010
    154 #define WC_CURRENTCHANNEL       0x0000003F      /* Channel [0..63] currently being serviced     */
     193#define WC_CURRENTCHANNEL       0x0700003F      /* Channel [0..63] currently being serviced     */
    155194                                                /* NOTE: Each channel takes 1/64th of a sample  */
    156195                                                /* period to be serviced.                       */
    157 
     196#endif
    158197#define HCFG                    0x14            /* Hardware config register                     */
    159198                                                /* NOTE: There is no reason to use the legacy   */
     
    181220
    182221/* Specific to Alice2, CA0102 */
     222
    183223#define HCFG_CODECFORMAT_AC97_1 0x00000000      /* AC97 CODEC format -- Ver 1.03                */
    184224#define HCFG_CODECFORMAT_AC97_2 0x00010000      /* AC97 CODEC format -- Ver 2.1                 */
     
    201241/* Rest of HCFG 0x0000000f same as below. LOCKSOUNDCACHE etc.  */
    202242
    203 
    204 
    205243/* Older chips */
     244
    206245#define HCFG_CODECFORMAT_AC97   0x00000000      /* AC97 CODEC format -- Primary Output          */
    207246#define HCFG_CODECFORMAT_I2S    0x00010000      /* I2S CODEC format -- Secondary (Rear) Output  */
     
    226265#define HCFG_LOCKSOUNDCACHE     0x00000008      /* 1 = Cancel bustmaster accesses to soundcache */
    227266                                                /* NOTE: This should generally never be used.   */
     267#ifndef TARGET_OS2
     268SUB_REG(HCFG, LOCKTANKCACHE,    0x00000004)     /* 1 = Cancel bustmaster accesses to tankcache  */
     269                                                /* NOTE: This should generally never be used.   */
     270#else
    228271#define HCFG_LOCKTANKCACHE_MASK 0x00000004      /* 1 = Cancel bustmaster accesses to tankcache  */
    229272                                                /* NOTE: This should generally never be used.   */
    230273#define HCFG_LOCKTANKCACHE      0x01020014
     274#endif
    231275#define HCFG_MUTEBUTTONENABLE   0x00000002      /* 1 = Master mute button sets AUDIOENABLE = 0. */
    232276                                                /* NOTE: This is a 'cheap' way to implement a   */
     
    239283                                                /* completely initialized.                      */
    240284
    241 //For Audigy, MPU port move to 0x70-0x74 ptr register
     285// On Audigy, the MPU port moved to the 0x70-0x74 ptr registers
    242286
    243287#define MUDATA                  0x18            /* MPU401 data register (8 bits)                */
     
    252296#define MUSTAT_ORDYN            0x40            /* 0 = MUDATA can accept a command or data      */
    253297
    254 #define A_IOCFG                 0x18            /* GPIO on Audigy card (16bits)                 */
    255 #define A_GPINPUT_MASK          0xff00
     298#define A_GPIO                  0x18            /* GPIO on Audigy card (16bits)                 */
     299#define A_GPINPUT_MASK          0xff00          /* Alice/2 has 8 input pins                     */
     300#define A3_GPINPUT_MASK         0x3f00          /* ... while Tina/2 has only 6                  */
    256301#define A_GPOUTPUT_MASK         0x00ff
    257302
     303// The GPIO port is used for I/O config on Sound Blasters;
     304// card-specific info can be found in the emu_chip_details table.
     305// On E-MU cards the port is used as the interface to the FPGA.
     306
    258307// Audigy output/GPIO stuff taken from the kX drivers
     308#define A_IOCFG                 A_GPIO
    259309#define A_IOCFG_GPOUT0          0x0044          /* analog/digital                               */
    260310#define A_IOCFG_DISABLE_ANALOG  0x0040          /* = 'enable' for Audigy2 (chiprev=4)           */
     
    272322#define A_IOCFG_PHONES_JACK     0x0100          /* LiveDrive                                    */
    273323
    274 /* outputs:
    275  *      for audigy2 platinum:   0xa00
    276  *      for a2 platinum ex:     0x1c00
    277  *      for a1 platinum:        0x0
    278  */
    279 
    280324#define TIMER                   0x1a            /* Timer terminal count register                */
    281325                                                /* NOTE: After the rate is changed, a maximum   */
    282326                                                /* of 1024 sample periods should be allowed     */
    283327                                                /* before the new rate is guaranteed accurate.  */
    284 #define TIMER_RATE_MASK         0x000003ff      /* Timer interrupt rate in sample periods       */
     328#define TIMER_RATE_MASK         0x03ff          /* Timer interrupt rate in sample periods       */
    285329                                                /* 0 == 1024 periods, [1..4] are not useful     */
    286 #define TIMER_RATE              0x0a00001a
    287330
    288331#define AC97DATA                0x1c            /* AC97 register set data register (16 bit)     */
     
    318361                                                /* 0x00000200 8-channel output. */
    319362                                                /* 0x00000004 pauses stream/irq fail. */
    320                                                 /* Rest of bits no nothing to sound output */
     363                                                /* Rest of bits do nothing to sound output */
    321364                                                /* bit 0: Enable P16V audio.
    322365                                                 * bit 1: Lock P16V record memory cache.
     
    332375#define IPR3                    0x38            /* Cdif interrupt pending register              */
    333376#define INTE3                   0x3c            /* Cdif interrupt enable register.      */
     377
    334378/************************************************************************************************/
    335379/* PCI function 1 registers, address = <val> + PCIBASE1                                         */
     
    350394#define JOYSTICK_COMPARATOR     0xf0            /* Joystick comparator data                     */
    351395
    352 
    353396/********************************************************************************************************/
    354397/* Emu10k1 pointer-offset register set, accessed through the PTR and DATA registers                     */
    355398/********************************************************************************************************/
    356399
     400// No official documentation was released for EMU10K1, but some info
     401// about playback can be extrapolated from the EMU8K documents:
     402// "AWE32/EMU8000 Programmer’s Guide" (emu8kpgm.pdf) - registers
     403// "AWE32 Developer's Information Pack" (adip301.pdf) - high-level view
     404
     405// The short version:
     406// - The engine has 64 playback channels, also called voices. The channels
     407//   operate independently, except when paired for stereo (see below).
     408// - PCM samples are fetched into the cache; see description of CD0 below.
     409// - Samples are consumed at the rate CPF_CURRENTPITCH.
     410// - 8-bit samples are transformed upon use: cooked = (raw ^ 0x80) << 8
     411// - 8 samples are read at CCR_READADDRESS:CPF_FRACADDRESS and interpolated
     412//   according to CCCA_INTERPROM_*. With CCCA_INTERPROM_0 selected and a zero
     413//   CPF_FRACADDRESS, this results in CCR_READADDRESS[3] being used verbatim.
     414// - The value is multiplied by CVCF_CURRENTVOL.
     415// - The value goes through a filter with cutoff CVCF_CURRENTFILTER;
     416//   delay stages Z1 and Z2.
     417// - The value is added by so-called `sends` to 4 (EMU10K1) / 8 (EMU10K2)
     418//   of the 16 (EMU10K1) / 64 (EMU10K2) FX bus accumulators via FXRT*,
     419//   multiplied by a per-send amount (*_FXSENDAMOUNT_*).
     420//   The scaling of the send amounts is exponential-ish.
     421// - The DSP has a go at FXBUS* and outputs the values to EXTOUT* or EMU32OUT*.
     422// - The pitch, volume, and filter cutoff can be modulated by two envelope
     423//   engines and two low frequency oscillators.
     424// - To avoid abrupt changes to the parameters (which may cause audible
     425//   distortion), the modulation engine sets the target registers, towards
     426//   which the current registers "swerve" gradually.
     427
     428// For the odd channel in a stereo pair, these registers are meaningless:
     429//   CPF_STEREO, CPF_CURRENTPITCH, PTRX_PITCHTARGET, CCR_CACHEINVALIDSIZE,
     430//   PSST_LOOPSTARTADDR, DSL_LOOPENDADDR, CCCA_CURRADDR
     431// The somewhat non-obviously still meaningful ones are:
     432//   CPF_STOP, CPF_FRACADDRESS, CCR_READADDRESS (!),
     433//   CCCA_INTERPROM, CCCA_8BITSELECT (!)
     434// (The envelope engine is ignored here, as stereo matters only for verbatim playback.)
     435
    357436#define CPF                     0x00            /* Current pitch and fraction register                  */
     437#ifndef TARGET_OS2
     438SUB_REG(CPF, CURRENTPITCH,      0xffff0000)     /* Current pitch (linear, 0x4000 == unity pitch shift)  */
     439#else
    358440#define CPF_CURRENTPITCH_MASK   0xffff0000      /* Current pitch (linear, 0x4000 == unity pitch shift)  */
    359441#define CPF_CURRENTPITCH        0x10100000
     442#endif
    360443#define CPF_STEREO_MASK         0x00008000      /* 1 = Even channel interleave, odd channel locked      */
     444#ifndef TARGET_OS2
     445SUB_REG(CPF, STOP,              0x00004000)     /* 1 = Current pitch forced to 0                        */
     446                                                /* Can be set only while matching bit in SOLEx is 1     */
     447#else
     448#define CPF_STOP                0x00004000      /* 1 = Current pitch forced to 0                        */
    361449#define CPF_STOP_MASK           0x00004000      /* 1 = Current pitch forced to 0                        */
     450#endif
    362451#define CPF_FRACADDRESS_MASK    0x00003fff      /* Linear fractional address of the current channel     */
    363452
    364453#define PTRX                    0x01            /* Pitch target and send A/B amounts register           */
     454#ifndef TARGET_OS2
     455SUB_REG(PTRX, PITCHTARGET,      0xffff0000)     /* Pitch target of specified channel                    */
     456SUB_REG(PTRX, FXSENDAMOUNT_A,   0x0000ff00)     /* Linear level of channel output sent to FX send bus A */
     457SUB_REG(PTRX, FXSENDAMOUNT_B,   0x000000ff)     /* Linear level of channel output sent to FX send bus B */
     458#else
    365459#define PTRX_PITCHTARGET_MASK   0xffff0000      /* Pitch target of specified channel                    */
    366460#define PTRX_PITCHTARGET        0x10100001
     
    369463#define PTRX_FXSENDAMOUNT_B_MASK 0x000000ff     /* Linear level of channel output sent to FX send bus B */
    370464#define PTRX_FXSENDAMOUNT_B     0x08000001
    371 
     465#endif
     466
     467// Note: the volumes are raw multpliers, so real 100% is impossible.
    372468#define CVCF                    0x02            /* Current volume and filter cutoff register            */
     469#ifndef TARGET_OS2
     470SUB_REG(CVCF, CURRENTVOL,       0xffff0000)     /* Current linear volume of specified channel           */
     471SUB_REG(CVCF, CURRENTFILTER,    0x0000ffff)     /* Current filter cutoff frequency of specified channel */
     472#else
    373473#define CVCF_CURRENTVOL_MASK    0xffff0000      /* Current linear volume of specified channel           */
    374474#define CVCF_CURRENTVOL         0x10100002
    375475#define CVCF_CURRENTFILTER_MASK 0x0000ffff      /* Current filter cutoff frequency of specified channel */
    376476#define CVCF_CURRENTFILTER      0x10000002
     477#endif
    377478
    378479#define VTFT                    0x03            /* Volume target and filter cutoff target register      */
     480#ifndef TARGET_OS2
     481SUB_REG(VTFT, VOLUMETARGET,     0xffff0000)     /* Volume target of specified channel                   */
     482SUB_REG(VTFT, FILTERTARGET,     0x0000ffff)     /* Filter cutoff target of specified channel            */
     483#else
    379484#define VTFT_VOLUMETARGET_MASK  0xffff0000      /* Volume target of specified channel                   */
    380485#define VTFT_VOLUMETARGET       0x10100003
    381486#define VTFT_FILTERTARGET_MASK  0x0000ffff      /* Filter cutoff target of specified channel            */
    382487#define VTFT_FILTERTARGET       0x10000003
     488#endif
    383489
    384490#define Z1                      0x05            /* Filter delay memory 1 register                       */
     
    387493
    388494#define PSST                    0x06            /* Send C amount and loop start address register        */
     495#ifndef TARGET_OS2
     496SUB_REG(PSST, FXSENDAMOUNT_C,   0xff000000)     /* Linear level of channel output sent to FX send bus C */
     497SUB_REG(PSST, LOOPSTARTADDR,    0x00ffffff)     /* Loop start address of the specified channel          */
     498#else
    389499#define PSST_FXSENDAMOUNT_C_MASK 0xff000000     /* Linear level of channel output sent to FX send bus C */
    390500
     
    393503#define PSST_LOOPSTARTADDR_MASK 0x00ffffff      /* Loop start address of the specified channel          */
    394504#define PSST_LOOPSTARTADDR      0x18000006
    395 
    396 #define DSL                     0x07            /* Send D amount and loop start address register        */
     505#endif
     506
     507#define DSL                     0x07            /* Send D amount and loop end address register  */
     508#ifndef TARGET_OS2
     509SUB_REG(DSL, FXSENDAMOUNT_D,    0xff000000)     /* Linear level of channel output sent to FX send bus D */
     510SUB_REG(DSL, LOOPENDADDR,       0x00ffffff)     /* Loop end address of the specified channel            */
     511#else
    397512#define DSL_FXSENDAMOUNT_D_MASK 0xff000000      /* Linear level of channel output sent to FX send bus D */
    398513
     
    401516#define DSL_LOOPENDADDR_MASK    0x00ffffff      /* Loop end address of the specified channel            */
    402517#define DSL_LOOPENDADDR         0x18000007
     518#endif
    403519
    404520#define CCCA                    0x08            /* Filter Q, interp. ROM, byte size, cur. addr register */
     521#ifndef TARGET_OS2
     522SUB_REG(CCCA, RESONANCE,        0xf0000000)     /* Lowpass filter resonance (Q) height                  */
     523#else
    405524#define CCCA_RESONANCE          0xf0000000      /* Lowpass filter resonance (Q) height                  */
    406 #define CCCA_INTERPROMMASK      0x0e000000      /* Selects passband of interpolation ROM                */
     525#endif
     526#define CCCA_INTERPROM_MASK     0x0e000000      /* Selects passband of interpolation ROM                */
    407527                                                /* 1 == full band, 7 == lowpass                         */
    408528                                                /* ROM 0 is used when pitch shifting downward or less   */
     
    419539#define CCCA_INTERPROM_7        0x0e000000      /* Select interpolation ROM 7                           */
    420540#define CCCA_8BITSELECT         0x01000000      /* 1 = Sound memory for this channel uses 8-bit samples */
     541                                                /* 8-bit samples are unsigned, 16-bit ones signed       */
     542#ifndef TARGET_OS2
     543SUB_REG(CCCA, CURRADDR,         0x00ffffff)     /* Current address of the selected channel              */
     544#else
    421545#define CCCA_CURRADDR_MASK      0x00ffffff      /* Current address of the selected channel              */
    422546#define CCCA_CURRADDR           0x18000008
     547#endif
    423548
    424549#define CCR                     0x09            /* Cache control register                               */
     550#ifndef TARGET_OS2
     551SUB_REG(CCR, CACHEINVALIDSIZE,  0xfe000000)     /* Number of invalid samples before the read address    */
     552#else
    425553#define CCR_CACHEINVALIDSIZE    0x07190009
    426554#define CCR_CACHEINVALIDSIZE_MASK       0xfe000000      /* Number of invalid samples cache for this channel     */
     555#endif
    427556#define CCR_CACHELOOPFLAG       0x01000000      /* 1 = Cache has a loop service pending                 */
    428557#define CCR_INTERLEAVEDSAMPLES  0x00800000      /* 1 = A cache service will fetch interleaved samples   */
     558                                                /* Auto-set from CPF_STEREO_MASK                        */
    429559#define CCR_WORDSIZEDSAMPLES    0x00400000      /* 1 = A cache service will fetch word sized samples    */
     560                                                /* Auto-set from CCCA_8BITSELECT                        */
     561#ifndef TARGET_OS2
     562SUB_REG(CCR, READADDRESS,       0x003f0000)     /* Next cached sample to play                           */
     563SUB_REG(CCR, LOOPINVALSIZE,     0x0000fe00)     /* Number of invalid samples in cache prior to loop     */
     564#else
    430565#define CCR_READADDRESS         0x06100009
    431566#define CCR_READADDRESS_MASK    0x003f0000      /* Location of cache just beyond current cache service  */
    432567#define CCR_LOOPINVALSIZE       0x0000fe00      /* Number of invalid samples in cache prior to loop     */
    433568                                                /* NOTE: This is valid only if CACHELOOPFLAG is set     */
     569#endif
     570                                                /* NOTE: This is valid only if CACHELOOPFLAG is set     */
    434571#define CCR_LOOPFLAG            0x00000100      /* Set for a single sample period when a loop occurs    */
     572#ifndef TARGET_OS2
     573SUB_REG(CCR, CACHELOOPADDRHI,   0x000000ff)     /* CLP_LOOPSTARTADDR's hi byte if CACHELOOPFLAG is set  */
     574#else
    435575#define CCR_CACHELOOPADDRHI     0x000000ff      /* DSL_LOOPSTARTADDR's hi byte if CACHELOOPFLAG is set  */
     576#endif
    436577
    437578#define CLP                     0x0a            /* Cache loop register (valid if CCR_CACHELOOPFLAG = 1) */
    438579                                                /* NOTE: This register is normally not used             */
     580#ifndef TARGET_OS2
     581SUB_REG(CLP, CACHELOOPADDR,     0x0000ffff)     /* Cache loop address low word                          */
     582#else
    439583#define CLP_CACHELOOPADDR       0x0000ffff      /* Cache loop address (DSL_LOOPSTARTADDR [0..15])       */
     584#endif
    440585
    441586#define FXRT                    0x0b            /* Effects send routing register                        */
     
    447592#define FXRT_CHANNELD           0xf0000000      /* Effects send bus number for channel's effects send D */
    448593
    449 #define A_HR                    0x0b    /* High Resolution. 24bit playback from host to DSP. */
    450594#define MAPA                    0x0c            /* Cache map A                                          */
    451 
    452595#define MAPB                    0x0d            /* Cache map B                                          */
    453596
     
    458601#define MAP_PTI_MASK1           0x00001fff      /* The 13 bit index to one of the 8192 PTE dwords       */
    459602
    460 /* 0x0e, 0x0f: Not used */
     603/* 0x0e, 0x0f: Internal state, at least on Audigy */
    461604
    462605#define ENVVOL                  0x10            /* Volume envelope register                             */
    463 #define ENVVOL_MASK             0x0000ffff      /* Current value of volume envelope state variable      */ 
     606#define ENVVOL_MASK             0x0000ffff      /* Current value of volume envelope state variable      */
    464607                                                /* 0x8000-n == 666*n usec delay                         */
    465608
    466609#define ATKHLDV                 0x11            /* Volume envelope hold and attack register             */
    467 #define ATKHLDV_PHASE0          0x00008000      /* 0 = Begin attack phase                               */
     610#define ATKHLDV_PHASE0_MASK     0x00008000      /* 0 = Begin attack phase                               */
    468611#define ATKHLDV_HOLDTIME_MASK   0x00007f00      /* Envelope hold time (127-n == n*88.2msec)             */
    469612#define ATKHLDV_ATTACKTIME_MASK 0x0000007f      /* Envelope attack time, log encoded                    */
     
    471614
    472615#define DCYSUSV                 0x12            /* Volume envelope sustain and decay register           */
    473 #define DCYSUSV_PHASE1_MASK     0x00008000      /* 0 = Begin attack phase, 1 = begin release phase      */
     616#define DCYSUSV_PHASE1_MASK     0x00008000      /* 0 = Begin decay phase, 1 = begin release phase       */
    474617#define DCYSUSV_SUSTAINLEVEL_MASK 0x00007f00    /* 127 = full, 0 = off, 0.75dB increments               */
    475 #define DCYSUSV_CHANNELENABLE_MASK 0x00000080   /* 1 = Inhibit envelope engine from writing values in   */
     618#define DCYSUSV_CHANNELENABLE_MASK 0x00000080   /* 0 = Inhibit envelope engine from writing values in   */
    476619                                                /* this channel and from writing to pitch, filter and   */
    477620                                                /* volume targets.                                      */
     
    488631
    489632#define ATKHLDM                 0x15            /* Modulation envelope hold and attack register         */
    490 #define ATKHLDM_PHASE0          0x00008000      /* 0 = Begin attack phase                               */
     633#define ATKHLDM_PHASE0_MASK     0x00008000      /* 0 = Begin attack phase                               */
    491634#define ATKHLDM_HOLDTIME        0x00007f00      /* Envelope hold time (127-n == n*42msec)               */
    492635#define ATKHLDM_ATTACKTIME      0x0000007f      /* Envelope attack time, log encoded                    */
     
    494637
    495638#define DCYSUSM                 0x16            /* Modulation envelope decay and sustain register       */
    496 #define DCYSUSM_PHASE1_MASK     0x00008000      /* 0 = Begin attack phase, 1 = begin release phase      */
     639#define DCYSUSM_PHASE1_MASK     0x00008000      /* 0 = Begin decay phase, 1 = begin release phase       */
    497640#define DCYSUSM_SUSTAINLEVEL_MASK 0x00007f00    /* 127 = full, 0 = off, 0.75dB increments               */
    498641#define DCYSUSM_DECAYTIME_MASK  0x0000007f      /* Envelope decay time, log encoded                     */
     
    509652
    510653#define IFATN                   0x19            /* Initial filter cutoff and attenuation register       */
     654#ifndef TARGET_OS2
     655SUB_REG(IFATN, FILTERCUTOFF,    0x0000ff00)     /* Initial filter cutoff frequency in exponential units */
     656                                                /* 6 most significant bits are semitones                */
     657                                                /* 2 least significant bits are fractions               */
     658SUB_REG(IFATN, ATTENUATION,     0x000000ff)     /* Initial attenuation in 0.375dB steps                 */
     659
     660#else
    511661#define IFATN_FILTERCUTOFF_MASK 0x0000ff00      /* Initial filter cutoff frequency in exponential units */
    512662                                                /* 6 most significant bits are semitones                */
     
    515665#define IFATN_ATTENUATION_MASK  0x000000ff      /* Initial attenuation in 0.375dB steps                 */
    516666#define IFATN_ATTENUATION       0x08000019
    517 
    518 
     667#endif
    519668#define PEFE                    0x1a            /* Pitch envelope and filter envelope amount register   */
     669#ifndef TARGET_OS2
     670SUB_REG(PEFE, PITCHAMOUNT,      0x0000ff00)     /* Pitch envlope amount                                 */
     671                                                /* Signed 2's complement, +/- one octave peak extremes  */
     672SUB_REG(PEFE, FILTERAMOUNT,     0x000000ff)     /* Filter envlope amount                                */
     673                                                /* Signed 2's complement, +/- six octaves peak extremes */
     674#else
    520675#define PEFE_PITCHAMOUNT_MASK   0x0000ff00      /* Pitch envlope amount                                 */
    521676                                                /* Signed 2's complement, +/- one octave peak extremes  */
     
    524679                                                /* Signed 2's complement, +/- six octaves peak extremes */
    525680#define PEFE_FILTERAMOUNT       0x0800001a
     681#endif
     682
     683
    526684#define FMMOD                   0x1b            /* Vibrato/filter modulation from LFO register          */
    527685#define FMMOD_MODVIBRATO        0x0000ff00      /* Vibrato LFO modulation depth                         */
     
    530688                                                /* Signed 2's complement, +/- three octave extremes     */
    531689
    532 
    533690#define TREMFRQ                 0x1c            /* Tremolo amount and modulation LFO frequency register */
    534691#define TREMFRQ_DEPTH           0x0000ff00      /* Tremolo depth                                        */
    535692                                                /* Signed 2's complement, with +/- 12dB extremes        */
    536 
    537693#define TREMFRQ_FREQUENCY       0x000000ff      /* Tremolo LFO frequency                                */
    538694                                                /* ??Hz steps, maximum of ?? Hz.                        */
     695
    539696#define FM2FRQ2                 0x1d            /* Vibrato amount and vibrato LFO frequency register    */
    540697#define FM2FRQ2_DEPTH           0x0000ff00      /* Vibrato LFO vibrato depth                            */
     
    550707/* 0x1f: not used */
    551708
    552 #define CD0                     0x20            /* Cache data 0 register                                */
    553 #define CD1                     0x21            /* Cache data 1 register                                */
    554 #define CD2                     0x22            /* Cache data 2 register                                */
    555 #define CD3                     0x23            /* Cache data 3 register                                */
    556 #define CD4                     0x24            /* Cache data 4 register                                */
    557 #define CD5                     0x25            /* Cache data 5 register                                */
    558 #define CD6                     0x26            /* Cache data 6 register                                */
    559 #define CD7                     0x27            /* Cache data 7 register                                */
    560 #define CD8                     0x28            /* Cache data 8 register                                */
    561 #define CD9                     0x29            /* Cache data 9 register                                */
    562 #define CDA                     0x2a            /* Cache data A register                                */
    563 #define CDB                     0x2b            /* Cache data B register                                */
    564 #define CDC                     0x2c            /* Cache data C register                                */
    565 #define CDD                     0x2d            /* Cache data D register                                */
    566 #define CDE                     0x2e            /* Cache data E register                                */
    567 #define CDF                     0x2f            /* Cache data F register                                */
    568 
    569 /* 0x30-3f seem to be the same as 0x20-2f */
     709// 32 cache registers (== 128 bytes) per channel follow.
     710// In stereo mode, the two channels' caches are concatenated into one,
     711// and hold the interleaved frames.
     712// The cache holds 64 frames, so the upper half is not used in 8-bit mode.
     713// All registers mentioned below count in frames.
     714// The cache is a ring buffer; CCR_READADDRESS operates modulo 64.
     715// The cache is filled from (CCCA_CURRADDR - CCR_CACHEINVALIDSIZE)
     716// into (CCR_READADDRESS - CCR_CACHEINVALIDSIZE).
     717// The engine has a fetch threshold of 32 bytes, so it tries to keep
     718// CCR_CACHEINVALIDSIZE below 8 (16-bit stereo), 16 (16-bit mono,
     719// 8-bit stereo), or 32 (8-bit mono). The actual transfers are pretty
     720// unpredictable, especially if several voices are running.
     721// Frames are consumed at CCR_READADDRESS, which is incremented afterwards,
     722// along with CCCA_CURRADDR and CCR_CACHEINVALIDSIZE. This implies that the
     723// actual playback position always lags CCCA_CURRADDR by exactly 64 frames.
     724#define CD0                     0x20            /* Cache data registers 0 .. 0x1f                       */
    570725
    571726#define PTB                     0x40            /* Page table base register                             */
     
    604759                                                /* simultaneously.                                      */
    605760
    606 #define FXWC_DEFAULTROUTE_C     (1<<0)          /* left emu out? */
    607 #define FXWC_DEFAULTROUTE_B     (1<<1)          /* right emu out? */
    608 #define FXWC_DEFAULTROUTE_A     (1<<12)
    609 #define FXWC_DEFAULTROUTE_D     (1<<13)
    610 #define FXWC_ADCLEFT            (1<<18)
    611 #define FXWC_CDROMSPDIFLEFT     (1<<18)
    612 #define FXWC_ADCRIGHT           (1<<19)
    613 #define FXWC_CDROMSPDIFRIGHT    (1<<19)
    614 #define FXWC_MIC                (1<<20)
    615 #define FXWC_ZOOMLEFT           (1<<20)
    616 #define FXWC_ZOOMRIGHT          (1<<21)
    617 #define FXWC_SPDIFLEFT          (1<<22)         /* 0x00400000 */
    618 #define FXWC_SPDIFRIGHT         (1<<23)         /* 0x00800000 */
    619 
    620761#define A_TBLSZ                 0x43    /* Effects Tank Internal Table Size. Only low byte or register used */
    621762
     
    640781#define FXBA_MASK               0xfffff000      /* 20 bit base address                                  */
    641782
    642 #define A_HWM                   0x48    /* High PCI Water Mark - word access, defaults to 3f */
     783#define A_HWM                   0x48            /* High PCI Water Mark - word access, defaults to 3f */
    643784
    644785#define MICBS                   0x49            /* Microphone buffer size register                      */
     
    648789#define FXBS                    0x4b            /* FX buffer size register                              */
    649790
    650 /* register: 0x4c..4f: ffff-ffff current amounts, per-channel */
    651 
    652 /* The following mask values define the size of the ADC, MIX and FX buffers in bytes */
     791/* The following mask values define the size of the ADC, MIC and FX buffers in bytes */
    653792#define ADCBS_BUFSIZE_NONE      0x00000000
    654793#define ADCBS_BUFSIZE_384       0x00000001
     
    684823#define ADCBS_BUFSIZE_65536     0x0000001f
    685824
    686 /* Current Send B, A Amounts */
    687 #define A_CSBA                  0x4c
    688 
    689 /* Current Send D, C Amounts */
    690 #define A_CSDC                  0x4d
    691 
    692 /* Current Send F, E Amounts */
    693 #define A_CSFE                  0x4e
    694 
    695 /* Current Send H, G Amounts */
    696 #define A_CSHG                  0x4f
    697 
    698 
    699 #define CDCS                    0x50            /* CD-ROM digital channel status register       */
    700 
    701 #define GPSCS                   0x51            /* General Purpose SPDIF channel status register*/
    702 
    703 #define DBG                     0x52            /* DO NOT PROGRAM THIS REGISTER!!! MAY DESTROY CHIP */
    704 
    705 /* S/PDIF Input C Channel Status */
    706 #define A_SPSC                  0x52
    707 
    708 #define REG53                   0x53            /* DO NOT PROGRAM THIS REGISTER!!! MAY DESTROY CHIP */
    709 
    710 #define A_DBG                    0x53
    711 #define A_DBG_SINGLE_STEP        0x00020000     /* Set to zero to start dsp */
    712 #define A_DBG_ZC                 0x40000000     /* zero tram counter */
    713 #define A_DBG_STEP_ADDR          0x000003ff
    714 #define A_DBG_SATURATION_OCCURED 0x20000000
    715 #define A_DBG_SATURATION_ADDR    0x0ffc0000
    716 
    717 // NOTE: 0x54,55,56: 64-bit
     825// On Audigy, the FX send amounts are not applied instantly, but determine
     826// targets towards which the following registers swerve gradually.
     827#define A_CSBA                  0x4c            /* FX send B & A current amounts                        */
     828#define A_CSDC                  0x4d            /* FX send D & C current amounts                        */
     829#define A_CSFE                  0x4e            /* FX send F & E current amounts                        */
     830#define A_CSHG                  0x4f            /* FX send H & G current amounts                        */
     831
     832// NOTE: 0x50,51,52: 64-bit (split over voices 0 & 1)
     833#define CDCS                    0x50            /* CD-ROM digital channel status register               */
     834
     835#define GPSCS                   0x51            /* General Purpose SPDIF channel status register        */
     836
     837// Corresponding EMU10K1_DBG_* constants are in the public header
     838#define DBG                     0x52
     839
     840#define A_SPSC                  0x52            /* S/PDIF Input C Channel Status                        */
     841
     842#define REG53                   0x53            /* DO NOT PROGRAM THIS REGISTER!!! MAY DESTROY CHIP     */
     843
     844// Corresponding A_DBG_* constants are in the public header
     845#define A_DBG                   0x53
     846
     847// NOTE: 0x54,55,56: 64-bit (split over voices 0 & 1)
    718848#define SPCS0                   0x54            /* SPDIF output Channel Status 0 register       */
    719849
     
    748878/* 0x57: Not used */
    749879
    750 /* The 32-bit CLIx and SOLx registers all have one bit per channel control/status               */
     880/* The 32-bit CLIx and SOLEx registers all have one bit per channel control/status              */
    751881#define CLIEL                   0x58            /* Channel loop interrupt enable low register   */
    752 
    753882#define CLIEH                   0x59            /* Channel loop interrupt enable high register  */
    754883
    755884#define CLIPL                   0x5a            /* Channel loop interrupt pending low register  */
    756 
    757885#define CLIPH                   0x5b            /* Channel loop interrupt pending high register */
    758886
     887// These cause CPF_STOP_MASK to be set shortly after CCCA_CURRADDR passes DSL_LOOPENDADDR.
     888// Subsequent changes to the address registers don't resume; clearing the bit here or in CPF does.
     889// The registers are NOT synchronized; the next serviced channel picks up immediately.
    759890#define SOLEL                   0x5c            /* Stop on loop enable low register             */
    760 
    761891#define SOLEH                   0x5d            /* Stop on loop enable high register            */
    762892
     
    768898
    769899#define AC97SLOT                0x5f            /* additional AC97 slots enable bits            */
    770 #define AC97SLOT_REAR_RIGHT     0x01            /* Rear left */
    771 #define AC97SLOT_REAR_LEFT      0x02            /* Rear right */
    772 #define AC97SLOT_CNTR           0x10            /* Center enable */
    773 #define AC97SLOT_LFE            0x20            /* LFE enable */
    774 
    775 /* PCB Revision */
    776 #define A_PCB                   0x5f
     900#define AC97SLOT_REAR_RIGHT     0x01            /* Rear left                                    */
     901#define AC97SLOT_REAR_LEFT      0x02            /* Rear right                                   */
     902#define AC97SLOT_CNTR           0x10            /* Center enable                                */
     903#define AC97SLOT_LFE            0x20            /* LFE enable                                   */
     904
     905#define A_PCB                   0x5f            /* PCB Revision                                 */
    777906
    778907// NOTE: 0x60,61,62: 64-bit
     
    797926
    798927#define MICIDX                  0x63            /* Microphone recording buffer index register   */
     928#ifndef TARGET_OS2
     929SUB_REG(MICIDX, IDX,            0x0000ffff)
     930#else
    799931#define MICIDX_MASK             0x0000ffff      /* 16-bit value                                 */
    800932#define MICIDX_IDX              0x10000063
     933#endif
    801934
    802935#define ADCIDX                  0x64            /* ADC recording buffer index register          */
     936#ifndef TARGET_OS2
     937SUB_REG(ADCIDX, IDX,            0x0000ffff)
     938#else
    803939#define ADCIDX_MASK             0x0000ffff      /* 16 bit index field                           */
    804940#define ADCIDX_IDX              0x10000064
     941#endif
    805942
    806943#define A_ADCIDX                0x63
     944#ifndef TARGET_OS2
     945SUB_REG(A_ADCIDX, IDX,          0x0000ffff)
     946#else
    807947#define A_ADCIDX_IDX            0x10000063
     948#endif
    808949
    809950#define A_MICIDX                0x64
     951#ifndef TARGET_OS2
     952SUB_REG(A_MICIDX, IDX,          0x0000ffff)
     953#else
    810954#define A_MICIDX_IDX            0x10000064
     955#endif
    811956
    812957#define FXIDX                   0x65            /* FX recording buffer index register           */
     958#ifndef TARGET_OS2
     959SUB_REG(FXIDX, IDX,             0x0000ffff)
     960#else
    813961#define FXIDX_MASK              0x0000ffff      /* 16-bit value                                 */
    814962#define FXIDX_IDX               0x10000065
    815 
    816 /* The 32-bit HLIx and HLIPx registers all have one bit per channel control/status                      */
     963#endif
     964
     965/* The 32-bit HLIEx and HLIPx registers all have one bit per channel control/status                     */
    817966#define HLIEL                   0x66            /* Channel half loop interrupt enable low register      */
    818 
    819967#define HLIEH                   0x67            /* Channel half loop interrupt enable high register     */
    820968
    821969#define HLIPL                   0x68            /* Channel half loop interrupt pending low register     */
    822 
    823970#define HLIPH                   0x69            /* Channel half loop interrupt pending high register    */
    824971
    825 /* S/PDIF Host Record Index (bypasses SRC) */
    826 #define A_SPRI                  0x6a
    827 /* S/PDIF Host Record Address */
    828 #define A_SPRA                  0x6b
    829 /* S/PDIF Host Record Control */
    830 #define A_SPRC                  0x6c
    831 /* Delayed Interrupt Counter & Enable */
    832 #define A_DICE                  0x6d
    833 /* Tank Table Base */
    834 #define A_TTB                   0x6e
    835 /* Tank Delay Offset */
    836 #define A_TDOF                  0x6f
     972#define A_SPRI                  0x6a            /* S/PDIF Host Record Index (bypasses SRC)      */
     973#define A_SPRA                  0x6b            /* S/PDIF Host Record Address                   */
     974#define A_SPRC                  0x6c            /* S/PDIF Host Record Control                   */
     975
     976#define A_DICE                  0x6d            /* Delayed Interrupt Counter & Enable           */
     977
     978#define A_TTB                   0x6e            /* Tank Table Base                              */
     979#define A_TDOF                  0x6f            /* Tank Delay Offset                            */
    837980
    838981/* This is the MPU port on the card (via the game port)                                         */
     
    847990
    848991/* The next two are the Audigy equivalent of FXWC                                               */
    849 /* the Audigy can record any output (16bit, 48kHz, up to 64 channel simultaneously)             */
     992/* the Audigy can record any output (16bit, 48kHz, up to 64 channels simultaneously)            */
    850993/* Each bit selects a channel for recording */
    851994#define A_FXWC1                 0x74            /* Selects 0x7f-0x60 for FX recording           */
    852995#define A_FXWC2                 0x75            /* Selects 0x9f-0x80 for FX recording           */
    853996
    854 /* Extended Hardware Control */
    855 #define A_SPDIF_SAMPLERATE      0x76            /* Set the sample rate of SPDIF output          */
    856 #define A_SAMPLE_RATE           0x76            /* Various sample rate settings. */
    857 #define A_SAMPLE_RATE_NOT_USED  0x0ffc111e      /* Bits that are not used and cannot be set.    */
    858 #define A_SAMPLE_RATE_UNKNOWN   0xf0030001      /* Bits that can be set, but have unknown use.  */
     997#define A_EHC                   0x76            /* Extended Hardware Control */
     998
     999#define A_SPDIF_SAMPLERATE      A_EHC           /* Set the sample rate of SPDIF output          */
    8591000#define A_SPDIF_RATE_MASK       0x000000e0      /* Any other values for rates, just use 48000   */
    860 #define A_SPDIF_48000           0x00000000
     1001#define A_SPDIF_48000           0x00000000      /* kX calls this BYPASS                         */
    8611002#define A_SPDIF_192000          0x00000020
    8621003#define A_SPDIF_96000           0x00000040
    8631004#define A_SPDIF_44100           0x00000080
    864 
     1005#define A_SPDIF_MUTED           0x000000c0
     1006
     1007#ifndef TARGET_OS2
     1008SUB_REG_NC(A_EHC, A_I2S_CAPTURE_RATE, 0x00000e00)  /* This sets the capture PCM rate, but it is  */
     1009                                                   /* unclear if this sets the ADC rate as well. */
     1010#else
     1011#define A_I2S_CAPTURE_RATE      0x00000e00
    8651012#define A_I2S_CAPTURE_RATE_MASK 0x00000e00      /* This sets the capture PCM rate, but it is    */
    866 #define A_I2S_CAPTURE_48000     0x00000000      /* unclear if this sets the ADC rate as well.   */
    867 #define A_I2S_CAPTURE_192000    0x00000200
    868 #define A_I2S_CAPTURE_96000     0x00000400
    869 #define A_I2S_CAPTURE_44100     0x00000800
    870 
    871 #define A_PCM_RATE_MASK         0x0000e000      /* This sets the playback PCM rate on the P16V  */
    872 #define A_PCM_48000             0x00000000
    873 #define A_PCM_192000            0x00002000
    874 #define A_PCM_96000             0x00004000
    875 #define A_PCM_44100             0x00008000
    876 
    877 /* I2S0 Sample Rate Tracker Status */
    878 #define A_SRT3                  0x77
    879 
    880 /* I2S1 Sample Rate Tracker Status */
    881 #define A_SRT4                  0x78
    882 
    883 /* I2S2 Sample Rate Tracker Status */
    884 #define A_SRT5                  0x79
     1013                                                   /* unclear if this sets the ADC rate as well. */
     1014#endif
     1015#define A_I2S_CAPTURE_48000     0x0
     1016#define A_I2S_CAPTURE_192000    0x1
     1017#define A_I2S_CAPTURE_96000     0x2
     1018#define A_I2S_CAPTURE_44100     0x4
     1019
     1020#define A_EHC_SRC48_MASK        0x0000e000      /* This sets the playback PCM rate on the P16V  */
     1021#define A_EHC_SRC48_BYPASS      0x00000000
     1022#define A_EHC_SRC48_192         0x00002000
     1023#define A_EHC_SRC48_96          0x00004000
     1024#define A_EHC_SRC48_44          0x00008000
     1025#define A_EHC_SRC48_MUTED       0x0000c000
     1026
     1027#define A_EHC_P17V_TVM          0x00000001      /* Tank virtual memory mode                     */
     1028#define A_EHC_P17V_SEL0_MASK    0x00030000      /* Aka A_EHC_P16V_PB_RATE; 00: 48, 01: 44.1, 10: 96, 11: 192 */
     1029#define A_EHC_P17V_SEL1_MASK    0x000c0000
     1030#define A_EHC_P17V_SEL2_MASK    0x00300000
     1031#define A_EHC_P17V_SEL3_MASK    0x00c00000
     1032
     1033#define A_EHC_ASYNC_BYPASS      0x80000000
     1034
     1035#define A_SRT3                  0x77            /* I2S0 Sample Rate Tracker Status              */
     1036#define A_SRT4                  0x78            /* I2S1 Sample Rate Tracker Status              */
     1037#define A_SRT5                  0x79            /* I2S2 Sample Rate Tracker Status              */
    8851038/* - default to 0x01080000 on my audigy 2 ZS --rlrevell */
    8861039
    887 /* Tank Table DMA Address */
    888 #define A_TTDA                  0x7a
    889 /* Tank Table DMA Data */
    890 #define A_TTDD                  0x7b
     1040#define A_SRT_ESTSAMPLERATE     0x001fffff
     1041#define A_SRT_RATELOCKED        0x01000000
     1042
     1043#define A_TTDA                  0x7a            /* Tank Table DMA Address                       */
     1044#define A_TTDD                  0x7b            /* Tank Table DMA Data                          */
     1045
     1046// In A_FXRT1 & A_FXRT2, the 0x80 bit of each byte completely disables the
     1047// filter (CVCF_CURRENTFILTER) for the corresponding channel. There is no
     1048// effect on the volume (CVCF_CURRENTVOLUME) or the interpolator's filter
     1049// (CCCA_INTERPROM_MASK).
    8911050
    8921051#define A_FXRT2                 0x7c
     
    9011060#define A_FXSENDAMOUNT_G_MASK   0x0000FF00
    9021061#define A_FXSENDAMOUNT_H_MASK   0x000000FF
    903 /* 0x7c, 0x7e "high bit is used for filtering" */
    904  
     1062
    9051063/* The send amounts for this one are the same as used with the emu10k1 */
    9061064#define A_FXRT1                 0x7e
     
    9111069
    9121070/* 0x7f: Not used */
    913 /* Each FX general purpose register is 32 bits in length, all bits are used                     */
    914 #define FXGPREGBASE             0x100           /* FX general purpose registers base            */
    915 #define A_FXGPREGBASE           0x400           /* Audigy GPRs, 0x400 to 0x5ff                  */
    916 
    917 #define A_TANKMEMCTLREGBASE     0x100           /* Tank memory control registers base - only for Audigy */
    918 #define A_TANKMEMCTLREG_MASK    0x1f            /* only 5 bits used - only for Audigy */
    919 
    920 /* Tank audio data is logarithmically compressed down to 16 bits before writing to TRAM and is  */
    921 /* decompressed back to 20 bits on a read.  There are a total of 160 locations, the last 32     */
    922 /* locations are for external TRAM.                                                             */
    923 #define TANKMEMDATAREGBASE      0x200           /* Tank memory data registers base              */
    924 #define TANKMEMDATAREG_MASK     0x000fffff      /* 20 bit tank audio data field                 */
    925 
    926 /* Combined address field and memory opcode or flag field.  160 locations, last 32 are external */
    927 #define TANKMEMADDRREGBASE      0x300           /* Tank memory address registers base           */
    928 #define TANKMEMADDRREG_ADDR_MASK 0x000fffff     /* 20 bit tank address field                    */
    929 #define TANKMEMADDRREG_CLEAR    0x00800000      /* Clear tank memory                            */
    930 #define TANKMEMADDRREG_ALIGN    0x00400000      /* Align read or write relative to tank access  */
    931 #define TANKMEMADDRREG_WRITE    0x00200000      /* Write to tank memory                         */
    932 #define TANKMEMADDRREG_READ     0x00100000      /* Read from tank memory                        */
    933 
    934 #define MICROCODEBASE           0x400           /* Microcode data base address                  */
     1071
     1072/* The public header defines the GPR and TRAM base addresses that
     1073 * are valid for _both_ CPU and DSP addressing. */
    9351074
    9361075/* Each DSP microcode instruction is mapped into 2 doublewords                                  */
    9371076/* NOTE: When writing, always write the LO doubleword first.  Reads can be in either order.     */
    938 #define LOWORD_OPX_MASK         0x000ffc00      /* Instruction operand X                        */
    939 #define LOWORD_OPY_MASK         0x000003ff      /* Instruction operand Y                        */
    940 #define HIWORD_OPCODE_MASK      0x00f00000      /* Instruction opcode                           */
    941 #define HIWORD_RESULT_MASK      0x000ffc00      /* Instruction result                           */
    942 #define HIWORD_OPA_MASK         0x000003ff      /* Instruction operand A                        */
    943 
    944 
    945 /* Audigy Soundcard have a different instruction format */
     1077#define MICROCODEBASE           0x400           /* Microcode data base address                  */
    9461078#define A_MICROCODEBASE         0x600
    947 #define A_LOWORD_OPY_MASK       0x000007ff
    948 #define A_LOWORD_OPX_MASK       0x007ff000
    949 #define A_HIWORD_OPCODE_MASK    0x0f000000
    950 #define A_HIWORD_RESULT_MASK    0x007ff000
    951 #define A_HIWORD_OPA_MASK       0x000007ff
     1079
    9521080
    9531081/************************************************************************************************/
    954 /* EMU1010m HANA FPGA registers                                                                 */
     1082/* E-MU Digital Audio System overview                                                           */
    9551083/************************************************************************************************/
     1084
     1085// - These cards use a regular PCI-attached Audigy chip (Alice2/Tina/Tina2);
     1086//   the PCIe variants simply put the Audigy chip behind a PCI bridge.
     1087// - All physical PCM I/O is routed through an additional FPGA; the regular
     1088//   EXTIN/EXTOUT ports are unconnected.
     1089// - The FPGA has a signal routing matrix, to connect each destination (output
     1090//   socket or capture channel) to a source (input socket or playback channel).
     1091// - The FPGA is controlled via Audigy's GPIO port, while sample data is
     1092//   transmitted via proprietary EMU32 serial links. On first-generation
     1093//   E-MU 1010 cards, Audigy's I2S inputs are also used for sample data.
     1094// - The Audio/Micro Dock is attached to Hana via EDI, a "network" link.
     1095// - The Audigy chip operates in slave mode; the clock is supplied by the FPGA.
     1096//   Gen1 E-MU 1010 cards have two crystals (for 44.1 kHz and 48 kHz multiples),
     1097//   while the later cards use a single crystal and a PLL chip.
     1098// - The whole card is switched to 2x/4x mode to achieve 88.2/96/176.4/192 kHz
     1099//   sample rates. Alice2/Tina keeps running at 44.1/48 kHz, but multiple channels
     1100//   are bundled.
     1101// - The number of available EMU32/EDI channels is hit in 2x/4x mode, so the total
     1102//   number of usable inputs/outputs is limited, esp. with ADAT in use.
     1103// - S/PDIF is unavailable in 4x mode (only over TOSLINK on newer 1010 cards) due
     1104//   to being unspecified at 176.4/192 kHz. Therefore, the Dock's S/PDIF channels
     1105//   can overlap with the Dock's ADC/DAC's high channels.
     1106// - The code names are mentioned below and in the emu_chip_details table.
     1107
     1108/************************************************************************************************/
     1109/* EMU1010 FPGA registers                                                                       */
     1110/************************************************************************************************/
     1111
    9561112#define EMU_HANA_DESTHI         0x00    /* 0000xxx  3 bits Link Destination */
    9571113#define EMU_HANA_DESTLO         0x01    /* 00xxxxx  5 bits */
     1114
    9581115#define EMU_HANA_SRCHI          0x02    /* 0000xxx  3 bits Link Source */
    9591116#define EMU_HANA_SRCLO          0x03    /* 00xxxxx  5 bits */
     1117
    9601118#define EMU_HANA_DOCK_PWR       0x04    /* 000000x  1 bits Audio Dock power */
    9611119#define EMU_HANA_DOCK_PWR_ON            0x01 /* Audio Dock power on */
     1120
    9621121#define EMU_HANA_WCLOCK         0x05    /* 0000xxx  3 bits Word Clock source select  */
    9631122                                        /* Must be written after power on to reset DLL */
     
    9681127#define EMU_HANA_WCLOCK_HANA_SPDIF_IN   0x02
    9691128#define EMU_HANA_WCLOCK_HANA_ADAT_IN    0x03
    970 #define EMU_HANA_WCLOCK_SYNC_BNCN       0x04
     1129#define EMU_HANA_WCLOCK_SYNC_BNC        0x04
    9711130#define EMU_HANA_WCLOCK_2ND_HANA        0x05
    9721131#define EMU_HANA_WCLOCK_SRC_RESERVED    0x06
     
    9781137#define EMU_HANA_WCLOCK_MULT_RESERVED   0x18
    9791138
     1139// If the selected external clock source is/becomes invalid or incompatible
     1140// with the clock multiplier, the clock source is reset to this value, and
     1141// a WCLK_CHANGED interrupt is raised.
    9801142#define EMU_HANA_DEFCLOCK       0x06    /* 000000x  1 bits Default Word Clock  */
    9811143#define EMU_HANA_DEFCLOCK_48K           0x00
     
    9971159
    9981160#define EMU_HANA_SPDIF_MODE     0x0a    /* 00xxxxx  5 bits SPDIF MODE  */
    999 #define EMU_HANA_SPDIF_MODE_TX_COMSUMER 0x00
     1161#define EMU_HANA_SPDIF_MODE_TX_CONSUMER 0x00
    10001162#define EMU_HANA_SPDIF_MODE_TX_PRO      0x01
    10011163#define EMU_HANA_SPDIF_MODE_TX_NOCOPY   0x02
    1002 #define EMU_HANA_SPDIF_MODE_RX_COMSUMER 0x00
     1164#define EMU_HANA_SPDIF_MODE_RX_CONSUMER 0x00
    10031165#define EMU_HANA_SPDIF_MODE_RX_PRO      0x04
    10041166#define EMU_HANA_SPDIF_MODE_RX_NOCOPY   0x08
     
    10121174
    10131175#define EMU_HANA_MIDI_IN                0x0c    /* 000000x  1 bit  Control MIDI  */
    1014 #define EMU_HANA_MIDI_IN_FROM_HAMOA     0x00 /* HAMOA MIDI in to Alice 2 MIDI B */
    1015 #define EMU_HANA_MIDI_IN_FROM_DOCK      0x01 /* Audio Dock MIDI in to Alice 2 MIDI B */
     1176#define EMU_HANA_MIDI_INA_FROM_HAMOA    0x01 /* HAMOA MIDI in to Alice 2 MIDI A */
     1177#define EMU_HANA_MIDI_INA_FROM_DOCK1    0x02 /* Audio Dock-1 MIDI in to Alice 2 MIDI A */
     1178#define EMU_HANA_MIDI_INA_FROM_DOCK2    0x03 /* Audio Dock-2 MIDI in to Alice 2 MIDI A */
     1179#define EMU_HANA_MIDI_INB_FROM_HAMOA    0x08 /* HAMOA MIDI in to Alice 2 MIDI B */
     1180#define EMU_HANA_MIDI_INB_FROM_DOCK1    0x10 /* Audio Dock-1 MIDI in to Alice 2 MIDI B */
     1181#define EMU_HANA_MIDI_INB_FROM_DOCK2    0x18 /* Audio Dock-2 MIDI in to Alice 2 MIDI B */
    10161182
    10171183#define EMU_HANA_DOCK_LEDS_1    0x0d    /* 000xxxx  4 bit  Audio Dock LEDs  */
     
    10381204
    10391205#define EMU_HANA_ADC_PADS       0x10    /* 0000xxx  3 bit  Audio Dock ADC 14dB pads */
    1040 #define EMU_HANA_DOCK_ADC_PAD1  0x01    /* 14dB Attenuation on Audio Dock ADC 1 */
    1041 #define EMU_HANA_DOCK_ADC_PAD2  0x02    /* 14dB Attenuation on Audio Dock ADC 2 */
    1042 #define EMU_HANA_DOCK_ADC_PAD3  0x04    /* 14dB Attenuation on Audio Dock ADC 3 */
    1043 #define EMU_HANA_0202_ADC_PAD1  0x08    /* 14dB Attenuation on 0202 ADC 1 */
     1206#define EMU_HANA_DOCK_ADC_PAD1          0x01    /* 14dB Attenuation on Audio Dock ADC 1 */
     1207#define EMU_HANA_DOCK_ADC_PAD2          0x02    /* 14dB Attenuation on Audio Dock ADC 2 */
     1208#define EMU_HANA_DOCK_ADC_PAD3          0x04    /* 14dB Attenuation on Audio Dock ADC 3 */
     1209#define EMU_HANA_0202_ADC_PAD1          0x08    /* 14dB Attenuation on 0202 ADC 1 */
    10441210
    10451211#define EMU_HANA_DOCK_MISC      0x11    /* 0xxxxxx  6 bit  Audio Dock misc bits */
    1046 #define EMU_HANA_DOCK_DAC1_MUTE 0x01    /* DAC 1 Mute */
    1047 #define EMU_HANA_DOCK_DAC2_MUTE 0x02    /* DAC 2 Mute */
    1048 #define EMU_HANA_DOCK_DAC3_MUTE 0x04    /* DAC 3 Mute */
    1049 #define EMU_HANA_DOCK_DAC4_MUTE 0x08    /* DAC 4 Mute */
     1212#define EMU_HANA_DOCK_DAC1_MUTE         0x01    /* DAC 1 Mute */
     1213#define EMU_HANA_DOCK_DAC2_MUTE         0x02    /* DAC 2 Mute */
     1214#define EMU_HANA_DOCK_DAC3_MUTE         0x04    /* DAC 3 Mute */
     1215#define EMU_HANA_DOCK_DAC4_MUTE         0x08    /* DAC 4 Mute */
    10501216#define EMU_HANA_DOCK_PHONES_192_DAC1   0x00    /* DAC 1 Headphones source at 192kHz */
    10511217#define EMU_HANA_DOCK_PHONES_192_DAC2   0x10    /* DAC 2 Headphones source at 192kHz */
     
    10541220
    10551221#define EMU_HANA_MIDI_OUT       0x12    /* 00xxxxx  5 bit  Source for each MIDI out port */
    1056 #define EMU_HANA_MIDI_OUT_0202  0x01 /* 0202 MIDI from Alice 2. 0 = A, 1 = B */
    1057 #define EMU_HANA_MIDI_OUT_DOCK1 0x02 /* Audio Dock MIDI1 front, from Alice 2. 0 = A, 1 = B */
    1058 #define EMU_HANA_MIDI_OUT_DOCK2 0x04 /* Audio Dock MIDI2 rear, from Alice 2. 0 = A, 1 = B */
    1059 #define EMU_HANA_MIDI_OUT_SYNC2 0x08 /* Sync card. Not the actual MIDI out jack. 0 = A, 1 = B */
    1060 #define EMU_HANA_MIDI_OUT_LOOP  0x10 /* 0 = bits (3:0) normal. 1 = MIDI loopback enabled. */
     1222#define EMU_HANA_MIDI_OUT_0202          0x01 /* 0202 MIDI from Alice 2. 0 = A, 1 = B */
     1223#define EMU_HANA_MIDI_OUT_DOCK1         0x02 /* Audio Dock MIDI1 front, from Alice 2. 0 = A, 1 = B */
     1224#define EMU_HANA_MIDI_OUT_DOCK2         0x04 /* Audio Dock MIDI2 rear, from Alice 2. 0 = A, 1 = B */
     1225#define EMU_HANA_MIDI_OUT_SYNC2         0x08 /* Sync card. Not the actual MIDI out jack. 0 = A, 1 = B */
     1226#define EMU_HANA_MIDI_OUT_LOOP          0x10 /* 0 = bits (3:0) normal. 1 = MIDI loopback enabled. */
    10611227
    10621228#define EMU_HANA_DAC_PADS       0x13    /* 00xxxxx  5 bit  DAC 14dB attenuation pads */
    1063 #define EMU_HANA_DOCK_DAC_PAD1  0x01    /* 14dB Attenuation on AudioDock DAC 1. Left and Right */
    1064 #define EMU_HANA_DOCK_DAC_PAD2  0x02    /* 14dB Attenuation on AudioDock DAC 2. Left and Right */
    1065 #define EMU_HANA_DOCK_DAC_PAD3  0x04    /* 14dB Attenuation on AudioDock DAC 3. Left and Right */
    1066 #define EMU_HANA_DOCK_DAC_PAD4  0x08    /* 14dB Attenuation on AudioDock DAC 4. Left and Right */
    1067 #define EMU_HANA_0202_DAC_PAD1  0x10    /* 14dB Attenuation on 0202 DAC 1. Left and Right */
     1229#define EMU_HANA_DOCK_DAC_PAD1          0x01    /* 14dB Attenuation on AudioDock DAC 1. Left and Right */
     1230#define EMU_HANA_DOCK_DAC_PAD2          0x02    /* 14dB Attenuation on AudioDock DAC 2. Left and Right */
     1231#define EMU_HANA_DOCK_DAC_PAD3          0x04    /* 14dB Attenuation on AudioDock DAC 3. Left and Right */
     1232#define EMU_HANA_DOCK_DAC_PAD4          0x08    /* 14dB Attenuation on AudioDock DAC 4. Left and Right */
     1233#define EMU_HANA_0202_DAC_PAD1          0x10    /* 14dB Attenuation on 0202 DAC 1. Left and Right */
    10681234
    10691235/* 0x14 - 0x1f Unused R/W registers */
    1070 #define EMU_HANA_IRQ_STATUS     0x20    /* 000xxxx  4 bits IRQ Status  */
    1071 #if 0  /* Already defined for reg 0x09 IRQ_ENABLE */
    1072 #define EMU_HANA_IRQ_WCLK_CHANGED       0x01
    1073 #define EMU_HANA_IRQ_ADAT               0x02
    1074 #define EMU_HANA_IRQ_DOCK               0x04
    1075 #define EMU_HANA_IRQ_DOCK_LOST          0x08
    1076 #endif
     1236
     1237#define EMU_HANA_IRQ_STATUS     0x20    /* 00xxxxx  5 bits IRQ Status  */
     1238                                        /* Same bits as for EMU_HANA_IRQ_ENABLE */
     1239                                        /* Reading the register resets it. */
    10771240
    10781241#define EMU_HANA_OPTION_CARDS   0x21    /* 000xxxx  4 bits Presence of option cards */
    1079 #define EMU_HANA_OPTION_HAMOA   0x01    /* HAMOA card present */
    1080 #define EMU_HANA_OPTION_SYNC    0x02    /* Sync card present */
    1081 #define EMU_HANA_OPTION_DOCK_ONLINE     0x04    /* Audio Dock online and FPGA configured */
    1082 #define EMU_HANA_OPTION_DOCK_OFFLINE    0x08    /* Audio Dock online and FPGA not configured */
    1083 
    1084 #define EMU_HANA_ID             0x22    /* 1010101  7 bits ID byte & 0x7f = 0x55 */
     1242#define EMU_HANA_OPTION_HAMOA           0x01    /* Hamoa (analog I/O) card present */
     1243#define EMU_HANA_OPTION_SYNC            0x02    /* Sync card present */
     1244#define EMU_HANA_OPTION_DOCK_ONLINE     0x04    /* Audio/Micro dock present and FPGA configured */
     1245#define EMU_HANA_OPTION_DOCK_OFFLINE    0x08    /* Audio/Micro dock present and FPGA not configured */
     1246
     1247#define EMU_HANA_ID             0x22    /* 1010101  7 bits ID byte & 0x7f = 0x55 with Alice2 */
     1248                                        /* 0010101  5 bits ID byte & 0x1f = 0x15 with Tina/2 */
    10851249
    10861250#define EMU_HANA_MAJOR_REV      0x23    /* 0000xxx  3 bit  Hana FPGA Major rev */
     
    10911255
    10921256#define EMU_DOCK_BOARD_ID       0x27    /* 00000xx  2 bits Audio Dock ID pins */
    1093 #define EMU_DOCK_BOARD_ID0      0x00    /* ID bit 0 */
    1094 #define EMU_DOCK_BOARD_ID1      0x03    /* ID bit 1 */
     1257#define EMU_DOCK_BOARD_ID0              0x00    /* ID bit 0 */
     1258#define EMU_DOCK_BOARD_ID1              0x03    /* ID bit 1 */
     1259
     1260// The actual code disagrees about the bit width of the registers -
     1261// the formula used is freq = 0x1770000 / (((X_HI << 5) | X_LO) + 1)
    10951262
    10961263#define EMU_HANA_WC_SPDIF_HI    0x28    /* 0xxxxxx  6 bit  SPDIF IN Word clock, upper 6 bits */
     
    11051272#define EMU_HANA2_WC_SPDIF_HI   0x2e    /* 0xxxxxx  6 bit  HANA2 SPDIF IN Word clock, upper 6 bits */
    11061273#define EMU_HANA2_WC_SPDIF_LO   0x2f    /* 0xxxxxx  6 bit  HANA2 SPDIF IN Word clock, lower 6 bits */
     1274
    11071275/* 0x30 - 0x3f Unused Read only registers */
    11081276
     1277// The meaning of this is not clear; kX-project just calls it "lock" in some info-only code.
     1278#define EMU_HANA_LOCK_STS_LO    0x38    /* 0xxxxxx  lower 6 bits */
     1279#define EMU_HANA_LOCK_STS_HI    0x39    /* 0xxxxxx  upper 6 bits */
     1280
    11091281/************************************************************************************************/
    1110 /* EMU1010m HANA Destinations                                                                   */
     1282/* EMU1010 Audio Destinations                                                                   */
    11111283/************************************************************************************************/
    1112 /* Hana, original 1010,1212,1820 using Alice2
    1113  * Destiniations for SRATEX = 1X rates: 44.1 kHz or 48 kHz
     1284/* Hana, original 1010,1212m,1820[m] using Alice2
    11141285 * 0x00, 0x00-0x0f: 16 EMU32 channels to Alice2
    1115  * 0x01, 0x10-0x1f: 32 Elink channels to Audio Dock
    1116  * 0x01, 0x00: Dock DAC 1 Left
    1117  * 0x01, 0x04: Dock DAC 1 Right
    1118  * 0x01, 0x08: Dock DAC 2 Left
    1119  * 0x01, 0x0c: Dock DAC 2 Right
    1120  * 0x01, 0x10: Dock DAC 3 Left
    1121  * 0x01, 0x12: PHONES Left
    1122  * 0x01, 0x14: Dock DAC 3 Right
    1123  * 0x01, 0x16: PHONES Right
    1124  * 0x01, 0x18: Dock DAC 4 Left
    1125  * 0x01, 0x1a: S/PDIF Left
    1126  * 0x01, 0x1c: Dock DAC 4 Right
    1127  * 0x01, 0x1e: S/PDIF Right
     1286 * 0x01, 0x00-0x1f: 32 EDI channels to Audio Dock
     1287 *       0x00: Dock DAC 1 Left
     1288 *       0x04: Dock DAC 1 Right
     1289 *       0x08: Dock DAC 2 Left
     1290 *       0x0c: Dock DAC 2 Right
     1291 *       0x10: Dock DAC 3 Left
     1292 *       0x12: PHONES Left (n/a in 2x/4x mode; output mirrors DAC4 Left)
     1293 *       0x14: Dock DAC 3 Right
     1294 *       0x16: PHONES Right (n/a in 2x/4x mode; output mirrors DAC4 Right)
     1295 *       0x18: Dock DAC 4 Left
     1296 *       0x1a: S/PDIF Left
     1297 *       0x1c: Dock DAC 4 Right
     1298 *       0x1e: S/PDIF Right
    11281299 * 0x02, 0x00: Hana S/PDIF Left
    11291300 * 0x02, 0x01: Hana S/PDIF Right
    1130  * 0x03, 0x00: Hanoa DAC Left
    1131  * 0x03, 0x01: Hanoa DAC Right
     1301 * 0x03, 0x00: Hamoa DAC Left
     1302 * 0x03, 0x01: Hamoa DAC Right
    11321303 * 0x04, 0x00-0x07: Hana ADAT
    11331304 * 0x05, 0x00: I2S0 Left to Alice2
     
    11411312 * Not needed.
    11421313 *
    1143  * Hana3, rev2 1010,1212,1616 using Tina
    1144  * Destinations for SRATEX = 1X rates: 44.1 kHz or 48 kHz
     1314 * Hana3, rev2 1010,1212m,1616[m] using Tina
    11451315 * 0x00, 0x00-0x0f: 16 EMU32A channels to Tina
    1146  * 0x01, 0x10-0x1f: 32 EDI channels to Micro Dock
    1147  * 0x01, 0x00: Dock DAC 1 Left
    1148  * 0x01, 0x04: Dock DAC 1 Right
    1149  * 0x01, 0x08: Dock DAC 2 Left
    1150  * 0x01, 0x0c: Dock DAC 2 Right
    1151  * 0x01, 0x10: Dock DAC 3 Left
    1152  * 0x01, 0x12: Dock S/PDIF Left
    1153  * 0x01, 0x14: Dock DAC 3 Right
    1154  * 0x01, 0x16: Dock S/PDIF Right
    1155  * 0x01, 0x18-0x1f: Dock ADAT 0-7
     1316 * 0x01, 0x00-0x1f: 32 EDI channels to Micro Dock
     1317 *       0x00: Dock DAC 1 Left
     1318 *       0x04: Dock DAC 1 Right
     1319 *       0x08: Dock DAC 2 Left
     1320 *       0x0c: Dock DAC 2 Right
     1321 *       0x10: Dock DAC 3 Left
     1322 *       0x12: Dock S/PDIF Left
     1323 *       0x14: Dock DAC 3 Right
     1324 *       0x16: Dock S/PDIF Right
     1325 *       0x18-0x1f: Dock ADAT 0-7
    11561326 * 0x02, 0x00: Hana3 S/PDIF Left
    11571327 * 0x02, 0x01: Hana3 S/PDIF Right
    1158  * 0x03, 0x00: Hanoa DAC Left
    1159  * 0x03, 0x01: Hanoa DAC Right
     1328 * 0x03, 0x00: Hamoa DAC Left
     1329 * 0x03, 0x01: Hamoa DAC Right
    11601330 * 0x04, 0x00-0x07: Hana3 ADAT 0-7
    11611331 * 0x05, 0x00-0x0f: 16 EMU32B channels to Tina
     
    11631333 *
    11641334 * HanaLite, rev1 0404 using Alice2
    1165  * Destiniations for SRATEX = 1X rates: 44.1 kHz or 48 kHz
    1166  * 0x00, 0x00-0x0f: 16 EMU32 channels to Alice2
    1167  * 0x01: Not used
    1168  * 0x02, 0x00: S/PDIF Left
    1169  * 0x02, 0x01: S/PDIF Right
    1170  * 0x03, 0x00: DAC Left
    1171  * 0x03, 0x01: DAC Right
    1172  * 0x04-0x07: Not used
    1173  *
    1174  * HanaLiteLite, rev2 0404 using Alice2
    1175  * Destiniations for SRATEX = 1X rates: 44.1 kHz or 48 kHz
    1176  * 0x00, 0x00-0x0f: 16 EMU32 channels to Alice2
     1335 * HanaLiteLite, rev2 0404 using Tina
     1336 * 0x00, 0x00-0x0f: 16 EMU32 channels to Alice2/Tina
    11771337 * 0x01: Not used
    11781338 * 0x02, 0x00: S/PDIF Left
     
    11831343 *
    11841344 * Mana, Cardbus 1616 using Tina2
    1185  * Destinations for SRATEX = 1X rates: 44.1 kHz or 48 kHz
    11861345 * 0x00, 0x00-0x0f: 16 EMU32A channels to Tina2
    1187  * 0x01, 0x10-0x1f: 32 EDI channels to Micro Dock
    1188  * 0x01, 0x00: Dock DAC 1 Left
    1189  * 0x01, 0x04: Dock DAC 1 Right
    1190  * 0x01, 0x08: Dock DAC 2 Left
    1191  * 0x01, 0x0c: Dock DAC 2 Right
    1192  * 0x01, 0x10: Dock DAC 3 Left
    1193  * 0x01, 0x12: Dock S/PDIF Left
    1194  * 0x01, 0x14: Dock DAC 3 Right
    1195  * 0x01, 0x16: Dock S/PDIF Right
    1196  * 0x01, 0x18-0x1f: Dock ADAT 0-7
     1346 * 0x01, 0x00-0x1f: 32 EDI channels to Micro Dock
     1347 *       (same as rev2 1010)
    11971348 * 0x02: Not used
    11981349 * 0x03, 0x00: Mana DAC Left
     
    12001351 * 0x04, 0x00-0x0f: 16 EMU32B channels to Tina2
    12011352 * 0x05-0x07: Not used
    1202  *
    1203  *
    12041353 */
     1354
    12051355/* 32-bit destinations of signal in the Hana FPGA. Destinations are either
    1206  * physical outputs of Hana, or outputs going to Alice2 (audigy) for capture
    1207  * - 16 x EMU_DST_ALICE2_EMU32_X.
    1208  */
    1209 /* EMU32 = 32-bit serial channel between Alice2 (audigy) and Hana (FPGA) */
    1210 /* EMU_DST_ALICE2_EMU32_X - data channels from Hana to Alice2 used for capture.
    1211  * Which data is fed into a EMU_DST_ALICE2_EMU32_X channel in Hana depends on
    1212  * setup of mixer control for each destination - see emumixer.c -
    1213  * snd_emu1010_output_enum_ctls[], snd_emu1010_input_enum_ctls[]
     1356 * physical outputs of Hana, or outputs going to Alice2/Tina for capture -
     1357 * 16 x EMU_DST_ALICE2_EMU32_X (2x on rev2 boards). Which data is fed into
     1358 * a channel depends on the mixer control setting for each destination - see
     1359 * the register arrays in emumixer.c.
    12141360 */
    12151361#define EMU_DST_ALICE2_EMU32_0  0x000f  /* 16 EMU32 channels to Alice2 +0 to +0xf */
     1362                                        /* This channel is delayed by one sample. */
    12161363#define EMU_DST_ALICE2_EMU32_1  0x0000  /* 16 EMU32 channels to Alice2 +0 to +0xf */
    12171364#define EMU_DST_ALICE2_EMU32_2  0x0001  /* 16 EMU32 channels to Alice2 +0 to +0xf */
     
    12711418#define EMU_DST_HANA_SPDIF_LEFT1        0x0200  /* Hana SPDIF Left, 1st or 48kHz only */
    12721419#define EMU_DST_HANA_SPDIF_LEFT2        0x0202  /* Hana SPDIF Left, 2nd or 96kHz */
     1420#define EMU_DST_HANA_SPDIF_LEFT3        0x0204  /* Hana SPDIF Left, 3rd or 192kHz */
     1421#define EMU_DST_HANA_SPDIF_LEFT4        0x0206  /* Hana SPDIF Left, 4th or 192kHz */
    12731422#define EMU_DST_HANA_SPDIF_RIGHT1       0x0201  /* Hana SPDIF Right, 1st or 48kHz only */
    12741423#define EMU_DST_HANA_SPDIF_RIGHT2       0x0203  /* Hana SPDIF Right, 2nd or 96kHz */
     1424#define EMU_DST_HANA_SPDIF_RIGHT3       0x0205  /* Hana SPDIF Right, 3rd or 192kHz */
     1425#define EMU_DST_HANA_SPDIF_RIGHT4       0x0207  /* Hana SPDIF Right, 4th or 192kHz */
    12751426#define EMU_DST_HAMOA_DAC_LEFT1 0x0300  /* Hamoa DAC Left, 1st or 48kHz only */
    12761427#define EMU_DST_HAMOA_DAC_LEFT2 0x0302  /* Hamoa DAC Left, 2nd or 96kHz */
     
    12811432#define EMU_DST_HAMOA_DAC_RIGHT3        0x0305  /* Hamoa DAC Right, 3rd or 192kHz */
    12821433#define EMU_DST_HAMOA_DAC_RIGHT4        0x0307  /* Hamoa DAC Right, 4th or 192kHz */
     1434// In S/MUX mode, the samples of one channel are adjacent.
    12831435#define EMU_DST_HANA_ADAT       0x0400  /* Hana ADAT 8 channel out +0 to +7 */
    12841436#define EMU_DST_ALICE_I2S0_LEFT         0x0500  /* Alice2 I2S0 Left */
     
    12901442
    12911443/* Additional destinations for 1616(M)/Microdock */
    1292 /* Microdock S/PDIF OUT Left, 1st or 48kHz only */
    1293 #define EMU_DST_MDOCK_SPDIF_LEFT1       0x0112
    1294 /* Microdock S/PDIF OUT Left, 2nd or 96kHz */
    1295 #define EMU_DST_MDOCK_SPDIF_LEFT2       0x0113
    1296 /* Microdock S/PDIF OUT Right, 1st or 48kHz only */
    1297 #define EMU_DST_MDOCK_SPDIF_RIGHT1      0x0116
    1298 /* Microdock S/PDIF OUT Right, 2nd or 96kHz  */
    1299 #define EMU_DST_MDOCK_SPDIF_RIGHT2      0x0117
    1300 /* Microdock S/PDIF ADAT 8 channel out +8 to +f */
    1301 #define EMU_DST_MDOCK_ADAT              0x0118
    1302 
    1303 /* Headphone jack on 1010 cardbus? 44.1/48kHz only? */
    1304 #define EMU_DST_MANA_DAC_LEFT           0x0300
    1305 /* Headphone jack on 1010 cardbus? 44.1/48kHz only? */
    1306 #define EMU_DST_MANA_DAC_RIGHT          0x0301
     1444
     1445#define EMU_DST_MDOCK_SPDIF_LEFT1       0x0112  /* Microdock S/PDIF OUT Left, 1st or 48kHz only */
     1446#define EMU_DST_MDOCK_SPDIF_LEFT2       0x0113  /* Microdock S/PDIF OUT Left, 2nd or 96kHz */
     1447#define EMU_DST_MDOCK_SPDIF_RIGHT1      0x0116  /* Microdock S/PDIF OUT Right, 1st or 48kHz only */
     1448#define EMU_DST_MDOCK_SPDIF_RIGHT2      0x0117  /* Microdock S/PDIF OUT Right, 2nd or 96kHz  */
     1449#define EMU_DST_MDOCK_ADAT              0x0118  /* Microdock S/PDIF ADAT 8 channel out +8 to +f */
     1450
     1451#define EMU_DST_MANA_DAC_LEFT           0x0300  /* Headphone jack on 1010 cardbus? 44.1/48kHz only? */
     1452#define EMU_DST_MANA_DAC_RIGHT          0x0301  /* Headphone jack on 1010 cardbus? 44.1/48kHz only? */
    13071453
    13081454/************************************************************************************************/
    1309 /* EMU1010m HANA Sources                                                                        */
     1455/* EMU1010 Audio Sources                                                                        */
    13101456/************************************************************************************************/
    1311 /* Hana, original 1010,1212,1820 using Alice2
    1312  * Sources SRATEX = 1X rates: 44.1 kHz or 48 kHz
    1313  * 0x00,0x00-0x1f: Silence
    1314  * 0x01, 0x10-0x1f: 32 Elink channels from Audio Dock
    1315  * 0x01, 0x00: Dock Mic A
    1316  * 0x01, 0x04: Dock Mic B
    1317  * 0x01, 0x08: Dock ADC 1 Left
    1318  * 0x01, 0x0c: Dock ADC 1 Right
    1319  * 0x01, 0x10: Dock ADC 2 Left
    1320  * 0x01, 0x14: Dock ADC 2 Right
    1321  * 0x01, 0x18: Dock ADC 3 Left
    1322  * 0x01, 0x1c: Dock ADC 3 Right
    1323  * 0x02, 0x00: Hana ADC Left
    1324  * 0x02, 0x01: Hana ADC Right
     1457/* Hana, original 1010,1212m,1820[m] using Alice2
     1458 * 0x00, 0x00-0x1f: Silence
     1459 * 0x01, 0x00-0x1f: 32 EDI channels from Audio Dock
     1460 *       0x00: Dock Mic A
     1461 *       0x04: Dock Mic B
     1462 *       0x08: Dock ADC 1 Left
     1463 *       0x0c: Dock ADC 1 Right
     1464 *       0x10: Dock ADC 2 Left
     1465 *       0x14: Dock ADC 2 Right
     1466 *       0x18: Dock ADC 3 Left
     1467 *       0x1c: Dock ADC 3 Right
     1468 * 0x02, 0x00: Hamoa ADC Left
     1469 * 0x02, 0x01: Hamoa ADC Right
    13251470 * 0x03, 0x00-0x0f: 16 inputs from Alice2 Emu32A output
    13261471 * 0x03, 0x10-0x1f: 16 inputs from Alice2 Emu32B output
     
    13331478 * Not needed.
    13341479 *
    1335  * Hana3, rev2 1010,1212,1616 using Tina
    1336  * Sources SRATEX = 1X rates: 44.1 kHz or 48 kHz
    1337  * 0x00,0x00-0x1f: Silence
    1338  * 0x01, 0x10-0x1f: 32 Elink channels from Audio Dock
    1339  * 0x01, 0x00: Dock Mic A
    1340  * 0x01, 0x04: Dock Mic B
    1341  * 0x01, 0x08: Dock ADC 1 Left
    1342  * 0x01, 0x0c: Dock ADC 1 Right
    1343  * 0x01, 0x10: Dock ADC 2 Left
    1344  * 0x01, 0x12: Dock S/PDIF Left
    1345  * 0x01, 0x14: Dock ADC 2 Right
    1346  * 0x01, 0x16: Dock S/PDIF Right
    1347  * 0x01, 0x18-0x1f: Dock ADAT 0-7
    1348  * 0x01, 0x18: Dock ADC 3 Left
    1349  * 0x01, 0x1c: Dock ADC 3 Right
    1350  * 0x02, 0x00: Hanoa ADC Left
    1351  * 0x02, 0x01: Hanoa ADC Right
     1480 * Hana3, rev2 1010,1212m,1616[m] using Tina
     1481 * 0x00, 0x00-0x1f: Silence
     1482 * 0x01, 0x00-0x1f: 32 EDI channels from Micro Dock
     1483 *       0x00: Dock Mic A
     1484 *       0x04: Dock Mic B
     1485 *       0x08: Dock ADC 1 Left
     1486 *       0x0c: Dock ADC 1 Right
     1487 *       0x10: Dock ADC 2 Left
     1488 *       0x12: Dock S/PDIF Left
     1489 *       0x14: Dock ADC 2 Right
     1490 *       0x16: Dock S/PDIF Right
     1491 *       0x18-0x1f: Dock ADAT 0-7
     1492 * 0x02, 0x00: Hamoa ADC Left
     1493 * 0x02, 0x01: Hamoa ADC Right
    13521494 * 0x03, 0x00-0x0f: 16 inputs from Tina Emu32A output
    13531495 * 0x03, 0x10-0x1f: 16 inputs from Tina Emu32B output
     
    13581500 *
    13591501 * HanaLite, rev1 0404 using Alice2
    1360  * Sources SRATEX = 1X rates: 44.1 kHz or 48 kHz
    1361  * 0x00,0x00-0x1f: Silence
     1502 * HanaLiteLite, rev2 0404 using Tina
     1503 * 0x00, 0x00-0x1f: Silence
    13621504 * 0x01: Not used
    13631505 * 0x02, 0x00: ADC Left
    13641506 * 0x02, 0x01: ADC Right
    1365  * 0x03, 0x00-0x0f: 16 inputs from Alice2 Emu32A output
    1366  * 0x03, 0x10-0x1f: 16 inputs from Alice2 Emu32B output
    1367  * 0x04: Not used
    1368  * 0x05, 0x00: S/PDIF Left
    1369  * 0x05, 0x01: S/PDIF Right
    1370  * 0x06-0x07: Not used
    1371  *
    1372  * HanaLiteLite, rev2 0404 using Alice2
    1373  * Sources SRATEX = 1X rates: 44.1 kHz or 48 kHz
    1374  * 0x00,0x00-0x1f: Silence
    1375  * 0x01: Not used
    1376  * 0x02, 0x00: ADC Left
    1377  * 0x02, 0x01: ADC Right
    1378  * 0x03, 0x00-0x0f: 16 inputs from Alice2 Emu32A output
    1379  * 0x03, 0x10-0x1f: 16 inputs from Alice2 Emu32B output
     1507 * 0x03, 0x00-0x0f: 16 inputs from Alice2/Tina Emu32A output
     1508 * 0x03, 0x10-0x1f: 16 inputs from Alice2/Tina Emu32B output
    13801509 * 0x04: Not used
    13811510 * 0x05, 0x00: S/PDIF Left
     
    13841513 *
    13851514 * Mana, Cardbus 1616 using Tina2
    1386  * Sources SRATEX = 1X rates: 44.1 kHz or 48 kHz
    1387  * 0x00,0x00-0x1f: Silence
    1388  * 0x01, 0x10-0x1f: 32 Elink channels from Audio Dock
    1389  * 0x01, 0x00: Dock Mic A
    1390  * 0x01, 0x04: Dock Mic B
    1391  * 0x01, 0x08: Dock ADC 1 Left
    1392  * 0x01, 0x0c: Dock ADC 1 Right
    1393  * 0x01, 0x10: Dock ADC 2 Left
    1394  * 0x01, 0x12: Dock S/PDIF Left
    1395  * 0x01, 0x14: Dock ADC 2 Right
    1396  * 0x01, 0x16: Dock S/PDIF Right
    1397  * 0x01, 0x18-0x1f: Dock ADAT 0-7
    1398  * 0x01, 0x18: Dock ADC 3 Left
    1399  * 0x01, 0x1c: Dock ADC 3 Right
     1515 * 0x00, 0x00-0x1f: Silence
     1516 * 0x01, 0x00-0x1f: 32 EDI channels from Micro Dock
     1517 *       (same as rev2 1010)
    14001518 * 0x02: Not used
    1401  * 0x03, 0x00-0x0f: 16 inputs from Tina Emu32A output
    1402  * 0x03, 0x10-0x1f: 16 inputs from Tina Emu32B output
     1519 * 0x03, 0x00-0x0f: 16 inputs from Tina2 Emu32A output
     1520 * 0x03, 0x10-0x1f: 16 inputs from Tina2 Emu32B output
    14031521 * 0x04-0x07: Not used
    1404  *
    14051522 */
    14061523
    14071524/* 32-bit sources of signal in the Hana FPGA. The sources are routed to
    1408  * destinations using mixer control for each destination - see emumixer.c
    1409  * Sources are either physical inputs of FPGA,
    1410  * or outputs from Alice (audigy) - 16 x EMU_SRC_ALICE_EMU32A +
    1411  * 16 x EMU_SRC_ALICE_EMU32B
     1525 * destinations using a mixer control for each destination - see emumixer.c.
     1526 * Sources are either physical inputs of Hana, or inputs from Alice2/Tina -
     1527 * 16 x EMU_SRC_ALICE_EMU32A + 16 x EMU_SRC_ALICE_EMU32B.
    14121528 */
    14131529#define EMU_SRC_SILENCE         0x0000  /* Silence */
     
    14541570#define EMU_SRC_ALICE_EMU32A            0x0300  /* Alice2 EMU32a 16 outputs. +0 to +0xf */
    14551571#define EMU_SRC_ALICE_EMU32B            0x0310  /* Alice2 EMU32b 16 outputs. +0 to +0xf */
     1572// In S/MUX mode, the samples of one channel are adjacent.
    14561573#define EMU_SRC_HANA_ADAT       0x0400  /* Hana ADAT 8 channel in +0 to +7 */
    14571574#define EMU_SRC_HANA_SPDIF_LEFT1        0x0500  /* Hana SPDIF Left, 1st or 48kHz only */
    14581575#define EMU_SRC_HANA_SPDIF_LEFT2        0x0502  /* Hana SPDIF Left, 2nd or 96kHz */
     1576#define EMU_SRC_HANA_SPDIF_LEFT3        0x0504  /* Hana SPDIF Left, 3rd or 192kHz */
     1577#define EMU_SRC_HANA_SPDIF_LEFT4        0x0506  /* Hana SPDIF Left, 4th or 192kHz */
    14591578#define EMU_SRC_HANA_SPDIF_RIGHT1       0x0501  /* Hana SPDIF Right, 1st or 48kHz only */
    14601579#define EMU_SRC_HANA_SPDIF_RIGHT2       0x0503  /* Hana SPDIF Right, 2nd or 96kHz */
     1580#define EMU_SRC_HANA_SPDIF_RIGHT3       0x0505  /* Hana SPDIF Right, 3rd or 192kHz */
     1581#define EMU_SRC_HANA_SPDIF_RIGHT4       0x0507  /* Hana SPDIF Right, 4th or 192kHz */
    14611582
    14621583/* Additional inputs for 1616(M)/Microdock */
    1463 /* Microdock S/PDIF Left, 1st or 48kHz only */
    1464 #define EMU_SRC_MDOCK_SPDIF_LEFT1       0x0112
    1465 /* Microdock S/PDIF Left, 2nd or 96kHz */
    1466 #define EMU_SRC_MDOCK_SPDIF_LEFT2       0x0113
    1467 /* Microdock S/PDIF Right, 1st or 48kHz only */
    1468 #define EMU_SRC_MDOCK_SPDIF_RIGHT1      0x0116
    1469 /* Microdock S/PDIF Right, 2nd or 96kHz */
    1470 #define EMU_SRC_MDOCK_SPDIF_RIGHT2      0x0117
    1471 /* Microdock ADAT 8 channel in +8 to +f */
    1472 #define EMU_SRC_MDOCK_ADAT              0x0118
     1584
     1585#define EMU_SRC_MDOCK_SPDIF_LEFT1       0x0112  /* Microdock S/PDIF Left, 1st or 48kHz only */
     1586#define EMU_SRC_MDOCK_SPDIF_LEFT2       0x0113  /* Microdock S/PDIF Left, 2nd or 96kHz */
     1587#define EMU_SRC_MDOCK_SPDIF_RIGHT1      0x0116  /* Microdock S/PDIF Right, 1st or 48kHz only */
     1588#define EMU_SRC_MDOCK_SPDIF_RIGHT2      0x0117  /* Microdock S/PDIF Right, 2nd or 96kHz */
     1589#define EMU_SRC_MDOCK_ADAT              0x0118  /* Microdock ADAT 8 channel in +8 to +f */
    14731590
    14741591/* 0x600 and 0x700 no used */
    14751592
     1593
     1594/* ------------------- CONSTANTS -------------------- */
     1595
     1596extern const char * const snd_emu10k1_fxbus[32];
     1597extern const char * const snd_emu10k1_sblive_ins[16];
     1598extern const char * const snd_emu10k1_audigy_ins[16];
     1599extern const char * const snd_emu10k1_sblive_outs[32];
     1600extern const char * const snd_emu10k1_audigy_outs[32];
     1601extern const s8 snd_emu10k1_sblive51_fxbus2_map[16];
     1602
    14761603/* ------------------- STRUCTURES -------------------- */
    14771604
    14781605enum {
     1606        EMU10K1_UNUSED,  // This must be zero
    14791607        EMU10K1_EFX,
     1608        EMU10K1_EFX_IRQ,
    14801609        EMU10K1_PCM,
     1610        EMU10K1_PCM_IRQ,
    14811611        EMU10K1_SYNTH,
    1482         EMU10K1_MIDI
     1612        EMU10K1_NUM_TYPES
    14831613};
    14841614
     
    14861616
    14871617struct snd_emu10k1_voice {
    1488         struct snd_emu10k1 *emu;
    1489         int number;
    1490         unsigned int use: 1,
    1491             pcm: 1,
    1492             efx: 1,
    1493             synth: 1,
    1494             midi: 1;
     1618        unsigned char number;
     1619        unsigned char use;
     1620        unsigned char dirty;
     1621        unsigned char last;
    14951622        void (*interrupt)(struct snd_emu10k1 *emu, struct snd_emu10k1_voice *pvoice);
    14961623
     
    15141641        unsigned short running;
    15151642        unsigned short first_ptr;
     1643        snd_pcm_uframes_t resume_pos;
    15161644        struct snd_util_memblk *memblk;
     1645        unsigned int pitch_target;
    15171646        unsigned int start_addr;
    15181647        unsigned int ccca_start_addr;
     
    15321661        unsigned char send_routing[3][8];
    15331662        unsigned char send_volume[3][8];
     1663        // 0x8000 is neutral. The mixer code rescales it to 0xffff to maintain
     1664        // backwards compatibility with user space.
    15341665        unsigned short attn[3];
    15351666        struct snd_emu10k1_pcm *epcm;
     
    15401671
    15411672#define snd_emu10k1_compose_audigy_fxrt1(route) \
    1542 ((unsigned int)route[0] | ((unsigned int)route[1] << 8) | ((unsigned int)route[2] << 16) | ((unsigned int)route[3] << 24))
     1673((unsigned int)route[0] | ((unsigned int)route[1] << 8) | ((unsigned int)route[2] << 16) | ((unsigned int)route[3] << 24) | 0x80808080)
    15431674
    15441675#define snd_emu10k1_compose_audigy_fxrt2(route) \
    1545 ((unsigned int)route[4] | ((unsigned int)route[5] << 8) | ((unsigned int)route[6] << 16) | ((unsigned int)route[7] << 24))
     1676((unsigned int)route[4] | ((unsigned int)route[5] << 8) | ((unsigned int)route[6] << 16) | ((unsigned int)route[7] << 24) | 0x80808080)
     1677
     1678#define snd_emu10k1_compose_audigy_sendamounts(vol) \
     1679(((unsigned int)vol[4] << 24) | ((unsigned int)vol[5] << 16) | ((unsigned int)vol[6] << 8) | (unsigned int)vol[7])
    15461680
    15471681struct snd_emu10k1_memblk {
     
    15631697        unsigned int count;             /* count of GPR (1..16) */
    15641698        unsigned short gpr[32];         /* GPR number(s) */
    1565         unsigned int value[32];
    1566         unsigned int min;               /* minimum range */
    1567         unsigned int max;               /* maximum range */
     1699        int value[32];
     1700        int min;                        /* minimum range */
     1701        int max;                        /* maximum range */
    15681702        unsigned int translation;       /* translation type (EMU10K1_GPR_TRANSLATION*) */
    15691703        struct snd_kcontrol *kcontrol;
     
    16001734
    16011735struct snd_emu10k1_fx8010 {
    1602         unsigned short fxbus_mask;      /* used FX buses (bitmask) */
    1603         unsigned short extin_mask;      /* used external inputs (bitmask) */
    1604         unsigned short extout_mask;     /* used external outputs (bitmask) */
    1605         unsigned short pad1;
     1736        unsigned short extin_mask;      /* used external inputs (bitmask); not used for Audigy */
     1737        unsigned short extout_mask;     /* used external outputs (bitmask); not used for Audigy */
    16061738        unsigned int itram_size;        /* internal TRAM size in samples */
    16071739        struct snd_dma_buffer etram_pages; /* external TRAM pages and size */
     
    16401772};
    16411773
     1774// Chip-o-logy:
     1775// - All SB Live! cards use EMU10K1 chips
     1776// - All SB Audigy cards use CA* chips, termed "emu10k2" by the driver
     1777// - Original Audigy uses CA0100 "Alice"
     1778// - Audigy 2 uses CA0102/CA10200 "Alice2"
     1779//   - Has an interface for CA0151 (P16V) "Alice3"
     1780// - Audigy 2 Value uses CA0108/CA10300 "Tina"
     1781//   - Approximately a CA0102 with an on-chip CA0151 (P17V)
     1782// - Audigy 2 ZS NB uses CA0109 "Tina2"
     1783//   - Cardbus version of CA0108
    16421784struct snd_emu_chip_details {
    16431785        u32 vendor;
     
    16451787        u32 subsystem;
    16461788        unsigned char revision;
    1647         unsigned char emu10k1_chip; /* Original SB Live. Not SB Live 24bit. */
    1648         unsigned char emu10k2_chip; /* Audigy 1 or Audigy 2. */
    1649         unsigned char ca0102_chip;  /* Audigy 1 or Audigy 2. Not SB Audigy 2 Value. */
    1650         unsigned char ca0108_chip;  /* Audigy 2 Value */
    1651         unsigned char ca_cardbus_chip; /* Audigy 2 ZS Notebook */
    1652         unsigned char ca0151_chip;  /* P16V */
    1653         unsigned char spk71;        /* Has 7.1 speakers */
    1654         unsigned char sblive51;     /* SBLive! 5.1 - extout 0x11 -> center, 0x12 -> lfe */
    1655         unsigned char spdif_bug;    /* Has Spdif phasing bug */
    1656         unsigned char ac97_chip;    /* Has an AC97 chip: 1 = mandatory, 2 = optional */
    1657         unsigned char ecard;        /* APS EEPROM */
    1658         unsigned char emu_model;     /* EMU model type */
    1659         unsigned char spi_dac;      /* SPI interface for DAC */
    1660         unsigned char i2c_adc;      /* I2C interface for ADC */
    1661         unsigned char adc_1361t;    /* Use Philips 1361T ADC */
    1662         unsigned char invert_shared_spdif; /* analog/digital switch inverted */
     1789        unsigned char emu_model;        /* EMU model type */
     1790#ifndef TARGET_OS2
     1791        unsigned int emu10k1_chip:1;    /* Original SB Live. Not SB Live 24bit. */
     1792                                        /* Redundant with emu10k2_chip being unset. */
     1793        unsigned int emu10k2_chip:1;    /* Audigy 1 or Audigy 2. */
     1794        unsigned int ca0102_chip:1;     /* Audigy 1 or Audigy 2. Not SB Audigy 2 Value. */
     1795                                        /* Redundant with ca0108_chip being unset. */
     1796        unsigned int ca0108_chip:1;     /* Audigy 2 Value */
     1797        unsigned int ca_cardbus_chip:1; /* Audigy 2 ZS Notebook */
     1798        unsigned int ca0151_chip:1;     /* P16V */
     1799        unsigned int spk20:1;           /* Stereo only */
     1800        unsigned int spk71:1;           /* Has 7.1 speakers */
     1801        unsigned int no_adat:1;         /* Has no ADAT, only SPDIF */
     1802        unsigned int sblive51:1;        /* SBLive! 5.1 - extout 0x11 -> center, 0x12 -> lfe */
     1803        unsigned int spdif_bug:1;       /* Has Spdif phasing bug */
     1804        unsigned int ac97_chip:2;       /* Has an AC97 chip: 1 = mandatory, 2 = optional */
     1805        unsigned int ecard:1;           /* APS EEPROM */
     1806        unsigned int spi_dac:1;         /* SPI interface for DAC; requires ca0108_chip */
     1807        unsigned int i2c_adc:1;         /* I2C interface for ADC; requires ca0108_chip */
     1808        unsigned int adc_1361t:1;       /* Use Philips 1361T ADC */
     1809        unsigned int invert_shared_spdif:1;  /* analog/digital switch inverted */
     1810#else
     1811        unsigned int emu10k1_chip;      /* Original SB Live. Not SB Live 24bit. */
     1812                                        /* Redundant with emu10k2_chip being unset. */
     1813        unsigned int emu10k2_chip;      /* Audigy 1 or Audigy 2. */
     1814        unsigned int ca0102_chip;       /* Audigy 1 or Audigy 2. Not SB Audigy 2 Value. */
     1815                                        /* Redundant with ca0108_chip being unset. */
     1816        unsigned int ca0108_chip;       /* Audigy 2 Value */
     1817        unsigned int ca_cardbus_chip;   /* Audigy 2 ZS Notebook */
     1818        unsigned int ca0151_chip;       /* P16V */
     1819        unsigned int spk20;             /* Stereo only */
     1820        unsigned int spk71;             /* Has 7.1 speakers */
     1821        unsigned int no_adat;           /* Has no ADAT, only SPDIF */
     1822        unsigned int sblive51;          /* SBLive! 5.1 - extout 0x11 -> center, 0x12 -> lfe */
     1823        unsigned int spdif_bug;         /* Has Spdif phasing bug */
     1824        unsigned int ac97_chip;         /* Has an AC97 chip: 1 = mandatory, 2 = optional */
     1825        unsigned int ecard;             /* APS EEPROM */
     1826        unsigned int spi_dac;           /* SPI interface for DAC; requires ca0108_chip */
     1827        unsigned int i2c_adc;           /* I2C interface for ADC; requires ca0108_chip */
     1828        unsigned int adc_1361t;         /* Use Philips 1361T ADC */
     1829        unsigned int invert_shared_spdif;  /* analog/digital switch inverted */
     1830#endif
    16631831        const char *driver;
    16641832        const char *name;
     
    16661834};
    16671835
     1836#define NUM_OUTPUT_DESTS 28
     1837#define NUM_INPUT_DESTS 22
     1838
    16681839struct snd_emu1010 {
    1669         unsigned int output_source[64];
    1670         unsigned int input_source[64];
     1840        unsigned char output_source[NUM_OUTPUT_DESTS];
     1841        unsigned char input_source[NUM_INPUT_DESTS];
    16711842        unsigned int adc_pads; /* bit mask */
    16721843        unsigned int dac_pads; /* bit mask */
    1673         unsigned int internal_clock; /* 44100 or 48000 */
     1844        unsigned int wclock;  /* Cached register value */
     1845        unsigned int word_clock;  /* Cached effective value */
     1846        unsigned int clock_source;
     1847        unsigned int clock_fallback;
    16741848        unsigned int optical_in; /* 0:SPDIF, 1:ADAT */
    16751849        unsigned int optical_out; /* 0:SPDIF, 1:ADAT */
    1676         struct delayed_work firmware_work;
    1677         u32 last_reg;
     1850        struct work_struct work;
    16781851};
    16791852
     
    16921865        unsigned int serial;                    /* serial number */
    16931866        unsigned short model;                   /* subsystem id */
    1694         unsigned int card_type;                 /* EMU10K1_CARD_* */
    16951867        unsigned int ecard_ctrl;                /* ecard control bits */
    16961868        unsigned int address_mode;              /* address mode */
    16971869        unsigned long dma_mask;                 /* PCI DMA mask */
    16981870        bool iommu_workaround;                  /* IOMMU workaround needed */
    1699         unsigned int delay_pcm_irq;             /* in samples */
    17001871        int max_cache_pages;                    /* max memory size / PAGE_SIZE */
    17011872        struct snd_dma_buffer silent_page;      /* silent page */
     
    17331904        int (*get_synth_voice)(struct snd_emu10k1 *emu);
    17341905
    1735         spinlock_t reg_lock;
    1736         spinlock_t emu_lock;
    1737         spinlock_t voice_lock;
     1906        spinlock_t reg_lock;  // high-level driver lock
     1907        spinlock_t emu_lock;  // low-level i/o lock
     1908        spinlock_t voice_lock;  // voice allocator lock
    17381909        spinlock_t spi_lock; /* serialises access to spi port */
    17391910        spinlock_t i2c_lock; /* serialises access to i2c port */
    17401911
    17411912        struct snd_emu10k1_voice voices[NUM_G];
    1742         struct snd_emu10k1_voice p16v_voices[4];
    1743         struct snd_emu10k1_voice p16v_capture_voice;
    17441913        int p16v_device_offset;
    17451914        u32 p16v_capture_source;
     
    17541923        struct snd_kcontrol *ctl_efx_send_volume;
    17551924        struct snd_kcontrol *ctl_efx_attn;
     1925        struct snd_kcontrol *ctl_clock_source;
    17561926
    17571927        void (*hwvol_interrupt)(struct snd_emu10k1 *emu, unsigned int status);
     
    17611931        void (*spdif_interrupt)(struct snd_emu10k1 *emu, unsigned int status);
    17621932        void (*dsp_interrupt)(struct snd_emu10k1 *emu);
     1933        void (*gpio_interrupt)(struct snd_emu10k1 *emu);
     1934        void (*p16v_interrupt)(struct snd_emu10k1 *emu);
    17631935
    17641936        struct snd_pcm_substream *pcm_capture_substream;
    17651937        struct snd_pcm_substream *pcm_capture_mic_substream;
    17661938        struct snd_pcm_substream *pcm_capture_efx_substream;
    1767         struct snd_pcm_substream *pcm_playback_efx_substream;
    17681939
    17691940        struct snd_timer *timer;
     
    18211992unsigned int snd_emu10k1_ptr_read(struct snd_emu10k1 * emu, unsigned int reg, unsigned int chn);
    18221993void snd_emu10k1_ptr_write(struct snd_emu10k1 *emu, unsigned int reg, unsigned int chn, unsigned int data);
     1994void snd_emu10k1_ptr_write_multiple(struct snd_emu10k1 *emu, unsigned int chn, ...);
    18231995unsigned int snd_emu10k1_ptr20_read(struct snd_emu10k1 * emu, unsigned int reg, unsigned int chn);
    18241996void snd_emu10k1_ptr20_write(struct snd_emu10k1 *emu, unsigned int reg, unsigned int chn, unsigned int data);
    18251997int snd_emu10k1_spi_write(struct snd_emu10k1 * emu, unsigned int data);
    18261998int snd_emu10k1_i2c_write(struct snd_emu10k1 *emu, u32 reg, u32 value);
    1827 int snd_emu1010_fpga_write(struct snd_emu10k1 * emu, u32 reg, u32 value);
    1828 int snd_emu1010_fpga_read(struct snd_emu10k1 * emu, u32 reg, u32 *value);
    1829 int snd_emu1010_fpga_link_dst_src_write(struct snd_emu10k1 * emu, u32 dst, u32 src);
     1999void snd_emu1010_fpga_write(struct snd_emu10k1 *emu, u32 reg, u32 value);
     2000void snd_emu1010_fpga_read(struct snd_emu10k1 *emu, u32 reg, u32 *value);
     2001void snd_emu1010_fpga_link_dst_src_write(struct snd_emu10k1 *emu, u32 dst, u32 src);
     2002u32 snd_emu1010_fpga_link_dst_src_read(struct snd_emu10k1 *emu, u32 dst);
     2003int snd_emu1010_get_raw_rate(struct snd_emu10k1 *emu, u8 src);
     2004void snd_emu1010_update_clock(struct snd_emu10k1 *emu);
    18302005unsigned int snd_emu10k1_efx_read(struct snd_emu10k1 *emu, unsigned int pc);
    18312006void snd_emu10k1_intr_enable(struct snd_emu10k1 *emu, unsigned int intrenb);
     
    18372012void snd_emu10k1_voice_half_loop_intr_disable(struct snd_emu10k1 *emu, unsigned int voicenum);
    18382013void snd_emu10k1_voice_half_loop_intr_ack(struct snd_emu10k1 *emu, unsigned int voicenum);
     2014#if 0
    18392015void snd_emu10k1_voice_set_loop_stop(struct snd_emu10k1 *emu, unsigned int voicenum);
    18402016void snd_emu10k1_voice_clear_loop_stop(struct snd_emu10k1 *emu, unsigned int voicenum);
     2017#endif
     2018void snd_emu10k1_voice_set_loop_stop_multiple(struct snd_emu10k1 *emu, u64 voices);
     2019void snd_emu10k1_voice_clear_loop_stop_multiple(struct snd_emu10k1 *emu, u64 voices);
     2020int snd_emu10k1_voice_clear_loop_stop_multiple_atomic(struct snd_emu10k1 *emu, u64 voices);
    18412021void snd_emu10k1_wait(struct snd_emu10k1 *emu, unsigned int wait);
    18422022static inline unsigned int snd_emu10k1_wc(struct snd_emu10k1 *emu) { return (inl(emu->port + WC) >> 6) & 0xfffff; }
    18432023unsigned short snd_emu10k1_ac97_read(struct snd_ac97 *ac97, unsigned short reg);
    18442024void snd_emu10k1_ac97_write(struct snd_ac97 *ac97, unsigned short reg, unsigned short data);
    1845 unsigned int snd_emu10k1_rate_to_pitch(unsigned int rate);
    18462025
    18472026#ifdef CONFIG_PM_SLEEP
     
    18712050
    18722051/* voice allocation */
    1873 int snd_emu10k1_voice_alloc(struct snd_emu10k1 *emu, int type, int pair, struct snd_emu10k1_voice **rvoice);
     2052int snd_emu10k1_voice_alloc(struct snd_emu10k1 *emu, int type, int count, int channels,
     2053                            struct snd_emu10k1_pcm *epcm, struct snd_emu10k1_voice **rvoice);
    18742054int snd_emu10k1_voice_free(struct snd_emu10k1 *emu, struct snd_emu10k1_voice *pvoice);
    18752055
  • GPL/trunk/alsa-kernel/include/sound/emux_synth.h

    r679 r772  
    5555        int (*oss_ioctl)(struct snd_emux *emu, int cmd, int p1, int p2);
    5656#endif
     57        int (*get_pitch_shift)(struct snd_emux *emu);
    5758};
    5859
     
    8384        int mem_size;           /* memory size (in byte) */
    8485        int num_ports;          /* number of ports to be created */
    85         int pitch_shift;        /* pitch shift value (for Emu10k1) */
    8686        struct snd_emux_operators ops;  /* operators */
    8787        void *hw;               /* hardware */
  • GPL/trunk/alsa-kernel/include/sound/hda_codec.h

    r717 r772  
    1919#include <sound/hda_regmap.h>
    2020
    21 #define IS_BXT(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0x5a98)
    22 #define IS_CFL(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0xa348)
    23 
    2421/*
    2522 * Structures
     
    6057        unsigned int bus_probing :1;    /* during probing process */
    6158        unsigned int keep_power:1;      /* keep power up for notification */
     59        unsigned int jackpoll_in_suspend:1; /* keep jack polling during
     60                                             * runtime suspend
     61                                             */
    6262
    6363        int primary_dig_out_type;       /* primary digital out PCM type */
     
    229229        unsigned int configured:1; /* codec was configured */
    230230        unsigned int in_freeing:1; /* being released */
    231         unsigned int registered:1; /* codec was registered */
    232231        unsigned int display_power_control:1; /* needs display power */
    233232        unsigned int spdif_status_reset :1; /* needs to toggle SPDIF for each
     
    257256        unsigned int relaxed_resume:1;  /* don't resume forcibly for jack */
    258257        unsigned int forced_resume:1; /* forced resume for jack */
    259         unsigned int mst_no_extra_pcms:1; /* no backup PCMs for DP-MST */
     258        unsigned int no_stream_clean_at_suspend:1; /* do not clean streams at suspend */
     259        unsigned int ctl_dev_id:1; /* old control element id build behaviour */
    260260
    261261#ifdef CONFIG_PM
     
    292292#define hda_codec_dev(_dev)     (&(_dev)->core.dev)
    293293
    294 #define hdac_to_hda_priv(_hdac) \
    295                         container_of(_hdac, struct hdac_hda_priv, codec.core)
    296294#define hdac_to_hda_codec(_hdac) container_of(_hdac, struct hda_codec, core)
    297295
     
    307305 * constructors
    308306 */
     307#ifndef TARGET_OS2
     308__printf(3, 4)
     309#endif
     310struct hda_codec *
     311snd_hda_codec_device_init(struct hda_bus *bus, unsigned int codec_addr,
     312                          const char *fmt, ...);
    309313int snd_hda_codec_new(struct hda_bus *bus, struct snd_card *card,
    310314                      unsigned int codec_addr, struct hda_codec **codecp);
    311315int snd_hda_codec_device_new(struct hda_bus *bus, struct snd_card *card,
    312                       unsigned int codec_addr, struct hda_codec *codec);
     316                      unsigned int codec_addr, struct hda_codec *codec,
     317                      bool snddev_managed);
    313318int snd_hda_codec_configure(struct hda_codec *codec);
    314319int snd_hda_codec_update_widgets(struct hda_codec *codec);
     320void snd_hda_codec_register(struct hda_codec *codec);
     321void snd_hda_codec_unregister(struct hda_codec *codec);
     322void snd_hda_codec_cleanup_for_unbind(struct hda_codec *codec);
    315323
    316324/*
     
    493501#define snd_hda_power_down_pm(codec)    snd_hdac_power_down_pm(&(codec)->core)
    494502#ifdef CONFIG_PM
     503void snd_hda_codec_set_power_save(struct hda_codec *codec, int delay);
    495504void snd_hda_set_power_save(struct hda_bus *bus, int delay);
    496505void snd_hda_update_power_acct(struct hda_codec *codec);
    497506#else
     507static inline void snd_hda_codec_set_power_save(struct hda_codec *codec, int delay) {}
    498508static inline void snd_hda_set_power_save(struct hda_bus *bus, int delay) {}
    499509#endif
  • GPL/trunk/alsa-kernel/include/sound/hda_register.h

    r695 r772  
    259259#define AZX_ML_INTERVAL                 0x40
    260260
     261/* HDaudio registers valid for HDaudio and HDaudio extended links */
    261262#define AZX_REG_ML_LCAP                 0x00
     263
     264#define AZX_ML_HDA_LCAP_ALT             BIT(28)
     265#define AZX_ML_HDA_LCAP_ALT_HDA         0x0
     266#define AZX_ML_HDA_LCAP_ALT_HDA_EXT     0x1
     267
     268#define AZX_ML_HDA_LCAP_INTC            BIT(27)         /* only used if ALT == 1 */
     269#define AZX_ML_HDA_LCAP_OFLS            BIT(26)         /* only used if ALT == 1 */
     270#define AZX_ML_HDA_LCAP_LSS             BIT(23)         /* only used if ALT == 1 */
     271#define AZX_ML_HDA_LCAP_SLCOUNT         GENMASK(22, 20) /* only used if ALT == 1 */
     272
    262273#define AZX_REG_ML_LCTL                 0x04
     274#define AZX_ML_LCTL_INTSTS              BIT(31)         /* only used if ALT == 1 */
     275#define AZX_ML_LCTL_CPA                 BIT(23)
     276#define AZX_ML_LCTL_CPA_SHIFT           23
     277#define AZX_ML_LCTL_SPA                 BIT(16)
     278#define AZX_ML_LCTL_SPA_SHIFT           16
     279#define AZX_ML_LCTL_INTEN               BIT(5)          /* only used if ALT == 1 */
     280#define AZX_ML_LCTL_OFLEN               BIT(4)          /* only used if ALT == 1 */
     281#define AZX_ML_LCTL_SCF                 GENMASK(3, 0)   /* only used if ALT == 0 */
     282
    263283#define AZX_REG_ML_LOSIDV               0x08
     284
     285/* bit0 is reserved, with BIT(1) mapping to stream1 */
     286#define AZX_ML_LOSIDV_STREAM_MASK       0xFFFE
     287
    264288#define AZX_REG_ML_LSDIID               0x0C
     289#define AZX_REG_ML_LSDIID_OFFSET(x)     (0x0C + (x) * 0x02)     /* only used if ALT == 1 */
     290
     291/* HDaudio registers only valid if LCAP.ALT == 0 */
    265292#define AZX_REG_ML_LPSOO                0x10
    266293#define AZX_REG_ML_LPSIO                0x12
     
    269296#define AZX_REG_ML_LINPAY               0x30
    270297
    271 /* bit0 is reserved, with BIT(1) mapping to stream1 */
    272 #define ML_LOSIDV_STREAM_MASK           0xFFFE
    273 
    274 #define ML_LCTL_SCF_MASK                        0xF
    275 #define AZX_MLCTL_SPA                           (0x1 << 16)
    276 #define AZX_MLCTL_CPA                           (0x1 << 23)
    277 #define AZX_MLCTL_SPA_SHIFT                     16
    278 #define AZX_MLCTL_CPA_SHIFT                     23
     298/* HDaudio Extended link registers only valid if LCAP.ALT == 1 */
     299#define AZX_REG_ML_LSYNC                0x1C
     300
     301#define AZX_REG_ML_LSYNC_CMDSYNC        BIT(24)
     302#define AZX_REG_ML_LSYNC_CMDSYNC_SHIFT  24
     303#define AZX_REG_ML_LSYNC_SYNCGO         BIT(23)
     304#define AZX_REG_ML_LSYNC_SYNCPU         BIT(20)
     305#define AZX_REG_ML_LSYNC_SYNCPRD        GENMASK(19, 0)
     306
     307#define AZX_REG_ML_LEPTR                0x20
     308
     309#define AZX_REG_ML_LEPTR_ID             GENMASK(31, 24)
     310#define AZX_REG_ML_LEPTR_ID_SHIFT       24
     311#define AZX_REG_ML_LEPTR_ID_SDW         0x00
     312#define AZX_REG_ML_LEPTR_ID_INTEL_SSP   0xC0
     313#define AZX_REG_ML_LEPTR_ID_INTEL_DMIC  0xC1
     314#define AZX_REG_ML_LEPTR_ID_INTEL_UAOL  0xC2
     315#define AZX_REG_ML_LEPTR_VER            GENMASK(23, 20)
     316#define AZX_REG_ML_LEPTR_PTR            GENMASK(19, 0)
    279317
    280318/* registers for DMA Resume Capability Structure */
  • GPL/trunk/alsa-kernel/include/sound/hda_verbs.h

    r679 r772  
    462462#define AC_DE_IA                        (1<<2)
    463463
    464 /* device device types (0x0-0xf) */
     464/* device types (0x0-0xf) */
    465465enum {
    466466        AC_JACK_LINE_OUT,
  • GPL/trunk/alsa-kernel/include/sound/hdaudio.h

    r695 r772  
    1010#include <linux/interrupt.h>
    1111#include <linux/io.h>
     12#include <linux/io-64-nonatomic-lo-hi.h>
     13#include <linux/iopoll.h>
     14#include <linux/pci.h>
    1215#include <linux/pm_runtime.h>
    1316#include <linux/timecounter.h>
     
    9396        bool caps_overwriting:1; /* caps overwrite being in process */
    9497        bool cache_coef:1;      /* cache COEF read/write too */
     98        unsigned int registered:1; /* codec was registered */
    9599};
    96100
     
    121125void snd_hdac_device_unregister(struct hdac_device *codec);
    122126int snd_hdac_device_set_chip_name(struct hdac_device *codec, const char *name);
    123 int snd_hdac_codec_modalias(struct hdac_device *hdac, char *buf, size_t size);
     127int snd_hdac_codec_modalias(const struct hdac_device *hdac, char *buf, size_t size);
    124128
    125129int snd_hdac_refresh_widgets(struct hdac_device *codec);
     
    356360        bool polling_mode:1;
    357361        bool needs_damn_long_delay:1;
     362        bool not_use_interrupts:1;      /* prohibiting the RIRB IRQ */
     363        bool access_sdnctl_in_dword:1;  /* accessing the sdnctl register by dword */
    358364
    359365        int poll_count;
     
    460466#define snd_hdac_reg_writel(bus, addr, val)     writel(val, addr)
    461467#define snd_hdac_reg_readl(bus, addr)   readl(addr)
     468#define snd_hdac_reg_writeq(bus, addr, val)     writeq(val, addr)
     469#define snd_hdac_reg_readq(bus, addr)           readq(addr)
    462470
    463471/*
     
    502510                             (snd_hdac_chip_readb(chip, reg) & ~(mask)) | (val))
    503511
     512/* update register macro */
     513#define snd_hdac_updatel(addr, reg, mask, val)          \
     514        writel(((readl(addr + reg) & ~(mask)) | (val)), addr + reg)
     515
     516#define snd_hdac_updatew(addr, reg, mask, val)          \
     517        writew(((readw(addr + reg) & ~(mask)) | (val)), addr + reg)
     518
    504519/*
    505520 * HD-audio stream
     
    521536
    522537        void __iomem *sd_addr;  /* stream descriptor pointer */
     538
     539        void __iomem *spib_addr; /* software position in buffers stream pointer */
     540        void __iomem *fifo_addr; /* software position Max fifos stream pointer */
     541
     542        void __iomem *dpibr_addr; /* DMA position in buffer resume pointer */
     543        u32 dpib;               /* DMA position in buffer */
     544        u32 lpib;               /* Linear position in buffer */
    523545
    524546        u32 sd_int_sta_mask;    /* stream int status mask */
     
    561583struct hdac_stream *snd_hdac_stream_assign(struct hdac_bus *bus,
    562584                                           struct snd_pcm_substream *substream);
     585void snd_hdac_stream_release_locked(struct hdac_stream *azx_dev);
    563586void snd_hdac_stream_release(struct hdac_stream *azx_dev);
    564587struct hdac_stream *snd_hdac_get_stream(struct hdac_bus *bus,
     
    570593int snd_hdac_stream_set_params(struct hdac_stream *azx_dev,
    571594                                unsigned int format_val);
    572 void snd_hdac_stream_start(struct hdac_stream *azx_dev, bool fresh_start);
    573 void snd_hdac_stream_clear(struct hdac_stream *azx_dev);
     595void snd_hdac_stream_start(struct hdac_stream *azx_dev);
    574596void snd_hdac_stream_stop(struct hdac_stream *azx_dev);
     597void snd_hdac_stop_streams(struct hdac_bus *bus);
     598void snd_hdac_stop_streams_and_chip(struct hdac_bus *bus);
    575599void snd_hdac_stream_reset(struct hdac_stream *azx_dev);
    576600void snd_hdac_stream_sync_trigger(struct hdac_stream *azx_dev, bool set,
     
    582606int snd_hdac_get_stream_stripe_ctl(struct hdac_bus *bus,
    583607                                struct snd_pcm_substream *substream);
     608
     609void snd_hdac_stream_spbcap_enable(struct hdac_bus *chip,
     610                                   bool enable, int index);
     611int snd_hdac_stream_set_spib(struct hdac_bus *bus,
     612                             struct hdac_stream *azx_dev, u32 value);
     613int snd_hdac_stream_get_spbmaxfifo(struct hdac_bus *bus,
     614                                   struct hdac_stream *azx_dev);
     615void snd_hdac_stream_drsm_enable(struct hdac_bus *bus,
     616                                 bool enable, int index);
     617int snd_hdac_stream_wait_drsm(struct hdac_stream *azx_dev);
     618int snd_hdac_stream_set_dpibr(struct hdac_bus *bus,
     619                              struct hdac_stream *azx_dev, u32 value);
     620int snd_hdac_stream_set_lpib(struct hdac_stream *azx_dev, u32 value);
    584621
    585622/*
     
    599636#define snd_hdac_stream_readb(dev, reg) \
    600637        snd_hdac_reg_readb((dev)->bus, (dev)->sd_addr + AZX_REG_ ## reg)
     638#define snd_hdac_stream_readb_poll(dev, reg, val, cond, delay_us, timeout_us) \
     639        read_poll_timeout_atomic(snd_hdac_reg_readb, val, cond, delay_us, timeout_us, \
     640                                 false, (dev)->bus, (dev)->sd_addr + AZX_REG_ ## reg)
     641#define snd_hdac_stream_readl_poll(dev, reg, val, cond, delay_us, timeout_us) \
     642        read_poll_timeout_atomic(snd_hdac_reg_readl, val, cond, delay_us, timeout_us, \
     643                                 false, (dev)->bus, (dev)->sd_addr + AZX_REG_ ## reg)
    601644
    602645/* update a register, pass without AZX_REG_ prefix */
     
    677720             (ptr) = snd_array_elem(array, ++(idx)))
    678721
     722/*
     723 * Device matching
     724 */
     725
     726#ifndef TARGET_OS2
     727#define HDA_CONTROLLER_IS_HSW(pci) (pci_match_id((struct pci_device_id []){ \
     728                        { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_HDA_HSW_0) }, \
     729                        { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_HDA_HSW_2) }, \
     730                        { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_HDA_HSW_3) }, \
     731                        { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_HDA_BDW) }, \
     732                        { } \
     733                }, pci))
     734
     735#define HDA_CONTROLLER_IS_APL(pci) (pci_match_id((struct pci_device_id []){ \
     736                        { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_HDA_APL) }, \
     737                        { } \
     738                }, pci))
     739
     740#define HDA_CONTROLLER_IN_GPU(pci) (pci_match_id((struct pci_device_id []){ \
     741                        { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_HDA_DG1) }, \
     742                        { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_HDA_DG2_0) }, \
     743                        { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_HDA_DG2_1) }, \
     744                        { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_HDA_DG2_2) }, \
     745                        { } \
     746                }, pci) || HDA_CONTROLLER_IS_HSW(pci))
     747#else
     748#define HDA_CONTROLLER_IS_HSW(pci) 0
     749#define HDA_CONTROLLER_IS_APL(pci) 0
     750#define HDA_CONTROLLER_IN_GPU(pci) 0
     751#endif
    679752#endif /* __SOUND_HDAUDIO_H */
  • GPL/trunk/alsa-kernel/include/sound/hdaudio_ext.h

    r717 r772  
    33#define __SOUND_HDAUDIO_EXT_H
    44
     5#include <linux/io-64-nonatomic-lo-hi.h>
     6#include <linux/iopoll.h>
    57#include <sound/hdaudio.h>
    68
     
    1012
    1113void snd_hdac_ext_bus_exit(struct hdac_bus *bus);
    12 int snd_hdac_ext_bus_device_init(struct hdac_bus *bus, int addr,
    13                                 struct hdac_device *hdev, int type);
    14 void snd_hdac_ext_bus_device_exit(struct hdac_device *hdev);
    1514void snd_hdac_ext_bus_device_remove(struct hdac_bus *bus);
    1615
     
    2524void snd_hdac_ext_bus_ppcap_int_enable(struct hdac_bus *chip, bool enable);
    2625
    27 void snd_hdac_ext_stream_spbcap_enable(struct hdac_bus *chip,
    28                                  bool enable, int index);
    29 
    3026int snd_hdac_ext_bus_get_ml_capabilities(struct hdac_bus *bus);
    31 struct hdac_ext_link *snd_hdac_ext_bus_get_link(struct hdac_bus *bus,
    32                                                 const char *codec_name);
     27struct hdac_ext_link *snd_hdac_ext_bus_get_hlink_by_addr(struct hdac_bus *bus, int addr);
     28struct hdac_ext_link *snd_hdac_ext_bus_get_hlink_by_name(struct hdac_bus *bus,
     29                                                         const char *codec_name);
    3330
    3431enum hdac_ext_stream_type {
     
    4441 * @pphc_addr: processing pipe host stream pointer
    4542 * @pplc_addr: processing pipe link stream pointer
    46  * @spib_addr: software position in buffers stream pointer
    47  * @fifo_addr: software position Max fifos stream pointer
    48  * @dpibr_addr: DMA position in buffer resume pointer
    49  * @dpib: DMA position in buffer
    50  * @lpib: Linear position in buffer
    5143 * @decoupled: stream host and link is decoupled
    5244 * @link_locked: link is locked
     
    6052        void __iomem *pplc_addr;
    6153
    62         void __iomem *spib_addr;
    63         void __iomem *fifo_addr;
     54        u32 pphcllpl;
     55        u32 pphcllpu;
     56        u32 pphcldpl;
     57        u32 pphcldpu;
    6458
    65         void __iomem *dpibr_addr;
    66 
    67         u32 dpib;
    68         u32 lpib;
    6959        bool decoupled:1;
    7060        bool link_locked:1;
     
    7868        container_of(s, struct hdac_ext_stream, hstream)
    7969
    80 void snd_hdac_ext_stream_init(struct hdac_bus *bus,
    81                                 struct hdac_ext_stream *stream, int idx,
    82                                 int direction, int tag);
    8370int snd_hdac_ext_stream_init_all(struct hdac_bus *bus, int start_idx,
    84                 int num_stream, int dir);
    85 void snd_hdac_stream_free_all(struct hdac_bus *bus);
    86 void snd_hdac_link_free_all(struct hdac_bus *bus);
     71                                 int num_stream, int dir);
     72void snd_hdac_ext_stream_free_all(struct hdac_bus *bus);
     73void snd_hdac_ext_link_free_all(struct hdac_bus *bus);
    8774struct hdac_ext_stream *snd_hdac_ext_stream_assign(struct hdac_bus *bus,
    8875                                           struct snd_pcm_substream *substream,
    8976                                           int type);
    90 void snd_hdac_ext_stream_release(struct hdac_ext_stream *azx_dev, int type);
     77void snd_hdac_ext_stream_release(struct hdac_ext_stream *hext_stream, int type);
     78struct hdac_ext_stream *snd_hdac_ext_cstream_assign(struct hdac_bus *bus,
     79                                                    struct snd_compr_stream *cstream);
    9180void snd_hdac_ext_stream_decouple_locked(struct hdac_bus *bus,
    92                                   struct hdac_ext_stream *azx_dev, bool decouple);
     81                                         struct hdac_ext_stream *hext_stream, bool decouple);
    9382void snd_hdac_ext_stream_decouple(struct hdac_bus *bus,
    9483                                struct hdac_ext_stream *azx_dev, bool decouple);
    95 void snd_hdac_ext_stop_streams(struct hdac_bus *bus);
    9684
    97 int snd_hdac_ext_stream_set_spib(struct hdac_bus *bus,
    98                                  struct hdac_ext_stream *stream, u32 value);
    99 int snd_hdac_ext_stream_get_spbmaxfifo(struct hdac_bus *bus,
    100                                  struct hdac_ext_stream *stream);
    101 void snd_hdac_ext_stream_drsm_enable(struct hdac_bus *bus,
    102                                 bool enable, int index);
    103 int snd_hdac_ext_stream_set_dpibr(struct hdac_bus *bus,
    104                                 struct hdac_ext_stream *stream, u32 value);
    105 int snd_hdac_ext_stream_set_lpib(struct hdac_ext_stream *stream, u32 value);
    106 
    107 void snd_hdac_ext_link_stream_start(struct hdac_ext_stream *hstream);
    108 void snd_hdac_ext_link_stream_clear(struct hdac_ext_stream *hstream);
    109 void snd_hdac_ext_link_stream_reset(struct hdac_ext_stream *hstream);
    110 int snd_hdac_ext_link_stream_setup(struct hdac_ext_stream *stream, int fmt);
     85void snd_hdac_ext_stream_start(struct hdac_ext_stream *hext_stream);
     86void snd_hdac_ext_stream_clear(struct hdac_ext_stream *hext_stream);
     87void snd_hdac_ext_stream_reset(struct hdac_ext_stream *hext_stream);
     88int snd_hdac_ext_stream_setup(struct hdac_ext_stream *hext_stream, int fmt);
    11189
    11290struct hdac_ext_link {
     
    122100};
    123101
    124 int snd_hdac_ext_bus_link_power_up(struct hdac_ext_link *link);
    125 int snd_hdac_ext_bus_link_power_down(struct hdac_ext_link *link);
     102int snd_hdac_ext_bus_link_power_up(struct hdac_ext_link *hlink);
     103int snd_hdac_ext_bus_link_power_down(struct hdac_ext_link *hlink);
    126104int snd_hdac_ext_bus_link_power_up_all(struct hdac_bus *bus);
    127105int snd_hdac_ext_bus_link_power_down_all(struct hdac_bus *bus);
    128 void snd_hdac_ext_link_set_stream_id(struct hdac_ext_link *link,
    129                                 int stream);
    130 void snd_hdac_ext_link_clear_stream_id(struct hdac_ext_link *link,
    131                                 int stream);
     106void snd_hdac_ext_bus_link_set_stream_id(struct hdac_ext_link *hlink,
     107                                        int stream);
     108void snd_hdac_ext_bus_link_clear_stream_id(struct hdac_ext_link *hlink,
     109                                          int stream);
    132110
    133 int snd_hdac_ext_bus_link_get(struct hdac_bus *bus, struct hdac_ext_link *link);
    134 int snd_hdac_ext_bus_link_put(struct hdac_bus *bus, struct hdac_ext_link *link);
     111int snd_hdac_ext_bus_link_get(struct hdac_bus *bus, struct hdac_ext_link *hlink);
     112int snd_hdac_ext_bus_link_put(struct hdac_bus *bus, struct hdac_ext_link *hlink);
    135113
    136114void snd_hdac_ext_bus_link_power(struct hdac_device *codec, bool enable);
    137115
    138 /* update register macro */
    139 #define snd_hdac_updatel(addr, reg, mask, val)          \
    140         writel(((readl(addr + reg) & ~(mask)) | (val)), \
    141                 addr + reg)
     116#define snd_hdac_adsp_writeb(chip, reg, value) \
     117        snd_hdac_reg_writeb(chip, (chip)->dsp_ba + (reg), value)
     118#define snd_hdac_adsp_readb(chip, reg) \
     119        snd_hdac_reg_readb(chip, (chip)->dsp_ba + (reg))
     120#define snd_hdac_adsp_writew(chip, reg, value) \
     121        snd_hdac_reg_writew(chip, (chip)->dsp_ba + (reg), value)
     122#define snd_hdac_adsp_readw(chip, reg) \
     123        snd_hdac_reg_readw(chip, (chip)->dsp_ba + (reg))
     124#define snd_hdac_adsp_writel(chip, reg, value) \
     125        snd_hdac_reg_writel(chip, (chip)->dsp_ba + (reg), value)
     126#define snd_hdac_adsp_readl(chip, reg) \
     127        snd_hdac_reg_readl(chip, (chip)->dsp_ba + (reg))
     128#define snd_hdac_adsp_writeq(chip, reg, value) \
     129        snd_hdac_reg_writeq(chip, (chip)->dsp_ba + (reg), value)
     130#define snd_hdac_adsp_readq(chip, reg) \
     131        snd_hdac_reg_readq(chip, (chip)->dsp_ba + (reg))
    142132
    143 #define snd_hdac_updatew(addr, reg, mask, val)          \
    144         writew(((readw(addr + reg) & ~(mask)) | (val)), \
    145                 addr + reg)
     133#define snd_hdac_adsp_updateb(chip, reg, mask, val) \
     134        snd_hdac_adsp_writeb(chip, reg, \
     135                        (snd_hdac_adsp_readb(chip, reg) & ~(mask)) | (val))
     136#define snd_hdac_adsp_updatew(chip, reg, mask, val) \
     137        snd_hdac_adsp_writew(chip, reg, \
     138                        (snd_hdac_adsp_readw(chip, reg) & ~(mask)) | (val))
     139#define snd_hdac_adsp_updatel(chip, reg, mask, val) \
     140        snd_hdac_adsp_writel(chip, reg, \
     141                        (snd_hdac_adsp_readl(chip, reg) & ~(mask)) | (val))
     142#define snd_hdac_adsp_updateq(chip, reg, mask, val) \
     143        snd_hdac_adsp_writeq(chip, reg, \
     144                        (snd_hdac_adsp_readq(chip, reg) & ~(mask)) | (val))
    146145
     146#define snd_hdac_adsp_readb_poll(chip, reg, val, cond, delay_us, timeout_us) \
     147        readb_poll_timeout((chip)->dsp_ba + (reg), val, cond, \
     148                           delay_us, timeout_us)
     149#define snd_hdac_adsp_readw_poll(chip, reg, val, cond, delay_us, timeout_us) \
     150        readw_poll_timeout((chip)->dsp_ba + (reg), val, cond, \
     151                           delay_us, timeout_us)
     152#define snd_hdac_adsp_readl_poll(chip, reg, val, cond, delay_us, timeout_us) \
     153        readl_poll_timeout((chip)->dsp_ba + (reg), val, cond, \
     154                           delay_us, timeout_us)
     155#define snd_hdac_adsp_readq_poll(chip, reg, val, cond, delay_us, timeout_us) \
     156        readq_poll_timeout((chip)->dsp_ba + (reg), val, cond, \
     157                           delay_us, timeout_us)
    147158
    148159struct hdac_ext_device;
  • GPL/trunk/alsa-kernel/include/sound/hdmi-codec.h

    r703 r772  
    3333        unsigned int bit_clk_inv:1;
    3434        unsigned int frame_clk_inv:1;
    35         unsigned int bit_clk_master:1;
    36         unsigned int frame_clk_master:1;
     35        unsigned int bit_clk_provider:1;
     36        unsigned int frame_clk_provider:1;
    3737        /* bit_fmt could be standard PCM format or
    3838         * IEC958 encoded format. ALSA IEC958 plugin will pass
     
    125125        const struct hdmi_codec_ops *ops;
    126126        uint i2s:1;
     127        uint no_i2s_playback:1;
     128        uint no_i2s_capture:1;
    127129        uint spdif:1;
     130        uint no_spdif_playback:1;
     131        uint no_spdif_capture:1;
    128132        int max_i2s_channels;
    129133        void *data;
  • GPL/trunk/alsa-kernel/include/sound/hwdep.h

    r679 r772  
    5454        void *private_data;
    5555        void (*private_free) (struct snd_hwdep *hwdep);
    56         struct device dev;
     56        struct device *dev;
    5757
    5858        struct mutex open_mutex;
  • GPL/trunk/alsa-kernel/include/sound/info.h

    r679 r772  
    123123                                             struct snd_info_entry *parent);
    124124void snd_info_free_entry(struct snd_info_entry *entry);
    125 int snd_info_store_text(struct snd_info_entry *entry);
    126 int snd_info_restore_text(struct snd_info_entry *entry);
    127125
    128126int snd_info_card_create(struct snd_card *card);
  • GPL/trunk/alsa-kernel/include/sound/intel-dsp-config.h

    r695 r772  
    1616        SND_INTEL_DSP_DRIVER_SST,
    1717        SND_INTEL_DSP_DRIVER_SOF,
    18         SND_INTEL_DSP_DRIVER_LAST = SND_INTEL_DSP_DRIVER_SOF
     18        SND_INTEL_DSP_DRIVER_AVS,
     19        SND_INTEL_DSP_DRIVER_LAST = SND_INTEL_DSP_DRIVER_AVS
    1920};
    2021
  • GPL/trunk/alsa-kernel/include/sound/intel-nhlt.h

    r689 r772  
    1111#include <linux/acpi.h>
    1212
    13 #if IS_ENABLED(CONFIG_ACPI) && IS_ENABLED(CONFIG_SND_INTEL_NHLT)
     13enum nhlt_link_type {
     14        NHLT_LINK_HDA = 0,
     15        NHLT_LINK_DSP = 1,
     16        NHLT_LINK_DMIC = 2,
     17        NHLT_LINK_SSP = 3,
     18        NHLT_LINK_INVALID
     19};
     20
     21enum nhlt_device_type {
     22        NHLT_DEVICE_BT = 0,
     23        NHLT_DEVICE_DMIC = 1,
     24        NHLT_DEVICE_I2S = 4,
     25        NHLT_DEVICE_INVALID
     26};
    1427
    1528struct wav_fmt {
     
    3346        u8 sub_fmt[16];
    3447} __packed;
    35 
    36 enum nhlt_link_type {
    37         NHLT_LINK_HDA = 0,
    38         NHLT_LINK_DSP = 1,
    39         NHLT_LINK_DMIC = 2,
    40         NHLT_LINK_SSP = 3,
    41         NHLT_LINK_INVALID
    42 };
    43 
    44 enum nhlt_device_type {
    45         NHLT_DEVICE_BT = 0,
    46         NHLT_DEVICE_DMIC = 1,
    47         NHLT_DEVICE_I2S = 4,
    48         NHLT_DEVICE_INVALID
    49 };
    5048
    5149struct nhlt_specific_cfg {
     
    127125};
    128126
     127#if IS_ENABLED(CONFIG_ACPI) && IS_ENABLED(CONFIG_SND_INTEL_NHLT)
     128
    129129struct nhlt_acpi_table *intel_nhlt_init(struct device *dev);
    130130
     
    133133int intel_nhlt_get_dmic_geo(struct device *dev, struct nhlt_acpi_table *nhlt);
    134134
     135bool intel_nhlt_has_endpoint_type(struct nhlt_acpi_table *nhlt, u8 link_type);
     136
     137int intel_nhlt_ssp_endpoint_mask(struct nhlt_acpi_table *nhlt, u8 device_type);
     138
     139int intel_nhlt_ssp_mclk_mask(struct nhlt_acpi_table *nhlt, int ssp_num);
     140
     141struct nhlt_specific_cfg *
     142intel_nhlt_get_endpoint_blob(struct device *dev, struct nhlt_acpi_table *nhlt,
     143                             u32 bus_id, u8 link_type, u8 vbps, u8 bps,
     144                             u8 num_ch, u32 rate, u8 dir, u8 dev_type);
     145
    135146#else
    136 
    137 struct nhlt_acpi_table;
    138147
    139148static inline struct nhlt_acpi_table *intel_nhlt_init(struct device *dev)
     
    151160        return 0;
    152161}
     162
     163static inline bool intel_nhlt_has_endpoint_type(struct nhlt_acpi_table *nhlt,
     164                                                u8 link_type)
     165{
     166        return false;
     167}
     168
     169static inline int intel_nhlt_ssp_endpoint_mask(struct nhlt_acpi_table *nhlt, u8 device_type)
     170{
     171        return 0;
     172}
     173
     174static inline int intel_nhlt_ssp_mclk_mask(struct nhlt_acpi_table *nhlt, int ssp_num)
     175{
     176        return 0;
     177}
     178
     179static inline struct nhlt_specific_cfg *
     180intel_nhlt_get_endpoint_blob(struct device *dev, struct nhlt_acpi_table *nhlt,
     181                             u32 bus_id, u8 link_type, u8 vbps, u8 bps,
     182                             u8 num_ch, u32 rate, u8 dir, u8 dev_type)
     183{
     184        return NULL;
     185}
     186
    153187#endif
    154188
  • GPL/trunk/alsa-kernel/include/sound/madera-pdata.h

    r679 r772  
    1010#define MADERA_CODEC_PDATA_H
    1111
    12 #include <linux/kernel.h>
     12#include <linux/types.h>
    1313
    1414#define MADERA_MAX_INPUT                6
  • GPL/trunk/alsa-kernel/include/sound/memalloc.h

    r717 r772  
    1010#define __SOUND_MEMALLOC_H
    1111
     12#include <linux/dma-direction.h>
    1213#include <asm/page.h>
    1314
    1415struct device;
    1516struct vm_area_struct;
     17struct sg_table;
    1618
    1719/*
     
    2022struct snd_dma_device {
    2123        int type;                       /* SNDRV_DMA_TYPE_XXX */
     24        enum dma_data_direction dir;    /* DMA direction */
     25        bool need_sync;                 /* explicit sync needed? */
    2226        struct device *dev;             /* generic device */
    2327};
    24 
    25 #define snd_dma_continuous_data(x)      ((struct device *)(__force unsigned long)(x))
    26 
    2728
    2829/*
     
    3334#define SNDRV_DMA_TYPE_DEV              2       /* generic device continuous */
    3435#define SNDRV_DMA_TYPE_DEV_WC           5       /* continuous write-combined */
    35 #ifdef CONFIG_SND_DMA_SGBUF
    36 #define SNDRV_DMA_TYPE_DEV_SG           3       /* generic device SG-buffer */
    37 #define SNDRV_DMA_TYPE_DEV_WC_SG        6       /* SG write-combined */
    38 #else
    39 #define SNDRV_DMA_TYPE_DEV_SG   SNDRV_DMA_TYPE_DEV /* no SG-buf support */
    40 #define SNDRV_DMA_TYPE_DEV_WC_SG        SNDRV_DMA_TYPE_DEV_WC
    41 #endif
    4236#ifdef CONFIG_GENERIC_ALLOCATOR
    4337#define SNDRV_DMA_TYPE_DEV_IRAM         4       /* generic device iram-buffer */
     
    4640#endif
    4741#define SNDRV_DMA_TYPE_VMALLOC          7       /* vmalloc'ed buffer */
     42#define SNDRV_DMA_TYPE_NONCONTIG        8       /* non-coherent SG buffer */
     43#define SNDRV_DMA_TYPE_NONCOHERENT      9       /* non-coherent buffer */
     44#ifdef CONFIG_SND_DMA_SGBUF
     45#define SNDRV_DMA_TYPE_DEV_SG           SNDRV_DMA_TYPE_NONCONTIG
     46#define SNDRV_DMA_TYPE_DEV_WC_SG        6       /* SG write-combined */
     47#else
     48#define SNDRV_DMA_TYPE_DEV_SG   SNDRV_DMA_TYPE_DEV /* no SG-buf support */
     49#define SNDRV_DMA_TYPE_DEV_WC_SG        SNDRV_DMA_TYPE_DEV_WC
     50#endif
     51/* fallback types, don't use those directly */
     52#ifdef CONFIG_SND_DMA_SGBUF
     53#define SNDRV_DMA_TYPE_DEV_SG_FALLBACK          10
     54#define SNDRV_DMA_TYPE_DEV_WC_SG_FALLBACK       11
     55#endif
    4856
    4957/*
     
    6775
    6876/* allocate/release a buffer */
    69 int snd_dma_alloc_pages(int type, struct device *dev, size_t size,
    70                         struct snd_dma_buffer *dmab);
     77int snd_dma_alloc_dir_pages(int type, struct device *dev,
     78                            enum dma_data_direction dir, size_t size,
     79                            struct snd_dma_buffer *dmab);
     80
     81static inline int snd_dma_alloc_pages(int type, struct device *dev,
     82                                      size_t size, struct snd_dma_buffer *dmab)
     83{
     84        return snd_dma_alloc_dir_pages(type, dev, DMA_BIDIRECTIONAL, size, dmab);
     85}
     86
    7187int snd_dma_alloc_pages_fallback(int type, struct device *dev, size_t size,
    7288                                 struct snd_dma_buffer *dmab);
     
    7490int snd_dma_buffer_mmap(struct snd_dma_buffer *dmab,
    7591                        struct vm_area_struct *area);
     92
     93enum snd_dma_sync_mode { SNDRV_DMA_SYNC_CPU, SNDRV_DMA_SYNC_DEVICE };
     94#ifdef CONFIG_HAS_DMA
     95void snd_dma_buffer_sync(struct snd_dma_buffer *dmab,
     96                         enum snd_dma_sync_mode mode);
     97#else
     98static inline void snd_dma_buffer_sync(struct snd_dma_buffer *dmab,
     99                                       enum snd_dma_sync_mode mode) {}
     100#endif
    76101
    77102dma_addr_t snd_sgbuf_get_addr(struct snd_dma_buffer *dmab, size_t offset);
     
    81106
    82107/* device-managed memory allocator */
    83 struct snd_dma_buffer *snd_devm_alloc_pages(struct device *dev, int type,
    84                                             size_t size);
     108struct snd_dma_buffer *snd_devm_alloc_dir_pages(struct device *dev, int type,
     109                                                enum dma_data_direction dir,
     110                                                size_t size);
     111
     112static inline struct snd_dma_buffer *
     113snd_devm_alloc_pages(struct device *dev, int type, size_t size)
     114{
     115        return snd_devm_alloc_dir_pages(dev, type, DMA_BIDIRECTIONAL, size);
     116}
     117
     118static inline struct sg_table *
     119snd_dma_noncontig_sg_table(struct snd_dma_buffer *dmab)
     120{
     121        return dmab->private_data;
     122}
     123
    85124#ifdef TARGET_OS2
    86125int snd_free_sgbuf_pages(struct snd_dma_buffer *dmab);
  • GPL/trunk/alsa-kernel/include/sound/pcm-indirect.h

    r679 r772  
    4545                        diff += runtime->boundary;
    4646                if (diff < 0)
    47                         return -EINVAL;
     47                        return -EPIPE;
    4848                rec->sw_ready += (int)frames_to_bytes(runtime, diff);
    4949                rec->appl_ptr = appl_ptr;
     
    8484{
    8585        int bytes = ptr - rec->hw_io;
     86        int err;
     87
    8688        if (bytes < 0)
    8789                bytes += rec->hw_buffer_size;
     
    9193        if (rec->sw_io >= rec->sw_buffer_size)
    9294                rec->sw_io -= rec->sw_buffer_size;
    93         if (substream->ops->ack)
    94                 substream->ops->ack(substream);
     95        if (substream->ops->ack) {
     96                err = substream->ops->ack(substream);
     97                if (err == -EPIPE)
     98                        return SNDRV_PCM_POS_XRUN;
     99        }
    95100        return bytes_to_frames(substream->runtime, rec->sw_io);
    96101}
     
    113118                        diff += runtime->boundary;
    114119                if (diff < 0)
    115                         return -EINVAL;
     120                        return -EPIPE;
    116121                rec->sw_ready -= frames_to_bytes(runtime, diff);
    117122                rec->appl_ptr = appl_ptr;
     
    153158        int qsize;
    154159        int bytes = ptr - rec->hw_io;
     160        int err;
     161
    155162        if (bytes < 0)
    156163                bytes += rec->hw_buffer_size;
     
    163170        if (rec->sw_io >= rec->sw_buffer_size)
    164171                rec->sw_io -= rec->sw_buffer_size;
    165         if (substream->ops->ack)
    166                 substream->ops->ack(substream);
     172        if (substream->ops->ack) {
     173                err = substream->ops->ack(substream);
     174                if (err == -EPIPE)
     175                        return SNDRV_PCM_POS_XRUN;
     176        }
    167177        return bytes_to_frames(substream->runtime, rec->sw_io);
    168178}
  • GPL/trunk/alsa-kernel/include/sound/pcm.h

    r717 r772  
    1717#include <linux/pm_qos.h>
    1818#include <linux/refcount.h>
     19#include <linux/uio.h>
    1920
    2021#define snd_pcm_substream_chip(substream) ((substream)->private_data)
     
    4748struct snd_pcm_status64;
    4849struct snd_pcm_substream;
    49 
    5050struct snd_pcm_audio_tstamp_config; /* definitions further down */
    5151struct snd_pcm_audio_tstamp_report;
     
    6969        int (*fill_silence)(struct snd_pcm_substream *substream, int channel,
    7070                            unsigned long pos, unsigned long bytes);
    71         int (*copy_user)(struct snd_pcm_substream *substream, int channel,
    72                          unsigned long pos, void __user *buf,
    73                          unsigned long bytes);
    74         int (*copy_kernel)(struct snd_pcm_substream *substream, int channel,
    75                            unsigned long pos, void *buf, unsigned long bytes);
     71#ifndef TARGET_OS2
     72        int (*copy)(struct snd_pcm_substream *substream, int channel,
     73                    unsigned long pos, struct iov_iter *iter, unsigned long bytes);
     74#else
     75        int (*copy)(struct snd_pcm_substream *substream, int channel,
     76                    unsigned long pos, void *iter, unsigned long bytes);
     77#endif
    7678        struct page *(*page)(struct snd_pcm_substream *substream,
    7779                             unsigned long offset);
     
    107109
    108110/* If you change this don't forget to change rates[] table in pcm_native.c */
    109 #define SNDRV_PCM_RATE_5512             (1<<0)          /* 5512Hz */
    110 #define SNDRV_PCM_RATE_8000             (1<<1)          /* 8000Hz */
    111 #define SNDRV_PCM_RATE_11025            (1<<2)          /* 11025Hz */
    112 #define SNDRV_PCM_RATE_16000            (1<<3)          /* 16000Hz */
    113 #define SNDRV_PCM_RATE_22050            (1<<4)          /* 22050Hz */
    114 #define SNDRV_PCM_RATE_32000            (1<<5)          /* 32000Hz */
    115 #define SNDRV_PCM_RATE_44100            (1<<6)          /* 44100Hz */
    116 #define SNDRV_PCM_RATE_48000            (1<<7)          /* 48000Hz */
    117 #define SNDRV_PCM_RATE_64000            (1<<8)          /* 64000Hz */
    118 #define SNDRV_PCM_RATE_88200            (1<<9)          /* 88200Hz */
    119 #define SNDRV_PCM_RATE_96000            (1<<10)         /* 96000Hz */
    120 #define SNDRV_PCM_RATE_176400           (1<<11)         /* 176400Hz */
    121 #define SNDRV_PCM_RATE_192000           (1<<12)         /* 192000Hz */
    122 #define SNDRV_PCM_RATE_352800           (1<<13)         /* 352800Hz */
    123 #define SNDRV_PCM_RATE_384000           (1<<14)         /* 384000Hz */
    124 
    125 #define SNDRV_PCM_RATE_CONTINUOUS       (1<<30)         /* continuous range */
    126 #define SNDRV_PCM_RATE_KNOT             (1<<31)         /* supports more non-continuos rates */
     111#define SNDRV_PCM_RATE_5512             (1U<<0)         /* 5512Hz */
     112#define SNDRV_PCM_RATE_8000             (1U<<1)         /* 8000Hz */
     113#define SNDRV_PCM_RATE_11025            (1U<<2)         /* 11025Hz */
     114#define SNDRV_PCM_RATE_16000            (1U<<3)         /* 16000Hz */
     115#define SNDRV_PCM_RATE_22050            (1U<<4)         /* 22050Hz */
     116#define SNDRV_PCM_RATE_32000            (1U<<5)         /* 32000Hz */
     117#define SNDRV_PCM_RATE_44100            (1U<<6)         /* 44100Hz */
     118#define SNDRV_PCM_RATE_48000            (1U<<7)         /* 48000Hz */
     119#define SNDRV_PCM_RATE_64000            (1U<<8)         /* 64000Hz */
     120#define SNDRV_PCM_RATE_88200            (1U<<9)         /* 88200Hz */
     121#define SNDRV_PCM_RATE_96000            (1U<<10)        /* 96000Hz */
     122#define SNDRV_PCM_RATE_176400           (1U<<11)        /* 176400Hz */
     123#define SNDRV_PCM_RATE_192000           (1U<<12)        /* 192000Hz */
     124#define SNDRV_PCM_RATE_352800           (1U<<13)        /* 352800Hz */
     125#define SNDRV_PCM_RATE_384000           (1U<<14)        /* 384000Hz */
     126
     127#define SNDRV_PCM_RATE_CONTINUOUS       (1U<<30)        /* continuous range */
     128#define SNDRV_PCM_RATE_KNOT             (1U<<31)        /* supports more non-continuos rates */
    127129
    128130#define SNDRV_PCM_RATE_8000_44100       (SNDRV_PCM_RATE_8000|SNDRV_PCM_RATE_11025|\
     
    148150#define SNDRV_PCM_FMTBIT_U24_LE         _SNDRV_PCM_FMTBIT(U24_LE)
    149151#define SNDRV_PCM_FMTBIT_U24_BE         _SNDRV_PCM_FMTBIT(U24_BE)
     152// For S32/U32 formats, 'msbits' hardware parameter is often used to deliver information about the
     153// available bit count in most significant bit. It's for the case of so-called 'left-justified' or
     154// `right-padding` sample which has less width than 32 bit.
    150155#define SNDRV_PCM_FMTBIT_S32_LE         _SNDRV_PCM_FMTBIT(S32_LE)
    151156#define SNDRV_PCM_FMTBIT_S32_BE         _SNDRV_PCM_FMTBIT(S32_BE)
     
    344349struct snd_pcm_runtime {
    345350        /* -- Status -- */
     351        snd_pcm_state_t state;          /* stream state */
     352        snd_pcm_state_t suspended_state; /* suspended stream state */
    346353        struct snd_pcm_substream *trigger_master;
    347354        struct timespec64 trigger_tstamp;       /* trigger timestamp */
     
    374381        unsigned int no_period_wakeup: 1;
    375382
    376         /* -- SW params -- */
    377         int tstamp_mode;                /* mmap timestamp is updated */
     383        /* -- SW params; see struct snd_pcm_sw_params for comments -- */
     384        int tstamp_mode;
    378385        unsigned int period_step;
    379386        snd_pcm_uframes_t start_threshold;
    380387        snd_pcm_uframes_t stop_threshold;
    381         snd_pcm_uframes_t silence_threshold; /* Silence filling happens when
    382                                                 noise is nearest than this */
    383         snd_pcm_uframes_t silence_size; /* Silence filling size */
    384         snd_pcm_uframes_t boundary;     /* pointers wrap point */
    385 
     388        snd_pcm_uframes_t silence_threshold;
     389        snd_pcm_uframes_t silence_size;
     390        snd_pcm_uframes_t boundary;
     391
     392        /* internal data of auto-silencer */
    386393        snd_pcm_uframes_t silence_start; /* starting pointer to silence area */
    387         snd_pcm_uframes_t silence_filled; /* size filled with silence */
     394        snd_pcm_uframes_t silence_filled; /* already filled part of silence area */
    388395
    389396        union snd_pcm_sync_id sync;     /* hardware synchronization ID */
     
    397404        wait_queue_head_t sleep;        /* poll sleep */
    398405        wait_queue_head_t tsleep;       /* transfer sleep */
    399         struct fasync_struct *fasync;
     406        struct snd_fasync *fasync;
    400407        bool stop_operating;            /* sync_stop will be called */
    401408        struct mutex buffer_mutex;      /* protect for buffer changes */
     
    506513#endif
    507514        struct snd_kcontrol *chmap_kctl; /* channel-mapping controls */
    508         struct device dev;
     515        struct device *dev;
    509516};
    510517
     
    605612 * @substream: substream to check
    606613 *
    607  * Returns true if the given substream is being linked with others.
     614 * Return: true if the given substream is being linked with others
    608615 */
    609616static inline int snd_pcm_stream_linked(struct snd_pcm_substream *substream)
     
    617624void snd_pcm_stream_unlock_irq(struct snd_pcm_substream *substream);
    618625unsigned long _snd_pcm_stream_lock_irqsave(struct snd_pcm_substream *substream);
     626unsigned long _snd_pcm_stream_lock_irqsave_nested(struct snd_pcm_substream *substream);
    619627
    620628/**
     
    643651
    644652/**
     653 * snd_pcm_stream_lock_irqsave_nested - Single-nested PCM stream locking
     654 * @substream: PCM substream
     655 * @flags: irq flags
     656 *
     657 * This locks the PCM stream like snd_pcm_stream_lock_irqsave() but with
     658 * the single-depth lockdep subclass.
     659 */
     660#define snd_pcm_stream_lock_irqsave_nested(substream, flags)            \
     661        do {                                                            \
     662                typecheck(unsigned long, flags);                        \
     663                flags = _snd_pcm_stream_lock_irqsave_nested(substream); \
     664        } while (0)
     665
     666/**
    645667 * snd_pcm_group_for_each_entry - iterate over the linked substreams
    646668 * @s: the iterator
     
    663685 * @substream: substream to check
    664686 *
    665  * Returns true if the given substream is in the state RUNNING, or in the
     687 * Return: true if the given substream is in the state RUNNING, or in the
    666688 * state DRAINING for playback.
    667689 */
    668690static inline int snd_pcm_running(struct snd_pcm_substream *substream)
    669691{
    670         return (substream->runtime->status->state == SNDRV_PCM_STATE_RUNNING ||
    671                 (substream->runtime->status->state == SNDRV_PCM_STATE_DRAINING &&
     692        return (substream->runtime->state == SNDRV_PCM_STATE_RUNNING ||
     693                (substream->runtime->state == SNDRV_PCM_STATE_DRAINING &&
    672694                 substream->stream == SNDRV_PCM_STREAM_PLAYBACK));
     695}
     696
     697/**
     698 * __snd_pcm_set_state - Change the current PCM state
     699 * @runtime: PCM runtime to set
     700 * @state: the current state to set
     701 *
     702 * Call within the stream lock
     703 */
     704static inline void __snd_pcm_set_state(struct snd_pcm_runtime *runtime,
     705                                       snd_pcm_state_t state)
     706{
     707        runtime->state = state;
     708        runtime->status->state = state; /* copy for mmap */
    673709}
    674710
     
    677713 * @runtime: PCM runtime instance
    678714 * @size: size in bytes
     715 *
     716 * Return: the size in samples
    679717 */
    680718static inline ssize_t bytes_to_samples(struct snd_pcm_runtime *runtime, ssize_t size)
     
    687725 * @runtime: PCM runtime instance
    688726 * @size: size in bytes
     727 *
     728 * Return: the size in frames
    689729 */
    690730static inline snd_pcm_sframes_t bytes_to_frames(struct snd_pcm_runtime *runtime, ssize_t size)
     
    697737 * @runtime: PCM runtime instance
    698738 * @size: size in samples
     739 *
     740 * Return: the byte size
    699741 */
    700742static inline ssize_t samples_to_bytes(struct snd_pcm_runtime *runtime, ssize_t size)
     
    707749 * @runtime: PCM runtime instance
    708750 * @size: size in frames
     751 *
     752 * Return: the byte size
    709753 */
    710754static inline ssize_t frames_to_bytes(struct snd_pcm_runtime *runtime, snd_pcm_sframes_t size)
     
    717761 * @runtime: PCM runtime instance
    718762 * @bytes: size in bytes
     763 *
     764 * Return: true if aligned, or false if not
    719765 */
    720766static inline int frame_aligned(struct snd_pcm_runtime *runtime, ssize_t bytes)
     
    726772 * snd_pcm_lib_buffer_bytes - Get the buffer size of the current PCM in bytes
    727773 * @substream: PCM substream
     774 *
     775 * Return: buffer byte size
    728776 */
    729777static inline size_t snd_pcm_lib_buffer_bytes(struct snd_pcm_substream *substream)
     
    736784 * snd_pcm_lib_period_bytes - Get the period size of the current PCM in bytes
    737785 * @substream: PCM substream
     786 *
     787 * Return: period byte size
    738788 */
    739789static inline size_t snd_pcm_lib_period_bytes(struct snd_pcm_substream *substream)
     
    748798 *
    749799 * Result is between 0 ... (boundary - 1)
     800 *
     801 * Return: available frame size
    750802 */
    751803static inline snd_pcm_uframes_t snd_pcm_playback_avail(struct snd_pcm_runtime *runtime)
     
    777829 *
    778830 * Result is between 0 ... (boundary - 1)
     831 *
     832 * Return: available frame size
    779833 */
    780834static inline snd_pcm_uframes_t snd_pcm_capture_avail(struct snd_pcm_runtime *runtime)
     
    789843 * snd_pcm_playback_hw_avail - Get the queued space for playback
    790844 * @runtime: PCM runtime instance
     845 *
     846 * Return: available frame size
    791847 */
    792848static inline snd_pcm_sframes_t snd_pcm_playback_hw_avail(struct snd_pcm_runtime *runtime)
     
    798854 * snd_pcm_capture_hw_avail - Get the free space for capture
    799855 * @runtime: PCM runtime instance
     856 *
     857 * Return: available frame size
    800858 */
    801859static inline snd_pcm_sframes_t snd_pcm_capture_hw_avail(struct snd_pcm_runtime *runtime)
     
    937995 * params_channels - Get the number of channels from the hw params
    938996 * @p: hw params
     997 *
     998 * Return: the number of channels
    939999 */
    9401000static inline unsigned int params_channels(const struct snd_pcm_hw_params *p)
     
    9461006 * params_rate - Get the sample rate from the hw params
    9471007 * @p: hw params
     1008 *
     1009 * Return: the sample rate
    9481010 */
    9491011static inline unsigned int params_rate(const struct snd_pcm_hw_params *p)
     
    9551017 * params_period_size - Get the period size (in frames) from the hw params
    9561018 * @p: hw params
     1019 *
     1020 * Return: the period size in frames
    9571021 */
    9581022static inline unsigned int params_period_size(const struct snd_pcm_hw_params *p)
     
    9641028 * params_periods - Get the number of periods from the hw params
    9651029 * @p: hw params
     1030 *
     1031 * Return: the number of periods
    9661032 */
    9671033static inline unsigned int params_periods(const struct snd_pcm_hw_params *p)
     
    9731039 * params_buffer_size - Get the buffer size (in frames) from the hw params
    9741040 * @p: hw params
     1041 *
     1042 * Return: the buffer size in frames
    9751043 */
    9761044static inline unsigned int params_buffer_size(const struct snd_pcm_hw_params *p)
     
    9821050 * params_buffer_bytes - Get the buffer size (in bytes) from the hw params
    9831051 * @p: hw params
     1052 *
     1053 * Return: the buffer size in bytes
    9841054 */
    9851055static inline unsigned int params_buffer_bytes(const struct snd_pcm_hw_params *p)
     
    12441314 * allocation of a larger buffer unlike the standard one.
    12451315 * The function may return -ENOMEM error, hence the caller must check it.
     1316 *
     1317 * Return: zero if successful, or a negative error code
    12461318 */
    12471319static inline int __must_check
     
    12621334 * all substream.  If any of allocation fails, it returns -ENOMEM, hence the
    12631335 * caller must check the return value.
     1336 *
     1337 * Return: zero if successful, or a negative error code
    12641338 */
    12651339static inline int __must_check
     
    13181392 * @substream: PCM substream
    13191393 * @ofs: byte offset
     1394 *
     1395 * Return: DMA address
    13201396 */
    13211397static inline dma_addr_t
     
    13311407 * @ofs: byte offset
    13321408 * @size: byte size to examine
     1409 *
     1410 * Return: chunk size
    13331411 */
    13341412static inline unsigned int
     
    13961474
    13971475/**
    1398  * snd_pcm_stream_str - Get a string naming the direction of a stream
    1399  * @substream: the pcm substream instance
    1400  *
    1401  * Return: A string naming the direction of the stream.
    1402  */
    1403 static inline const char *snd_pcm_stream_str(struct snd_pcm_substream *substream)
    1404 {
    1405         if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
     1476 * snd_pcm_direction_name - Get a string naming the direction of a stream
     1477 * @direction: Stream's direction, one of SNDRV_PCM_STREAM_XXX
     1478 *
     1479 * Returns a string naming the direction of the stream.
     1480 */
     1481static inline const char *snd_pcm_direction_name(int direction)
     1482{
     1483        if (direction == SNDRV_PCM_STREAM_PLAYBACK)
    14061484                return "Playback";
    14071485        else
    14081486                return "Capture";
     1487}
     1488
     1489/**
     1490 * snd_pcm_stream_str - Get a string naming the direction of a stream
     1491 * @substream: the pcm substream instance
     1492 *
     1493 * Return: A string naming the direction of the stream.
     1494 */
     1495static inline const char *snd_pcm_stream_str(struct snd_pcm_substream *substream)
     1496{
     1497        return snd_pcm_direction_name(substream->stream);
    14091498}
    14101499
     
    14331522 * @info: chmap information
    14341523 * @idx: the substream number index
     1524 *
     1525 * Return: the matched PCM substream, or NULL if not found
    14351526 */
    14361527static inline struct snd_pcm_substream *
     
    14631554 * pcm_format_to_bits - Strong-typed conversion of pcm_format to bitwise
    14641555 * @pcm_format: PCM format
     1556 *
     1557 * Return: 64bit mask corresponding to the given PCM format
    14651558 */
    14661559static inline u64 pcm_format_to_bits(snd_pcm_format_t pcm_format)
     
    14911584int pcm_dbg(struct snd_pcm *dev, const char *fmt, ...);
    14921585#endif
     1586
     1587/* helpers for copying between iov_iter and iomem */
     1588int copy_to_iter_fromio(struct iov_iter *itert, const void __iomem *src,
     1589                        size_t count);
     1590int copy_from_iter_toio(void __iomem *dst, struct iov_iter *iter, size_t count);
    14931591
    14941592struct snd_pcm_status64 {
  • GPL/trunk/alsa-kernel/include/sound/pxa2xx-lib.h

    r717 r772  
    5353extern void pxa2xx_ac97_hw_remove(struct platform_device *dev);
    5454
     55/* modem registers, used by touchscreen driver */
     56u32 pxa2xx_ac97_read_modr(void);
     57u32 pxa2xx_ac97_read_misr(void);
     58
    5559#endif
  • GPL/trunk/alsa-kernel/include/sound/rawmidi.h

    r717 r772  
    1919#include <sound/seq_device.h>
    2020#endif
     21#include <sound/info.h>
    2122
    2223/*
     
    4849        void (*get_port_info)(struct snd_rawmidi *rmidi, int number,
    4950                              struct snd_seq_port_info *info);
     51        long (*ioctl)(struct snd_rawmidi *rmidi, unsigned int cmd,
     52                      void __user *argp);
     53        void (*proc_read)(struct snd_info_entry *entry,
     54                          struct snd_info_buffer *buf);
    5055};
    5156
     
    6267        size_t avail;           /* max used buffer for wakeup */
    6368        size_t xruns;           /* over/underruns counter */
     69        size_t align;           /* alignment (0 = byte stream, 3 = UMP) */
    6470        int buffer_ref;         /* buffer reference count */
    6571        /* misc */
    66         spinlock_t lock;
    6772        wait_queue_head_t sleep;
    6873        /* event handler (new bytes, input only) */
     
    8691        int use_count;                  /* use counter (for output) */
    8792        size_t bytes;
     93        spinlock_t lock;
    8894        struct snd_rawmidi *rmidi;
    8995        struct snd_rawmidi_str *pstr;
     
    130136        wait_queue_head_t open_wait;
    131137
    132         struct device dev;
     138        struct device *dev;
    133139
    134140        struct snd_info_entry *proc_entry;
     
    147153                         const struct snd_rawmidi_ops *ops);
    148154
     155/* internal */
     156int snd_rawmidi_init(struct snd_rawmidi *rmidi,
     157                     struct snd_card *card, char *id, int device,
     158                     int output_count, int input_count,
     159                     unsigned int info_flags);
     160int snd_rawmidi_free(struct snd_rawmidi *rmidi);
     161
    149162/* callbacks */
    150163
     
    157170int snd_rawmidi_transmit(struct snd_rawmidi_substream *substream,
    158171                         unsigned char *buffer, int count);
    159 int __snd_rawmidi_transmit_peek(struct snd_rawmidi_substream *substream,
    160                               unsigned char *buffer, int count);
    161 int __snd_rawmidi_transmit_ack(struct snd_rawmidi_substream *substream,
    162                                int count);
    163172int snd_rawmidi_proceed(struct snd_rawmidi_substream *substream);
    164173
     
    166175
    167176int snd_rawmidi_info_select(struct snd_card *card, struct snd_rawmidi_info *info);
    168 int snd_rawmidi_kernel_open(struct snd_card *card, int device, int subdevice,
     177int snd_rawmidi_kernel_open(struct snd_rawmidi *rmidi, int subdevice,
    169178                            int mode, struct snd_rawmidi_file *rfile);
    170179int snd_rawmidi_kernel_release(struct snd_rawmidi_file *rfile);
  • GPL/trunk/alsa-kernel/include/sound/rt5665.h

    r679 r772  
    3232        bool in4_diff;
    3333
    34         int ldo1_en; /* GPIO for LDO1_EN */
    35 
    3634        enum rt5665_dmic1_data_pin dmic1_data_pin;
    3735        enum rt5665_dmic2_data_pin dmic2_data_pin;
  • GPL/trunk/alsa-kernel/include/sound/rt5668.h

    r679 r772  
    2626
    2727struct rt5668_platform_data {
    28 
    29         int ldo1_en; /* GPIO for LDO1_EN */
    30 
    3128        enum rt5668_dmic1_data_pin dmic1_data_pin;
    3229        enum rt5668_dmic1_clk_pin dmic1_clk_pin;
  • GPL/trunk/alsa-kernel/include/sound/rt5682.h

    r695 r772  
    3232
    3333struct rt5682_platform_data {
    34 
    35         int ldo1_en; /* GPIO for LDO1_EN */
    36 
    3734        enum rt5682_dmic1_data_pin dmic1_data_pin;
    3835        enum rt5682_dmic1_clk_pin dmic1_clk_pin;
  • GPL/trunk/alsa-kernel/include/sound/seq_device.h

    r679 r772  
    7979#define SNDRV_SEQ_DEV_ID_MIDISYNTH      "seq-midi"
    8080#define SNDRV_SEQ_DEV_ID_OPL3           "opl3-synth"
     81#define SNDRV_SEQ_DEV_ID_UMP            "seq-ump-client"
    8182
    8283#endif /* __SOUND_SEQ_DEVICE_H */
  • GPL/trunk/alsa-kernel/include/sound/seq_kernel.h

    r679 r772  
    7373int snd_seq_expand_var_event(const struct snd_seq_event *event, int count, char *buf,
    7474                             int in_kernel, int size_aligned);
     75int snd_seq_expand_var_event_at(const struct snd_seq_event *event, int count,
     76                                char *buf, int offset);
    7577int snd_seq_dump_var_event(const struct snd_seq_event *event,
    7678                           snd_seq_dump_func_t func, void *private_data);
     79
     80/* size of the event packet; it can be greater than snd_seq_event size */
     81static inline size_t snd_seq_event_packet_size(struct snd_seq_event *ev)
     82{
     83        if (snd_seq_ev_is_ump(ev))
     84                return sizeof(struct snd_seq_ump_event);
     85        return sizeof(struct snd_seq_event);
     86}
    7787
    7888/* interface for OSS emulation */
  • GPL/trunk/alsa-kernel/include/sound/simple_card_utils.h

    r695 r772  
    1616#define asoc_simple_init_mic(card, sjack, prefix) \
    1717        asoc_simple_init_jack(card, sjack, 0, prefix, NULL)
     18
     19struct asoc_simple_tdm_width_map {
     20        u8 sample_bits;
     21        u8 slot_count;
     22        u16 slot_width;
     23};
    1824
    1925struct asoc_simple_dai {
     
    2632        unsigned int rx_slot_mask;
    2733        struct clk *clk;
     34        bool clk_fixed;
     35        struct asoc_simple_tdm_width_map *tdm_width_map;
     36        int n_tdm_widths;
    2837};
    2938
     
    3140        u32 convert_rate;
    3241        u32 convert_channels;
     42        const char *convert_sample_format;
    3343};
    3444
     
    5060                struct asoc_simple_dai *cpu_dai;
    5161                struct asoc_simple_dai *codec_dai;
    52                 struct snd_soc_dai_link_component *cpus;
    53                 struct snd_soc_dai_link_component *codecs;
    54                 struct snd_soc_dai_link_component *platforms;
    5562                struct asoc_simple_data adata;
    5663                struct snd_soc_codec_conf *codec_conf;
     
    6067        struct asoc_simple_jack hp_jack;
    6168        struct asoc_simple_jack mic_jack;
     69        struct snd_soc_jack *aux_jacks;
    6270        struct snd_soc_dai_link *dai_link;
    6371        struct asoc_simple_dai *dais;
    6472        struct snd_soc_dai_link_component *dlcs;
    65         struct snd_soc_dai_link_component dummy;
    6673        struct snd_soc_codec_conf *codec_conf;
    6774        struct gpio_desc *pa_gpio;
     
    116123             (i)++)
    117124
    118 #define SNDRV_MAX_LINKS 128
     125#define SNDRV_MAX_LINKS 512
    119126
    120127struct link_info {
     
    129136                             char *prefix,
    130137                             unsigned int *retfmt);
     138int asoc_simple_parse_tdm_width_map(struct device *dev, struct device_node *np,
     139                                    struct asoc_simple_dai *dai);
     140
    131141__printf(3, 4)
    132142int asoc_simple_set_dailink_name(struct device *dev,
     
    159169                                  int is_single_links);
    160170
    161 int asoc_simple_clean_reference(struct snd_soc_card *card);
    162 
    163 void asoc_simple_convert_fixup(struct asoc_simple_data *data,
    164                                       struct snd_pcm_hw_params *params);
     171void asoc_simple_clean_reference(struct snd_soc_card *card);
     172
    165173void asoc_simple_parse_convert(struct device_node *np, char *prefix,
    166174                               struct asoc_simple_data *data);
     175bool asoc_simple_is_convert_required(const struct asoc_simple_data *data);
    167176
    168177int asoc_simple_parse_routing(struct snd_soc_card *card,
     
    176185                               struct asoc_simple_jack *sjack,
    177186                               int is_hp, char *prefix, char *pin);
     187int asoc_simple_init_aux_jacks(struct asoc_simple_priv *priv,
     188                                char *prefix);
    178189int asoc_simple_init_priv(struct asoc_simple_priv *priv,
    179190                               struct link_info *li);
     
    181192
    182193int asoc_graph_card_probe(struct snd_soc_card *card);
     194int asoc_graph_is_ports0(struct device_node *port);
     195int asoc_graph_parse_dai(struct device *dev, struct device_node *ep,
     196                         struct snd_soc_dai_link_component *dlc, int *is_single_link);
    183197
    184198#ifdef DEBUG
  • GPL/trunk/alsa-kernel/include/sound/soc-acpi-intel-match.h

    r695 r772  
    1515 * pdata or machine ops
    1616 */
    17 extern struct snd_soc_acpi_mach snd_soc_acpi_intel_haswell_machines[];
    1817extern struct snd_soc_acpi_mach snd_soc_acpi_intel_broadwell_machines[];
    1918extern struct snd_soc_acpi_mach snd_soc_acpi_intel_baytrail_machines[];
     
    3130extern struct snd_soc_acpi_mach snd_soc_acpi_intel_jsl_machines[];
    3231extern struct snd_soc_acpi_mach snd_soc_acpi_intel_adl_machines[];
     32extern struct snd_soc_acpi_mach snd_soc_acpi_intel_rpl_machines[];
     33extern struct snd_soc_acpi_mach snd_soc_acpi_intel_mtl_machines[];
     34extern struct snd_soc_acpi_mach snd_soc_acpi_intel_lnl_machines[];
     35extern struct snd_soc_acpi_mach snd_soc_acpi_intel_arl_machines[];
    3336
    3437extern struct snd_soc_acpi_mach snd_soc_acpi_intel_cnl_sdw_machines[];
     
    3841extern struct snd_soc_acpi_mach snd_soc_acpi_intel_tgl_sdw_machines[];
    3942extern struct snd_soc_acpi_mach snd_soc_acpi_intel_adl_sdw_machines[];
     43extern struct snd_soc_acpi_mach snd_soc_acpi_intel_rpl_sdw_machines[];
     44extern struct snd_soc_acpi_mach snd_soc_acpi_intel_mtl_sdw_machines[];
     45extern struct snd_soc_acpi_mach snd_soc_acpi_intel_lnl_sdw_machines[];
     46extern struct snd_soc_acpi_mach snd_soc_acpi_intel_arl_sdw_machines[];
    4047
    4148/*
  • GPL/trunk/alsa-kernel/include/sound/soc-acpi.h

    r695 r772  
    1010#include <linux/acpi.h>
    1111#include <linux/mod_devicetable.h>
     12#include <linux/soundwire/sdw.h>
    1213
    1314struct snd_soc_acpi_package_context {
     
    6162 * @platform: string used for HDAudio codec support
    6263 * @codec_mask: used for HDAudio support
     64 * @dmic_num: number of SoC- or chipset-attached PDM digital microphones
    6365 * @common_hdmi_codec_drv: use commom HDAudio HDMI codec driver
    64  * @link_mask: links enabled on the board
    65  * @links: array of link _ADR descriptors, null terminated
     66 * @link_mask: SoundWire links enabled on the board
     67 * @links: array of SoundWire link _ADR descriptors, null terminated
     68 * @i2s_link_mask: I2S/TDM links enabled on the board
    6669 * @num_dai_drivers: number of elements in @dai_drivers
    6770 * @dai_drivers: pointer to dai_drivers, used e.g. in nocodec mode
     71 * @subsystem_vendor: optional PCI SSID vendor value
     72 * @subsystem_device: optional PCI SSID device value
     73 * @subsystem_id_set: true if a value has been written to
     74 *                    subsystem_vendor and subsystem_device.
    6875 */
    6976struct snd_soc_acpi_mach_params {
     
    7582        u32 link_mask;
    7683        const struct snd_soc_acpi_link_adr *links;
     84        u32 i2s_link_mask;
    7785        u32 num_dai_drivers;
    7886        struct snd_soc_dai_driver *dai_drivers;
     87        unsigned short subsystem_vendor;
     88        unsigned short subsystem_device;
     89        bool subsystem_id_set;
    7990};
    8091
     
    123134};
    124135
     136/*
     137 * when set the topology uses the -ssp<N> suffix, where N is determined based on
     138 * BIOS or DMI information
     139 */
     140#define SND_SOC_ACPI_TPLG_INTEL_SSP_NUMBER BIT(0)
     141
     142/*
     143 * when more than one SSP is reported in the link mask, use the most significant.
     144 * This choice was found to be valid on platforms with ES8336 codecs.
     145 */
     146#define SND_SOC_ACPI_TPLG_INTEL_SSP_MSB BIT(1)
     147
     148/*
     149 * when set the topology uses the -dmic<N>ch suffix, where N is determined based on
     150 * BIOS or DMI information
     151 */
     152#define SND_SOC_ACPI_TPLG_INTEL_DMIC_NUMBER BIT(2)
     153
    125154/**
    126155 * snd_soc_acpi_mach: ACPI-based machine descriptor. Most of the fields are
     
    130159 *
    131160 * @id: ACPI ID (usually the codec's) used to find a matching machine driver.
     161 * @uid: ACPI Unique ID, can be used to disambiguate matches.
     162 * @comp_ids: list of compatible audio codecs using the same machine driver,
     163 * firmware and topology
    132164 * @link_mask: describes required board layout, e.g. for SoundWire.
    133165 * @links: array of link _ADR descriptors, null terminated.
    134166 * @drv_name: machine driver name
    135167 * @fw_filename: firmware file name. Used when SOF is not enabled.
     168 * @tplg_filename: topology file name. Used when SOF is not enabled.
    136169 * @board: board name
    137170 * @machine_quirk: pointer to quirk, usually based on DMI information when
     
    141174 * @pdata: intended for platform data or machine specific-ops. This structure
    142175 *  is not constant since this field may be updated at run-time
    143  * @sof_fw_filename: Sound Open Firmware file name, if enabled
    144176 * @sof_tplg_filename: Sound Open Firmware topology file name, if enabled
     177 * @tplg_quirk_mask: quirks to select different topology files dynamically
    145178 */
    146179/* Descriptor for SST ASoC machine driver */
    147180struct snd_soc_acpi_mach {
    148         const u8 id[ACPI_ID_LEN];
     181        u8 id[ACPI_ID_LEN];
     182        const char *uid;
     183        const struct snd_soc_acpi_codecs *comp_ids;
    149184        const u32 link_mask;
    150185        const struct snd_soc_acpi_link_adr *links;
    151186        const char *drv_name;
    152187        const char *fw_filename;
     188        const char *tplg_filename;
    153189        const char *board;
    154190        struct snd_soc_acpi_mach * (*machine_quirk)(void *arg);
     
    156192        void *pdata;
    157193        struct snd_soc_acpi_mach_params mach_params;
    158         const char *sof_fw_filename;
    159194        const char *sof_tplg_filename;
     195        const u32 tplg_quirk_mask;
    160196};
    161197
     
    182218}
    183219
     220bool snd_soc_acpi_sdw_link_slaves_found(struct device *dev,
     221                                        const struct snd_soc_acpi_link_adr *link,
     222                                        struct sdw_extended_slave_id *ids,
     223                                        int num_slaves);
     224
    184225#endif
  • GPL/trunk/alsa-kernel/include/sound/soc-component.h

    r695 r772  
    9999        int (*set_jack)(struct snd_soc_component *component,
    100100                        struct snd_soc_jack *jack,  void *data);
     101        int (*get_jack_type)(struct snd_soc_component *component);
    101102
    102103        /* DT */
     
    137138                struct snd_pcm_audio_tstamp_config *audio_tstamp_config,
    138139                struct snd_pcm_audio_tstamp_report *audio_tstamp_report);
    139         int (*copy_user)(struct snd_soc_component *component,
    140                         struct snd_pcm_substream *substream, int channel,
    141                          unsigned long pos, void __user *buf,
    142                         unsigned long bytes);
     140        int (*copy)(struct snd_soc_component *component,
     141                    struct snd_pcm_substream *substream, int channel,
     142                    unsigned long pos, struct iov_iter *iter,
     143                    unsigned long bytes);
    143144        struct page *(*page)(struct snd_soc_component *component,
    144145                             struct snd_pcm_substream *substream,
     
    149150        int (*ack)(struct snd_soc_component *component,
    150151                   struct snd_pcm_substream *substream);
     152        snd_pcm_sframes_t (*delay)(struct snd_soc_component *component,
     153                                   struct snd_pcm_substream *substream);
    151154
    152155        const struct snd_compress_ops *compress_ops;
     
    155158        int probe_order;
    156159        int remove_order;
     160
     161        /*
     162         * soc_pcm_trigger() start/stop sequence.
     163         * see also
     164         *      snd_soc_dai_link
     165         *      soc_pcm_trigger()
     166         */
     167        enum snd_soc_trigger_order trigger_start;
     168        enum snd_soc_trigger_order trigger_stop;
    157169
    158170        /*
     
    168180        unsigned int suspend_bias_off:1;
    169181        unsigned int use_pmdown_time:1; /* care pmdown_time at stop */
     182        /*
     183         * Indicates that the component does not care about the endianness of
     184         * PCM audio data and the core will ensure that both LE and BE variants
     185         * of each used format are present. Typically this is because the
     186         * component sits behind a bus that abstracts away the endian of the
     187         * original data, ie. one for which the transmission endian is defined
     188         * (I2S/SLIMbus/SoundWire), or the concept of endian doesn't exist (PDM,
     189         * analogue).
     190         */
    170191        unsigned int endianness:1;
    171         unsigned int non_legacy_dai_naming:1;
     192        unsigned int legacy_dai_naming:1;
    172193
    173194        /* this component uses topology and ignore machine driver FEs */
     
    178199        bool use_dai_pcm_id;    /* use DAI link PCM ID as PCM device number */
    179200        int be_pcm_base;        /* base device ID for all BE PCMs */
     201
     202#ifdef CONFIG_DEBUG_FS
     203        const char *debugfs_prefix;
     204#endif
    180205};
    181206
     
    221246
    222247        /* function mark */
    223         struct snd_pcm_substream *mark_module;
     248        void *mark_module;
    224249        struct snd_pcm_substream *mark_open;
    225250        struct snd_pcm_substream *mark_hw_params;
     
    228253        void *mark_pm;
    229254
    230 #ifdef CONFIG_DEBUG_FS
    231255        struct dentry *debugfs_root;
    232256        const char *debugfs_prefix;
    233 #endif
    234257};
    235258
     
    372395int snd_soc_component_set_jack(struct snd_soc_component *component,
    373396                               struct snd_soc_jack *jack, void *data);
     397int snd_soc_component_get_jack_type(struct snd_soc_component *component);
    374398
    375399void snd_soc_component_seq_notifier(struct snd_soc_component *component,
     
    392416        snd_soc_component_module_get(component, substream, 1)
    393417int snd_soc_component_module_get(struct snd_soc_component *component,
    394                                  struct snd_pcm_substream *substream,
    395                                  int upon_open);
     418                                 void *mark, int upon_open);
    396419#define snd_soc_component_module_put_when_remove(component)     \
    397420        snd_soc_component_module_put(component, NULL, 0, 0)
     
    399422        snd_soc_component_module_put(component, substream, 1, rollback)
    400423void snd_soc_component_module_put(struct snd_soc_component *component,
    401                                   struct snd_pcm_substream *substream,
    402                                   int upon_open, int rollback);
     424                                  void *mark, int upon_open, int rollback);
    403425
    404426static inline void snd_soc_component_set_drvdata(struct snd_soc_component *c,
     
    440462        const char *pin);
    441463
     464/* component controls */
     465int snd_soc_component_notify_control(struct snd_soc_component *component,
     466                                     const char * const ctl);
     467
    442468/* component driver ops */
    443469int snd_soc_component_open(struct snd_soc_component *component,
     
    456482                                        const struct of_phandle_args *args,
    457483                                        const char **dai_name);
    458 int snd_soc_component_compr_open(struct snd_compr_stream *cstream);
    459 void snd_soc_component_compr_free(struct snd_compr_stream *cstream,
     484int snd_soc_component_compr_open(struct snd_soc_component *component,
     485                                 struct snd_compr_stream *cstream);
     486void snd_soc_component_compr_free(struct snd_soc_component *component,
     487                                  struct snd_compr_stream *cstream,
    460488                                  int rollback);
    461489int snd_soc_component_compr_trigger(struct snd_compr_stream *cstream, int cmd);
     
    482510                                unsigned int cmd, void *arg);
    483511int snd_soc_pcm_component_sync_stop(struct snd_pcm_substream *substream);
    484 int snd_soc_pcm_component_copy_user(struct snd_pcm_substream *substream,
    485                                     int channel, unsigned long pos,
    486                                     void __user *buf, unsigned long bytes);
     512int snd_soc_pcm_component_copy(struct snd_pcm_substream *substream,
     513                               int channel, unsigned long pos,
     514                               struct iov_iter *iter, unsigned long bytes);
    487515struct page *snd_soc_pcm_component_page(struct snd_pcm_substream *substream,
    488516                                        unsigned long offset);
     
    503531                                          void *stream, int rollback);
    504532int snd_soc_pcm_component_ack(struct snd_pcm_substream *substream);
     533void snd_soc_pcm_component_delay(struct snd_pcm_substream *substream,
     534                                 snd_pcm_sframes_t *cpu_delay, snd_pcm_sframes_t *codec_delay);
    505535
    506536#endif /* __SOC_COMPONENT_H */
  • GPL/trunk/alsa-kernel/include/sound/soc-dai.h

    r703 r772  
    124124#define SND_SOC_DAIFMT_CBM_CFS          SND_SOC_DAIFMT_CBP_CFC
    125125#define SND_SOC_DAIFMT_CBS_CFS          SND_SOC_DAIFMT_CBC_CFC
     126
     127/* when passed to set_fmt directly indicate if the device is provider or consumer */
     128#define SND_SOC_DAIFMT_BP_FP            SND_SOC_DAIFMT_CBP_CFP
     129#define SND_SOC_DAIFMT_BC_FP            SND_SOC_DAIFMT_CBC_CFP
     130#define SND_SOC_DAIFMT_BP_FC            SND_SOC_DAIFMT_CBP_CFC
     131#define SND_SOC_DAIFMT_BC_FC            SND_SOC_DAIFMT_CBC_CFC
    126132
    127133/* Describes the possible PCM format */
     
    209215void snd_soc_dai_shutdown(struct snd_soc_dai *dai,
    210216                          struct snd_pcm_substream *substream, int rollback);
    211 snd_pcm_sframes_t snd_soc_dai_delay(struct snd_soc_dai *dai,
    212                                     struct snd_pcm_substream *substream);
    213217void snd_soc_dai_suspend(struct snd_soc_dai *dai);
    214218void snd_soc_dai_resume(struct snd_soc_dai *dai);
     
    239243int snd_soc_pcm_dai_bespoke_trigger(struct snd_pcm_substream *substream,
    240244                                    int cmd);
     245void snd_soc_pcm_dai_delay(struct snd_pcm_substream *substream,
     246                           snd_pcm_sframes_t *cpu_delay, snd_pcm_sframes_t *codec_delay);
    241247
    242248int snd_soc_dai_compr_startup(struct snd_soc_dai *dai,
     
    266272                                   struct snd_compr_metadata *metadata);
    267273
     274const char *snd_soc_dai_name_get(struct snd_soc_dai *dai);
     275
    268276struct snd_soc_dai_ops {
     277        /* DAI driver callbacks */
     278        int (*probe)(struct snd_soc_dai *dai);
     279        int (*remove)(struct snd_soc_dai *dai);
     280        /* compress dai */
     281        int (*compress_new)(struct snd_soc_pcm_runtime *rtd, int num);
     282        /* Optional Callback used at pcm creation*/
     283        int (*pcm_new)(struct snd_soc_pcm_runtime *rtd,
     284                       struct snd_soc_dai *dai);
     285
    269286        /*
    270287         * DAI clocking configuration, all optional.
     
    296313        int (*set_tristate)(struct snd_soc_dai *dai, int tristate);
    297314
    298         int (*set_sdw_stream)(struct snd_soc_dai *dai,
    299                         void *stream, int direction);
    300         void *(*get_sdw_stream)(struct snd_soc_dai *dai, int direction);
     315        int (*set_stream)(struct snd_soc_dai *dai,
     316                          void *stream, int direction);
     317        void *(*get_stream)(struct snd_soc_dai *dai, int direction);
    301318
    302319        /*
     
    348365        int num_auto_selectable_formats;
    349366
     367        /* probe ordering - for components with runtime dependencies */
     368        int probe_order;
     369        int remove_order;
     370
    350371        /* bit field */
    351372        unsigned int no_capture_mute:1;
     373        unsigned int mute_unmute_on_trigger:1;
    352374};
    353375
     
    392414        unsigned int base;
    393415        struct snd_soc_dobj dobj;
    394 
    395         /* DAI driver callbacks */
    396         int (*probe)(struct snd_soc_dai *dai);
    397         int (*remove)(struct snd_soc_dai *dai);
    398         /* compress dai */
    399         int (*compress_new)(struct snd_soc_pcm_runtime *rtd, int num);
    400         /* Optional Callback used at pcm creation*/
    401         int (*pcm_new)(struct snd_soc_pcm_runtime *rtd,
    402                        struct snd_soc_dai *dai);
     416        struct of_phandle_args *dai_args;
    403417
    404418        /* ops */
     
    412426        unsigned int symmetric_channels:1;
    413427        unsigned int symmetric_sample_bits:1;
    414 
    415         /* probe ordering - for components with runtime dependencies */
    416         int probe_order;
    417         int remove_order;
     428};
     429
     430/* for Playback/Capture */
     431struct snd_soc_dai_stream {
     432        struct snd_soc_dapm_widget *widget;
     433
     434        unsigned int active;    /* usage count */
     435        unsigned int tdm_mask;  /* CODEC TDM slot masks and params (for fixup) */
     436
     437        void *dma_data;         /* DAI DMA data */
    418438};
    419439
     
    432452
    433453        /* DAI runtime info */
    434         unsigned int stream_active[SNDRV_PCM_STREAM_LAST + 1]; /* usage count */
    435 
    436         struct snd_soc_dapm_widget *playback_widget;
    437         struct snd_soc_dapm_widget *capture_widget;
    438 
    439         /* DAI DMA data */
    440         void *playback_dma_data;
    441         void *capture_dma_data;
     454        struct snd_soc_dai_stream stream[SNDRV_PCM_STREAM_LAST + 1];
    442455
    443456        /* Symmetry data - only valid if symmetry is being enforced */
     
    448461        /* parent platform/codec */
    449462        struct snd_soc_component *component;
    450 
    451         /* CODEC TDM slot masks and params (for fixup) */
    452         unsigned int tx_mask;
    453         unsigned int rx_mask;
    454463
    455464        struct list_head list;
     
    472481}
    473482
     483#define snd_soc_dai_get_widget_playback(dai)    snd_soc_dai_get_widget(dai, SNDRV_PCM_STREAM_PLAYBACK)
     484#define snd_soc_dai_get_widget_capture(dai)     snd_soc_dai_get_widget(dai, SNDRV_PCM_STREAM_CAPTURE)
    474485static inline
    475 struct snd_soc_dapm_widget *snd_soc_dai_get_widget(
    476         struct snd_soc_dai *dai, int stream)
    477 {
    478         return (stream == SNDRV_PCM_STREAM_PLAYBACK) ?
    479                 dai->playback_widget : dai->capture_widget;
    480 }
    481 
    482 static inline void *snd_soc_dai_get_dma_data(const struct snd_soc_dai *dai,
    483                                              const struct snd_pcm_substream *ss)
    484 {
    485         return (ss->stream == SNDRV_PCM_STREAM_PLAYBACK) ?
    486                 dai->playback_dma_data : dai->capture_dma_data;
    487 }
    488 
    489 static inline void snd_soc_dai_set_dma_data(struct snd_soc_dai *dai,
    490                                             const struct snd_pcm_substream *ss,
    491                                             void *data)
    492 {
    493         if (ss->stream == SNDRV_PCM_STREAM_PLAYBACK)
    494                 dai->playback_dma_data = data;
    495         else
    496                 dai->capture_dma_data = data;
    497 }
    498 
    499 static inline void snd_soc_dai_init_dma_data(struct snd_soc_dai *dai,
    500                                              void *playback, void *capture)
    501 {
    502         dai->playback_dma_data = playback;
    503         dai->capture_dma_data = capture;
     486struct snd_soc_dapm_widget *snd_soc_dai_get_widget(struct snd_soc_dai *dai, int stream)
     487{
     488        return dai->stream[stream].widget;
     489}
     490
     491#define snd_soc_dai_set_widget_playback(dai, widget)    snd_soc_dai_set_widget(dai, SNDRV_PCM_STREAM_PLAYBACK, widget)
     492#define snd_soc_dai_set_widget_capture(dai,  widget)    snd_soc_dai_set_widget(dai, SNDRV_PCM_STREAM_CAPTURE,  widget)
     493static inline
     494void snd_soc_dai_set_widget(struct snd_soc_dai *dai, int stream, struct snd_soc_dapm_widget *widget)
     495{
     496        dai->stream[stream].widget = widget;
     497}
     498
     499#define snd_soc_dai_dma_data_get_playback(dai)  snd_soc_dai_dma_data_get(dai, SNDRV_PCM_STREAM_PLAYBACK)
     500#define snd_soc_dai_dma_data_get_capture(dai)   snd_soc_dai_dma_data_get(dai, SNDRV_PCM_STREAM_CAPTURE)
     501#define snd_soc_dai_get_dma_data(dai, ss)       snd_soc_dai_dma_data_get(dai, ss->stream)
     502static inline void *snd_soc_dai_dma_data_get(const struct snd_soc_dai *dai, int stream)
     503{
     504        return dai->stream[stream].dma_data;
     505}
     506
     507#define snd_soc_dai_dma_data_set_playback(dai, data)    snd_soc_dai_dma_data_set(dai, SNDRV_PCM_STREAM_PLAYBACK, data)
     508#define snd_soc_dai_dma_data_set_capture(dai,  data)    snd_soc_dai_dma_data_set(dai, SNDRV_PCM_STREAM_CAPTURE,  data)
     509#define snd_soc_dai_set_dma_data(dai, ss, data)         snd_soc_dai_dma_data_set(dai, ss->stream, data)
     510static inline void snd_soc_dai_dma_data_set(struct snd_soc_dai *dai, int stream, void *data)
     511{
     512        dai->stream[stream].dma_data = data;
     513}
     514
     515static inline void snd_soc_dai_init_dma_data(struct snd_soc_dai *dai, void *playback, void *capture)
     516{
     517        snd_soc_dai_dma_data_set_playback(dai, playback);
     518        snd_soc_dai_dma_data_set_capture(dai,  capture);
     519}
     520
     521static inline unsigned int snd_soc_dai_tdm_mask_get(struct snd_soc_dai *dai, int stream)
     522{
     523        return dai->stream[stream].tdm_mask;
     524}
     525
     526static inline void snd_soc_dai_tdm_mask_set(struct snd_soc_dai *dai, int stream,
     527                                            unsigned int tdm_mask)
     528{
     529        dai->stream[stream].tdm_mask = tdm_mask;
     530}
     531
     532static inline unsigned int snd_soc_dai_stream_active(struct snd_soc_dai *dai, int stream)
     533{
     534        /* see snd_soc_dai_action() for setup */
     535        return dai->stream[stream].active;
    504536}
    505537
     
    516548
    517549/**
    518  * snd_soc_dai_set_sdw_stream() - Configures a DAI for SDW stream operation
     550 * snd_soc_dai_set_stream() - Configures a DAI for stream operation
    519551 * @dai: DAI
    520  * @stream: STREAM
     552 * @stream: STREAM (opaque structure depending on DAI type)
    521553 * @direction: Stream direction(Playback/Capture)
    522  * SoundWire subsystem doesn't have a notion of direction and we reuse
     554 * Some subsystems, such as SoundWire, don't have a notion of direction and we reuse
    523555 * the ASoC stream direction to configure sink/source ports.
    524556 * Playback maps to source ports and Capture for sink ports.
     
    527559 * Returns 0 on success, a negative error code otherwise.
    528560 */
    529 static inline int snd_soc_dai_set_sdw_stream(struct snd_soc_dai *dai,
    530                                 void *stream, int direction)
    531 {
    532         if (dai->driver->ops->set_sdw_stream)
    533                 return dai->driver->ops->set_sdw_stream(dai, stream, direction);
     561static inline int snd_soc_dai_set_stream(struct snd_soc_dai *dai,
     562                                         void *stream, int direction)
     563{
     564        if (dai->driver->ops->set_stream)
     565                return dai->driver->ops->set_stream(dai, stream, direction);
    534566        else
    535567                return -ENOTSUPP;
     
    537569
    538570/**
    539  * snd_soc_dai_get_sdw_stream() - Retrieves SDW stream from DAI
     571 * snd_soc_dai_get_stream() - Retrieves stream from DAI
    540572 * @dai: DAI
    541573 * @direction: Stream direction(Playback/Capture)
    542574 *
    543575 * This routine only retrieves that was previously configured
    544  * with snd_soc_dai_get_sdw_stream()
     576 * with snd_soc_dai_get_stream()
    545577 *
    546578 * Returns pointer to stream or an ERR_PTR value, e.g.
    547579 * ERR_PTR(-ENOTSUPP) if callback is not supported;
    548580 */
    549 static inline void *snd_soc_dai_get_sdw_stream(struct snd_soc_dai *dai,
    550                                                int direction)
    551 {
    552         if (dai->driver->ops->get_sdw_stream)
    553                 return dai->driver->ops->get_sdw_stream(dai, direction);
     581static inline void *snd_soc_dai_get_stream(struct snd_soc_dai *dai,
     582                                           int direction)
     583{
     584        if (dai->driver->ops->get_stream)
     585                return dai->driver->ops->get_stream(dai, direction);
    554586        else
    555587                return ERR_PTR(-ENOTSUPP);
    556588}
    557589
    558 static inline unsigned int
    559 snd_soc_dai_stream_active(struct snd_soc_dai *dai, int stream)
    560 {
    561         return dai->stream_active[stream];
    562 }
    563 
    564590#endif
  • GPL/trunk/alsa-kernel/include/sound/soc-dapm.h

    r679 r772  
    1717
    1818struct device;
     19struct snd_pcm_substream;
    1920struct snd_soc_pcm_runtime;
    2021struct soc_enum;
     
    4243/* codec domain */
    4344#define SND_SOC_DAPM_VMID(wname) \
    44 {       .id = snd_soc_dapm_vmid, .name = wname, .kcontrol_news = NULL, \
     45(struct snd_soc_dapm_widget) { \
     46        .id = snd_soc_dapm_vmid, .name = wname, .kcontrol_news = NULL, \
    4547        .num_kcontrols = 0}
    4648
    4749/* platform domain */
    4850#define SND_SOC_DAPM_SIGGEN(wname) \
    49 {       .id = snd_soc_dapm_siggen, .name = wname, .kcontrol_news = NULL, \
     51(struct snd_soc_dapm_widget) { \
     52        .id = snd_soc_dapm_siggen, .name = wname, .kcontrol_news = NULL, \
    5053        .num_kcontrols = 0, .reg = SND_SOC_NOPM }
    5154#define SND_SOC_DAPM_SINK(wname) \
    52 {       .id = snd_soc_dapm_sink, .name = wname, .kcontrol_news = NULL, \
     55(struct snd_soc_dapm_widget) { \
     56        .id = snd_soc_dapm_sink, .name = wname, .kcontrol_news = NULL, \
    5357        .num_kcontrols = 0, .reg = SND_SOC_NOPM }
    5458#define SND_SOC_DAPM_INPUT(wname) \
    55 {       .id = snd_soc_dapm_input, .name = wname, .kcontrol_news = NULL, \
     59(struct snd_soc_dapm_widget) { \
     60        .id = snd_soc_dapm_input, .name = wname, .kcontrol_news = NULL, \
    5661        .num_kcontrols = 0, .reg = SND_SOC_NOPM }
    5762#define SND_SOC_DAPM_OUTPUT(wname) \
    58 {       .id = snd_soc_dapm_output, .name = wname, .kcontrol_news = NULL, \
     63(struct snd_soc_dapm_widget) { \
     64        .id = snd_soc_dapm_output, .name = wname, .kcontrol_news = NULL, \
    5965        .num_kcontrols = 0, .reg = SND_SOC_NOPM }
    6066#define SND_SOC_DAPM_MIC(wname, wevent) \
    61 {       .id = snd_soc_dapm_mic, .name = wname, .kcontrol_news = NULL, \
     67(struct snd_soc_dapm_widget) { \
     68        .id = snd_soc_dapm_mic, .name = wname, .kcontrol_news = NULL, \
    6269        .num_kcontrols = 0, .reg = SND_SOC_NOPM, .event = wevent, \
    6370        .event_flags = SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD}
    6471#define SND_SOC_DAPM_HP(wname, wevent) \
    65 {       .id = snd_soc_dapm_hp, .name = wname, .kcontrol_news = NULL, \
     72(struct snd_soc_dapm_widget) { \
     73        .id = snd_soc_dapm_hp, .name = wname, .kcontrol_news = NULL, \
    6674        .num_kcontrols = 0, .reg = SND_SOC_NOPM, .event = wevent, \
    6775        .event_flags = SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD}
    6876#define SND_SOC_DAPM_SPK(wname, wevent) \
    69 {       .id = snd_soc_dapm_spk, .name = wname, .kcontrol_news = NULL, \
     77(struct snd_soc_dapm_widget) { \
     78        .id = snd_soc_dapm_spk, .name = wname, .kcontrol_news = NULL, \
    7079        .num_kcontrols = 0, .reg = SND_SOC_NOPM, .event = wevent, \
    7180        .event_flags = SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD}
    7281#define SND_SOC_DAPM_LINE(wname, wevent) \
    73 {       .id = snd_soc_dapm_line, .name = wname, .kcontrol_news = NULL, \
     82(struct snd_soc_dapm_widget) { \
     83        .id = snd_soc_dapm_line, .name = wname, .kcontrol_news = NULL, \
    7484        .num_kcontrols = 0, .reg = SND_SOC_NOPM, .event = wevent, \
    7585        .event_flags = SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD}
     
    8292#define SND_SOC_DAPM_PGA(wname, wreg, wshift, winvert,\
    8393         wcontrols, wncontrols) \
    84 {       .id = snd_soc_dapm_pga, .name = wname, \
     94(struct snd_soc_dapm_widget) { \
     95        .id = snd_soc_dapm_pga, .name = wname, \
    8596        SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
    8697        .kcontrol_news = wcontrols, .num_kcontrols = wncontrols}
    8798#define SND_SOC_DAPM_OUT_DRV(wname, wreg, wshift, winvert,\
    8899         wcontrols, wncontrols) \
    89 {       .id = snd_soc_dapm_out_drv, .name = wname, \
     100(struct snd_soc_dapm_widget) { \
     101        .id = snd_soc_dapm_out_drv, .name = wname, \
    90102        SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
    91103        .kcontrol_news = wcontrols, .num_kcontrols = wncontrols}
    92104#define SND_SOC_DAPM_MIXER(wname, wreg, wshift, winvert, \
    93105         wcontrols, wncontrols)\
    94 {       .id = snd_soc_dapm_mixer, .name = wname, \
     106(struct snd_soc_dapm_widget) { \
     107        .id = snd_soc_dapm_mixer, .name = wname, \
    95108        SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
    96109        .kcontrol_news = wcontrols, .num_kcontrols = wncontrols}
    97110#define SND_SOC_DAPM_MIXER_NAMED_CTL(wname, wreg, wshift, winvert, \
    98111         wcontrols, wncontrols)\
    99 {       .id = snd_soc_dapm_mixer_named_ctl, .name = wname, \
     112(struct snd_soc_dapm_widget) { \
     113        .id = snd_soc_dapm_mixer_named_ctl, .name = wname, \
    100114        SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
    101115        .kcontrol_news = wcontrols, .num_kcontrols = wncontrols}
    102116/* DEPRECATED: use SND_SOC_DAPM_SUPPLY */
    103117#define SND_SOC_DAPM_MICBIAS(wname, wreg, wshift, winvert) \
    104 {       .id = snd_soc_dapm_micbias, .name = wname, \
     118(struct snd_soc_dapm_widget) { \
     119        .id = snd_soc_dapm_micbias, .name = wname, \
    105120        SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
    106121        .kcontrol_news = NULL, .num_kcontrols = 0}
    107122#define SND_SOC_DAPM_SWITCH(wname, wreg, wshift, winvert, wcontrols) \
    108 {       .id = snd_soc_dapm_switch, .name = wname, \
     123(struct snd_soc_dapm_widget) { \
     124        .id = snd_soc_dapm_switch, .name = wname, \
    109125        SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
    110126        .kcontrol_news = wcontrols, .num_kcontrols = 1}
    111127#define SND_SOC_DAPM_MUX(wname, wreg, wshift, winvert, wcontrols) \
    112 {       .id = snd_soc_dapm_mux, .name = wname, \
     128(struct snd_soc_dapm_widget) { \
     129        .id = snd_soc_dapm_mux, .name = wname, \
    113130        SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
    114131        .kcontrol_news = wcontrols, .num_kcontrols = 1}
    115132#define SND_SOC_DAPM_DEMUX(wname, wreg, wshift, winvert, wcontrols) \
    116 {       .id = snd_soc_dapm_demux, .name = wname, \
     133(struct snd_soc_dapm_widget) { \
     134        .id = snd_soc_dapm_demux, .name = wname, \
    117135        SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
    118136        .kcontrol_news = wcontrols, .num_kcontrols = 1}
     
    121139#define SOC_PGA_ARRAY(wname, wreg, wshift, winvert,\
    122140         wcontrols) \
    123 {       .id = snd_soc_dapm_pga, .name = wname, \
     141(struct snd_soc_dapm_widget) { \
     142        .id = snd_soc_dapm_pga, .name = wname, \
    124143        SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
    125144        .kcontrol_news = wcontrols, .num_kcontrols = ARRAY_SIZE(wcontrols)}
    126145#define SOC_MIXER_ARRAY(wname, wreg, wshift, winvert, \
    127146         wcontrols)\
    128 {       .id = snd_soc_dapm_mixer, .name = wname, \
     147(struct snd_soc_dapm_widget) { \
     148        .id = snd_soc_dapm_mixer, .name = wname, \
    129149        SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
    130150        .kcontrol_news = wcontrols, .num_kcontrols = ARRAY_SIZE(wcontrols)}
    131151#define SOC_MIXER_NAMED_CTL_ARRAY(wname, wreg, wshift, winvert, \
    132152         wcontrols)\
    133 {       .id = snd_soc_dapm_mixer_named_ctl, .name = wname, \
     153(struct snd_soc_dapm_widget) { \
     154        .id = snd_soc_dapm_mixer_named_ctl, .name = wname, \
    134155        SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
    135156        .kcontrol_news = wcontrols, .num_kcontrols = ARRAY_SIZE(wcontrols)}
     
    138159#define SND_SOC_DAPM_PGA_E(wname, wreg, wshift, winvert, wcontrols, \
    139160        wncontrols, wevent, wflags) \
    140 {       .id = snd_soc_dapm_pga, .name = wname, \
     161(struct snd_soc_dapm_widget) { \
     162        .id = snd_soc_dapm_pga, .name = wname, \
    141163        SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
    142164        .kcontrol_news = wcontrols, .num_kcontrols = wncontrols, \
     
    144166#define SND_SOC_DAPM_OUT_DRV_E(wname, wreg, wshift, winvert, wcontrols, \
    145167        wncontrols, wevent, wflags) \
    146 {       .id = snd_soc_dapm_out_drv, .name = wname, \
     168(struct snd_soc_dapm_widget) { \
     169        .id = snd_soc_dapm_out_drv, .name = wname, \
    147170        SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
    148171        .kcontrol_news = wcontrols, .num_kcontrols = wncontrols, \
     
    150173#define SND_SOC_DAPM_MIXER_E(wname, wreg, wshift, winvert, wcontrols, \
    151174        wncontrols, wevent, wflags) \
    152 {       .id = snd_soc_dapm_mixer, .name = wname, \
     175(struct snd_soc_dapm_widget) { \
     176        .id = snd_soc_dapm_mixer, .name = wname, \
    153177        SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
    154178        .kcontrol_news = wcontrols, .num_kcontrols = wncontrols, \
     
    156180#define SND_SOC_DAPM_MIXER_NAMED_CTL_E(wname, wreg, wshift, winvert, \
    157181        wcontrols, wncontrols, wevent, wflags) \
    158 {       .id = snd_soc_dapm_mixer, .name = wname, \
     182(struct snd_soc_dapm_widget) { \
     183        .id = snd_soc_dapm_mixer, .name = wname, \
    159184        SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
    160185        .kcontrol_news = wcontrols, \
     
    162187#define SND_SOC_DAPM_SWITCH_E(wname, wreg, wshift, winvert, wcontrols, \
    163188        wevent, wflags) \
    164 {       .id = snd_soc_dapm_switch, .name = wname, \
     189(struct snd_soc_dapm_widget) { \
     190        .id = snd_soc_dapm_switch, .name = wname, \
    165191        SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
    166192        .kcontrol_news = wcontrols, .num_kcontrols = 1, \
     
    168194#define SND_SOC_DAPM_MUX_E(wname, wreg, wshift, winvert, wcontrols, \
    169195        wevent, wflags) \
    170 {       .id = snd_soc_dapm_mux, .name = wname, \
     196(struct snd_soc_dapm_widget) { \
     197        .id = snd_soc_dapm_mux, .name = wname, \
    171198        SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
    172199        .kcontrol_news = wcontrols, .num_kcontrols = 1, \
     
    176203#define SND_SOC_DAPM_PGA_S(wname, wsubseq, wreg, wshift, winvert, \
    177204        wevent, wflags) \
    178 {       .id = snd_soc_dapm_pga, .name = wname, \
     205(struct snd_soc_dapm_widget) { \
     206        .id = snd_soc_dapm_pga, .name = wname, \
    179207        SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
    180208        .event = wevent, .event_flags = wflags, \
     
    182210#define SND_SOC_DAPM_SUPPLY_S(wname, wsubseq, wreg, wshift, winvert, wevent, \
    183211        wflags) \
    184 {       .id = snd_soc_dapm_supply, .name = wname, \
     212(struct snd_soc_dapm_widget) { \
     213        .id = snd_soc_dapm_supply, .name = wname, \
    185214        SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
    186215        .event = wevent, .event_flags = wflags, .subseq = wsubseq}
     
    189218#define SOC_PGA_E_ARRAY(wname, wreg, wshift, winvert, wcontrols, \
    190219        wevent, wflags) \
    191 {       .id = snd_soc_dapm_pga, .name = wname, \
     220(struct snd_soc_dapm_widget) { \
     221        .id = snd_soc_dapm_pga, .name = wname, \
    192222        SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
    193223        .kcontrol_news = wcontrols, .num_kcontrols = ARRAY_SIZE(wcontrols), \
     
    195225#define SOC_MIXER_E_ARRAY(wname, wreg, wshift, winvert, wcontrols, \
    196226        wevent, wflags) \
    197 {       .id = snd_soc_dapm_mixer, .name = wname, \
     227(struct snd_soc_dapm_widget) { \
     228        .id = snd_soc_dapm_mixer, .name = wname, \
    198229        SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
    199230        .kcontrol_news = wcontrols, .num_kcontrols = ARRAY_SIZE(wcontrols), \
     
    201232#define SOC_MIXER_NAMED_CTL_E_ARRAY(wname, wreg, wshift, winvert, \
    202233        wcontrols, wevent, wflags) \
    203 {       .id = snd_soc_dapm_mixer, .name = wname, \
     234(struct snd_soc_dapm_widget) { \
     235        .id = snd_soc_dapm_mixer, .name = wname, \
    204236        SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
    205237        .kcontrol_news = wcontrols, .num_kcontrols = ARRAY_SIZE(wcontrols), \
     
    208240/* events that are pre and post DAPM */
    209241#define SND_SOC_DAPM_PRE(wname, wevent) \
    210 {       .id = snd_soc_dapm_pre, .name = wname, .kcontrol_news = NULL, \
     242(struct snd_soc_dapm_widget) { \
     243        .id = snd_soc_dapm_pre, .name = wname, .kcontrol_news = NULL, \
    211244        .num_kcontrols = 0, .reg = SND_SOC_NOPM, .event = wevent, \
    212245        .event_flags = SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_PRE_PMD}
    213246#define SND_SOC_DAPM_POST(wname, wevent) \
    214 {       .id = snd_soc_dapm_post, .name = wname, .kcontrol_news = NULL, \
     247(struct snd_soc_dapm_widget) { \
     248        .id = snd_soc_dapm_post, .name = wname, .kcontrol_news = NULL, \
    215249        .num_kcontrols = 0, .reg = SND_SOC_NOPM, .event = wevent, \
    216250        .event_flags = SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD}
     
    218252/* stream domain */
    219253#define SND_SOC_DAPM_AIF_IN(wname, stname, wchan, wreg, wshift, winvert) \
    220 {       .id = snd_soc_dapm_aif_in, .name = wname, .sname = stname, \
     254(struct snd_soc_dapm_widget) { \
     255        .id = snd_soc_dapm_aif_in, .name = wname, .sname = stname, \
    221256        .channel = wchan, SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), }
    222257#define SND_SOC_DAPM_AIF_IN_E(wname, stname, wchan, wreg, wshift, winvert, \
    223258                              wevent, wflags)                           \
    224 {       .id = snd_soc_dapm_aif_in, .name = wname, .sname = stname, \
     259(struct snd_soc_dapm_widget) { \
     260        .id = snd_soc_dapm_aif_in, .name = wname, .sname = stname, \
    225261        .channel = wchan, SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
    226262        .event = wevent, .event_flags = wflags }
    227263#define SND_SOC_DAPM_AIF_OUT(wname, stname, wchan, wreg, wshift, winvert) \
    228 {       .id = snd_soc_dapm_aif_out, .name = wname, .sname = stname, \
     264(struct snd_soc_dapm_widget) { \
     265        .id = snd_soc_dapm_aif_out, .name = wname, .sname = stname, \
    229266        .channel = wchan, SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), }
    230267#define SND_SOC_DAPM_AIF_OUT_E(wname, stname, wchan, wreg, wshift, winvert, \
    231268                             wevent, wflags)                            \
    232 {       .id = snd_soc_dapm_aif_out, .name = wname, .sname = stname, \
     269(struct snd_soc_dapm_widget) { \
     270        .id = snd_soc_dapm_aif_out, .name = wname, .sname = stname, \
    233271        .channel = wchan, SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
    234272        .event = wevent, .event_flags = wflags }
    235273#define SND_SOC_DAPM_DAC(wname, stname, wreg, wshift, winvert) \
    236 {       .id = snd_soc_dapm_dac, .name = wname, .sname = stname, \
     274(struct snd_soc_dapm_widget) { \
     275        .id = snd_soc_dapm_dac, .name = wname, .sname = stname, \
    237276        SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert) }
    238277#define SND_SOC_DAPM_DAC_E(wname, stname, wreg, wshift, winvert, \
    239278                           wevent, wflags)                              \
    240 {       .id = snd_soc_dapm_dac, .name = wname, .sname = stname, \
     279(struct snd_soc_dapm_widget) { \
     280        .id = snd_soc_dapm_dac, .name = wname, .sname = stname, \
    241281        SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
    242282        .event = wevent, .event_flags = wflags}
    243283
    244284#define SND_SOC_DAPM_ADC(wname, stname, wreg, wshift, winvert) \
    245 {       .id = snd_soc_dapm_adc, .name = wname, .sname = stname, \
     285(struct snd_soc_dapm_widget) { \
     286        .id = snd_soc_dapm_adc, .name = wname, .sname = stname, \
    246287        SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), }
    247288#define SND_SOC_DAPM_ADC_E(wname, stname, wreg, wshift, winvert, \
    248289                           wevent, wflags)                              \
    249 {       .id = snd_soc_dapm_adc, .name = wname, .sname = stname, \
     290(struct snd_soc_dapm_widget) { \
     291        .id = snd_soc_dapm_adc, .name = wname, .sname = stname, \
    250292        SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
    251293        .event = wevent, .event_flags = wflags}
    252294#define SND_SOC_DAPM_CLOCK_SUPPLY(wname) \
    253 {       .id = snd_soc_dapm_clock_supply, .name = wname, \
     295(struct snd_soc_dapm_widget) { \
     296        .id = snd_soc_dapm_clock_supply, .name = wname, \
    254297        .reg = SND_SOC_NOPM, .event = dapm_clock_event, \
    255298        .event_flags = SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD }
     
    257300/* generic widgets */
    258301#define SND_SOC_DAPM_REG(wid, wname, wreg, wshift, wmask, won_val, woff_val) \
    259 {       .id = wid, .name = wname, .kcontrol_news = NULL, .num_kcontrols = 0, \
     302(struct snd_soc_dapm_widget) { \
     303        .id = wid, .name = wname, .kcontrol_news = NULL, .num_kcontrols = 0, \
    260304        .reg = wreg, .shift = wshift, .mask = wmask, \
    261305        .on_val = won_val, .off_val = woff_val, }
    262306#define SND_SOC_DAPM_SUPPLY(wname, wreg, wshift, winvert, wevent, wflags) \
    263 {       .id = snd_soc_dapm_supply, .name = wname, \
     307(struct snd_soc_dapm_widget) { \
     308        .id = snd_soc_dapm_supply, .name = wname, \
    264309        SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
    265310        .event = wevent, .event_flags = wflags}
    266311#define SND_SOC_DAPM_REGULATOR_SUPPLY(wname, wdelay, wflags)        \
    267 {       .id = snd_soc_dapm_regulator_supply, .name = wname, \
     312(struct snd_soc_dapm_widget) { \
     313        .id = snd_soc_dapm_regulator_supply, .name = wname, \
    268314        .reg = SND_SOC_NOPM, .shift = wdelay, .event = dapm_regulator_event, \
    269315        .event_flags = SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD, \
    270316        .on_val = wflags}
    271317#define SND_SOC_DAPM_PINCTRL(wname, active, sleep) \
    272 {       .id = snd_soc_dapm_pinctrl, .name = wname, \
     318(struct snd_soc_dapm_widget) { \
     319        .id = snd_soc_dapm_pinctrl, .name = wname, \
    273320        .priv = (&(struct snd_soc_dapm_pinctrl_priv) \
    274321                { .active_state = active, .sleep_state = sleep,}), \
     
    342389#define SND_SOC_DAPM_STREAM_SUSPEND             0x4
    343390#define SND_SOC_DAPM_STREAM_RESUME              0x8
    344 #define SND_SOC_DAPM_STREAM_PAUSE_PUSH  0x10
     391#define SND_SOC_DAPM_STREAM_PAUSE_PUSH          0x10
    345392#define SND_SOC_DAPM_STREAM_PAUSE_RELEASE       0x20
    346393
    347394/* dapm event types */
    348 #define SND_SOC_DAPM_PRE_PMU    0x1     /* before widget power up */
    349 #define SND_SOC_DAPM_POST_PMU   0x2             /* after widget power up */
    350 #define SND_SOC_DAPM_PRE_PMD    0x4     /* before widget power down */
    351 #define SND_SOC_DAPM_POST_PMD   0x8             /* after widget power down */
    352 #define SND_SOC_DAPM_PRE_REG    0x10    /* before audio path setup */
    353 #define SND_SOC_DAPM_POST_REG   0x20    /* after audio path setup */
    354 #define SND_SOC_DAPM_WILL_PMU   0x40    /* called at start of sequence */
    355 #define SND_SOC_DAPM_WILL_PMD   0x80    /* called at start of sequence */
    356 #define SND_SOC_DAPM_PRE_POST_PMD \
    357                                 (SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD)
    358 #define SND_SOC_DAPM_PRE_POST_PMU \
    359                                 (SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU)
     395#define SND_SOC_DAPM_PRE_PMU            0x1     /* before widget power up */
     396#define SND_SOC_DAPM_POST_PMU           0x2     /* after  widget power up */
     397#define SND_SOC_DAPM_PRE_PMD            0x4     /* before widget power down */
     398#define SND_SOC_DAPM_POST_PMD           0x8     /* after  widget power down */
     399#define SND_SOC_DAPM_PRE_REG            0x10    /* before audio path setup */
     400#define SND_SOC_DAPM_POST_REG           0x20    /* after  audio path setup */
     401#define SND_SOC_DAPM_WILL_PMU           0x40    /* called at start of sequence */
     402#define SND_SOC_DAPM_WILL_PMD           0x80    /* called at start of sequence */
     403#define SND_SOC_DAPM_PRE_POST_PMD       (SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD)
     404#define SND_SOC_DAPM_PRE_POST_PMU       (SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU)
    360405
    361406/* convenience event type detection */
    362 #define SND_SOC_DAPM_EVENT_ON(e)        \
    363         (e & (SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU))
    364 #define SND_SOC_DAPM_EVENT_OFF(e)       \
    365         (e & (SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD))
     407#define SND_SOC_DAPM_EVENT_ON(e)        (e & (SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU))
     408#define SND_SOC_DAPM_EVENT_OFF(e)       (e & (SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD))
    366409
    367410/* regulator widget flags */
    368 #define SND_SOC_DAPM_REGULATOR_BYPASS     0x1     /* bypass when disabled */
     411#define SND_SOC_DAPM_REGULATOR_BYPASS   0x1     /* bypass when disabled */
    369412
    370413struct snd_soc_dapm_widget;
     
    397440};
    398441
    399 int dapm_regulator_event(struct snd_soc_dapm_widget *w,
    400                          struct snd_kcontrol *kcontrol, int event);
    401 int dapm_clock_event(struct snd_soc_dapm_widget *w,
    402                          struct snd_kcontrol *kcontrol, int event);
    403 int dapm_pinctrl_event(struct snd_soc_dapm_widget *w,
    404                          struct snd_kcontrol *kcontrol, int event);
     442int dapm_regulator_event(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, int event);
     443int dapm_clock_event(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, int event);
     444int dapm_pinctrl_event(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, int event);
    405445
    406446/* dapm controls */
    407 int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol,
    408         struct snd_ctl_elem_value *ucontrol);
    409 int snd_soc_dapm_get_volsw(struct snd_kcontrol *kcontrol,
    410         struct snd_ctl_elem_value *ucontrol);
     447int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol);
     448int snd_soc_dapm_get_volsw(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol);
    411449int snd_soc_dapm_get_enum_double(struct snd_kcontrol *kcontrol,
    412450        struct snd_ctl_elem_value *ucontrol);
     
    420458        struct snd_ctl_elem_value *uncontrol);
    421459int snd_soc_dapm_new_controls(struct snd_soc_dapm_context *dapm,
    422         const struct snd_soc_dapm_widget *widget,
    423         int num);
    424 struct snd_soc_dapm_widget *snd_soc_dapm_new_control(
    425                 struct snd_soc_dapm_context *dapm,
     460        const struct snd_soc_dapm_widget *widget, int num);
     461struct snd_soc_dapm_widget *snd_soc_dapm_new_control(struct snd_soc_dapm_context *dapm,
    426462                const struct snd_soc_dapm_widget *widget);
    427 struct snd_soc_dapm_widget *snd_soc_dapm_new_control_unlocked(
    428                 struct snd_soc_dapm_context *dapm,
     463struct snd_soc_dapm_widget *snd_soc_dapm_new_control_unlocked(struct snd_soc_dapm_context *dapm,
    429464                const struct snd_soc_dapm_widget *widget);
    430 int snd_soc_dapm_new_dai_widgets(struct snd_soc_dapm_context *dapm,
    431                                  struct snd_soc_dai *dai);
     465int snd_soc_dapm_new_dai_widgets(struct snd_soc_dapm_context *dapm, struct snd_soc_dai *dai);
     466void snd_soc_dapm_free_widget(struct snd_soc_dapm_widget *w);
    432467int snd_soc_dapm_link_dai_widgets(struct snd_soc_card *card);
    433468void snd_soc_dapm_connect_dai_link_widgets(struct snd_soc_card *card);
    434469
    435470int snd_soc_dapm_update_dai(struct snd_pcm_substream *substream,
    436                             struct snd_pcm_hw_params *params,
    437                             struct snd_soc_dai *dai);
     471                            struct snd_pcm_hw_params *params, struct snd_soc_dai *dai);
     472int snd_soc_dapm_widget_name_cmp(struct snd_soc_dapm_widget *widget, const char *s);
    438473
    439474/* dapm path setup */
     
    441476void snd_soc_dapm_free(struct snd_soc_dapm_context *dapm);
    442477void snd_soc_dapm_init(struct snd_soc_dapm_context *dapm,
    443                        struct snd_soc_card *card,
    444                        struct snd_soc_component *component);
     478                       struct snd_soc_card *card, struct snd_soc_component *component);
    445479int snd_soc_dapm_add_routes(struct snd_soc_dapm_context *dapm,
    446480                            const struct snd_soc_dapm_route *route, int num);
     
    450484                             const struct snd_soc_dapm_route *route, int num);
    451485void snd_soc_dapm_free_widget(struct snd_soc_dapm_widget *w);
    452 void snd_soc_dapm_reset_cache(struct snd_soc_dapm_context *dapm);
    453486
    454487/* dapm events */
    455 void snd_soc_dapm_stream_event(struct snd_soc_pcm_runtime *rtd, int stream,
    456         int event);
     488void snd_soc_dapm_stream_event(struct snd_soc_pcm_runtime *rtd, int stream, int event);
    457489void snd_soc_dapm_stream_stop(struct snd_soc_pcm_runtime *rtd, int stream);
    458490void snd_soc_dapm_shutdown(struct snd_soc_card *card);
     
    460492/* external DAPM widget events */
    461493int snd_soc_dapm_mixer_update_power(struct snd_soc_dapm_context *dapm,
    462                 struct snd_kcontrol *kcontrol, int connect,
    463                 struct snd_soc_dapm_update *update);
     494                struct snd_kcontrol *kcontrol, int connect, struct snd_soc_dapm_update *update);
    464495int snd_soc_dapm_mux_update_power(struct snd_soc_dapm_context *dapm,
    465496                struct snd_kcontrol *kcontrol, int mux, struct soc_enum *e,
     
    468499/* dapm sys fs - used by the core */
    469500extern struct attribute *soc_dapm_dev_attrs[];
    470 void snd_soc_dapm_debugfs_init(struct snd_soc_dapm_context *dapm,
    471                                 struct dentry *parent);
     501void snd_soc_dapm_debugfs_init(struct snd_soc_dapm_context *dapm, struct dentry *parent);
    472502
    473503/* dapm audio pin control and status */
    474 int snd_soc_dapm_enable_pin(struct snd_soc_dapm_context *dapm,
    475                             const char *pin);
    476 int snd_soc_dapm_enable_pin_unlocked(struct snd_soc_dapm_context *dapm,
    477                                      const char *pin);
    478 int snd_soc_dapm_disable_pin(struct snd_soc_dapm_context *dapm,
    479                              const char *pin);
    480 int snd_soc_dapm_disable_pin_unlocked(struct snd_soc_dapm_context *dapm,
    481                                       const char *pin);
     504int snd_soc_dapm_enable_pin(struct snd_soc_dapm_context *dapm, const char *pin);
     505int snd_soc_dapm_enable_pin_unlocked(struct snd_soc_dapm_context *dapm, const char *pin);
     506int snd_soc_dapm_disable_pin(struct snd_soc_dapm_context *dapm, const char *pin);
     507int snd_soc_dapm_disable_pin_unlocked(struct snd_soc_dapm_context *dapm, const char *pin);
    482508int snd_soc_dapm_nc_pin(struct snd_soc_dapm_context *dapm, const char *pin);
    483 int snd_soc_dapm_nc_pin_unlocked(struct snd_soc_dapm_context *dapm,
    484                                  const char *pin);
    485 int snd_soc_dapm_get_pin_status(struct snd_soc_dapm_context *dapm,
    486                                 const char *pin);
     509int snd_soc_dapm_nc_pin_unlocked(struct snd_soc_dapm_context *dapm, const char *pin);
     510int snd_soc_dapm_get_pin_status(struct snd_soc_dapm_context *dapm, const char *pin);
    487511int snd_soc_dapm_sync(struct snd_soc_dapm_context *dapm);
    488512int snd_soc_dapm_sync_unlocked(struct snd_soc_dapm_context *dapm);
    489 int snd_soc_dapm_force_enable_pin(struct snd_soc_dapm_context *dapm,
    490                                   const char *pin);
    491 int snd_soc_dapm_force_enable_pin_unlocked(struct snd_soc_dapm_context *dapm,
    492                                            const char *pin);
    493 int snd_soc_dapm_ignore_suspend(struct snd_soc_dapm_context *dapm,
    494                                 const char *pin);
     513int snd_soc_dapm_force_enable_pin(struct snd_soc_dapm_context *dapm, const char *pin);
     514int snd_soc_dapm_force_enable_pin_unlocked(struct snd_soc_dapm_context *dapm, const char *pin);
     515int snd_soc_dapm_ignore_suspend(struct snd_soc_dapm_context *dapm, const char *pin);
    495516unsigned int dapm_kcontrol_get_value(const struct snd_kcontrol *kcontrol);
    496517
     
    501522int snd_soc_dapm_dai_get_connected_widgets(struct snd_soc_dai *dai, int stream,
    502523        struct snd_soc_dapm_widget_list **list,
    503         bool (*custom_stop_condition)(struct snd_soc_dapm_widget *,
    504                                       enum snd_soc_dapm_direction));
     524        bool (*custom_stop_condition)(struct snd_soc_dapm_widget *, enum snd_soc_dapm_direction));
    505525void snd_soc_dapm_dai_free_widgets(struct snd_soc_dapm_widget_list **list);
    506526
    507 struct snd_soc_dapm_context *snd_soc_dapm_kcontrol_dapm(
    508         struct snd_kcontrol *kcontrol);
    509 
    510 struct snd_soc_dapm_widget *snd_soc_dapm_kcontrol_widget(
    511                 struct snd_kcontrol *kcontrol);
    512 
    513 int snd_soc_dapm_force_bias_level(struct snd_soc_dapm_context *dapm,
    514         enum snd_soc_bias_level level);
     527struct snd_soc_dapm_context *snd_soc_dapm_kcontrol_dapm(struct snd_kcontrol *kcontrol);
     528struct snd_soc_dapm_widget *snd_soc_dapm_kcontrol_widget(struct snd_kcontrol *kcontrol);
     529
     530int snd_soc_dapm_force_bias_level(struct snd_soc_dapm_context *dapm, enum snd_soc_bias_level level);
    515531
    516532/* dapm widget types */
     
    518534        snd_soc_dapm_input = 0,         /* input pin */
    519535        snd_soc_dapm_output,            /* output pin */
    520         snd_soc_dapm_mux,                       /* selects 1 analog signal from many inputs */
    521         snd_soc_dapm_demux,                     /* connects the input to one of multiple outputs */
    522         snd_soc_dapm_mixer,                     /* mixes several analog signals together */
    523         snd_soc_dapm_mixer_named_ctl,           /* mixer with named controls */
    524         snd_soc_dapm_pga,                       /* programmable gain/attenuation (volume) */
    525         snd_soc_dapm_out_drv,                   /* output driver */
    526         snd_soc_dapm_adc,                       /* analog to digital converter */
    527         snd_soc_dapm_dac,                       /* digital to analog converter */
     536        snd_soc_dapm_mux,               /* selects 1 analog signal from many inputs */
     537        snd_soc_dapm_demux,             /* connects the input to one of multiple outputs */
     538        snd_soc_dapm_mixer,             /* mixes several analog signals together */
     539        snd_soc_dapm_mixer_named_ctl,   /* mixer with named controls */
     540        snd_soc_dapm_pga,               /* programmable gain/attenuation (volume) */
     541        snd_soc_dapm_out_drv,           /* output driver */
     542        snd_soc_dapm_adc,               /* analog to digital converter */
     543        snd_soc_dapm_dac,               /* digital to analog converter */
    528544        snd_soc_dapm_micbias,           /* microphone bias (power) - DEPRECATED: use snd_soc_dapm_supply */
    529         snd_soc_dapm_mic,                       /* microphone */
    530         snd_soc_dapm_hp,                        /* headphones */
    531         snd_soc_dapm_spk,                       /* speaker */
    532         snd_soc_dapm_line,                      /* line input/output */
     545        snd_soc_dapm_mic,               /* microphone */
     546        snd_soc_dapm_hp,                /* headphones */
     547        snd_soc_dapm_spk,               /* speaker */
     548        snd_soc_dapm_line,              /* line input/output */
    533549        snd_soc_dapm_switch,            /* analog switch */
    534         snd_soc_dapm_vmid,                      /* codec bias/vmid - to minimise pops */
    535         snd_soc_dapm_pre,                       /* machine specific pre widget - exec first */
    536         snd_soc_dapm_post,                      /* machine specific post widget - exec last */
     550        snd_soc_dapm_vmid,              /* codec bias/vmid - to minimise pops */
     551        snd_soc_dapm_pre,               /* machine specific pre widget - exec first */
     552        snd_soc_dapm_post,              /* machine specific post widget - exec last */
    537553        snd_soc_dapm_supply,            /* power/clock supply */
    538554        snd_soc_dapm_pinctrl,           /* pinctrl */
     
    559575};
    560576
    561 enum snd_soc_dapm_subclass {
    562         SND_SOC_DAPM_CLASS_INIT         = 0,
    563         SND_SOC_DAPM_CLASS_RUNTIME      = 1,
    564 };
    565 
    566577/*
    567578 * DAPM audio route definition.
     
    600611
    601612        /* status */
    602         u32 connect:1;  /* source and sink widgets are connected */
    603         u32 walking:1;  /* path is in the process of being walked */
    604         u32 weak:1;     /* path ignored for power management */
     613        u32 connect:1;          /* source and sink widgets are connected */
     614        u32 walking:1;          /* path is in the process of being walked */
     615        u32 weak:1;             /* path ignored for power management */
    605616        u32 is_supply:1;        /* At least one of the connected widgets is a supply */
    606617
     
    616627struct snd_soc_dapm_widget {
    617628        enum snd_soc_dapm_type id;
    618         const char *name;               /* widget name */
    619         const char *sname;      /* stream name */
     629        const char *name;                       /* widget name */
     630        const char *sname;                      /* stream name */
    620631        struct list_head list;
    621632        struct snd_soc_dapm_context *dapm;
     
    636647        unsigned char new:1;                    /* cnew complete */
    637648        unsigned char force:1;                  /* force state */
    638         unsigned char ignore_suspend:1;         /* kept enabled over suspend */
     649        unsigned char ignore_suspend:1;         /* kept enabled over suspend */
    639650        unsigned char new_power:1;              /* power from this run */
    640651        unsigned char power_checked:1;          /* power checked this run */
    641652        unsigned char is_supply:1;              /* Widget is a supply type widget */
    642653        unsigned char is_ep:2;                  /* Widget is a endpoint type widget */
     654        unsigned char no_wname_in_kcontrol_name:1; /* No widget name prefix in kcontrol name */
    643655        int subseq;                             /* sort within widget type */
    644656
     
    680692};
    681693
    682 struct snd_soc_dapm_wcache {
    683         struct snd_soc_dapm_widget *widget;
    684 };
    685 
    686694/* DAPM context */
    687695struct snd_soc_dapm_context {
    688696        enum snd_soc_bias_level bias_level;
    689         unsigned int idle_bias_off:1; /* Use BIAS_OFF instead of STANDBY */
    690         /* Go to BIAS_OFF in suspend if the DAPM context is idle */
    691         unsigned int suspend_bias_off:1;
    692 
    693         struct device *dev; /* from parent - for debug */
    694         struct snd_soc_component *component; /* parent component */
    695         struct snd_soc_card *card; /* parent card */
     697
     698        /* bit field */
     699        unsigned int idle_bias_off:1;           /* Use BIAS_OFF instead of STANDBY */
     700        unsigned int suspend_bias_off:1;        /* Use BIAS_OFF in suspend if the DAPM is idle */
     701
     702        struct device *dev;                     /* from parent - for debug */
     703        struct snd_soc_component *component;    /* parent component */
     704        struct snd_soc_card *card;              /* parent card */
    696705
    697706        /* used during DAPM updates */
     
    699708        struct list_head list;
    700709
    701         struct snd_soc_dapm_wcache path_sink_cache;
    702         struct snd_soc_dapm_wcache path_source_cache;
     710        struct snd_soc_dapm_widget *wcache_sink;
     711        struct snd_soc_dapm_widget *wcache_source;
    703712
    704713#ifdef CONFIG_DEBUG_FS
     
    767776#define SND_SOC_DAPM_DIR_TO_EP(x) BIT(x)
    768777
    769 #define SND_SOC_DAPM_EP_SOURCE SND_SOC_DAPM_DIR_TO_EP(SND_SOC_DAPM_DIR_IN)
    770 #define SND_SOC_DAPM_EP_SINK SND_SOC_DAPM_DIR_TO_EP(SND_SOC_DAPM_DIR_OUT)
     778#define SND_SOC_DAPM_EP_SOURCE  SND_SOC_DAPM_DIR_TO_EP(SND_SOC_DAPM_DIR_IN)
     779#define SND_SOC_DAPM_EP_SINK    SND_SOC_DAPM_DIR_TO_EP(SND_SOC_DAPM_DIR_OUT)
    771780
    772781/**
    773  * snd_soc_dapm_widget_for_each_sink_path - Iterates over all paths in the
     782 * snd_soc_dapm_widget_for_each_path - Iterates over all paths in the
    774783 *   specified direction of a widget
    775784 * @w: The widget
     
    782791
    783792/**
    784  * snd_soc_dapm_widget_for_each_sink_path_safe - Iterates over all paths in the
     793 * snd_soc_dapm_widget_for_each_path_safe - Iterates over all paths in the
    785794 *   specified direction of a widget
    786795 * @w: The widget
     
    790799 * @next_p: Temporary storage for the next path
    791800 *
    792  *  This function works like snd_soc_dapm_widget_for_each_sink_path, expect that
     801 *  This function works like snd_soc_dapm_widget_for_each_path, expect that
    793802 *  it is safe to remove the current path from the list while iterating
    794803 */
  • GPL/trunk/alsa-kernel/include/sound/soc-dpcm.h

    r695 r772  
    7979        struct list_head list_fe;
    8080
    81         /* hw params for this link - may be different for each link */
    82         struct snd_pcm_hw_params hw_params;
    8381#ifdef CONFIG_DEBUG_FS
    8482        struct dentry *debugfs_state;
     
    9492
    9593        int users;
    96         struct snd_pcm_runtime *runtime;
    9794        struct snd_pcm_hw_params hw_params;
    9895
     
    10299
    103100        int trigger_pending; /* trigger cmd + 1 if pending, 0 if not */
     101
     102        int be_start; /* refcount protected by BE stream pcm lock */
     103        int be_pause; /* refcount protected by BE stream pcm lock */
     104        bool fe_pause; /* used to track STOP after PAUSE */
    104105};
    105106
     
    121122int snd_soc_dpcm_can_be_params(struct snd_soc_pcm_runtime *fe,
    122123                struct snd_soc_pcm_runtime *be, int stream);
     124
     125/* can this BE perform prepare */
     126int snd_soc_dpcm_can_be_prepared(struct snd_soc_pcm_runtime *fe,
     127                                 struct snd_soc_pcm_runtime *be, int stream);
    123128
    124129/* is the current PCM operation for this FE ? */
     
    160165int dpcm_dapm_stream_event(struct snd_soc_pcm_runtime *fe, int dir,
    161166        int event);
     167bool dpcm_end_walk_at_be(struct snd_soc_dapm_widget *widget, enum snd_soc_dapm_direction dir);
     168int widget_in_list(struct snd_soc_dapm_widget_list *list,
     169                   struct snd_soc_dapm_widget *widget);
    162170
    163171#define dpcm_be_dai_startup_rollback(fe, stream, last)  \
  • GPL/trunk/alsa-kernel/include/sound/soc-topology.h

    r717 r772  
    6363        unsigned int index;     /* objects can belong in different groups */
    6464        struct list_head list;
    65         struct snd_soc_tplg_ops *ops;
     65        int (*unload)(struct snd_soc_component *comp, struct snd_soc_dobj *dobj);
    6666        union {
    6767                struct snd_soc_dobj_control control;
     
    152152
    153153        /* completion - called at completion of firmware loading */
    154         void (*complete)(struct snd_soc_component *);
     154        int (*complete)(struct snd_soc_component *comp);
    155155
    156156        /* manifest - optional to inform component of manifest */
  • 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>
  • GPL/trunk/alsa-kernel/include/sound/sof.h

    r717 r772  
    1717
    1818struct snd_sof_dsp_ops;
     19struct snd_sof_dev;
     20
     21/**
     22 * enum sof_fw_state - DSP firmware state definitions
     23 * @SOF_FW_BOOT_NOT_STARTED:    firmware boot is not yet started
     24 * @SOF_DSPLESS_MODE:           DSP is not used
     25 * @SOF_FW_BOOT_PREPARE:        preparing for boot (firmware loading for exaqmple)
     26 * @SOF_FW_BOOT_IN_PROGRESS:    firmware boot is in progress
     27 * @SOF_FW_BOOT_FAILED:         firmware boot failed
     28 * @SOF_FW_BOOT_READY_FAILED:   firmware booted but fw_ready op failed
     29 * @SOF_FW_BOOT_READY_OK:       firmware booted and fw_ready op passed
     30 * @SOF_FW_BOOT_COMPLETE:       firmware is booted up and functional
     31 * @SOF_FW_CRASHED:             firmware crashed after successful boot
     32 */
     33enum sof_fw_state {
     34        SOF_FW_BOOT_NOT_STARTED = 0,
     35        SOF_DSPLESS_MODE,
     36        SOF_FW_BOOT_PREPARE,
     37        SOF_FW_BOOT_IN_PROGRESS,
     38        SOF_FW_BOOT_FAILED,
     39        SOF_FW_BOOT_READY_FAILED,
     40        SOF_FW_BOOT_READY_OK,
     41        SOF_FW_BOOT_COMPLETE,
     42        SOF_FW_CRASHED,
     43};
     44
     45/* DSP power states */
     46enum sof_dsp_power_states {
     47        SOF_DSP_PM_D0,
     48        SOF_DSP_PM_D1,
     49        SOF_DSP_PM_D2,
     50        SOF_DSP_PM_D3,
     51};
     52
     53/* Definitions for multiple IPCs */
     54enum sof_ipc_type {
     55        SOF_IPC_TYPE_3,
     56        SOF_IPC_TYPE_4,
     57        SOF_IPC_TYPE_COUNT
     58};
     59
     60#define SOF_IPC         SOF_IPC_TYPE_3
     61#define SOF_INTEL_IPC4  SOF_IPC_TYPE_4
    1962
    2063/*
     
    2265 */
    2366struct snd_sof_pdata {
    24         const struct firmware *fw;
    2567        const char *name;
    2668        const char *platform;
    2769
     70        /*
     71         * PCI SSID. As PCI does not define 0 as invalid, the subsystem_id_set
     72         * flag indicates that a value has been written to these members.
     73         */
     74        unsigned short subsystem_vendor;
     75        unsigned short subsystem_device;
     76        bool subsystem_id_set;
     77
    2878        struct device *dev;
    29 
    30         /* indicate how many first bytes shouldn't be loaded into DSP memory. */
    31         size_t fw_offset;
    3279
    3380        /*
     
    4996        const char *tplg_filename;
    5097
     98        /* loadable external libraries available under this directory */
     99        const char *fw_lib_prefix;
     100
    51101        /* machine */
    52102        struct platform_device *pdev_mach;
    53103        const struct snd_soc_acpi_mach *machine;
     104        const struct snd_sof_of_mach *of_machine;
    54105
    55106        void *hw_pdata;
     107
     108        enum sof_ipc_type ipc_type;
    56109};
    57110
     
    63116        /* list of machines using this configuration */
    64117        struct snd_soc_acpi_mach *machines;
     118        struct snd_sof_of_mach *of_machines;
    65119
    66120        /* alternate list of machines using this configuration */
     
    75129        int resindex_imr_base;
    76130        int irqindex_host_ipc;
    77         int resindex_dma_base;
    78 
    79         /* DMA only valid when resindex_dma_base != -1*/
    80         int dma_engine;
    81         int dma_size;
    82131
    83132        /* IPC timeouts in ms */
     
    91140        const char *nocodec_tplg_filename;
    92141
    93         /* defaults paths for firmware and topology files */
    94         const char *default_fw_path;
    95         const char *default_tplg_path;
     142        /* information on supported IPCs */
     143        unsigned int ipc_supported_mask;
     144        enum sof_ipc_type ipc_default;
     145
     146        /* The platform supports DSPless mode */
     147        bool dspless_mode_supported;
     148
     149        /* defaults paths for firmware, library and topology files */
     150        const char *default_fw_path[SOF_IPC_TYPE_COUNT];
     151        const char *default_lib_path[SOF_IPC_TYPE_COUNT];
     152        const char *default_tplg_path[SOF_IPC_TYPE_COUNT];
    96153
    97154        /* default firmware name */
    98         const char *default_fw_filename;
     155        const char *default_fw_filename[SOF_IPC_TYPE_COUNT];
    99156
    100         const struct snd_sof_dsp_ops *ops;
     157        struct snd_sof_dsp_ops *ops;
     158        int (*ops_init)(struct snd_sof_dev *sdev);
     159        void (*ops_free)(struct snd_sof_dev *sdev);
    101160};
    102161
  • GPL/trunk/alsa-kernel/include/sound/version.h

    r717 r772  
    11/* include/version.h */
    2 #define CONFIG_SND_VERSION "5.15.59"
     2#define CONFIG_SND_VERSION "6.6.85"
    33#define CONFIG_SND_DATE ""
  • GPL/trunk/alsa-kernel/include/uapi/sound/asequencer.h

    r615 r772  
    44 *  Copyright (c) 1998-1999 by Frank van de Pol <fvdpol@coil.demon.nl>
    55 *            (c) 1998-1999 by Jaroslav Kysela <perex@perex.cz>
    6  *
    7  *
    8  *   This program is free software; you can redistribute it and/or modify
    9  *   it under the terms of the GNU General Public License as published by
    10  *   the Free Software Foundation; either version 2 of the License, or
    11  *   (at your option) any later version.
    12  *
    13  *   This program is distributed in the hope that it will be useful,
    14  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
    15  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    16  *   GNU General Public License for more details.
    17  *
    18  *   You should have received a copy of the GNU General Public License
    19  *   along with this program; if not, write to the Free Software
    20  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
    21  *
    226 */
    237#ifndef _UAPI__SOUND_ASEQUENCER_H
     
    2711
    2812/** version of the sequencer */
    29 #define SNDRV_SEQ_VERSION SNDRV_PROTOCOL_VERSION(1, 0, 2)
     13#define SNDRV_SEQ_VERSION SNDRV_PROTOCOL_VERSION(1, 0, 3)
    3014
    3115/**
     
    191175#define SNDRV_SEQ_PRIORITY_MASK         (1<<4)
    192176
     177#define SNDRV_SEQ_EVENT_UMP             (1<<5)  /* event holds a UMP packet */
    193178
    194179        /* note event */
     
    288273#endif
    289274
     275union snd_seq_event_data { /* event data... */
     276        struct snd_seq_ev_note note;
     277        struct snd_seq_ev_ctrl control;
     278        struct snd_seq_ev_raw8 raw8;
     279        struct snd_seq_ev_raw32 raw32;
     280        struct snd_seq_ev_ext ext;
     281        struct snd_seq_ev_queue_control queue;
     282        union snd_seq_timestamp time;
     283        struct snd_seq_addr addr;
     284        struct snd_seq_connect connect;
     285        struct snd_seq_result result;
     286        struct snd_seq_ev_quote quote;
     287};
    290288
    291289        /* sequencer event */
     
    298296        union snd_seq_timestamp time;   /* schedule time */
    299297
    300 
    301298        struct snd_seq_addr source;     /* source address */
    302299        struct snd_seq_addr dest;       /* destination address */
    303300
    304         union {                         /* event data... */
    305                 struct snd_seq_ev_note note;
    306                 struct snd_seq_ev_ctrl control;
    307                 struct snd_seq_ev_raw8 raw8;
    308                 struct snd_seq_ev_raw32 raw32;
    309                 struct snd_seq_ev_ext ext;
    310                 struct snd_seq_ev_queue_control queue;
    311                 union snd_seq_timestamp time;
    312                 struct snd_seq_addr addr;
    313                 struct snd_seq_connect connect;
    314                 struct snd_seq_result result;
    315                 struct snd_seq_ev_quote quote;
    316         } data;
    317 };
    318 
     301        union snd_seq_event_data data;
     302};
     303
     304        /* (compatible) event for UMP-capable clients */
     305struct snd_seq_ump_event {
     306        snd_seq_event_type_t type;      /* event type */
     307        unsigned char flags;            /* event flags */
     308        char tag;
     309        unsigned char queue;            /* schedule queue */
     310        union snd_seq_timestamp time;   /* schedule time */
     311        struct snd_seq_addr source;     /* source address */
     312        struct snd_seq_addr dest;       /* destination address */
     313
     314        union {
     315                union snd_seq_event_data data;
     316                unsigned int ump[4];
     317        };
     318};
    319319
    320320/*
     
    364364                       
    365365        /* event filter flags */
    366 #define SNDRV_SEQ_FILTER_BROADCAST      (1<<0)  /* accept broadcast messages */
    367 #define SNDRV_SEQ_FILTER_MULTICAST      (1<<1)  /* accept multicast messages */
    368 #define SNDRV_SEQ_FILTER_BOUNCE         (1<<2)  /* accept bounce event in error */
    369 #define SNDRV_SEQ_FILTER_USE_EVENT      (1<<31) /* use event filter */
     366#define SNDRV_SEQ_FILTER_BROADCAST      (1U<<0) /* accept broadcast messages */
     367#define SNDRV_SEQ_FILTER_MULTICAST      (1U<<1) /* accept multicast messages */
     368#define SNDRV_SEQ_FILTER_BOUNCE         (1U<<2) /* accept bounce event in error */
     369#define SNDRV_SEQ_FILTER_NO_CONVERT     (1U<<30) /* don't convert UMP events */
     370#define SNDRV_SEQ_FILTER_USE_EVENT      (1U<<31)        /* use event filter */
    370371
    371372struct snd_seq_client_info {
     
    380381        int card;                       /* RO: card number[kernel] */
    381382        int pid;                        /* RO: pid[user] */
    382         char reserved[56];              /* for future use */
    383 };
    384 
     383        unsigned int midi_version;      /* MIDI version */
     384        unsigned int group_filter;      /* UMP group filter bitmap
     385                                         * (bit 0 = groupless messages,
     386                                         *  bit 1-16 = messages for groups 1-16)
     387                                         */
     388        char reserved[48];              /* for future use */
     389};
     390
     391/* MIDI version numbers in client info */
     392#define SNDRV_SEQ_CLIENT_LEGACY_MIDI            0       /* Legacy client */
     393#define SNDRV_SEQ_CLIENT_UMP_MIDI_1_0           1       /* UMP MIDI 1.0 */
     394#define SNDRV_SEQ_CLIENT_UMP_MIDI_2_0           2       /* UMP MIDI 2.0 */
    385395
    386396/* client pool size */
     
    442452#define SNDRV_SEQ_PORT_CAP_SUBS_WRITE   (1<<6)  /* allow write subscription */
    443453#define SNDRV_SEQ_PORT_CAP_NO_EXPORT    (1<<7)  /* routing not allowed */
     454#define SNDRV_SEQ_PORT_CAP_INACTIVE     (1<<8)  /* inactive port */
     455#define SNDRV_SEQ_PORT_CAP_UMP_ENDPOINT (1<<9)  /* MIDI 2.0 UMP Endpoint port */
    444456
    445457        /* port type */
     
    451463#define SNDRV_SEQ_PORT_TYPE_MIDI_MT32   (1<<5)  /* MT-32 compatible device */
    452464#define SNDRV_SEQ_PORT_TYPE_MIDI_GM2    (1<<6)  /* General MIDI 2 compatible device */
     465#define SNDRV_SEQ_PORT_TYPE_MIDI_UMP    (1<<7)  /* UMP */
    453466
    454467/* other standards...*/
     
    468481#define SNDRV_SEQ_PORT_FLG_TIME_REAL    (1<<2)
    469482
     483/* port direction */
     484#define SNDRV_SEQ_PORT_DIR_UNKNOWN      0
     485#define SNDRV_SEQ_PORT_DIR_INPUT        1
     486#define SNDRV_SEQ_PORT_DIR_OUTPUT       2
     487#define SNDRV_SEQ_PORT_DIR_BIDIRECTION  3
     488
    470489struct snd_seq_port_info {
    471490        struct snd_seq_addr addr;       /* client/port numbers */
     
    484503        unsigned int flags;             /* misc. conditioning */
    485504        unsigned char time_queue;       /* queue # for timestamping */
    486         char reserved[59];              /* for future use */
     505        unsigned char direction;        /* port usage direction (r/w/bidir) */
     506        unsigned char ump_group;        /* 0 = UMP EP (no conversion), 1-16 = UMP group number */
     507        char reserved[57];              /* for future use */
    487508};
    488509
     
    588609};
    589610
     611/*
     612 * UMP-specific information
     613 */
     614/* type of UMP info query */
     615#define SNDRV_SEQ_CLIENT_UMP_INFO_ENDPOINT      0
     616#define SNDRV_SEQ_CLIENT_UMP_INFO_BLOCK         1
     617
     618struct snd_seq_client_ump_info {
     619        int client;                     /* client number to inquire/set */
     620        int type;                       /* type to inquire/set */
     621        unsigned char info[512];        /* info (either UMP ep or block info) */
     622} __packed;
    590623
    591624/*
     
    597630#define SNDRV_SEQ_IOCTL_SYSTEM_INFO     _IOWR('S', 0x02, struct snd_seq_system_info)
    598631#define SNDRV_SEQ_IOCTL_RUNNING_MODE    _IOWR('S', 0x03, struct snd_seq_running_info)
     632#define SNDRV_SEQ_IOCTL_USER_PVERSION   _IOW('S', 0x04, int)
    599633
    600634#define SNDRV_SEQ_IOCTL_GET_CLIENT_INFO _IOWR('S', 0x10, struct snd_seq_client_info)
    601635#define SNDRV_SEQ_IOCTL_SET_CLIENT_INFO _IOW ('S', 0x11, struct snd_seq_client_info)
     636#define SNDRV_SEQ_IOCTL_GET_CLIENT_UMP_INFO     _IOWR('S', 0x12, struct snd_seq_client_ump_info)
     637#define SNDRV_SEQ_IOCTL_SET_CLIENT_UMP_INFO     _IOWR('S', 0x13, struct snd_seq_client_ump_info)
    602638
    603639#define SNDRV_SEQ_IOCTL_CREATE_PORT     _IOWR('S', 0x20, struct snd_seq_port_info)
  • GPL/trunk/alsa-kernel/include/uapi/sound/asoc.h

    r695 r772  
    55 * Copyright (C) 2012 Texas Instruments Inc.
    66 * Copyright (C) 2015 Intel Corporation.
    7  *
    8  * This program is free software; you can redistribute it and/or modify
    9  * it under the terms of the GNU General Public License version 2 as
    10  * published by the Free Software Foundation.
    117 *
    128 * Simple file API to load FW that includes mixers, coefficients, DAPM graphs,
     
    227223        __le32 num_elems;       /* number of elements in array */
    228224        union {
    229                 struct snd_soc_tplg_vendor_uuid_elem uuid[0];
    230                 struct snd_soc_tplg_vendor_value_elem value[0];
    231                 struct snd_soc_tplg_vendor_string_elem string[0];
     225                __DECLARE_FLEX_ARRAY(struct snd_soc_tplg_vendor_uuid_elem, uuid);
     226                __DECLARE_FLEX_ARRAY(struct snd_soc_tplg_vendor_value_elem, value);
     227                __DECLARE_FLEX_ARRAY(struct snd_soc_tplg_vendor_string_elem, string);
    232228        };
    233229} __attribute__((packed));
     
    241237        __le32 size;    /* in bytes of private data */
    242238        union {
    243                 char data[0];
    244                 struct snd_soc_tplg_vendor_array array[0];
     239                __DECLARE_FLEX_ARRAY(char, data);
     240                __DECLARE_FLEX_ARRAY(struct snd_soc_tplg_vendor_array, array);
    245241        };
    246242} __attribute__((packed));
  • GPL/trunk/alsa-kernel/include/uapi/sound/asound.h

    r717 r772  
    44 *  Copyright (c) 1994-2003 by Jaroslav Kysela <perex@perex.cz>,
    55 *                             Abramo Bagnara <abramo@alsa-project.org>
    6  *
    7  *
    8  *   This program is free software; you can redistribute it and/or modify
    9  *   it under the terms of the GNU General Public License as published by
    10  *   the Free Software Foundation; either version 2 of the License, or
    11  *   (at your option) any later version.
    12  *
    13  *   This program is distributed in the hope that it will be useful,
    14  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
    15  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    16  *   GNU General Public License for more details.
    17  *
    18  *   You should have received a copy of the GNU General Public License
    19  *   along with this program; if not, write to the Free Software
    20  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
    21  *
    226 */
    237
     
    4428#ifndef __bitwise
    4529#define __bitwise
     30#endif
     31
     32#ifndef __packed
     33#define __packed
    4634#endif
    4735
     
    229217#define SNDRV_PCM_FORMAT_U24_LE ((__force snd_pcm_format_t) 8) /* low three bytes */
    230218#define SNDRV_PCM_FORMAT_U24_BE ((__force snd_pcm_format_t) 9) /* low three bytes */
     219/*
     220 * For S32/U32 formats, 'msbits' hardware parameter is often used to deliver information about the
     221 * available bit count in most significant bit. It's for the case of so-called 'left-justified' or
     222 * `right-padding` sample which has less width than 32 bit.
     223 */
    231224#define SNDRV_PCM_FORMAT_S32_LE ((__force snd_pcm_format_t) 10)
    232225#define SNDRV_PCM_FORMAT_S32_BE ((__force snd_pcm_format_t) 11)
     
    310303#define SNDRV_PCM_INFO_BATCH            0x00000010      /* double buffering */
    311304#define SNDRV_PCM_INFO_SYNC_APPLPTR     0x00000020      /* need the explicit sync of appl_ptr update */
     305#define SNDRV_PCM_INFO_PERFECT_DRAIN    0x00000040      /* silencing at the end of stream is not required */
    312306#define SNDRV_PCM_INFO_INTERLEAVED      0x00000100      /* channels are interleaved */
    313307#define SNDRV_PCM_INFO_NONINTERLEAVED   0x00000200      /* channels are not interleaved */
     
    327321#define SNDRV_PCM_INFO_HAS_LINK_SYNCHRONIZED_ATIME 0x08000000  /* report synchronized audio/system time */
    328322#define SNDRV_PCM_INFO_EXPLICIT_SYNC    0x10000000      /* needs explicit sync of pointers and data */
    329 
     323#define SNDRV_PCM_INFO_NO_REWINDS       0x20000000      /* hardware can only support monotonic changes of appl_ptr */
    330324#define SNDRV_PCM_INFO_DRAIN_TRIGGER    0x40000000              /* internal kernel flag - trigger in drain */
    331325#define SNDRV_PCM_INFO_FIFO_IN_FRAMES   0x80000000      /* internal kernel flag - FIFO size is in frames */
     
    422416#define SNDRV_PCM_HW_PARAMS_EXPORT_BUFFER       (1<<1)  /* export buffer */
    423417#define SNDRV_PCM_HW_PARAMS_NO_PERIOD_WAKEUP    (1<<2)  /* disable period wakeups */
     418#define SNDRV_PCM_HW_PARAMS_NO_DRAIN_SILENCE    (1<<3)  /* suppress drain with the filling
     419                                                         * of the silence samples
     420                                                         */
    424421
    425422struct snd_interval {
     
    468465        snd_pcm_uframes_t xfer_align;           /* obsolete: xfer size need to be a multiple */
    469466        snd_pcm_uframes_t start_threshold;      /* min hw_avail frames for automatic start */
    470         snd_pcm_uframes_t stop_threshold;       /* min avail frames for automatic stop */
    471         snd_pcm_uframes_t silence_threshold;    /* min distance from noise for silence filling */
    472         snd_pcm_uframes_t silence_size;         /* silence block size */
     467        /*
     468         * The following two thresholds alleviate playback buffer underruns; when
     469         * hw_avail drops below the threshold, the respective action is triggered:
     470         */
     471        snd_pcm_uframes_t stop_threshold;       /* - stop playback */
     472        snd_pcm_uframes_t silence_threshold;    /* - pre-fill buffer with silence */
     473        snd_pcm_uframes_t silence_size;         /* max size of silence pre-fill; when >= boundary,
     474                                                 * fill played area with silence immediately */
    473475        snd_pcm_uframes_t boundary;             /* pointers wrap point */
    474476        unsigned int proto;                     /* protocol version */
     
    619621        __pad_before_uframe __pad1;
    620622        snd_pcm_uframes_t appl_ptr;      /* RW: appl ptr (0...boundary-1) */
    621         __pad_before_uframe __pad2;
     623        __pad_before_uframe __pad2;      // This should be __pad_after_uframe, but binary
     624                                         // backwards compatibility constraints prevent a fix.
    622625
    623626        __pad_before_uframe __pad3;
     
    751754 */
    752755
    753 #define SNDRV_RAWMIDI_VERSION           SNDRV_PROTOCOL_VERSION(2, 0, 2)
     756#define SNDRV_RAWMIDI_VERSION           SNDRV_PROTOCOL_VERSION(2, 0, 4)
    754757
    755758enum {
     
    762765#define SNDRV_RAWMIDI_INFO_INPUT                0x00000002
    763766#define SNDRV_RAWMIDI_INFO_DUPLEX               0x00000004
     767#define SNDRV_RAWMIDI_INFO_UMP                  0x00000008
    764768
    765769struct snd_rawmidi_info {
     
    826830#endif
    827831
     832/* UMP EP info flags */
     833#define SNDRV_UMP_EP_INFO_STATIC_BLOCKS         0x01
     834
     835/* UMP EP Protocol / JRTS capability bits */
     836#define SNDRV_UMP_EP_INFO_PROTO_MIDI_MASK       0x0300
     837#define SNDRV_UMP_EP_INFO_PROTO_MIDI1           0x0100 /* MIDI 1.0 */
     838#define SNDRV_UMP_EP_INFO_PROTO_MIDI2           0x0200 /* MIDI 2.0 */
     839#define SNDRV_UMP_EP_INFO_PROTO_JRTS_MASK       0x0003
     840#define SNDRV_UMP_EP_INFO_PROTO_JRTS_TX         0x0001 /* JRTS Transmit */
     841#define SNDRV_UMP_EP_INFO_PROTO_JRTS_RX         0x0002 /* JRTS Receive */
     842
     843/* UMP Endpoint information */
     844struct snd_ump_endpoint_info {
     845        int card;                       /* card number */
     846        int device;                     /* device number */
     847        unsigned int flags;             /* additional info */
     848        unsigned int protocol_caps;     /* protocol capabilities */
     849        unsigned int protocol;          /* current protocol */
     850        unsigned int num_blocks;        /* # of function blocks */
     851        unsigned short version;         /* UMP major/minor version */
     852        unsigned short family_id;       /* MIDI device family ID */
     853        unsigned short model_id;        /* MIDI family model ID */
     854        unsigned int manufacturer_id;   /* MIDI manufacturer ID */
     855        unsigned char sw_revision[4];   /* software revision */
     856        unsigned short padding;
     857        unsigned char name[128];        /* endpoint name string */
     858        unsigned char product_id[128];  /* unique product id string */
     859        unsigned char reserved[32];
     860} __packed;
     861
     862/* UMP direction */
     863#define SNDRV_UMP_DIR_INPUT             0x01
     864#define SNDRV_UMP_DIR_OUTPUT            0x02
     865#define SNDRV_UMP_DIR_BIDIRECTION       0x03
     866
     867/* UMP block info flags */
     868#define SNDRV_UMP_BLOCK_IS_MIDI1        (1U << 0) /* MIDI 1.0 port w/o restrict */
     869#define SNDRV_UMP_BLOCK_IS_LOWSPEED     (1U << 1) /* 31.25Kbps B/W MIDI1 port */
     870
     871/* UMP block user-interface hint */
     872#define SNDRV_UMP_BLOCK_UI_HINT_UNKNOWN         0x00
     873#define SNDRV_UMP_BLOCK_UI_HINT_RECEIVER        0x01
     874#define SNDRV_UMP_BLOCK_UI_HINT_SENDER          0x02
     875#define SNDRV_UMP_BLOCK_UI_HINT_BOTH            0x03
     876
     877/* UMP groups and blocks */
     878#define SNDRV_UMP_MAX_GROUPS            16
     879#define SNDRV_UMP_MAX_BLOCKS            32
     880
     881/* UMP Block information */
     882struct snd_ump_block_info {
     883        int card;                       /* card number */
     884        int device;                     /* device number */
     885        unsigned char block_id;         /* block ID (R/W) */
     886        unsigned char direction;        /* UMP direction */
     887        unsigned char active;           /* Activeness */
     888        unsigned char first_group;      /* first group ID */
     889        unsigned char num_groups;       /* number of groups */
     890        unsigned char midi_ci_version;  /* MIDI-CI support version */
     891        unsigned char sysex8_streams;   /* max number of sysex8 streams */
     892        unsigned char ui_hint;          /* user interface hint */
     893        unsigned int flags;             /* various info flags */
     894        unsigned char name[128];        /* block name string */
     895        unsigned char reserved[32];
     896} __packed;
     897
    828898#define SNDRV_RAWMIDI_IOCTL_PVERSION    _IOR('W', 0x00, int)
    829899#define SNDRV_RAWMIDI_IOCTL_INFO        _IOR('W', 0x01, struct snd_rawmidi_info)
     
    833903#define SNDRV_RAWMIDI_IOCTL_DROP        _IOW('W', 0x30, int)
    834904#define SNDRV_RAWMIDI_IOCTL_DRAIN       _IOW('W', 0x31, int)
     905/* Additional ioctls for UMP rawmidi devices */
     906#define SNDRV_UMP_IOCTL_ENDPOINT_INFO   _IOR('W', 0x40, struct snd_ump_endpoint_info)
     907#define SNDRV_UMP_IOCTL_BLOCK_INFO      _IOR('W', 0x41, struct snd_ump_block_info)
    835908
    836909/*
     
    10081081 ****************************************************************************/
    10091082
    1010 #define SNDRV_CTL_VERSION               SNDRV_PROTOCOL_VERSION(2, 0, 8)
     1083#define SNDRV_CTL_VERSION               SNDRV_PROTOCOL_VERSION(2, 0, 9)
    10111084
    10121085/******************** This section used in uniaud.dll interface *********************/
     
    10471120#define SNDRV_CTL_ELEM_ACCESS_READWRITE         (SNDRV_CTL_ELEM_ACCESS_READ|SNDRV_CTL_ELEM_ACCESS_WRITE)
    10481121#define SNDRV_CTL_ELEM_ACCESS_VOLATILE          (1<<2)  /* control value may be changed without a notification */
    1049 // (1 << 3) is unused.
     1122/* (1 << 3) is unused. */
    10501123#define SNDRV_CTL_ELEM_ACCESS_TLV_READ          (1<<4)  /* TLV read is possible */
    10511124#define SNDRV_CTL_ELEM_ACCESS_TLV_WRITE         (1<<5)  /* TLV write is possible */
     
    11451218        unsigned int length;    /* in bytes aligned to 4 */
    11461219#ifndef TARGET_OS2
    1147         unsigned int tlv[0];    /* first TLV */
     1220        unsigned int tlv[];     /* first TLV */
    11481221#else
    11491222        unsigned int tlv[1];    /* first TLV */
     
    11741247#define SNDRV_CTL_IOCTL_RAWMIDI_INFO    _IOWR('U', 0x41, struct snd_rawmidi_info)
    11751248#define SNDRV_CTL_IOCTL_RAWMIDI_PREFER_SUBDEVICE _IOW('U', 0x42, int)
     1249#define SNDRV_CTL_IOCTL_UMP_NEXT_DEVICE _IOWR('U', 0x43, int)
     1250#define SNDRV_CTL_IOCTL_UMP_ENDPOINT_INFO _IOWR('U', 0x44, struct snd_ump_endpoint_info)
     1251#define SNDRV_CTL_IOCTL_UMP_BLOCK_INFO  _IOWR('U', 0x45, struct snd_ump_block_info)
    11761252#define SNDRV_CTL_IOCTL_POWER           _IOWR('U', 0xd0, int)
    11771253#define SNDRV_CTL_IOCTL_POWER_STATE     _IOR('U', 0xd1, int)
  • GPL/trunk/alsa-kernel/include/uapi/sound/asound_fm.h

    r615 r772  
    1111 *
    1212 *  Direct FM control
    13  *
    14  *   This program is free software; you can redistribute it and/or modify
    15  *   it under the terms of the GNU General Public License as published by
    16  *   the Free Software Foundation; either version 2 of the License, or
    17  *   (at your option) any later version.
    18  *
    19  *   This program is distributed in the hope that it will be useful,
    20  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
    21  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    22  *   GNU General Public License for more details.
    23  *
    24  *   You should have received a copy of the GNU General Public License
    25  *   along with this program; if not, write to the Free Software
    26  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
    27  *
    2813 */
    2914
  • GPL/trunk/alsa-kernel/include/uapi/sound/compress_offload.h

    r629 r772  
    66 *  Authors:    Vinod Koul <vinod.koul@linux.intel.com>
    77 *              Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
    8  *  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    9  *
    10  *  This program is free software; you can redistribute it and/or modify
    11  *  it under the terms of the GNU General Public License as published by
    12  *  the Free Software Foundation; version 2 of the License.
    13  *
    14  *  This program is distributed in the hope that it will be useful, but
    15  *  WITHOUT ANY WARRANTY; without even the implied warranty of
    16  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    17  *  General Public License for more details.
    18  *
    19  *  You should have received a copy of the GNU General Public License along
    20  *  with this program; if not, write to the Free Software Foundation, Inc.,
    21  *  59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
    22  *
    23  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    24  *
    258 */
    269#ifndef __COMPRESS_OFFLOAD_H
     
    124107
    125108/**
    126  * enum sndrv_compress_encoder
     109 * enum sndrv_compress_encoder - encoder metadata key
    127110 * @SNDRV_COMPRESS_ENCODER_PADDING: no of samples appended by the encoder at the
    128111 * end of the track
  • GPL/trunk/alsa-kernel/include/uapi/sound/compress_params.h

    r629 r772  
    88 *              Vinod Koul <vinod.koul@linux.intel.com>
    99 *
    10  *  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    11  *
    12  *  This program is free software; you can redistribute it and/or modify
    13  *  it under the terms of the GNU General Public License as published by
    14  *  the Free Software Foundation; version 2 of the License.
    15  *
    16  *  This program is distributed in the hope that it will be useful, but
    17  *  WITHOUT ANY WARRANTY; without even the implied warranty of
    18  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    19  *  General Public License for more details.
    20  *
    21  *  You should have received a copy of the GNU General Public License along
    22  *  with this program; if not, write to the Free Software Foundation, Inc.,
    23  *  59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
    24  *
    2510 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    2611 *
    2712 * The definitions in this file are derived from the OpenMAX AL version 1.1
    28  * and OpenMAX IL v 1.1.2 header files which contain the copyright notice below.
     13 * and OpenMAX IL v 1.1.2 header files which contain the copyright notice below
     14 * and are licensed under the MIT license.
    2915 *
    3016 * Copyright (c) 2007-2010 The Khronos Group Inc.
    31  *
    32  * Permission is hereby granted, free of charge, to any person obtaining
    33  * a copy of this software and/or associated documentation files (the
    34  * "Materials "), to deal in the Materials without restriction, including
    35  * without limitation the rights to use, copy, modify, merge, publish,
    36  * distribute, sublicense, and/or sell copies of the Materials, and to
    37  * permit persons to whom the Materials are furnished to do so, subject to
    38  * the following conditions:
    39  *
    40  * The above copyright notice and this permission notice shall be included
    41  * in all copies or substantial portions of the Materials.
    42  *
    43  * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
    44  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
    45  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
    46  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
    47  * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
    48  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
    49  * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
    50  *
    5117 */
    5218#ifndef __SND_COMPRESS_PARAMS_H
     
    251217
    252218/**
    253  * struct snd_enc_vorbis
     219 * struct snd_enc_vorbis - Vorbis encoder parameters
    254220 * @quality: Sets encoding quality to n, between -1 (low) and 10 (high).
    255221 * In the default mode of operation, the quality level is 3.
     
    280246
    281247/**
    282  * struct snd_enc_real
     248 * struct snd_enc_real - RealAudio encoder parameters
    283249 * @quant_bits: number of coupling quantization bits in the stream
    284250 * @start_region: coupling start region in the stream
     
    295261
    296262/**
    297  * struct snd_enc_flac
     263 * struct snd_enc_flac - FLAC encoder parameters
    298264 * @num: serial number, valid only for OGG formats
    299265 *      needs to be set by application
  • GPL/trunk/alsa-kernel/include/uapi/sound/emu10k1.h

    r629 r772  
    44 *                   Creative Labs, Inc.
    55 *  Definitions for EMU10K1 (SB Live!) chips
    6  *
    7  *
    8  *   This program is free software; you can redistribute it and/or modify
    9  *   it under the terms of the GNU General Public License as published by
    10  *   the Free Software Foundation; either version 2 of the License, or
    11  *   (at your option) any later version.
    12  *
    13  *   This program is distributed in the hope that it will be useful,
    14  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
    15  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    16  *   GNU General Public License for more details.
    17  *
    18  *   You should have received a copy of the GNU General Public License
    19  *   along with this program; if not, write to the Free Software
    20  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
    21  *
    226 */
    237#ifndef _UAPI__SOUND_EMU10K1_H
     
    3115 * ---- FX8010 ----
    3216 */
    33 
    34 #define EMU10K1_CARD_CREATIVE                   0x00000000
    35 #define EMU10K1_CARD_EMUAPS                     0x00000001
    3617
    3718#define EMU10K1_FX8010_PCM_COUNT                8
     
    6344#define iSKIP    0x0f   /* R = A (cc_reg), X (count), Y (cc_test) */
    6445
     46#define LOWORD_OPX_MASK         0x000ffc00      /* Instruction operand X                        */
     47#define LOWORD_OPY_MASK         0x000003ff      /* Instruction operand Y                        */
     48#define HIWORD_OPCODE_MASK      0x00f00000      /* Instruction opcode                           */
     49#define HIWORD_RESULT_MASK      0x000ffc00      /* Instruction result                           */
     50#define HIWORD_OPA_MASK         0x000003ff      /* Instruction operand A                        */
     51
     52/* Audigy Soundcards have a different instruction format */
     53#define A_LOWORD_OPX_MASK       0x007ff000
     54#define A_LOWORD_OPY_MASK       0x000007ff
     55#define A_HIWORD_OPCODE_MASK    0x0f000000
     56#define A_HIWORD_RESULT_MASK    0x007ff000
     57#define A_HIWORD_OPA_MASK       0x000007ff
     58
    6559/* GPRs */
    6660#define FXBUS(x)        (0x00 + (x))    /* x = 0x00 - 0x0f */
     
    6963#define FXBUS2(x)       (0x30 + (x))    /* x = 0x00 - 0x0f copies of fx buses for capture -> FXWC high 16 bits */
    7064                                        /* NB: 0x31 and 0x32 are shared with Center/LFE on SB live 5.1 */
     65
     66#define A_FXBUS(x)      (0x00 + (x))    /* x = 0x00 - 0x3f FX buses */
     67#define A_EXTIN(x)      (0x40 + (x))    /* x = 0x00 - 0x0f physical ins */
     68#define A_P16VIN(x)     (0x50 + (x))    /* x = 0x00 - 0x0f p16v ins (A2 only) "EMU32 inputs" */
     69#define A_EXTOUT(x)     (0x60 + (x))    /* x = 0x00 - 0x1f physical outs -> A_FXWC1 0x79-7f unknown   */
     70#define A_FXBUS2(x)     (0x80 + (x))    /* x = 0x00 - 0x1f extra outs used for EFX capture -> A_FXWC2 */
     71#define A_EMU32OUTH(x)  (0xa0 + (x))    /* x = 0x00 - 0x0f "EMU32_OUT_10 - _1F" */
     72#define A_EMU32OUTL(x)  (0xb0 + (x))    /* x = 0x00 - 0x0f "EMU32_OUT_01 - _0F" */
     73#define A3_EMU32IN(x)   (0x160 + (x))   /* x = 0x00 - 0x1f "EMU32_IN_00 - _1F" - Only when .device = 0x0008 */
     74#define A3_EMU32OUT(x)  (0x1E0 + (x))   /* x = 0x00 - 0x1f "EMU32_OUT_00 - _1F" - Only when .device = 0x0008 */
    7175
    7276#define C_00000000      0x40
     
    98102#define GPR_IRQ         0x5a            /* IRQ register */
    99103#define GPR_DBAC        0x5b            /* TRAM Delay Base Address Counter */
    100 #define GPR(x)          (FXGPREGBASE + (x)) /* free GPRs: x = 0x00 - 0xff */
    101 #define ITRAM_DATA(x)   (TANKMEMDATAREGBASE + 0x00 + (x)) /* x = 0x00 - 0x7f */
    102 #define ETRAM_DATA(x)   (TANKMEMDATAREGBASE + 0x80 + (x)) /* x = 0x00 - 0x1f */
    103 #define ITRAM_ADDR(x)   (TANKMEMADDRREGBASE + 0x00 + (x)) /* x = 0x00 - 0x7f */
    104 #define ETRAM_ADDR(x)   (TANKMEMADDRREGBASE + 0x80 + (x)) /* x = 0x00 - 0x1f */
    105 
    106 #define A_ITRAM_DATA(x) (TANKMEMDATAREGBASE + 0x00 + (x)) /* x = 0x00 - 0xbf */
    107 #define A_ETRAM_DATA(x) (TANKMEMDATAREGBASE + 0xc0 + (x)) /* x = 0x00 - 0x3f */
    108 #define A_ITRAM_ADDR(x) (TANKMEMADDRREGBASE + 0x00 + (x)) /* x = 0x00 - 0xbf */
    109 #define A_ETRAM_ADDR(x) (TANKMEMADDRREGBASE + 0xc0 + (x)) /* x = 0x00 - 0x3f */
    110 #define A_ITRAM_CTL(x)  (A_TANKMEMCTLREGBASE + 0x00 + (x)) /* x = 0x00 - 0xbf */
    111 #define A_ETRAM_CTL(x)  (A_TANKMEMCTLREGBASE + 0xc0 + (x)) /* x = 0x00 - 0x3f */
    112 
    113 #define A_FXBUS(x)      (0x00 + (x))    /* x = 0x00 - 0x3f FX buses */
    114 #define A_EXTIN(x)      (0x40 + (x))    /* x = 0x00 - 0x0f physical ins */
    115 #define A_P16VIN(x)     (0x50 + (x))    /* x = 0x00 - 0x0f p16v ins (A2 only) "EMU32 inputs" */
    116 #define A_EXTOUT(x)     (0x60 + (x))    /* x = 0x00 - 0x1f physical outs -> A_FXWC1 0x79-7f unknown   */
    117 #define A_FXBUS2(x)     (0x80 + (x))    /* x = 0x00 - 0x1f extra outs used for EFX capture -> A_FXWC2 */
    118 #define A_EMU32OUTH(x)  (0xa0 + (x))    /* x = 0x00 - 0x0f "EMU32_OUT_10 - _1F" - ??? */
    119 #define A_EMU32OUTL(x)  (0xb0 + (x))    /* x = 0x00 - 0x0f "EMU32_OUT_1 - _F" - ??? */
    120 #define A3_EMU32IN(x)   (0x160 + (x))   /* x = 0x00 - 0x3f "EMU32_IN_00 - _3F" - Only when .device = 0x0008 */
    121 #define A3_EMU32OUT(x)  (0x1E0 + (x))   /* x = 0x00 - 0x0f "EMU32_OUT_00 - _3F" - Only when .device = 0x0008 */
    122 #define A_GPR(x)        (A_FXGPREGBASE + (x))
    123 
    124 /* cc_reg constants */
    125 #define CC_REG_NORMALIZED C_00000001
    126 #define CC_REG_BORROW   C_00000002
    127 #define CC_REG_MINUS    C_00000004
    128 #define CC_REG_ZERO     C_00000008
    129 #define CC_REG_SATURATE C_00000010
    130 #define CC_REG_NONZERO  C_00000100
    131 
    132 /* FX buses */
    133 #define FXBUS_PCM_LEFT          0x00
    134 #define FXBUS_PCM_RIGHT         0x01
    135 #define FXBUS_PCM_LEFT_REAR     0x02
    136 #define FXBUS_PCM_RIGHT_REAR    0x03
    137 #define FXBUS_MIDI_LEFT         0x04
    138 #define FXBUS_MIDI_RIGHT        0x05
    139 #define FXBUS_PCM_CENTER        0x06
    140 #define FXBUS_PCM_LFE           0x07
    141 #define FXBUS_PCM_LEFT_FRONT    0x08
    142 #define FXBUS_PCM_RIGHT_FRONT   0x09
    143 #define FXBUS_MIDI_REVERB       0x0c
    144 #define FXBUS_MIDI_CHORUS       0x0d
    145 #define FXBUS_PCM_LEFT_SIDE     0x0e
    146 #define FXBUS_PCM_RIGHT_SIDE    0x0f
    147 #define FXBUS_PT_LEFT           0x14
    148 #define FXBUS_PT_RIGHT          0x15
    149 
    150 /* Inputs */
    151 #define EXTIN_AC97_L       0x00 /* AC'97 capture channel - left */
    152 #define EXTIN_AC97_R       0x01 /* AC'97 capture channel - right */
    153 #define EXTIN_SPDIF_CD_L   0x02 /* internal S/PDIF CD - onboard - left */
    154 #define EXTIN_SPDIF_CD_R   0x03 /* internal S/PDIF CD - onboard - right */
    155 #define EXTIN_ZOOM_L       0x04 /* Zoom Video I2S - left */
    156 #define EXTIN_ZOOM_R       0x05 /* Zoom Video I2S - right */
    157 #define EXTIN_TOSLINK_L    0x06 /* LiveDrive - TOSLink Optical - left */
    158 #define EXTIN_TOSLINK_R    0x07 /* LiveDrive - TOSLink Optical - right */
    159 #define EXTIN_LINE1_L      0x08 /* LiveDrive - Line/Mic 1 - left */
    160 #define EXTIN_LINE1_R      0x09 /* LiveDrive - Line/Mic 1 - right */
    161 #define EXTIN_COAX_SPDIF_L 0x0a /* LiveDrive - Coaxial S/PDIF - left */
    162 #define EXTIN_COAX_SPDIF_R 0x0b /* LiveDrive - Coaxial S/PDIF - right */
    163 #define EXTIN_LINE2_L      0x0c /* LiveDrive - Line/Mic 2 - left */
    164 #define EXTIN_LINE2_R      0x0d /* LiveDrive - Line/Mic 2 - right */
    165 
    166 /* Outputs */
    167 #define EXTOUT_AC97_L      0x00 /* AC'97 playback channel - left */
    168 #define EXTOUT_AC97_R      0x01 /* AC'97 playback channel - right */
    169 #define EXTOUT_TOSLINK_L   0x02 /* LiveDrive - TOSLink Optical - left */
    170 #define EXTOUT_TOSLINK_R   0x03 /* LiveDrive - TOSLink Optical - right */
    171 #define EXTOUT_AC97_CENTER 0x04 /* SB Live 5.1 - center */
    172 #define EXTOUT_AC97_LFE    0x05 /* SB Live 5.1 - LFE */
    173 #define EXTOUT_HEADPHONE_L 0x06 /* LiveDrive - Headphone - left */
    174 #define EXTOUT_HEADPHONE_R 0x07 /* LiveDrive - Headphone - right */
    175 #define EXTOUT_REAR_L      0x08 /* Rear channel - left */
    176 #define EXTOUT_REAR_R      0x09 /* Rear channel - right */
    177 #define EXTOUT_ADC_CAP_L   0x0a /* ADC Capture buffer - left */
    178 #define EXTOUT_ADC_CAP_R   0x0b /* ADC Capture buffer - right */
    179 #define EXTOUT_MIC_CAP     0x0c /* MIC Capture buffer */
    180 #define EXTOUT_AC97_REAR_L 0x0d /* SB Live 5.1 (c) 2003 - Rear Left */
    181 #define EXTOUT_AC97_REAR_R 0x0e /* SB Live 5.1 (c) 2003 - Rear Right */
    182 #define EXTOUT_ACENTER     0x11 /* Analog Center */
    183 #define EXTOUT_ALFE        0x12 /* Analog LFE */
    184 
    185 /* Audigy Inputs */
    186 #define A_EXTIN_AC97_L          0x00    /* AC'97 capture channel - left */
    187 #define A_EXTIN_AC97_R          0x01    /* AC'97 capture channel - right */
    188 #define A_EXTIN_SPDIF_CD_L      0x02    /* digital CD left */
    189 #define A_EXTIN_SPDIF_CD_R      0x03    /* digital CD left */
    190 #define A_EXTIN_OPT_SPDIF_L     0x04    /* audigy drive Optical SPDIF - left */
    191 #define A_EXTIN_OPT_SPDIF_R     0x05    /*                              right */
    192 #define A_EXTIN_LINE2_L         0x08    /* audigy drive line2/mic2 - left */
    193 #define A_EXTIN_LINE2_R         0x09    /*                           right */
    194 #define A_EXTIN_ADC_L           0x0a    /* Philips ADC - left */
    195 #define A_EXTIN_ADC_R           0x0b    /*               right */
    196 #define A_EXTIN_AUX2_L          0x0c    /* audigy drive aux2 - left */
    197 #define A_EXTIN_AUX2_R          0x0d    /*                   - right */
    198 
    199 /* Audigiy Outputs */
    200 #define A_EXTOUT_FRONT_L        0x00    /* digital front left */
    201 #define A_EXTOUT_FRONT_R        0x01    /*               right */
    202 #define A_EXTOUT_CENTER         0x02    /* digital front center */
    203 #define A_EXTOUT_LFE            0x03    /* digital front lfe */
    204 #define A_EXTOUT_HEADPHONE_L    0x04    /* headphone audigy drive left */
    205 #define A_EXTOUT_HEADPHONE_R    0x05    /*                        right */
    206 #define A_EXTOUT_REAR_L         0x06    /* digital rear left */
    207 #define A_EXTOUT_REAR_R         0x07    /*              right */
    208 #define A_EXTOUT_AFRONT_L       0x08    /* analog front left */
    209 #define A_EXTOUT_AFRONT_R       0x09    /*              right */
    210 #define A_EXTOUT_ACENTER        0x0a    /* analog center */
    211 #define A_EXTOUT_ALFE           0x0b    /* analog LFE */
    212 #define A_EXTOUT_ASIDE_L        0x0c    /* analog side left  - Audigy 2 ZS */
    213 #define A_EXTOUT_ASIDE_R        0x0d    /*             right - Audigy 2 ZS */
    214 #define A_EXTOUT_AREAR_L        0x0e    /* analog rear left */
    215 #define A_EXTOUT_AREAR_R        0x0f    /*             right */
    216 #define A_EXTOUT_AC97_L         0x10    /* AC97 left (front) */
    217 #define A_EXTOUT_AC97_R         0x11    /*      right */
    218 #define A_EXTOUT_ADC_CAP_L      0x16    /* ADC capture buffer left */
    219 #define A_EXTOUT_ADC_CAP_R      0x17    /*                    right */
    220 #define A_EXTOUT_MIC_CAP        0x18    /* Mic capture buffer */
    221104
    222105/* Audigy constants */
     
    251134#define A_GPR_DBACE     0xde            /* TRAM Delay Base Address Counter - external */
    252135
    253 /* definitions for debug register */
     136/* Each FX general purpose register is 32 bits in length, all bits are used                     */
     137#define FXGPREGBASE             0x100           /* FX general purpose registers base            */
     138#define A_FXGPREGBASE           0x400           /* Audigy GPRs, 0x400 to 0x5ff                  */
     139
     140#define A_TANKMEMCTLREGBASE     0x100           /* Tank memory control registers base - only for Audigy */
     141#define A_TANKMEMCTLREG_MASK    0x1f            /* only 5 bits used - only for Audigy */
     142
     143/* Tank audio data is logarithmically compressed down to 16 bits before writing to TRAM and is  */
     144/* decompressed back to 20 bits on a read.  There are a total of 160 locations, the last 32     */
     145/* locations are for external TRAM.                                                             */
     146#define TANKMEMDATAREGBASE      0x200           /* Tank memory data registers base              */
     147#define TANKMEMDATAREG_MASK     0x000fffff      /* 20 bit tank audio data field                 */
     148
     149/* Combined address field and memory opcode or flag field.  160 locations, last 32 are external */
     150#define TANKMEMADDRREGBASE      0x300           /* Tank memory address registers base           */
     151#define TANKMEMADDRREG_ADDR_MASK 0x000fffff     /* 20 bit tank address field                    */
     152#define TANKMEMADDRREG_CLEAR    0x00800000      /* Clear tank memory                            */
     153#define TANKMEMADDRREG_ALIGN    0x00400000      /* Align read or write relative to tank access  */
     154#define TANKMEMADDRREG_WRITE    0x00200000      /* Write to tank memory                         */
     155#define TANKMEMADDRREG_READ     0x00100000      /* Read from tank memory                        */
     156
     157#define GPR(x)          (FXGPREGBASE + (x)) /* free GPRs: x = 0x00 - 0xff */
     158#define ITRAM_DATA(x)   (TANKMEMDATAREGBASE + 0x00 + (x)) /* x = 0x00 - 0x7f */
     159#define ETRAM_DATA(x)   (TANKMEMDATAREGBASE + 0x80 + (x)) /* x = 0x00 - 0x1f */
     160#define ITRAM_ADDR(x)   (TANKMEMADDRREGBASE + 0x00 + (x)) /* x = 0x00 - 0x7f */
     161#define ETRAM_ADDR(x)   (TANKMEMADDRREGBASE + 0x80 + (x)) /* x = 0x00 - 0x1f */
     162
     163#define A_GPR(x)        (A_FXGPREGBASE + (x))
     164#define A_ITRAM_DATA(x) (TANKMEMDATAREGBASE + 0x00 + (x)) /* x = 0x00 - 0xbf */
     165#define A_ETRAM_DATA(x) (TANKMEMDATAREGBASE + 0xc0 + (x)) /* x = 0x00 - 0x3f */
     166#define A_ITRAM_ADDR(x) (TANKMEMADDRREGBASE + 0x00 + (x)) /* x = 0x00 - 0xbf */
     167#define A_ETRAM_ADDR(x) (TANKMEMADDRREGBASE + 0xc0 + (x)) /* x = 0x00 - 0x3f */
     168#define A_ITRAM_CTL(x)  (A_TANKMEMCTLREGBASE + 0x00 + (x)) /* x = 0x00 - 0xbf */
     169#define A_ETRAM_CTL(x)  (A_TANKMEMCTLREGBASE + 0xc0 + (x)) /* x = 0x00 - 0x3f */
     170
     171/* cc_reg constants */
     172#define CC_REG_NORMALIZED C_00000001
     173#define CC_REG_BORROW   C_00000002
     174#define CC_REG_MINUS    C_00000004
     175#define CC_REG_ZERO     C_00000008
     176#define CC_REG_SATURATE C_00000010
     177#define CC_REG_NONZERO  C_00000100
     178
     179#define A_CC_REG_NORMALIZED     A_C_00000001
     180#define A_CC_REG_BORROW         A_C_00000002
     181#define A_CC_REG_MINUS          A_C_00000004
     182#define A_CC_REG_ZERO           A_C_00000008
     183#define A_CC_REG_SATURATE       A_C_00000010
     184#define A_CC_REG_NONZERO        A_C_00000100
     185
     186/* FX buses */
     187// These are arbitrary mappings; our DSP code simply expects
     188// the config files to route the channels this way.
     189// The numbers are documented in {audigy,sb-live}-mixer.rst.
     190#define FXBUS_PCM_LEFT          0x00
     191#define FXBUS_PCM_RIGHT         0x01
     192#define FXBUS_PCM_LEFT_REAR     0x02
     193#define FXBUS_PCM_RIGHT_REAR    0x03
     194#define FXBUS_MIDI_LEFT         0x04
     195#define FXBUS_MIDI_RIGHT        0x05
     196#define FXBUS_PCM_CENTER        0x06
     197#define FXBUS_PCM_LFE           0x07
     198#define FXBUS_PCM_LEFT_FRONT    0x08
     199#define FXBUS_PCM_RIGHT_FRONT   0x09
     200#define FXBUS_MIDI_REVERB       0x0c
     201#define FXBUS_MIDI_CHORUS       0x0d
     202#define FXBUS_PCM_LEFT_SIDE     0x0e
     203#define FXBUS_PCM_RIGHT_SIDE    0x0f
     204#define FXBUS_PT_LEFT           0x14
     205#define FXBUS_PT_RIGHT          0x15
     206
     207/* Inputs */
     208#define EXTIN_AC97_L       0x00 /* AC'97 capture channel - left */
     209#define EXTIN_AC97_R       0x01 /* AC'97 capture channel - right */
     210#define EXTIN_SPDIF_CD_L   0x02 /* internal S/PDIF CD - onboard - left */
     211#define EXTIN_SPDIF_CD_R   0x03 /* internal S/PDIF CD - onboard - right */
     212#define EXTIN_ZOOM_L       0x04 /* Zoom Video I2S - left */
     213#define EXTIN_ZOOM_R       0x05 /* Zoom Video I2S - right */
     214#define EXTIN_TOSLINK_L    0x06 /* LiveDrive - TOSLink Optical - left */
     215#define EXTIN_TOSLINK_R    0x07 /* LiveDrive - TOSLink Optical - right */
     216#define EXTIN_LINE1_L      0x08 /* LiveDrive - Line/Mic 1 - left */
     217#define EXTIN_LINE1_R      0x09 /* LiveDrive - Line/Mic 1 - right */
     218#define EXTIN_COAX_SPDIF_L 0x0a /* LiveDrive - Coaxial S/PDIF - left */
     219#define EXTIN_COAX_SPDIF_R 0x0b /* LiveDrive - Coaxial S/PDIF - right */
     220#define EXTIN_LINE2_L      0x0c /* LiveDrive - Line/Mic 2 - left */
     221#define EXTIN_LINE2_R      0x0d /* LiveDrive - Line/Mic 2 - right */
     222
     223/* Outputs */
     224#define EXTOUT_AC97_L      0x00 /* AC'97 playback channel - left */
     225#define EXTOUT_AC97_R      0x01 /* AC'97 playback channel - right */
     226#define EXTOUT_TOSLINK_L   0x02 /* LiveDrive - TOSLink Optical - left */
     227#define EXTOUT_TOSLINK_R   0x03 /* LiveDrive - TOSLink Optical - right */
     228#define EXTOUT_AC97_CENTER 0x04 /* SB Live 5.1 - center */
     229#define EXTOUT_AC97_LFE    0x05 /* SB Live 5.1 - LFE */
     230#define EXTOUT_HEADPHONE_L 0x06 /* LiveDrive - Headphone - left */
     231#define EXTOUT_HEADPHONE_R 0x07 /* LiveDrive - Headphone - right */
     232#define EXTOUT_REAR_L      0x08 /* Rear channel - left */
     233#define EXTOUT_REAR_R      0x09 /* Rear channel - right */
     234#define EXTOUT_ADC_CAP_L   0x0a /* ADC Capture buffer - left */
     235#define EXTOUT_ADC_CAP_R   0x0b /* ADC Capture buffer - right */
     236#define EXTOUT_MIC_CAP     0x0c /* MIC Capture buffer */
     237#define EXTOUT_AC97_REAR_L 0x0d /* SB Live 5.1 (c) 2003 - Rear Left */
     238#define EXTOUT_AC97_REAR_R 0x0e /* SB Live 5.1 (c) 2003 - Rear Right */
     239#define EXTOUT_ACENTER     0x11 /* Analog Center */
     240#define EXTOUT_ALFE        0x12 /* Analog LFE */
     241
     242/* Audigy Inputs */
     243#define A_EXTIN_AC97_L          0x00    /* AC'97 capture channel - left */
     244#define A_EXTIN_AC97_R          0x01    /* AC'97 capture channel - right */
     245#define A_EXTIN_SPDIF_CD_L      0x02    /* digital CD left */
     246#define A_EXTIN_SPDIF_CD_R      0x03    /* digital CD left */
     247#define A_EXTIN_OPT_SPDIF_L     0x04    /* audigy drive Optical SPDIF - left */
     248#define A_EXTIN_OPT_SPDIF_R     0x05    /*                              right */
     249#define A_EXTIN_LINE2_L         0x08    /* audigy drive line2/mic2 - left */
     250#define A_EXTIN_LINE2_R         0x09    /*                           right */
     251#define A_EXTIN_ADC_L           0x0a    /* Philips ADC - left */
     252#define A_EXTIN_ADC_R           0x0b    /*               right */
     253#define A_EXTIN_AUX2_L          0x0c    /* audigy drive aux2 - left */
     254#define A_EXTIN_AUX2_R          0x0d    /*                   - right */
     255
     256/* Audigiy Outputs */
     257#define A_EXTOUT_FRONT_L        0x00    /* digital front left */
     258#define A_EXTOUT_FRONT_R        0x01    /*               right */
     259#define A_EXTOUT_CENTER         0x02    /* digital front center */
     260#define A_EXTOUT_LFE            0x03    /* digital front lfe */
     261#define A_EXTOUT_HEADPHONE_L    0x04    /* headphone audigy drive left */
     262#define A_EXTOUT_HEADPHONE_R    0x05    /*                        right */
     263#define A_EXTOUT_REAR_L         0x06    /* digital rear left */
     264#define A_EXTOUT_REAR_R         0x07    /*              right */
     265#define A_EXTOUT_AFRONT_L       0x08    /* analog front left */
     266#define A_EXTOUT_AFRONT_R       0x09    /*              right */
     267#define A_EXTOUT_ACENTER        0x0a    /* analog center */
     268#define A_EXTOUT_ALFE           0x0b    /* analog LFE */
     269#define A_EXTOUT_ASIDE_L        0x0c    /* analog side left  - Audigy 2 ZS */
     270#define A_EXTOUT_ASIDE_R        0x0d    /*             right - Audigy 2 ZS */
     271#define A_EXTOUT_AREAR_L        0x0e    /* analog rear left */
     272#define A_EXTOUT_AREAR_R        0x0f    /*             right */
     273#define A_EXTOUT_AC97_L         0x10    /* AC97 left (front) */
     274#define A_EXTOUT_AC97_R         0x11    /*      right */
     275#define A_EXTOUT_ADC_CAP_L      0x16    /* ADC capture buffer left */
     276#define A_EXTOUT_ADC_CAP_R      0x17    /*                    right */
     277#define A_EXTOUT_MIC_CAP        0x18    /* Mic capture buffer */
     278
     279/* Definitions for debug register. Note that these are for emu10k1 ONLY. */
    254280#define EMU10K1_DBG_ZC                  0x80000000      /* zero tram counter */
    255281#define EMU10K1_DBG_SATURATION_OCCURED  0x02000000      /* saturation control */
     
    260286#define EMU10K1_DBG_SINGLE_STEP_ADDR    0x000001ff      /* single step address */
    261287
    262 /* tank memory address line */
    263 #ifndef __KERNEL__
    264 #define TANKMEMADDRREG_ADDR_MASK 0x000fffff     /* 20 bit tank address field                    */
    265 #define TANKMEMADDRREG_CLEAR     0x00800000     /* Clear tank memory                            */
    266 #define TANKMEMADDRREG_ALIGN     0x00400000     /* Align read or write relative to tank access  */
    267 #define TANKMEMADDRREG_WRITE     0x00200000     /* Write to tank memory                         */
    268 #define TANKMEMADDRREG_READ      0x00100000     /* Read from tank memory                        */
    269 #endif
     288/* Definitions for emu10k2 debug register. */
     289#define A_DBG_ZC                        0x40000000      /* zero tram counter */
     290#define A_DBG_SATURATION_OCCURED        0x20000000
     291#define A_DBG_SATURATION_ADDR           0x0ffc0000
     292#define A_DBG_SINGLE_STEP               0x00020000      /* Set to zero to start dsp */
     293#define A_DBG_STEP                      0x00010000
     294#define A_DBG_CONDITION_CODE            0x0000f800
     295#define A_DBG_STEP_ADDR                 0x000003ff
    270296
    271297struct snd_emu10k1_fx8010_info {
     
    283309#define EMU10K1_GPR_TRANSLATION_TREBLE          3
    284310#define EMU10K1_GPR_TRANSLATION_ONOFF           4
     311#define EMU10K1_GPR_TRANSLATION_NEGATE          5
     312#define EMU10K1_GPR_TRANSLATION_NEG_TABLE100    6
    285313
    286314enum emu10k1_ctl_elem_iface {
     
    303331        unsigned int count;             /* count of GPR (1..16) */
    304332        unsigned short gpr[32];         /* GPR number(s) */
    305         unsigned int value[32];         /* initial values */
    306         unsigned int min;               /* minimum range */
    307         unsigned int max;               /* maximum range */
     333        int value[32];                  /* initial values */
     334        int min;                        /* minimum range */
     335        int max;                        /* maximum range */
    308336        unsigned int translation;       /* translation type (EMU10K1_GPR_TRANSLATION*) */
    309337        const unsigned int *tlv;
  • GPL/trunk/alsa-kernel/include/uapi/sound/tlv.h

    r615 r772  
    11/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
    2 /*
    3  *   This program is free software; you can redistribute it and/or modify
    4  *   it under the terms of the GNU General Public License as published by
    5  *   the Free Software Foundation; either version 2 of the License, or
    6  *   (at your option) any later version.
    7  *
    8  *   This program is distributed in the hope that it will be useful,
    9  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
    10  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    11  *   GNU General Public License for more details.
    12  */
    132
    143#ifndef __UAPI_SOUND_TLV_H
Note: See TracChangeset for help on using the changeset viewer.