Ignore:
Timestamp:
Apr 3, 2017, 4:51:56 PM (9 years ago)
Author:
David Azarewicz
Message:

Merged/reintegrated v2 branch into trunk. Trunk is now v2

Location:
GPL/trunk
Files:
31 added
14 deleted
27 edited

Legend:

Unmodified
Added
Removed
  • GPL/trunk

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

    r464 r598  
    478478struct snd_ac97 {
    479479        /* -- lowlevel (hardware) driver specific -- */
    480         struct snd_ac97_build_ops * build_ops;
     480        const struct snd_ac97_build_ops *build_ops;
    481481        void *private_data;
    482482        void (*private_free) (struct snd_ac97 *ac97);
     
    594594struct ac97_quirk {
    595595        unsigned short subvendor; /* PCI subsystem vendor id */
    596         unsigned short subdevice; /* PCI sybsystem device id */
     596        unsigned short subdevice; /* PCI subsystem device id */
    597597        unsigned short mask;    /* device id bit mask, 0 = accept all */
    598598        unsigned int codec_id;  /* codec id (if any), 0 = accept all */
  • GPL/trunk/alsa-kernel/include/sound/ak4114.h

    r399 r598  
    9696/* AK4114_REG_IO0 */
    9797#define AK4114_TX1E             (1<<7)  /* TX1 Output Enable (1 = enable) */
    98 #define AK4114_OPS12            (1<<2)  /* Output Though Data Selector for TX1 pin */
    99 #define AK4114_OPS11            (1<<1)  /* Output Though Data Selector for TX1 pin */
    100 #define AK4114_OPS10            (1<<0)  /* Output Though Data Selector for TX1 pin */
     98#define AK4114_OPS12            (1<<6)  /* Output Data Selector for TX1 pin */
     99#define AK4114_OPS11            (1<<5)  /* Output Data Selector for TX1 pin */
     100#define AK4114_OPS10            (1<<4)  /* Output Data Selector for TX1 pin */
    101101#define AK4114_TX0E             (1<<3)  /* TX0 Output Enable (1 = enable) */
    102 #define AK4114_OPS02            (1<<2)  /* Output Though Data Selector for TX0 pin */
    103 #define AK4114_OPS01            (1<<1)  /* Output Though Data Selector for TX0 pin */
    104 #define AK4114_OPS00            (1<<0)  /* Output Though Data Selector for TX0 pin */
     102#define AK4114_OPS02            (1<<2)  /* Output Data Selector for TX0 pin */
     103#define AK4114_OPS01            (1<<1)  /* Output Data Selector for TX0 pin */
     104#define AK4114_OPS00            (1<<0)  /* Output Data Selector for TX0 pin */
    105105
    106106/* AK4114_REG_IO1 */
  • GPL/trunk/alsa-kernel/include/sound/ak4xxx-adda.h

    r399 r598  
    6969                SND_AK4524, SND_AK4528, SND_AK4529,
    7070                SND_AK4355, SND_AK4358, SND_AK4381,
    71                 SND_AK5365
     71                SND_AK5365, SND_AK4620,
    7272        } type;
    7373
     
    7777
    7878        struct snd_ak4xxx_ops ops;
     79        unsigned int num_chips;
     80        unsigned int total_regs;
     81        const char *name;
    7982};
    8083
  • GPL/trunk/alsa-kernel/include/sound/asequencer.h

    r587 r598  
    6868#define SNDRV_SEQ_EVENT_TIMESIGN        23      /* SMF Time Signature event */
    6969#define SNDRV_SEQ_EVENT_KEYSIGN         24      /* SMF Key Signature event */
    70        
     70               
    7171/** timer messages
    7272 * event data type = snd_seq_ev_queue_control
     
    222222
    223223        /* external stored data */
    224 #ifndef TARGET_OS2     
     224#ifndef TARGET_OS2
    225225struct snd_seq_ev_ext {
    226226        unsigned int len;       /* length of data */
     
    235235#pragma pack()
    236236#endif
    237 
    238237struct snd_seq_result {
    239238        int event;              /* processed event type */
     
    274273
    275274        /* quoted event - inside the kernel only */
    276 #ifndef TARGET_OS2     
     275#ifndef TARGET_OS2
    277276struct snd_seq_ev_quote {
    278277        struct snd_seq_addr origin;             /* original sender */
     
    423422#define USER_CLIENT     ((__force snd_seq_client_type_t) 1)
    424423#define KERNEL_CLIENT   ((__force snd_seq_client_type_t) 2)
    425 
     424                       
    426425        /* event filter flags */
    427426#define SNDRV_SEQ_FILTER_BROADCAST      (1<<0)  /* accept broadcast messages */
  • GPL/trunk/alsa-kernel/include/sound/asound.h

    r587 r598  
    4242#endif /* __KERNEL__ **/
    4343
    44 #ifdef TARGET_OS2
    4544#ifndef __force
    4645#define __force
     
    5150#endif
    5251
     52#ifdef TARGET_OS2
    5353#define SNDRV_PCM_VOL_FRONT_LEFT        0
    5454#define SNDRV_PCM_VOL_FRONT_RIGHT       1
     
    236236#define SNDRV_PCM_FORMAT_U18_3LE        ((__force snd_pcm_format_t) 42) /* in three bytes */
    237237#define SNDRV_PCM_FORMAT_U18_3BE        ((__force snd_pcm_format_t) 43) /* in three bytes */
    238 #define SNDRV_PCM_FORMAT_LAST           SNDRV_PCM_FORMAT_U18_3BE
     238#define SNDRV_PCM_FORMAT_G723_24        ((__force snd_pcm_format_t) 44) /* 8 samples in 3 bytes */
     239#define SNDRV_PCM_FORMAT_G723_24_1B     ((__force snd_pcm_format_t) 45) /* 1 sample in 1 byte */
     240#define SNDRV_PCM_FORMAT_G723_40        ((__force snd_pcm_format_t) 46) /* 8 Samples in 5 bytes */
     241#define SNDRV_PCM_FORMAT_G723_40_1B     ((__force snd_pcm_format_t) 47) /* 1 sample in 1 byte */
     242#define SNDRV_PCM_FORMAT_LAST           SNDRV_PCM_FORMAT_G723_40_1B
    239243
    240244#ifdef SNDRV_LITTLE_ENDIAN
     
    279283#define SNDRV_PCM_INFO_JOINT_DUPLEX     0x00200000      /* playback and capture stream are somewhat correlated */
    280284#define SNDRV_PCM_INFO_SYNC_START       0x00400000      /* pcm support some kind of sync go */
     285#define SNDRV_PCM_INFO_NO_PERIOD_WAKEUP 0x00800000      /* period wakeup can be disabled */
    281286#define SNDRV_PCM_INFO_FIFO_IN_FRAMES   0x80000000      /* internal kernel flag - FIFO size is in frames */
    282287
     
    323328typedef int snd_pcm_hw_param_t;
    324329#define SNDRV_PCM_HW_PARAM_ACCESS       0       /* Access type */
    325 #ifndef TARGET_OS2
    326 #define SNDRV_PCM_HW_PARAM_FORMAT       1       /* Format */
    327 #define SNDRV_PCM_HW_PARAM_SUBFORMAT    2       /* Subformat */
    328 #else
     330#ifdef TARGET_OS2
    329331#define SNDRV_PCM_HW_PARAM_RATE_MASK    1 /* Format */
     332#endif
    330333#define SNDRV_PCM_HW_PARAM_FORMAT       2       /* Format */
    331334#define SNDRV_PCM_HW_PARAM_SUBFORMAT    3       /* Subformat */
    332 #endif
    333335#define SNDRV_PCM_HW_PARAM_FIRST_MASK   SNDRV_PCM_HW_PARAM_ACCESS
    334336#define SNDRV_PCM_HW_PARAM_LAST_MASK    SNDRV_PCM_HW_PARAM_SUBFORMAT
     
    360362
    361363#define SNDRV_PCM_HW_PARAMS_NORESAMPLE  (1<<0)  /* avoid rate resampling */
     364#define SNDRV_PCM_HW_PARAMS_EXPORT_BUFFER       (1<<1)  /* export buffer */
     365#define SNDRV_PCM_HW_PARAMS_NO_PERIOD_WAKEUP    (1<<2)  /* disable period wakeups */
    362366
    363367struct snd_interval {
     
    574578 */
    575579
    576 #define SNDRV_TIMER_VERSION             SNDRV_PROTOCOL_VERSION(2, 0, 5)
     580#define SNDRV_TIMER_VERSION             SNDRV_PROTOCOL_VERSION(2, 0, 6)
    577581
    578582enum {
     
    604608
    605609struct snd_timer_id {
    606         int dev_class; 
     610        int dev_class;
    607611        int dev_sclass;
    608612        int card;
     
    731735#define SNDRV_CTL_VERSION               SNDRV_PROTOCOL_VERSION(2, 0, 6)
    732736
     737/******************** This section used in uniaud.dll interface *********************/
    733738struct snd_ctl_card_info {
    734739        int card;                       /* card number */
     
    792797        unsigned int device;            /* device/client number */
    793798        unsigned int subdevice;         /* subdevice (substream) number */
    794         unsigned char name[44];         /* ASCII name of item */
     799        unsigned char name[44];         /* ASCII name of item */
    795800        unsigned int index;             /* index of item */
    796801};
     
    839844        struct snd_ctl_elem_id id;      /* W: element ID */
    840845        unsigned int indirect: 1;       /* W: indirect access - obsoleted */
    841         union {
     846        union {
    842847                union {
    843848                        long value[128];
     
    857862                } bytes;
    858863                struct snd_aes_iec958 iec958;
    859         } value;                /* RO */
     864        } value;                /* RO */
    860865        struct timespec tstamp;
    861         unsigned char reserved[128-sizeof(struct timespec)];
     866        unsigned char reserved[128-sizeof(struct timespec)];
    862867};
    863868
    864869struct snd_ctl_tlv {
    865         unsigned int numid;     /* control element numeric identification */
    866         unsigned int length;    /* in bytes aligned to 4 */
     870        unsigned int numid;     /* control element numeric identification */
     871        unsigned int length;    /* in bytes aligned to 4 */
    867872#ifndef TARGET_OS2
    868         unsigned int tlv[0];    /* first TLV */
     873        unsigned int tlv[0];    /* first TLV */
    869874#else
    870         unsigned int tlv[1];    /* first TLV */
     875        unsigned int tlv[1];    /* first TLV */
    871876#endif
    872877};
     
    924929                        struct snd_ctl_elem_id id;
    925930                } elem;
    926                 unsigned char data8[60];
    927         } data;
     931                unsigned char data8[60];
     932        } data;
    928933};
    929934
  • GPL/trunk/alsa-kernel/include/sound/control.h

    r426 r598  
    5757struct snd_kcontrol_volatile {
    5858        struct snd_ctl_file *owner;     /* locked */
    59         pid_t owner_pid;
    6059        unsigned int access;    /* access rights */
    6160};
     
    9594#define snd_kctl_event(n) list_entry(n, struct snd_kctl_event, list)
    9695
     96struct pid;
     97
    9798struct snd_ctl_file {
    9899        struct list_head list;          /* list of all control files */
    99100        struct snd_card *card;
    100         pid_t pid;
     101        struct pid *pid;
    101102        int prefer_pcm_subdevice;
    102103        int prefer_rawmidi_subdevice;
     
    167168
    168169/*
    169  * Frequently used control callbacks
     170 * Frequently used control callbacks/helpers
    170171 */
    171172int snd_ctl_boolean_mono_info(struct snd_kcontrol *kcontrol,
     
    173174int snd_ctl_boolean_stereo_info(struct snd_kcontrol *kcontrol,
    174175                                struct snd_ctl_elem_info *uinfo);
     176int snd_ctl_enum_info(struct snd_ctl_elem_info *info, unsigned int channels,
     177                      unsigned int items, const char *const names[]);
    175178
    176179/*
  • GPL/trunk/alsa-kernel/include/sound/core.h

    r587 r598  
    2323 */
    2424#ifdef TARGET_OS2
    25 #include <config.h>
     25#include <sound\config.h>
    2626#endif
    2727
     
    9797#define snd_device(n) list_entry(n, struct snd_device, list)
    9898
    99 /* monitor files for graceful shutdown (hotplug) */
    100 
    101 struct snd_monitor_file {
    102         struct file *file;
    103 #ifndef TARGET_OS2     
    104         const struct file_operations *disconnected_f_op;
    105 #else
    106         struct file_operations *disconnected_f_op;
    107 #endif 
    108         struct list_head shutdown_list; /* still need to shutdown */
    109         struct list_head list;  /* link of monitor files */
    110 };
    111 
    11299/* main structure for soundcard */
    113100
     
    150137        wait_queue_head_t shutdown_sleep;
    151138        struct device *dev;             /* device assigned to this card */
    152 #ifndef CONFIG_SYSFS_DEPRECATED
    153139        struct device *card_dev;        /* cardX object for sysfs */
    154 #endif
    155140
    156141#ifdef CONFIG_PM
     
    196181#define snd_power_unlock(card)          do { (void)(card); } while (0)
    197182static inline int snd_power_wait(struct snd_card *card, unsigned int state) { return 0; }
    198 #define snd_power_get_state(card)       SNDRV_CTL_POWER_D0
     183#define snd_power_get_state(card)       ({ (void)(card); SNDRV_CTL_POWER_D0; })
    199184#define snd_power_change_state(card, state)     do { (void)(card); } while (0)
    200185
     
    205190        int card;                       /* card number */
    206191        int device;                     /* device number */
    207 #ifndef TARGET_OS2     
     192#ifndef TARGET_OS2
    208193        const struct file_operations *f_ops;    /* file operations */
    209194#else
    210195        struct file_operations *f_ops;  /* file operations */
    211 #endif 
     196#endif
    212197        void *private_data;             /* private data for f_ops->open */
    213198        struct device *dev;             /* device for sysfs */
     
    217202static inline struct device *snd_card_get_device_link(struct snd_card *card)
    218203{
    219 #ifdef CONFIG_SYSFS_DEPRECATED
    220         return card ? card->dev : NULL;
    221 #else
    222204        return card ? card->card_dev : NULL;
    223 #endif
    224205}
    225206
     
    234215int snd_register_device_for_dev(int type, struct snd_card *card,
    235216                                int dev,
    236 #ifndef TARGET_OS2                             
     217#ifndef TARGET_OS2
    237218                                const struct file_operations *f_ops,
    238219#else
    239220                                struct file_operations *f_ops,
    240 #endif                         
     221#endif
    241222                                void *private_data,
    242223                                const char *name,
     
    263244#ifndef TARGET_OS2
    264245                                      const struct file_operations *f_ops,
    265 #else                           
     246#else
    266247                                      struct file_operations *f_ops,
    267 #endif                         
     248#endif
    268249                                      void *private_data,
    269250                                      const char *name)
     
    285266#else
    286267                            struct file_operations *f_ops, void *private_data,
    287 #endif                 
     268#endif
    288269                            const char *name);
    289270int snd_unregister_oss_device(int type, struct snd_card *card, int dev);
     
    335316int snd_card_file_remove(struct snd_card *card, struct file *file);
    336317
    337 #ifndef snd_card_set_dev
    338318#define snd_card_set_dev(card, devptr) ((card)->dev = (devptr))
    339 #endif
    340319
    341320/* device.c */
     
    376355#else
    377356#define __snd_printk printk
    378 #endif 
     357#endif /* nothing */
    379358#endif
    380359
     
    418397 * When CONFIG_SND_DEBUG is set, this macro evaluates the given condition,
    419398 * and call WARN() and returns the value if it's non-zero.
    420  *
     399 * 
    421400 * When CONFIG_SND_DEBUG is not set, this just returns zero, and the given
    422401 * condition is ignored.
     
    427406 * If you want to evaluate and give a warning, use standard WARN_ON().
    428407 */
     408
    429409#define snd_BUG_ON(cond)        WARN((cond), "BUG? (%s)\n", __stringify(cond))
    430410
     
    448428#define snd_BUG_ON(cond)        __snd_bug_on(0 && (cond))  /* always false */
    449429#endif
     430
    450431
    451432#endif /* CONFIG_SND_DEBUG */
     
    478459/* for easier backward-porting */
    479460#if defined(CONFIG_GAMEPORT) || defined(CONFIG_GAMEPORT_MODULE)
    480 #ifndef gameport_set_dev_parent
    481461#define gameport_set_dev_parent(gp,xdev) ((gp)->dev.parent = (xdev))
    482462#define gameport_set_port_data(gp,r) ((gp)->port_data = (r))
    483463#define gameport_get_port_data(gp) (gp)->port_data
    484 #endif
    485464#endif
    486465
     
    521500snd_pci_quirk_lookup(struct pci_dev *pci, const struct snd_pci_quirk *list);
    522501
     502const struct snd_pci_quirk *
     503snd_pci_quirk_lookup_id(u16 vendor, u16 device,
     504                        const struct snd_pci_quirk *list);
    523505
    524506#endif /* __SOUND_CORE_H */
  • GPL/trunk/alsa-kernel/include/sound/cs4231-regs.h

    r399 r598  
    7171#define CS4235_LEFT_MASTER      0x1b    /* left master output control */
    7272#define CS4231_REC_FORMAT       0x1c    /* clock and data format - record - bits 7-0 MCE */
    73 #define CS4231_PLY_VAR_FREQ     0x1d    /* playback variable frequency */
    7473#define AD1845_CLOCK            0x1d    /* crystal clock select and total power down */
    7574#define CS4235_RIGHT_MASTER     0x1d    /* right master output control */
  • GPL/trunk/alsa-kernel/include/sound/cs46xx_dsp_spos.h

    r305 r598  
    119119        struct snd_info_entry *proc_info;
    120120        int ref_count;
    121         spinlock_t lock;
    122 
    123         int deleted;
     121
     122        u16 volume[2];
     123        unsigned int deleted :1;
     124        unsigned int updated :1;
     125        unsigned int volume_set :1;
    124126};
    125127
  • GPL/trunk/alsa-kernel/include/sound/emu10k1.h

    r426 r598  
    439439#define CCCA_CURRADDR           0x18000008
    440440
     441/* undefine CCR to avoid conflict with the definition for SH */
     442#undef CCR
    441443#define CCR                     0x09            /* Cache control register                               */
    442444#define CCR_CACHEINVALIDSIZE    0x07190009
     
    17081710        unsigned int ecard_ctrl;                /* ecard control bits */
    17091711        unsigned long dma_mask;                 /* PCI DMA mask */
     1712        unsigned int delay_pcm_irq;             /* in samples */
    17101713        int max_cache_pages;                    /* max memory size / PAGE_SIZE */
    17111714        struct snd_dma_buffer silent_page;      /* silent page */
  • GPL/trunk/alsa-kernel/include/sound/es1688.h

    r398 r598  
    4545        unsigned int dma_size;
    4646
    47         struct snd_card *card;
    4847        struct snd_pcm *pcm;
    4948        struct snd_pcm_substream *playback_substream;
     
    109108
    110109int snd_es1688_create(struct snd_card *card,
     110                      struct snd_es1688 *chip,
    111111                      unsigned long port,
    112112                      unsigned long mpu_port,
     
    114114                      int mpu_irq,
    115115                      int dma8,
    116                       unsigned short hardware,
    117                       struct snd_es1688 ** rchip);
    118 int snd_es1688_pcm(struct snd_es1688 *chip, int device, struct snd_pcm ** rpcm);
    119 int snd_es1688_mixer(struct snd_es1688 *chip);
     116                      unsigned short hardware);
     117int snd_es1688_pcm(struct snd_card *card, struct snd_es1688 *chip, int device,
     118                   struct snd_pcm **rpcm);
     119int snd_es1688_mixer(struct snd_card *card, struct snd_es1688 *chip);
     120int snd_es1688_reset(struct snd_es1688 *chip);
    120121
    121122#endif /* __SOUND_ES1688_H */
  • GPL/trunk/alsa-kernel/include/sound/hdsp.h

    r426 r598  
    2929        H9652,
    3030        H9632,
     31        RPM,
    3132        Undefined,
    3233};
  • GPL/trunk/alsa-kernel/include/sound/info.h

    r587 r598  
    5252        int (*release)(struct snd_info_entry *entry,
    5353                       unsigned short mode, void *file_private_data);
    54         long (*read)(struct snd_info_entry *entry, void *file_private_data,
    55                      struct file *file, char __user *buf,
    56                      unsigned long count, unsigned long pos);
    57         long (*write)(struct snd_info_entry *entry, void *file_private_data,
    58                       struct file *file, const char __user *buf,
    59                       unsigned long count, unsigned long pos);
    60         long long (*llseek)(struct snd_info_entry *entry,
    61                             void *file_private_data, struct file *file,
    62                             long long offset, int orig);
    63         unsigned int(*poll)(struct snd_info_entry *entry,
    64                             void *file_private_data, struct file *file,
    65                             poll_table *wait);
     54        ssize_t (*read)(struct snd_info_entry *entry, void *file_private_data,
     55                        struct file *file, char __user *buf,
     56                        size_t count, loff_t pos);
     57        ssize_t (*write)(struct snd_info_entry *entry, void *file_private_data,
     58                        struct file *file, const char __user *buf,
     59                         size_t count, loff_t pos);
     60        loff_t (*llseek)(struct snd_info_entry *entry,
     61                         void *file_private_data, struct file *file,
     62                         loff_t offset, int orig);
     63        unsigned int (*poll)(struct snd_info_entry *entry,
     64                             void *file_private_data, struct file *file,
     65                             poll_table *wait);
    6666        int (*ioctl)(struct snd_info_entry *entry, void *file_private_data,
    6767                     struct file *file, unsigned int cmd, unsigned long arg);
     
    111111#endif
    112112
    113 int snd_iprintf(struct snd_info_buffer *buffer, char *fmt, ...) \
     113#ifndef TARGET_OS2
     114int snd_iprintf(struct snd_info_buffer *buffer, const char *fmt, ...) \
    114115                                __attribute__ ((format (printf, 2, 3)));
     116#else
     117int snd_iprintf(struct snd_info_buffer * buffer, char *fmt,...);
     118#endif
    115119int snd_info_init(void);
    116120int snd_info_done(void);
    117121
    118122int snd_info_get_line(struct snd_info_buffer *buffer, char *line, int len);
    119 char *snd_info_get_str(char *dest, char *src, int len);
     123const char *snd_info_get_str(char *dest, const char *src, int len);
    120124struct snd_info_entry *snd_info_create_module_entry(struct module *module,
    121125                                               const char *name,
  • GPL/trunk/alsa-kernel/include/sound/initval.h

    r587 r598  
    2222 */
    2323
    24 #ifdef TARGET_OS2
    2524#ifndef MODULE_GENERIC_STRING
    2625#ifdef MODULE
     
    3332#endif
    3433
    35 #define MODULE_CLASSES(val)
    36 #define MODULE_DEVICES(val)
    37 #define MODULE_PARM_SYNTAX(id, val)
     34#ifdef TARGET_OS2
     35#define MODULE_CLASSES(val)
     36#define MODULE_DEVICES(val)
     37#define MODULE_PARM_SYNTAX(id, val)
    3838#define module_param_array(name, type, nump, perm)
    3939#define module_param(name, type, perm)
     
    5252#define module_param(name, type, perm) \
    5353        MODULE_PARM(name, SNDRV_MODULE_TYPE_##type)
     54
    5455#endif
    5556
    56 #ifndef TARGET_OS2
    57 #define SNDRV_AUTO_PORT         1
    58 #else
    5957#define SNDRV_AUTO_PORT         0xffff
    60 #endif
    6158#define SNDRV_AUTO_IRQ          0xffff
    6259#define SNDRV_AUTO_DMA          0xffff
     
    7875#define SNDRV_DEFAULT_ENABLE    { 1,1,1,1,1,1,1,1 }
    7976#define SNDRV_DEFAULT_ENABLE_PNP        SNDRV_DEFAULT_ENABLE
    80 #ifdef CONFIG_PNP
    81 #define SNDRV_DEFAULT_ENABLE_ISAPNP SNDRV_DEFAULT_ENABLE_PNP
    82 #else
    83 #define SNDRV_DEFAULT_ENABLE_ISAPNP SNDRV_DEFAULT_ENABLE
    84 #endif
    8577#define SNDRV_DEFAULT_PORT      { REPEAT_SNDRV(-1) }
    8678#define SNDRV_DEFAULT_IRQ       { REPEAT_SNDRV(SNDRV_AUTO_IRQ) }
     
    9183#define SNDDRV_DEFAULT_PCM_SUBSTREAMS {REPEAT_SNDRV(8)};
    9284#define SNDDRV_DEFAULT_MIDI_DEVS      {REPEAT_SNDRV(4)};
     85#else
     86#define SNDRV_DEFAULT_IDX       { [0 ... (SNDRV_CARDS-1)] = -1 }
     87#define SNDRV_DEFAULT_STR       { [0 ... (SNDRV_CARDS-1)] = NULL }
     88#define SNDRV_DEFAULT_ENABLE    { 1, [1 ... (SNDRV_CARDS-1)] = 0 }
     89#define SNDRV_DEFAULT_ENABLE_PNP { [0 ... (SNDRV_CARDS-1)] = 1 }
     90#define SNDRV_DEFAULT_PORT      { SNDRV_AUTO_PORT, [1 ... (SNDRV_CARDS-1)] = -1 }
     91#define SNDRV_DEFAULT_IRQ       { [0 ... (SNDRV_CARDS-1)] = SNDRV_AUTO_IRQ }
     92#define SNDRV_DEFAULT_DMA       { [0 ... (SNDRV_CARDS-1)] = SNDRV_AUTO_DMA }
     93#define SNDRV_DEFAULT_DMA_SIZE  { [0 ... (SNDRV_CARDS-1)] = SNDRV_AUTO_DMA_SIZE }
     94#define SNDRV_DEFAULT_PTR       SNDRV_DEFAULT_STR
     95#endif
     96
     97#ifdef CONFIG_PNP
     98#define SNDRV_DEFAULT_ENABLE_ISAPNP SNDRV_DEFAULT_ENABLE_PNP
     99#else
     100#define SNDRV_DEFAULT_ENABLE_ISAPNP SNDRV_DEFAULT_ENABLE
     101#endif
    93102
    94103#define SNDRV_BOOLEAN_TRUE_DESC "allows:{{0,Disabled},{1,Enabled}},default:1,dialog:check"
     
    110119#define SNDRV_PORT12_DESC       SNDRV_ENABLED ",allows:{{0,0x3fff}},base:16"
    111120#define SNDRV_PORT_DESC         SNDRV_ENABLED ",allows:{{0,0xffff}},base:16"
    112 #else
    113 #define SNDRV_DEFAULT_IDX       { [0 ... (SNDRV_CARDS-1)] = -1 }
    114 #define SNDRV_DEFAULT_STR       { [0 ... (SNDRV_CARDS-1)] = NULL }
    115 #define SNDRV_DEFAULT_ENABLE    { 1, [1 ... (SNDRV_CARDS-1)] = 0 }
    116 #define SNDRV_DEFAULT_ENABLE_PNP { [0 ... (SNDRV_CARDS-1)] = 1 }
    117 #ifdef CONFIG_PNP
    118 #define SNDRV_DEFAULT_ENABLE_ISAPNP SNDRV_DEFAULT_ENABLE_PNP
    119 #else
    120 #define SNDRV_DEFAULT_ENABLE_ISAPNP SNDRV_DEFAULT_ENABLE
    121 #endif
    122 #define SNDRV_DEFAULT_PORT      { [0 ... (SNDRV_CARDS-1)] = SNDRV_AUTO_PORT }
    123 #define SNDRV_DEFAULT_IRQ       { [0 ... (SNDRV_CARDS-1)] = SNDRV_AUTO_IRQ }
    124 #define SNDRV_DEFAULT_DMA       { [0 ... (SNDRV_CARDS-1)] = SNDRV_AUTO_DMA }
    125 #define SNDRV_DEFAULT_DMA_SIZE  { [0 ... (SNDRV_CARDS-1)] = SNDRV_AUTO_DMA_SIZE }
    126 #define SNDRV_DEFAULT_PTR       SNDRV_DEFAULT_STR
    127 #endif
    128121
    129122#ifdef SNDRV_LEGACY_FIND_FREE_IRQ
     
    164157#endif
    165158
    166 #ifdef TARGET_OS2
    167159#if defined(SNDRV_GET_ID) && !defined(MODULE)
    168160#include <linux/ctype.h>
     
    190182}
    191183#endif
    192 #endif
    193184
    194 #endif /* __SOUND_INITVAL_H */
    195 
     185#endif                          /* __INITVAL_H */
  • GPL/trunk/alsa-kernel/include/sound/jack.h

    r426 r598  
    4343        SND_JACK_VIDEOOUT       = 0x0010,
    4444        SND_JACK_AVOUT          = SND_JACK_LINEOUT | SND_JACK_VIDEOOUT,
     45
     46        /* Kept separate from switches to facilitate implementation */
     47        SND_JACK_BTN_0          = 0x4000,
     48        SND_JACK_BTN_1          = 0x2000,
     49        SND_JACK_BTN_2          = 0x1000,
     50        SND_JACK_BTN_3          = 0x0800,
     51        SND_JACK_BTN_4          = 0x0400,
     52        SND_JACK_BTN_5          = 0x0200,
    4553};
    4654
     
    5159        const char *id;
    5260        char name[100];
     61        unsigned int key[6];   /* Keep in sync with definitions above */
    5362        void *private_data;
    5463        void (*private_free)(struct snd_jack *);
     
    6069                 struct snd_jack **jack);
    6170void snd_jack_set_parent(struct snd_jack *jack, struct device *parent);
     71int snd_jack_set_key(struct snd_jack *jack, enum snd_jack_types type,
     72                     int keytype);
    6273
    6374void snd_jack_report(struct snd_jack *jack, int status);
  • GPL/trunk/alsa-kernel/include/sound/minors.h

    r464 r598  
    3232#define SNDRV_MINOR_CONTROL             0       /* 0 */
    3333#define SNDRV_MINOR_GLOBAL              1       /* 1 */
    34 #define SNDRV_MINOR_SEQUENCER           (SNDRV_MINOR_GLOBAL + 0 * 32)
    35 #define SNDRV_MINOR_TIMER               (SNDRV_MINOR_GLOBAL + 1 * 32)
     34#define SNDRV_MINOR_SEQUENCER           1       /* SNDRV_MINOR_GLOBAL + 0 * 32 */
     35#define SNDRV_MINOR_TIMER               33      /* SNDRV_MINOR_GLOBAL + 1 * 32 */
    3636
    3737#ifndef CONFIG_SND_DYNAMIC_MINORS
  • GPL/trunk/alsa-kernel/include/sound/opl3.h

    r587 r598  
    1818 *
    1919 *      With the above exceptions the both sides can be operated independently.
    20  *
     20 *     
    2121 *      A 4 OP voice can be created by setting the corresponding
    2222 *      bit at offset 4 of the right side.
     
    2727 *
    2828 *      If a voice is set to the 2 OP mode, it works like 2 OP modes
    29  *      of the original YM3812 (AdLib). In addition the voice can
     29 *      of the original YM3812 (AdLib). In addition the voice can 
    3030 *      be connected the left, right or both stereo channels. It can
    3131 *      even be left unconnected. This works with 4 OP voices also.
     
    189189 *
    190190 *
    191  *
     191 *                                     
    192192 *                                       +---+
    193193 *                                       |   |
     
    195195 *                                                |->
    196196 *                                      >--3----4-+
    197  *
     197 *                                     
    198198 *                                       +---+
    199199 *                                       |   |
     
    251251        unsigned char sustain_release;
    252252        unsigned char wave_select;
     253#ifndef TARGET_OS2
    253254} __attribute__((packed));
    254 #ifdef TARGET_OS2
     255#else
     256};
    255257#pragma pack()
    256258#endif
     
    341343        struct snd_midi_channel_set * oss_chset;
    342344#endif
    343 
     345 
    344346#define OPL3_PATCH_HASH_SIZE    32
    345347        struct fm_patch *patch_table[OPL3_PATCH_HASH_SIZE];
  • GPL/trunk/alsa-kernel/include/sound/pcm.h

    r587 r598  
    3030#include <linux/mm.h>
    3131#include <linux/bitops.h>
     32#include <linux/pm_qos_params.h>
    3233
    3334#define snd_pcm_substream_chip(substream) ((substream)->private_data)
     
    7475                    snd_pcm_uframes_t pos,
    7576                    void __user *buf, snd_pcm_uframes_t count);
    76         int (*silence)(struct snd_pcm_substream *substream, int channel,
     77        int (*silence)(struct snd_pcm_substream *substream, int channel, 
    7778                       snd_pcm_uframes_t pos, snd_pcm_uframes_t count);
    7879        struct page *(*page)(struct snd_pcm_substream *substream,
     
    174175#define SNDRV_PCM_FMTBIT_S18_3BE        (1ULL << SNDRV_PCM_FORMAT_S18_3BE)
    175176#define SNDRV_PCM_FMTBIT_U18_3BE        (1ULL << SNDRV_PCM_FORMAT_U18_3BE)
     177#define SNDRV_PCM_FMTBIT_G723_24        (1ULL << SNDRV_PCM_FORMAT_G723_24)
     178#define SNDRV_PCM_FMTBIT_G723_24_1B     (1ULL << SNDRV_PCM_FORMAT_G723_24_1B)
     179#define SNDRV_PCM_FMTBIT_G723_40        (1ULL << SNDRV_PCM_FORMAT_G723_40)
     180#define SNDRV_PCM_FMTBIT_G723_40_1B     (1ULL << SNDRV_PCM_FORMAT_G723_40_1B)
    176181
    177182#ifdef SNDRV_LITTLE_ENDIAN
     
    216221
    217222struct snd_pcm_hw_constraints {
    218         struct snd_mask masks[SNDRV_PCM_HW_PARAM_LAST_MASK -
     223        struct snd_mask masks[SNDRV_PCM_HW_PARAM_LAST_MASK - 
    219224                         SNDRV_PCM_HW_PARAM_FIRST_MASK + 1];
    220225        struct snd_interval intervals[SNDRV_PCM_HW_PARAM_LAST_INTERVAL -
     
    262267        unsigned int mask;
    263268};
     269
     270struct snd_pcm_hwptr_log;
    264271
    265272struct snd_pcm_runtime {
     
    272279        snd_pcm_uframes_t hw_ptr_interrupt; /* Position at interrupt time */
    273280        unsigned long hw_ptr_jiffies;   /* Time when hw_ptr is updated */
     281        unsigned long hw_ptr_buffer_jiffies; /* buffer time in jiffies */
    274282        snd_pcm_sframes_t delay;        /* extra delay; typically FIFO size */
    275283
     
    290298        unsigned int rate_num;
    291299        unsigned int rate_den;
     300        unsigned int no_period_wakeup: 1;
    292301
    293302        /* -- SW params -- */
     
    311320
    312321        /* -- locking / scheduling -- */
    313         wait_queue_head_t sleep;
     322        snd_pcm_uframes_t twake;        /* do transfer (!poll) wakeup if non-zero */
     323        wait_queue_head_t sleep;        /* poll sleep */
     324        wait_queue_head_t tsleep;       /* transfer sleep */
    314325        struct fasync_struct *fasync;
    315326
     
    330341        int tstamp_type;                /* timestamp type */
    331342
    332         /* -- DMA -- */
     343        /* -- DMA -- */           
    333344        unsigned char *dma_area;        /* DMA area */
    334345        dma_addr_t dma_addr;            /* physical bus address (not accessible from main CPU) */
     
    340351        /* -- OSS things -- */
    341352        struct snd_pcm_oss_runtime oss;
     353#endif
     354
     355#ifdef CONFIG_SND_PCM_XRUN_DEBUG
     356        struct snd_pcm_hwptr_log *hwptr_log;
    342357#endif
    343358};
     
    348363        int count;
    349364};
     365
     366struct pid;
    350367
    351368struct snd_pcm_substream {
     
    356373        char name[32];                  /* substream name */
    357374        int stream;                     /* stream (direction) */
    358         char latency_id[20];            /* latency identifier */
     375#ifndef TARGET_OS2
     376        struct pm_qos_request_list latency_pm_qos_req; /* pm_qos request */
     377#else
     378        char latency_id[20];
     379#endif
    359380        size_t buffer_bytes_max;        /* limit ring buffer size */
    360381        struct snd_dma_buffer dma_buffer;
     
    380401        unsigned int f_flags;
    381402        void (*pcm_release)(struct snd_pcm_substream *);
     403        struct pid *pid;
    382404#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)
    383405        /* -- OSS things -- */
     
    538560} while (0)
    539561
    540 #ifdef TARGET_OS2
    541562#define snd_pcm_group_for_each_entry(s, substream) \
    542563        list_for_each_entry(s, &substream->group->substreams, link_list, struct snd_pcm_substream)
    543 #else   
    544 #define snd_pcm_group_for_each_entry(s, substream) \
    545         list_for_each_entry(s, &substream->group->substreams, link_list)
    546 #endif
    547564
    548565static inline int snd_pcm_running(struct snd_pcm_substream *substream)
     
    597614        snd_pcm_sframes_t avail = runtime->status->hw_ptr + runtime->buffer_size - runtime->control->appl_ptr;
    598615#if defined TARGET_OS2
    599        if ( runtime->buffer_size > runtime->control->appl_ptr)
    600           avail = runtime->status->hw_ptr + runtime->buffer_size - runtime->control->appl_ptr;
    601        else
    602        {
    603 
    604           avail = runtime->control->appl_ptr - runtime->status->hw_ptr;
    605           if ( avail > runtime->buffer_size )
    606              avail = 0;
    607           else
    608              avail = runtime->buffer_size - avail;
    609        }
    610 #endif /* TARGET_OS2  */
     616       if ( runtime->buffer_size > runtime->control->appl_ptr) 
     617          avail = runtime->status->hw_ptr + runtime->buffer_size - runtime->control->appl_ptr; 
     618       else 
     619       { 
     620 
     621          avail = runtime->control->appl_ptr - runtime->status->hw_ptr; 
     622          if ( avail > runtime->buffer_size ) 
     623             avail = 0; 
     624          else 
     625             avail = runtime->buffer_size - avail; 
     626       } 
     627#endif /* TARGET_OS2  */ 
    611628        if (avail < 0)
    612629                avail += runtime->boundary;
     
    711728}
    712729
    713 static inline void snd_pcm_trigger_done(struct snd_pcm_substream *substream,
     730static inline void snd_pcm_trigger_done(struct snd_pcm_substream *substream, 
    714731                                        struct snd_pcm_substream *master)
    715732{
     
    768785void snd_interval_mul(const struct snd_interval *a, const struct snd_interval *b, struct snd_interval *c);
    769786void snd_interval_div(const struct snd_interval *a, const struct snd_interval *b, struct snd_interval *c);
    770 void snd_interval_muldivk(const struct snd_interval *a, const struct snd_interval *b,
     787void snd_interval_muldivk(const struct snd_interval *a, const struct snd_interval *b, 
    771788                          unsigned int k, struct snd_interval *c);
    772789void snd_interval_mulkdiv(const struct snd_interval *a, unsigned int k,
     
    793810                                 unsigned int min, unsigned int max);
    794811int snd_pcm_hw_constraint_integer(struct snd_pcm_runtime *runtime, snd_pcm_hw_param_t var);
    795 int snd_pcm_hw_constraint_list(struct snd_pcm_runtime *runtime,
     812int snd_pcm_hw_constraint_list(struct snd_pcm_runtime *runtime, 
    796813                               unsigned int cond,
    797814                               snd_pcm_hw_param_t var,
    798815                               struct snd_pcm_hw_constraint_list *l);
    799 int snd_pcm_hw_constraint_ratnums(struct snd_pcm_runtime *runtime,
     816int snd_pcm_hw_constraint_ratnums(struct snd_pcm_runtime *runtime, 
    800817                                  unsigned int cond,
    801818                                  snd_pcm_hw_param_t var,
    802819                                  struct snd_pcm_hw_constraint_ratnums *r);
    803 int snd_pcm_hw_constraint_ratdens(struct snd_pcm_runtime *runtime,
     820int snd_pcm_hw_constraint_ratdens(struct snd_pcm_runtime *runtime, 
    804821                                  unsigned int cond,
    805822                                  snd_pcm_hw_param_t var,
    806823                                  struct snd_pcm_hw_constraint_ratdens *r);
    807 int snd_pcm_hw_constraint_msbits(struct snd_pcm_runtime *runtime,
     824int snd_pcm_hw_constraint_msbits(struct snd_pcm_runtime *runtime, 
    808825                                 unsigned int cond,
    809826                                 unsigned int width,
     
    853870int snd_pcm_lib_interleave_len(struct snd_pcm_substream *substream);
    854871int snd_pcm_lib_ioctl(struct snd_pcm_substream *substream,
    855                       unsigned int cmd, void *arg);
     872                      unsigned int cmd, void *arg);                     
     873int snd_pcm_update_state(struct snd_pcm_substream *substream,
     874                         struct snd_pcm_runtime *runtime);
    856875int snd_pcm_update_hw_ptr(struct snd_pcm_substream *substream);
    857876int snd_pcm_playback_xrun_check(struct snd_pcm_substream *substream);
     
    925944int snd_pcm_lib_free_pages(struct snd_pcm_substream *substream);
    926945
     946int _snd_pcm_lib_alloc_vmalloc_buffer(struct snd_pcm_substream *substream,
     947                                      size_t size, gfp_t gfp_flags);
     948int snd_pcm_lib_free_vmalloc_buffer(struct snd_pcm_substream *substream);
     949struct page *snd_pcm_lib_get_vmalloc_page(struct snd_pcm_substream *substream,
     950                                          unsigned long offset);
     951#if 0 /* for kernel-doc */
     952/**
     953 * snd_pcm_lib_alloc_vmalloc_buffer - allocate virtual DMA buffer
     954 * @substream: the substream to allocate the buffer to
     955 * @size: the requested buffer size, in bytes
     956 *
     957 * Allocates the PCM substream buffer using vmalloc(), i.e., the memory is
     958 * contiguous in kernel virtual space, but not in physical memory.  Use this
     959 * if the buffer is accessed by kernel code but not by device DMA.
     960 *
     961 * Returns 1 if the buffer was changed, 0 if not changed, or a negative error
     962 * code.
     963 */
     964static int snd_pcm_lib_alloc_vmalloc_buffer
     965                        (struct snd_pcm_substream *substream, size_t size);
     966/**
     967 * snd_pcm_lib_alloc_vmalloc_32_buffer - allocate 32-bit-addressable buffer
     968 * @substream: the substream to allocate the buffer to
     969 * @size: the requested buffer size, in bytes
     970 *
     971 * This function works like snd_pcm_lib_alloc_vmalloc_buffer(), but uses
     972 * vmalloc_32(), i.e., the pages are allocated from 32-bit-addressable memory.
     973 */
     974static int snd_pcm_lib_alloc_vmalloc_32_buffer
     975                        (struct snd_pcm_substream *substream, size_t size);
     976#endif
     977#define snd_pcm_lib_alloc_vmalloc_buffer(subs, size) \
     978        _snd_pcm_lib_alloc_vmalloc_buffer \
     979                        (subs, size, GFP_KERNEL | __GFP_HIGHMEM | __GFP_ZERO)
     980#define snd_pcm_lib_alloc_vmalloc_32_buffer(subs, size) \
     981        _snd_pcm_lib_alloc_vmalloc_buffer \
     982                        (subs, size, GFP_KERNEL | GFP_DMA32 | __GFP_ZERO)
     983
    927984#ifdef CONFIG_SND_DMA_SGBUF
    928985/*
     
    9951052#endif
    9961053
     1054int snd_pcm_lib_mmap_noncached(struct snd_pcm_substream *substream,
     1055                               struct vm_area_struct *area);
     1056#define snd_pcm_lib_mmap_vmalloc        snd_pcm_lib_mmap_noncached
     1057
    9971058static inline void snd_pcm_limit_isa_dma_size(int dma, size_t *max)
    9981059{
     
    10111072#define PCM_RUNTIME_CHECK(sub) snd_BUG_ON(!(sub) || !(sub)->runtime)
    10121073
     1074const char *snd_pcm_format_name(snd_pcm_format_t format);
     1075
    10131076#endif /* __SOUND_PCM_H */
  • GPL/trunk/alsa-kernel/include/sound/pcm_oss.h

    r398 r598  
    6262        struct snd_pcm_plugin *plugin_last;
    6363#endif
    64         unsigned int prev_hw_ptr_interrupt;
     64        unsigned int prev_hw_ptr_period;
    6565};
    6666
  • GPL/trunk/alsa-kernel/include/sound/rawmidi.h

    r426 r598  
    4747struct snd_rawmidi_substream;
    4848struct snd_seq_port_info;
     49struct pid;
    4950
    5051struct snd_rawmidi_ops {
     
    9899        char name[32];
    99100        struct snd_rawmidi_runtime *runtime;
     101        struct pid *pid;
    100102        /* hardware layer */
    101103        struct snd_rawmidi_ops *ops;
  • GPL/trunk/alsa-kernel/include/sound/sb.h

    r426 r598  
    3434        SB_HW_201,
    3535        SB_HW_PRO,
     36        SB_HW_JAZZ16,           /* Media Vision Jazz16 */
    3637        SB_HW_16,
    3738        SB_HW_16CSP,            /* SB16 with CSP chip */
  • GPL/trunk/alsa-kernel/include/sound/seq_kernel.h

    r587 r598  
    7676
    7777/* interface for kernel client */
     78#ifndef TARGET_OS2
    7879int snd_seq_create_kernel_client(struct snd_card *card, int client_index,
    7980                                 const char *name_fmt, ...)
    8081        __attribute__ ((format (printf, 3, 4)));
     82#else
     83int snd_seq_create_kernel_client(struct snd_card *card, int client_index,
     84                                 const char *name_fmt, ...);
     85#endif
    8186int snd_seq_delete_kernel_client(int client);
    8287int snd_seq_kernel_client_enqueue(int client, struct snd_seq_event *ev, int atomic, int hop);
  • GPL/trunk/alsa-kernel/include/sound/soc-dapm.h

    r464 r598  
    1717#include <linux/types.h>
    1818#include <sound/control.h>
    19 #include <sound/soc.h>
    2019
    2120/* widget has no PM register bit */
     
    7372{       .id = snd_soc_dapm_pga, .name = wname, .reg = wreg, .shift = wshift, \
    7473        .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = wncontrols}
     74#define SND_SOC_DAPM_OUT_DRV(wname, wreg, wshift, winvert,\
     75         wcontrols, wncontrols) \
     76{       .id = snd_soc_dapm_out_drv, .name = wname, .reg = wreg, .shift = wshift, \
     77        .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = wncontrols}
    7578#define SND_SOC_DAPM_MIXER(wname, wreg, wshift, winvert, \
    7679         wcontrols, wncontrols)\
     
    9194{       .id = snd_soc_dapm_mux, .name = wname, .reg = wreg, .shift = wshift, \
    9295        .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = 1}
     96#define SND_SOC_DAPM_VIRT_MUX(wname, wreg, wshift, winvert, wcontrols) \
     97{       .id = snd_soc_dapm_virt_mux, .name = wname, .reg = wreg, .shift = wshift, \
     98        .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = 1}
    9399#define SND_SOC_DAPM_VALUE_MUX(wname, wreg, wshift, winvert, wcontrols) \
    94100{       .id = snd_soc_dapm_value_mux, .name = wname, .reg = wreg, \
     
    96102        .num_kcontrols = 1}
    97103
     104/* Simplified versions of above macros, assuming wncontrols = ARRAY_SIZE(wcontrols) */
     105#define SOC_PGA_ARRAY(wname, wreg, wshift, winvert,\
     106         wcontrols) \
     107{       .id = snd_soc_dapm_pga, .name = wname, .reg = wreg, .shift = wshift, \
     108        .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = ARRAY_SIZE(wcontrols)}
     109#define SOC_MIXER_ARRAY(wname, wreg, wshift, winvert, \
     110         wcontrols)\
     111{       .id = snd_soc_dapm_mixer, .name = wname, .reg = wreg, .shift = wshift, \
     112        .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = ARRAY_SIZE(wcontrols)}
     113#define SOC_MIXER_NAMED_CTL_ARRAY(wname, wreg, wshift, winvert, \
     114         wcontrols)\
     115{       .id = snd_soc_dapm_mixer_named_ctl, .name = wname, .reg = wreg, \
     116        .shift = wshift, .invert = winvert, .kcontrols = wcontrols, \
     117        .num_kcontrols = ARRAY_SIZE(wcontrols)}
     118
    98119/* path domain with event - event handler must return 0 for success */
    99120#define SND_SOC_DAPM_PGA_E(wname, wreg, wshift, winvert, wcontrols, \
    100121        wncontrols, wevent, wflags) \
    101122{       .id = snd_soc_dapm_pga, .name = wname, .reg = wreg, .shift = wshift, \
     123        .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = wncontrols, \
     124        .event = wevent, .event_flags = wflags}
     125#define SND_SOC_DAPM_OUT_DRV_E(wname, wreg, wshift, winvert, wcontrols, \
     126        wncontrols, wevent, wflags) \
     127{       .id = snd_soc_dapm_out_drv, .name = wname, .reg = wreg, .shift = wshift, \
    102128        .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = wncontrols, \
    103129        .event = wevent, .event_flags = wflags}
     
    126152        .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = 1, \
    127153        .event = wevent, .event_flags = wflags}
     154#define SND_SOC_DAPM_VIRT_MUX_E(wname, wreg, wshift, winvert, wcontrols, \
     155        wevent, wflags) \
     156{       .id = snd_soc_dapm_virt_mux, .name = wname, .reg = wreg, .shift = wshift, \
     157        .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = 1, \
     158        .event = wevent, .event_flags = wflags}
     159
     160/* Simplified versions of above macros, assuming wncontrols = ARRAY_SIZE(wcontrols) */
     161#define SOC_PGA_E_ARRAY(wname, wreg, wshift, winvert, wcontrols, \
     162        wevent, wflags) \
     163{       .id = snd_soc_dapm_pga, .name = wname, .reg = wreg, .shift = wshift, \
     164        .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = ARRAY_SIZE(wcontrols), \
     165        .event = wevent, .event_flags = wflags}
     166#define SOC_MIXER_E_ARRAY(wname, wreg, wshift, winvert, wcontrols, \
     167        wevent, wflags) \
     168{       .id = snd_soc_dapm_mixer, .name = wname, .reg = wreg, .shift = wshift, \
     169        .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = ARRAY_SIZE(wcontrols), \
     170        .event = wevent, .event_flags = wflags}
     171#define SOC_MIXER_NAMED_CTL_E_ARRAY(wname, wreg, wshift, winvert, \
     172        wcontrols, wevent, wflags) \
     173{       .id = snd_soc_dapm_mixer, .name = wname, .reg = wreg, .shift = wshift, \
     174        .invert = winvert, .kcontrols = wcontrols, \
     175        .num_kcontrols = ARRAY_SIZE(wcontrols), .event = wevent, .event_flags = wflags}
    128176
    129177/* events that are pre and post DAPM */
     
    141189{       .id = snd_soc_dapm_aif_in, .name = wname, .sname = stname, \
    142190        .reg = wreg, .shift = wshift, .invert = winvert }
     191#define SND_SOC_DAPM_AIF_IN_E(wname, stname, wslot, wreg, wshift, winvert, \
     192                              wevent, wflags)                           \
     193{       .id = snd_soc_dapm_aif_in, .name = wname, .sname = stname, \
     194        .reg = wreg, .shift = wshift, .invert = winvert, \
     195        .event = wevent, .event_flags = wflags }
    143196#define SND_SOC_DAPM_AIF_OUT(wname, stname, wslot, wreg, wshift, winvert) \
    144197{       .id = snd_soc_dapm_aif_out, .name = wname, .sname = stname, \
    145198        .reg = wreg, .shift = wshift, .invert = winvert }
     199#define SND_SOC_DAPM_AIF_OUT_E(wname, stname, wslot, wreg, wshift, winvert, \
     200                             wevent, wflags)                            \
     201{       .id = snd_soc_dapm_aif_out, .name = wname, .sname = stname, \
     202        .reg = wreg, .shift = wshift, .invert = winvert, \
     203        .event = wevent, .event_flags = wflags }
    146204#define SND_SOC_DAPM_DAC(wname, stname, wreg, wshift, winvert) \
    147205{       .id = snd_soc_dapm_dac, .name = wname, .sname = stname, .reg = wreg, \
     
    178236        .get = snd_soc_dapm_get_volsw, .put = snd_soc_dapm_put_volsw, \
    179237        .private_value =  SOC_SINGLE_VALUE(reg, shift, max, invert) }
    180 #define SOC_DAPM_DOUBLE(xname, reg, shift_left, shift_right, max, invert, \
    181         power) \
    182 {       .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
    183         .info = snd_soc_info_volsw, \
    184         .get = snd_soc_dapm_get_volsw, .put = snd_soc_dapm_put_volsw, \
    185         .private_value = (reg) | ((shift_left) << 8) | ((shift_right) << 12) |\
    186                 ((max) << 16) | ((invert) << 24) }
    187238#define SOC_DAPM_SINGLE_TLV(xname, reg, shift, max, invert, tlv_array) \
    188239{       .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
     
    192243        .get = snd_soc_dapm_get_volsw, .put = snd_soc_dapm_put_volsw, \
    193244        .private_value =  SOC_SINGLE_VALUE(reg, shift, max, invert) }
    194 #define SOC_DAPM_DOUBLE_TLV(xname, reg, shift_left, shift_right, max, invert, \
    195         power, tlv_array) \
    196 {       .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
    197         .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | SNDRV_CTL_ELEM_ACCESS_READWRITE,\
    198         .tlv.p = (tlv_array), \
    199         .info = snd_soc_info_volsw, \
    200         .get = snd_soc_dapm_get_volsw, .put = snd_soc_dapm_put_volsw, \
    201         .private_value = (reg) | ((shift_left) << 8) | ((shift_right) << 12) |\
    202                 ((max) << 16) | ((invert) << 24) }
    203245#define SOC_DAPM_ENUM(xname, xenum) \
    204246{       .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
     
    207249        .put = snd_soc_dapm_put_enum_double, \
    208250        .private_value = (unsigned long)&xenum }
     251#define SOC_DAPM_ENUM_VIRT(xname, xenum)                    \
     252{       .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
     253        .info = snd_soc_info_enum_double, \
     254        .get = snd_soc_dapm_get_enum_virt, \
     255        .put = snd_soc_dapm_put_enum_virt, \
     256        .private_value = (unsigned long)&xenum }
    209257#define SOC_DAPM_VALUE_ENUM(xname, xenum) \
    210258{       .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
     
    236284#define SND_SOC_DAPM_PRE_REG    0x10    /* before audio path setup */
    237285#define SND_SOC_DAPM_POST_REG   0x20    /* after audio path setup */
     286#define SND_SOC_DAPM_PRE_POST_PMD \
     287                                (SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD)
    238288
    239289/* convenience event type detection */
     
    248298struct snd_soc_dapm_pin;
    249299struct snd_soc_dapm_route;
     300struct snd_soc_dapm_context;
    250301
    251302int dapm_reg_event(struct snd_soc_dapm_widget *w,
     
    260311        struct snd_ctl_elem_value *ucontrol);
    261312int snd_soc_dapm_put_enum_double(struct snd_kcontrol *kcontrol,
     313        struct snd_ctl_elem_value *ucontrol);
     314int snd_soc_dapm_get_enum_virt(struct snd_kcontrol *kcontrol,
     315        struct snd_ctl_elem_value *ucontrol);
     316int snd_soc_dapm_put_enum_virt(struct snd_kcontrol *kcontrol,
    262317        struct snd_ctl_elem_value *ucontrol);
    263318int snd_soc_dapm_get_value_enum_double(struct snd_kcontrol *kcontrol,
     
    271326int snd_soc_dapm_put_pin_switch(struct snd_kcontrol *kcontrol,
    272327        struct snd_ctl_elem_value *uncontrol);
    273 int snd_soc_dapm_new_control(struct snd_soc_codec *codec,
     328int snd_soc_dapm_new_control(struct snd_soc_dapm_context *dapm,
    274329        const struct snd_soc_dapm_widget *widget);
    275 int snd_soc_dapm_new_controls(struct snd_soc_codec *codec,
     330int snd_soc_dapm_new_controls(struct snd_soc_dapm_context *dapm,
    276331        const struct snd_soc_dapm_widget *widget,
    277332        int num);
    278333
    279334/* dapm path setup */
    280 int snd_soc_dapm_new_widgets(struct snd_soc_codec *codec);
    281 void snd_soc_dapm_free(struct snd_soc_device *socdev);
    282 int snd_soc_dapm_add_routes(struct snd_soc_codec *codec,
     335int snd_soc_dapm_new_widgets(struct snd_soc_dapm_context *dapm);
     336void snd_soc_dapm_free(struct snd_soc_dapm_context *dapm);
     337int snd_soc_dapm_add_routes(struct snd_soc_dapm_context *dapm,
    283338                            const struct snd_soc_dapm_route *route, int num);
    284339
    285340/* dapm events */
    286 int snd_soc_dapm_stream_event(struct snd_soc_codec *codec, char *stream,
    287         int event);
    288 void snd_soc_dapm_shutdown(struct snd_soc_device *socdev);
     341int snd_soc_dapm_stream_event(struct snd_soc_pcm_runtime *rtd,
     342        const char *stream, int event);
     343void snd_soc_dapm_shutdown(struct snd_soc_card *card);
    289344
    290345/* dapm sys fs - used by the core */
    291346int snd_soc_dapm_sys_add(struct device *dev);
    292 void snd_soc_dapm_debugfs_init(struct snd_soc_codec *codec);
     347void snd_soc_dapm_debugfs_init(struct snd_soc_dapm_context *dapm);
    293348
    294349/* dapm audio pin control and status */
    295 int snd_soc_dapm_enable_pin(struct snd_soc_codec *codec, const char *pin);
    296 int snd_soc_dapm_disable_pin(struct snd_soc_codec *codec, const char *pin);
    297 int snd_soc_dapm_nc_pin(struct snd_soc_codec *codec, const char *pin);
    298 int snd_soc_dapm_get_pin_status(struct snd_soc_codec *codec, const char *pin);
    299 int snd_soc_dapm_sync(struct snd_soc_codec *codec);
     350int snd_soc_dapm_enable_pin(struct snd_soc_dapm_context *dapm,
     351                            const char *pin);
     352int snd_soc_dapm_disable_pin(struct snd_soc_dapm_context *dapm,
     353                             const char *pin);
     354int snd_soc_dapm_nc_pin(struct snd_soc_dapm_context *dapm, const char *pin);
     355int snd_soc_dapm_get_pin_status(struct snd_soc_dapm_context *dapm,
     356                                const char *pin);
     357int snd_soc_dapm_sync(struct snd_soc_dapm_context *dapm);
     358int snd_soc_dapm_force_enable_pin(struct snd_soc_dapm_context *dapm,
     359                                  const char *pin);
     360int snd_soc_dapm_ignore_suspend(struct snd_soc_dapm_context *dapm,
     361                                const char *pin);
    300362
    301363/* dapm widget types */
     
    304366        snd_soc_dapm_output,            /* output pin */
    305367        snd_soc_dapm_mux,                       /* selects 1 analog signal from many inputs */
     368        snd_soc_dapm_virt_mux,                  /* virtual version of snd_soc_dapm_mux */
    306369        snd_soc_dapm_value_mux,                 /* selects 1 analog signal from many inputs */
    307370        snd_soc_dapm_mixer,                     /* mixes several analog signals together */
    308371        snd_soc_dapm_mixer_named_ctl,           /* mixer with named controls */
    309372        snd_soc_dapm_pga,                       /* programmable gain/attenuation (volume) */
     373        snd_soc_dapm_out_drv,                   /* output driver */
    310374        snd_soc_dapm_adc,                       /* analog to digital converter */
    311375        snd_soc_dapm_dac,                       /* digital to analog converter */
     
    334398        const char *control;
    335399        const char *source;
     400
     401        /* Note: currently only supported for links where source is a supply */
     402        int (*connected)(struct snd_soc_dapm_widget *source,
     403                         struct snd_soc_dapm_widget *sink);
    336404};
    337405
     
    349417        u32 connect:1;  /* source and sink widgets are connected */
    350418        u32 walked:1;   /* path has been walked */
     419
     420        int (*connected)(struct snd_soc_dapm_widget *source,
     421                         struct snd_soc_dapm_widget *sink);
    351422
    352423        struct list_head list_source;
     
    362433        struct snd_soc_codec *codec;
    363434        struct list_head list;
     435        struct snd_soc_dapm_context *dapm;
    364436
    365437        /* dapm control */
     
    377449        unsigned char new:1;                    /* cnew complete */
    378450        unsigned char ext:1;                    /* has external widgets */
    379         unsigned char muted:1;                  /* muted for pop reduction */
    380         unsigned char suspend:1;                /* was active before suspend */
    381         unsigned char pmdown:1;                 /* waiting for timeout */
     451        unsigned char force:1;                  /* force state */
     452        unsigned char ignore_suspend:1;         /* kept enabled over suspend */
    382453
    383454        int (*power_check)(struct snd_soc_dapm_widget *w);
     
    399470};
    400471
     472struct snd_soc_dapm_update {
     473        struct snd_soc_dapm_widget *widget;
     474        struct snd_kcontrol *kcontrol;
     475        int reg;
     476        int mask;
     477        int val;
     478};
     479
     480/* DAPM context */
     481struct snd_soc_dapm_context {
     482        int n_widgets; /* number of widgets in this context */
     483        enum snd_soc_bias_level bias_level;
     484        enum snd_soc_bias_level suspend_bias_level;
     485        struct delayed_work delayed_work;
     486        unsigned int idle_bias_off:1; /* Use BIAS_OFF instead of STANDBY */
     487
     488        struct snd_soc_dapm_update *update;
     489
     490        struct device *dev; /* from parent - for debug */
     491        struct snd_soc_codec *codec; /* parent codec */
     492        struct snd_soc_card *card; /* parent card */
     493
     494        /* used during DAPM updates */
     495        int dev_power;
     496        struct list_head list;
     497
     498#ifdef CONFIG_DEBUG_FS
     499        struct dentry *debugfs_dapm;
    401500#endif
     501};
     502
     503#endif
  • GPL/trunk/alsa-kernel/include/sound/soc.h

    r464 r598  
    1616#include <linux/platform_device.h>
    1717#include <linux/types.h>
     18#include <linux/notifier.h>
    1819#include <linux/workqueue.h>
    1920#include <linux/interrupt.h>
     
    3031        ((unsigned long)&(struct soc_mixer_control) \
    3132        {.reg = xreg, .shift = xshift, .rshift = xshift, .max = xmax, \
    32         .invert = xinvert})
     33        .platform_max = xmax, .invert = xinvert})
    3334#define SOC_SINGLE_VALUE_EXT(xreg, xmax, xinvert) \
    3435        ((unsigned long)&(struct soc_mixer_control) \
    35         {.reg = xreg, .max = xmax, .invert = xinvert})
     36        {.reg = xreg, .max = xmax, .platform_max = xmax, .invert = xinvert})
    3637#define SOC_SINGLE(xname, reg, shift, max, invert) \
    3738{       .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
     
    5354        .private_value = (unsigned long)&(struct soc_mixer_control) \
    5455                {.reg = xreg, .shift = shift_left, .rshift = shift_right, \
    55                  .max = xmax, .invert = xinvert} }
     56                 .max = xmax, .platform_max = xmax, .invert = xinvert} }
    5657#define SOC_DOUBLE_R(xname, reg_left, reg_right, xshift, xmax, xinvert) \
    5758{       .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
     
    6061        .private_value = (unsigned long)&(struct soc_mixer_control) \
    6162                {.reg = reg_left, .rreg = reg_right, .shift = xshift, \
    62                 .max = xmax, .invert = xinvert} }
     63                .max = xmax, .platform_max = xmax, .invert = xinvert} }
    6364#define SOC_DOUBLE_TLV(xname, xreg, shift_left, shift_right, xmax, xinvert, tlv_array) \
    6465{       .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
     
    7071        .private_value = (unsigned long)&(struct soc_mixer_control) \
    7172                {.reg = xreg, .shift = shift_left, .rshift = shift_right,\
    72                  .max = xmax, .invert = xinvert} }
     73                 .max = xmax, .platform_max = xmax, .invert = xinvert} }
    7374#define SOC_DOUBLE_R_TLV(xname, reg_left, reg_right, xshift, xmax, xinvert, tlv_array) \
    7475{       .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
     
    8081        .private_value = (unsigned long)&(struct soc_mixer_control) \
    8182                {.reg = reg_left, .rreg = reg_right, .shift = xshift, \
    82                 .max = xmax, .invert = xinvert} }
     83                .max = xmax, .platform_max = xmax, .invert = xinvert} }
    8384#define SOC_DOUBLE_S8_TLV(xname, xreg, xmin, xmax, tlv_array) \
    8485{       .iface  = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
     
    8990        .put    = snd_soc_put_volsw_s8, \
    9091        .private_value = (unsigned long)&(struct soc_mixer_control) \
    91                 {.reg = xreg, .min = xmin, .max = xmax} }
     92                {.reg = xreg, .min = xmin, .max = xmax, \
     93                 .platform_max = xmax} }
    9294#define SOC_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmax, xtexts) \
    9395{       .reg = xreg, .shift_l = xshift_l, .shift_r = xshift_r, \
     
    126128        .private_value = (unsigned long)&(struct soc_mixer_control) \
    127129                {.reg = xreg, .shift = shift_left, .rshift = shift_right, \
    128                  .max = xmax, .invert = xinvert} }
     130                 .max = xmax, .platform_max = xmax, .invert = xinvert} }
    129131#define SOC_SINGLE_EXT_TLV(xname, xreg, xshift, xmax, xinvert,\
    130132         xhandler_get, xhandler_put, tlv_array) \
     
    146148        .private_value = (unsigned long)&(struct soc_mixer_control) \
    147149                {.reg = xreg, .shift = shift_left, .rshift = shift_right, \
    148                 .max = xmax, .invert = xinvert} }
     150                .max = xmax, .platform_max = xmax, .invert = xinvert} }
    149151#define SOC_DOUBLE_R_EXT_TLV(xname, reg_left, reg_right, xshift, xmax, xinvert,\
    150152         xhandler_get, xhandler_put, tlv_array) \
     
    157159        .private_value = (unsigned long)&(struct soc_mixer_control) \
    158160                {.reg = reg_left, .rreg = reg_right, .shift = xshift, \
    159                 .max = xmax, .invert = xinvert} }
     161                .max = xmax, .platform_max = xmax, .invert = xinvert} }
    160162#define SOC_SINGLE_BOOL_EXT(xname, xdata, xhandler_get, xhandler_put) \
    161163{       .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
     
    168170        .get = xhandler_get, .put = xhandler_put, \
    169171        .private_value = (unsigned long)&xenum }
     172
     173#define SOC_DOUBLE_R_SX_TLV(xname, xreg_left, xreg_right, xshift,\
     174                xmin, xmax, tlv_array) \
     175{       .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
     176        .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
     177                  SNDRV_CTL_ELEM_ACCESS_READWRITE, \
     178        .tlv.p = (tlv_array), \
     179        .info = snd_soc_info_volsw_2r_sx, \
     180        .get = snd_soc_get_volsw_2r_sx, \
     181        .put = snd_soc_put_volsw_2r_sx, \
     182        .private_value = (unsigned long)&(struct soc_mixer_control) \
     183                {.reg = xreg_left, \
     184                 .rreg = xreg_right, .shift = xshift, \
     185                 .min = xmin, .max = xmax} }
     186
     187
     188/*
     189 * Simplified versions of above macros, declaring a struct and calculating
     190 * ARRAY_SIZE internally
     191 */
     192#define SOC_ENUM_DOUBLE_DECL(name, xreg, xshift_l, xshift_r, xtexts) \
     193        struct soc_enum name = SOC_ENUM_DOUBLE(xreg, xshift_l, xshift_r, \
     194                                                ARRAY_SIZE(xtexts), xtexts)
     195#define SOC_ENUM_SINGLE_DECL(name, xreg, xshift, xtexts) \
     196        SOC_ENUM_DOUBLE_DECL(name, xreg, xshift, xshift, xtexts)
     197#define SOC_ENUM_SINGLE_EXT_DECL(name, xtexts) \
     198        struct soc_enum name = SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(xtexts), xtexts)
     199#define SOC_VALUE_ENUM_DOUBLE_DECL(name, xreg, xshift_l, xshift_r, xmask, xtexts, xvalues) \
     200        struct soc_enum name = SOC_VALUE_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmask, \
     201                                                        ARRAY_SIZE(xtexts), xtexts, xvalues)
     202#define SOC_VALUE_ENUM_SINGLE_DECL(name, xreg, xshift, xmask, xtexts, xvalues) \
     203        SOC_VALUE_ENUM_DOUBLE_DECL(name, xreg, xshift, xshift, xmask, xtexts, xvalues)
    170204
    171205/*
     
    181215 */
    182216enum snd_soc_bias_level {
     217        SND_SOC_BIAS_OFF,
     218        SND_SOC_BIAS_STANDBY,
     219        SND_SOC_BIAS_PREPARE,
    183220        SND_SOC_BIAS_ON,
    184         SND_SOC_BIAS_PREPARE,
    185         SND_SOC_BIAS_STANDBY,
    186         SND_SOC_BIAS_OFF,
    187221};
    188222
    189223struct snd_jack;
    190224struct snd_soc_card;
    191 struct snd_soc_device;
    192225struct snd_soc_pcm_stream;
    193226struct snd_soc_ops;
    194 struct snd_soc_dai_mode;
    195227struct snd_soc_pcm_runtime;
    196228struct snd_soc_dai;
     229struct snd_soc_dai_driver;
    197230struct snd_soc_platform;
     231struct snd_soc_dai_link;
     232struct snd_soc_platform_driver;
    198233struct snd_soc_codec;
     234struct snd_soc_codec_driver;
    199235struct soc_enum;
    200 struct snd_soc_ac97_ops;
    201236struct snd_soc_jack;
    202237struct snd_soc_jack_pin;
     238struct snd_soc_cache_ops;
     239#include <sound/soc-dapm.h>
     240
    203241#ifdef CONFIG_GPIOLIB
    204242struct snd_soc_jack_gpio;
     
    206244
    207245typedef int (*hw_write_t)(void *,const char* ,int);
    208 typedef int (*hw_read_t)(void *,char* ,int);
    209246
    210247extern struct snd_ac97_bus_ops soc_ac97_ops;
     
    216253};
    217254
    218 int snd_soc_register_platform(struct snd_soc_platform *platform);
    219 void snd_soc_unregister_platform(struct snd_soc_platform *platform);
    220 int snd_soc_register_codec(struct snd_soc_codec *codec);
    221 void snd_soc_unregister_codec(struct snd_soc_codec *codec);
     255enum snd_soc_compress_type {
     256        SND_SOC_FLAT_COMPRESSION = 1,
     257        SND_SOC_LZO_COMPRESSION,
     258        SND_SOC_RBTREE_COMPRESSION
     259};
     260
     261int snd_soc_register_card(struct snd_soc_card *card);
     262int snd_soc_unregister_card(struct snd_soc_card *card);
     263int snd_soc_register_platform(struct device *dev,
     264                struct snd_soc_platform_driver *platform_drv);
     265void snd_soc_unregister_platform(struct device *dev);
     266int snd_soc_register_codec(struct device *dev,
     267                const struct snd_soc_codec_driver *codec_drv,
     268                struct snd_soc_dai_driver *dai_drv, int num_dai);
     269void snd_soc_unregister_codec(struct device *dev);
    222270int snd_soc_codec_volatile_register(struct snd_soc_codec *codec, int reg);
    223271int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec,
    224272                               int addr_bits, int data_bits,
    225273                               enum snd_soc_control_type control);
    226 
    227 #ifdef CONFIG_PM
    228 int snd_soc_suspend_device(struct device *dev);
    229 int snd_soc_resume_device(struct device *dev);
    230 #endif
    231 
    232 /* pcm <-> DAI connect */
    233 void snd_soc_free_pcms(struct snd_soc_device *socdev);
    234 int snd_soc_new_pcms(struct snd_soc_device *socdev, int idx, const char *xid);
    235 int snd_soc_init_card(struct snd_soc_device *socdev);
     274int snd_soc_cache_sync(struct snd_soc_codec *codec);
     275int snd_soc_cache_init(struct snd_soc_codec *codec);
     276int snd_soc_cache_exit(struct snd_soc_codec *codec);
     277int snd_soc_cache_write(struct snd_soc_codec *codec,
     278                        unsigned int reg, unsigned int value);
     279int snd_soc_cache_read(struct snd_soc_codec *codec,
     280                       unsigned int reg, unsigned int *value);
     281int snd_soc_default_volatile_register(struct snd_soc_codec *codec,
     282                                      unsigned int reg);
     283int snd_soc_default_readable_register(struct snd_soc_codec *codec,
     284                                      unsigned int reg);
     285
     286/* Utility functions to get clock rates from various things */
     287int snd_soc_calc_frame_size(int sample_size, int channels, int tdm_slots);
     288int snd_soc_params_to_frame_size(struct snd_pcm_hw_params *params);
     289int snd_soc_calc_bclk(int fs, int sample_size, int channels, int tdm_slots);
     290int snd_soc_params_to_bclk(struct snd_pcm_hw_params *parms);
    236291
    237292/* set runtime hw params */
     
    240295
    241296/* Jack reporting */
    242 int snd_soc_jack_new(struct snd_soc_card *card, const char *id, int type,
     297int snd_soc_jack_new(struct snd_soc_codec *codec, const char *id, int type,
    243298                     struct snd_soc_jack *jack);
    244299void snd_soc_jack_report(struct snd_soc_jack *jack, int status, int mask);
    245300int snd_soc_jack_add_pins(struct snd_soc_jack *jack, int count,
    246301                          struct snd_soc_jack_pin *pins);
     302void snd_soc_jack_notifier_register(struct snd_soc_jack *jack,
     303                                    struct notifier_block *nb);
     304void snd_soc_jack_notifier_unregister(struct snd_soc_jack *jack,
     305                                      struct notifier_block *nb);
    247306#ifdef CONFIG_GPIOLIB
    248307int snd_soc_jack_add_gpios(struct snd_soc_jack *jack, int count,
     
    255314int snd_soc_update_bits(struct snd_soc_codec *codec, unsigned short reg,
    256315                                unsigned int mask, unsigned int value);
     316int snd_soc_update_bits_locked(struct snd_soc_codec *codec,
     317                               unsigned short reg, unsigned int mask,
     318                               unsigned int value);
    257319int snd_soc_test_bits(struct snd_soc_codec *codec, unsigned short reg,
    258320                                unsigned int mask, unsigned int value);
     
    302364int snd_soc_put_volsw_s8(struct snd_kcontrol *kcontrol,
    303365        struct snd_ctl_elem_value *ucontrol);
     366int snd_soc_limit_volume(struct snd_soc_codec *codec,
     367        const char *name, int max);
     368int snd_soc_info_volsw_2r_sx(struct snd_kcontrol *kcontrol,
     369        struct snd_ctl_elem_info *uinfo);
     370int snd_soc_get_volsw_2r_sx(struct snd_kcontrol *kcontrol,
     371        struct snd_ctl_elem_value *ucontrol);
     372int snd_soc_put_volsw_2r_sx(struct snd_kcontrol *kcontrol,
     373        struct snd_ctl_elem_value *ucontrol);
     374
     375/**
     376 * struct snd_soc_reg_access - Describes whether a given register is
     377 * readable, writable or volatile.
     378 *
     379 * @reg: the register number
     380 * @read: whether this register is readable
     381 * @write: whether this register is writable
     382 * @vol: whether this register is volatile
     383 */
     384struct snd_soc_reg_access {
     385        u16 reg;
     386        u16 read;
     387        u16 write;
     388        u16 vol;
     389};
    304390
    305391/**
     
    334420        int debounce_time;
    335421        struct snd_soc_jack *jack;
    336         struct work_struct work;
     422        struct delayed_work work;
     423
     424        int (*jack_status_check)(void);
    337425};
    338426#endif
     
    340428struct snd_soc_jack {
    341429        struct snd_jack *jack;
    342         struct snd_soc_card *card;
     430        struct snd_soc_codec *codec;
    343431        struct list_head pins;
    344432        int status;
     433        struct blocking_notifier_head notifier;
    345434};
    346435
    347436/* SoC PCM stream information */
    348437struct snd_soc_pcm_stream {
    349         char *stream_name;
     438        const char *stream_name;
    350439        u64 formats;                    /* SNDRV_PCM_FMTBIT_* */
    351440        unsigned int rates;             /* SNDRV_PCM_RATE_* */
     
    354443        unsigned int channels_min;      /* min channels */
    355444        unsigned int channels_max;      /* max channels */
    356         unsigned int active:1;          /* stream is in use */
    357445};
    358446
     
    367455};
    368456
    369 /* SoC Audio Codec */
     457/* SoC cache ops */
     458struct snd_soc_cache_ops {
     459        const char *name;
     460        enum snd_soc_compress_type id;
     461        int (*init)(struct snd_soc_codec *codec);
     462        int (*exit)(struct snd_soc_codec *codec);
     463        int (*read)(struct snd_soc_codec *codec, unsigned int reg,
     464                unsigned int *value);
     465        int (*write)(struct snd_soc_codec *codec, unsigned int reg,
     466                unsigned int value);
     467        int (*sync)(struct snd_soc_codec *codec);
     468};
     469
     470/* SoC Audio Codec device */
    370471struct snd_soc_codec {
    371         char *name;
    372         struct module *owner;
     472        const char *name;
     473        const char *name_prefix;
     474        int id;
     475        struct device *dev;
     476        const struct snd_soc_codec_driver *driver;
     477
    373478        struct mutex mutex;
    374         struct device *dev;
    375         struct snd_soc_device *socdev;
    376 
     479        struct snd_soc_card *card;
    377480        struct list_head list;
    378 
    379         /* callbacks */
    380         int (*set_bias_level)(struct snd_soc_codec *,
    381                               enum snd_soc_bias_level level);
     481        struct list_head card_list;
     482        int num_dai;
     483        enum snd_soc_compress_type compress_type;
     484        size_t reg_size;        /* reg_cache_size * reg_word_size */
     485        int (*volatile_register)(struct snd_soc_codec *, unsigned int);
     486        int (*readable_register)(struct snd_soc_codec *, unsigned int);
    382487
    383488        /* runtime */
    384         struct snd_card *card;
    385489        struct snd_ac97 *ac97;  /* for ad-hoc ac97 devices */
    386490        unsigned int active;
    387         unsigned int pcm_devs;
    388         void *private_data;
     491        unsigned int cache_only:1;  /* Suppress writes to hardware */
     492        unsigned int cache_sync:1; /* Cache needs to be synced to hardware */
     493        unsigned int suspended:1; /* Codec is in suspend PM state */
     494        unsigned int probed:1; /* Codec has been probed */
     495        unsigned int ac97_registered:1; /* Codec has been AC97 registered */
     496        unsigned int ac97_created:1; /* Codec has been created by SoC */
     497        unsigned int sysfs_registered:1; /* codec has been sysfs registered */
     498        unsigned int cache_init:1; /* codec cache has been initialized */
    389499
    390500        /* codec IO */
    391501        void *control_data; /* codec control (i2c/3wire) data */
     502        hw_write_t hw_write;
     503        unsigned int (*hw_read)(struct snd_soc_codec *, unsigned int);
     504        unsigned int (*read)(struct snd_soc_codec *, unsigned int);
     505        int (*write)(struct snd_soc_codec *, unsigned int, unsigned int);
     506        void *reg_cache;
     507        const void *reg_def_copy;
     508        const struct snd_soc_cache_ops *cache_ops;
     509        struct mutex cache_rw_mutex;
     510
     511        /* dapm */
     512        struct snd_soc_dapm_context dapm;
     513
     514#ifdef CONFIG_DEBUG_FS
     515        struct dentry *debugfs_codec_root;
     516        struct dentry *debugfs_reg;
     517        struct dentry *debugfs_dapm;
     518#endif
     519};
     520
     521/* codec driver */
     522struct snd_soc_codec_driver {
     523
     524        /* driver ops */
     525        int (*probe)(struct snd_soc_codec *);
     526        int (*remove)(struct snd_soc_codec *);
     527        int (*suspend)(struct snd_soc_codec *,
     528                        pm_message_t state);
     529        int (*resume)(struct snd_soc_codec *);
     530
     531        /* codec IO */
    392532        unsigned int (*read)(struct snd_soc_codec *, unsigned int);
    393533        int (*write)(struct snd_soc_codec *, unsigned int, unsigned int);
    394534        int (*display_register)(struct snd_soc_codec *, char *,
    395535                                size_t, unsigned int);
    396         int (*volatile_register)(unsigned int);
    397         int (*readable_register)(unsigned int);
    398         hw_write_t hw_write;
    399         unsigned int (*hw_read)(struct snd_soc_codec *, unsigned int);
    400         void *reg_cache;
     536        int (*volatile_register)(struct snd_soc_codec *, unsigned int);
     537        int (*readable_register)(struct snd_soc_codec *, unsigned int);
    401538        short reg_cache_size;
    402539        short reg_cache_step;
    403 
    404         /* dapm */
    405         u32 pop_time;
    406         struct list_head dapm_widgets;
    407         struct list_head dapm_paths;
    408         enum snd_soc_bias_level bias_level;
    409         enum snd_soc_bias_level suspend_bias_level;
    410         struct delayed_work delayed_work;
    411 
    412         /* codec DAI's */
    413         struct snd_soc_dai *dai;
    414         unsigned int num_dai;
    415 
    416 #ifdef CONFIG_DEBUG_FS
    417         struct dentry *debugfs_reg;
    418         struct dentry *debugfs_pop_time;
    419         struct dentry *debugfs_dapm;
    420 #endif
    421 };
    422 
    423 /* codec device */
    424 struct snd_soc_codec_device {
    425         int (*probe)(struct platform_device *pdev);
    426         int (*remove)(struct platform_device *pdev);
    427         int (*suspend)(struct platform_device *pdev, pm_message_t state);
    428         int (*resume)(struct platform_device *pdev);
     540        short reg_word_size;
     541        const void *reg_cache_default;
     542        short reg_access_size;
     543        const struct snd_soc_reg_access *reg_access_default;
     544        enum snd_soc_compress_type compress_type;
     545
     546        /* codec bias level */
     547        int (*set_bias_level)(struct snd_soc_codec *,
     548                              enum snd_soc_bias_level level);
    429549};
    430550
    431551/* SoC platform interface */
    432 struct snd_soc_platform {
    433         char *name;
    434         struct list_head list;
    435 
    436         int (*probe)(struct platform_device *pdev);
    437         int (*remove)(struct platform_device *pdev);
     552struct snd_soc_platform_driver {
     553
     554        int (*probe)(struct snd_soc_platform *);
     555        int (*remove)(struct snd_soc_platform *);
    438556        int (*suspend)(struct snd_soc_dai *dai);
    439557        int (*resume)(struct snd_soc_dai *dai);
     
    444562        void (*pcm_free)(struct snd_pcm *);
    445563
     564        /*
     565         * For platform caused delay reporting.
     566         * Optional.
     567         */
     568        snd_pcm_sframes_t (*delay)(struct snd_pcm_substream *,
     569                struct snd_soc_dai *);
     570
    446571        /* platform stream ops */
    447         struct snd_pcm_ops *pcm_ops;
    448 };
    449 
    450 /* SoC machine DAI configuration, glues a codec and cpu DAI together */
    451 struct snd_soc_dai_link  {
    452         char *name;                     /* Codec name */
    453         char *stream_name;              /* Stream name */
    454 
    455         /* DAI */
    456         struct snd_soc_dai *codec_dai;
    457         struct snd_soc_dai *cpu_dai;
     572        struct snd_pcm_ops *ops;
     573};
     574
     575struct snd_soc_platform {
     576        const char *name;
     577        int id;
     578        struct device *dev;
     579        struct snd_soc_platform_driver *driver;
     580
     581        unsigned int suspended:1; /* platform is suspended */
     582        unsigned int probed:1;
     583
     584        struct snd_soc_card *card;
     585        struct list_head list;
     586        struct list_head card_list;
     587};
     588
     589struct snd_soc_dai_link {
     590        /* config - must be set by machine driver */
     591        const char *name;                       /* Codec name */
     592        const char *stream_name;                /* Stream name */
     593        const char *codec_name;         /* for multi-codec */
     594        const char *platform_name;      /* for multi-platform */
     595        const char *cpu_dai_name;
     596        const char *codec_dai_name;
     597
     598        /* Keep DAI active over suspend */
     599        unsigned int ignore_suspend:1;
     600
     601        /* Symmetry requirements */
     602        unsigned int symmetric_rates:1;
     603
     604        /* codec/machine specific init - e.g. add machine controls */
     605        int (*init)(struct snd_soc_pcm_runtime *rtd);
    458606
    459607        /* machine stream operations */
    460608        struct snd_soc_ops *ops;
     609};
     610
     611struct snd_soc_codec_conf {
     612        const char *dev_name;
     613
     614        /*
     615         * optional map of kcontrol, widget and path name prefixes that are
     616         * associated per device
     617         */
     618        const char *name_prefix;
     619
     620        /*
     621         * set this to the desired compression type if you want to
     622         * override the one supplied in codec->driver->compress_type
     623         */
     624        enum snd_soc_compress_type compress_type;
     625};
     626
     627struct snd_soc_aux_dev {
     628        const char *name;               /* Codec name */
     629        const char *codec_name;         /* for multi-codec */
    461630
    462631        /* codec/machine specific init - e.g. add machine controls */
    463         int (*init)(struct snd_soc_codec *codec);
    464 
    465         /* Symmetry requirements */
    466         unsigned int symmetric_rates:1;
    467 
    468         /* Symmetry data - only valid if symmetry is being enforced */
    469         unsigned int rate;
    470 
    471         /* DAI pcm */
    472         struct snd_pcm *pcm;
     632        int (*init)(struct snd_soc_dapm_context *dapm);
    473633};
    474634
    475635/* SoC card */
    476636struct snd_soc_card {
    477         char *name;
     637        const char *name;
    478638        struct device *dev;
     639        struct snd_card *snd_card;
     640        struct module *owner;
    479641
    480642        struct list_head list;
    481 
    482         int instantiated;
     643        struct mutex mutex;
     644
     645        bool instantiated;
    483646
    484647        int (*probe)(struct platform_device *pdev);
     
    495658        int (*set_bias_level)(struct snd_soc_card *,
    496659                              enum snd_soc_bias_level level);
     660        int (*set_bias_level_post)(struct snd_soc_card *,
     661                                   enum snd_soc_bias_level level);
     662
     663        long pmdown_time;
    497664
    498665        /* CPU <--> Codec DAI links  */
    499666        struct snd_soc_dai_link *dai_link;
    500667        int num_links;
    501 
    502         struct snd_soc_device *socdev;
    503 
     668        struct snd_soc_pcm_runtime *rtd;
     669        int num_rtd;
     670
     671        /* optional codec specific configuration */
     672        struct snd_soc_codec_conf *codec_conf;
     673        int num_configs;
     674
     675        /*
     676         * optional auxiliary devices such as amplifiers or codecs with DAI
     677         * link unused
     678         */
     679        struct snd_soc_aux_dev *aux_dev;
     680        int num_aux_devs;
     681        struct snd_soc_pcm_runtime *rtd_aux;
     682        int num_aux_rtd;
     683
     684        struct work_struct deferred_resume_work;
     685
     686        /* lists of probed devices belonging to this card */
     687        struct list_head codec_dev_list;
     688        struct list_head platform_dev_list;
     689        struct list_head dai_dev_list;
     690
     691        struct list_head widgets;
     692        struct list_head paths;
     693        struct list_head dapm_list;
     694
     695#ifdef CONFIG_DEBUG_FS
     696        struct dentry *debugfs_card_root;
     697        struct dentry *debugfs_pop_time;
     698#endif
     699        u32 pop_time;
     700};
     701
     702/* SoC machine DAI configuration, glues a codec and cpu DAI together */
     703struct snd_soc_pcm_runtime  {
     704        struct device dev;
     705        struct snd_soc_card *card;
     706        struct snd_soc_dai_link *dai_link;
     707
     708        unsigned int complete:1;
     709        unsigned int dev_registered:1;
     710
     711        /* Symmetry data - only valid if symmetry is being enforced */
     712        unsigned int rate;
     713        long pmdown_time;
     714
     715        /* runtime devices */
     716        struct snd_pcm *pcm;
    504717        struct snd_soc_codec *codec;
    505 
    506718        struct snd_soc_platform *platform;
     719        struct snd_soc_dai *codec_dai;
     720        struct snd_soc_dai *cpu_dai;
     721
    507722        struct delayed_work delayed_work;
    508         struct work_struct deferred_resume_work;
    509 };
    510 
    511 /* SoC Device - the audio subsystem */
    512 struct snd_soc_device {
    513         struct device *dev;
    514         struct snd_soc_card *card;
    515         struct snd_soc_codec_device *codec_dev;
    516         void *codec_data;
    517 };
    518 
    519 /* runtime channel data */
    520 struct snd_soc_pcm_runtime {
    521         struct snd_soc_dai_link *dai;
    522         struct snd_soc_device *socdev;
    523723};
    524724
    525725/* mixer control */
    526726struct soc_mixer_control {
    527         int min, max;
     727        int min, max, platform_max;
    528728        unsigned int reg, rreg, shift, rshift, invert;
    529729};
     
    543743
    544744/* codec IO */
    545 static inline unsigned int snd_soc_read(struct snd_soc_codec *codec,
    546                                         unsigned int reg)
     745unsigned int snd_soc_read(struct snd_soc_codec *codec, unsigned int reg);
     746unsigned int snd_soc_write(struct snd_soc_codec *codec,
     747                           unsigned int reg, unsigned int val);
     748
     749/* device driver data */
     750
     751static inline void snd_soc_codec_set_drvdata(struct snd_soc_codec *codec,
     752                void *data)
    547753{
    548         return codec->read(codec, reg);
     754        dev_set_drvdata(codec->dev, data);
    549755}
    550756
    551 static inline unsigned int snd_soc_write(struct snd_soc_codec *codec,
    552                                          unsigned int reg, unsigned int val)
     757static inline void *snd_soc_codec_get_drvdata(struct snd_soc_codec *codec)
    553758{
    554         return codec->write(codec, reg, val);
     759        return dev_get_drvdata(codec->dev);
    555760}
    556761
     762static inline void snd_soc_platform_set_drvdata(struct snd_soc_platform *platform,
     763                void *data)
     764{
     765        dev_set_drvdata(platform->dev, data);
     766}
     767
     768static inline void *snd_soc_platform_get_drvdata(struct snd_soc_platform *platform)
     769{
     770        return dev_get_drvdata(platform->dev);
     771}
     772
     773static inline void snd_soc_pcm_set_drvdata(struct snd_soc_pcm_runtime *rtd,
     774                void *data)
     775{
     776        dev_set_drvdata(&rtd->dev, data);
     777}
     778
     779static inline void *snd_soc_pcm_get_drvdata(struct snd_soc_pcm_runtime *rtd)
     780{
     781        return dev_get_drvdata(&rtd->dev);
     782}
     783
     784static inline void snd_soc_initialize_card_lists(struct snd_soc_card *card)
     785{
     786        INIT_LIST_HEAD(&card->dai_dev_list);
     787        INIT_LIST_HEAD(&card->codec_dev_list);
     788        INIT_LIST_HEAD(&card->platform_dev_list);
     789        INIT_LIST_HEAD(&card->widgets);
     790        INIT_LIST_HEAD(&card->paths);
     791        INIT_LIST_HEAD(&card->dapm_list);
     792}
     793
    557794#include <sound/soc-dai.h>
    558795
     796#ifdef CONFIG_DEBUG_FS
     797extern struct dentry *snd_soc_debugfs_root;
    559798#endif
     799
     800#endif
  • GPL/trunk/alsa-kernel/include/sound/tlv.h

    r464 r598  
    3939#define SNDRV_CTL_TLVT_DB_MINMAX_MUTE 5 /* dB scale with min/max with mute */
    4040
     41#define TLV_DB_SCALE_MASK       0xffff
     42#define TLV_DB_SCALE_MUTE       0x10000
    4143#define TLV_DB_SCALE_ITEM(min, step, mute)                      \
    4244        SNDRV_CTL_TLVT_DB_SCALE, 2 * sizeof(unsigned int),      \
    43         (min), ((step) & 0xffff) | ((mute) ? 0x10000 : 0)
     45        (min), ((step) & TLV_DB_SCALE_MASK) | ((mute) ? TLV_DB_SCALE_MUTE : 0)
    4446#define DECLARE_TLV_DB_SCALE(name, min, step, mute) \
    4547        unsigned int name[] = { TLV_DB_SCALE_ITEM(min, step, mute) }
  • GPL/trunk/alsa-kernel/include/sound/version.h

    r472 r598  
    11/* include/version.h */
    2 #define CONFIG_SND_VERSION "1.0.21"
     2#define CONFIG_SND_VERSION "1.0.24"
    33#define CONFIG_SND_DATE ""
Note: See TracChangeset for help on using the changeset viewer.