Merge branch 'for-linus' into for-next
authorTakashi Iwai <tiwai@suse.de>
Thu, 8 Nov 2012 14:58:25 +0000 (15:58 +0100)
committerTakashi Iwai <tiwai@suse.de>
Thu, 8 Nov 2012 14:58:25 +0000 (15:58 +0100)
73 files changed:
include/sound/Kbuild
include/sound/asequencer.h
include/sound/asound.h
include/sound/emu10k1.h
include/sound/pcm.h
include/sound/sb16_csp.h
include/uapi/sound/Kbuild
include/uapi/sound/asequencer.h [new file with mode: 0644]
include/uapi/sound/asound.h [new file with mode: 0644]
include/uapi/sound/asound_fm.h [moved from include/sound/asound_fm.h with 100% similarity]
include/uapi/sound/compress_offload.h [moved from include/sound/compress_offload.h with 100% similarity]
include/uapi/sound/compress_params.h [moved from include/sound/compress_params.h with 100% similarity]
include/uapi/sound/emu10k1.h [new file with mode: 0644]
include/uapi/sound/hdsp.h [moved from include/sound/hdsp.h with 100% similarity]
include/uapi/sound/hdspm.h [moved from include/sound/hdspm.h with 100% similarity]
include/uapi/sound/sb16_csp.h [new file with mode: 0644]
include/uapi/sound/sfnt_info.h [moved from include/sound/sfnt_info.h with 100% similarity]
sound/core/pcm_compat.c
sound/core/pcm_lib.c
sound/core/pcm_native.c
sound/drivers/Kconfig
sound/drivers/aloop.c
sound/drivers/dummy.c
sound/isa/Kconfig
sound/pci/Kconfig
sound/pci/asihpi/hpidspcd.c
sound/pci/asihpi/hpioctl.c
sound/pci/au88x0/au88x0_core.c
sound/pci/hda/Kconfig
sound/pci/hda/Makefile
sound/pci/hda/hda_codec.c
sound/pci/hda/hda_codec.h
sound/pci/hda/hda_intel.c
sound/pci/hda/hda_intel_trace.h [new file with mode: 0644]
sound/pci/hda/hda_jack.c
sound/pci/hda/hda_jack.h
sound/pci/hda/hda_local.h
sound/pci/hda/patch_cirrus.c
sound/pci/hda/patch_conexant.c
sound/pci/hda/patch_hdmi.c
sound/pci/hda/patch_realtek.c
sound/pci/hda/patch_sigmatel.c
sound/pci/ice1712/Makefile
sound/pci/ice1712/amp.c
sound/pci/ice1712/aureon.c
sound/pci/ice1712/delta.c
sound/pci/ice1712/ews.c
sound/pci/ice1712/hoontech.c
sound/pci/ice1712/ice1712.c
sound/pci/ice1712/ice1712.h
sound/pci/ice1712/ice1724.c
sound/pci/ice1712/juli.c
sound/pci/ice1712/maya44.c
sound/pci/ice1712/phase.c
sound/pci/ice1712/pontis.c
sound/pci/ice1712/prodigy192.c
sound/pci/ice1712/prodigy_hifi.c
sound/pci/ice1712/psc724.c [new file with mode: 0644]
sound/pci/ice1712/psc724.h [new file with mode: 0644]
sound/pci/ice1712/quartet.c
sound/pci/ice1712/revo.c
sound/pci/ice1712/se.c
sound/pci/ice1712/vt1720_mobo.c
sound/pci/ice1712/wm8766.c [new file with mode: 0644]
sound/pci/ice1712/wm8766.h [new file with mode: 0644]
sound/pci/ice1712/wm8776.c [new file with mode: 0644]
sound/pci/ice1712/wm8776.h [new file with mode: 0644]
sound/pci/ice1712/wtm.c
sound/pci/oxygen/virtuoso.c
sound/pci/oxygen/xonar_wm87x6.c
sound/usb/Kconfig
sound/usb/pcm.c
sound/usb/quirks-table.h

index 6df30ed..e69de29 100644 (file)
@@ -1,10 +0,0 @@
-header-y += asequencer.h
-header-y += asound.h
-header-y += asound_fm.h
-header-y += emu10k1.h
-header-y += hdsp.h
-header-y += hdspm.h
-header-y += sb16_csp.h
-header-y += sfnt_info.h
-header-y += compress_params.h
-header-y += compress_offload.h
index 1505e6d..75935ce 100644 (file)
 #ifndef __SOUND_ASEQUENCER_H
 #define __SOUND_ASEQUENCER_H
 
-#ifdef __KERNEL__
 #include <linux/ioctl.h>
 #include <sound/asound.h>
-#endif
-
-/** version of the sequencer */
-#define SNDRV_SEQ_VERSION SNDRV_PROTOCOL_VERSION (1, 0, 1)
-
-/**
- * definition of sequencer event types
- */
-
-/** system messages
- * event data type = #snd_seq_result
- */
-#define SNDRV_SEQ_EVENT_SYSTEM         0
-#define SNDRV_SEQ_EVENT_RESULT         1
-
-/** note messages (channel specific)
- * event data type = #snd_seq_ev_note
- */
-#define SNDRV_SEQ_EVENT_NOTE           5
-#define SNDRV_SEQ_EVENT_NOTEON         6
-#define SNDRV_SEQ_EVENT_NOTEOFF                7
-#define SNDRV_SEQ_EVENT_KEYPRESS       8
-       
-/** control messages (channel specific)
- * event data type = #snd_seq_ev_ctrl
- */
-#define SNDRV_SEQ_EVENT_CONTROLLER     10
-#define SNDRV_SEQ_EVENT_PGMCHANGE      11
-#define SNDRV_SEQ_EVENT_CHANPRESS      12
-#define SNDRV_SEQ_EVENT_PITCHBEND      13      /**< from -8192 to 8191 */
-#define SNDRV_SEQ_EVENT_CONTROL14      14      /**< 14 bit controller value */
-#define SNDRV_SEQ_EVENT_NONREGPARAM    15      /**< 14 bit NRPN address + 14 bit unsigned value */
-#define SNDRV_SEQ_EVENT_REGPARAM       16      /**< 14 bit RPN address + 14 bit unsigned value */
-
-/** synchronisation messages
- * event data type = #snd_seq_ev_ctrl
- */
-#define SNDRV_SEQ_EVENT_SONGPOS                20      /* Song Position Pointer with LSB and MSB values */
-#define SNDRV_SEQ_EVENT_SONGSEL                21      /* Song Select with song ID number */
-#define SNDRV_SEQ_EVENT_QFRAME         22      /* midi time code quarter frame */
-#define SNDRV_SEQ_EVENT_TIMESIGN       23      /* SMF Time Signature event */
-#define SNDRV_SEQ_EVENT_KEYSIGN                24      /* SMF Key Signature event */
-               
-/** timer messages
- * event data type = snd_seq_ev_queue_control
- */
-#define SNDRV_SEQ_EVENT_START          30      /* midi Real Time Start message */
-#define SNDRV_SEQ_EVENT_CONTINUE       31      /* midi Real Time Continue message */
-#define SNDRV_SEQ_EVENT_STOP           32      /* midi Real Time Stop message */       
-#define        SNDRV_SEQ_EVENT_SETPOS_TICK     33      /* set tick queue position */
-#define SNDRV_SEQ_EVENT_SETPOS_TIME    34      /* set realtime queue position */
-#define SNDRV_SEQ_EVENT_TEMPO          35      /* (SMF) Tempo event */
-#define SNDRV_SEQ_EVENT_CLOCK          36      /* midi Real Time Clock message */
-#define SNDRV_SEQ_EVENT_TICK           37      /* midi Real Time Tick message */
-#define SNDRV_SEQ_EVENT_QUEUE_SKEW     38      /* skew queue tempo */
-
-/** others
- * event data type = none
- */
-#define SNDRV_SEQ_EVENT_TUNE_REQUEST   40      /* tune request */
-#define SNDRV_SEQ_EVENT_RESET          41      /* reset to power-on state */
-#define SNDRV_SEQ_EVENT_SENSING                42      /* "active sensing" event */
-
-/** echo back, kernel private messages
- * event data type = any type
- */
-#define SNDRV_SEQ_EVENT_ECHO           50      /* echo event */
-#define SNDRV_SEQ_EVENT_OSS            51      /* OSS raw event */
-
-/** system status messages (broadcast for subscribers)
- * event data type = snd_seq_addr
- */
-#define SNDRV_SEQ_EVENT_CLIENT_START   60      /* new client has connected */
-#define SNDRV_SEQ_EVENT_CLIENT_EXIT    61      /* client has left the system */
-#define SNDRV_SEQ_EVENT_CLIENT_CHANGE  62      /* client status/info has changed */
-#define SNDRV_SEQ_EVENT_PORT_START     63      /* new port was created */
-#define SNDRV_SEQ_EVENT_PORT_EXIT      64      /* port was deleted from system */
-#define SNDRV_SEQ_EVENT_PORT_CHANGE    65      /* port status/info has changed */
-
-/** port connection changes
- * event data type = snd_seq_connect
- */
-#define SNDRV_SEQ_EVENT_PORT_SUBSCRIBED        66      /* ports connected */
-#define SNDRV_SEQ_EVENT_PORT_UNSUBSCRIBED 67   /* ports disconnected */
-
-/* 70-89:  synthesizer events - obsoleted */
-
-/** user-defined events with fixed length
- * event data type = any
- */
-#define SNDRV_SEQ_EVENT_USR0           90
-#define SNDRV_SEQ_EVENT_USR1           91
-#define SNDRV_SEQ_EVENT_USR2           92
-#define SNDRV_SEQ_EVENT_USR3           93
-#define SNDRV_SEQ_EVENT_USR4           94
-#define SNDRV_SEQ_EVENT_USR5           95
-#define SNDRV_SEQ_EVENT_USR6           96
-#define SNDRV_SEQ_EVENT_USR7           97
-#define SNDRV_SEQ_EVENT_USR8           98
-#define SNDRV_SEQ_EVENT_USR9           99
-
-/* 100-118: instrument layer - obsoleted */
-/* 119-129: reserved */
-
-/* 130-139: variable length events
- * event data type = snd_seq_ev_ext
- * (SNDRV_SEQ_EVENT_LENGTH_VARIABLE must be set)
- */
-#define SNDRV_SEQ_EVENT_SYSEX          130     /* system exclusive data (variable length) */
-#define SNDRV_SEQ_EVENT_BOUNCE         131     /* error event */
-/* 132-134: reserved */
-#define SNDRV_SEQ_EVENT_USR_VAR0       135
-#define SNDRV_SEQ_EVENT_USR_VAR1       136
-#define SNDRV_SEQ_EVENT_USR_VAR2       137
-#define SNDRV_SEQ_EVENT_USR_VAR3       138
-#define SNDRV_SEQ_EVENT_USR_VAR4       139
-
-/* 150-151: kernel events with quote - DO NOT use in user clients */
-#define SNDRV_SEQ_EVENT_KERNEL_ERROR   150
-#define SNDRV_SEQ_EVENT_KERNEL_QUOTE   151     /* obsolete */
-
-/* 152-191: reserved */
-
-/* 192-254: hardware specific events */
-
-/* 255: special event */
-#define SNDRV_SEQ_EVENT_NONE           255
-
-
-typedef unsigned char snd_seq_event_type_t;
-
-/** event address */
-struct snd_seq_addr {
-       unsigned char client;   /**< Client number:         0..255, 255 = broadcast to all clients */
-       unsigned char port;     /**< Port within client:    0..255, 255 = broadcast to all ports */
-};
-
-/** port connection */
-struct snd_seq_connect {
-       struct snd_seq_addr sender;
-       struct snd_seq_addr dest;
-};
-
-
-#define SNDRV_SEQ_ADDRESS_UNKNOWN      253     /* unknown source */
-#define SNDRV_SEQ_ADDRESS_SUBSCRIBERS  254     /* send event to all subscribed ports */
-#define SNDRV_SEQ_ADDRESS_BROADCAST    255     /* send event to all queues/clients/ports/channels */
-#define SNDRV_SEQ_QUEUE_DIRECT         253     /* direct dispatch */
-
-       /* event mode flag - NOTE: only 8 bits available! */
-#define SNDRV_SEQ_TIME_STAMP_TICK      (0<<0) /* timestamp in clock ticks */
-#define SNDRV_SEQ_TIME_STAMP_REAL      (1<<0) /* timestamp in real time */
-#define SNDRV_SEQ_TIME_STAMP_MASK      (1<<0)
-
-#define SNDRV_SEQ_TIME_MODE_ABS                (0<<1)  /* absolute timestamp */
-#define SNDRV_SEQ_TIME_MODE_REL                (1<<1)  /* relative to current time */
-#define SNDRV_SEQ_TIME_MODE_MASK       (1<<1)
-
-#define SNDRV_SEQ_EVENT_LENGTH_FIXED   (0<<2)  /* fixed event size */
-#define SNDRV_SEQ_EVENT_LENGTH_VARIABLE        (1<<2)  /* variable event size */
-#define SNDRV_SEQ_EVENT_LENGTH_VARUSR  (2<<2)  /* variable event size - user memory space */
-#define SNDRV_SEQ_EVENT_LENGTH_MASK    (3<<2)
-
-#define SNDRV_SEQ_PRIORITY_NORMAL      (0<<4)  /* normal priority */
-#define SNDRV_SEQ_PRIORITY_HIGH                (1<<4)  /* event should be processed before others */
-#define SNDRV_SEQ_PRIORITY_MASK                (1<<4)
-
-
-       /* note event */
-struct snd_seq_ev_note {
-       unsigned char channel;
-       unsigned char note;
-       unsigned char velocity;
-       unsigned char off_velocity;     /* only for SNDRV_SEQ_EVENT_NOTE */
-       unsigned int duration;          /* only for SNDRV_SEQ_EVENT_NOTE */
-};
-
-       /* controller event */
-struct snd_seq_ev_ctrl {
-       unsigned char channel;
-       unsigned char unused1, unused2, unused3;        /* pad */
-       unsigned int param;
-       signed int value;
-};
-
-       /* generic set of bytes (12x8 bit) */
-struct snd_seq_ev_raw8 {
-       unsigned char d[12];    /* 8 bit value */
-};
-
-       /* generic set of integers (3x32 bit) */
-struct snd_seq_ev_raw32 {
-       unsigned int d[3];      /* 32 bit value */
-};
-
-       /* external stored data */
-struct snd_seq_ev_ext {
-       unsigned int len;       /* length of data */
-       void *ptr;              /* pointer to data (note: maybe 64-bit) */
-} __attribute__((packed));
-
-struct snd_seq_result {
-       int event;              /* processed event type */
-       int result;
-};
-
-
-struct snd_seq_real_time {
-       unsigned int tv_sec;    /* seconds */
-       unsigned int tv_nsec;   /* nanoseconds */
-};
-
-typedef unsigned int snd_seq_tick_time_t;      /* midi ticks */
-
-union snd_seq_timestamp {
-       snd_seq_tick_time_t tick;
-       struct snd_seq_real_time time;
-};
-
-struct snd_seq_queue_skew {
-       unsigned int value;
-       unsigned int base;
-};
-
-       /* queue timer control */
-struct snd_seq_ev_queue_control {
-       unsigned char queue;                    /* affected queue */
-       unsigned char pad[3];                   /* reserved */
-       union {
-               signed int value;               /* affected value (e.g. tempo) */
-               union snd_seq_timestamp time;   /* time */
-               unsigned int position;          /* sync position */
-               struct snd_seq_queue_skew skew;
-               unsigned int d32[2];
-               unsigned char d8[8];
-       } param;
-};
-
-       /* quoted event - inside the kernel only */
-struct snd_seq_ev_quote {
-       struct snd_seq_addr origin;             /* original sender */
-       unsigned short value;           /* optional data */
-       struct snd_seq_event *event;            /* quoted event */
-} __attribute__((packed));
-
-
-       /* sequencer event */
-struct snd_seq_event {
-       snd_seq_event_type_t type;      /* event type */
-       unsigned char flags;            /* event flags */
-       char tag;
-       
-       unsigned char queue;            /* schedule queue */
-       union snd_seq_timestamp time;   /* schedule time */
-
-
-       struct snd_seq_addr source;     /* source address */
-       struct snd_seq_addr dest;       /* destination address */
-
-       union {                         /* event data... */
-               struct snd_seq_ev_note note;
-               struct snd_seq_ev_ctrl control;
-               struct snd_seq_ev_raw8 raw8;
-               struct snd_seq_ev_raw32 raw32;
-               struct snd_seq_ev_ext ext;
-               struct snd_seq_ev_queue_control queue;
-               union snd_seq_timestamp time;
-               struct snd_seq_addr addr;
-               struct snd_seq_connect connect;
-               struct snd_seq_result result;
-               struct snd_seq_ev_quote quote;
-       } data;
-};
-
-
-/*
- * bounce event - stored as variable size data
- */
-struct snd_seq_event_bounce {
-       int err;
-       struct snd_seq_event event;
-       /* external data follows here. */
-};
-
-#ifdef __KERNEL__
+#include <uapi/sound/asequencer.h>
 
 /* helper macro */
 #define snd_seq_event_bounce_ext_data(ev) ((void*)((char *)(ev)->data.ext.ptr + sizeof(struct snd_seq_event_bounce)))
@@ -368,311 +83,4 @@ struct snd_seq_event_bounce {
 /* queue sync port */
 #define snd_seq_queue_sync_port(q)     ((q) + 16)
 
-#endif /* __KERNEL__ */
-
-       /* system information */
-struct snd_seq_system_info {
-       int queues;                     /* maximum queues count */
-       int clients;                    /* maximum clients count */
-       int ports;                      /* maximum ports per client */
-       int channels;                   /* maximum channels per port */
-       int cur_clients;                /* current clients */
-       int cur_queues;                 /* current queues */
-       char reserved[24];
-};
-
-
-       /* system running information */
-struct snd_seq_running_info {
-       unsigned char client;           /* client id */
-       unsigned char big_endian;       /* 1 = big-endian */
-       unsigned char cpu_mode;         /* 4 = 32bit, 8 = 64bit */
-       unsigned char pad;              /* reserved */
-       unsigned char reserved[12];
-};
-
-
-       /* known client numbers */
-#define SNDRV_SEQ_CLIENT_SYSTEM                0
-       /* internal client numbers */
-#define SNDRV_SEQ_CLIENT_DUMMY         14      /* midi through */
-#define SNDRV_SEQ_CLIENT_OSS           15      /* oss sequencer emulator */
-
-
-       /* client types */
-typedef int __bitwise snd_seq_client_type_t;
-#define        NO_CLIENT       ((__force snd_seq_client_type_t) 0)
-#define        USER_CLIENT     ((__force snd_seq_client_type_t) 1)
-#define        KERNEL_CLIENT   ((__force snd_seq_client_type_t) 2)
-                        
-       /* event filter flags */
-#define SNDRV_SEQ_FILTER_BROADCAST     (1<<0)  /* accept broadcast messages */
-#define SNDRV_SEQ_FILTER_MULTICAST     (1<<1)  /* accept multicast messages */
-#define SNDRV_SEQ_FILTER_BOUNCE                (1<<2)  /* accept bounce event in error */
-#define SNDRV_SEQ_FILTER_USE_EVENT     (1<<31) /* use event filter */
-
-struct snd_seq_client_info {
-       int client;                     /* client number to inquire */
-       snd_seq_client_type_t type;     /* client type */
-       char name[64];                  /* client name */
-       unsigned int filter;            /* filter flags */
-       unsigned char multicast_filter[8]; /* multicast filter bitmap */
-       unsigned char event_filter[32]; /* event filter bitmap */
-       int num_ports;                  /* RO: number of ports */
-       int event_lost;                 /* number of lost events */
-       char reserved[64];              /* for future use */
-};
-
-
-/* client pool size */
-struct snd_seq_client_pool {
-       int client;                     /* client number to inquire */
-       int output_pool;                /* outgoing (write) pool size */
-       int input_pool;                 /* incoming (read) pool size */
-       int output_room;                /* minimum free pool size for select/blocking mode */
-       int output_free;                /* unused size */
-       int input_free;                 /* unused size */
-       char reserved[64];
-};
-
-
-/* Remove events by specified criteria */
-
-#define SNDRV_SEQ_REMOVE_INPUT         (1<<0)  /* Flush input queues */
-#define SNDRV_SEQ_REMOVE_OUTPUT                (1<<1)  /* Flush output queues */
-#define SNDRV_SEQ_REMOVE_DEST          (1<<2)  /* Restrict by destination q:client:port */
-#define SNDRV_SEQ_REMOVE_DEST_CHANNEL  (1<<3)  /* Restrict by channel */
-#define SNDRV_SEQ_REMOVE_TIME_BEFORE   (1<<4)  /* Restrict to before time */
-#define SNDRV_SEQ_REMOVE_TIME_AFTER    (1<<5)  /* Restrict to time or after */
-#define SNDRV_SEQ_REMOVE_TIME_TICK     (1<<6)  /* Time is in ticks */
-#define SNDRV_SEQ_REMOVE_EVENT_TYPE    (1<<7)  /* Restrict to event type */
-#define SNDRV_SEQ_REMOVE_IGNORE_OFF    (1<<8)  /* Do not flush off events */
-#define SNDRV_SEQ_REMOVE_TAG_MATCH     (1<<9)  /* Restrict to events with given tag */
-
-struct snd_seq_remove_events {
-       unsigned int  remove_mode;      /* Flags that determine what gets removed */
-
-       union snd_seq_timestamp time;
-
-       unsigned char queue;    /* Queue for REMOVE_DEST */
-       struct snd_seq_addr dest;       /* Address for REMOVE_DEST */
-       unsigned char channel;  /* Channel for REMOVE_DEST */
-
-       int  type;      /* For REMOVE_EVENT_TYPE */
-       char  tag;      /* Tag for REMOVE_TAG */
-
-       int  reserved[10];      /* To allow for future binary compatibility */
-
-};
-
-
-       /* known port numbers */
-#define SNDRV_SEQ_PORT_SYSTEM_TIMER    0
-#define SNDRV_SEQ_PORT_SYSTEM_ANNOUNCE 1
-
-       /* port capabilities (32 bits) */
-#define SNDRV_SEQ_PORT_CAP_READ                (1<<0)  /* readable from this port */
-#define SNDRV_SEQ_PORT_CAP_WRITE       (1<<1)  /* writable to this port */
-
-#define SNDRV_SEQ_PORT_CAP_SYNC_READ   (1<<2)
-#define SNDRV_SEQ_PORT_CAP_SYNC_WRITE  (1<<3)
-
-#define SNDRV_SEQ_PORT_CAP_DUPLEX      (1<<4)
-
-#define SNDRV_SEQ_PORT_CAP_SUBS_READ   (1<<5)  /* allow read subscription */
-#define SNDRV_SEQ_PORT_CAP_SUBS_WRITE  (1<<6)  /* allow write subscription */
-#define SNDRV_SEQ_PORT_CAP_NO_EXPORT   (1<<7)  /* routing not allowed */
-
-       /* port type */
-#define SNDRV_SEQ_PORT_TYPE_SPECIFIC   (1<<0)  /* hardware specific */
-#define SNDRV_SEQ_PORT_TYPE_MIDI_GENERIC (1<<1)        /* generic MIDI device */
-#define SNDRV_SEQ_PORT_TYPE_MIDI_GM    (1<<2)  /* General MIDI compatible device */
-#define SNDRV_SEQ_PORT_TYPE_MIDI_GS    (1<<3)  /* GS compatible device */
-#define SNDRV_SEQ_PORT_TYPE_MIDI_XG    (1<<4)  /* XG compatible device */
-#define SNDRV_SEQ_PORT_TYPE_MIDI_MT32  (1<<5)  /* MT-32 compatible device */
-#define SNDRV_SEQ_PORT_TYPE_MIDI_GM2   (1<<6)  /* General MIDI 2 compatible device */
-
-/* other standards...*/
-#define SNDRV_SEQ_PORT_TYPE_SYNTH      (1<<10) /* Synth device (no MIDI compatible - direct wavetable) */
-#define SNDRV_SEQ_PORT_TYPE_DIRECT_SAMPLE (1<<11)      /* Sampling device (support sample download) */
-#define SNDRV_SEQ_PORT_TYPE_SAMPLE     (1<<12) /* Sampling device (sample can be downloaded at any time) */
-/*...*/
-#define SNDRV_SEQ_PORT_TYPE_HARDWARE   (1<<16) /* driver for a hardware device */
-#define SNDRV_SEQ_PORT_TYPE_SOFTWARE   (1<<17) /* implemented in software */
-#define SNDRV_SEQ_PORT_TYPE_SYNTHESIZER        (1<<18) /* generates sound */
-#define SNDRV_SEQ_PORT_TYPE_PORT       (1<<19) /* connects to other device(s) */
-#define SNDRV_SEQ_PORT_TYPE_APPLICATION        (1<<20) /* application (sequencer/editor) */
-
-/* misc. conditioning flags */
-#define SNDRV_SEQ_PORT_FLG_GIVEN_PORT  (1<<0)
-#define SNDRV_SEQ_PORT_FLG_TIMESTAMP   (1<<1)
-#define SNDRV_SEQ_PORT_FLG_TIME_REAL   (1<<2)
-
-struct snd_seq_port_info {
-       struct snd_seq_addr addr;       /* client/port numbers */
-       char name[64];                  /* port name */
-
-       unsigned int capability;        /* port capability bits */
-       unsigned int type;              /* port type bits */
-       int midi_channels;              /* channels per MIDI port */
-       int midi_voices;                /* voices per MIDI port */
-       int synth_voices;               /* voices per SYNTH port */
-
-       int read_use;                   /* R/O: subscribers for output (from this port) */
-       int write_use;                  /* R/O: subscribers for input (to this port) */
-
-       void *kernel;                   /* reserved for kernel use (must be NULL) */
-       unsigned int flags;             /* misc. conditioning */
-       unsigned char time_queue;       /* queue # for timestamping */
-       char reserved[59];              /* for future use */
-};
-
-
-/* queue flags */
-#define SNDRV_SEQ_QUEUE_FLG_SYNC       (1<<0)  /* sync enabled */
-
-/* queue information */
-struct snd_seq_queue_info {
-       int queue;              /* queue id */
-
-       /*
-        *  security settings, only owner of this queue can start/stop timer
-        *  etc. if the queue is locked for other clients
-        */
-       int owner;              /* client id for owner of the queue */
-       unsigned locked:1;      /* timing queue locked for other queues */
-       char name[64];          /* name of this queue */
-       unsigned int flags;     /* flags */
-       char reserved[60];      /* for future use */
-
-};
-
-/* queue info/status */
-struct snd_seq_queue_status {
-       int queue;                      /* queue id */
-       int events;                     /* read-only - queue size */
-       snd_seq_tick_time_t tick;       /* current tick */
-       struct snd_seq_real_time time;  /* current time */
-       int running;                    /* running state of queue */
-       int flags;                      /* various flags */
-       char reserved[64];              /* for the future */
-};
-
-
-/* queue tempo */
-struct snd_seq_queue_tempo {
-       int queue;                      /* sequencer queue */
-       unsigned int tempo;             /* current tempo, us/tick */
-       int ppq;                        /* time resolution, ticks/quarter */
-       unsigned int skew_value;        /* queue skew */
-       unsigned int skew_base;         /* queue skew base */
-       char reserved[24];              /* for the future */
-};
-
-
-/* sequencer timer sources */
-#define SNDRV_SEQ_TIMER_ALSA           0       /* ALSA timer */
-#define SNDRV_SEQ_TIMER_MIDI_CLOCK     1       /* Midi Clock (CLOCK event) */
-#define SNDRV_SEQ_TIMER_MIDI_TICK      2       /* Midi Timer Tick (TICK event) */
-
-/* queue timer info */
-struct snd_seq_queue_timer {
-       int queue;                      /* sequencer queue */
-       int type;                       /* source timer type */
-       union {
-               struct {
-                       struct snd_timer_id id; /* ALSA's timer ID */
-                       unsigned int resolution;        /* resolution in Hz */
-               } alsa;
-       } u;
-       char reserved[64];              /* for the future use */
-};
-
-
-struct snd_seq_queue_client {
-       int queue;              /* sequencer queue */
-       int client;             /* sequencer client */
-       int used;               /* queue is used with this client
-                                  (must be set for accepting events) */
-       /* per client watermarks */
-       char reserved[64];      /* for future use */
-};
-
-
-#define SNDRV_SEQ_PORT_SUBS_EXCLUSIVE  (1<<0)  /* exclusive connection */
-#define SNDRV_SEQ_PORT_SUBS_TIMESTAMP  (1<<1)
-#define SNDRV_SEQ_PORT_SUBS_TIME_REAL  (1<<2)
-
-struct snd_seq_port_subscribe {
-       struct snd_seq_addr sender;     /* sender address */
-       struct snd_seq_addr dest;       /* destination address */
-       unsigned int voices;            /* number of voices to be allocated (0 = don't care) */
-       unsigned int flags;             /* modes */
-       unsigned char queue;            /* input time-stamp queue (optional) */
-       unsigned char pad[3];           /* reserved */
-       char reserved[64];
-};
-
-/* type of query subscription */
-#define SNDRV_SEQ_QUERY_SUBS_READ      0
-#define SNDRV_SEQ_QUERY_SUBS_WRITE     1
-
-struct snd_seq_query_subs {
-       struct snd_seq_addr root;       /* client/port id to be searched */
-       int type;               /* READ or WRITE */
-       int index;              /* 0..N-1 */
-       int num_subs;           /* R/O: number of subscriptions on this port */
-       struct snd_seq_addr addr;       /* R/O: result */
-       unsigned char queue;    /* R/O: result */
-       unsigned int flags;     /* R/O: result */
-       char reserved[64];      /* for future use */
-};
-
-
-/*
- *  IOCTL commands
- */
-
-#define SNDRV_SEQ_IOCTL_PVERSION       _IOR ('S', 0x00, int)
-#define SNDRV_SEQ_IOCTL_CLIENT_ID      _IOR ('S', 0x01, int)
-#define SNDRV_SEQ_IOCTL_SYSTEM_INFO    _IOWR('S', 0x02, struct snd_seq_system_info)
-#define SNDRV_SEQ_IOCTL_RUNNING_MODE   _IOWR('S', 0x03, struct snd_seq_running_info)
-
-#define SNDRV_SEQ_IOCTL_GET_CLIENT_INFO        _IOWR('S', 0x10, struct snd_seq_client_info)
-#define SNDRV_SEQ_IOCTL_SET_CLIENT_INFO        _IOW ('S', 0x11, struct snd_seq_client_info)
-
-#define SNDRV_SEQ_IOCTL_CREATE_PORT    _IOWR('S', 0x20, struct snd_seq_port_info)
-#define SNDRV_SEQ_IOCTL_DELETE_PORT    _IOW ('S', 0x21, struct snd_seq_port_info)
-#define SNDRV_SEQ_IOCTL_GET_PORT_INFO  _IOWR('S', 0x22, struct snd_seq_port_info)
-#define SNDRV_SEQ_IOCTL_SET_PORT_INFO  _IOW ('S', 0x23, struct snd_seq_port_info)
-
-#define SNDRV_SEQ_IOCTL_SUBSCRIBE_PORT _IOW ('S', 0x30, struct snd_seq_port_subscribe)
-#define SNDRV_SEQ_IOCTL_UNSUBSCRIBE_PORT _IOW ('S', 0x31, struct snd_seq_port_subscribe)
-
-#define SNDRV_SEQ_IOCTL_CREATE_QUEUE   _IOWR('S', 0x32, struct snd_seq_queue_info)
-#define SNDRV_SEQ_IOCTL_DELETE_QUEUE   _IOW ('S', 0x33, struct snd_seq_queue_info)
-#define SNDRV_SEQ_IOCTL_GET_QUEUE_INFO _IOWR('S', 0x34, struct snd_seq_queue_info)
-#define SNDRV_SEQ_IOCTL_SET_QUEUE_INFO _IOWR('S', 0x35, struct snd_seq_queue_info)
-#define SNDRV_SEQ_IOCTL_GET_NAMED_QUEUE        _IOWR('S', 0x36, struct snd_seq_queue_info)
-#define SNDRV_SEQ_IOCTL_GET_QUEUE_STATUS _IOWR('S', 0x40, struct snd_seq_queue_status)
-#define SNDRV_SEQ_IOCTL_GET_QUEUE_TEMPO        _IOWR('S', 0x41, struct snd_seq_queue_tempo)
-#define SNDRV_SEQ_IOCTL_SET_QUEUE_TEMPO        _IOW ('S', 0x42, struct snd_seq_queue_tempo)
-#define SNDRV_SEQ_IOCTL_GET_QUEUE_OWNER        _IOWR('S', 0x43, struct snd_seq_queue_owner)
-#define SNDRV_SEQ_IOCTL_SET_QUEUE_OWNER        _IOW ('S', 0x44, struct snd_seq_queue_owner)
-#define SNDRV_SEQ_IOCTL_GET_QUEUE_TIMER        _IOWR('S', 0x45, struct snd_seq_queue_timer)
-#define SNDRV_SEQ_IOCTL_SET_QUEUE_TIMER        _IOW ('S', 0x46, struct snd_seq_queue_timer)
-/* XXX
-#define SNDRV_SEQ_IOCTL_GET_QUEUE_SYNC _IOWR('S', 0x53, struct snd_seq_queue_sync)
-#define SNDRV_SEQ_IOCTL_SET_QUEUE_SYNC _IOW ('S', 0x54, struct snd_seq_queue_sync)
-*/
-#define SNDRV_SEQ_IOCTL_GET_QUEUE_CLIENT       _IOWR('S', 0x49, struct snd_seq_queue_client)
-#define SNDRV_SEQ_IOCTL_SET_QUEUE_CLIENT       _IOW ('S', 0x4a, struct snd_seq_queue_client)
-#define SNDRV_SEQ_IOCTL_GET_CLIENT_POOL        _IOWR('S', 0x4b, struct snd_seq_client_pool)
-#define SNDRV_SEQ_IOCTL_SET_CLIENT_POOL        _IOW ('S', 0x4c, struct snd_seq_client_pool)
-#define SNDRV_SEQ_IOCTL_REMOVE_EVENTS  _IOW ('S', 0x4e, struct snd_seq_remove_events)
-#define SNDRV_SEQ_IOCTL_QUERY_SUBS     _IOWR('S', 0x4f, struct snd_seq_query_subs)
-#define SNDRV_SEQ_IOCTL_GET_SUBSCRIPTION       _IOWR('S', 0x50, struct snd_seq_port_subscribe)
-#define SNDRV_SEQ_IOCTL_QUERY_NEXT_CLIENT      _IOWR('S', 0x51, struct snd_seq_client_info)
-#define SNDRV_SEQ_IOCTL_QUERY_NEXT_PORT        _IOWR('S', 0x52, struct snd_seq_port_info)
-
 #endif /* __SOUND_ASEQUENCER_H */
index dfe7d44..c2dff53 100644 (file)
  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
  *
  */
-
 #ifndef __SOUND_ASOUND_H
 #define __SOUND_ASOUND_H
 
-#include <linux/types.h>
-
-#ifdef __KERNEL__
 #include <linux/ioctl.h>
 #include <linux/time.h>
 #include <asm/byteorder.h>
 #endif
 #endif
 
-#endif /* __KERNEL__ **/
-
-/*
- *  protocol version
- */
-
-#define SNDRV_PROTOCOL_VERSION(major, minor, subminor) (((major)<<16)|((minor)<<8)|(subminor))
-#define SNDRV_PROTOCOL_MAJOR(version) (((version)>>16)&0xffff)
-#define SNDRV_PROTOCOL_MINOR(version) (((version)>>8)&0xff)
-#define SNDRV_PROTOCOL_MICRO(version) ((version)&0xff)
-#define SNDRV_PROTOCOL_INCOMPATIBLE(kversion, uversion) \
-       (SNDRV_PROTOCOL_MAJOR(kversion) != SNDRV_PROTOCOL_MAJOR(uversion) || \
-        (SNDRV_PROTOCOL_MAJOR(kversion) == SNDRV_PROTOCOL_MAJOR(uversion) && \
-          SNDRV_PROTOCOL_MINOR(kversion) != SNDRV_PROTOCOL_MINOR(uversion)))
-
-/****************************************************************************
- *                                                                          *
- *        Digital audio interface                                          *
- *                                                                          *
- ****************************************************************************/
-
-struct snd_aes_iec958 {
-       unsigned char status[24];       /* AES/IEC958 channel status bits */
-       unsigned char subcode[147];     /* AES/IEC958 subcode bits */
-       unsigned char pad;              /* nothing */
-       unsigned char dig_subframe[4];  /* AES/IEC958 subframe bits */
-};
-
-/****************************************************************************
- *                                                                          *
- *        CEA-861 Audio InfoFrame. Used in HDMI and DisplayPort                    *
- *                                                                          *
- ****************************************************************************/
-
-struct snd_cea_861_aud_if {
-       unsigned char db1_ct_cc; /* coding type and channel count */
-       unsigned char db2_sf_ss; /* sample frequency and size */
-       unsigned char db3; /* not used, all zeros */
-       unsigned char db4_ca; /* channel allocation code */
-       unsigned char db5_dminh_lsv; /* downmix inhibit & level-shit values */
-};
-
-/****************************************************************************
- *                                                                          *
- *      Section for driver hardware dependent interface - /dev/snd/hw?      *
- *                                                                          *
- ****************************************************************************/
-
-#define SNDRV_HWDEP_VERSION            SNDRV_PROTOCOL_VERSION(1, 0, 1)
-
-enum {
-       SNDRV_HWDEP_IFACE_OPL2 = 0,
-       SNDRV_HWDEP_IFACE_OPL3,
-       SNDRV_HWDEP_IFACE_OPL4,
-       SNDRV_HWDEP_IFACE_SB16CSP,      /* Creative Signal Processor */
-       SNDRV_HWDEP_IFACE_EMU10K1,      /* FX8010 processor in EMU10K1 chip */
-       SNDRV_HWDEP_IFACE_YSS225,       /* Yamaha FX processor */
-       SNDRV_HWDEP_IFACE_ICS2115,      /* Wavetable synth */
-       SNDRV_HWDEP_IFACE_SSCAPE,       /* Ensoniq SoundScape ISA card (MC68EC000) */
-       SNDRV_HWDEP_IFACE_VX,           /* Digigram VX cards */
-       SNDRV_HWDEP_IFACE_MIXART,       /* Digigram miXart cards */
-       SNDRV_HWDEP_IFACE_USX2Y,        /* Tascam US122, US224 & US428 usb */
-       SNDRV_HWDEP_IFACE_EMUX_WAVETABLE, /* EmuX wavetable */  
-       SNDRV_HWDEP_IFACE_BLUETOOTH,    /* Bluetooth audio */
-       SNDRV_HWDEP_IFACE_USX2Y_PCM,    /* Tascam US122, US224 & US428 rawusb pcm */
-       SNDRV_HWDEP_IFACE_PCXHR,        /* Digigram PCXHR */
-       SNDRV_HWDEP_IFACE_SB_RC,        /* SB Extigy/Audigy2NX remote control */
-       SNDRV_HWDEP_IFACE_HDA,          /* HD-audio */
-       SNDRV_HWDEP_IFACE_USB_STREAM,   /* direct access to usb stream */
-
-       /* Don't forget to change the following: */
-       SNDRV_HWDEP_IFACE_LAST = SNDRV_HWDEP_IFACE_USB_STREAM
-};
-
-struct snd_hwdep_info {
-       unsigned int device;            /* WR: device number */
-       int card;                       /* R: card number */
-       unsigned char id[64];           /* ID (user selectable) */
-       unsigned char name[80];         /* hwdep name */
-       int iface;                      /* hwdep interface */
-       unsigned char reserved[64];     /* reserved for future */
-};
-
-/* generic DSP loader */
-struct snd_hwdep_dsp_status {
-       unsigned int version;           /* R: driver-specific version */
-       unsigned char id[32];           /* R: driver-specific ID string */
-       unsigned int num_dsps;          /* R: number of DSP images to transfer */
-       unsigned int dsp_loaded;        /* R: bit flags indicating the loaded DSPs */
-       unsigned int chip_ready;        /* R: 1 = initialization finished */
-       unsigned char reserved[16];     /* reserved for future use */
-};
-
-struct snd_hwdep_dsp_image {
-       unsigned int index;             /* W: DSP index */
-       unsigned char name[64];         /* W: ID (e.g. file name) */
-       unsigned char __user *image;    /* W: binary image */
-       size_t length;                  /* W: size of image in bytes */
-       unsigned long driver_data;      /* W: driver-specific data */
-};
-
-#define SNDRV_HWDEP_IOCTL_PVERSION     _IOR ('H', 0x00, int)
-#define SNDRV_HWDEP_IOCTL_INFO         _IOR ('H', 0x01, struct snd_hwdep_info)
-#define SNDRV_HWDEP_IOCTL_DSP_STATUS   _IOR('H', 0x02, struct snd_hwdep_dsp_status)
-#define SNDRV_HWDEP_IOCTL_DSP_LOAD     _IOW('H', 0x03, struct snd_hwdep_dsp_image)
-
-/*****************************************************************************
- *                                                                           *
- *             Digital Audio (PCM) interface - /dev/snd/pcm??                *
- *                                                                           *
- *****************************************************************************/
-
-#define SNDRV_PCM_VERSION              SNDRV_PROTOCOL_VERSION(2, 0, 10)
-
-typedef unsigned long snd_pcm_uframes_t;
-typedef signed long snd_pcm_sframes_t;
-
-enum {
-       SNDRV_PCM_CLASS_GENERIC = 0,    /* standard mono or stereo device */
-       SNDRV_PCM_CLASS_MULTI,          /* multichannel device */
-       SNDRV_PCM_CLASS_MODEM,          /* software modem class */
-       SNDRV_PCM_CLASS_DIGITIZER,      /* digitizer class */
-       /* Don't forget to change the following: */
-       SNDRV_PCM_CLASS_LAST = SNDRV_PCM_CLASS_DIGITIZER,
-};
-
-enum {
-       SNDRV_PCM_SUBCLASS_GENERIC_MIX = 0, /* mono or stereo subdevices are mixed together */
-       SNDRV_PCM_SUBCLASS_MULTI_MIX,   /* multichannel subdevices are mixed together */
-       /* Don't forget to change the following: */
-       SNDRV_PCM_SUBCLASS_LAST = SNDRV_PCM_SUBCLASS_MULTI_MIX,
-};
-
-enum {
-       SNDRV_PCM_STREAM_PLAYBACK = 0,
-       SNDRV_PCM_STREAM_CAPTURE,
-       SNDRV_PCM_STREAM_LAST = SNDRV_PCM_STREAM_CAPTURE,
-};
-
-typedef int __bitwise snd_pcm_access_t;
-#define        SNDRV_PCM_ACCESS_MMAP_INTERLEAVED       ((__force snd_pcm_access_t) 0) /* interleaved mmap */
-#define        SNDRV_PCM_ACCESS_MMAP_NONINTERLEAVED    ((__force snd_pcm_access_t) 1) /* noninterleaved mmap */
-#define        SNDRV_PCM_ACCESS_MMAP_COMPLEX           ((__force snd_pcm_access_t) 2) /* complex mmap */
-#define        SNDRV_PCM_ACCESS_RW_INTERLEAVED         ((__force snd_pcm_access_t) 3) /* readi/writei */
-#define        SNDRV_PCM_ACCESS_RW_NONINTERLEAVED      ((__force snd_pcm_access_t) 4) /* readn/writen */
-#define        SNDRV_PCM_ACCESS_LAST           SNDRV_PCM_ACCESS_RW_NONINTERLEAVED
-
-typedef int __bitwise snd_pcm_format_t;
-#define        SNDRV_PCM_FORMAT_S8     ((__force snd_pcm_format_t) 0)
-#define        SNDRV_PCM_FORMAT_U8     ((__force snd_pcm_format_t) 1)
-#define        SNDRV_PCM_FORMAT_S16_LE ((__force snd_pcm_format_t) 2)
-#define        SNDRV_PCM_FORMAT_S16_BE ((__force snd_pcm_format_t) 3)
-#define        SNDRV_PCM_FORMAT_U16_LE ((__force snd_pcm_format_t) 4)
-#define        SNDRV_PCM_FORMAT_U16_BE ((__force snd_pcm_format_t) 5)
-#define        SNDRV_PCM_FORMAT_S24_LE ((__force snd_pcm_format_t) 6) /* low three bytes */
-#define        SNDRV_PCM_FORMAT_S24_BE ((__force snd_pcm_format_t) 7) /* low three bytes */
-#define        SNDRV_PCM_FORMAT_U24_LE ((__force snd_pcm_format_t) 8) /* low three bytes */
-#define        SNDRV_PCM_FORMAT_U24_BE ((__force snd_pcm_format_t) 9) /* low three bytes */
-#define        SNDRV_PCM_FORMAT_S32_LE ((__force snd_pcm_format_t) 10)
-#define        SNDRV_PCM_FORMAT_S32_BE ((__force snd_pcm_format_t) 11)
-#define        SNDRV_PCM_FORMAT_U32_LE ((__force snd_pcm_format_t) 12)
-#define        SNDRV_PCM_FORMAT_U32_BE ((__force snd_pcm_format_t) 13)
-#define        SNDRV_PCM_FORMAT_FLOAT_LE       ((__force snd_pcm_format_t) 14) /* 4-byte float, IEEE-754 32-bit, range -1.0 to 1.0 */
-#define        SNDRV_PCM_FORMAT_FLOAT_BE       ((__force snd_pcm_format_t) 15) /* 4-byte float, IEEE-754 32-bit, range -1.0 to 1.0 */
-#define        SNDRV_PCM_FORMAT_FLOAT64_LE     ((__force snd_pcm_format_t) 16) /* 8-byte float, IEEE-754 64-bit, range -1.0 to 1.0 */
-#define        SNDRV_PCM_FORMAT_FLOAT64_BE     ((__force snd_pcm_format_t) 17) /* 8-byte float, IEEE-754 64-bit, range -1.0 to 1.0 */
-#define        SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE ((__force snd_pcm_format_t) 18) /* IEC-958 subframe, Little Endian */
-#define        SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE ((__force snd_pcm_format_t) 19) /* IEC-958 subframe, Big Endian */
-#define        SNDRV_PCM_FORMAT_MU_LAW         ((__force snd_pcm_format_t) 20)
-#define        SNDRV_PCM_FORMAT_A_LAW          ((__force snd_pcm_format_t) 21)
-#define        SNDRV_PCM_FORMAT_IMA_ADPCM      ((__force snd_pcm_format_t) 22)
-#define        SNDRV_PCM_FORMAT_MPEG           ((__force snd_pcm_format_t) 23)
-#define        SNDRV_PCM_FORMAT_GSM            ((__force snd_pcm_format_t) 24)
-#define        SNDRV_PCM_FORMAT_SPECIAL        ((__force snd_pcm_format_t) 31)
-#define        SNDRV_PCM_FORMAT_S24_3LE        ((__force snd_pcm_format_t) 32) /* in three bytes */
-#define        SNDRV_PCM_FORMAT_S24_3BE        ((__force snd_pcm_format_t) 33) /* in three bytes */
-#define        SNDRV_PCM_FORMAT_U24_3LE        ((__force snd_pcm_format_t) 34) /* in three bytes */
-#define        SNDRV_PCM_FORMAT_U24_3BE        ((__force snd_pcm_format_t) 35) /* in three bytes */
-#define        SNDRV_PCM_FORMAT_S20_3LE        ((__force snd_pcm_format_t) 36) /* in three bytes */
-#define        SNDRV_PCM_FORMAT_S20_3BE        ((__force snd_pcm_format_t) 37) /* in three bytes */
-#define        SNDRV_PCM_FORMAT_U20_3LE        ((__force snd_pcm_format_t) 38) /* in three bytes */
-#define        SNDRV_PCM_FORMAT_U20_3BE        ((__force snd_pcm_format_t) 39) /* in three bytes */
-#define        SNDRV_PCM_FORMAT_S18_3LE        ((__force snd_pcm_format_t) 40) /* in three bytes */
-#define        SNDRV_PCM_FORMAT_S18_3BE        ((__force snd_pcm_format_t) 41) /* in three bytes */
-#define        SNDRV_PCM_FORMAT_U18_3LE        ((__force snd_pcm_format_t) 42) /* in three bytes */
-#define        SNDRV_PCM_FORMAT_U18_3BE        ((__force snd_pcm_format_t) 43) /* in three bytes */
-#define        SNDRV_PCM_FORMAT_G723_24        ((__force snd_pcm_format_t) 44) /* 8 samples in 3 bytes */
-#define        SNDRV_PCM_FORMAT_G723_24_1B     ((__force snd_pcm_format_t) 45) /* 1 sample in 1 byte */
-#define        SNDRV_PCM_FORMAT_G723_40        ((__force snd_pcm_format_t) 46) /* 8 Samples in 5 bytes */
-#define        SNDRV_PCM_FORMAT_G723_40_1B     ((__force snd_pcm_format_t) 47) /* 1 sample in 1 byte */
-#define        SNDRV_PCM_FORMAT_LAST           SNDRV_PCM_FORMAT_G723_40_1B
-
-#ifdef SNDRV_LITTLE_ENDIAN
-#define        SNDRV_PCM_FORMAT_S16            SNDRV_PCM_FORMAT_S16_LE
-#define        SNDRV_PCM_FORMAT_U16            SNDRV_PCM_FORMAT_U16_LE
-#define        SNDRV_PCM_FORMAT_S24            SNDRV_PCM_FORMAT_S24_LE
-#define        SNDRV_PCM_FORMAT_U24            SNDRV_PCM_FORMAT_U24_LE
-#define        SNDRV_PCM_FORMAT_S32            SNDRV_PCM_FORMAT_S32_LE
-#define        SNDRV_PCM_FORMAT_U32            SNDRV_PCM_FORMAT_U32_LE
-#define        SNDRV_PCM_FORMAT_FLOAT          SNDRV_PCM_FORMAT_FLOAT_LE
-#define        SNDRV_PCM_FORMAT_FLOAT64        SNDRV_PCM_FORMAT_FLOAT64_LE
-#define        SNDRV_PCM_FORMAT_IEC958_SUBFRAME SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE
-#endif
-#ifdef SNDRV_BIG_ENDIAN
-#define        SNDRV_PCM_FORMAT_S16            SNDRV_PCM_FORMAT_S16_BE
-#define        SNDRV_PCM_FORMAT_U16            SNDRV_PCM_FORMAT_U16_BE
-#define        SNDRV_PCM_FORMAT_S24            SNDRV_PCM_FORMAT_S24_BE
-#define        SNDRV_PCM_FORMAT_U24            SNDRV_PCM_FORMAT_U24_BE
-#define        SNDRV_PCM_FORMAT_S32            SNDRV_PCM_FORMAT_S32_BE
-#define        SNDRV_PCM_FORMAT_U32            SNDRV_PCM_FORMAT_U32_BE
-#define        SNDRV_PCM_FORMAT_FLOAT          SNDRV_PCM_FORMAT_FLOAT_BE
-#define        SNDRV_PCM_FORMAT_FLOAT64        SNDRV_PCM_FORMAT_FLOAT64_BE
-#define        SNDRV_PCM_FORMAT_IEC958_SUBFRAME SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE
-#endif
-
-typedef int __bitwise snd_pcm_subformat_t;
-#define        SNDRV_PCM_SUBFORMAT_STD         ((__force snd_pcm_subformat_t) 0)
-#define        SNDRV_PCM_SUBFORMAT_LAST        SNDRV_PCM_SUBFORMAT_STD
-
-#define SNDRV_PCM_INFO_MMAP            0x00000001      /* hardware supports mmap */
-#define SNDRV_PCM_INFO_MMAP_VALID      0x00000002      /* period data are valid during transfer */
-#define SNDRV_PCM_INFO_DOUBLE          0x00000004      /* Double buffering needed for PCM start/stop */
-#define SNDRV_PCM_INFO_BATCH           0x00000010      /* double buffering */
-#define SNDRV_PCM_INFO_INTERLEAVED     0x00000100      /* channels are interleaved */
-#define SNDRV_PCM_INFO_NONINTERLEAVED  0x00000200      /* channels are not interleaved */
-#define SNDRV_PCM_INFO_COMPLEX         0x00000400      /* complex frame organization (mmap only) */
-#define SNDRV_PCM_INFO_BLOCK_TRANSFER  0x00010000      /* hardware transfer block of samples */
-#define SNDRV_PCM_INFO_OVERRANGE       0x00020000      /* hardware supports ADC (capture) overrange detection */
-#define SNDRV_PCM_INFO_RESUME          0x00040000      /* hardware supports stream resume after suspend */
-#define SNDRV_PCM_INFO_PAUSE           0x00080000      /* pause ioctl is supported */
-#define SNDRV_PCM_INFO_HALF_DUPLEX     0x00100000      /* only half duplex */
-#define SNDRV_PCM_INFO_JOINT_DUPLEX    0x00200000      /* playback and capture stream are somewhat correlated */
-#define SNDRV_PCM_INFO_SYNC_START      0x00400000      /* pcm support some kind of sync go */
-#define SNDRV_PCM_INFO_NO_PERIOD_WAKEUP        0x00800000      /* period wakeup can be disabled */
-#define SNDRV_PCM_INFO_FIFO_IN_FRAMES  0x80000000      /* internal kernel flag - FIFO size is in frames */
-
-typedef int __bitwise snd_pcm_state_t;
-#define        SNDRV_PCM_STATE_OPEN            ((__force snd_pcm_state_t) 0) /* stream is open */
-#define        SNDRV_PCM_STATE_SETUP           ((__force snd_pcm_state_t) 1) /* stream has a setup */
-#define        SNDRV_PCM_STATE_PREPARED        ((__force snd_pcm_state_t) 2) /* stream is ready to start */
-#define        SNDRV_PCM_STATE_RUNNING         ((__force snd_pcm_state_t) 3) /* stream is running */
-#define        SNDRV_PCM_STATE_XRUN            ((__force snd_pcm_state_t) 4) /* stream reached an xrun */
-#define        SNDRV_PCM_STATE_DRAINING        ((__force snd_pcm_state_t) 5) /* stream is draining */
-#define        SNDRV_PCM_STATE_PAUSED          ((__force snd_pcm_state_t) 6) /* stream is paused */
-#define        SNDRV_PCM_STATE_SUSPENDED       ((__force snd_pcm_state_t) 7) /* hardware is suspended */
-#define        SNDRV_PCM_STATE_DISCONNECTED    ((__force snd_pcm_state_t) 8) /* hardware is disconnected */
-#define        SNDRV_PCM_STATE_LAST            SNDRV_PCM_STATE_DISCONNECTED
-
-enum {
-       SNDRV_PCM_MMAP_OFFSET_DATA = 0x00000000,
-       SNDRV_PCM_MMAP_OFFSET_STATUS = 0x80000000,
-       SNDRV_PCM_MMAP_OFFSET_CONTROL = 0x81000000,
-};
-
-union snd_pcm_sync_id {
-       unsigned char id[16];
-       unsigned short id16[8];
-       unsigned int id32[4];
-};
-
-struct snd_pcm_info {
-       unsigned int device;            /* RO/WR (control): device number */
-       unsigned int subdevice;         /* RO/WR (control): subdevice number */
-       int stream;                     /* RO/WR (control): stream direction */
-       int card;                       /* R: card number */
-       unsigned char id[64];           /* ID (user selectable) */
-       unsigned char name[80];         /* name of this device */
-       unsigned char subname[32];      /* subdevice name */
-       int dev_class;                  /* SNDRV_PCM_CLASS_* */
-       int dev_subclass;               /* SNDRV_PCM_SUBCLASS_* */
-       unsigned int subdevices_count;
-       unsigned int subdevices_avail;
-       union snd_pcm_sync_id sync;     /* hardware synchronization ID */
-       unsigned char reserved[64];     /* reserved for future... */
-};
-
-typedef int snd_pcm_hw_param_t;
-#define        SNDRV_PCM_HW_PARAM_ACCESS       0       /* Access type */
-#define        SNDRV_PCM_HW_PARAM_FORMAT       1       /* Format */
-#define        SNDRV_PCM_HW_PARAM_SUBFORMAT    2       /* Subformat */
-#define        SNDRV_PCM_HW_PARAM_FIRST_MASK   SNDRV_PCM_HW_PARAM_ACCESS
-#define        SNDRV_PCM_HW_PARAM_LAST_MASK    SNDRV_PCM_HW_PARAM_SUBFORMAT
-
-#define        SNDRV_PCM_HW_PARAM_SAMPLE_BITS  8       /* Bits per sample */
-#define        SNDRV_PCM_HW_PARAM_FRAME_BITS   9       /* Bits per frame */
-#define        SNDRV_PCM_HW_PARAM_CHANNELS     10      /* Channels */
-#define        SNDRV_PCM_HW_PARAM_RATE         11      /* Approx rate */
-#define        SNDRV_PCM_HW_PARAM_PERIOD_TIME  12      /* Approx distance between
-                                                * interrupts in us
-                                                */
-#define        SNDRV_PCM_HW_PARAM_PERIOD_SIZE  13      /* Approx frames between
-                                                * interrupts
-                                                */
-#define        SNDRV_PCM_HW_PARAM_PERIOD_BYTES 14      /* Approx bytes between
-                                                * interrupts
-                                                */
-#define        SNDRV_PCM_HW_PARAM_PERIODS      15      /* Approx interrupts per
-                                                * buffer
-                                                */
-#define        SNDRV_PCM_HW_PARAM_BUFFER_TIME  16      /* Approx duration of buffer
-                                                * in us
-                                                */
-#define        SNDRV_PCM_HW_PARAM_BUFFER_SIZE  17      /* Size of buffer in frames */
-#define        SNDRV_PCM_HW_PARAM_BUFFER_BYTES 18      /* Size of buffer in bytes */
-#define        SNDRV_PCM_HW_PARAM_TICK_TIME    19      /* Approx tick duration in us */
-#define        SNDRV_PCM_HW_PARAM_FIRST_INTERVAL       SNDRV_PCM_HW_PARAM_SAMPLE_BITS
-#define        SNDRV_PCM_HW_PARAM_LAST_INTERVAL        SNDRV_PCM_HW_PARAM_TICK_TIME
-
-#define SNDRV_PCM_HW_PARAMS_NORESAMPLE (1<<0)  /* avoid rate resampling */
-#define SNDRV_PCM_HW_PARAMS_EXPORT_BUFFER      (1<<1)  /* export buffer */
-#define SNDRV_PCM_HW_PARAMS_NO_PERIOD_WAKEUP   (1<<2)  /* disable period wakeups */
-
-struct snd_interval {
-       unsigned int min, max;
-       unsigned int openmin:1,
-                    openmax:1,
-                    integer:1,
-                    empty:1;
-};
-
-#define SNDRV_MASK_MAX 256
-
-struct snd_mask {
-       __u32 bits[(SNDRV_MASK_MAX+31)/32];
-};
-
-struct snd_pcm_hw_params {
-       unsigned int flags;
-       struct snd_mask masks[SNDRV_PCM_HW_PARAM_LAST_MASK - 
-                              SNDRV_PCM_HW_PARAM_FIRST_MASK + 1];
-       struct snd_mask mres[5];        /* reserved masks */
-       struct snd_interval intervals[SNDRV_PCM_HW_PARAM_LAST_INTERVAL -
-                                       SNDRV_PCM_HW_PARAM_FIRST_INTERVAL + 1];
-       struct snd_interval ires[9];    /* reserved intervals */
-       unsigned int rmask;             /* W: requested masks */
-       unsigned int cmask;             /* R: changed masks */
-       unsigned int info;              /* R: Info flags for returned setup */
-       unsigned int msbits;            /* R: used most significant bits */
-       unsigned int rate_num;          /* R: rate numerator */
-       unsigned int rate_den;          /* R: rate denominator */
-       snd_pcm_uframes_t fifo_size;    /* R: chip FIFO size in frames */
-       unsigned char reserved[64];     /* reserved for future */
-};
-
-enum {
-       SNDRV_PCM_TSTAMP_NONE = 0,
-       SNDRV_PCM_TSTAMP_ENABLE,
-       SNDRV_PCM_TSTAMP_LAST = SNDRV_PCM_TSTAMP_ENABLE,
-};
-
-struct snd_pcm_sw_params {
-       int tstamp_mode;                        /* timestamp mode */
-       unsigned int period_step;
-       unsigned int sleep_min;                 /* min ticks to sleep */
-       snd_pcm_uframes_t avail_min;            /* min avail frames for wakeup */
-       snd_pcm_uframes_t xfer_align;           /* obsolete: xfer size need to be a multiple */
-       snd_pcm_uframes_t start_threshold;      /* min hw_avail frames for automatic start */
-       snd_pcm_uframes_t stop_threshold;       /* min avail frames for automatic stop */
-       snd_pcm_uframes_t silence_threshold;    /* min distance from noise for silence filling */
-       snd_pcm_uframes_t silence_size;         /* silence block size */
-       snd_pcm_uframes_t boundary;             /* pointers wrap point */
-       unsigned char reserved[64];             /* reserved for future */
-};
-
-struct snd_pcm_channel_info {
-       unsigned int channel;
-       __kernel_off_t offset;          /* mmap offset */
-       unsigned int first;             /* offset to first sample in bits */
-       unsigned int step;              /* samples distance in bits */
-};
-
-struct snd_pcm_status {
-       snd_pcm_state_t state;          /* stream state */
-       struct timespec trigger_tstamp; /* time when stream was started/stopped/paused */
-       struct timespec tstamp;         /* reference timestamp */
-       snd_pcm_uframes_t appl_ptr;     /* appl ptr */
-       snd_pcm_uframes_t hw_ptr;       /* hw ptr */
-       snd_pcm_sframes_t delay;        /* current delay in frames */
-       snd_pcm_uframes_t avail;        /* number of frames available */
-       snd_pcm_uframes_t avail_max;    /* max frames available on hw since last status */
-       snd_pcm_uframes_t overrange;    /* count of ADC (capture) overrange detections from last status */
-       snd_pcm_state_t suspended_state; /* suspended stream state */
-       unsigned char reserved[60];     /* must be filled with zero */
-};
-
-struct snd_pcm_mmap_status {
-       snd_pcm_state_t state;          /* RO: state - SNDRV_PCM_STATE_XXXX */
-       int pad1;                       /* Needed for 64 bit alignment */
-       snd_pcm_uframes_t hw_ptr;       /* RO: hw ptr (0...boundary-1) */
-       struct timespec tstamp;         /* Timestamp */
-       snd_pcm_state_t suspended_state; /* RO: suspended stream state */
-};
-
-struct snd_pcm_mmap_control {
-       snd_pcm_uframes_t appl_ptr;     /* RW: appl ptr (0...boundary-1) */
-       snd_pcm_uframes_t avail_min;    /* RW: min available frames for wakeup */
-};
-
-#define SNDRV_PCM_SYNC_PTR_HWSYNC      (1<<0)  /* execute hwsync */
-#define SNDRV_PCM_SYNC_PTR_APPL                (1<<1)  /* get appl_ptr from driver (r/w op) */
-#define SNDRV_PCM_SYNC_PTR_AVAIL_MIN   (1<<2)  /* get avail_min from driver */
-
-struct snd_pcm_sync_ptr {
-       unsigned int flags;
-       union {
-               struct snd_pcm_mmap_status status;
-               unsigned char reserved[64];
-       } s;
-       union {
-               struct snd_pcm_mmap_control control;
-               unsigned char reserved[64];
-       } c;
-};
-
-struct snd_xferi {
-       snd_pcm_sframes_t result;
-       void __user *buf;
-       snd_pcm_uframes_t frames;
-};
-
-struct snd_xfern {
-       snd_pcm_sframes_t result;
-       void __user * __user *bufs;
-       snd_pcm_uframes_t frames;
-};
-
-enum {
-       SNDRV_PCM_TSTAMP_TYPE_GETTIMEOFDAY = 0, /* gettimeofday equivalent */
-       SNDRV_PCM_TSTAMP_TYPE_MONOTONIC,        /* posix_clock_monotonic equivalent */
-       SNDRV_PCM_TSTAMP_TYPE_LAST = SNDRV_PCM_TSTAMP_TYPE_MONOTONIC,
-};
-
-/* channel positions */
-enum {
-       SNDRV_CHMAP_UNKNOWN = 0,
-       SNDRV_CHMAP_NA,         /* N/A, silent */
-       SNDRV_CHMAP_MONO,       /* mono stream */
-       /* this follows the alsa-lib mixer channel value + 3 */
-       SNDRV_CHMAP_FL,         /* front left */
-       SNDRV_CHMAP_FR,         /* front right */
-       SNDRV_CHMAP_RL,         /* rear left */
-       SNDRV_CHMAP_RR,         /* rear right */
-       SNDRV_CHMAP_FC,         /* front center */
-       SNDRV_CHMAP_LFE,        /* LFE */
-       SNDRV_CHMAP_SL,         /* side left */
-       SNDRV_CHMAP_SR,         /* side right */
-       SNDRV_CHMAP_RC,         /* rear center */
-       /* new definitions */
-       SNDRV_CHMAP_FLC,        /* front left center */
-       SNDRV_CHMAP_FRC,        /* front right center */
-       SNDRV_CHMAP_RLC,        /* rear left center */
-       SNDRV_CHMAP_RRC,        /* rear right center */
-       SNDRV_CHMAP_FLW,        /* front left wide */
-       SNDRV_CHMAP_FRW,        /* front right wide */
-       SNDRV_CHMAP_FLH,        /* front left high */
-       SNDRV_CHMAP_FCH,        /* front center high */
-       SNDRV_CHMAP_FRH,        /* front right high */
-       SNDRV_CHMAP_TC,         /* top center */
-       SNDRV_CHMAP_TFL,        /* top front left */
-       SNDRV_CHMAP_TFR,        /* top front right */
-       SNDRV_CHMAP_TFC,        /* top front center */
-       SNDRV_CHMAP_TRL,        /* top rear left */
-       SNDRV_CHMAP_TRR,        /* top rear right */
-       SNDRV_CHMAP_TRC,        /* top rear center */
-       SNDRV_CHMAP_LAST = SNDRV_CHMAP_TRC,
-};
-
-#define SNDRV_CHMAP_POSITION_MASK      0xffff
-#define SNDRV_CHMAP_PHASE_INVERSE      (0x01 << 16)
-#define SNDRV_CHMAP_DRIVER_SPEC                (0x02 << 16)
-
-#define SNDRV_PCM_IOCTL_PVERSION       _IOR('A', 0x00, int)
-#define SNDRV_PCM_IOCTL_INFO           _IOR('A', 0x01, struct snd_pcm_info)
-#define SNDRV_PCM_IOCTL_TSTAMP         _IOW('A', 0x02, int)
-#define SNDRV_PCM_IOCTL_TTSTAMP                _IOW('A', 0x03, int)
-#define SNDRV_PCM_IOCTL_HW_REFINE      _IOWR('A', 0x10, struct snd_pcm_hw_params)
-#define SNDRV_PCM_IOCTL_HW_PARAMS      _IOWR('A', 0x11, struct snd_pcm_hw_params)
-#define SNDRV_PCM_IOCTL_HW_FREE                _IO('A', 0x12)
-#define SNDRV_PCM_IOCTL_SW_PARAMS      _IOWR('A', 0x13, struct snd_pcm_sw_params)
-#define SNDRV_PCM_IOCTL_STATUS         _IOR('A', 0x20, struct snd_pcm_status)
-#define SNDRV_PCM_IOCTL_DELAY          _IOR('A', 0x21, snd_pcm_sframes_t)
-#define SNDRV_PCM_IOCTL_HWSYNC         _IO('A', 0x22)
-#define SNDRV_PCM_IOCTL_SYNC_PTR       _IOWR('A', 0x23, struct snd_pcm_sync_ptr)
-#define SNDRV_PCM_IOCTL_CHANNEL_INFO   _IOR('A', 0x32, struct snd_pcm_channel_info)
-#define SNDRV_PCM_IOCTL_PREPARE                _IO('A', 0x40)
-#define SNDRV_PCM_IOCTL_RESET          _IO('A', 0x41)
-#define SNDRV_PCM_IOCTL_START          _IO('A', 0x42)
-#define SNDRV_PCM_IOCTL_DROP           _IO('A', 0x43)
-#define SNDRV_PCM_IOCTL_DRAIN          _IO('A', 0x44)
-#define SNDRV_PCM_IOCTL_PAUSE          _IOW('A', 0x45, int)
-#define SNDRV_PCM_IOCTL_REWIND         _IOW('A', 0x46, snd_pcm_uframes_t)
-#define SNDRV_PCM_IOCTL_RESUME         _IO('A', 0x47)
-#define SNDRV_PCM_IOCTL_XRUN           _IO('A', 0x48)
-#define SNDRV_PCM_IOCTL_FORWARD                _IOW('A', 0x49, snd_pcm_uframes_t)
-#define SNDRV_PCM_IOCTL_WRITEI_FRAMES  _IOW('A', 0x50, struct snd_xferi)
-#define SNDRV_PCM_IOCTL_READI_FRAMES   _IOR('A', 0x51, struct snd_xferi)
-#define SNDRV_PCM_IOCTL_WRITEN_FRAMES  _IOW('A', 0x52, struct snd_xfern)
-#define SNDRV_PCM_IOCTL_READN_FRAMES   _IOR('A', 0x53, struct snd_xfern)
-#define SNDRV_PCM_IOCTL_LINK           _IOW('A', 0x60, int)
-#define SNDRV_PCM_IOCTL_UNLINK         _IO('A', 0x61)
-
-/*****************************************************************************
- *                                                                           *
- *                            MIDI v1.0 interface                            *
- *                                                                           *
- *****************************************************************************/
-
-/*
- *  Raw MIDI section - /dev/snd/midi??
- */
-
-#define SNDRV_RAWMIDI_VERSION          SNDRV_PROTOCOL_VERSION(2, 0, 0)
-
-enum {
-       SNDRV_RAWMIDI_STREAM_OUTPUT = 0,
-       SNDRV_RAWMIDI_STREAM_INPUT,
-       SNDRV_RAWMIDI_STREAM_LAST = SNDRV_RAWMIDI_STREAM_INPUT,
-};
-
-#define SNDRV_RAWMIDI_INFO_OUTPUT              0x00000001
-#define SNDRV_RAWMIDI_INFO_INPUT               0x00000002
-#define SNDRV_RAWMIDI_INFO_DUPLEX              0x00000004
-
-struct snd_rawmidi_info {
-       unsigned int device;            /* RO/WR (control): device number */
-       unsigned int subdevice;         /* RO/WR (control): subdevice number */
-       int stream;                     /* WR: stream */
-       int card;                       /* R: card number */
-       unsigned int flags;             /* SNDRV_RAWMIDI_INFO_XXXX */
-       unsigned char id[64];           /* ID (user selectable) */
-       unsigned char name[80];         /* name of device */
-       unsigned char subname[32];      /* name of active or selected subdevice */
-       unsigned int subdevices_count;
-       unsigned int subdevices_avail;
-       unsigned char reserved[64];     /* reserved for future use */
-};
-
-struct snd_rawmidi_params {
-       int stream;
-       size_t buffer_size;             /* queue size in bytes */
-       size_t avail_min;               /* minimum avail bytes for wakeup */
-       unsigned int no_active_sensing: 1; /* do not send active sensing byte in close() */
-       unsigned char reserved[16];     /* reserved for future use */
-};
-
-struct snd_rawmidi_status {
-       int stream;
-       struct timespec tstamp;         /* Timestamp */
-       size_t avail;                   /* available bytes */
-       size_t xruns;                   /* count of overruns since last status (in bytes) */
-       unsigned char reserved[16];     /* reserved for future use */
-};
-
-#define SNDRV_RAWMIDI_IOCTL_PVERSION   _IOR('W', 0x00, int)
-#define SNDRV_RAWMIDI_IOCTL_INFO       _IOR('W', 0x01, struct snd_rawmidi_info)
-#define SNDRV_RAWMIDI_IOCTL_PARAMS     _IOWR('W', 0x10, struct snd_rawmidi_params)
-#define SNDRV_RAWMIDI_IOCTL_STATUS     _IOWR('W', 0x20, struct snd_rawmidi_status)
-#define SNDRV_RAWMIDI_IOCTL_DROP       _IOW('W', 0x30, int)
-#define SNDRV_RAWMIDI_IOCTL_DRAIN      _IOW('W', 0x31, int)
-
-/*
- *  Timer section - /dev/snd/timer
- */
-
-#define SNDRV_TIMER_VERSION            SNDRV_PROTOCOL_VERSION(2, 0, 6)
-
-enum {
-       SNDRV_TIMER_CLASS_NONE = -1,
-       SNDRV_TIMER_CLASS_SLAVE = 0,
-       SNDRV_TIMER_CLASS_GLOBAL,
-       SNDRV_TIMER_CLASS_CARD,
-       SNDRV_TIMER_CLASS_PCM,
-       SNDRV_TIMER_CLASS_LAST = SNDRV_TIMER_CLASS_PCM,
-};
-
-/* slave timer classes */
-enum {
-       SNDRV_TIMER_SCLASS_NONE = 0,
-       SNDRV_TIMER_SCLASS_APPLICATION,
-       SNDRV_TIMER_SCLASS_SEQUENCER,           /* alias */
-       SNDRV_TIMER_SCLASS_OSS_SEQUENCER,       /* alias */
-       SNDRV_TIMER_SCLASS_LAST = SNDRV_TIMER_SCLASS_OSS_SEQUENCER,
-};
-
-/* global timers (device member) */
-#define SNDRV_TIMER_GLOBAL_SYSTEM      0
-#define SNDRV_TIMER_GLOBAL_RTC         1
-#define SNDRV_TIMER_GLOBAL_HPET                2
-#define SNDRV_TIMER_GLOBAL_HRTIMER     3
-
-/* info flags */
-#define SNDRV_TIMER_FLG_SLAVE          (1<<0)  /* cannot be controlled */
-
-struct snd_timer_id {
-       int dev_class;
-       int dev_sclass;
-       int card;
-       int device;
-       int subdevice;
-};
-
-struct snd_timer_ginfo {
-       struct snd_timer_id tid;        /* requested timer ID */
-       unsigned int flags;             /* timer flags - SNDRV_TIMER_FLG_* */
-       int card;                       /* card number */
-       unsigned char id[64];           /* timer identification */
-       unsigned char name[80];         /* timer name */
-       unsigned long reserved0;        /* reserved for future use */
-       unsigned long resolution;       /* average period resolution in ns */
-       unsigned long resolution_min;   /* minimal period resolution in ns */
-       unsigned long resolution_max;   /* maximal period resolution in ns */
-       unsigned int clients;           /* active timer clients */
-       unsigned char reserved[32];
-};
-
-struct snd_timer_gparams {
-       struct snd_timer_id tid;        /* requested timer ID */
-       unsigned long period_num;       /* requested precise period duration (in seconds) - numerator */
-       unsigned long period_den;       /* requested precise period duration (in seconds) - denominator */
-       unsigned char reserved[32];
-};
-
-struct snd_timer_gstatus {
-       struct snd_timer_id tid;        /* requested timer ID */
-       unsigned long resolution;       /* current period resolution in ns */
-       unsigned long resolution_num;   /* precise current period resolution (in seconds) - numerator */
-       unsigned long resolution_den;   /* precise current period resolution (in seconds) - denominator */
-       unsigned char reserved[32];
-};
-
-struct snd_timer_select {
-       struct snd_timer_id id; /* bind to timer ID */
-       unsigned char reserved[32];     /* reserved */
-};
-
-struct snd_timer_info {
-       unsigned int flags;             /* timer flags - SNDRV_TIMER_FLG_* */
-       int card;                       /* card number */
-       unsigned char id[64];           /* timer identificator */
-       unsigned char name[80];         /* timer name */
-       unsigned long reserved0;        /* reserved for future use */
-       unsigned long resolution;       /* average period resolution in ns */
-       unsigned char reserved[64];     /* reserved */
-};
-
-#define SNDRV_TIMER_PSFLG_AUTO         (1<<0)  /* auto start, otherwise one-shot */
-#define SNDRV_TIMER_PSFLG_EXCLUSIVE    (1<<1)  /* exclusive use, precise start/stop/pause/continue */
-#define SNDRV_TIMER_PSFLG_EARLY_EVENT  (1<<2)  /* write early event to the poll queue */
-
-struct snd_timer_params {
-       unsigned int flags;             /* flags - SNDRV_MIXER_PSFLG_* */
-       unsigned int ticks;             /* requested resolution in ticks */
-       unsigned int queue_size;        /* total size of queue (32-1024) */
-       unsigned int reserved0;         /* reserved, was: failure locations */
-       unsigned int filter;            /* event filter (bitmask of SNDRV_TIMER_EVENT_*) */
-       unsigned char reserved[60];     /* reserved */
-};
-
-struct snd_timer_status {
-       struct timespec tstamp;         /* Timestamp - last update */
-       unsigned int resolution;        /* current period resolution in ns */
-       unsigned int lost;              /* counter of master tick lost */
-       unsigned int overrun;           /* count of read queue overruns */
-       unsigned int queue;             /* used queue size */
-       unsigned char reserved[64];     /* reserved */
-};
-
-#define SNDRV_TIMER_IOCTL_PVERSION     _IOR('T', 0x00, int)
-#define SNDRV_TIMER_IOCTL_NEXT_DEVICE  _IOWR('T', 0x01, struct snd_timer_id)
-#define SNDRV_TIMER_IOCTL_TREAD                _IOW('T', 0x02, int)
-#define SNDRV_TIMER_IOCTL_GINFO                _IOWR('T', 0x03, struct snd_timer_ginfo)
-#define SNDRV_TIMER_IOCTL_GPARAMS      _IOW('T', 0x04, struct snd_timer_gparams)
-#define SNDRV_TIMER_IOCTL_GSTATUS      _IOWR('T', 0x05, struct snd_timer_gstatus)
-#define SNDRV_TIMER_IOCTL_SELECT       _IOW('T', 0x10, struct snd_timer_select)
-#define SNDRV_TIMER_IOCTL_INFO         _IOR('T', 0x11, struct snd_timer_info)
-#define SNDRV_TIMER_IOCTL_PARAMS       _IOW('T', 0x12, struct snd_timer_params)
-#define SNDRV_TIMER_IOCTL_STATUS       _IOR('T', 0x14, struct snd_timer_status)
-/* The following four ioctls are changed since 1.0.9 due to confliction */
-#define SNDRV_TIMER_IOCTL_START                _IO('T', 0xa0)
-#define SNDRV_TIMER_IOCTL_STOP         _IO('T', 0xa1)
-#define SNDRV_TIMER_IOCTL_CONTINUE     _IO('T', 0xa2)
-#define SNDRV_TIMER_IOCTL_PAUSE                _IO('T', 0xa3)
-
-struct snd_timer_read {
-       unsigned int resolution;
-       unsigned int ticks;
-};
-
-enum {
-       SNDRV_TIMER_EVENT_RESOLUTION = 0,       /* val = resolution in ns */
-       SNDRV_TIMER_EVENT_TICK,                 /* val = ticks */
-       SNDRV_TIMER_EVENT_START,                /* val = resolution in ns */
-       SNDRV_TIMER_EVENT_STOP,                 /* val = 0 */
-       SNDRV_TIMER_EVENT_CONTINUE,             /* val = resolution in ns */
-       SNDRV_TIMER_EVENT_PAUSE,                /* val = 0 */
-       SNDRV_TIMER_EVENT_EARLY,                /* val = 0, early event */
-       SNDRV_TIMER_EVENT_SUSPEND,              /* val = 0 */
-       SNDRV_TIMER_EVENT_RESUME,               /* val = resolution in ns */
-       /* master timer events for slave timer instances */
-       SNDRV_TIMER_EVENT_MSTART = SNDRV_TIMER_EVENT_START + 10,
-       SNDRV_TIMER_EVENT_MSTOP = SNDRV_TIMER_EVENT_STOP + 10,
-       SNDRV_TIMER_EVENT_MCONTINUE = SNDRV_TIMER_EVENT_CONTINUE + 10,
-       SNDRV_TIMER_EVENT_MPAUSE = SNDRV_TIMER_EVENT_PAUSE + 10,
-       SNDRV_TIMER_EVENT_MSUSPEND = SNDRV_TIMER_EVENT_SUSPEND + 10,
-       SNDRV_TIMER_EVENT_MRESUME = SNDRV_TIMER_EVENT_RESUME + 10,
-};
-
-struct snd_timer_tread {
-       int event;
-       struct timespec tstamp;
-       unsigned int val;
-};
-
-/****************************************************************************
- *                                                                          *
- *        Section for driver control interface - /dev/snd/control?          *
- *                                                                          *
- ****************************************************************************/
-
-#define SNDRV_CTL_VERSION              SNDRV_PROTOCOL_VERSION(2, 0, 7)
-
-struct snd_ctl_card_info {
-       int card;                       /* card number */
-       int pad;                        /* reserved for future (was type) */
-       unsigned char id[16];           /* ID of card (user selectable) */
-       unsigned char driver[16];       /* Driver name */
-       unsigned char name[32];         /* Short name of soundcard */
-       unsigned char longname[80];     /* name + info text about soundcard */
-       unsigned char reserved_[16];    /* reserved for future (was ID of mixer) */
-       unsigned char mixername[80];    /* visual mixer identification */
-       unsigned char components[128];  /* card components / fine identification, delimited with one space (AC97 etc..) */
-};
-
-typedef int __bitwise snd_ctl_elem_type_t;
-#define        SNDRV_CTL_ELEM_TYPE_NONE        ((__force snd_ctl_elem_type_t) 0) /* invalid */
-#define        SNDRV_CTL_ELEM_TYPE_BOOLEAN     ((__force snd_ctl_elem_type_t) 1) /* boolean type */
-#define        SNDRV_CTL_ELEM_TYPE_INTEGER     ((__force snd_ctl_elem_type_t) 2) /* integer type */
-#define        SNDRV_CTL_ELEM_TYPE_ENUMERATED  ((__force snd_ctl_elem_type_t) 3) /* enumerated type */
-#define        SNDRV_CTL_ELEM_TYPE_BYTES       ((__force snd_ctl_elem_type_t) 4) /* byte array */
-#define        SNDRV_CTL_ELEM_TYPE_IEC958      ((__force snd_ctl_elem_type_t) 5) /* IEC958 (S/PDIF) setup */
-#define        SNDRV_CTL_ELEM_TYPE_INTEGER64   ((__force snd_ctl_elem_type_t) 6) /* 64-bit integer type */
-#define        SNDRV_CTL_ELEM_TYPE_LAST        SNDRV_CTL_ELEM_TYPE_INTEGER64
-
-typedef int __bitwise snd_ctl_elem_iface_t;
-#define        SNDRV_CTL_ELEM_IFACE_CARD       ((__force snd_ctl_elem_iface_t) 0) /* global control */
-#define        SNDRV_CTL_ELEM_IFACE_HWDEP      ((__force snd_ctl_elem_iface_t) 1) /* hardware dependent device */
-#define        SNDRV_CTL_ELEM_IFACE_MIXER      ((__force snd_ctl_elem_iface_t) 2) /* virtual mixer device */
-#define        SNDRV_CTL_ELEM_IFACE_PCM        ((__force snd_ctl_elem_iface_t) 3) /* PCM device */
-#define        SNDRV_CTL_ELEM_IFACE_RAWMIDI    ((__force snd_ctl_elem_iface_t) 4) /* RawMidi device */
-#define        SNDRV_CTL_ELEM_IFACE_TIMER      ((__force snd_ctl_elem_iface_t) 5) /* timer device */
-#define        SNDRV_CTL_ELEM_IFACE_SEQUENCER  ((__force snd_ctl_elem_iface_t) 6) /* sequencer client */
-#define        SNDRV_CTL_ELEM_IFACE_LAST       SNDRV_CTL_ELEM_IFACE_SEQUENCER
-
-#define SNDRV_CTL_ELEM_ACCESS_READ             (1<<0)
-#define SNDRV_CTL_ELEM_ACCESS_WRITE            (1<<1)
-#define SNDRV_CTL_ELEM_ACCESS_READWRITE                (SNDRV_CTL_ELEM_ACCESS_READ|SNDRV_CTL_ELEM_ACCESS_WRITE)
-#define SNDRV_CTL_ELEM_ACCESS_VOLATILE         (1<<2)  /* control value may be changed without a notification */
-#define SNDRV_CTL_ELEM_ACCESS_TIMESTAMP                (1<<3)  /* when was control changed */
-#define SNDRV_CTL_ELEM_ACCESS_TLV_READ         (1<<4)  /* TLV read is possible */
-#define SNDRV_CTL_ELEM_ACCESS_TLV_WRITE                (1<<5)  /* TLV write is possible */
-#define SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE    (SNDRV_CTL_ELEM_ACCESS_TLV_READ|SNDRV_CTL_ELEM_ACCESS_TLV_WRITE)
-#define SNDRV_CTL_ELEM_ACCESS_TLV_COMMAND      (1<<6)  /* TLV command is possible */
-#define SNDRV_CTL_ELEM_ACCESS_INACTIVE         (1<<8)  /* control does actually nothing, but may be updated */
-#define SNDRV_CTL_ELEM_ACCESS_LOCK             (1<<9)  /* write lock */
-#define SNDRV_CTL_ELEM_ACCESS_OWNER            (1<<10) /* write lock owner */
-#define SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK     (1<<28) /* kernel use a TLV callback */ 
-#define SNDRV_CTL_ELEM_ACCESS_USER             (1<<29) /* user space element */
-/* bits 30 and 31 are obsoleted (for indirect access) */
-
-/* for further details see the ACPI and PCI power management specification */
-#define SNDRV_CTL_POWER_D0             0x0000  /* full On */
-#define SNDRV_CTL_POWER_D1             0x0100  /* partial On */
-#define SNDRV_CTL_POWER_D2             0x0200  /* partial On */
-#define SNDRV_CTL_POWER_D3             0x0300  /* Off */
-#define SNDRV_CTL_POWER_D3hot          (SNDRV_CTL_POWER_D3|0x0000)     /* Off, with power */
-#define SNDRV_CTL_POWER_D3cold         (SNDRV_CTL_POWER_D3|0x0001)     /* Off, without power */
-
-struct snd_ctl_elem_id {
-       unsigned int numid;             /* numeric identifier, zero = invalid */
-       snd_ctl_elem_iface_t iface;     /* interface identifier */
-       unsigned int device;            /* device/client number */
-       unsigned int subdevice;         /* subdevice (substream) number */
-       unsigned char name[44];         /* ASCII name of item */
-       unsigned int index;             /* index of item */
-};
-
-struct snd_ctl_elem_list {
-       unsigned int offset;            /* W: first element ID to get */
-       unsigned int space;             /* W: count of element IDs to get */
-       unsigned int used;              /* R: count of element IDs set */
-       unsigned int count;             /* R: count of all elements */
-       struct snd_ctl_elem_id __user *pids; /* R: IDs */
-       unsigned char reserved[50];
-};
-
-struct snd_ctl_elem_info {
-       struct snd_ctl_elem_id id;      /* W: element ID */
-       snd_ctl_elem_type_t type;       /* R: value type - SNDRV_CTL_ELEM_TYPE_* */
-       unsigned int access;            /* R: value access (bitmask) - SNDRV_CTL_ELEM_ACCESS_* */
-       unsigned int count;             /* count of values */
-       __kernel_pid_t owner;           /* owner's PID of this control */
-       union {
-               struct {
-                       long min;               /* R: minimum value */
-                       long max;               /* R: maximum value */
-                       long step;              /* R: step (0 variable) */
-               } integer;
-               struct {
-                       long long min;          /* R: minimum value */
-                       long long max;          /* R: maximum value */
-                       long long step;         /* R: step (0 variable) */
-               } integer64;
-               struct {
-                       unsigned int items;     /* R: number of items */
-                       unsigned int item;      /* W: item number */
-                       char name[64];          /* R: value name */
-                       __u64 names_ptr;        /* W: names list (ELEM_ADD only) */
-                       unsigned int names_length;
-               } enumerated;
-               unsigned char reserved[128];
-       } value;
-       union {
-               unsigned short d[4];            /* dimensions */
-               unsigned short *d_ptr;          /* indirect - obsoleted */
-       } dimen;
-       unsigned char reserved[64-4*sizeof(unsigned short)];
-};
-
-struct snd_ctl_elem_value {
-       struct snd_ctl_elem_id id;      /* W: element ID */
-       unsigned int indirect: 1;       /* W: indirect access - obsoleted */
-       union {
-               union {
-                       long value[128];
-                       long *value_ptr;        /* obsoleted */
-               } integer;
-               union {
-                       long long value[64];
-                       long long *value_ptr;   /* obsoleted */
-               } integer64;
-               union {
-                       unsigned int item[128];
-                       unsigned int *item_ptr; /* obsoleted */
-               } enumerated;
-               union {
-                       unsigned char data[512];
-                       unsigned char *data_ptr;        /* obsoleted */
-               } bytes;
-               struct snd_aes_iec958 iec958;
-       } value;                /* RO */
-       struct timespec tstamp;
-       unsigned char reserved[128-sizeof(struct timespec)];
-};
-
-struct snd_ctl_tlv {
-       unsigned int numid;     /* control element numeric identification */
-       unsigned int length;    /* in bytes aligned to 4 */
-       unsigned int tlv[0];    /* first TLV */
-};
-
-#define SNDRV_CTL_IOCTL_PVERSION       _IOR('U', 0x00, int)
-#define SNDRV_CTL_IOCTL_CARD_INFO      _IOR('U', 0x01, struct snd_ctl_card_info)
-#define SNDRV_CTL_IOCTL_ELEM_LIST      _IOWR('U', 0x10, struct snd_ctl_elem_list)
-#define SNDRV_CTL_IOCTL_ELEM_INFO      _IOWR('U', 0x11, struct snd_ctl_elem_info)
-#define SNDRV_CTL_IOCTL_ELEM_READ      _IOWR('U', 0x12, struct snd_ctl_elem_value)
-#define SNDRV_CTL_IOCTL_ELEM_WRITE     _IOWR('U', 0x13, struct snd_ctl_elem_value)
-#define SNDRV_CTL_IOCTL_ELEM_LOCK      _IOW('U', 0x14, struct snd_ctl_elem_id)
-#define SNDRV_CTL_IOCTL_ELEM_UNLOCK    _IOW('U', 0x15, struct snd_ctl_elem_id)
-#define SNDRV_CTL_IOCTL_SUBSCRIBE_EVENTS _IOWR('U', 0x16, int)
-#define SNDRV_CTL_IOCTL_ELEM_ADD       _IOWR('U', 0x17, struct snd_ctl_elem_info)
-#define SNDRV_CTL_IOCTL_ELEM_REPLACE   _IOWR('U', 0x18, struct snd_ctl_elem_info)
-#define SNDRV_CTL_IOCTL_ELEM_REMOVE    _IOWR('U', 0x19, struct snd_ctl_elem_id)
-#define SNDRV_CTL_IOCTL_TLV_READ       _IOWR('U', 0x1a, struct snd_ctl_tlv)
-#define SNDRV_CTL_IOCTL_TLV_WRITE      _IOWR('U', 0x1b, struct snd_ctl_tlv)
-#define SNDRV_CTL_IOCTL_TLV_COMMAND    _IOWR('U', 0x1c, struct snd_ctl_tlv)
-#define SNDRV_CTL_IOCTL_HWDEP_NEXT_DEVICE _IOWR('U', 0x20, int)
-#define SNDRV_CTL_IOCTL_HWDEP_INFO     _IOR('U', 0x21, struct snd_hwdep_info)
-#define SNDRV_CTL_IOCTL_PCM_NEXT_DEVICE        _IOR('U', 0x30, int)
-#define SNDRV_CTL_IOCTL_PCM_INFO       _IOWR('U', 0x31, struct snd_pcm_info)
-#define SNDRV_CTL_IOCTL_PCM_PREFER_SUBDEVICE _IOW('U', 0x32, int)
-#define SNDRV_CTL_IOCTL_RAWMIDI_NEXT_DEVICE _IOWR('U', 0x40, int)
-#define SNDRV_CTL_IOCTL_RAWMIDI_INFO   _IOWR('U', 0x41, struct snd_rawmidi_info)
-#define SNDRV_CTL_IOCTL_RAWMIDI_PREFER_SUBDEVICE _IOW('U', 0x42, int)
-#define SNDRV_CTL_IOCTL_POWER          _IOWR('U', 0xd0, int)
-#define SNDRV_CTL_IOCTL_POWER_STATE    _IOR('U', 0xd1, int)
-
-/*
- *  Read interface.
- */
-
-enum sndrv_ctl_event_type {
-       SNDRV_CTL_EVENT_ELEM = 0,
-       SNDRV_CTL_EVENT_LAST = SNDRV_CTL_EVENT_ELEM,
-};
-
-#define SNDRV_CTL_EVENT_MASK_VALUE     (1<<0)  /* element value was changed */
-#define SNDRV_CTL_EVENT_MASK_INFO      (1<<1)  /* element info was changed */
-#define SNDRV_CTL_EVENT_MASK_ADD       (1<<2)  /* element was added */
-#define SNDRV_CTL_EVENT_MASK_TLV       (1<<3)  /* element TLV tree was changed */
-#define SNDRV_CTL_EVENT_MASK_REMOVE    (~0U)   /* element was removed */
-
-struct snd_ctl_event {
-       int type;       /* event type - SNDRV_CTL_EVENT_* */
-       union {
-               struct {
-                       unsigned int mask;
-                       struct snd_ctl_elem_id id;
-               } elem;
-               unsigned char data8[60];
-       } data;
-};
-
-/*
- *  Control names
- */
-
-#define SNDRV_CTL_NAME_NONE                            ""
-#define SNDRV_CTL_NAME_PLAYBACK                                "Playback "
-#define SNDRV_CTL_NAME_CAPTURE                         "Capture "
-
-#define SNDRV_CTL_NAME_IEC958_NONE                     ""
-#define SNDRV_CTL_NAME_IEC958_SWITCH                   "Switch"
-#define SNDRV_CTL_NAME_IEC958_VOLUME                   "Volume"
-#define SNDRV_CTL_NAME_IEC958_DEFAULT                  "Default"
-#define SNDRV_CTL_NAME_IEC958_MASK                     "Mask"
-#define SNDRV_CTL_NAME_IEC958_CON_MASK                 "Con Mask"
-#define SNDRV_CTL_NAME_IEC958_PRO_MASK                 "Pro Mask"
-#define SNDRV_CTL_NAME_IEC958_PCM_STREAM               "PCM Stream"
-#define SNDRV_CTL_NAME_IEC958(expl,direction,what)     "IEC958 " expl SNDRV_CTL_NAME_##direction SNDRV_CTL_NAME_IEC958_##what
-
+#include <uapi/sound/asound.h>
 #endif /* __SOUND_ASOUND_H */
index 1a33f48..3707288 100644 (file)
@@ -1,8 +1,3 @@
-#ifndef __SOUND_EMU10K1_H
-#define __SOUND_EMU10K1_H
-
-#include <linux/types.h>
-
 /*
  *  Copyright (c) by Jaroslav Kysela <perex@perex.cz>,
  *                  Creative Labs, Inc.
@@ -24,8 +19,9 @@
  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
  *
  */
+#ifndef __SOUND_EMU10K1_H
+#define __SOUND_EMU10K1_H
 
-#ifdef __KERNEL__
 
 #include <sound/pcm.h>
 #include <sound/rawmidi.h>
@@ -38,6 +34,7 @@
 #include <linux/mutex.h>
 
 #include <asm/io.h>
+#include <uapi/sound/emu10k1.h>
 
 /* ------------------- DEFINES -------------------- */
 
@@ -1899,350 +1896,4 @@ int snd_emu10k1_fx8010_register_irq_handler(struct snd_emu10k1 *emu,
 int snd_emu10k1_fx8010_unregister_irq_handler(struct snd_emu10k1 *emu,
                                              struct snd_emu10k1_fx8010_irq *irq);
 
-#endif /* __KERNEL__ */
-
-/*
- * ---- FX8010 ----
- */
-
-#define EMU10K1_CARD_CREATIVE                  0x00000000
-#define EMU10K1_CARD_EMUAPS                    0x00000001
-
-#define EMU10K1_FX8010_PCM_COUNT               8
-
-/* instruction set */
-#define iMAC0   0x00   /* R = A + (X * Y >> 31)   ; saturation */
-#define iMAC1   0x01   /* R = A + (-X * Y >> 31)  ; saturation */
-#define iMAC2   0x02   /* R = A + (X * Y >> 31)   ; wraparound */
-#define iMAC3   0x03   /* R = A + (-X * Y >> 31)  ; wraparound */
-#define iMACINT0 0x04  /* R = A + X * Y           ; saturation */
-#define iMACINT1 0x05  /* R = A + X * Y           ; wraparound (31-bit) */
-#define iACC3   0x06   /* R = A + X + Y           ; saturation */
-#define iMACMV   0x07  /* R = A, acc += X * Y >> 31 */
-#define iANDXOR  0x08  /* R = (A & X) ^ Y */
-#define iTSTNEG  0x09  /* R = (A >= Y) ? X : ~X */
-#define iLIMITGE 0x0a  /* R = (A >= Y) ? X : Y */
-#define iLIMITLT 0x0b  /* R = (A < Y) ? X : Y */
-#define iLOG    0x0c   /* R = linear_data, A (log_data), X (max_exp), Y (format_word) */
-#define iEXP    0x0d   /* R = log_data, A (linear_data), X (max_exp), Y (format_word) */
-#define iINTERP  0x0e  /* R = A + (X * (Y - A) >> 31)  ; saturation */
-#define iSKIP    0x0f  /* R = A (cc_reg), X (count), Y (cc_test) */
-
-/* GPRs */
-#define FXBUS(x)       (0x00 + (x))    /* x = 0x00 - 0x0f */
-#define EXTIN(x)       (0x10 + (x))    /* x = 0x00 - 0x0f */
-#define EXTOUT(x)      (0x20 + (x))    /* x = 0x00 - 0x0f physical outs -> FXWC low 16 bits */
-#define FXBUS2(x)      (0x30 + (x))    /* x = 0x00 - 0x0f copies of fx buses for capture -> FXWC high 16 bits */
-                                       /* NB: 0x31 and 0x32 are shared with Center/LFE on SB live 5.1 */
-
-#define C_00000000     0x40
-#define C_00000001     0x41
-#define C_00000002     0x42
-#define C_00000003     0x43
-#define C_00000004     0x44
-#define C_00000008     0x45
-#define C_00000010     0x46
-#define C_00000020     0x47
-#define C_00000100     0x48
-#define C_00010000     0x49
-#define C_00080000     0x4a
-#define C_10000000     0x4b
-#define C_20000000     0x4c
-#define C_40000000     0x4d
-#define C_80000000     0x4e
-#define C_7fffffff     0x4f
-#define C_ffffffff     0x50
-#define C_fffffffe     0x51
-#define C_c0000000     0x52
-#define C_4f1bbcdc     0x53
-#define C_5a7ef9db     0x54
-#define C_00100000     0x55            /* ?? */
-#define GPR_ACCU       0x56            /* ACCUM, accumulator */
-#define GPR_COND       0x57            /* CCR, condition register */
-#define GPR_NOISE0     0x58            /* noise source */
-#define GPR_NOISE1     0x59            /* noise source */
-#define GPR_IRQ                0x5a            /* IRQ register */
-#define GPR_DBAC       0x5b            /* TRAM Delay Base Address Counter */
-#define GPR(x)         (FXGPREGBASE + (x)) /* free GPRs: x = 0x00 - 0xff */
-#define ITRAM_DATA(x)  (TANKMEMDATAREGBASE + 0x00 + (x)) /* x = 0x00 - 0x7f */
-#define ETRAM_DATA(x)  (TANKMEMDATAREGBASE + 0x80 + (x)) /* x = 0x00 - 0x1f */
-#define ITRAM_ADDR(x)  (TANKMEMADDRREGBASE + 0x00 + (x)) /* x = 0x00 - 0x7f */
-#define ETRAM_ADDR(x)  (TANKMEMADDRREGBASE + 0x80 + (x)) /* x = 0x00 - 0x1f */
-
-#define A_ITRAM_DATA(x)        (TANKMEMDATAREGBASE + 0x00 + (x)) /* x = 0x00 - 0xbf */
-#define A_ETRAM_DATA(x)        (TANKMEMDATAREGBASE + 0xc0 + (x)) /* x = 0x00 - 0x3f */
-#define A_ITRAM_ADDR(x)        (TANKMEMADDRREGBASE + 0x00 + (x)) /* x = 0x00 - 0xbf */
-#define A_ETRAM_ADDR(x)        (TANKMEMADDRREGBASE + 0xc0 + (x)) /* x = 0x00 - 0x3f */
-#define A_ITRAM_CTL(x) (A_TANKMEMCTLREGBASE + 0x00 + (x)) /* x = 0x00 - 0xbf */
-#define A_ETRAM_CTL(x) (A_TANKMEMCTLREGBASE + 0xc0 + (x)) /* x = 0x00 - 0x3f */
-
-#define A_FXBUS(x)     (0x00 + (x))    /* x = 0x00 - 0x3f FX buses */
-#define A_EXTIN(x)     (0x40 + (x))    /* x = 0x00 - 0x0f physical ins */
-#define A_P16VIN(x)    (0x50 + (x))    /* x = 0x00 - 0x0f p16v ins (A2 only) "EMU32 inputs" */
-#define A_EXTOUT(x)    (0x60 + (x))    /* x = 0x00 - 0x1f physical outs -> A_FXWC1 0x79-7f unknown   */
-#define A_FXBUS2(x)    (0x80 + (x))    /* x = 0x00 - 0x1f extra outs used for EFX capture -> A_FXWC2 */
-#define A_EMU32OUTH(x) (0xa0 + (x))    /* x = 0x00 - 0x0f "EMU32_OUT_10 - _1F" - ??? */
-#define A_EMU32OUTL(x) (0xb0 + (x))    /* x = 0x00 - 0x0f "EMU32_OUT_1 - _F" - ??? */
-#define A3_EMU32IN(x)  (0x160 + (x))   /* x = 0x00 - 0x3f "EMU32_IN_00 - _3F" - Only when .device = 0x0008 */
-#define A3_EMU32OUT(x) (0x1E0 + (x))   /* x = 0x00 - 0x0f "EMU32_OUT_00 - _3F" - Only when .device = 0x0008 */
-#define A_GPR(x)       (A_FXGPREGBASE + (x))
-
-/* cc_reg constants */
-#define CC_REG_NORMALIZED C_00000001
-#define CC_REG_BORROW  C_00000002
-#define CC_REG_MINUS   C_00000004
-#define CC_REG_ZERO    C_00000008
-#define CC_REG_SATURATE        C_00000010
-#define CC_REG_NONZERO C_00000100
-
-/* FX buses */
-#define FXBUS_PCM_LEFT         0x00
-#define FXBUS_PCM_RIGHT                0x01
-#define FXBUS_PCM_LEFT_REAR    0x02
-#define FXBUS_PCM_RIGHT_REAR   0x03
-#define FXBUS_MIDI_LEFT                0x04
-#define FXBUS_MIDI_RIGHT       0x05
-#define FXBUS_PCM_CENTER       0x06
-#define FXBUS_PCM_LFE          0x07
-#define FXBUS_PCM_LEFT_FRONT   0x08
-#define FXBUS_PCM_RIGHT_FRONT  0x09
-#define FXBUS_MIDI_REVERB      0x0c
-#define FXBUS_MIDI_CHORUS      0x0d
-#define FXBUS_PCM_LEFT_SIDE    0x0e
-#define FXBUS_PCM_RIGHT_SIDE   0x0f
-#define FXBUS_PT_LEFT          0x14
-#define FXBUS_PT_RIGHT         0x15
-
-/* Inputs */
-#define EXTIN_AC97_L      0x00 /* AC'97 capture channel - left */
-#define EXTIN_AC97_R      0x01 /* AC'97 capture channel - right */
-#define EXTIN_SPDIF_CD_L   0x02        /* internal S/PDIF CD - onboard - left */
-#define EXTIN_SPDIF_CD_R   0x03        /* internal S/PDIF CD - onboard - right */
-#define EXTIN_ZOOM_L      0x04 /* Zoom Video I2S - left */
-#define EXTIN_ZOOM_R      0x05 /* Zoom Video I2S - right */
-#define EXTIN_TOSLINK_L           0x06 /* LiveDrive - TOSLink Optical - left */
-#define EXTIN_TOSLINK_R    0x07        /* LiveDrive - TOSLink Optical - right */
-#define EXTIN_LINE1_L     0x08 /* LiveDrive - Line/Mic 1 - left */
-#define EXTIN_LINE1_R     0x09 /* LiveDrive - Line/Mic 1 - right */
-#define EXTIN_COAX_SPDIF_L 0x0a        /* LiveDrive - Coaxial S/PDIF - left */
-#define EXTIN_COAX_SPDIF_R 0x0b /* LiveDrive - Coaxial S/PDIF - right */
-#define EXTIN_LINE2_L     0x0c /* LiveDrive - Line/Mic 2 - left */
-#define EXTIN_LINE2_R     0x0d /* LiveDrive - Line/Mic 2 - right */
-
-/* Outputs */
-#define EXTOUT_AC97_L     0x00 /* AC'97 playback channel - left */
-#define EXTOUT_AC97_R     0x01 /* AC'97 playback channel - right */
-#define EXTOUT_TOSLINK_L   0x02        /* LiveDrive - TOSLink Optical - left */
-#define EXTOUT_TOSLINK_R   0x03        /* LiveDrive - TOSLink Optical - right */
-#define EXTOUT_AC97_CENTER 0x04        /* SB Live 5.1 - center */
-#define EXTOUT_AC97_LFE           0x05 /* SB Live 5.1 - LFE */
-#define EXTOUT_HEADPHONE_L 0x06        /* LiveDrive - Headphone - left */
-#define EXTOUT_HEADPHONE_R 0x07        /* LiveDrive - Headphone - right */
-#define EXTOUT_REAR_L     0x08 /* Rear channel - left */
-#define EXTOUT_REAR_R     0x09 /* Rear channel - right */
-#define EXTOUT_ADC_CAP_L   0x0a        /* ADC Capture buffer - left */
-#define EXTOUT_ADC_CAP_R   0x0b        /* ADC Capture buffer - right */
-#define EXTOUT_MIC_CAP    0x0c /* MIC Capture buffer */
-#define EXTOUT_AC97_REAR_L 0x0d        /* SB Live 5.1 (c) 2003 - Rear Left */
-#define EXTOUT_AC97_REAR_R 0x0e        /* SB Live 5.1 (c) 2003 - Rear Right */
-#define EXTOUT_ACENTER    0x11 /* Analog Center */
-#define EXTOUT_ALFE       0x12 /* Analog LFE */
-
-/* Audigy Inputs */
-#define A_EXTIN_AC97_L         0x00    /* AC'97 capture channel - left */
-#define A_EXTIN_AC97_R         0x01    /* AC'97 capture channel - right */
-#define A_EXTIN_SPDIF_CD_L     0x02    /* digital CD left */
-#define A_EXTIN_SPDIF_CD_R     0x03    /* digital CD left */
-#define A_EXTIN_OPT_SPDIF_L     0x04    /* audigy drive Optical SPDIF - left */
-#define A_EXTIN_OPT_SPDIF_R     0x05    /*                              right */ 
-#define A_EXTIN_LINE2_L                0x08    /* audigy drive line2/mic2 - left */
-#define A_EXTIN_LINE2_R                0x09    /*                           right */
-#define A_EXTIN_ADC_L          0x0a    /* Philips ADC - left */
-#define A_EXTIN_ADC_R          0x0b    /*               right */
-#define A_EXTIN_AUX2_L         0x0c    /* audigy drive aux2 - left */
-#define A_EXTIN_AUX2_R         0x0d    /*                   - right */
-
-/* Audigiy Outputs */
-#define A_EXTOUT_FRONT_L       0x00    /* digital front left */
-#define A_EXTOUT_FRONT_R       0x01    /*               right */
-#define A_EXTOUT_CENTER                0x02    /* digital front center */
-#define A_EXTOUT_LFE           0x03    /* digital front lfe */
-#define A_EXTOUT_HEADPHONE_L   0x04    /* headphone audigy drive left */
-#define A_EXTOUT_HEADPHONE_R   0x05    /*                        right */
-#define A_EXTOUT_REAR_L                0x06    /* digital rear left */
-#define A_EXTOUT_REAR_R                0x07    /*              right */
-#define A_EXTOUT_AFRONT_L      0x08    /* analog front left */
-#define A_EXTOUT_AFRONT_R      0x09    /*              right */
-#define A_EXTOUT_ACENTER       0x0a    /* analog center */
-#define A_EXTOUT_ALFE          0x0b    /* analog LFE */
-#define A_EXTOUT_ASIDE_L       0x0c    /* analog side left  - Audigy 2 ZS */
-#define A_EXTOUT_ASIDE_R       0x0d    /*             right - Audigy 2 ZS */
-#define A_EXTOUT_AREAR_L       0x0e    /* analog rear left */
-#define A_EXTOUT_AREAR_R       0x0f    /*             right */
-#define A_EXTOUT_AC97_L                0x10    /* AC97 left (front) */
-#define A_EXTOUT_AC97_R                0x11    /*      right */
-#define A_EXTOUT_ADC_CAP_L     0x16    /* ADC capture buffer left */
-#define A_EXTOUT_ADC_CAP_R     0x17    /*                    right */
-#define A_EXTOUT_MIC_CAP       0x18    /* Mic capture buffer */
-
-/* Audigy constants */
-#define A_C_00000000   0xc0
-#define A_C_00000001   0xc1
-#define A_C_00000002   0xc2
-#define A_C_00000003   0xc3
-#define A_C_00000004   0xc4
-#define A_C_00000008   0xc5
-#define A_C_00000010   0xc6
-#define A_C_00000020   0xc7
-#define A_C_00000100   0xc8
-#define A_C_00010000   0xc9
-#define A_C_00000800   0xca
-#define A_C_10000000   0xcb
-#define A_C_20000000   0xcc
-#define A_C_40000000   0xcd
-#define A_C_80000000   0xce
-#define A_C_7fffffff   0xcf
-#define A_C_ffffffff   0xd0
-#define A_C_fffffffe   0xd1
-#define A_C_c0000000   0xd2
-#define A_C_4f1bbcdc   0xd3
-#define A_C_5a7ef9db   0xd4
-#define A_C_00100000   0xd5
-#define A_GPR_ACCU     0xd6            /* ACCUM, accumulator */
-#define A_GPR_COND     0xd7            /* CCR, condition register */
-#define A_GPR_NOISE0   0xd8            /* noise source */
-#define A_GPR_NOISE1   0xd9            /* noise source */
-#define A_GPR_IRQ      0xda            /* IRQ register */
-#define A_GPR_DBAC     0xdb            /* TRAM Delay Base Address Counter - internal */
-#define A_GPR_DBACE    0xde            /* TRAM Delay Base Address Counter - external */
-
-/* definitions for debug register */
-#define EMU10K1_DBG_ZC                 0x80000000      /* zero tram counter */
-#define EMU10K1_DBG_SATURATION_OCCURED 0x02000000      /* saturation control */
-#define EMU10K1_DBG_SATURATION_ADDR    0x01ff0000      /* saturation address */
-#define EMU10K1_DBG_SINGLE_STEP                0x00008000      /* single step mode */
-#define EMU10K1_DBG_STEP               0x00004000      /* start single step */
-#define EMU10K1_DBG_CONDITION_CODE     0x00003e00      /* condition code */
-#define EMU10K1_DBG_SINGLE_STEP_ADDR   0x000001ff      /* single step address */
-
-/* tank memory address line */
-#ifndef __KERNEL__
-#define TANKMEMADDRREG_ADDR_MASK 0x000fffff    /* 20 bit tank address field                    */
-#define TANKMEMADDRREG_CLEAR    0x00800000     /* Clear tank memory                            */
-#define TANKMEMADDRREG_ALIGN    0x00400000     /* Align read or write relative to tank access  */
-#define TANKMEMADDRREG_WRITE    0x00200000     /* Write to tank memory                         */
-#define TANKMEMADDRREG_READ     0x00100000     /* Read from tank memory                        */
-#endif
-
-struct snd_emu10k1_fx8010_info {
-       unsigned int internal_tram_size;        /* in samples */
-       unsigned int external_tram_size;        /* in samples */
-       char fxbus_names[16][32];               /* names of FXBUSes */
-       char extin_names[16][32];               /* names of external inputs */
-       char extout_names[32][32];              /* names of external outputs */
-       unsigned int gpr_controls;              /* count of GPR controls */
-};
-
-#define EMU10K1_GPR_TRANSLATION_NONE           0
-#define EMU10K1_GPR_TRANSLATION_TABLE100       1
-#define EMU10K1_GPR_TRANSLATION_BASS           2
-#define EMU10K1_GPR_TRANSLATION_TREBLE         3
-#define EMU10K1_GPR_TRANSLATION_ONOFF          4
-
-struct snd_emu10k1_fx8010_control_gpr {
-       struct snd_ctl_elem_id id;              /* full control ID definition */
-       unsigned int vcount;            /* visible count */
-       unsigned int count;             /* count of GPR (1..16) */
-       unsigned short gpr[32];         /* GPR number(s) */
-       unsigned int value[32];         /* initial values */
-       unsigned int min;               /* minimum range */
-       unsigned int max;               /* maximum range */
-       unsigned int translation;       /* translation type (EMU10K1_GPR_TRANSLATION*) */
-       const unsigned int *tlv;
-};
-
-/* old ABI without TLV support */
-struct snd_emu10k1_fx8010_control_old_gpr {
-       struct snd_ctl_elem_id id;
-       unsigned int vcount;
-       unsigned int count;
-       unsigned short gpr[32];
-       unsigned int value[32];
-       unsigned int min;
-       unsigned int max;
-       unsigned int translation;
-};
-
-struct snd_emu10k1_fx8010_code {
-       char name[128];
-
-       DECLARE_BITMAP(gpr_valid, 0x200); /* bitmask of valid initializers */
-       __u32 __user *gpr_map;          /* initializers */
-
-       unsigned int gpr_add_control_count; /* count of GPR controls to add/replace */
-       struct snd_emu10k1_fx8010_control_gpr __user *gpr_add_controls; /* GPR controls to add/replace */
-
-       unsigned int gpr_del_control_count; /* count of GPR controls to remove */
-       struct snd_ctl_elem_id __user *gpr_del_controls; /* IDs of GPR controls to remove */
-
-       unsigned int gpr_list_control_count; /* count of GPR controls to list */
-       unsigned int gpr_list_control_total; /* total count of GPR controls */
-       struct snd_emu10k1_fx8010_control_gpr __user *gpr_list_controls; /* listed GPR controls */
-
-       DECLARE_BITMAP(tram_valid, 0x100); /* bitmask of valid initializers */
-       __u32 __user *tram_data_map;      /* data initializers */
-       __u32 __user *tram_addr_map;      /* map initializers */
-
-       DECLARE_BITMAP(code_valid, 1024); /* bitmask of valid instructions */
-       __u32 __user *code;               /* one instruction - 64 bits */
-};
-
-struct snd_emu10k1_fx8010_tram {
-       unsigned int address;           /* 31.bit == 1 -> external TRAM */
-       unsigned int size;              /* size in samples (4 bytes) */
-       unsigned int *samples;          /* pointer to samples (20-bit) */
-                                       /* NULL->clear memory */
-};
-
-struct snd_emu10k1_fx8010_pcm_rec {
-       unsigned int substream;         /* substream number */
-       unsigned int res1;              /* reserved */
-       unsigned int channels;          /* 16-bit channels count, zero = remove this substream */
-       unsigned int tram_start;        /* ring buffer position in TRAM (in samples) */
-       unsigned int buffer_size;       /* count of buffered samples */
-       unsigned short gpr_size;                /* GPR containing size of ringbuffer in samples (host) */
-       unsigned short gpr_ptr;         /* GPR containing current pointer in the ring buffer (host = reset, FX8010) */
-       unsigned short gpr_count;       /* GPR containing count of samples between two interrupts (host) */
-       unsigned short gpr_tmpcount;    /* GPR containing current count of samples to interrupt (host = set, FX8010) */
-       unsigned short gpr_trigger;     /* GPR containing trigger (activate) information (host) */
-       unsigned short gpr_running;     /* GPR containing info if PCM is running (FX8010) */
-       unsigned char pad;              /* reserved */
-       unsigned char etram[32];        /* external TRAM address & data (one per channel) */
-       unsigned int res2;              /* reserved */
-};
-
-#define SNDRV_EMU10K1_VERSION          SNDRV_PROTOCOL_VERSION(1, 0, 1)
-
-#define SNDRV_EMU10K1_IOCTL_INFO       _IOR ('H', 0x10, struct snd_emu10k1_fx8010_info)
-#define SNDRV_EMU10K1_IOCTL_CODE_POKE  _IOW ('H', 0x11, struct snd_emu10k1_fx8010_code)
-#define SNDRV_EMU10K1_IOCTL_CODE_PEEK  _IOWR('H', 0x12, struct snd_emu10k1_fx8010_code)
-#define SNDRV_EMU10K1_IOCTL_TRAM_SETUP _IOW ('H', 0x20, int)
-#define SNDRV_EMU10K1_IOCTL_TRAM_POKE  _IOW ('H', 0x21, struct snd_emu10k1_fx8010_tram)
-#define SNDRV_EMU10K1_IOCTL_TRAM_PEEK  _IOWR('H', 0x22, struct snd_emu10k1_fx8010_tram)
-#define SNDRV_EMU10K1_IOCTL_PCM_POKE   _IOW ('H', 0x30, struct snd_emu10k1_fx8010_pcm_rec)
-#define SNDRV_EMU10K1_IOCTL_PCM_PEEK   _IOWR('H', 0x31, struct snd_emu10k1_fx8010_pcm_rec)
-#define SNDRV_EMU10K1_IOCTL_PVERSION   _IOR ('H', 0x40, int)
-#define SNDRV_EMU10K1_IOCTL_STOP       _IO  ('H', 0x80)
-#define SNDRV_EMU10K1_IOCTL_CONTINUE   _IO  ('H', 0x81)
-#define SNDRV_EMU10K1_IOCTL_ZERO_TRAM_COUNTER _IO ('H', 0x82)
-#define SNDRV_EMU10K1_IOCTL_SINGLE_STEP        _IOW ('H', 0x83, int)
-#define SNDRV_EMU10K1_IOCTL_DBG_READ   _IOR ('H', 0x84, int)
-
-/* typedefs for compatibility to user-space */
-typedef struct snd_emu10k1_fx8010_info emu10k1_fx8010_info_t;
-typedef struct snd_emu10k1_fx8010_control_gpr emu10k1_fx8010_control_gpr_t;
-typedef struct snd_emu10k1_fx8010_code emu10k1_fx8010_code_t;
-typedef struct snd_emu10k1_fx8010_tram emu10k1_fx8010_tram_t;
-typedef struct snd_emu10k1_fx8010_pcm_rec emu10k1_fx8010_pcm_t;
-
 #endif /* __SOUND_EMU10K1_H */
index 6268a41..45c1981 100644 (file)
@@ -71,6 +71,8 @@ struct snd_pcm_ops {
        int (*prepare)(struct snd_pcm_substream *substream);
        int (*trigger)(struct snd_pcm_substream *substream, int cmd);
        snd_pcm_uframes_t (*pointer)(struct snd_pcm_substream *substream);
+       int (*wall_clock)(struct snd_pcm_substream *substream,
+                         struct timespec *audio_ts);
        int (*copy)(struct snd_pcm_substream *substream, int channel,
                    snd_pcm_uframes_t pos,
                    void __user *buf, snd_pcm_uframes_t count);
@@ -281,6 +283,7 @@ struct snd_pcm_runtime {
        unsigned long hw_ptr_jiffies;   /* Time when hw_ptr is updated */
        unsigned long hw_ptr_buffer_jiffies; /* buffer time in jiffies */
        snd_pcm_sframes_t delay;        /* extra delay; typically FIFO size */
+       u64 hw_ptr_wrap;                /* offset for hw_ptr due to boundary wrap-around */
 
        /* -- HW params -- */
        snd_pcm_access_t access;        /* access mode */
index 7e95056..c7c7788 100644 (file)
@@ -1,6 +1,3 @@
-#ifndef __SOUND_SB16_CSP_H
-#define __SOUND_SB16_CSP_H
-
 /*
  *  Copyright (c) 1999 by Uros Bizjak <uros@kss-loka.si>
  *                        Takashi Iwai <tiwai@suse.de>
  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
  *
  */
+#ifndef __SOUND_SB16_CSP_H
+#define __SOUND_SB16_CSP_H
 
-/* CSP modes */
-#define SNDRV_SB_CSP_MODE_NONE         0x00
-#define SNDRV_SB_CSP_MODE_DSP_READ     0x01    /* Record from DSP */
-#define SNDRV_SB_CSP_MODE_DSP_WRITE    0x02    /* Play to DSP */
-#define SNDRV_SB_CSP_MODE_QSOUND               0x04    /* QSound */
-
-/* CSP load flags */
-#define SNDRV_SB_CSP_LOAD_FROMUSER     0x01
-#define SNDRV_SB_CSP_LOAD_INITBLOCK    0x02
-
-/* CSP sample width */
-#define SNDRV_SB_CSP_SAMPLE_8BIT               0x01
-#define SNDRV_SB_CSP_SAMPLE_16BIT              0x02
-
-/* CSP channels */
-#define SNDRV_SB_CSP_MONO                      0x01
-#define SNDRV_SB_CSP_STEREO            0x02
-
-/* CSP rates */
-#define SNDRV_SB_CSP_RATE_8000         0x01
-#define SNDRV_SB_CSP_RATE_11025                0x02
-#define SNDRV_SB_CSP_RATE_22050                0x04
-#define SNDRV_SB_CSP_RATE_44100                0x08
-#define SNDRV_SB_CSP_RATE_ALL          0x0f
-
-/* CSP running state */
-#define SNDRV_SB_CSP_ST_IDLE           0x00
-#define SNDRV_SB_CSP_ST_LOADED         0x01
-#define SNDRV_SB_CSP_ST_RUNNING                0x02
-#define SNDRV_SB_CSP_ST_PAUSED         0x04
-#define SNDRV_SB_CSP_ST_AUTO           0x08
-#define SNDRV_SB_CSP_ST_QSOUND         0x10
-
-/* maximum QSound value (180 degrees right) */
-#define SNDRV_SB_CSP_QSOUND_MAX_RIGHT  0x20
-
-/* maximum microcode RIFF file size */
-#define SNDRV_SB_CSP_MAX_MICROCODE_FILE_SIZE   0x3000
-
-/* microcode header */
-struct snd_sb_csp_mc_header {
-       char codec_name[16];            /* id name of codec */
-       unsigned short func_req;        /* requested function */
-};
-
-/* microcode to be loaded */
-struct snd_sb_csp_microcode {
-       struct snd_sb_csp_mc_header info;
-       unsigned char data[SNDRV_SB_CSP_MAX_MICROCODE_FILE_SIZE];
-};
-
-/* start CSP with sample_width in mono/stereo */
-struct snd_sb_csp_start {
-       int sample_width;       /* sample width, look above */
-       int channels;           /* channels, look above */
-};
-
-/* CSP information */
-struct snd_sb_csp_info {
-       char codec_name[16];            /* id name of codec */
-       unsigned short func_nr;         /* function number */
-       unsigned int acc_format;        /* accepted PCM formats */
-       unsigned short acc_channels;    /* accepted channels */
-       unsigned short acc_width;       /* accepted sample width */
-       unsigned short acc_rates;       /* accepted sample rates */
-       unsigned short csp_mode;        /* CSP mode, see above */
-       unsigned short run_channels;    /* current channels  */
-       unsigned short run_width;       /* current sample width */
-       unsigned short version;         /* version id: 0x10 - 0x1f */
-       unsigned short state;           /* state bits */
-};
-
-/* HWDEP controls */
-/* get CSP information */
-#define SNDRV_SB_CSP_IOCTL_INFO                _IOR('H', 0x10, struct snd_sb_csp_info)
-/* load microcode to CSP */
-/* NOTE: struct snd_sb_csp_microcode overflows the max size (13 bits)
- * defined for some architectures like MIPS, and it leads to build errors.
- * (x86 and co have 14-bit size, thus it's valid, though.)
- * As a workaround for skipping the size-limit check, here we don't use the
- * normal _IOW() macro but _IOC() with the manual argument.
- */
-#define SNDRV_SB_CSP_IOCTL_LOAD_CODE   \
-       _IOC(_IOC_WRITE, 'H', 0x11, sizeof(struct snd_sb_csp_microcode))
-/* unload microcode from CSP */
-#define SNDRV_SB_CSP_IOCTL_UNLOAD_CODE _IO('H', 0x12)
-/* start CSP */
-#define SNDRV_SB_CSP_IOCTL_START               _IOW('H', 0x13, struct snd_sb_csp_start)
-/* stop CSP */
-#define SNDRV_SB_CSP_IOCTL_STOP                _IO('H', 0x14)
-/* pause CSP and DMA transfer */
-#define SNDRV_SB_CSP_IOCTL_PAUSE               _IO('H', 0x15)
-/* restart CSP and DMA transfer */
-#define SNDRV_SB_CSP_IOCTL_RESTART     _IO('H', 0x16)
-
-#ifdef __KERNEL__
 #include <sound/sb.h>
 #include <sound/hwdep.h>
 #include <linux/firmware.h>
+#include <uapi/sound/sb16_csp.h>
 
 struct snd_sb_csp;
 
@@ -183,6 +87,4 @@ struct snd_sb_csp {
 };
 
 int snd_sb_csp_new(struct snd_sb *chip, int device, struct snd_hwdep ** rhwdep);
-#endif
-
 #endif /* __SOUND_SB16_CSP */
index aafaa5a..0f7d279 100644 (file)
@@ -1 +1,11 @@
 # UAPI Header export list
+header-y += asequencer.h
+header-y += asound.h
+header-y += asound_fm.h
+header-y += compress_offload.h
+header-y += compress_params.h
+header-y += emu10k1.h
+header-y += hdsp.h
+header-y += hdspm.h
+header-y += sb16_csp.h
+header-y += sfnt_info.h
diff --git a/include/uapi/sound/asequencer.h b/include/uapi/sound/asequencer.h
new file mode 100644 (file)
index 0000000..09c8a00
--- /dev/null
@@ -0,0 +1,614 @@
+/*
+ *  Main header file for the ALSA sequencer
+ *  Copyright (c) 1998-1999 by Frank van de Pol <fvdpol@coil.demon.nl>
+ *            (c) 1998-1999 by Jaroslav Kysela <perex@perex.cz>
+ *
+ *
+ *   This program is free software; you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation; either version 2 of the License, or
+ *   (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+ *
+ */
+#ifndef _UAPI__SOUND_ASEQUENCER_H
+#define _UAPI__SOUND_ASEQUENCER_H
+
+
+/** version of the sequencer */
+#define SNDRV_SEQ_VERSION SNDRV_PROTOCOL_VERSION (1, 0, 1)
+
+/**
+ * definition of sequencer event types
+ */
+
+/** system messages
+ * event data type = #snd_seq_result
+ */
+#define SNDRV_SEQ_EVENT_SYSTEM         0
+#define SNDRV_SEQ_EVENT_RESULT         1
+
+/** note messages (channel specific)
+ * event data type = #snd_seq_ev_note
+ */
+#define SNDRV_SEQ_EVENT_NOTE           5
+#define SNDRV_SEQ_EVENT_NOTEON         6
+#define SNDRV_SEQ_EVENT_NOTEOFF                7
+#define SNDRV_SEQ_EVENT_KEYPRESS       8
+       
+/** control messages (channel specific)
+ * event data type = #snd_seq_ev_ctrl
+ */
+#define SNDRV_SEQ_EVENT_CONTROLLER     10
+#define SNDRV_SEQ_EVENT_PGMCHANGE      11
+#define SNDRV_SEQ_EVENT_CHANPRESS      12
+#define SNDRV_SEQ_EVENT_PITCHBEND      13      /**< from -8192 to 8191 */
+#define SNDRV_SEQ_EVENT_CONTROL14      14      /**< 14 bit controller value */
+#define SNDRV_SEQ_EVENT_NONREGPARAM    15      /**< 14 bit NRPN address + 14 bit unsigned value */
+#define SNDRV_SEQ_EVENT_REGPARAM       16      /**< 14 bit RPN address + 14 bit unsigned value */
+
+/** synchronisation messages
+ * event data type = #snd_seq_ev_ctrl
+ */
+#define SNDRV_SEQ_EVENT_SONGPOS                20      /* Song Position Pointer with LSB and MSB values */
+#define SNDRV_SEQ_EVENT_SONGSEL                21      /* Song Select with song ID number */
+#define SNDRV_SEQ_EVENT_QFRAME         22      /* midi time code quarter frame */
+#define SNDRV_SEQ_EVENT_TIMESIGN       23      /* SMF Time Signature event */
+#define SNDRV_SEQ_EVENT_KEYSIGN                24      /* SMF Key Signature event */
+               
+/** timer messages
+ * event data type = snd_seq_ev_queue_control
+ */
+#define SNDRV_SEQ_EVENT_START          30      /* midi Real Time Start message */
+#define SNDRV_SEQ_EVENT_CONTINUE       31      /* midi Real Time Continue message */
+#define SNDRV_SEQ_EVENT_STOP           32      /* midi Real Time Stop message */       
+#define        SNDRV_SEQ_EVENT_SETPOS_TICK     33      /* set tick queue position */
+#define SNDRV_SEQ_EVENT_SETPOS_TIME    34      /* set realtime queue position */
+#define SNDRV_SEQ_EVENT_TEMPO          35      /* (SMF) Tempo event */
+#define SNDRV_SEQ_EVENT_CLOCK          36      /* midi Real Time Clock message */
+#define SNDRV_SEQ_EVENT_TICK           37      /* midi Real Time Tick message */
+#define SNDRV_SEQ_EVENT_QUEUE_SKEW     38      /* skew queue tempo */
+
+/** others
+ * event data type = none
+ */
+#define SNDRV_SEQ_EVENT_TUNE_REQUEST   40      /* tune request */
+#define SNDRV_SEQ_EVENT_RESET          41      /* reset to power-on state */
+#define SNDRV_SEQ_EVENT_SENSING                42      /* "active sensing" event */
+
+/** echo back, kernel private messages
+ * event data type = any type
+ */
+#define SNDRV_SEQ_EVENT_ECHO           50      /* echo event */
+#define SNDRV_SEQ_EVENT_OSS            51      /* OSS raw event */
+
+/** system status messages (broadcast for subscribers)
+ * event data type = snd_seq_addr
+ */
+#define SNDRV_SEQ_EVENT_CLIENT_START   60      /* new client has connected */
+#define SNDRV_SEQ_EVENT_CLIENT_EXIT    61      /* client has left the system */
+#define SNDRV_SEQ_EVENT_CLIENT_CHANGE  62      /* client status/info has changed */
+#define SNDRV_SEQ_EVENT_PORT_START     63      /* new port was created */
+#define SNDRV_SEQ_EVENT_PORT_EXIT      64      /* port was deleted from system */
+#define SNDRV_SEQ_EVENT_PORT_CHANGE    65      /* port status/info has changed */
+
+/** port connection changes
+ * event data type = snd_seq_connect
+ */
+#define SNDRV_SEQ_EVENT_PORT_SUBSCRIBED        66      /* ports connected */
+#define SNDRV_SEQ_EVENT_PORT_UNSUBSCRIBED 67   /* ports disconnected */
+
+/* 70-89:  synthesizer events - obsoleted */
+
+/** user-defined events with fixed length
+ * event data type = any
+ */
+#define SNDRV_SEQ_EVENT_USR0           90
+#define SNDRV_SEQ_EVENT_USR1           91
+#define SNDRV_SEQ_EVENT_USR2           92
+#define SNDRV_SEQ_EVENT_USR3           93
+#define SNDRV_SEQ_EVENT_USR4           94
+#define SNDRV_SEQ_EVENT_USR5           95
+#define SNDRV_SEQ_EVENT_USR6           96
+#define SNDRV_SEQ_EVENT_USR7           97
+#define SNDRV_SEQ_EVENT_USR8           98
+#define SNDRV_SEQ_EVENT_USR9           99
+
+/* 100-118: instrument layer - obsoleted */
+/* 119-129: reserved */
+
+/* 130-139: variable length events
+ * event data type = snd_seq_ev_ext
+ * (SNDRV_SEQ_EVENT_LENGTH_VARIABLE must be set)
+ */
+#define SNDRV_SEQ_EVENT_SYSEX          130     /* system exclusive data (variable length) */
+#define SNDRV_SEQ_EVENT_BOUNCE         131     /* error event */
+/* 132-134: reserved */
+#define SNDRV_SEQ_EVENT_USR_VAR0       135
+#define SNDRV_SEQ_EVENT_USR_VAR1       136
+#define SNDRV_SEQ_EVENT_USR_VAR2       137
+#define SNDRV_SEQ_EVENT_USR_VAR3       138
+#define SNDRV_SEQ_EVENT_USR_VAR4       139
+
+/* 150-151: kernel events with quote - DO NOT use in user clients */
+#define SNDRV_SEQ_EVENT_KERNEL_ERROR   150
+#define SNDRV_SEQ_EVENT_KERNEL_QUOTE   151     /* obsolete */
+
+/* 152-191: reserved */
+
+/* 192-254: hardware specific events */
+
+/* 255: special event */
+#define SNDRV_SEQ_EVENT_NONE           255
+
+
+typedef unsigned char snd_seq_event_type_t;
+
+/** event address */
+struct snd_seq_addr {
+       unsigned char client;   /**< Client number:         0..255, 255 = broadcast to all clients */
+       unsigned char port;     /**< Port within client:    0..255, 255 = broadcast to all ports */
+};
+
+/** port connection */
+struct snd_seq_connect {
+       struct snd_seq_addr sender;
+       struct snd_seq_addr dest;
+};
+
+
+#define SNDRV_SEQ_ADDRESS_UNKNOWN      253     /* unknown source */
+#define SNDRV_SEQ_ADDRESS_SUBSCRIBERS  254     /* send event to all subscribed ports */
+#define SNDRV_SEQ_ADDRESS_BROADCAST    255     /* send event to all queues/clients/ports/channels */
+#define SNDRV_SEQ_QUEUE_DIRECT         253     /* direct dispatch */
+
+       /* event mode flag - NOTE: only 8 bits available! */
+#define SNDRV_SEQ_TIME_STAMP_TICK      (0<<0) /* timestamp in clock ticks */
+#define SNDRV_SEQ_TIME_STAMP_REAL      (1<<0) /* timestamp in real time */
+#define SNDRV_SEQ_TIME_STAMP_MASK      (1<<0)
+
+#define SNDRV_SEQ_TIME_MODE_ABS                (0<<1)  /* absolute timestamp */
+#define SNDRV_SEQ_TIME_MODE_REL                (1<<1)  /* relative to current time */
+#define SNDRV_SEQ_TIME_MODE_MASK       (1<<1)
+
+#define SNDRV_SEQ_EVENT_LENGTH_FIXED   (0<<2)  /* fixed event size */
+#define SNDRV_SEQ_EVENT_LENGTH_VARIABLE        (1<<2)  /* variable event size */
+#define SNDRV_SEQ_EVENT_LENGTH_VARUSR  (2<<2)  /* variable event size - user memory space */
+#define SNDRV_SEQ_EVENT_LENGTH_MASK    (3<<2)
+
+#define SNDRV_SEQ_PRIORITY_NORMAL      (0<<4)  /* normal priority */
+#define SNDRV_SEQ_PRIORITY_HIGH                (1<<4)  /* event should be processed before others */
+#define SNDRV_SEQ_PRIORITY_MASK                (1<<4)
+
+
+       /* note event */
+struct snd_seq_ev_note {
+       unsigned char channel;
+       unsigned char note;
+       unsigned char velocity;
+       unsigned char off_velocity;     /* only for SNDRV_SEQ_EVENT_NOTE */
+       unsigned int duration;          /* only for SNDRV_SEQ_EVENT_NOTE */
+};
+
+       /* controller event */
+struct snd_seq_ev_ctrl {
+       unsigned char channel;
+       unsigned char unused1, unused2, unused3;        /* pad */
+       unsigned int param;
+       signed int value;
+};
+
+       /* generic set of bytes (12x8 bit) */
+struct snd_seq_ev_raw8 {
+       unsigned char d[12];    /* 8 bit value */
+};
+
+       /* generic set of integers (3x32 bit) */
+struct snd_seq_ev_raw32 {
+       unsigned int d[3];      /* 32 bit value */
+};
+
+       /* external stored data */
+struct snd_seq_ev_ext {
+       unsigned int len;       /* length of data */
+       void *ptr;              /* pointer to data (note: maybe 64-bit) */
+} __attribute__((packed));
+
+struct snd_seq_result {
+       int event;              /* processed event type */
+       int result;
+};
+
+
+struct snd_seq_real_time {
+       unsigned int tv_sec;    /* seconds */
+       unsigned int tv_nsec;   /* nanoseconds */
+};
+
+typedef unsigned int snd_seq_tick_time_t;      /* midi ticks */
+
+union snd_seq_timestamp {
+       snd_seq_tick_time_t tick;
+       struct snd_seq_real_time time;
+};
+
+struct snd_seq_queue_skew {
+       unsigned int value;
+       unsigned int base;
+};
+
+       /* queue timer control */
+struct snd_seq_ev_queue_control {
+       unsigned char queue;                    /* affected queue */
+       unsigned char pad[3];                   /* reserved */
+       union {
+               signed int value;               /* affected value (e.g. tempo) */
+               union snd_seq_timestamp time;   /* time */
+               unsigned int position;          /* sync position */
+               struct snd_seq_queue_skew skew;
+               unsigned int d32[2];
+               unsigned char d8[8];
+       } param;
+};
+
+       /* quoted event - inside the kernel only */
+struct snd_seq_ev_quote {
+       struct snd_seq_addr origin;             /* original sender */
+       unsigned short value;           /* optional data */
+       struct snd_seq_event *event;            /* quoted event */
+} __attribute__((packed));
+
+
+       /* sequencer event */
+struct snd_seq_event {
+       snd_seq_event_type_t type;      /* event type */
+       unsigned char flags;            /* event flags */
+       char tag;
+       
+       unsigned char queue;            /* schedule queue */
+       union snd_seq_timestamp time;   /* schedule time */
+
+
+       struct snd_seq_addr source;     /* source address */
+       struct snd_seq_addr dest;       /* destination address */
+
+       union {                         /* event data... */
+               struct snd_seq_ev_note note;
+               struct snd_seq_ev_ctrl control;
+               struct snd_seq_ev_raw8 raw8;
+               struct snd_seq_ev_raw32 raw32;
+               struct snd_seq_ev_ext ext;
+               struct snd_seq_ev_queue_control queue;
+               union snd_seq_timestamp time;
+               struct snd_seq_addr addr;
+               struct snd_seq_connect connect;
+               struct snd_seq_result result;
+               struct snd_seq_ev_quote quote;
+       } data;
+};
+
+
+/*
+ * bounce event - stored as variable size data
+ */
+struct snd_seq_event_bounce {
+       int err;
+       struct snd_seq_event event;
+       /* external data follows here. */
+};
+
+
+       /* system information */
+struct snd_seq_system_info {
+       int queues;                     /* maximum queues count */
+       int clients;                    /* maximum clients count */
+       int ports;                      /* maximum ports per client */
+       int channels;                   /* maximum channels per port */
+       int cur_clients;                /* current clients */
+       int cur_queues;                 /* current queues */
+       char reserved[24];
+};
+
+
+       /* system running information */
+struct snd_seq_running_info {
+       unsigned char client;           /* client id */
+       unsigned char big_endian;       /* 1 = big-endian */
+       unsigned char cpu_mode;         /* 4 = 32bit, 8 = 64bit */
+       unsigned char pad;              /* reserved */
+       unsigned char reserved[12];
+};
+
+
+       /* known client numbers */
+#define SNDRV_SEQ_CLIENT_SYSTEM                0
+       /* internal client numbers */
+#define SNDRV_SEQ_CLIENT_DUMMY         14      /* midi through */
+#define SNDRV_SEQ_CLIENT_OSS           15      /* oss sequencer emulator */
+
+
+       /* client types */
+typedef int __bitwise snd_seq_client_type_t;
+#define        NO_CLIENT       ((__force snd_seq_client_type_t) 0)
+#define        USER_CLIENT     ((__force snd_seq_client_type_t) 1)
+#define        KERNEL_CLIENT   ((__force snd_seq_client_type_t) 2)
+                        
+       /* event filter flags */
+#define SNDRV_SEQ_FILTER_BROADCAST     (1<<0)  /* accept broadcast messages */
+#define SNDRV_SEQ_FILTER_MULTICAST     (1<<1)  /* accept multicast messages */
+#define SNDRV_SEQ_FILTER_BOUNCE                (1<<2)  /* accept bounce event in error */
+#define SNDRV_SEQ_FILTER_USE_EVENT     (1<<31) /* use event filter */
+
+struct snd_seq_client_info {
+       int client;                     /* client number to inquire */
+       snd_seq_client_type_t type;     /* client type */
+       char name[64];                  /* client name */
+       unsigned int filter;            /* filter flags */
+       unsigned char multicast_filter[8]; /* multicast filter bitmap */
+       unsigned char event_filter[32]; /* event filter bitmap */
+       int num_ports;                  /* RO: number of ports */
+       int event_lost;                 /* number of lost events */
+       char reserved[64];              /* for future use */
+};
+
+
+/* client pool size */
+struct snd_seq_client_pool {
+       int client;                     /* client number to inquire */
+       int output_pool;                /* outgoing (write) pool size */
+       int input_pool;                 /* incoming (read) pool size */
+       int output_room;                /* minimum free pool size for select/blocking mode */
+       int output_free;                /* unused size */
+       int input_free;                 /* unused size */
+       char reserved[64];
+};
+
+
+/* Remove events by specified criteria */
+
+#define SNDRV_SEQ_REMOVE_INPUT         (1<<0)  /* Flush input queues */
+#define SNDRV_SEQ_REMOVE_OUTPUT                (1<<1)  /* Flush output queues */
+#define SNDRV_SEQ_REMOVE_DEST          (1<<2)  /* Restrict by destination q:client:port */
+#define SNDRV_SEQ_REMOVE_DEST_CHANNEL  (1<<3)  /* Restrict by channel */
+#define SNDRV_SEQ_REMOVE_TIME_BEFORE   (1<<4)  /* Restrict to before time */
+#define SNDRV_SEQ_REMOVE_TIME_AFTER    (1<<5)  /* Restrict to time or after */
+#define SNDRV_SEQ_REMOVE_TIME_TICK     (1<<6)  /* Time is in ticks */
+#define SNDRV_SEQ_REMOVE_EVENT_TYPE    (1<<7)  /* Restrict to event type */
+#define SNDRV_SEQ_REMOVE_IGNORE_OFF    (1<<8)  /* Do not flush off events */
+#define SNDRV_SEQ_REMOVE_TAG_MATCH     (1<<9)  /* Restrict to events with given tag */
+
+struct snd_seq_remove_events {
+       unsigned int  remove_mode;      /* Flags that determine what gets removed */
+
+       union snd_seq_timestamp time;
+
+       unsigned char queue;    /* Queue for REMOVE_DEST */
+       struct snd_seq_addr dest;       /* Address for REMOVE_DEST */
+       unsigned char channel;  /* Channel for REMOVE_DEST */
+
+       int  type;      /* For REMOVE_EVENT_TYPE */
+       char  tag;      /* Tag for REMOVE_TAG */
+
+       int  reserved[10];      /* To allow for future binary compatibility */
+
+};
+
+
+       /* known port numbers */
+#define SNDRV_SEQ_PORT_SYSTEM_TIMER    0
+#define SNDRV_SEQ_PORT_SYSTEM_ANNOUNCE 1
+
+       /* port capabilities (32 bits) */
+#define SNDRV_SEQ_PORT_CAP_READ                (1<<0)  /* readable from this port */
+#define SNDRV_SEQ_PORT_CAP_WRITE       (1<<1)  /* writable to this port */
+
+#define SNDRV_SEQ_PORT_CAP_SYNC_READ   (1<<2)
+#define SNDRV_SEQ_PORT_CAP_SYNC_WRITE  (1<<3)
+
+#define SNDRV_SEQ_PORT_CAP_DUPLEX      (1<<4)
+
+#define SNDRV_SEQ_PORT_CAP_SUBS_READ   (1<<5)  /* allow read subscription */
+#define SNDRV_SEQ_PORT_CAP_SUBS_WRITE  (1<<6)  /* allow write subscription */
+#define SNDRV_SEQ_PORT_CAP_NO_EXPORT   (1<<7)  /* routing not allowed */
+
+       /* port type */
+#define SNDRV_SEQ_PORT_TYPE_SPECIFIC   (1<<0)  /* hardware specific */
+#define SNDRV_SEQ_PORT_TYPE_MIDI_GENERIC (1<<1)        /* generic MIDI device */
+#define SNDRV_SEQ_PORT_TYPE_MIDI_GM    (1<<2)  /* General MIDI compatible device */
+#define SNDRV_SEQ_PORT_TYPE_MIDI_GS    (1<<3)  /* GS compatible device */
+#define SNDRV_SEQ_PORT_TYPE_MIDI_XG    (1<<4)  /* XG compatible device */
+#define SNDRV_SEQ_PORT_TYPE_MIDI_MT32  (1<<5)  /* MT-32 compatible device */
+#define SNDRV_SEQ_PORT_TYPE_MIDI_GM2   (1<<6)  /* General MIDI 2 compatible device */
+
+/* other standards...*/
+#define SNDRV_SEQ_PORT_TYPE_SYNTH      (1<<10) /* Synth device (no MIDI compatible - direct wavetable) */
+#define SNDRV_SEQ_PORT_TYPE_DIRECT_SAMPLE (1<<11)      /* Sampling device (support sample download) */
+#define SNDRV_SEQ_PORT_TYPE_SAMPLE     (1<<12) /* Sampling device (sample can be downloaded at any time) */
+/*...*/
+#define SNDRV_SEQ_PORT_TYPE_HARDWARE   (1<<16) /* driver for a hardware device */
+#define SNDRV_SEQ_PORT_TYPE_SOFTWARE   (1<<17) /* implemented in software */
+#define SNDRV_SEQ_PORT_TYPE_SYNTHESIZER        (1<<18) /* generates sound */
+#define SNDRV_SEQ_PORT_TYPE_PORT       (1<<19) /* connects to other device(s) */
+#define SNDRV_SEQ_PORT_TYPE_APPLICATION        (1<<20) /* application (sequencer/editor) */
+
+/* misc. conditioning flags */
+#define SNDRV_SEQ_PORT_FLG_GIVEN_PORT  (1<<0)
+#define SNDRV_SEQ_PORT_FLG_TIMESTAMP   (1<<1)
+#define SNDRV_SEQ_PORT_FLG_TIME_REAL   (1<<2)
+
+struct snd_seq_port_info {
+       struct snd_seq_addr addr;       /* client/port numbers */
+       char name[64];                  /* port name */
+
+       unsigned int capability;        /* port capability bits */
+       unsigned int type;              /* port type bits */
+       int midi_channels;              /* channels per MIDI port */
+       int midi_voices;                /* voices per MIDI port */
+       int synth_voices;               /* voices per SYNTH port */
+
+       int read_use;                   /* R/O: subscribers for output (from this port) */
+       int write_use;                  /* R/O: subscribers for input (to this port) */
+
+       void *kernel;                   /* reserved for kernel use (must be NULL) */
+       unsigned int flags;             /* misc. conditioning */
+       unsigned char time_queue;       /* queue # for timestamping */
+       char reserved[59];              /* for future use */
+};
+
+
+/* queue flags */
+#define SNDRV_SEQ_QUEUE_FLG_SYNC       (1<<0)  /* sync enabled */
+
+/* queue information */
+struct snd_seq_queue_info {
+       int queue;              /* queue id */
+
+       /*
+        *  security settings, only owner of this queue can start/stop timer
+        *  etc. if the queue is locked for other clients
+        */
+       int owner;              /* client id for owner of the queue */
+       unsigned locked:1;      /* timing queue locked for other queues */
+       char name[64];          /* name of this queue */
+       unsigned int flags;     /* flags */
+       char reserved[60];      /* for future use */
+
+};
+
+/* queue info/status */
+struct snd_seq_queue_status {
+       int queue;                      /* queue id */
+       int events;                     /* read-only - queue size */
+       snd_seq_tick_time_t tick;       /* current tick */
+       struct snd_seq_real_time time;  /* current time */
+       int running;                    /* running state of queue */
+       int flags;                      /* various flags */
+       char reserved[64];              /* for the future */
+};
+
+
+/* queue tempo */
+struct snd_seq_queue_tempo {
+       int queue;                      /* sequencer queue */
+       unsigned int tempo;             /* current tempo, us/tick */
+       int ppq;                        /* time resolution, ticks/quarter */
+       unsigned int skew_value;        /* queue skew */
+       unsigned int skew_base;         /* queue skew base */
+       char reserved[24];              /* for the future */
+};
+
+
+/* sequencer timer sources */
+#define SNDRV_SEQ_TIMER_ALSA           0       /* ALSA timer */
+#define SNDRV_SEQ_TIMER_MIDI_CLOCK     1       /* Midi Clock (CLOCK event) */
+#define SNDRV_SEQ_TIMER_MIDI_TICK      2       /* Midi Timer Tick (TICK event) */
+
+/* queue timer info */
+struct snd_seq_queue_timer {
+       int queue;                      /* sequencer queue */
+       int type;                       /* source timer type */
+       union {
+               struct {
+                       struct snd_timer_id id; /* ALSA's timer ID */
+                       unsigned int resolution;        /* resolution in Hz */
+               } alsa;
+       } u;
+       char reserved[64];              /* for the future use */
+};
+
+
+struct snd_seq_queue_client {
+       int queue;              /* sequencer queue */
+       int client;             /* sequencer client */
+       int used;               /* queue is used with this client
+                                  (must be set for accepting events) */
+       /* per client watermarks */
+       char reserved[64];      /* for future use */
+};
+
+
+#define SNDRV_SEQ_PORT_SUBS_EXCLUSIVE  (1<<0)  /* exclusive connection */
+#define SNDRV_SEQ_PORT_SUBS_TIMESTAMP  (1<<1)
+#define SNDRV_SEQ_PORT_SUBS_TIME_REAL  (1<<2)
+
+struct snd_seq_port_subscribe {
+       struct snd_seq_addr sender;     /* sender address */
+       struct snd_seq_addr dest;       /* destination address */
+       unsigned int voices;            /* number of voices to be allocated (0 = don't care) */
+       unsigned int flags;             /* modes */
+       unsigned char queue;            /* input time-stamp queue (optional) */
+       unsigned char pad[3];           /* reserved */
+       char reserved[64];
+};
+
+/* type of query subscription */
+#define SNDRV_SEQ_QUERY_SUBS_READ      0
+#define SNDRV_SEQ_QUERY_SUBS_WRITE     1
+
+struct snd_seq_query_subs {
+       struct snd_seq_addr root;       /* client/port id to be searched */
+       int type;               /* READ or WRITE */
+       int index;              /* 0..N-1 */
+       int num_subs;           /* R/O: number of subscriptions on this port */
+       struct snd_seq_addr addr;       /* R/O: result */
+       unsigned char queue;    /* R/O: result */
+       unsigned int flags;     /* R/O: result */
+       char reserved[64];      /* for future use */
+};
+
+
+/*
+ *  IOCTL commands
+ */
+
+#define SNDRV_SEQ_IOCTL_PVERSION       _IOR ('S', 0x00, int)
+#define SNDRV_SEQ_IOCTL_CLIENT_ID      _IOR ('S', 0x01, int)
+#define SNDRV_SEQ_IOCTL_SYSTEM_INFO    _IOWR('S', 0x02, struct snd_seq_system_info)
+#define SNDRV_SEQ_IOCTL_RUNNING_MODE   _IOWR('S', 0x03, struct snd_seq_running_info)
+
+#define SNDRV_SEQ_IOCTL_GET_CLIENT_INFO        _IOWR('S', 0x10, struct snd_seq_client_info)
+#define SNDRV_SEQ_IOCTL_SET_CLIENT_INFO        _IOW ('S', 0x11, struct snd_seq_client_info)
+
+#define SNDRV_SEQ_IOCTL_CREATE_PORT    _IOWR('S', 0x20, struct snd_seq_port_info)
+#define SNDRV_SEQ_IOCTL_DELETE_PORT    _IOW ('S', 0x21, struct snd_seq_port_info)
+#define SNDRV_SEQ_IOCTL_GET_PORT_INFO  _IOWR('S', 0x22, struct snd_seq_port_info)
+#define SNDRV_SEQ_IOCTL_SET_PORT_INFO  _IOW ('S', 0x23, struct snd_seq_port_info)
+
+#define SNDRV_SEQ_IOCTL_SUBSCRIBE_PORT _IOW ('S', 0x30, struct snd_seq_port_subscribe)
+#define SNDRV_SEQ_IOCTL_UNSUBSCRIBE_PORT _IOW ('S', 0x31, struct snd_seq_port_subscribe)
+
+#define SNDRV_SEQ_IOCTL_CREATE_QUEUE   _IOWR('S', 0x32, struct snd_seq_queue_info)
+#define SNDRV_SEQ_IOCTL_DELETE_QUEUE   _IOW ('S', 0x33, struct snd_seq_queue_info)
+#define SNDRV_SEQ_IOCTL_GET_QUEUE_INFO _IOWR('S', 0x34, struct snd_seq_queue_info)
+#define SNDRV_SEQ_IOCTL_SET_QUEUE_INFO _IOWR('S', 0x35, struct snd_seq_queue_info)
+#define SNDRV_SEQ_IOCTL_GET_NAMED_QUEUE        _IOWR('S', 0x36, struct snd_seq_queue_info)
+#define SNDRV_SEQ_IOCTL_GET_QUEUE_STATUS _IOWR('S', 0x40, struct snd_seq_queue_status)
+#define SNDRV_SEQ_IOCTL_GET_QUEUE_TEMPO        _IOWR('S', 0x41, struct snd_seq_queue_tempo)
+#define SNDRV_SEQ_IOCTL_SET_QUEUE_TEMPO        _IOW ('S', 0x42, struct snd_seq_queue_tempo)
+#define SNDRV_SEQ_IOCTL_GET_QUEUE_OWNER        _IOWR('S', 0x43, struct snd_seq_queue_owner)
+#define SNDRV_SEQ_IOCTL_SET_QUEUE_OWNER        _IOW ('S', 0x44, struct snd_seq_queue_owner)
+#define SNDRV_SEQ_IOCTL_GET_QUEUE_TIMER        _IOWR('S', 0x45, struct snd_seq_queue_timer)
+#define SNDRV_SEQ_IOCTL_SET_QUEUE_TIMER        _IOW ('S', 0x46, struct snd_seq_queue_timer)
+/* XXX
+#define SNDRV_SEQ_IOCTL_GET_QUEUE_SYNC _IOWR('S', 0x53, struct snd_seq_queue_sync)
+#define SNDRV_SEQ_IOCTL_SET_QUEUE_SYNC _IOW ('S', 0x54, struct snd_seq_queue_sync)
+*/
+#define SNDRV_SEQ_IOCTL_GET_QUEUE_CLIENT       _IOWR('S', 0x49, struct snd_seq_queue_client)
+#define SNDRV_SEQ_IOCTL_SET_QUEUE_CLIENT       _IOW ('S', 0x4a, struct snd_seq_queue_client)
+#define SNDRV_SEQ_IOCTL_GET_CLIENT_POOL        _IOWR('S', 0x4b, struct snd_seq_client_pool)
+#define SNDRV_SEQ_IOCTL_SET_CLIENT_POOL        _IOW ('S', 0x4c, struct snd_seq_client_pool)
+#define SNDRV_SEQ_IOCTL_REMOVE_EVENTS  _IOW ('S', 0x4e, struct snd_seq_remove_events)
+#define SNDRV_SEQ_IOCTL_QUERY_SUBS     _IOWR('S', 0x4f, struct snd_seq_query_subs)
+#define SNDRV_SEQ_IOCTL_GET_SUBSCRIPTION       _IOWR('S', 0x50, struct snd_seq_port_subscribe)
+#define SNDRV_SEQ_IOCTL_QUERY_NEXT_CLIENT      _IOWR('S', 0x51, struct snd_seq_client_info)
+#define SNDRV_SEQ_IOCTL_QUERY_NEXT_PORT        _IOWR('S', 0x52, struct snd_seq_port_info)
+
+#endif /* _UAPI__SOUND_ASEQUENCER_H */
diff --git a/include/uapi/sound/asound.h b/include/uapi/sound/asound.h
new file mode 100644 (file)
index 0000000..515b8fc
--- /dev/null
@@ -0,0 +1,961 @@
+/*
+ *  Advanced Linux Sound Architecture - ALSA - Driver
+ *  Copyright (c) 1994-2003 by Jaroslav Kysela <perex@perex.cz>,
+ *                             Abramo Bagnara <abramo@alsa-project.org>
+ *
+ *
+ *   This program is free software; you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation; either version 2 of the License, or
+ *   (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+ *
+ */
+
+#ifndef _UAPI__SOUND_ASOUND_H
+#define _UAPI__SOUND_ASOUND_H
+
+#include <linux/types.h>
+
+
+/*
+ *  protocol version
+ */
+
+#define SNDRV_PROTOCOL_VERSION(major, minor, subminor) (((major)<<16)|((minor)<<8)|(subminor))
+#define SNDRV_PROTOCOL_MAJOR(version) (((version)>>16)&0xffff)
+#define SNDRV_PROTOCOL_MINOR(version) (((version)>>8)&0xff)
+#define SNDRV_PROTOCOL_MICRO(version) ((version)&0xff)
+#define SNDRV_PROTOCOL_INCOMPATIBLE(kversion, uversion) \
+       (SNDRV_PROTOCOL_MAJOR(kversion) != SNDRV_PROTOCOL_MAJOR(uversion) || \
+        (SNDRV_PROTOCOL_MAJOR(kversion) == SNDRV_PROTOCOL_MAJOR(uversion) && \
+          SNDRV_PROTOCOL_MINOR(kversion) != SNDRV_PROTOCOL_MINOR(uversion)))
+
+/****************************************************************************
+ *                                                                          *
+ *        Digital audio interface                                          *
+ *                                                                          *
+ ****************************************************************************/
+
+struct snd_aes_iec958 {
+       unsigned char status[24];       /* AES/IEC958 channel status bits */
+       unsigned char subcode[147];     /* AES/IEC958 subcode bits */
+       unsigned char pad;              /* nothing */
+       unsigned char dig_subframe[4];  /* AES/IEC958 subframe bits */
+};
+
+/****************************************************************************
+ *                                                                          *
+ *        CEA-861 Audio InfoFrame. Used in HDMI and DisplayPort                    *
+ *                                                                          *
+ ****************************************************************************/
+
+struct snd_cea_861_aud_if {
+       unsigned char db1_ct_cc; /* coding type and channel count */
+       unsigned char db2_sf_ss; /* sample frequency and size */
+       unsigned char db3; /* not used, all zeros */
+       unsigned char db4_ca; /* channel allocation code */
+       unsigned char db5_dminh_lsv; /* downmix inhibit & level-shit values */
+};
+
+/****************************************************************************
+ *                                                                          *
+ *      Section for driver hardware dependent interface - /dev/snd/hw?      *
+ *                                                                          *
+ ****************************************************************************/
+
+#define SNDRV_HWDEP_VERSION            SNDRV_PROTOCOL_VERSION(1, 0, 1)
+
+enum {
+       SNDRV_HWDEP_IFACE_OPL2 = 0,
+       SNDRV_HWDEP_IFACE_OPL3,
+       SNDRV_HWDEP_IFACE_OPL4,
+       SNDRV_HWDEP_IFACE_SB16CSP,      /* Creative Signal Processor */
+       SNDRV_HWDEP_IFACE_EMU10K1,      /* FX8010 processor in EMU10K1 chip */
+       SNDRV_HWDEP_IFACE_YSS225,       /* Yamaha FX processor */
+       SNDRV_HWDEP_IFACE_ICS2115,      /* Wavetable synth */
+       SNDRV_HWDEP_IFACE_SSCAPE,       /* Ensoniq SoundScape ISA card (MC68EC000) */
+       SNDRV_HWDEP_IFACE_VX,           /* Digigram VX cards */
+       SNDRV_HWDEP_IFACE_MIXART,       /* Digigram miXart cards */
+       SNDRV_HWDEP_IFACE_USX2Y,        /* Tascam US122, US224 & US428 usb */
+       SNDRV_HWDEP_IFACE_EMUX_WAVETABLE, /* EmuX wavetable */  
+       SNDRV_HWDEP_IFACE_BLUETOOTH,    /* Bluetooth audio */
+       SNDRV_HWDEP_IFACE_USX2Y_PCM,    /* Tascam US122, US224 & US428 rawusb pcm */
+       SNDRV_HWDEP_IFACE_PCXHR,        /* Digigram PCXHR */
+       SNDRV_HWDEP_IFACE_SB_RC,        /* SB Extigy/Audigy2NX remote control */
+       SNDRV_HWDEP_IFACE_HDA,          /* HD-audio */
+       SNDRV_HWDEP_IFACE_USB_STREAM,   /* direct access to usb stream */
+
+       /* Don't forget to change the following: */
+       SNDRV_HWDEP_IFACE_LAST = SNDRV_HWDEP_IFACE_USB_STREAM
+};
+
+struct snd_hwdep_info {
+       unsigned int device;            /* WR: device number */
+       int card;                       /* R: card number */
+       unsigned char id[64];           /* ID (user selectable) */
+       unsigned char name[80];         /* hwdep name */
+       int iface;                      /* hwdep interface */
+       unsigned char reserved[64];     /* reserved for future */
+};
+
+/* generic DSP loader */
+struct snd_hwdep_dsp_status {
+       unsigned int version;           /* R: driver-specific version */
+       unsigned char id[32];           /* R: driver-specific ID string */
+       unsigned int num_dsps;          /* R: number of DSP images to transfer */
+       unsigned int dsp_loaded;        /* R: bit flags indicating the loaded DSPs */
+       unsigned int chip_ready;        /* R: 1 = initialization finished */
+       unsigned char reserved[16];     /* reserved for future use */
+};
+
+struct snd_hwdep_dsp_image {
+       unsigned int index;             /* W: DSP index */
+       unsigned char name[64];         /* W: ID (e.g. file name) */
+       unsigned char __user *image;    /* W: binary image */
+       size_t length;                  /* W: size of image in bytes */
+       unsigned long driver_data;      /* W: driver-specific data */
+};
+
+#define SNDRV_HWDEP_IOCTL_PVERSION     _IOR ('H', 0x00, int)
+#define SNDRV_HWDEP_IOCTL_INFO         _IOR ('H', 0x01, struct snd_hwdep_info)
+#define SNDRV_HWDEP_IOCTL_DSP_STATUS   _IOR('H', 0x02, struct snd_hwdep_dsp_status)
+#define SNDRV_HWDEP_IOCTL_DSP_LOAD     _IOW('H', 0x03, struct snd_hwdep_dsp_image)
+
+/*****************************************************************************
+ *                                                                           *
+ *             Digital Audio (PCM) interface - /dev/snd/pcm??                *
+ *                                                                           *
+ *****************************************************************************/
+
+#define SNDRV_PCM_VERSION              SNDRV_PROTOCOL_VERSION(2, 0, 11)
+
+typedef unsigned long snd_pcm_uframes_t;
+typedef signed long snd_pcm_sframes_t;
+
+enum {
+       SNDRV_PCM_CLASS_GENERIC = 0,    /* standard mono or stereo device */
+       SNDRV_PCM_CLASS_MULTI,          /* multichannel device */
+       SNDRV_PCM_CLASS_MODEM,          /* software modem class */
+       SNDRV_PCM_CLASS_DIGITIZER,      /* digitizer class */
+       /* Don't forget to change the following: */
+       SNDRV_PCM_CLASS_LAST = SNDRV_PCM_CLASS_DIGITIZER,
+};
+
+enum {
+       SNDRV_PCM_SUBCLASS_GENERIC_MIX = 0, /* mono or stereo subdevices are mixed together */
+       SNDRV_PCM_SUBCLASS_MULTI_MIX,   /* multichannel subdevices are mixed together */
+       /* Don't forget to change the following: */
+       SNDRV_PCM_SUBCLASS_LAST = SNDRV_PCM_SUBCLASS_MULTI_MIX,
+};
+
+enum {
+       SNDRV_PCM_STREAM_PLAYBACK = 0,
+       SNDRV_PCM_STREAM_CAPTURE,
+       SNDRV_PCM_STREAM_LAST = SNDRV_PCM_STREAM_CAPTURE,
+};
+
+typedef int __bitwise snd_pcm_access_t;
+#define        SNDRV_PCM_ACCESS_MMAP_INTERLEAVED       ((__force snd_pcm_access_t) 0) /* interleaved mmap */
+#define        SNDRV_PCM_ACCESS_MMAP_NONINTERLEAVED    ((__force snd_pcm_access_t) 1) /* noninterleaved mmap */
+#define        SNDRV_PCM_ACCESS_MMAP_COMPLEX           ((__force snd_pcm_access_t) 2) /* complex mmap */
+#define        SNDRV_PCM_ACCESS_RW_INTERLEAVED         ((__force snd_pcm_access_t) 3) /* readi/writei */
+#define        SNDRV_PCM_ACCESS_RW_NONINTERLEAVED      ((__force snd_pcm_access_t) 4) /* readn/writen */
+#define        SNDRV_PCM_ACCESS_LAST           SNDRV_PCM_ACCESS_RW_NONINTERLEAVED
+
+typedef int __bitwise snd_pcm_format_t;
+#define        SNDRV_PCM_FORMAT_S8     ((__force snd_pcm_format_t) 0)
+#define        SNDRV_PCM_FORMAT_U8     ((__force snd_pcm_format_t) 1)
+#define        SNDRV_PCM_FORMAT_S16_LE ((__force snd_pcm_format_t) 2)
+#define        SNDRV_PCM_FORMAT_S16_BE ((__force snd_pcm_format_t) 3)
+#define        SNDRV_PCM_FORMAT_U16_LE ((__force snd_pcm_format_t) 4)
+#define        SNDRV_PCM_FORMAT_U16_BE ((__force snd_pcm_format_t) 5)
+#define        SNDRV_PCM_FORMAT_S24_LE ((__force snd_pcm_format_t) 6) /* low three bytes */
+#define        SNDRV_PCM_FORMAT_S24_BE ((__force snd_pcm_format_t) 7) /* low three bytes */
+#define        SNDRV_PCM_FORMAT_U24_LE ((__force snd_pcm_format_t) 8) /* low three bytes */
+#define        SNDRV_PCM_FORMAT_U24_BE ((__force snd_pcm_format_t) 9) /* low three bytes */
+#define        SNDRV_PCM_FORMAT_S32_LE ((__force snd_pcm_format_t) 10)
+#define        SNDRV_PCM_FORMAT_S32_BE ((__force snd_pcm_format_t) 11)
+#define        SNDRV_PCM_FORMAT_U32_LE ((__force snd_pcm_format_t) 12)
+#define        SNDRV_PCM_FORMAT_U32_BE ((__force snd_pcm_format_t) 13)
+#define        SNDRV_PCM_FORMAT_FLOAT_LE       ((__force snd_pcm_format_t) 14) /* 4-byte float, IEEE-754 32-bit, range -1.0 to 1.0 */
+#define        SNDRV_PCM_FORMAT_FLOAT_BE       ((__force snd_pcm_format_t) 15) /* 4-byte float, IEEE-754 32-bit, range -1.0 to 1.0 */
+#define        SNDRV_PCM_FORMAT_FLOAT64_LE     ((__force snd_pcm_format_t) 16) /* 8-byte float, IEEE-754 64-bit, range -1.0 to 1.0 */
+#define        SNDRV_PCM_FORMAT_FLOAT64_BE     ((__force snd_pcm_format_t) 17) /* 8-byte float, IEEE-754 64-bit, range -1.0 to 1.0 */
+#define        SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE ((__force snd_pcm_format_t) 18) /* IEC-958 subframe, Little Endian */
+#define        SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE ((__force snd_pcm_format_t) 19) /* IEC-958 subframe, Big Endian */
+#define        SNDRV_PCM_FORMAT_MU_LAW         ((__force snd_pcm_format_t) 20)
+#define        SNDRV_PCM_FORMAT_A_LAW          ((__force snd_pcm_format_t) 21)
+#define        SNDRV_PCM_FORMAT_IMA_ADPCM      ((__force snd_pcm_format_t) 22)
+#define        SNDRV_PCM_FORMAT_MPEG           ((__force snd_pcm_format_t) 23)
+#define        SNDRV_PCM_FORMAT_GSM            ((__force snd_pcm_format_t) 24)
+#define        SNDRV_PCM_FORMAT_SPECIAL        ((__force snd_pcm_format_t) 31)
+#define        SNDRV_PCM_FORMAT_S24_3LE        ((__force snd_pcm_format_t) 32) /* in three bytes */
+#define        SNDRV_PCM_FORMAT_S24_3BE        ((__force snd_pcm_format_t) 33) /* in three bytes */
+#define        SNDRV_PCM_FORMAT_U24_3LE        ((__force snd_pcm_format_t) 34) /* in three bytes */
+#define        SNDRV_PCM_FORMAT_U24_3BE        ((__force snd_pcm_format_t) 35) /* in three bytes */
+#define        SNDRV_PCM_FORMAT_S20_3LE        ((__force snd_pcm_format_t) 36) /* in three bytes */
+#define        SNDRV_PCM_FORMAT_S20_3BE        ((__force snd_pcm_format_t) 37) /* in three bytes */
+#define        SNDRV_PCM_FORMAT_U20_3LE        ((__force snd_pcm_format_t) 38) /* in three bytes */
+#define        SNDRV_PCM_FORMAT_U20_3BE        ((__force snd_pcm_format_t) 39) /* in three bytes */
+#define        SNDRV_PCM_FORMAT_S18_3LE        ((__force snd_pcm_format_t) 40) /* in three bytes */
+#define        SNDRV_PCM_FORMAT_S18_3BE        ((__force snd_pcm_format_t) 41) /* in three bytes */
+#define        SNDRV_PCM_FORMAT_U18_3LE        ((__force snd_pcm_format_t) 42) /* in three bytes */
+#define        SNDRV_PCM_FORMAT_U18_3BE        ((__force snd_pcm_format_t) 43) /* in three bytes */
+#define        SNDRV_PCM_FORMAT_G723_24        ((__force snd_pcm_format_t) 44) /* 8 samples in 3 bytes */
+#define        SNDRV_PCM_FORMAT_G723_24_1B     ((__force snd_pcm_format_t) 45) /* 1 sample in 1 byte */
+#define        SNDRV_PCM_FORMAT_G723_40        ((__force snd_pcm_format_t) 46) /* 8 Samples in 5 bytes */
+#define        SNDRV_PCM_FORMAT_G723_40_1B     ((__force snd_pcm_format_t) 47) /* 1 sample in 1 byte */
+#define        SNDRV_PCM_FORMAT_LAST           SNDRV_PCM_FORMAT_G723_40_1B
+
+#ifdef SNDRV_LITTLE_ENDIAN
+#define        SNDRV_PCM_FORMAT_S16            SNDRV_PCM_FORMAT_S16_LE
+#define        SNDRV_PCM_FORMAT_U16            SNDRV_PCM_FORMAT_U16_LE
+#define        SNDRV_PCM_FORMAT_S24            SNDRV_PCM_FORMAT_S24_LE
+#define        SNDRV_PCM_FORMAT_U24            SNDRV_PCM_FORMAT_U24_LE
+#define        SNDRV_PCM_FORMAT_S32            SNDRV_PCM_FORMAT_S32_LE
+#define        SNDRV_PCM_FORMAT_U32            SNDRV_PCM_FORMAT_U32_LE
+#define        SNDRV_PCM_FORMAT_FLOAT          SNDRV_PCM_FORMAT_FLOAT_LE
+#define        SNDRV_PCM_FORMAT_FLOAT64        SNDRV_PCM_FORMAT_FLOAT64_LE
+#define        SNDRV_PCM_FORMAT_IEC958_SUBFRAME SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE
+#endif
+#ifdef SNDRV_BIG_ENDIAN
+#define        SNDRV_PCM_FORMAT_S16            SNDRV_PCM_FORMAT_S16_BE
+#define        SNDRV_PCM_FORMAT_U16            SNDRV_PCM_FORMAT_U16_BE
+#define        SNDRV_PCM_FORMAT_S24            SNDRV_PCM_FORMAT_S24_BE
+#define        SNDRV_PCM_FORMAT_U24            SNDRV_PCM_FORMAT_U24_BE
+#define        SNDRV_PCM_FORMAT_S32            SNDRV_PCM_FORMAT_S32_BE
+#define        SNDRV_PCM_FORMAT_U32            SNDRV_PCM_FORMAT_U32_BE
+#define        SNDRV_PCM_FORMAT_FLOAT          SNDRV_PCM_FORMAT_FLOAT_BE
+#define        SNDRV_PCM_FORMAT_FLOAT64        SNDRV_PCM_FORMAT_FLOAT64_BE
+#define        SNDRV_PCM_FORMAT_IEC958_SUBFRAME SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE
+#endif
+
+typedef int __bitwise snd_pcm_subformat_t;
+#define        SNDRV_PCM_SUBFORMAT_STD         ((__force snd_pcm_subformat_t) 0)
+#define        SNDRV_PCM_SUBFORMAT_LAST        SNDRV_PCM_SUBFORMAT_STD
+
+#define SNDRV_PCM_INFO_MMAP            0x00000001      /* hardware supports mmap */
+#define SNDRV_PCM_INFO_MMAP_VALID      0x00000002      /* period data are valid during transfer */
+#define SNDRV_PCM_INFO_DOUBLE          0x00000004      /* Double buffering needed for PCM start/stop */
+#define SNDRV_PCM_INFO_BATCH           0x00000010      /* double buffering */
+#define SNDRV_PCM_INFO_INTERLEAVED     0x00000100      /* channels are interleaved */
+#define SNDRV_PCM_INFO_NONINTERLEAVED  0x00000200      /* channels are not interleaved */
+#define SNDRV_PCM_INFO_COMPLEX         0x00000400      /* complex frame organization (mmap only) */
+#define SNDRV_PCM_INFO_BLOCK_TRANSFER  0x00010000      /* hardware transfer block of samples */
+#define SNDRV_PCM_INFO_OVERRANGE       0x00020000      /* hardware supports ADC (capture) overrange detection */
+#define SNDRV_PCM_INFO_RESUME          0x00040000      /* hardware supports stream resume after suspend */
+#define SNDRV_PCM_INFO_PAUSE           0x00080000      /* pause ioctl is supported */
+#define SNDRV_PCM_INFO_HALF_DUPLEX     0x00100000      /* only half duplex */
+#define SNDRV_PCM_INFO_JOINT_DUPLEX    0x00200000      /* playback and capture stream are somewhat correlated */
+#define SNDRV_PCM_INFO_SYNC_START      0x00400000      /* pcm support some kind of sync go */
+#define SNDRV_PCM_INFO_NO_PERIOD_WAKEUP        0x00800000      /* period wakeup can be disabled */
+#define SNDRV_PCM_INFO_HAS_WALL_CLOCK   0x01000000      /* has audio wall clock for audio/system time sync */
+#define SNDRV_PCM_INFO_FIFO_IN_FRAMES  0x80000000      /* internal kernel flag - FIFO size is in frames */
+
+typedef int __bitwise snd_pcm_state_t;
+#define        SNDRV_PCM_STATE_OPEN            ((__force snd_pcm_state_t) 0) /* stream is open */
+#define        SNDRV_PCM_STATE_SETUP           ((__force snd_pcm_state_t) 1) /* stream has a setup */
+#define        SNDRV_PCM_STATE_PREPARED        ((__force snd_pcm_state_t) 2) /* stream is ready to start */
+#define        SNDRV_PCM_STATE_RUNNING         ((__force snd_pcm_state_t) 3) /* stream is running */
+#define        SNDRV_PCM_STATE_XRUN            ((__force snd_pcm_state_t) 4) /* stream reached an xrun */
+#define        SNDRV_PCM_STATE_DRAINING        ((__force snd_pcm_state_t) 5) /* stream is draining */
+#define        SNDRV_PCM_STATE_PAUSED          ((__force snd_pcm_state_t) 6) /* stream is paused */
+#define        SNDRV_PCM_STATE_SUSPENDED       ((__force snd_pcm_state_t) 7) /* hardware is suspended */
+#define        SNDRV_PCM_STATE_DISCONNECTED    ((__force snd_pcm_state_t) 8) /* hardware is disconnected */
+#define        SNDRV_PCM_STATE_LAST            SNDRV_PCM_STATE_DISCONNECTED
+
+enum {
+       SNDRV_PCM_MMAP_OFFSET_DATA = 0x00000000,
+       SNDRV_PCM_MMAP_OFFSET_STATUS = 0x80000000,
+       SNDRV_PCM_MMAP_OFFSET_CONTROL = 0x81000000,
+};
+
+union snd_pcm_sync_id {
+       unsigned char id[16];
+       unsigned short id16[8];
+       unsigned int id32[4];
+};
+
+struct snd_pcm_info {
+       unsigned int device;            /* RO/WR (control): device number */
+       unsigned int subdevice;         /* RO/WR (control): subdevice number */
+       int stream;                     /* RO/WR (control): stream direction */
+       int card;                       /* R: card number */
+       unsigned char id[64];           /* ID (user selectable) */
+       unsigned char name[80];         /* name of this device */
+       unsigned char subname[32];      /* subdevice name */
+       int dev_class;                  /* SNDRV_PCM_CLASS_* */
+       int dev_subclass;               /* SNDRV_PCM_SUBCLASS_* */
+       unsigned int subdevices_count;
+       unsigned int subdevices_avail;
+       union snd_pcm_sync_id sync;     /* hardware synchronization ID */
+       unsigned char reserved[64];     /* reserved for future... */
+};
+
+typedef int snd_pcm_hw_param_t;
+#define        SNDRV_PCM_HW_PARAM_ACCESS       0       /* Access type */
+#define        SNDRV_PCM_HW_PARAM_FORMAT       1       /* Format */
+#define        SNDRV_PCM_HW_PARAM_SUBFORMAT    2       /* Subformat */
+#define        SNDRV_PCM_HW_PARAM_FIRST_MASK   SNDRV_PCM_HW_PARAM_ACCESS
+#define        SNDRV_PCM_HW_PARAM_LAST_MASK    SNDRV_PCM_HW_PARAM_SUBFORMAT
+
+#define        SNDRV_PCM_HW_PARAM_SAMPLE_BITS  8       /* Bits per sample */
+#define        SNDRV_PCM_HW_PARAM_FRAME_BITS   9       /* Bits per frame */
+#define        SNDRV_PCM_HW_PARAM_CHANNELS     10      /* Channels */
+#define        SNDRV_PCM_HW_PARAM_RATE         11      /* Approx rate */
+#define        SNDRV_PCM_HW_PARAM_PERIOD_TIME  12      /* Approx distance between
+                                                * interrupts in us
+                                                */
+#define        SNDRV_PCM_HW_PARAM_PERIOD_SIZE  13      /* Approx frames between
+                                                * interrupts
+                                                */
+#define        SNDRV_PCM_HW_PARAM_PERIOD_BYTES 14      /* Approx bytes between
+                                                * interrupts
+                                                */
+#define        SNDRV_PCM_HW_PARAM_PERIODS      15      /* Approx interrupts per
+                                                * buffer
+                                                */
+#define        SNDRV_PCM_HW_PARAM_BUFFER_TIME  16      /* Approx duration of buffer
+                                                * in us
+                                                */
+#define        SNDRV_PCM_HW_PARAM_BUFFER_SIZE  17      /* Size of buffer in frames */
+#define        SNDRV_PCM_HW_PARAM_BUFFER_BYTES 18      /* Size of buffer in bytes */
+#define        SNDRV_PCM_HW_PARAM_TICK_TIME    19      /* Approx tick duration in us */
+#define        SNDRV_PCM_HW_PARAM_FIRST_INTERVAL       SNDRV_PCM_HW_PARAM_SAMPLE_BITS
+#define        SNDRV_PCM_HW_PARAM_LAST_INTERVAL        SNDRV_PCM_HW_PARAM_TICK_TIME
+
+#define SNDRV_PCM_HW_PARAMS_NORESAMPLE (1<<0)  /* avoid rate resampling */
+#define SNDRV_PCM_HW_PARAMS_EXPORT_BUFFER      (1<<1)  /* export buffer */
+#define SNDRV_PCM_HW_PARAMS_NO_PERIOD_WAKEUP   (1<<2)  /* disable period wakeups */
+
+struct snd_interval {
+       unsigned int min, max;
+       unsigned int openmin:1,
+                    openmax:1,
+                    integer:1,
+                    empty:1;
+};
+
+#define SNDRV_MASK_MAX 256
+
+struct snd_mask {
+       __u32 bits[(SNDRV_MASK_MAX+31)/32];
+};
+
+struct snd_pcm_hw_params {
+       unsigned int flags;
+       struct snd_mask masks[SNDRV_PCM_HW_PARAM_LAST_MASK - 
+                              SNDRV_PCM_HW_PARAM_FIRST_MASK + 1];
+       struct snd_mask mres[5];        /* reserved masks */
+       struct snd_interval intervals[SNDRV_PCM_HW_PARAM_LAST_INTERVAL -
+                                       SNDRV_PCM_HW_PARAM_FIRST_INTERVAL + 1];
+       struct snd_interval ires[9];    /* reserved intervals */
+       unsigned int rmask;             /* W: requested masks */
+       unsigned int cmask;             /* R: changed masks */
+       unsigned int info;              /* R: Info flags for returned setup */
+       unsigned int msbits;            /* R: used most significant bits */
+       unsigned int rate_num;          /* R: rate numerator */
+       unsigned int rate_den;          /* R: rate denominator */
+       snd_pcm_uframes_t fifo_size;    /* R: chip FIFO size in frames */
+       unsigned char reserved[64];     /* reserved for future */
+};
+
+enum {
+       SNDRV_PCM_TSTAMP_NONE = 0,
+       SNDRV_PCM_TSTAMP_ENABLE,
+       SNDRV_PCM_TSTAMP_LAST = SNDRV_PCM_TSTAMP_ENABLE,
+};
+
+struct snd_pcm_sw_params {
+       int tstamp_mode;                        /* timestamp mode */
+       unsigned int period_step;
+       unsigned int sleep_min;                 /* min ticks to sleep */
+       snd_pcm_uframes_t avail_min;            /* min avail frames for wakeup */
+       snd_pcm_uframes_t xfer_align;           /* obsolete: xfer size need to be a multiple */
+       snd_pcm_uframes_t start_threshold;      /* min hw_avail frames for automatic start */
+       snd_pcm_uframes_t stop_threshold;       /* min avail frames for automatic stop */
+       snd_pcm_uframes_t silence_threshold;    /* min distance from noise for silence filling */
+       snd_pcm_uframes_t silence_size;         /* silence block size */
+       snd_pcm_uframes_t boundary;             /* pointers wrap point */
+       unsigned char reserved[64];             /* reserved for future */
+};
+
+struct snd_pcm_channel_info {
+       unsigned int channel;
+       __kernel_off_t offset;          /* mmap offset */
+       unsigned int first;             /* offset to first sample in bits */
+       unsigned int step;              /* samples distance in bits */
+};
+
+struct snd_pcm_status {
+       snd_pcm_state_t state;          /* stream state */
+       struct timespec trigger_tstamp; /* time when stream was started/stopped/paused */
+       struct timespec tstamp;         /* reference timestamp */
+       snd_pcm_uframes_t appl_ptr;     /* appl ptr */
+       snd_pcm_uframes_t hw_ptr;       /* hw ptr */
+       snd_pcm_sframes_t delay;        /* current delay in frames */
+       snd_pcm_uframes_t avail;        /* number of frames available */
+       snd_pcm_uframes_t avail_max;    /* max frames available on hw since last status */
+       snd_pcm_uframes_t overrange;    /* count of ADC (capture) overrange detections from last status */
+       snd_pcm_state_t suspended_state; /* suspended stream state */
+       __u32 reserved_alignment;       /* must be filled with zero */
+       struct timespec audio_tstamp;   /* from sample counter or wall clock */
+       unsigned char reserved[56-sizeof(struct timespec)]; /* must be filled with zero */
+};
+
+struct snd_pcm_mmap_status {
+       snd_pcm_state_t state;          /* RO: state - SNDRV_PCM_STATE_XXXX */
+       int pad1;                       /* Needed for 64 bit alignment */
+       snd_pcm_uframes_t hw_ptr;       /* RO: hw ptr (0...boundary-1) */
+       struct timespec tstamp;         /* Timestamp */
+       snd_pcm_state_t suspended_state; /* RO: suspended stream state */
+       struct timespec audio_tstamp;   /* from sample counter or wall clock */
+};
+
+struct snd_pcm_mmap_control {
+       snd_pcm_uframes_t appl_ptr;     /* RW: appl ptr (0...boundary-1) */
+       snd_pcm_uframes_t avail_min;    /* RW: min available frames for wakeup */
+};
+
+#define SNDRV_PCM_SYNC_PTR_HWSYNC      (1<<0)  /* execute hwsync */
+#define SNDRV_PCM_SYNC_PTR_APPL                (1<<1)  /* get appl_ptr from driver (r/w op) */
+#define SNDRV_PCM_SYNC_PTR_AVAIL_MIN   (1<<2)  /* get avail_min from driver */
+
+struct snd_pcm_sync_ptr {
+       unsigned int flags;
+       union {
+               struct snd_pcm_mmap_status status;
+               unsigned char reserved[64];
+       } s;
+       union {
+               struct snd_pcm_mmap_control control;
+               unsigned char reserved[64];
+       } c;
+};
+
+struct snd_xferi {
+       snd_pcm_sframes_t result;
+       void __user *buf;
+       snd_pcm_uframes_t frames;
+};
+
+struct snd_xfern {
+       snd_pcm_sframes_t result;
+       void __user * __user *bufs;
+       snd_pcm_uframes_t frames;
+};
+
+enum {
+       SNDRV_PCM_TSTAMP_TYPE_GETTIMEOFDAY = 0, /* gettimeofday equivalent */
+       SNDRV_PCM_TSTAMP_TYPE_MONOTONIC,        /* posix_clock_monotonic equivalent */
+       SNDRV_PCM_TSTAMP_TYPE_LAST = SNDRV_PCM_TSTAMP_TYPE_MONOTONIC,
+};
+
+/* channel positions */
+enum {
+       SNDRV_CHMAP_UNKNOWN = 0,
+       SNDRV_CHMAP_NA,         /* N/A, silent */
+       SNDRV_CHMAP_MONO,       /* mono stream */
+       /* this follows the alsa-lib mixer channel value + 3 */
+       SNDRV_CHMAP_FL,         /* front left */
+       SNDRV_CHMAP_FR,         /* front right */
+       SNDRV_CHMAP_RL,         /* rear left */
+       SNDRV_CHMAP_RR,         /* rear right */
+       SNDRV_CHMAP_FC,         /* front center */
+       SNDRV_CHMAP_LFE,        /* LFE */
+       SNDRV_CHMAP_SL,         /* side left */
+       SNDRV_CHMAP_SR,         /* side right */
+       SNDRV_CHMAP_RC,         /* rear center */
+       /* new definitions */
+       SNDRV_CHMAP_FLC,        /* front left center */
+       SNDRV_CHMAP_FRC,        /* front right center */
+       SNDRV_CHMAP_RLC,        /* rear left center */
+       SNDRV_CHMAP_RRC,        /* rear right center */
+       SNDRV_CHMAP_FLW,        /* front left wide */
+       SNDRV_CHMAP_FRW,        /* front right wide */
+       SNDRV_CHMAP_FLH,        /* front left high */
+       SNDRV_CHMAP_FCH,        /* front center high */
+       SNDRV_CHMAP_FRH,        /* front right high */
+       SNDRV_CHMAP_TC,         /* top center */
+       SNDRV_CHMAP_TFL,        /* top front left */
+       SNDRV_CHMAP_TFR,        /* top front right */
+       SNDRV_CHMAP_TFC,        /* top front center */
+       SNDRV_CHMAP_TRL,        /* top rear left */
+       SNDRV_CHMAP_TRR,        /* top rear right */
+       SNDRV_CHMAP_TRC,        /* top rear center */
+       SNDRV_CHMAP_LAST = SNDRV_CHMAP_TRC,
+};
+
+#define SNDRV_CHMAP_POSITION_MASK      0xffff
+#define SNDRV_CHMAP_PHASE_INVERSE      (0x01 << 16)
+#define SNDRV_CHMAP_DRIVER_SPEC                (0x02 << 16)
+
+#define SNDRV_PCM_IOCTL_PVERSION       _IOR('A', 0x00, int)
+#define SNDRV_PCM_IOCTL_INFO           _IOR('A', 0x01, struct snd_pcm_info)
+#define SNDRV_PCM_IOCTL_TSTAMP         _IOW('A', 0x02, int)
+#define SNDRV_PCM_IOCTL_TTSTAMP                _IOW('A', 0x03, int)
+#define SNDRV_PCM_IOCTL_HW_REFINE      _IOWR('A', 0x10, struct snd_pcm_hw_params)
+#define SNDRV_PCM_IOCTL_HW_PARAMS      _IOWR('A', 0x11, struct snd_pcm_hw_params)
+#define SNDRV_PCM_IOCTL_HW_FREE                _IO('A', 0x12)
+#define SNDRV_PCM_IOCTL_SW_PARAMS      _IOWR('A', 0x13, struct snd_pcm_sw_params)
+#define SNDRV_PCM_IOCTL_STATUS         _IOR('A', 0x20, struct snd_pcm_status)
+#define SNDRV_PCM_IOCTL_DELAY          _IOR('A', 0x21, snd_pcm_sframes_t)
+#define SNDRV_PCM_IOCTL_HWSYNC         _IO('A', 0x22)
+#define SNDRV_PCM_IOCTL_SYNC_PTR       _IOWR('A', 0x23, struct snd_pcm_sync_ptr)
+#define SNDRV_PCM_IOCTL_CHANNEL_INFO   _IOR('A', 0x32, struct snd_pcm_channel_info)
+#define SNDRV_PCM_IOCTL_PREPARE                _IO('A', 0x40)
+#define SNDRV_PCM_IOCTL_RESET          _IO('A', 0x41)
+#define SNDRV_PCM_IOCTL_START          _IO('A', 0x42)
+#define SNDRV_PCM_IOCTL_DROP           _IO('A', 0x43)
+#define SNDRV_PCM_IOCTL_DRAIN          _IO('A', 0x44)
+#define SNDRV_PCM_IOCTL_PAUSE          _IOW('A', 0x45, int)
+#define SNDRV_PCM_IOCTL_REWIND         _IOW('A', 0x46, snd_pcm_uframes_t)
+#define SNDRV_PCM_IOCTL_RESUME         _IO('A', 0x47)
+#define SNDRV_PCM_IOCTL_XRUN           _IO('A', 0x48)
+#define SNDRV_PCM_IOCTL_FORWARD                _IOW('A', 0x49, snd_pcm_uframes_t)
+#define SNDRV_PCM_IOCTL_WRITEI_FRAMES  _IOW('A', 0x50, struct snd_xferi)
+#define SNDRV_PCM_IOCTL_READI_FRAMES   _IOR('A', 0x51, struct snd_xferi)
+#define SNDRV_PCM_IOCTL_WRITEN_FRAMES  _IOW('A', 0x52, struct snd_xfern)
+#define SNDRV_PCM_IOCTL_READN_FRAMES   _IOR('A', 0x53, struct snd_xfern)
+#define SNDRV_PCM_IOCTL_LINK           _IOW('A', 0x60, int)
+#define SNDRV_PCM_IOCTL_UNLINK         _IO('A', 0x61)
+
+/*****************************************************************************
+ *                                                                           *
+ *                            MIDI v1.0 interface                            *
+ *                                                                           *
+ *****************************************************************************/
+
+/*
+ *  Raw MIDI section - /dev/snd/midi??
+ */
+
+#define SNDRV_RAWMIDI_VERSION          SNDRV_PROTOCOL_VERSION(2, 0, 0)
+
+enum {
+       SNDRV_RAWMIDI_STREAM_OUTPUT = 0,
+       SNDRV_RAWMIDI_STREAM_INPUT,
+       SNDRV_RAWMIDI_STREAM_LAST = SNDRV_RAWMIDI_STREAM_INPUT,
+};
+
+#define SNDRV_RAWMIDI_INFO_OUTPUT              0x00000001
+#define SNDRV_RAWMIDI_INFO_INPUT               0x00000002
+#define SNDRV_RAWMIDI_INFO_DUPLEX              0x00000004
+
+struct snd_rawmidi_info {
+       unsigned int device;            /* RO/WR (control): device number */
+       unsigned int subdevice;         /* RO/WR (control): subdevice number */
+       int stream;                     /* WR: stream */
+       int card;                       /* R: card number */
+       unsigned int flags;             /* SNDRV_RAWMIDI_INFO_XXXX */
+       unsigned char id[64];           /* ID (user selectable) */
+       unsigned char name[80];         /* name of device */
+       unsigned char subname[32];      /* name of active or selected subdevice */
+       unsigned int subdevices_count;
+       unsigned int subdevices_avail;
+       unsigned char reserved[64];     /* reserved for future use */
+};
+
+struct snd_rawmidi_params {
+       int stream;
+       size_t buffer_size;             /* queue size in bytes */
+       size_t avail_min;               /* minimum avail bytes for wakeup */
+       unsigned int no_active_sensing: 1; /* do not send active sensing byte in close() */
+       unsigned char reserved[16];     /* reserved for future use */
+};
+
+struct snd_rawmidi_status {
+       int stream;
+       struct timespec tstamp;         /* Timestamp */
+       size_t avail;                   /* available bytes */
+       size_t xruns;                   /* count of overruns since last status (in bytes) */
+       unsigned char reserved[16];     /* reserved for future use */
+};
+
+#define SNDRV_RAWMIDI_IOCTL_PVERSION   _IOR('W', 0x00, int)
+#define SNDRV_RAWMIDI_IOCTL_INFO       _IOR('W', 0x01, struct snd_rawmidi_info)
+#define SNDRV_RAWMIDI_IOCTL_PARAMS     _IOWR('W', 0x10, struct snd_rawmidi_params)
+#define SNDRV_RAWMIDI_IOCTL_STATUS     _IOWR('W', 0x20, struct snd_rawmidi_status)
+#define SNDRV_RAWMIDI_IOCTL_DROP       _IOW('W', 0x30, int)
+#define SNDRV_RAWMIDI_IOCTL_DRAIN      _IOW('W', 0x31, int)
+
+/*
+ *  Timer section - /dev/snd/timer
+ */
+
+#define SNDRV_TIMER_VERSION            SNDRV_PROTOCOL_VERSION(2, 0, 6)
+
+enum {
+       SNDRV_TIMER_CLASS_NONE = -1,
+       SNDRV_TIMER_CLASS_SLAVE = 0,
+       SNDRV_TIMER_CLASS_GLOBAL,
+       SNDRV_TIMER_CLASS_CARD,
+       SNDRV_TIMER_CLASS_PCM,
+       SNDRV_TIMER_CLASS_LAST = SNDRV_TIMER_CLASS_PCM,
+};
+
+/* slave timer classes */
+enum {
+       SNDRV_TIMER_SCLASS_NONE = 0,
+       SNDRV_TIMER_SCLASS_APPLICATION,
+       SNDRV_TIMER_SCLASS_SEQUENCER,           /* alias */
+       SNDRV_TIMER_SCLASS_OSS_SEQUENCER,       /* alias */
+       SNDRV_TIMER_SCLASS_LAST = SNDRV_TIMER_SCLASS_OSS_SEQUENCER,
+};
+
+/* global timers (device member) */
+#define SNDRV_TIMER_GLOBAL_SYSTEM      0
+#define SNDRV_TIMER_GLOBAL_RTC         1
+#define SNDRV_TIMER_GLOBAL_HPET                2
+#define SNDRV_TIMER_GLOBAL_HRTIMER     3
+
+/* info flags */
+#define SNDRV_TIMER_FLG_SLAVE          (1<<0)  /* cannot be controlled */
+
+struct snd_timer_id {
+       int dev_class;
+       int dev_sclass;
+       int card;
+       int device;
+       int subdevice;
+};
+
+struct snd_timer_ginfo {
+       struct snd_timer_id tid;        /* requested timer ID */
+       unsigned int flags;             /* timer flags - SNDRV_TIMER_FLG_* */
+       int card;                       /* card number */
+       unsigned char id[64];           /* timer identification */
+       unsigned char name[80];         /* timer name */
+       unsigned long reserved0;        /* reserved for future use */
+       unsigned long resolution;       /* average period resolution in ns */
+       unsigned long resolution_min;   /* minimal period resolution in ns */
+       unsigned long resolution_max;   /* maximal period resolution in ns */
+       unsigned int clients;           /* active timer clients */
+       unsigned char reserved[32];
+};
+
+struct snd_timer_gparams {
+       struct snd_timer_id tid;        /* requested timer ID */
+       unsigned long period_num;       /* requested precise period duration (in seconds) - numerator */
+       unsigned long period_den;       /* requested precise period duration (in seconds) - denominator */
+       unsigned char reserved[32];
+};
+
+struct snd_timer_gstatus {
+       struct snd_timer_id tid;        /* requested timer ID */
+       unsigned long resolution;       /* current period resolution in ns */
+       unsigned long resolution_num;   /* precise current period resolution (in seconds) - numerator */
+       unsigned long resolution_den;   /* precise current period resolution (in seconds) - denominator */
+       unsigned char reserved[32];
+};
+
+struct snd_timer_select {
+       struct snd_timer_id id; /* bind to timer ID */
+       unsigned char reserved[32];     /* reserved */
+};
+
+struct snd_timer_info {
+       unsigned int flags;             /* timer flags - SNDRV_TIMER_FLG_* */
+       int card;                       /* card number */
+       unsigned char id[64];           /* timer identificator */
+       unsigned char name[80];         /* timer name */
+       unsigned long reserved0;        /* reserved for future use */
+       unsigned long resolution;       /* average period resolution in ns */
+       unsigned char reserved[64];     /* reserved */
+};
+
+#define SNDRV_TIMER_PSFLG_AUTO         (1<<0)  /* auto start, otherwise one-shot */
+#define SNDRV_TIMER_PSFLG_EXCLUSIVE    (1<<1)  /* exclusive use, precise start/stop/pause/continue */
+#define SNDRV_TIMER_PSFLG_EARLY_EVENT  (1<<2)  /* write early event to the poll queue */
+
+struct snd_timer_params {
+       unsigned int flags;             /* flags - SNDRV_MIXER_PSFLG_* */
+       unsigned int ticks;             /* requested resolution in ticks */
+       unsigned int queue_size;        /* total size of queue (32-1024) */
+       unsigned int reserved0;         /* reserved, was: failure locations */
+       unsigned int filter;            /* event filter (bitmask of SNDRV_TIMER_EVENT_*) */
+       unsigned char reserved[60];     /* reserved */
+};
+
+struct snd_timer_status {
+       struct timespec tstamp;         /* Timestamp - last update */
+       unsigned int resolution;        /* current period resolution in ns */
+       unsigned int lost;              /* counter of master tick lost */
+       unsigned int overrun;           /* count of read queue overruns */
+       unsigned int queue;             /* used queue size */
+       unsigned char reserved[64];     /* reserved */
+};
+
+#define SNDRV_TIMER_IOCTL_PVERSION     _IOR('T', 0x00, int)
+#define SNDRV_TIMER_IOCTL_NEXT_DEVICE  _IOWR('T', 0x01, struct snd_timer_id)
+#define SNDRV_TIMER_IOCTL_TREAD                _IOW('T', 0x02, int)
+#define SNDRV_TIMER_IOCTL_GINFO                _IOWR('T', 0x03, struct snd_timer_ginfo)
+#define SNDRV_TIMER_IOCTL_GPARAMS      _IOW('T', 0x04, struct snd_timer_gparams)
+#define SNDRV_TIMER_IOCTL_GSTATUS      _IOWR('T', 0x05, struct snd_timer_gstatus)
+#define SNDRV_TIMER_IOCTL_SELECT       _IOW('T', 0x10, struct snd_timer_select)
+#define SNDRV_TIMER_IOCTL_INFO         _IOR('T', 0x11, struct snd_timer_info)
+#define SNDRV_TIMER_IOCTL_PARAMS       _IOW('T', 0x12, struct snd_timer_params)
+#define SNDRV_TIMER_IOCTL_STATUS       _IOR('T', 0x14, struct snd_timer_status)
+/* The following four ioctls are changed since 1.0.9 due to confliction */
+#define SNDRV_TIMER_IOCTL_START                _IO('T', 0xa0)
+#define SNDRV_TIMER_IOCTL_STOP         _IO('T', 0xa1)
+#define SNDRV_TIMER_IOCTL_CONTINUE     _IO('T', 0xa2)
+#define SNDRV_TIMER_IOCTL_PAUSE                _IO('T', 0xa3)
+
+struct snd_timer_read {
+       unsigned int resolution;
+       unsigned int ticks;
+};
+
+enum {
+       SNDRV_TIMER_EVENT_RESOLUTION = 0,       /* val = resolution in ns */
+       SNDRV_TIMER_EVENT_TICK,                 /* val = ticks */
+       SNDRV_TIMER_EVENT_START,                /* val = resolution in ns */
+       SNDRV_TIMER_EVENT_STOP,                 /* val = 0 */
+       SNDRV_TIMER_EVENT_CONTINUE,             /* val = resolution in ns */
+       SNDRV_TIMER_EVENT_PAUSE,                /* val = 0 */
+       SNDRV_TIMER_EVENT_EARLY,                /* val = 0, early event */
+       SNDRV_TIMER_EVENT_SUSPEND,              /* val = 0 */
+       SNDRV_TIMER_EVENT_RESUME,               /* val = resolution in ns */
+       /* master timer events for slave timer instances */
+       SNDRV_TIMER_EVENT_MSTART = SNDRV_TIMER_EVENT_START + 10,
+       SNDRV_TIMER_EVENT_MSTOP = SNDRV_TIMER_EVENT_STOP + 10,
+       SNDRV_TIMER_EVENT_MCONTINUE = SNDRV_TIMER_EVENT_CONTINUE + 10,
+       SNDRV_TIMER_EVENT_MPAUSE = SNDRV_TIMER_EVENT_PAUSE + 10,
+       SNDRV_TIMER_EVENT_MSUSPEND = SNDRV_TIMER_EVENT_SUSPEND + 10,
+       SNDRV_TIMER_EVENT_MRESUME = SNDRV_TIMER_EVENT_RESUME + 10,
+};
+
+struct snd_timer_tread {
+       int event;
+       struct timespec tstamp;
+       unsigned int val;
+};
+
+/****************************************************************************
+ *                                                                          *
+ *        Section for driver control interface - /dev/snd/control?          *
+ *                                                                          *
+ ****************************************************************************/
+
+#define SNDRV_CTL_VERSION              SNDRV_PROTOCOL_VERSION(2, 0, 7)
+
+struct snd_ctl_card_info {
+       int card;                       /* card number */
+       int pad;                        /* reserved for future (was type) */
+       unsigned char id[16];           /* ID of card (user selectable) */
+       unsigned char driver[16];       /* Driver name */
+       unsigned char name[32];         /* Short name of soundcard */
+       unsigned char longname[80];     /* name + info text about soundcard */
+       unsigned char reserved_[16];    /* reserved for future (was ID of mixer) */
+       unsigned char mixername[80];    /* visual mixer identification */
+       unsigned char components[128];  /* card components / fine identification, delimited with one space (AC97 etc..) */
+};
+
+typedef int __bitwise snd_ctl_elem_type_t;
+#define        SNDRV_CTL_ELEM_TYPE_NONE        ((__force snd_ctl_elem_type_t) 0) /* invalid */
+#define        SNDRV_CTL_ELEM_TYPE_BOOLEAN     ((__force snd_ctl_elem_type_t) 1) /* boolean type */
+#define        SNDRV_CTL_ELEM_TYPE_INTEGER     ((__force snd_ctl_elem_type_t) 2) /* integer type */
+#define        SNDRV_CTL_ELEM_TYPE_ENUMERATED  ((__force snd_ctl_elem_type_t) 3) /* enumerated type */
+#define        SNDRV_CTL_ELEM_TYPE_BYTES       ((__force snd_ctl_elem_type_t) 4) /* byte array */
+#define        SNDRV_CTL_ELEM_TYPE_IEC958      ((__force snd_ctl_elem_type_t) 5) /* IEC958 (S/PDIF) setup */
+#define        SNDRV_CTL_ELEM_TYPE_INTEGER64   ((__force snd_ctl_elem_type_t) 6) /* 64-bit integer type */
+#define        SNDRV_CTL_ELEM_TYPE_LAST        SNDRV_CTL_ELEM_TYPE_INTEGER64
+
+typedef int __bitwise snd_ctl_elem_iface_t;
+#define        SNDRV_CTL_ELEM_IFACE_CARD       ((__force snd_ctl_elem_iface_t) 0) /* global control */
+#define        SNDRV_CTL_ELEM_IFACE_HWDEP      ((__force snd_ctl_elem_iface_t) 1) /* hardware dependent device */
+#define        SNDRV_CTL_ELEM_IFACE_MIXER      ((__force snd_ctl_elem_iface_t) 2) /* virtual mixer device */
+#define        SNDRV_CTL_ELEM_IFACE_PCM        ((__force snd_ctl_elem_iface_t) 3) /* PCM device */
+#define        SNDRV_CTL_ELEM_IFACE_RAWMIDI    ((__force snd_ctl_elem_iface_t) 4) /* RawMidi device */
+#define        SNDRV_CTL_ELEM_IFACE_TIMER      ((__force snd_ctl_elem_iface_t) 5) /* timer device */
+#define        SNDRV_CTL_ELEM_IFACE_SEQUENCER  ((__force snd_ctl_elem_iface_t) 6) /* sequencer client */
+#define        SNDRV_CTL_ELEM_IFACE_LAST       SNDRV_CTL_ELEM_IFACE_SEQUENCER
+
+#define SNDRV_CTL_ELEM_ACCESS_READ             (1<<0)
+#define SNDRV_CTL_ELEM_ACCESS_WRITE            (1<<1)
+#define SNDRV_CTL_ELEM_ACCESS_READWRITE                (SNDRV_CTL_ELEM_ACCESS_READ|SNDRV_CTL_ELEM_ACCESS_WRITE)
+#define SNDRV_CTL_ELEM_ACCESS_VOLATILE         (1<<2)  /* control value may be changed without a notification */
+#define SNDRV_CTL_ELEM_ACCESS_TIMESTAMP                (1<<3)  /* when was control changed */
+#define SNDRV_CTL_ELEM_ACCESS_TLV_READ         (1<<4)  /* TLV read is possible */
+#define SNDRV_CTL_ELEM_ACCESS_TLV_WRITE                (1<<5)  /* TLV write is possible */
+#define SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE    (SNDRV_CTL_ELEM_ACCESS_TLV_READ|SNDRV_CTL_ELEM_ACCESS_TLV_WRITE)
+#define SNDRV_CTL_ELEM_ACCESS_TLV_COMMAND      (1<<6)  /* TLV command is possible */
+#define SNDRV_CTL_ELEM_ACCESS_INACTIVE         (1<<8)  /* control does actually nothing, but may be updated */
+#define SNDRV_CTL_ELEM_ACCESS_LOCK             (1<<9)  /* write lock */
+#define SNDRV_CTL_ELEM_ACCESS_OWNER            (1<<10) /* write lock owner */
+#define SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK     (1<<28) /* kernel use a TLV callback */ 
+#define SNDRV_CTL_ELEM_ACCESS_USER             (1<<29) /* user space element */
+/* bits 30 and 31 are obsoleted (for indirect access) */
+
+/* for further details see the ACPI and PCI power management specification */
+#define SNDRV_CTL_POWER_D0             0x0000  /* full On */
+#define SNDRV_CTL_POWER_D1             0x0100  /* partial On */
+#define SNDRV_CTL_POWER_D2             0x0200  /* partial On */
+#define SNDRV_CTL_POWER_D3             0x0300  /* Off */
+#define SNDRV_CTL_POWER_D3hot          (SNDRV_CTL_POWER_D3|0x0000)     /* Off, with power */
+#define SNDRV_CTL_POWER_D3cold         (SNDRV_CTL_POWER_D3|0x0001)     /* Off, without power */
+
+struct snd_ctl_elem_id {
+       unsigned int numid;             /* numeric identifier, zero = invalid */
+       snd_ctl_elem_iface_t iface;     /* interface identifier */
+       unsigned int device;            /* device/client number */
+       unsigned int subdevice;         /* subdevice (substream) number */
+       unsigned char name[44];         /* ASCII name of item */
+       unsigned int index;             /* index of item */
+};
+
+struct snd_ctl_elem_list {
+       unsigned int offset;            /* W: first element ID to get */
+       unsigned int space;             /* W: count of element IDs to get */
+       unsigned int used;              /* R: count of element IDs set */
+       unsigned int count;             /* R: count of all elements */
+       struct snd_ctl_elem_id __user *pids; /* R: IDs */
+       unsigned char reserved[50];
+};
+
+struct snd_ctl_elem_info {
+       struct snd_ctl_elem_id id;      /* W: element ID */
+       snd_ctl_elem_type_t type;       /* R: value type - SNDRV_CTL_ELEM_TYPE_* */
+       unsigned int access;            /* R: value access (bitmask) - SNDRV_CTL_ELEM_ACCESS_* */
+       unsigned int count;             /* count of values */
+       __kernel_pid_t owner;           /* owner's PID of this control */
+       union {
+               struct {
+                       long min;               /* R: minimum value */
+                       long max;               /* R: maximum value */
+                       long step;              /* R: step (0 variable) */
+               } integer;
+               struct {
+                       long long min;          /* R: minimum value */
+                       long long max;          /* R: maximum value */
+                       long long step;         /* R: step (0 variable) */
+               } integer64;
+               struct {
+                       unsigned int items;     /* R: number of items */
+                       unsigned int item;      /* W: item number */
+                       char name[64];          /* R: value name */
+                       __u64 names_ptr;        /* W: names list (ELEM_ADD only) */
+                       unsigned int names_length;
+               } enumerated;
+               unsigned char reserved[128];
+       } value;
+       union {
+               unsigned short d[4];            /* dimensions */
+               unsigned short *d_ptr;          /* indirect - obsoleted */
+       } dimen;
+       unsigned char reserved[64-4*sizeof(unsigned short)];
+};
+
+struct snd_ctl_elem_value {
+       struct snd_ctl_elem_id id;      /* W: element ID */
+       unsigned int indirect: 1;       /* W: indirect access - obsoleted */
+       union {
+               union {
+                       long value[128];
+                       long *value_ptr;        /* obsoleted */
+               } integer;
+               union {
+                       long long value[64];
+                       long long *value_ptr;   /* obsoleted */
+               } integer64;
+               union {
+                       unsigned int item[128];
+                       unsigned int *item_ptr; /* obsoleted */
+               } enumerated;
+               union {
+                       unsigned char data[512];
+                       unsigned char *data_ptr;        /* obsoleted */
+               } bytes;
+               struct snd_aes_iec958 iec958;
+       } value;                /* RO */
+       struct timespec tstamp;
+       unsigned char reserved[128-sizeof(struct timespec)];
+};
+
+struct snd_ctl_tlv {
+       unsigned int numid;     /* control element numeric identification */
+       unsigned int length;    /* in bytes aligned to 4 */
+       unsigned int tlv[0];    /* first TLV */
+};
+
+#define SNDRV_CTL_IOCTL_PVERSION       _IOR('U', 0x00, int)
+#define SNDRV_CTL_IOCTL_CARD_INFO      _IOR('U', 0x01, struct snd_ctl_card_info)
+#define SNDRV_CTL_IOCTL_ELEM_LIST      _IOWR('U', 0x10, struct snd_ctl_elem_list)
+#define SNDRV_CTL_IOCTL_ELEM_INFO      _IOWR('U', 0x11, struct snd_ctl_elem_info)
+#define SNDRV_CTL_IOCTL_ELEM_READ      _IOWR('U', 0x12, struct snd_ctl_elem_value)
+#define SNDRV_CTL_IOCTL_ELEM_WRITE     _IOWR('U', 0x13, struct snd_ctl_elem_value)
+#define SNDRV_CTL_IOCTL_ELEM_LOCK      _IOW('U', 0x14, struct snd_ctl_elem_id)
+#define SNDRV_CTL_IOCTL_ELEM_UNLOCK    _IOW('U', 0x15, struct snd_ctl_elem_id)
+#define SNDRV_CTL_IOCTL_SUBSCRIBE_EVENTS _IOWR('U', 0x16, int)
+#define SNDRV_CTL_IOCTL_ELEM_ADD       _IOWR('U', 0x17, struct snd_ctl_elem_info)
+#define SNDRV_CTL_IOCTL_ELEM_REPLACE   _IOWR('U', 0x18, struct snd_ctl_elem_info)
+#define SNDRV_CTL_IOCTL_ELEM_REMOVE    _IOWR('U', 0x19, struct snd_ctl_elem_id)
+#define SNDRV_CTL_IOCTL_TLV_READ       _IOWR('U', 0x1a, struct snd_ctl_tlv)
+#define SNDRV_CTL_IOCTL_TLV_WRITE      _IOWR('U', 0x1b, struct snd_ctl_tlv)
+#define SNDRV_CTL_IOCTL_TLV_COMMAND    _IOWR('U', 0x1c, struct snd_ctl_tlv)
+#define SNDRV_CTL_IOCTL_HWDEP_NEXT_DEVICE _IOWR('U', 0x20, int)
+#define SNDRV_CTL_IOCTL_HWDEP_INFO     _IOR('U', 0x21, struct snd_hwdep_info)
+#define SNDRV_CTL_IOCTL_PCM_NEXT_DEVICE        _IOR('U', 0x30, int)
+#define SNDRV_CTL_IOCTL_PCM_INFO       _IOWR('U', 0x31, struct snd_pcm_info)
+#define SNDRV_CTL_IOCTL_PCM_PREFER_SUBDEVICE _IOW('U', 0x32, int)
+#define SNDRV_CTL_IOCTL_RAWMIDI_NEXT_DEVICE _IOWR('U', 0x40, int)
+#define SNDRV_CTL_IOCTL_RAWMIDI_INFO   _IOWR('U', 0x41, struct snd_rawmidi_info)
+#define SNDRV_CTL_IOCTL_RAWMIDI_PREFER_SUBDEVICE _IOW('U', 0x42, int)
+#define SNDRV_CTL_IOCTL_POWER          _IOWR('U', 0xd0, int)
+#define SNDRV_CTL_IOCTL_POWER_STATE    _IOR('U', 0xd1, int)
+
+/*
+ *  Read interface.
+ */
+
+enum sndrv_ctl_event_type {
+       SNDRV_CTL_EVENT_ELEM = 0,
+       SNDRV_CTL_EVENT_LAST = SNDRV_CTL_EVENT_ELEM,
+};
+
+#define SNDRV_CTL_EVENT_MASK_VALUE     (1<<0)  /* element value was changed */
+#define SNDRV_CTL_EVENT_MASK_INFO      (1<<1)  /* element info was changed */
+#define SNDRV_CTL_EVENT_MASK_ADD       (1<<2)  /* element was added */
+#define SNDRV_CTL_EVENT_MASK_TLV       (1<<3)  /* element TLV tree was changed */
+#define SNDRV_CTL_EVENT_MASK_REMOVE    (~0U)   /* element was removed */
+
+struct snd_ctl_event {
+       int type;       /* event type - SNDRV_CTL_EVENT_* */
+       union {
+               struct {
+                       unsigned int mask;
+                       struct snd_ctl_elem_id id;
+               } elem;
+               unsigned char data8[60];
+       } data;
+};
+
+/*
+ *  Control names
+ */
+
+#define SNDRV_CTL_NAME_NONE                            ""
+#define SNDRV_CTL_NAME_PLAYBACK                                "Playback "
+#define SNDRV_CTL_NAME_CAPTURE                         "Capture "
+
+#define SNDRV_CTL_NAME_IEC958_NONE                     ""
+#define SNDRV_CTL_NAME_IEC958_SWITCH                   "Switch"
+#define SNDRV_CTL_NAME_IEC958_VOLUME                   "Volume"
+#define SNDRV_CTL_NAME_IEC958_DEFAULT                  "Default"
+#define SNDRV_CTL_NAME_IEC958_MASK                     "Mask"
+#define SNDRV_CTL_NAME_IEC958_CON_MASK                 "Con Mask"
+#define SNDRV_CTL_NAME_IEC958_PRO_MASK                 "Pro Mask"
+#define SNDRV_CTL_NAME_IEC958_PCM_STREAM               "PCM Stream"
+#define SNDRV_CTL_NAME_IEC958(expl,direction,what)     "IEC958 " expl SNDRV_CTL_NAME_##direction SNDRV_CTL_NAME_IEC958_##what
+
+#endif /* _UAPI__SOUND_ASOUND_H */
diff --git a/include/uapi/sound/emu10k1.h b/include/uapi/sound/emu10k1.h
new file mode 100644 (file)
index 0000000..d1bbaf7
--- /dev/null
@@ -0,0 +1,373 @@
+/*
+ *  Copyright (c) by Jaroslav Kysela <perex@perex.cz>,
+ *                  Creative Labs, Inc.
+ *  Definitions for EMU10K1 (SB Live!) chips
+ *
+ *
+ *   This program is free software; you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation; either version 2 of the License, or
+ *   (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+ *
+ */
+#ifndef _UAPI__SOUND_EMU10K1_H
+#define _UAPI__SOUND_EMU10K1_H
+
+#include <linux/types.h>
+
+
+
+/*
+ * ---- FX8010 ----
+ */
+
+#define EMU10K1_CARD_CREATIVE                  0x00000000
+#define EMU10K1_CARD_EMUAPS                    0x00000001
+
+#define EMU10K1_FX8010_PCM_COUNT               8
+
+/* instruction set */
+#define iMAC0   0x00   /* R = A + (X * Y >> 31)   ; saturation */
+#define iMAC1   0x01   /* R = A + (-X * Y >> 31)  ; saturation */
+#define iMAC2   0x02   /* R = A + (X * Y >> 31)   ; wraparound */
+#define iMAC3   0x03   /* R = A + (-X * Y >> 31)  ; wraparound */
+#define iMACINT0 0x04  /* R = A + X * Y           ; saturation */
+#define iMACINT1 0x05  /* R = A + X * Y           ; wraparound (31-bit) */
+#define iACC3   0x06   /* R = A + X + Y           ; saturation */
+#define iMACMV   0x07  /* R = A, acc += X * Y >> 31 */
+#define iANDXOR  0x08  /* R = (A & X) ^ Y */
+#define iTSTNEG  0x09  /* R = (A >= Y) ? X : ~X */
+#define iLIMITGE 0x0a  /* R = (A >= Y) ? X : Y */
+#define iLIMITLT 0x0b  /* R = (A < Y) ? X : Y */
+#define iLOG    0x0c   /* R = linear_data, A (log_data), X (max_exp), Y (format_word) */
+#define iEXP    0x0d   /* R = log_data, A (linear_data), X (max_exp), Y (format_word) */
+#define iINTERP  0x0e  /* R = A + (X * (Y - A) >> 31)  ; saturation */
+#define iSKIP    0x0f  /* R = A (cc_reg), X (count), Y (cc_test) */
+
+/* GPRs */
+#define FXBUS(x)       (0x00 + (x))    /* x = 0x00 - 0x0f */
+#define EXTIN(x)       (0x10 + (x))    /* x = 0x00 - 0x0f */
+#define EXTOUT(x)      (0x20 + (x))    /* x = 0x00 - 0x0f physical outs -> FXWC low 16 bits */
+#define FXBUS2(x)      (0x30 + (x))    /* x = 0x00 - 0x0f copies of fx buses for capture -> FXWC high 16 bits */
+                                       /* NB: 0x31 and 0x32 are shared with Center/LFE on SB live 5.1 */
+
+#define C_00000000     0x40
+#define C_00000001     0x41
+#define C_00000002     0x42
+#define C_00000003     0x43
+#define C_00000004     0x44
+#define C_00000008     0x45
+#define C_00000010     0x46
+#define C_00000020     0x47
+#define C_00000100     0x48
+#define C_00010000     0x49
+#define C_00080000     0x4a
+#define C_10000000     0x4b
+#define C_20000000     0x4c
+#define C_40000000     0x4d
+#define C_80000000     0x4e
+#define C_7fffffff     0x4f
+#define C_ffffffff     0x50
+#define C_fffffffe     0x51
+#define C_c0000000     0x52
+#define C_4f1bbcdc     0x53
+#define C_5a7ef9db     0x54
+#define C_00100000     0x55            /* ?? */
+#define GPR_ACCU       0x56            /* ACCUM, accumulator */
+#define GPR_COND       0x57            /* CCR, condition register */
+#define GPR_NOISE0     0x58            /* noise source */
+#define GPR_NOISE1     0x59            /* noise source */
+#define GPR_IRQ                0x5a            /* IRQ register */
+#define GPR_DBAC       0x5b            /* TRAM Delay Base Address Counter */
+#define GPR(x)         (FXGPREGBASE + (x)) /* free GPRs: x = 0x00 - 0xff */
+#define ITRAM_DATA(x)  (TANKMEMDATAREGBASE + 0x00 + (x)) /* x = 0x00 - 0x7f */
+#define ETRAM_DATA(x)  (TANKMEMDATAREGBASE + 0x80 + (x)) /* x = 0x00 - 0x1f */
+#define ITRAM_ADDR(x)  (TANKMEMADDRREGBASE + 0x00 + (x)) /* x = 0x00 - 0x7f */
+#define ETRAM_ADDR(x)  (TANKMEMADDRREGBASE + 0x80 + (x)) /* x = 0x00 - 0x1f */
+
+#define A_ITRAM_DATA(x)        (TANKMEMDATAREGBASE + 0x00 + (x)) /* x = 0x00 - 0xbf */
+#define A_ETRAM_DATA(x)        (TANKMEMDATAREGBASE + 0xc0 + (x)) /* x = 0x00 - 0x3f */
+#define A_ITRAM_ADDR(x)        (TANKMEMADDRREGBASE + 0x00 + (x)) /* x = 0x00 - 0xbf */
+#define A_ETRAM_ADDR(x)        (TANKMEMADDRREGBASE + 0xc0 + (x)) /* x = 0x00 - 0x3f */
+#define A_ITRAM_CTL(x) (A_TANKMEMCTLREGBASE + 0x00 + (x)) /* x = 0x00 - 0xbf */
+#define A_ETRAM_CTL(x) (A_TANKMEMCTLREGBASE + 0xc0 + (x)) /* x = 0x00 - 0x3f */
+
+#define A_FXBUS(x)     (0x00 + (x))    /* x = 0x00 - 0x3f FX buses */
+#define A_EXTIN(x)     (0x40 + (x))    /* x = 0x00 - 0x0f physical ins */
+#define A_P16VIN(x)    (0x50 + (x))    /* x = 0x00 - 0x0f p16v ins (A2 only) "EMU32 inputs" */
+#define A_EXTOUT(x)    (0x60 + (x))    /* x = 0x00 - 0x1f physical outs -> A_FXWC1 0x79-7f unknown   */
+#define A_FXBUS2(x)    (0x80 + (x))    /* x = 0x00 - 0x1f extra outs used for EFX capture -> A_FXWC2 */
+#define A_EMU32OUTH(x) (0xa0 + (x))    /* x = 0x00 - 0x0f "EMU32_OUT_10 - _1F" - ??? */
+#define A_EMU32OUTL(x) (0xb0 + (x))    /* x = 0x00 - 0x0f "EMU32_OUT_1 - _F" - ??? */
+#define A3_EMU32IN(x)  (0x160 + (x))   /* x = 0x00 - 0x3f "EMU32_IN_00 - _3F" - Only when .device = 0x0008 */
+#define A3_EMU32OUT(x) (0x1E0 + (x))   /* x = 0x00 - 0x0f "EMU32_OUT_00 - _3F" - Only when .device = 0x0008 */
+#define A_GPR(x)       (A_FXGPREGBASE + (x))
+
+/* cc_reg constants */
+#define CC_REG_NORMALIZED C_00000001
+#define CC_REG_BORROW  C_00000002
+#define CC_REG_MINUS   C_00000004
+#define CC_REG_ZERO    C_00000008
+#define CC_REG_SATURATE        C_00000010
+#define CC_REG_NONZERO C_00000100
+
+/* FX buses */
+#define FXBUS_PCM_LEFT         0x00
+#define FXBUS_PCM_RIGHT                0x01
+#define FXBUS_PCM_LEFT_REAR    0x02
+#define FXBUS_PCM_RIGHT_REAR   0x03
+#define FXBUS_MIDI_LEFT                0x04
+#define FXBUS_MIDI_RIGHT       0x05
+#define FXBUS_PCM_CENTER       0x06
+#define FXBUS_PCM_LFE          0x07
+#define FXBUS_PCM_LEFT_FRONT   0x08
+#define FXBUS_PCM_RIGHT_FRONT  0x09
+#define FXBUS_MIDI_REVERB      0x0c
+#define FXBUS_MIDI_CHORUS      0x0d
+#define FXBUS_PCM_LEFT_SIDE    0x0e
+#define FXBUS_PCM_RIGHT_SIDE   0x0f
+#define FXBUS_PT_LEFT          0x14
+#define FXBUS_PT_RIGHT         0x15
+
+/* Inputs */
+#define EXTIN_AC97_L      0x00 /* AC'97 capture channel - left */
+#define EXTIN_AC97_R      0x01 /* AC'97 capture channel - right */
+#define EXTIN_SPDIF_CD_L   0x02        /* internal S/PDIF CD - onboard - left */
+#define EXTIN_SPDIF_CD_R   0x03        /* internal S/PDIF CD - onboard - right */
+#define EXTIN_ZOOM_L      0x04 /* Zoom Video I2S - left */
+#define EXTIN_ZOOM_R      0x05 /* Zoom Video I2S - right */
+#define EXTIN_TOSLINK_L           0x06 /* LiveDrive - TOSLink Optical - left */
+#define EXTIN_TOSLINK_R    0x07        /* LiveDrive - TOSLink Optical - right */
+#define EXTIN_LINE1_L     0x08 /* LiveDrive - Line/Mic 1 - left */
+#define EXTIN_LINE1_R     0x09 /* LiveDrive - Line/Mic 1 - right */
+#define EXTIN_COAX_SPDIF_L 0x0a        /* LiveDrive - Coaxial S/PDIF - left */
+#define EXTIN_COAX_SPDIF_R 0x0b /* LiveDrive - Coaxial S/PDIF - right */
+#define EXTIN_LINE2_L     0x0c /* LiveDrive - Line/Mic 2 - left */
+#define EXTIN_LINE2_R     0x0d /* LiveDrive - Line/Mic 2 - right */
+
+/* Outputs */
+#define EXTOUT_AC97_L     0x00 /* AC'97 playback channel - left */
+#define EXTOUT_AC97_R     0x01 /* AC'97 playback channel - right */
+#define EXTOUT_TOSLINK_L   0x02        /* LiveDrive - TOSLink Optical - left */
+#define EXTOUT_TOSLINK_R   0x03        /* LiveDrive - TOSLink Optical - right */
+#define EXTOUT_AC97_CENTER 0x04        /* SB Live 5.1 - center */
+#define EXTOUT_AC97_LFE           0x05 /* SB Live 5.1 - LFE */
+#define EXTOUT_HEADPHONE_L 0x06        /* LiveDrive - Headphone - left */
+#define EXTOUT_HEADPHONE_R 0x07        /* LiveDrive - Headphone - right */
+#define EXTOUT_REAR_L     0x08 /* Rear channel - left */
+#define EXTOUT_REAR_R     0x09 /* Rear channel - right */
+#define EXTOUT_ADC_CAP_L   0x0a        /* ADC Capture buffer - left */
+#define EXTOUT_ADC_CAP_R   0x0b        /* ADC Capture buffer - right */
+#define EXTOUT_MIC_CAP    0x0c /* MIC Capture buffer */
+#define EXTOUT_AC97_REAR_L 0x0d        /* SB Live 5.1 (c) 2003 - Rear Left */
+#define EXTOUT_AC97_REAR_R 0x0e        /* SB Live 5.1 (c) 2003 - Rear Right */
+#define EXTOUT_ACENTER    0x11 /* Analog Center */
+#define EXTOUT_ALFE       0x12 /* Analog LFE */
+
+/* Audigy Inputs */
+#define A_EXTIN_AC97_L         0x00    /* AC'97 capture channel - left */
+#define A_EXTIN_AC97_R         0x01    /* AC'97 capture channel - right */
+#define A_EXTIN_SPDIF_CD_L     0x02    /* digital CD left */
+#define A_EXTIN_SPDIF_CD_R     0x03    /* digital CD left */
+#define A_EXTIN_OPT_SPDIF_L     0x04    /* audigy drive Optical SPDIF - left */
+#define A_EXTIN_OPT_SPDIF_R     0x05    /*                              right */ 
+#define A_EXTIN_LINE2_L                0x08    /* audigy drive line2/mic2 - left */
+#define A_EXTIN_LINE2_R                0x09    /*                           right */
+#define A_EXTIN_ADC_L          0x0a    /* Philips ADC - left */
+#define A_EXTIN_ADC_R          0x0b    /*               right */
+#define A_EXTIN_AUX2_L         0x0c    /* audigy drive aux2 - left */
+#define A_EXTIN_AUX2_R         0x0d    /*                   - right */
+
+/* Audigiy Outputs */
+#define A_EXTOUT_FRONT_L       0x00    /* digital front left */
+#define A_EXTOUT_FRONT_R       0x01    /*               right */
+#define A_EXTOUT_CENTER                0x02    /* digital front center */
+#define A_EXTOUT_LFE           0x03    /* digital front lfe */
+#define A_EXTOUT_HEADPHONE_L   0x04    /* headphone audigy drive left */
+#define A_EXTOUT_HEADPHONE_R   0x05    /*                        right */
+#define A_EXTOUT_REAR_L                0x06    /* digital rear left */
+#define A_EXTOUT_REAR_R                0x07    /*              right */
+#define A_EXTOUT_AFRONT_L      0x08    /* analog front left */
+#define A_EXTOUT_AFRONT_R      0x09    /*              right */
+#define A_EXTOUT_ACENTER       0x0a    /* analog center */
+#define A_EXTOUT_ALFE          0x0b    /* analog LFE */
+#define A_EXTOUT_ASIDE_L       0x0c    /* analog side left  - Audigy 2 ZS */
+#define A_EXTOUT_ASIDE_R       0x0d    /*             right - Audigy 2 ZS */
+#define A_EXTOUT_AREAR_L       0x0e    /* analog rear left */
+#define A_EXTOUT_AREAR_R       0x0f    /*             right */
+#define A_EXTOUT_AC97_L                0x10    /* AC97 left (front) */
+#define A_EXTOUT_AC97_R                0x11    /*      right */
+#define A_EXTOUT_ADC_CAP_L     0x16    /* ADC capture buffer left */
+#define A_EXTOUT_ADC_CAP_R     0x17    /*                    right */
+#define A_EXTOUT_MIC_CAP       0x18    /* Mic capture buffer */
+
+/* Audigy constants */
+#define A_C_00000000   0xc0
+#define A_C_00000001   0xc1
+#define A_C_00000002   0xc2
+#define A_C_00000003   0xc3
+#define A_C_00000004   0xc4
+#define A_C_00000008   0xc5
+#define A_C_00000010   0xc6
+#define A_C_00000020   0xc7
+#define A_C_00000100   0xc8
+#define A_C_00010000   0xc9
+#define A_C_00000800   0xca
+#define A_C_10000000   0xcb
+#define A_C_20000000   0xcc
+#define A_C_40000000   0xcd
+#define A_C_80000000   0xce
+#define A_C_7fffffff   0xcf
+#define A_C_ffffffff   0xd0
+#define A_C_fffffffe   0xd1
+#define A_C_c0000000   0xd2
+#define A_C_4f1bbcdc   0xd3
+#define A_C_5a7ef9db   0xd4
+#define A_C_00100000   0xd5
+#define A_GPR_ACCU     0xd6            /* ACCUM, accumulator */
+#define A_GPR_COND     0xd7            /* CCR, condition register */
+#define A_GPR_NOISE0   0xd8            /* noise source */
+#define A_GPR_NOISE1   0xd9            /* noise source */
+#define A_GPR_IRQ      0xda            /* IRQ register */
+#define A_GPR_DBAC     0xdb            /* TRAM Delay Base Address Counter - internal */
+#define A_GPR_DBACE    0xde            /* TRAM Delay Base Address Counter - external */
+
+/* definitions for debug register */
+#define EMU10K1_DBG_ZC                 0x80000000      /* zero tram counter */
+#define EMU10K1_DBG_SATURATION_OCCURED 0x02000000      /* saturation control */
+#define EMU10K1_DBG_SATURATION_ADDR    0x01ff0000      /* saturation address */
+#define EMU10K1_DBG_SINGLE_STEP                0x00008000      /* single step mode */
+#define EMU10K1_DBG_STEP               0x00004000      /* start single step */
+#define EMU10K1_DBG_CONDITION_CODE     0x00003e00      /* condition code */
+#define EMU10K1_DBG_SINGLE_STEP_ADDR   0x000001ff      /* single step address */
+
+/* tank memory address line */
+#ifndef __KERNEL__
+#define TANKMEMADDRREG_ADDR_MASK 0x000fffff    /* 20 bit tank address field                    */
+#define TANKMEMADDRREG_CLEAR    0x00800000     /* Clear tank memory                            */
+#define TANKMEMADDRREG_ALIGN    0x00400000     /* Align read or write relative to tank access  */
+#define TANKMEMADDRREG_WRITE    0x00200000     /* Write to tank memory                         */
+#define TANKMEMADDRREG_READ     0x00100000     /* Read from tank memory                        */
+#endif
+
+struct snd_emu10k1_fx8010_info {
+       unsigned int internal_tram_size;        /* in samples */
+       unsigned int external_tram_size;        /* in samples */
+       char fxbus_names[16][32];               /* names of FXBUSes */
+       char extin_names[16][32];               /* names of external inputs */
+       char extout_names[32][32];              /* names of external outputs */
+       unsigned int gpr_controls;              /* count of GPR controls */
+};
+
+#define EMU10K1_GPR_TRANSLATION_NONE           0
+#define EMU10K1_GPR_TRANSLATION_TABLE100       1
+#define EMU10K1_GPR_TRANSLATION_BASS           2
+#define EMU10K1_GPR_TRANSLATION_TREBLE         3
+#define EMU10K1_GPR_TRANSLATION_ONOFF          4
+
+struct snd_emu10k1_fx8010_control_gpr {
+       struct snd_ctl_elem_id id;              /* full control ID definition */
+       unsigned int vcount;            /* visible count */
+       unsigned int count;             /* count of GPR (1..16) */
+       unsigned short gpr[32];         /* GPR number(s) */
+       unsigned int value[32];         /* initial values */
+       unsigned int min;               /* minimum range */
+       unsigned int max;               /* maximum range */
+       unsigned int translation;       /* translation type (EMU10K1_GPR_TRANSLATION*) */
+       const unsigned int *tlv;
+};
+
+/* old ABI without TLV support */
+struct snd_emu10k1_fx8010_control_old_gpr {
+       struct snd_ctl_elem_id id;
+       unsigned int vcount;
+       unsigned int count;
+       unsigned short gpr[32];
+       unsigned int value[32];
+       unsigned int min;
+       unsigned int max;
+       unsigned int translation;
+};
+
+struct snd_emu10k1_fx8010_code {
+       char name[128];
+
+       DECLARE_BITMAP(gpr_valid, 0x200); /* bitmask of valid initializers */
+       __u32 __user *gpr_map;          /* initializers */
+
+       unsigned int gpr_add_control_count; /* count of GPR controls to add/replace */
+       struct snd_emu10k1_fx8010_control_gpr __user *gpr_add_controls; /* GPR controls to add/replace */
+
+       unsigned int gpr_del_control_count; /* count of GPR controls to remove */
+       struct snd_ctl_elem_id __user *gpr_del_controls; /* IDs of GPR controls to remove */
+
+       unsigned int gpr_list_control_count; /* count of GPR controls to list */
+       unsigned int gpr_list_control_total; /* total count of GPR controls */
+       struct snd_emu10k1_fx8010_control_gpr __user *gpr_list_controls; /* listed GPR controls */
+
+       DECLARE_BITMAP(tram_valid, 0x100); /* bitmask of valid initializers */
+       __u32 __user *tram_data_map;      /* data initializers */
+       __u32 __user *tram_addr_map;      /* map initializers */
+
+       DECLARE_BITMAP(code_valid, 1024); /* bitmask of valid instructions */
+       __u32 __user *code;               /* one instruction - 64 bits */
+};
+
+struct snd_emu10k1_fx8010_tram {
+       unsigned int address;           /* 31.bit == 1 -> external TRAM */
+       unsigned int size;              /* size in samples (4 bytes) */
+       unsigned int *samples;          /* pointer to samples (20-bit) */
+                                       /* NULL->clear memory */
+};
+
+struct snd_emu10k1_fx8010_pcm_rec {
+       unsigned int substream;         /* substream number */
+       unsigned int res1;              /* reserved */
+       unsigned int channels;          /* 16-bit channels count, zero = remove this substream */
+       unsigned int tram_start;        /* ring buffer position in TRAM (in samples) */
+       unsigned int buffer_size;       /* count of buffered samples */
+       unsigned short gpr_size;                /* GPR containing size of ringbuffer in samples (host) */
+       unsigned short gpr_ptr;         /* GPR containing current pointer in the ring buffer (host = reset, FX8010) */
+       unsigned short gpr_count;       /* GPR containing count of samples between two interrupts (host) */
+       unsigned short gpr_tmpcount;    /* GPR containing current count of samples to interrupt (host = set, FX8010) */
+       unsigned short gpr_trigger;     /* GPR containing trigger (activate) information (host) */
+       unsigned short gpr_running;     /* GPR containing info if PCM is running (FX8010) */
+       unsigned char pad;              /* reserved */
+       unsigned char etram[32];        /* external TRAM address & data (one per channel) */
+       unsigned int res2;              /* reserved */
+};
+
+#define SNDRV_EMU10K1_VERSION          SNDRV_PROTOCOL_VERSION(1, 0, 1)
+
+#define SNDRV_EMU10K1_IOCTL_INFO       _IOR ('H', 0x10, struct snd_emu10k1_fx8010_info)
+#define SNDRV_EMU10K1_IOCTL_CODE_POKE  _IOW ('H', 0x11, struct snd_emu10k1_fx8010_code)
+#define SNDRV_EMU10K1_IOCTL_CODE_PEEK  _IOWR('H', 0x12, struct snd_emu10k1_fx8010_code)
+#define SNDRV_EMU10K1_IOCTL_TRAM_SETUP _IOW ('H', 0x20, int)
+#define SNDRV_EMU10K1_IOCTL_TRAM_POKE  _IOW ('H', 0x21, struct snd_emu10k1_fx8010_tram)
+#define SNDRV_EMU10K1_IOCTL_TRAM_PEEK  _IOWR('H', 0x22, struct snd_emu10k1_fx8010_tram)
+#define SNDRV_EMU10K1_IOCTL_PCM_POKE   _IOW ('H', 0x30, struct snd_emu10k1_fx8010_pcm_rec)
+#define SNDRV_EMU10K1_IOCTL_PCM_PEEK   _IOWR('H', 0x31, struct snd_emu10k1_fx8010_pcm_rec)
+#define SNDRV_EMU10K1_IOCTL_PVERSION   _IOR ('H', 0x40, int)
+#define SNDRV_EMU10K1_IOCTL_STOP       _IO  ('H', 0x80)
+#define SNDRV_EMU10K1_IOCTL_CONTINUE   _IO  ('H', 0x81)
+#define SNDRV_EMU10K1_IOCTL_ZERO_TRAM_COUNTER _IO ('H', 0x82)
+#define SNDRV_EMU10K1_IOCTL_SINGLE_STEP        _IOW ('H', 0x83, int)
+#define SNDRV_EMU10K1_IOCTL_DBG_READ   _IOR ('H', 0x84, int)
+
+/* typedefs for compatibility to user-space */
+typedef struct snd_emu10k1_fx8010_info emu10k1_fx8010_info_t;
+typedef struct snd_emu10k1_fx8010_control_gpr emu10k1_fx8010_control_gpr_t;
+typedef struct snd_emu10k1_fx8010_code emu10k1_fx8010_code_t;
+typedef struct snd_emu10k1_fx8010_tram emu10k1_fx8010_tram_t;
+typedef struct snd_emu10k1_fx8010_pcm_rec emu10k1_fx8010_pcm_t;
+
+#endif /* _UAPI__SOUND_EMU10K1_H */
diff --git a/include/uapi/sound/sb16_csp.h b/include/uapi/sound/sb16_csp.h
new file mode 100644 (file)
index 0000000..3b96907
--- /dev/null
@@ -0,0 +1,122 @@
+/*
+ *  Copyright (c) 1999 by Uros Bizjak <uros@kss-loka.si>
+ *                        Takashi Iwai <tiwai@suse.de>
+ *
+ *  SB16ASP/AWE32 CSP control
+ *
+ *   This program is free software; you can redistribute it and/or modify 
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation; either version 2 of the License, or
+ *   (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+ *
+ */
+#ifndef _UAPI__SOUND_SB16_CSP_H
+#define _UAPI__SOUND_SB16_CSP_H
+
+
+/* CSP modes */
+#define SNDRV_SB_CSP_MODE_NONE         0x00
+#define SNDRV_SB_CSP_MODE_DSP_READ     0x01    /* Record from DSP */
+#define SNDRV_SB_CSP_MODE_DSP_WRITE    0x02    /* Play to DSP */
+#define SNDRV_SB_CSP_MODE_QSOUND               0x04    /* QSound */
+
+/* CSP load flags */
+#define SNDRV_SB_CSP_LOAD_FROMUSER     0x01
+#define SNDRV_SB_CSP_LOAD_INITBLOCK    0x02
+
+/* CSP sample width */
+#define SNDRV_SB_CSP_SAMPLE_8BIT               0x01
+#define SNDRV_SB_CSP_SAMPLE_16BIT              0x02
+
+/* CSP channels */
+#define SNDRV_SB_CSP_MONO                      0x01
+#define SNDRV_SB_CSP_STEREO            0x02
+
+/* CSP rates */
+#define SNDRV_SB_CSP_RATE_8000         0x01
+#define SNDRV_SB_CSP_RATE_11025                0x02
+#define SNDRV_SB_CSP_RATE_22050                0x04
+#define SNDRV_SB_CSP_RATE_44100                0x08
+#define SNDRV_SB_CSP_RATE_ALL          0x0f
+
+/* CSP running state */
+#define SNDRV_SB_CSP_ST_IDLE           0x00
+#define SNDRV_SB_CSP_ST_LOADED         0x01
+#define SNDRV_SB_CSP_ST_RUNNING                0x02
+#define SNDRV_SB_CSP_ST_PAUSED         0x04
+#define SNDRV_SB_CSP_ST_AUTO           0x08
+#define SNDRV_SB_CSP_ST_QSOUND         0x10
+
+/* maximum QSound value (180 degrees right) */
+#define SNDRV_SB_CSP_QSOUND_MAX_RIGHT  0x20
+
+/* maximum microcode RIFF file size */
+#define SNDRV_SB_CSP_MAX_MICROCODE_FILE_SIZE   0x3000
+
+/* microcode header */
+struct snd_sb_csp_mc_header {
+       char codec_name[16];            /* id name of codec */
+       unsigned short func_req;        /* requested function */
+};
+
+/* microcode to be loaded */
+struct snd_sb_csp_microcode {
+       struct snd_sb_csp_mc_header info;
+       unsigned char data[SNDRV_SB_CSP_MAX_MICROCODE_FILE_SIZE];
+};
+
+/* start CSP with sample_width in mono/stereo */
+struct snd_sb_csp_start {
+       int sample_width;       /* sample width, look above */
+       int channels;           /* channels, look above */
+};
+
+/* CSP information */
+struct snd_sb_csp_info {
+       char codec_name[16];            /* id name of codec */
+       unsigned short func_nr;         /* function number */
+       unsigned int acc_format;        /* accepted PCM formats */
+       unsigned short acc_channels;    /* accepted channels */
+       unsigned short acc_width;       /* accepted sample width */
+       unsigned short acc_rates;       /* accepted sample rates */
+       unsigned short csp_mode;        /* CSP mode, see above */
+       unsigned short run_channels;    /* current channels  */
+       unsigned short run_width;       /* current sample width */
+       unsigned short version;         /* version id: 0x10 - 0x1f */
+       unsigned short state;           /* state bits */
+};
+
+/* HWDEP controls */
+/* get CSP information */
+#define SNDRV_SB_CSP_IOCTL_INFO                _IOR('H', 0x10, struct snd_sb_csp_info)
+/* load microcode to CSP */
+/* NOTE: struct snd_sb_csp_microcode overflows the max size (13 bits)
+ * defined for some architectures like MIPS, and it leads to build errors.
+ * (x86 and co have 14-bit size, thus it's valid, though.)
+ * As a workaround for skipping the size-limit check, here we don't use the
+ * normal _IOW() macro but _IOC() with the manual argument.
+ */
+#define SNDRV_SB_CSP_IOCTL_LOAD_CODE   \
+       _IOC(_IOC_WRITE, 'H', 0x11, sizeof(struct snd_sb_csp_microcode))
+/* unload microcode from CSP */
+#define SNDRV_SB_CSP_IOCTL_UNLOAD_CODE _IO('H', 0x12)
+/* start CSP */
+#define SNDRV_SB_CSP_IOCTL_START               _IOW('H', 0x13, struct snd_sb_csp_start)
+/* stop CSP */
+#define SNDRV_SB_CSP_IOCTL_STOP                _IO('H', 0x14)
+/* pause CSP and DMA transfer */
+#define SNDRV_SB_CSP_IOCTL_PAUSE               _IO('H', 0x15)
+/* restart CSP and DMA transfer */
+#define SNDRV_SB_CSP_IOCTL_RESTART     _IO('H', 0x16)
+
+
+#endif /* _UAPI__SOUND_SB16_CSP_H */
index 91cdf94..af49721 100644 (file)
@@ -190,7 +190,9 @@ struct snd_pcm_status32 {
        u32 avail_max;
        u32 overrange;
        s32 suspended_state;
-       unsigned char reserved[60];
+       u32 reserved_alignment;
+       struct compat_timespec audio_tstamp;
+       unsigned char reserved[56-sizeof(struct compat_timespec)];
 } __attribute__((packed));
 
 
@@ -205,17 +207,16 @@ static int snd_pcm_status_user_compat(struct snd_pcm_substream *substream,
                return err;
 
        if (put_user(status.state, &src->state) ||
-           put_user(status.trigger_tstamp.tv_sec, &src->trigger_tstamp.tv_sec) ||
-           put_user(status.trigger_tstamp.tv_nsec, &src->trigger_tstamp.tv_nsec) ||
-           put_user(status.tstamp.tv_sec, &src->tstamp.tv_sec) ||
-           put_user(status.tstamp.tv_nsec, &src->tstamp.tv_nsec) ||
+           compat_put_timespec(&status.trigger_tstamp, &src->trigger_tstamp) ||
+           compat_put_timespec(&status.tstamp, &src->tstamp) ||
            put_user(status.appl_ptr, &src->appl_ptr) ||
            put_user(status.hw_ptr, &src->hw_ptr) ||
            put_user(status.delay, &src->delay) ||
            put_user(status.avail, &src->avail) ||
            put_user(status.avail_max, &src->avail_max) ||
            put_user(status.overrange, &src->overrange) ||
-           put_user(status.suspended_state, &src->suspended_state))
+           put_user(status.suspended_state, &src->suspended_state) ||
+           compat_put_timespec(&status.audio_tstamp, &src->audio_tstamp))
                return -EFAULT;
 
        return err;
@@ -364,6 +365,7 @@ struct snd_pcm_mmap_status32 {
        u32 hw_ptr;
        struct compat_timespec tstamp;
        s32 suspended_state;
+       struct compat_timespec audio_tstamp;
 } __attribute__((packed));
 
 struct snd_pcm_mmap_control32 {
@@ -426,12 +428,14 @@ static int snd_pcm_ioctl_sync_ptr_compat(struct snd_pcm_substream *substream,
        sstatus.hw_ptr = status->hw_ptr % boundary;
        sstatus.tstamp = status->tstamp;
        sstatus.suspended_state = status->suspended_state;
+       sstatus.audio_tstamp = status->audio_tstamp;
        snd_pcm_stream_unlock_irq(substream);
        if (put_user(sstatus.state, &src->s.status.state) ||
            put_user(sstatus.hw_ptr, &src->s.status.hw_ptr) ||
-           put_user(sstatus.tstamp.tv_sec, &src->s.status.tstamp.tv_sec) ||
-           put_user(sstatus.tstamp.tv_nsec, &src->s.status.tstamp.tv_nsec) ||
+           compat_put_timespec(&sstatus.tstamp, &src->s.status.tstamp) ||
            put_user(sstatus.suspended_state, &src->s.status.suspended_state) ||
+           compat_put_timespec(&sstatus.audio_tstamp,
+                   &src->s.status.audio_tstamp) ||
            put_user(scontrol.appl_ptr, &src->c.control.appl_ptr) ||
            put_user(scontrol.avail_min, &src->c.control.avail_min))
                return -EFAULT;
index f42c10a..c4840ff 100644 (file)
@@ -316,6 +316,8 @@ static int snd_pcm_update_hw_ptr0(struct snd_pcm_substream *substream,
        unsigned long jdelta;
        unsigned long curr_jiffies;
        struct timespec curr_tstamp;
+       struct timespec audio_tstamp;
+       int crossed_boundary = 0;
 
        old_hw_ptr = runtime->status->hw_ptr;
 
@@ -327,9 +329,14 @@ static int snd_pcm_update_hw_ptr0(struct snd_pcm_substream *substream,
         */
        pos = substream->ops->pointer(substream);
        curr_jiffies = jiffies;
-       if (runtime->tstamp_mode == SNDRV_PCM_TSTAMP_ENABLE)
+       if (runtime->tstamp_mode == SNDRV_PCM_TSTAMP_ENABLE) {
                snd_pcm_gettime(runtime, (struct timespec *)&curr_tstamp);
 
+               if ((runtime->hw.info & SNDRV_PCM_INFO_HAS_WALL_CLOCK) &&
+                       (substream->ops->wall_clock))
+                       substream->ops->wall_clock(substream, &audio_tstamp);
+       }
+
        if (pos == SNDRV_PCM_POS_XRUN) {
                xrun(substream);
                return -EPIPE;
@@ -360,8 +367,10 @@ static int snd_pcm_update_hw_ptr0(struct snd_pcm_substream *substream,
                        hdelta = curr_jiffies - runtime->hw_ptr_jiffies;
                        if (hdelta > runtime->hw_ptr_buffer_jiffies/2) {
                                hw_base += runtime->buffer_size;
-                               if (hw_base >= runtime->boundary)
+                               if (hw_base >= runtime->boundary) {
                                        hw_base = 0;
+                                       crossed_boundary++;
+                               }
                                new_hw_ptr = hw_base + pos;
                                goto __delta;
                        }
@@ -371,8 +380,10 @@ static int snd_pcm_update_hw_ptr0(struct snd_pcm_substream *substream,
        /* pointer crosses the end of the ring buffer */
        if (new_hw_ptr < old_hw_ptr) {
                hw_base += runtime->buffer_size;
-               if (hw_base >= runtime->boundary)
+               if (hw_base >= runtime->boundary) {
                        hw_base = 0;
+                       crossed_boundary++;
+               }
                new_hw_ptr = hw_base + pos;
        }
       __delta:
@@ -410,8 +421,10 @@ static int snd_pcm_update_hw_ptr0(struct snd_pcm_substream *substream,
                while (hdelta > xrun_threshold) {
                        delta += runtime->buffer_size;
                        hw_base += runtime->buffer_size;
-                       if (hw_base >= runtime->boundary)
+                       if (hw_base >= runtime->boundary) {
                                hw_base = 0;
+                               crossed_boundary++;
+                       }
                        new_hw_ptr = hw_base + pos;
                        hdelta -= runtime->hw_ptr_buffer_jiffies;
                }
@@ -456,8 +469,10 @@ static int snd_pcm_update_hw_ptr0(struct snd_pcm_substream *substream,
                /* the delta value is small or zero in most cases */
                while (delta > 0) {
                        new_hw_ptr += runtime->period_size;
-                       if (new_hw_ptr >= runtime->boundary)
+                       if (new_hw_ptr >= runtime->boundary) {
                                new_hw_ptr -= runtime->boundary;
+                               crossed_boundary--;
+                       }
                        delta--;
                }
                /* align hw_base to buffer_size */
@@ -507,9 +522,35 @@ static int snd_pcm_update_hw_ptr0(struct snd_pcm_substream *substream,
        runtime->hw_ptr_base = hw_base;
        runtime->status->hw_ptr = new_hw_ptr;
        runtime->hw_ptr_jiffies = curr_jiffies;
-       if (runtime->tstamp_mode == SNDRV_PCM_TSTAMP_ENABLE)
+       if (crossed_boundary) {
+               snd_BUG_ON(crossed_boundary != 1);
+               runtime->hw_ptr_wrap += runtime->boundary;
+       }
+       if (runtime->tstamp_mode == SNDRV_PCM_TSTAMP_ENABLE) {
                runtime->status->tstamp = curr_tstamp;
 
+               if (!(runtime->hw.info & SNDRV_PCM_INFO_HAS_WALL_CLOCK)) {
+                       /*
+                        * no wall clock available, provide audio timestamp
+                        * derived from pointer position+delay
+                        */
+                       u64 audio_frames, audio_nsecs;
+
+                       if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+                               audio_frames = runtime->hw_ptr_wrap
+                                       + runtime->status->hw_ptr
+                                       - runtime->delay;
+                       else
+                               audio_frames = runtime->hw_ptr_wrap
+                                       + runtime->status->hw_ptr
+                                       + runtime->delay;
+                       audio_nsecs = div_u64(audio_frames * 1000000000LL,
+                                       runtime->rate);
+                       audio_tstamp = ns_to_timespec(audio_nsecs);
+               }
+               runtime->status->audio_tstamp = audio_tstamp;
+       }
+
        return snd_pcm_update_state(substream, runtime);
 }
 
@@ -1661,8 +1702,10 @@ static int snd_pcm_lib_ioctl_reset(struct snd_pcm_substream *substream,
        if (snd_pcm_running(substream) &&
            snd_pcm_update_hw_ptr(substream) >= 0)
                runtime->status->hw_ptr %= runtime->buffer_size;
-       else
+       else {
                runtime->status->hw_ptr = 0;
+               runtime->hw_ptr_wrap = 0;
+       }
        snd_pcm_stream_unlock_irqrestore(substream, flags);
        return 0;
 }
index f9ddecf..c76f637 100644 (file)
@@ -602,6 +602,8 @@ int snd_pcm_status(struct snd_pcm_substream *substream,
                snd_pcm_update_hw_ptr(substream);
                if (runtime->tstamp_mode == SNDRV_PCM_TSTAMP_ENABLE) {
                        status->tstamp = runtime->status->tstamp;
+                       status->audio_tstamp =
+                               runtime->status->audio_tstamp;
                        goto _tstamp_end;
                }
        }
index fe5ae09..5e43841 100644 (file)
@@ -35,7 +35,6 @@ config SND_PCSP
        tristate "PC-Speaker support (READ HELP!)"
        depends on PCSPKR_PLATFORM && X86 && HIGH_RES_TIMERS
        depends on INPUT
-       depends on EXPERIMENTAL
        select SND_PCM
        help
          If you don't have a sound card in your computer, you can include a
index 0fe6d64..1904046 100644 (file)
@@ -120,7 +120,6 @@ struct loopback_pcm {
        unsigned int last_drift;
        unsigned long last_jiffies;
        struct timer_list timer;
-       spinlock_t timer_lock;
 };
 
 static struct platform_device *devices[SNDRV_CARDS];
@@ -166,12 +165,12 @@ static inline unsigned int get_rate_shift(struct loopback_pcm *dpcm)
        return get_setup(dpcm)->rate_shift;
 }
 
+/* call in cable->lock */
 static void loopback_timer_start(struct loopback_pcm *dpcm)
 {
        unsigned long tick;
        unsigned int rate_shift = get_rate_shift(dpcm);
 
-       spin_lock(&dpcm->timer_lock);
        if (rate_shift != dpcm->pcm_rate_shift) {
                dpcm->pcm_rate_shift = rate_shift;
                dpcm->period_size_frac = frac_pos(dpcm, dpcm->pcm_period_size);
@@ -184,15 +183,13 @@ static void loopback_timer_start(struct loopback_pcm *dpcm)
        tick = (tick + dpcm->pcm_bps - 1) / dpcm->pcm_bps;
        dpcm->timer.expires = jiffies + tick;
        add_timer(&dpcm->timer);
-       spin_unlock(&dpcm->timer_lock);
 }
 
+/* call in cable->lock */
 static inline void loopback_timer_stop(struct loopback_pcm *dpcm)
 {
-       spin_lock(&dpcm->timer_lock);
        del_timer(&dpcm->timer);
        dpcm->timer.expires = 0;
-       spin_unlock(&dpcm->timer_lock);
 }
 
 #define CABLE_VALID_PLAYBACK   (1 << SNDRV_PCM_STREAM_PLAYBACK)
@@ -274,8 +271,8 @@ static int loopback_trigger(struct snd_pcm_substream *substream, int cmd)
                spin_lock(&cable->lock);        
                cable->running |= stream;
                cable->pause &= ~stream;
-               spin_unlock(&cable->lock);
                loopback_timer_start(dpcm);
+               spin_unlock(&cable->lock);
                if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
                        loopback_active_notify(dpcm);
                break;
@@ -283,23 +280,23 @@ static int loopback_trigger(struct snd_pcm_substream *substream, int cmd)
                spin_lock(&cable->lock);        
                cable->running &= ~stream;
                cable->pause &= ~stream;
-               spin_unlock(&cable->lock);
                loopback_timer_stop(dpcm);
+               spin_unlock(&cable->lock);
                if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
                        loopback_active_notify(dpcm);
                break;
        case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
                spin_lock(&cable->lock);        
                cable->pause |= stream;
-               spin_unlock(&cable->lock);
                loopback_timer_stop(dpcm);
+               spin_unlock(&cable->lock);
                break;
        case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
                spin_lock(&cable->lock);
                dpcm->last_jiffies = jiffies;
                cable->pause &= ~stream;
-               spin_unlock(&cable->lock);
                loopback_timer_start(dpcm);
+               spin_unlock(&cable->lock);
                break;
        default:
                return -EINVAL;
@@ -477,6 +474,7 @@ static inline void bytepos_finish(struct loopback_pcm *dpcm,
        dpcm->buf_pos %= dpcm->pcm_buffer_size;
 }
 
+/* call in cable->lock */
 static unsigned int loopback_pos_update(struct loopback_cable *cable)
 {
        struct loopback_pcm *dpcm_play =
@@ -485,9 +483,7 @@ static unsigned int loopback_pos_update(struct loopback_cable *cable)
                        cable->streams[SNDRV_PCM_STREAM_CAPTURE];
        unsigned long delta_play = 0, delta_capt = 0;
        unsigned int running, count1, count2;
-       unsigned long flags;
 
-       spin_lock_irqsave(&cable->lock, flags);
        running = cable->running ^ cable->pause;
        if (running & (1 << SNDRV_PCM_STREAM_PLAYBACK)) {
                delta_play = jiffies - dpcm_play->last_jiffies;
@@ -529,32 +525,39 @@ static unsigned int loopback_pos_update(struct loopback_cable *cable)
        bytepos_finish(dpcm_play, count1);
        bytepos_finish(dpcm_capt, count1);
  unlock:
-       spin_unlock_irqrestore(&cable->lock, flags);
        return running;
 }
 
 static void loopback_timer_function(unsigned long data)
 {
        struct loopback_pcm *dpcm = (struct loopback_pcm *)data;
-       unsigned int running;
+       unsigned long flags;
 
-       running = loopback_pos_update(dpcm->cable);
-       if (running & (1 << dpcm->substream->stream)) {
+       spin_lock_irqsave(&dpcm->cable->lock, flags);
+       if (loopback_pos_update(dpcm->cable) & (1 << dpcm->substream->stream)) {
                loopback_timer_start(dpcm);
                if (dpcm->period_update_pending) {
                        dpcm->period_update_pending = 0;
+                       spin_unlock_irqrestore(&dpcm->cable->lock, flags);
+                       /* need to unlock before calling below */
                        snd_pcm_period_elapsed(dpcm->substream);
+                       return;
                }
        }
+       spin_unlock_irqrestore(&dpcm->cable->lock, flags);
 }
 
 static snd_pcm_uframes_t loopback_pointer(struct snd_pcm_substream *substream)
 {
        struct snd_pcm_runtime *runtime = substream->runtime;
        struct loopback_pcm *dpcm = runtime->private_data;
+       snd_pcm_uframes_t pos;
 
+       spin_lock(&dpcm->cable->lock);
        loopback_pos_update(dpcm->cable);
-       return bytes_to_frames(runtime, dpcm->buf_pos);
+       pos = dpcm->buf_pos;
+       spin_unlock(&dpcm->cable->lock);
+       return bytes_to_frames(runtime, pos);
 }
 
 static struct snd_pcm_hardware loopback_pcm_hardware =
@@ -672,7 +675,6 @@ static int loopback_open(struct snd_pcm_substream *substream)
        dpcm->substream = substream;
        setup_timer(&dpcm->timer, loopback_timer_function,
                    (unsigned long)dpcm);
-       spin_lock_init(&dpcm->timer_lock);
 
        cable = loopback->cables[substream->number][dev];
        if (!cable) {
index 54bb664..4f522cf 100644 (file)
@@ -134,6 +134,9 @@ struct snd_dummy {
        spinlock_t mixer_lock;
        int mixer_volume[MIXER_ADDR_LAST+1][2];
        int capture_source[MIXER_ADDR_LAST+1][2];
+       int iobox;
+       struct snd_kcontrol *cd_volume_ctl;
+       struct snd_kcontrol *cd_switch_ctl;
        const struct dummy_timer_ops *timer_ops;
 };
 
@@ -817,6 +820,57 @@ static int snd_dummy_capsrc_put(struct snd_kcontrol *kcontrol, struct snd_ctl_el
        return change;
 }
 
+static int snd_dummy_iobox_info(struct snd_kcontrol *kcontrol,
+                               struct snd_ctl_elem_info *info)
+{
+       const char *const names[] = { "None", "CD Player" };
+
+       return snd_ctl_enum_info(info, 1, 2, names);
+}
+
+static int snd_dummy_iobox_get(struct snd_kcontrol *kcontrol,
+                              struct snd_ctl_elem_value *value)
+{
+       struct snd_dummy *dummy = snd_kcontrol_chip(kcontrol);
+
+       value->value.enumerated.item[0] = dummy->iobox;
+       return 0;
+}
+
+static int snd_dummy_iobox_put(struct snd_kcontrol *kcontrol,
+                              struct snd_ctl_elem_value *value)
+{
+       struct snd_dummy *dummy = snd_kcontrol_chip(kcontrol);
+       int changed;
+
+       if (value->value.enumerated.item[0] > 1)
+               return -EINVAL;
+
+       changed = value->value.enumerated.item[0] != dummy->iobox;
+       if (changed) {
+               dummy->iobox = value->value.enumerated.item[0];
+
+               if (dummy->iobox) {
+                       dummy->cd_volume_ctl->vd[0].access &=
+                               ~SNDRV_CTL_ELEM_ACCESS_INACTIVE;
+                       dummy->cd_switch_ctl->vd[0].access &=
+                               ~SNDRV_CTL_ELEM_ACCESS_INACTIVE;
+               } else {
+                       dummy->cd_volume_ctl->vd[0].access |=
+                               SNDRV_CTL_ELEM_ACCESS_INACTIVE;
+                       dummy->cd_switch_ctl->vd[0].access |=
+                               SNDRV_CTL_ELEM_ACCESS_INACTIVE;
+               }
+
+               snd_ctl_notify(dummy->card, SNDRV_CTL_EVENT_MASK_INFO,
+                              &dummy->cd_volume_ctl->id);
+               snd_ctl_notify(dummy->card, SNDRV_CTL_EVENT_MASK_INFO,
+                              &dummy->cd_switch_ctl->id);
+       }
+
+       return changed;
+}
+
 static struct snd_kcontrol_new snd_dummy_controls[] = {
 DUMMY_VOLUME("Master Volume", 0, MIXER_ADDR_MASTER),
 DUMMY_CAPSRC("Master Capture Switch", 0, MIXER_ADDR_MASTER),
@@ -827,22 +881,37 @@ DUMMY_CAPSRC("Line Capture Switch", 0, MIXER_ADDR_LINE),
 DUMMY_VOLUME("Mic Volume", 0, MIXER_ADDR_MIC),
 DUMMY_CAPSRC("Mic Capture Switch", 0, MIXER_ADDR_MIC),
 DUMMY_VOLUME("CD Volume", 0, MIXER_ADDR_CD),
-DUMMY_CAPSRC("CD Capture Switch", 0, MIXER_ADDR_CD)
+DUMMY_CAPSRC("CD Capture Switch", 0, MIXER_ADDR_CD),
+{
+       .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+       .name  = "External I/O Box",
+       .info  = snd_dummy_iobox_info,
+       .get   = snd_dummy_iobox_get,
+       .put   = snd_dummy_iobox_put,
+},
 };
 
 static int __devinit snd_card_dummy_new_mixer(struct snd_dummy *dummy)
 {
        struct snd_card *card = dummy->card;
+       struct snd_kcontrol *kcontrol;
        unsigned int idx;
        int err;
 
        spin_lock_init(&dummy->mixer_lock);
        strcpy(card->mixername, "Dummy Mixer");
+       dummy->iobox = 1;
 
        for (idx = 0; idx < ARRAY_SIZE(snd_dummy_controls); idx++) {
-               err = snd_ctl_add(card, snd_ctl_new1(&snd_dummy_controls[idx], dummy));
+               kcontrol = snd_ctl_new1(&snd_dummy_controls[idx], dummy);
+               err = snd_ctl_add(card, kcontrol);
                if (err < 0)
                        return err;
+               if (!strcmp(kcontrol->id.name, "CD Volume"))
+                       dummy->cd_volume_ctl = kcontrol;
+               else if (!strcmp(kcontrol->id.name, "CD Capture Switch"))
+                       dummy->cd_switch_ctl = kcontrol;
+
        }
        return 0;
 }
index a38d964..affa134 100644 (file)
@@ -425,7 +425,7 @@ config SND_WAVEFRONT
 
 config SND_MSND_PINNACLE
        tristate "Turtle Beach MultiSound Pinnacle/Fiji driver"
-       depends on X86 && EXPERIMENTAL
+       depends on X86
        select FW_LOADER
        select SND_MPU401_UART
        select SND_PCM
@@ -438,7 +438,7 @@ config SND_MSND_PINNACLE
 
 config SND_MSND_CLASSIC
        tristate "Support for Turtle Beach MultiSound Classic, Tahiti, Monterey"
-       depends on X86 && EXPERIMENTAL
+       depends on X86
        select FW_LOADER
        select SND_MPU401_UART
        select SND_PCM
index f99fa25..6150eb1 100644 (file)
@@ -630,7 +630,7 @@ config SND_ICE1724
          AudioTrak Prodigy 192, 7.1 (HIFI/LT/XT), HD2; Hercules
          Fortissimo IV; ESI Juli@; Pontis MS300; EGO-SYS WaveTerminal
          192M; Albatron K8X800 Pro II; Chaintech ZNF3-150/250, 9CJS,
-         AV-710; Shuttle SN25P.
+         AV-710; Shuttle SN25P; Philips PSC724 Ultimate Edge.
 
          To compile this driver as a module, choose M here: the module
          will be called snd-ice1724.
index 456a758..ac91637 100644 (file)
@@ -49,14 +49,12 @@ short hpi_dsp_code_open(u32 adapter, void *os_data, struct dsp_code *dsp_code,
        err = request_firmware(&firmware, fw_name, &dev->dev);
 
        if (err || !firmware) {
-               dev_printk(KERN_ERR, &dev->dev,
-                       "%d, request_firmware failed for  %s\n", err,
-                       fw_name);
+               dev_err(&dev->dev, "%d, request_firmware failed for %s\n",
+                       err, fw_name);
                goto error1;
        }
        if (firmware->size < sizeof(header)) {
-               dev_printk(KERN_ERR, &dev->dev, "Header size too small %s\n",
-                       fw_name);
+               dev_err(&dev->dev, "Header size too small %s\n", fw_name);
                goto error2;
        }
        memcpy(&header, firmware->data, sizeof(header));
@@ -64,7 +62,7 @@ short hpi_dsp_code_open(u32 adapter, void *os_data, struct dsp_code *dsp_code,
        if ((header.type != 0x45444F43) ||      /* "CODE" */
                (header.adapter != adapter)
                || (header.size != firmware->size)) {
-               dev_printk(KERN_ERR, &dev->dev,
+               dev_err(&dev->dev,
                        "Invalid firmware header size %d != file %zd\n",
                        header.size, firmware->size);
                goto error2;
@@ -72,17 +70,15 @@ short hpi_dsp_code_open(u32 adapter, void *os_data, struct dsp_code *dsp_code,
 
        if ((header.version >> 9) != (HPI_VER >> 9)) {
                /* Consider even and subsequent odd minor versions to be compatible */
-               dev_printk(KERN_ERR, &dev->dev,
-                       "Incompatible firmware version "
-                       "DSP image %X != Driver %X\n", header.version,
-                       HPI_VER);
+               dev_err(&dev->dev, "Incompatible firmware version DSP image %X != Driver %X\n",
+                       header.version, HPI_VER);
                goto error2;
        }
 
        if (header.version != HPI_VER) {
-               dev_printk(KERN_INFO, &dev->dev,
-                       "Firmware: release version mismatch  DSP image %X != Driver %X\n",
-                       header.version, HPI_VER);
+               dev_info(&dev->dev,
+                        "Firmware: release version mismatch  DSP image %X != Driver %X\n",
+                        header.version, HPI_VER);
        }
 
        HPI_DEBUG_LOG(DEBUG, "dsp code %s opened\n", fw_name);
index 6091562..8f96749 100644 (file)
@@ -326,7 +326,7 @@ int __devinit asihpi_adapter_probe(struct pci_dev *pci_dev,
                pci_dev->subsystem_device, pci_dev->devfn);
 
        if (pci_enable_device(pci_dev) < 0) {
-               dev_printk(KERN_ERR, &pci_dev->dev,
+               dev_err(&pci_dev->dev,
                        "pci_enable_device failed, disabling device\n");
                return -EIO;
        }
@@ -398,9 +398,8 @@ int __devinit asihpi_adapter_probe(struct pci_dev *pci_dev,
        mutex_init(&adapters[adapter_index].mutex);
        pci_set_drvdata(pci_dev, &adapters[adapter_index]);
 
-       dev_printk(KERN_INFO, &pci_dev->dev,
-               "probe succeeded for ASI%04X HPI index %d\n",
-               adapter.adapter->type, adapter_index);
+       dev_info(&pci_dev->dev, "probe succeeded for ASI%04X HPI index %d\n",
+                adapter.adapter->type, adapter_index);
 
        return 0;
 
@@ -448,11 +447,11 @@ void __devexit asihpi_adapter_remove(struct pci_dev *pci_dev)
 
        pci_set_drvdata(pci_dev, NULL);
        if (1)
-               dev_printk(KERN_INFO, &pci_dev->dev,
-                       "remove %04x:%04x,%04x:%04x,%04x," " HPI index %d.\n",
-                       pci_dev->vendor, pci_dev->device,
-                       pci_dev->subsystem_vendor, pci_dev->subsystem_device,
-                       pci_dev->devfn, pa->adapter->index);
+               dev_info(&pci_dev->dev,
+                        "remove %04x:%04x,%04x:%04x,%04x, HPI index %d\n",
+                        pci_dev->vendor, pci_dev->device,
+                        pci_dev->subsystem_vendor, pci_dev->subsystem_device,
+                        pci_dev->devfn, pa->adapter->index);
 
        memset(pa, 0, sizeof(*pa));
 }
index 525f881..2698abf 100644 (file)
@@ -2461,7 +2461,12 @@ static irqreturn_t vortex_interrupt(int irq, void *dev_id)
 #ifndef CHIP_AU8810
                for (i = 0; i < NR_WT; i++) {
                        if (vortex->dma_wt[i].fifo_status == FIFO_START) {
-                               if (vortex_wtdma_bufshift(vortex, i)) ;
+                               /* FIXME: we ignore the return value from
+                                * vortex_wtdma_bufshift() below as the delta
+                                * calculation seems not working for wavetable
+                                * by some reason
+                                */
+                               vortex_wtdma_bufshift(vortex, i);
                                spin_unlock(&vortex->lock);
                                snd_pcm_period_elapsed(vortex->dma_wt[i].
                                                       substream);
index 7105c3d..6eeb889 100644 (file)
@@ -37,8 +37,8 @@ config SND_HDA_HWDEP
          with codecs for debugging purposes.
 
 config SND_HDA_RECONFIG
-       bool "Allow dynamic codec reconfiguration (EXPERIMENTAL)"
-       depends on SND_HDA_HWDEP && EXPERIMENTAL
+       bool "Allow dynamic codec reconfiguration"
+       depends on SND_HDA_HWDEP
        help
          Say Y here to enable the HD-audio codec re-configuration feature.
          This adds the sysfs interfaces to allow user to clear the whole
@@ -72,7 +72,6 @@ config SND_HDA_INPUT_JACK
 
 config SND_HDA_PATCH_LOADER
        bool "Support initialization patch loading for HD-audio"
-       depends on EXPERIMENTAL
        select FW_LOADER
        select SND_HDA_HWDEP
        select SND_HDA_RECONFIG
index bd4149f..24a2514 100644 (file)
@@ -8,6 +8,7 @@ snd-hda-codec-$(CONFIG_SND_HDA_INPUT_BEEP) += hda_beep.o
 
 # for trace-points
 CFLAGS_hda_codec.o := -I$(src)
+CFLAGS_hda_intel.o := -I$(src)
 
 snd-hda-codec-realtek-objs :=  patch_realtek.o
 snd-hda-codec-cmedia-objs :=   patch_cmedia.o
index 70d4848..569bc05 100644 (file)
@@ -1135,6 +1135,19 @@ static void restore_shutup_pins(struct hda_codec *codec)
 }
 #endif
 
+static void hda_jackpoll_work(struct work_struct *work)
+{
+       struct hda_codec *codec =
+               container_of(work, struct hda_codec, jackpoll_work.work);
+       if (!codec->jackpoll_interval)
+               return;
+
+       snd_hda_jack_set_dirty_all(codec);
+       snd_hda_jack_poll_all(codec);
+       queue_delayed_work(codec->bus->workq, &codec->jackpoll_work,
+                          codec->jackpoll_interval);
+}
+
 static void init_hda_cache(struct hda_cache_rec *cache,
                           unsigned int record_size);
 static void free_hda_cache(struct hda_cache_rec *cache);
@@ -1190,6 +1203,7 @@ static void snd_hda_codec_free(struct hda_codec *codec)
 {
        if (!codec)
                return;
+       cancel_delayed_work_sync(&codec->jackpoll_work);
        snd_hda_jack_tbl_clear(codec);
        restore_init_pincfgs(codec);
 #ifdef CONFIG_PM
@@ -1273,6 +1287,7 @@ int /*__devinit*/ snd_hda_codec_new(struct hda_bus *bus,
        snd_array_init(&codec->cvt_setups, sizeof(struct hda_cvt_setup), 8);
        snd_array_init(&codec->conn_lists, sizeof(hda_nid_t), 64);
        snd_array_init(&codec->spdif_out, sizeof(struct hda_spdif_out), 16);
+       INIT_DELAYED_WORK(&codec->jackpoll_work, hda_jackpoll_work);
 
 #ifdef CONFIG_PM
        spin_lock_init(&codec->power_lock);
@@ -2151,12 +2166,12 @@ EXPORT_SYMBOL_HDA(snd_hda_set_vmaster_tlv);
 
 /* find a mixer control element with the given name */
 static struct snd_kcontrol *
-_snd_hda_find_mixer_ctl(struct hda_codec *codec,
-                       const char *name, int idx)
+find_mixer_ctl(struct hda_codec *codec, const char *name, int dev, int idx)
 {
        struct snd_ctl_elem_id id;
        memset(&id, 0, sizeof(id));
        id.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
+       id.device = dev;
        id.index = idx;
        if (snd_BUG_ON(strlen(name) >= sizeof(id.name)))
                return NULL;
@@ -2174,15 +2189,16 @@ _snd_hda_find_mixer_ctl(struct hda_codec *codec,
 struct snd_kcontrol *snd_hda_find_mixer_ctl(struct hda_codec *codec,
                                            const char *name)
 {
-       return _snd_hda_find_mixer_ctl(codec, name, 0);
+       return find_mixer_ctl(codec, name, 0, 0);
 }
 EXPORT_SYMBOL_HDA(snd_hda_find_mixer_ctl);
 
-static int find_empty_mixer_ctl_idx(struct hda_codec *codec, const char *name)
+static int find_empty_mixer_ctl_idx(struct hda_codec *codec, const char *name,
+                                   int dev)
 {
        int idx;
        for (idx = 0; idx < 16; idx++) { /* 16 ctlrs should be large enough */
-               if (!_snd_hda_find_mixer_ctl(codec, name, idx))
+               if (!find_mixer_ctl(codec, name, dev, idx))
                        return idx;
        }
        return -EBUSY;
@@ -2349,7 +2365,7 @@ int snd_hda_codec_reset(struct hda_codec *codec)
                return -EBUSY;
 
        /* OK, let it free */
-
+       cancel_delayed_work_sync(&codec->jackpoll_work);
 #ifdef CONFIG_PM
        cancel_delayed_work_sync(&codec->power_work);
        codec->power_on = 0;
@@ -3133,26 +3149,48 @@ static struct snd_kcontrol_new dig_mixes[] = {
 };
 
 /**
- * snd_hda_create_spdif_out_ctls - create Output SPDIF-related controls
+ * snd_hda_create_dig_out_ctls - create Output SPDIF-related controls
  * @codec: the HDA codec
- * @nid: audio out widget NID
- *
- * Creates controls related with the SPDIF output.
- * Called from each patch supporting the SPDIF out.
+ * @associated_nid: NID that new ctls associated with
+ * @cvt_nid: converter NID
+ * @type: HDA_PCM_TYPE_*
+ * Creates controls related with the digital output.
+ * Called from each patch supporting the digital out.
  *
  * Returns 0 if successful, or a negative error code.
  */
-int snd_hda_create_spdif_out_ctls(struct hda_codec *codec,
-                                 hda_nid_t associated_nid,
-                                 hda_nid_t cvt_nid)
+int snd_hda_create_dig_out_ctls(struct hda_codec *codec,
+                               hda_nid_t associated_nid,
+                               hda_nid_t cvt_nid,
+                               int type)
 {
        int err;
        struct snd_kcontrol *kctl;
        struct snd_kcontrol_new *dig_mix;
-       int idx;
+       int idx, dev = 0;
+       const int spdif_pcm_dev = 1;
        struct hda_spdif_out *spdif;
 
-       idx = find_empty_mixer_ctl_idx(codec, "IEC958 Playback Switch");
+       if (codec->primary_dig_out_type == HDA_PCM_TYPE_HDMI &&
+           type == HDA_PCM_TYPE_SPDIF) {
+               dev = spdif_pcm_dev;
+       } else if (codec->primary_dig_out_type == HDA_PCM_TYPE_SPDIF &&
+                  type == HDA_PCM_TYPE_HDMI) {
+               for (idx = 0; idx < codec->spdif_out.used; idx++) {
+                       spdif = snd_array_elem(&codec->spdif_out, idx);
+                       for (dig_mix = dig_mixes; dig_mix->name; dig_mix++) {
+                               kctl = find_mixer_ctl(codec, dig_mix->name, 0, idx);
+                               if (!kctl)
+                                       break;
+                               kctl->id.device = spdif_pcm_dev;
+                       }
+               }
+               codec->primary_dig_out_type = HDA_PCM_TYPE_HDMI;
+       }
+       if (!codec->primary_dig_out_type)
+               codec->primary_dig_out_type = type;
+
+       idx = find_empty_mixer_ctl_idx(codec, "IEC958 Playback Switch", dev);
        if (idx < 0) {
                printk(KERN_ERR "hda_codec: too many IEC958 outputs\n");
                return -EBUSY;
@@ -3162,6 +3200,7 @@ int snd_hda_create_spdif_out_ctls(struct hda_codec *codec,
                kctl = snd_ctl_new1(dig_mix, codec);
                if (!kctl)
                        return -ENOMEM;
+               kctl->id.device = dev;
                kctl->id.index = idx;
                kctl->private_value = codec->spdif_out.used - 1;
                err = snd_hda_ctl_add(codec, associated_nid, kctl);
@@ -3174,7 +3213,7 @@ int snd_hda_create_spdif_out_ctls(struct hda_codec *codec,
        spdif->status = convert_to_spdif_status(spdif->ctls);
        return 0;
 }
-EXPORT_SYMBOL_HDA(snd_hda_create_spdif_out_ctls);
+EXPORT_SYMBOL_HDA(snd_hda_create_dig_out_ctls);
 
 /* get the hda_spdif_out entry from the given NID
  * call within spdif_mutex lock
@@ -3349,7 +3388,7 @@ int snd_hda_create_spdif_in_ctls(struct hda_codec *codec, hda_nid_t nid)
        struct snd_kcontrol_new *dig_mix;
        int idx;
 
-       idx = find_empty_mixer_ctl_idx(codec, "IEC958 Capture Switch");
+       idx = find_empty_mixer_ctl_idx(codec, "IEC958 Capture Switch", 0);
        if (idx < 0) {
                printk(KERN_ERR "hda_codec: too many IEC958 inputs\n");
                return -EBUSY;
@@ -3646,7 +3685,6 @@ static void hda_call_codec_resume(struct hda_codec *codec)
        restore_pincfgs(codec); /* restore all current pin configs */
        restore_shutup_pins(codec);
        hda_exec_init_verbs(codec);
-       snd_hda_jack_set_dirty_all(codec);
        if (codec->patch_ops.resume)
                codec->patch_ops.resume(codec);
        else {
@@ -3655,7 +3693,13 @@ static void hda_call_codec_resume(struct hda_codec *codec)
                snd_hda_codec_resume_amp(codec);
                snd_hda_codec_resume_cache(codec);
        }
-       snd_hda_jack_report_sync(codec);
+
+       if (codec->jackpoll_interval)
+               hda_jackpoll_work(&codec->jackpoll_work.work);
+       else {
+               snd_hda_jack_set_dirty_all(codec);
+               snd_hda_jack_report_sync(codec);
+       }
        snd_hda_power_down(codec); /* flag down before returning */
 }
 #endif /* CONFIG_PM */
@@ -3737,7 +3781,10 @@ int snd_hda_codec_build_controls(struct hda_codec *codec)
        if (err < 0)
                return err;
 
-       snd_hda_jack_report_sync(codec); /* call at the last init point */
+       if (codec->jackpoll_interval)
+               hda_jackpoll_work(&codec->jackpoll_work.work);
+       else
+               snd_hda_jack_report_sync(codec); /* call at the last init point */
        return 0;
 }
 
@@ -4449,7 +4496,7 @@ int snd_hda_add_new_ctls(struct hda_codec *codec,
                                addr = codec->addr;
                        else if (!idx && !knew->index) {
                                idx = find_empty_mixer_ctl_idx(codec,
-                                                              knew->name);
+                                                              knew->name, 0);
                                if (idx <= 0)
                                        return err;
                        } else
@@ -4769,10 +4816,20 @@ EXPORT_SYMBOL_HDA(snd_hda_input_mux_put);
 static void setup_dig_out_stream(struct hda_codec *codec, hda_nid_t nid,
                                 unsigned int stream_tag, unsigned int format)
 {
-       struct hda_spdif_out *spdif = snd_hda_spdif_out_of_nid(codec, nid);
-
-       /* turn off SPDIF once; otherwise the IEC958 bits won't be updated */
-       if (codec->spdif_status_reset && (spdif->ctls & AC_DIG1_ENABLE))
+       struct hda_spdif_out *spdif;
+       unsigned int curr_fmt;
+       bool reset;
+
+       spdif = snd_hda_spdif_out_of_nid(codec, nid);
+       curr_fmt = snd_hda_codec_read(codec, nid, 0,
+                                     AC_VERB_GET_STREAM_FORMAT, 0);
+       reset = codec->spdif_status_reset &&
+               (spdif->ctls & AC_DIG1_ENABLE) &&
+               curr_fmt != format;
+
+       /* turn off SPDIF if needed; otherwise the IEC958 bits won't be
+          updated */
+       if (reset)
                set_dig_out_convert(codec, nid,
                                    spdif->ctls & ~AC_DIG1_ENABLE & 0xff,
                                    -1);
@@ -4784,7 +4841,7 @@ static void setup_dig_out_stream(struct hda_codec *codec, hda_nid_t nid,
                                                   format);
        }
        /* turn on again (if needed) */
-       if (codec->spdif_status_reset && (spdif->ctls & AC_DIG1_ENABLE))
+       if (reset)
                set_dig_out_convert(codec, nid,
                                    spdif->ctls & 0xff, -1);
 }
@@ -5128,6 +5185,7 @@ int snd_hda_suspend(struct hda_bus *bus)
        struct hda_codec *codec;
 
        list_for_each_entry(codec, &bus->codec_list, list) {
+               cancel_delayed_work_sync(&codec->jackpoll_work);
                if (hda_codec_is_power_on(codec))
                        hda_call_codec_suspend(codec, false);
        }
index 507fe8a..62d4229 100644 (file)
@@ -836,6 +836,7 @@ struct hda_codec {
        struct mutex hash_mutex;
        struct snd_array spdif_out;
        unsigned int spdif_in_enable;   /* SPDIF input enable? */
+       int primary_dig_out_type;       /* primary digital out PCM type */
        const hda_nid_t *slave_dig_outs; /* optional digital out slave widgets */
        struct snd_array init_pins;     /* initial (BIOS) pin configurations */
        struct snd_array driver_pins;   /* pin configs set by codec parser */
@@ -884,6 +885,8 @@ struct hda_codec {
 
        /* jack detection */
        struct snd_array jacktbl;
+       unsigned long jackpoll_interval; /* In jiffies. Zero means no poll, rely on unsol events */
+       struct delayed_work jackpoll_work;
 
 #ifdef CONFIG_SND_HDA_INPUT_JACK
        /* jack detection */
index cd2dbaf..2cc07c1 100644 (file)
@@ -47,6 +47,9 @@
 #include <linux/reboot.h>
 #include <linux/io.h>
 #include <linux/pm_runtime.h>
+#include <linux/clocksource.h>
+#include <linux/time.h>
+
 #ifdef CONFIG_X86
 /* for snoop control */
 #include <asm/pgtable.h>
@@ -68,6 +71,7 @@ static int position_fix[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)] = -1};
 static int bdl_pos_adj[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)] = -1};
 static int probe_mask[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)] = -1};
 static int probe_only[SNDRV_CARDS];
+static int jackpoll_ms[SNDRV_CARDS];
 static bool single_cmd;
 static int enable_msi = -1;
 #ifdef CONFIG_SND_HDA_PATCH_LOADER
@@ -95,6 +99,8 @@ module_param_array(probe_mask, int, NULL, 0444);
 MODULE_PARM_DESC(probe_mask, "Bitmask to probe codecs (default = -1).");
 module_param_array(probe_only, int, NULL, 0444);
 MODULE_PARM_DESC(probe_only, "Only probing and no codec initialization.");
+module_param_array(jackpoll_ms, int, NULL, 0444);
+MODULE_PARM_DESC(jackpoll_ms, "Ms between polling for jack events (default = 0, using unsol events only)");
 module_param(single_cmd, bool, 0444);
 MODULE_PARM_DESC(single_cmd, "Use single command to communicate with codecs "
                 "(for debugging only).");
@@ -416,6 +422,9 @@ struct azx_dev {
        unsigned int insufficient :1;
        unsigned int wc_marked:1;
        unsigned int no_period_wakeup:1;
+
+       struct timecounter  azx_tc;
+       struct cyclecounter azx_cc;
 };
 
 /* CORB/RIRB */
@@ -518,6 +527,9 @@ struct azx {
        struct list_head list;
 };
 
+#define CREATE_TRACE_POINTS
+#include "hda_intel_trace.h"
+
 /* driver types */
 enum {
        AZX_DRIVER_ICH,
@@ -829,8 +841,9 @@ static void azx_update_rirb(struct azx *chip)
                        smp_wmb();
                        chip->rirb.cmds[addr]--;
                } else
-                       snd_printk(KERN_ERR SFX "spurious response %#x:%#x, "
+                       snd_printk(KERN_ERR SFX "%s: spurious response %#x:%#x, "
                                   "last cmd=%#08x\n",
+                                  pci_name(chip->pci),
                                   res, res_ex,
                                   chip->last_cmd[addr]);
        }
@@ -1582,6 +1595,22 @@ static void azx_bus_reset(struct hda_bus *bus)
        bus->in_reset = 0;
 }
 
+static int get_jackpoll_interval(struct azx *chip)
+{
+       int i = jackpoll_ms[chip->dev_index];
+       unsigned int j;
+       if (i == 0)
+               return 0;
+       if (i < 50 || i > 60000)
+               j = 0;
+       else
+               j = msecs_to_jiffies(i);
+       if (j == 0)
+               snd_printk(KERN_WARNING SFX
+                          "jackpoll_ms value out of range: %d\n", i);
+       return j;
+}
+
 /*
  * Codec initialization
  */
@@ -1666,6 +1695,7 @@ static int DELAYED_INIT_MARK azx_codec_create(struct azx *chip, const char *mode
                        err = snd_hda_codec_new(chip->bus, c, &codec);
                        if (err < 0)
                                continue;
+                       codec->jackpoll_interval = get_jackpoll_interval(chip);
                        codec->beep_mode = chip->beep_mode;
                        codecs++;
                }
@@ -1728,6 +1758,64 @@ static inline void azx_release_device(struct azx_dev *azx_dev)
        azx_dev->opened = 0;
 }
 
+static cycle_t azx_cc_read(const struct cyclecounter *cc)
+{
+       struct azx_dev *azx_dev = container_of(cc, struct azx_dev, azx_cc);
+       struct snd_pcm_substream *substream = azx_dev->substream;
+       struct azx_pcm *apcm = snd_pcm_substream_chip(substream);
+       struct azx *chip = apcm->chip;
+
+       return azx_readl(chip, WALLCLK);
+}
+
+static void azx_timecounter_init(struct snd_pcm_substream *substream,
+                               bool force, cycle_t last)
+{
+       struct azx_dev *azx_dev = get_azx_dev(substream);
+       struct timecounter *tc = &azx_dev->azx_tc;
+       struct cyclecounter *cc = &azx_dev->azx_cc;
+       u64 nsec;
+
+       cc->read = azx_cc_read;
+       cc->mask = CLOCKSOURCE_MASK(32);
+
+       /*
+        * Converting from 24 MHz to ns means applying a 125/3 factor.
+        * To avoid any saturation issues in intermediate operations,
+        * the 125 factor is applied first. The division is applied
+        * last after reading the timecounter value.
+        * Applying the 1/3 factor as part of the multiplication
+        * requires at least 20 bits for a decent precision, however
+        * overflows occur after about 4 hours or less, not a option.
+        */
+
+       cc->mult = 125; /* saturation after 195 years */
+       cc->shift = 0;
+
+       nsec = 0; /* audio time is elapsed time since trigger */
+       timecounter_init(tc, cc, nsec);
+       if (force)
+               /*
+                * force timecounter to use predefined value,
+                * used for synchronized starts
+                */
+               tc->cycle_last = last;
+}
+
+static int azx_get_wallclock_tstamp(struct snd_pcm_substream *substream,
+                               struct timespec *ts)
+{
+       struct azx_dev *azx_dev = get_azx_dev(substream);
+       u64 nsec;
+
+       nsec = timecounter_read(&azx_dev->azx_tc);
+       nsec = div_u64(nsec, 3); /* can be optimized */
+
+       *ts = ns_to_timespec(nsec);
+
+       return 0;
+}
+
 static struct snd_pcm_hardware azx_pcm_hw = {
        .info =                 (SNDRV_PCM_INFO_MMAP |
                                 SNDRV_PCM_INFO_INTERLEAVED |
@@ -1737,6 +1825,7 @@ static struct snd_pcm_hardware azx_pcm_hw = {
                                 /* SNDRV_PCM_INFO_RESUME |*/
                                 SNDRV_PCM_INFO_PAUSE |
                                 SNDRV_PCM_INFO_SYNC_START |
+                                SNDRV_PCM_INFO_HAS_WALL_CLOCK |
                                 SNDRV_PCM_INFO_NO_PERIOD_WAKEUP),
        .formats =              SNDRV_PCM_FMTBIT_S16_LE,
        .rates =                SNDRV_PCM_RATE_48000,
@@ -1776,6 +1865,12 @@ static int azx_pcm_open(struct snd_pcm_substream *substream)
        runtime->hw.rates = hinfo->rates;
        snd_pcm_limit_hw_rates(runtime);
        snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS);
+
+       /* avoid wrap-around with wall-clock */
+       snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_BUFFER_TIME,
+                               20,
+                               178000000);
+
        if (chip->align_buffer_size)
                /* constrain buffer sizes to be multiple of 128
                   bytes. This is more efficient in terms of memory
@@ -1815,6 +1910,12 @@ static int azx_pcm_open(struct snd_pcm_substream *substream)
                mutex_unlock(&chip->open_mutex);
                return -EINVAL;
        }
+
+       /* disable WALLCLOCK timestamps for capture streams
+          until we figure out how to handle digital inputs */
+       if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
+               runtime->hw.info &= ~SNDRV_PCM_INFO_HAS_WALL_CLOCK;
+
        spin_lock_irqsave(&chip->reg_lock, flags);
        azx_dev->substream = substream;
        azx_dev->running = 0;
@@ -1961,6 +2062,9 @@ static int azx_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
        int rstart = 0, start, nsync = 0, sbits = 0;
        int nwait, timeout;
 
+       azx_dev = get_azx_dev(substream);
+       trace_azx_pcm_trigger(chip, azx_dev, cmd);
+
        switch (cmd) {
        case SNDRV_PCM_TRIGGER_START:
                rstart = 1;
@@ -2051,6 +2155,22 @@ static int azx_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
                        azx_readl(chip, OLD_SSYNC) & ~sbits);
        else
                azx_writel(chip, SSYNC, azx_readl(chip, SSYNC) & ~sbits);
+       if (start) {
+               azx_timecounter_init(substream, 0, 0);
+               if (nsync > 1) {
+                       cycle_t cycle_last;
+
+                       /* same start cycle for master and group */
+                       azx_dev = get_azx_dev(substream);
+                       cycle_last = azx_dev->azx_tc.cycle_last;
+
+                       snd_pcm_group_for_each_entry(s, substream) {
+                               if (s->pcm->card != substream->pcm->card)
+                                       continue;
+                               azx_timecounter_init(s, 1, cycle_last);
+                       }
+               }
+       }
        spin_unlock(&chip->reg_lock);
        return 0;
 }
@@ -2117,6 +2237,7 @@ static unsigned int azx_get_position(struct azx *chip,
 {
        unsigned int pos;
        int stream = azx_dev->substream->stream;
+       int delay = 0;
 
        switch (chip->position_fix[stream]) {
        case POS_FIX_LPIB:
@@ -2150,7 +2271,6 @@ static unsigned int azx_get_position(struct azx *chip,
            chip->position_fix[stream] == POS_FIX_POSBUF &&
            (chip->driver_caps & AZX_DCAPS_COUNT_LPIB_DELAY)) {
                unsigned int lpib_pos = azx_sd_readl(azx_dev, SD_LPIB);
-               int delay;
                if (stream == SNDRV_PCM_STREAM_PLAYBACK)
                        delay = pos - lpib_pos;
                else
@@ -2168,6 +2288,7 @@ static unsigned int azx_get_position(struct azx *chip,
                azx_dev->substream->runtime->delay =
                        bytes_to_frames(azx_dev->substream->runtime, delay);
        }
+       trace_azx_get_position(chip, azx_dev, pos, delay);
        return pos;
 }
 
@@ -2193,13 +2314,11 @@ static int azx_position_ok(struct azx *chip, struct azx_dev *azx_dev)
 {
        u32 wallclk;
        unsigned int pos;
-       int stream;
 
        wallclk = azx_readl(chip, WALLCLK) - azx_dev->start_wallclk;
        if (wallclk < (azx_dev->period_wallclk * 2) / 3)
                return -1;      /* bogus (too early) interrupt */
 
-       stream = azx_dev->substream->stream;
        pos = azx_get_position(chip, azx_dev, true);
 
        if (WARN_ONCE(!azx_dev->period_bytes,
@@ -2290,6 +2409,7 @@ static struct snd_pcm_ops azx_pcm_ops = {
        .prepare = azx_pcm_prepare,
        .trigger = azx_pcm_trigger,
        .pointer = azx_pcm_pointer,
+       .wall_clock =  azx_get_wallclock_tstamp,
        .mmap = azx_pcm_mmap,
        .page = snd_pcm_sgbuf_ops_page,
 };
diff --git a/sound/pci/hda/hda_intel_trace.h b/sound/pci/hda/hda_intel_trace.h
new file mode 100644 (file)
index 0000000..7b5e4c2
--- /dev/null
@@ -0,0 +1,62 @@
+#undef TRACE_SYSTEM
+#define TRACE_SYSTEM hda_intel
+#define TRACE_INCLUDE_FILE hda_intel_trace
+
+#if !defined(_TRACE_HDA_INTEL_H) || defined(TRACE_HEADER_MULTI_READ)
+#define _TRACE_HDA_INTEL_H
+
+#include <linux/tracepoint.h>
+
+struct azx;
+struct azx_dev;
+
+TRACE_EVENT(azx_pcm_trigger,
+
+       TP_PROTO(struct azx *chip, struct azx_dev *dev, int cmd),
+
+       TP_ARGS(chip, dev, cmd),
+
+       TP_STRUCT__entry(
+               __field( int, card )
+               __field( int, idx )
+               __field( int, cmd )
+       ),
+
+       TP_fast_assign(
+               __entry->card = (chip)->card->number;
+               __entry->idx = (dev)->index;
+               __entry->cmd = cmd;
+       ),
+
+       TP_printk("[%d:%d] cmd=%d", __entry->card, __entry->idx, __entry->cmd)
+);
+
+TRACE_EVENT(azx_get_position,
+
+    TP_PROTO(struct azx *chip, struct azx_dev *dev, unsigned int pos, unsigned int delay),
+
+           TP_ARGS(chip, dev, pos, delay),
+
+       TP_STRUCT__entry(
+               __field( int, card )
+               __field( int, idx )
+               __field( unsigned int, pos )
+               __field( unsigned int, delay )
+       ),
+
+       TP_fast_assign(
+               __entry->card = (chip)->card->number;
+               __entry->idx = (dev)->index;
+               __entry->pos = pos;
+               __entry->delay = delay;
+       ),
+
+       TP_printk("[%d:%d] pos=%u, delay=%u", __entry->card, __entry->idx, __entry->pos, __entry->delay)
+);
+
+#endif /* _TRACE_HDA_INTEL_H */
+
+/* This part must be outside protection */
+#undef TRACE_INCLUDE_PATH
+#define TRACE_INCLUDE_PATH .
+#include <trace/define_trace.h>
index 5c690cb..5bdbada 100644 (file)
@@ -206,6 +206,8 @@ int snd_hda_jack_detect_enable_callback(struct hda_codec *codec, hda_nid_t nid,
                jack->action = action;
        if (cb)
                jack->callback = cb;
+       if (codec->jackpoll_interval > 0)
+               return 0; /* No unsol if we're polling instead */
        return snd_hda_codec_write_cache(codec, nid, 0,
                                         AC_VERB_SET_UNSOLICITED_ENABLE,
                                         AC_USRSP_EN | jack->tag);
@@ -439,3 +441,25 @@ void snd_hda_jack_unsol_event(struct hda_codec *codec, unsigned int res)
 }
 EXPORT_SYMBOL_HDA(snd_hda_jack_unsol_event);
 
+void snd_hda_jack_poll_all(struct hda_codec *codec)
+{
+       struct hda_jack_tbl *jack = codec->jacktbl.list;
+       int i, changes = 0;
+
+       for (i = 0; i < codec->jacktbl.used; i++, jack++) {
+               unsigned int old_sense;
+               if (!jack->nid || !jack->jack_dirty || jack->phantom_jack)
+                       continue;
+               old_sense = get_jack_plug_state(jack->pin_sense);
+               jack_detect_update(codec, jack);
+               if (old_sense == get_jack_plug_state(jack->pin_sense))
+                       continue;
+               changes = 1;
+               if (jack->callback)
+                       jack->callback(codec, jack);
+       }
+       if (changes)
+               snd_hda_jack_report_sync(codec);
+}
+EXPORT_SYMBOL_HDA(snd_hda_jack_poll_all);
+
index af8dd47..4487785 100644 (file)
@@ -84,4 +84,6 @@ void snd_hda_jack_report_sync(struct hda_codec *codec);
 
 void snd_hda_jack_unsol_event(struct hda_codec *codec, unsigned int res);
 
+void snd_hda_jack_poll_all(struct hda_codec *codec);
+
 #endif /* __SOUND_HDA_JACK_H */
index 09dbdc3..8c43198 100644 (file)
@@ -240,9 +240,11 @@ int snd_hda_mixer_bind_tlv(struct snd_kcontrol *kcontrol, int op_flag,
 /*
  * SPDIF I/O
  */
-int snd_hda_create_spdif_out_ctls(struct hda_codec *codec,
-                                 hda_nid_t associated_nid,
-                                 hda_nid_t cvt_nid);
+int snd_hda_create_dig_out_ctls(struct hda_codec *codec,
+                               hda_nid_t associated_nid,
+                               hda_nid_t cvt_nid, int type);
+#define snd_hda_create_spdif_out_ctls(codec, anid, cnid) \
+       snd_hda_create_dig_out_ctls(codec, anid, cnid, HDA_PCM_TYPE_SPDIF)
 int snd_hda_create_spdif_in_ctls(struct hda_codec *codec, hda_nid_t nid);
 
 /*
index d5f3a26..b9039db 100644 (file)
@@ -873,8 +873,9 @@ static int build_digital_output(struct hda_codec *codec)
        if (!spec->multiout.dig_out_nid)
                return 0;
 
-       err = snd_hda_create_spdif_out_ctls(codec, spec->multiout.dig_out_nid,
-                                           spec->multiout.dig_out_nid);
+       err = snd_hda_create_dig_out_ctls(codec, spec->multiout.dig_out_nid,
+                                         spec->multiout.dig_out_nid,
+                                         spec->pcm_rec[1].pcm_type);
        if (err < 0)
                return err;
        err = snd_hda_create_spdif_share_sw(codec, &spec->multiout);
index 03b1dc3..252d419 100644 (file)
@@ -4405,7 +4405,10 @@ static const struct hda_codec_ops cx_auto_patch_ops = {
 enum {
        CXT_PINCFG_LENOVO_X200,
        CXT_PINCFG_LENOVO_TP410,
+       CXT_PINCFG_LEMOTE_A1004,
+       CXT_PINCFG_LEMOTE_A1205,
        CXT_FIXUP_STEREO_DMIC,
+       CXT_FIXUP_INC_MIC_BOOST,
 };
 
 static void cxt_fixup_stereo_dmic(struct hda_codec *codec,
@@ -4415,6 +4418,19 @@ static void cxt_fixup_stereo_dmic(struct hda_codec *codec,
        spec->fixup_stereo_dmic = 1;
 }
 
+static void cxt5066_increase_mic_boost(struct hda_codec *codec,
+                                  const struct hda_fixup *fix, int action)
+{
+       if (action != HDA_FIXUP_ACT_PRE_PROBE)
+               return;
+
+       snd_hda_override_amp_caps(codec, 0x17, HDA_OUTPUT,
+                                 (0x3 << AC_AMPCAP_OFFSET_SHIFT) |
+                                 (0x4 << AC_AMPCAP_NUM_STEPS_SHIFT) |
+                                 (0x27 << AC_AMPCAP_STEP_SIZE_SHIFT) |
+                                 (0 << AC_AMPCAP_MUTE_SHIFT));
+}
+
 /* ThinkPad X200 & co with cxt5051 */
 static const struct hda_pintbl cxt_pincfg_lenovo_x200[] = {
        { 0x16, 0x042140ff }, /* HP (seq# overridden) */
@@ -4432,6 +4448,18 @@ static const struct hda_pintbl cxt_pincfg_lenovo_tp410[] = {
        {}
 };
 
+/* Lemote A1004/A1205 with cxt5066 */
+static const struct hda_pintbl cxt_pincfg_lemote[] = {
+       { 0x1a, 0x90a10020 }, /* Internal mic */
+       { 0x1b, 0x03a11020 }, /* External mic */
+       { 0x1d, 0x400101f0 }, /* Not used */
+       { 0x1e, 0x40a701f0 }, /* Not used */
+       { 0x20, 0x404501f0 }, /* Not used */
+       { 0x22, 0x404401f0 }, /* Not used */
+       { 0x23, 0x40a701f0 }, /* Not used */
+       {}
+};
+
 static const struct hda_fixup cxt_fixups[] = {
        [CXT_PINCFG_LENOVO_X200] = {
                .type = HDA_FIXUP_PINS,
@@ -4441,10 +4469,24 @@ static const struct hda_fixup cxt_fixups[] = {
                .type = HDA_FIXUP_PINS,
                .v.pins = cxt_pincfg_lenovo_tp410,
        },
+       [CXT_PINCFG_LEMOTE_A1004] = {
+               .type = HDA_FIXUP_PINS,
+               .chained = true,
+               .chain_id = CXT_FIXUP_INC_MIC_BOOST,
+               .v.pins = cxt_pincfg_lemote,
+       },
+       [CXT_PINCFG_LEMOTE_A1205] = {
+               .type = HDA_FIXUP_PINS,
+               .v.pins = cxt_pincfg_lemote,
+       },
        [CXT_FIXUP_STEREO_DMIC] = {
                .type = HDA_FIXUP_FUNC,
                .v.func = cxt_fixup_stereo_dmic,
        },
+       [CXT_FIXUP_INC_MIC_BOOST] = {
+               .type = HDA_FIXUP_FUNC,
+               .v.func = cxt5066_increase_mic_boost,
+       },
 };
 
 static const struct snd_pci_quirk cxt5051_fixups[] = {
@@ -4461,6 +4503,8 @@ static const struct snd_pci_quirk cxt5066_fixups[] = {
        SND_PCI_QUIRK(0x17aa, 0x3975, "Lenovo U300s", CXT_FIXUP_STEREO_DMIC),
        SND_PCI_QUIRK(0x17aa, 0x3977, "Lenovo IdeaPad U310", CXT_FIXUP_STEREO_DMIC),
        SND_PCI_QUIRK(0x17aa, 0x397b, "Lenovo S205", CXT_FIXUP_STEREO_DMIC),
+       SND_PCI_QUIRK(0x1c06, 0x2011, "Lemote A1004", CXT_PINCFG_LEMOTE_A1004),
+       SND_PCI_QUIRK(0x1c06, 0x2012, "Lemote A1205", CXT_PINCFG_LEMOTE_A1205),
        {}
 };
 
index 71555cc..3824699 100644 (file)
@@ -1288,13 +1288,17 @@ static int hdmi_parse_codec(struct hda_codec *codec)
                }
        }
 
+#ifdef CONFIG_PM
+       /* We're seeing some problems with unsolicited hot plug events on
+        * PantherPoint after S3, if this is not enabled */
+       if (codec->vendor_id == 0x80862806)
+               codec->bus->power_keep_link_on = 1;
        /*
         * G45/IbexPeak don't support EPSS: the unsolicited pin hot plug event
         * can be lost and presence sense verb will become inaccurate if the
         * HDA link is powered off at hot plug or hw initialization time.
         */
-#ifdef CONFIG_PM
-       if (!(snd_hda_param_read(codec, codec->afg, AC_PAR_POWER_STATE) &
+       else if (!(snd_hda_param_read(codec, codec->afg, AC_PAR_POWER_STATE) &
              AC_PWRST_EPSS))
                codec->bus->power_keep_link_on = 1;
 #endif
@@ -1589,9 +1593,10 @@ static int generic_hdmi_build_controls(struct hda_codec *codec)
                if (err < 0)
                        return err;
 
-               err = snd_hda_create_spdif_out_ctls(codec,
-                                                   per_pin->pin_nid,
-                                                   per_pin->mux_nids[0]);
+               err = snd_hda_create_dig_out_ctls(codec,
+                                                 per_pin->pin_nid,
+                                                 per_pin->mux_nids[0],
+                                                 HDA_PCM_TYPE_HDMI);
                if (err < 0)
                        return err;
                snd_hda_spdif_ctls_unassign(codec, pin_idx);
index c0ce3b1..bc71be3 100644 (file)
@@ -1836,9 +1836,10 @@ static int __alc_build_controls(struct hda_codec *codec)
                        return err;
        }
        if (spec->multiout.dig_out_nid) {
-               err = snd_hda_create_spdif_out_ctls(codec,
-                                                   spec->multiout.dig_out_nid,
-                                                   spec->multiout.dig_out_nid);
+               err = snd_hda_create_dig_out_ctls(codec,
+                                                 spec->multiout.dig_out_nid,
+                                                 spec->multiout.dig_out_nid,
+                                                 spec->pcm_rec[1].pcm_type);
                if (err < 0)
                        return err;
                if (!spec->no_analog) {
index 9ba8af0..962a948 100644 (file)
@@ -1136,9 +1136,10 @@ static int stac92xx_build_controls(struct hda_codec *codec)
        }
 
        if (spec->multiout.dig_out_nid) {
-               err = snd_hda_create_spdif_out_ctls(codec,
-                                                   spec->multiout.dig_out_nid,
-                                                   spec->multiout.dig_out_nid);
+               err = snd_hda_create_dig_out_ctls(codec,
+                                                 spec->multiout.dig_out_nid,
+                                                 spec->multiout.dig_out_nid,
+                                                 spec->autocfg.dig_out_type[0]);
                if (err < 0)
                        return err;
                err = snd_hda_create_spdif_share_sw(codec,
index f7ce33f..7e50c13 100644 (file)
@@ -5,7 +5,7 @@
 
 snd-ice17xx-ak4xxx-objs := ak4xxx.o
 snd-ice1712-objs := ice1712.o delta.o hoontech.o ews.o
-snd-ice1724-objs := ice1724.o amp.o revo.o aureon.o vt1720_mobo.o pontis.o prodigy192.o prodigy_hifi.o juli.o phase.o wtm.o se.o maya44.o quartet.o
+snd-ice1724-objs := ice1724.o amp.o revo.o aureon.o vt1720_mobo.o pontis.o prodigy192.o prodigy_hifi.o juli.o phase.o wtm.o se.o maya44.o quartet.o psc724.o wm8766.o wm8776.o
 
 # Toplevel Module Dependency
 obj-$(CONFIG_SND_ICE1712) += snd-ice1712.o snd-ice17xx-ak4xxx.o
index e525da2..d9bd27b 100644 (file)
@@ -21,7 +21,6 @@
  *
  */      
 
-#include <asm/io.h>
 #include <linux/delay.h>
 #include <linux/interrupt.h>
 #include <linux/init.h>
index 20bcdde..ce9941c 100644 (file)
@@ -46,7 +46,6 @@
  *                    on mixer switch and other coll stuff.
  */
 
-#include <linux/io.h>
 #include <linux/delay.h>
 #include <linux/interrupt.h>
 #include <linux/init.h>
@@ -203,7 +202,8 @@ static void aureon_pca9554_write(struct snd_ice1712 *ice, unsigned char reg,
 static int aureon_universe_inmux_info(struct snd_kcontrol *kcontrol,
                                      struct snd_ctl_elem_info *uinfo)
 {
-       char *texts[3] = {"Internal Aux", "Wavetable", "Rear Line-In"};
+       static const char * const texts[3] =
+               {"Internal Aux", "Wavetable", "Rear Line-In"};
 
        uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
        uinfo->count = 1;
index 20c6b07..bbef99b 100644 (file)
@@ -22,7 +22,6 @@
  *
  */      
 
-#include <asm/io.h>
 #include <linux/delay.h>
 #include <linux/interrupt.h>
 #include <linux/init.h>
index 6fe35b8..bf289f0 100644 (file)
@@ -22,7 +22,6 @@
  *
  */      
 
-#include <asm/io.h>
 #include <linux/delay.h>
 #include <linux/interrupt.h>
 #include <linux/init.h>
@@ -576,7 +575,7 @@ static int __devinit snd_ice1712_ews_init(struct snd_ice1712 *ice)
 /* i/o sensitivity - this callback is shared among other devices, too */
 static int snd_ice1712_ewx_io_sense_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo){
 
-       static char *texts[2] = {
+       static const char * const texts[2] = {
                "+4dBu", "-10dBV",
        };
        uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
@@ -899,7 +898,7 @@ static int snd_ice1712_6fire_control_put(struct snd_kcontrol *kcontrol, struct s
 
 static int snd_ice1712_6fire_select_input_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
 {
-       static char *texts[4] = {
+       static const char * const texts[4] = {
                "Internal", "Front Input", "Rear Input", "Wave Table"
        };
        uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
index 6914189..3d84d21 100644 (file)
@@ -21,7 +21,6 @@
  *
  */      
 
-#include <asm/io.h>
 #include <linux/delay.h>
 #include <linux/interrupt.h>
 #include <linux/init.h>
index 5be2e12..dd64e22 100644 (file)
@@ -47,7 +47,6 @@
  */
 
 
-#include <linux/io.h>
 #include <linux/delay.h>
 #include <linux/interrupt.h>
 #include <linux/init.h>
@@ -2686,6 +2685,7 @@ static int __devinit snd_ice1712_probe(struct pci_dev *pci,
        for (tbl = card_tables; *tbl; tbl++) {
                for (c = *tbl; c->subvendor; c++) {
                        if (c->subvendor == ice->eeprom.subvendor) {
+                               ice->card_info = c;
                                strcpy(card->shortname, c->name);
                                if (c->driver) /* specific driver? */
                                        strcpy(card->driver, c->driver);
@@ -2799,7 +2799,12 @@ static int __devinit snd_ice1712_probe(struct pci_dev *pci,
 
 static void __devexit snd_ice1712_remove(struct pci_dev *pci)
 {
-       snd_card_free(pci_get_drvdata(pci));
+       struct snd_card *card = pci_get_drvdata(pci);
+       struct snd_ice1712 *ice = card->private_data;
+
+       if (ice->card_info && ice->card_info->chip_exit)
+               ice->card_info->chip_exit(ice);
+       snd_card_free(card);
        pci_set_drvdata(pci, NULL);
 }
 
index d0e7d87..b209fc3 100644 (file)
@@ -22,6 +22,7 @@
  *
  */
 
+#include <linux/io.h>
 #include <sound/control.h>
 #include <sound/ac97_codec.h>
 #include <sound/rawmidi.h>
@@ -288,6 +289,7 @@ struct snd_ice1712_spdif {
        } ops;
 };
 
+struct snd_ice1712_card_info;
 
 struct snd_ice1712 {
        unsigned long conp_dma_size;
@@ -324,6 +326,7 @@ struct snd_ice1712 {
        struct snd_info_entry *proc_entry;
 
        struct snd_ice1712_eeprom eeprom;
+       struct snd_ice1712_card_info *card_info;
 
        unsigned int pro_volumes[20];
        unsigned int omni:1;            /* Delta Omni I/O */
@@ -381,7 +384,7 @@ struct snd_ice1712 {
        unsigned char (*set_mclk)(struct snd_ice1712 *ice, unsigned int rate);
        int (*set_spdif_clock)(struct snd_ice1712 *ice, int type);
        int (*get_spdif_master_type)(struct snd_ice1712 *ice);
-       char **ext_clock_names;
+       const char * const *ext_clock_names;
        int ext_clock_count;
        void (*pro_open)(struct snd_ice1712 *, struct snd_pcm_substream *);
 #ifdef CONFIG_PM_SLEEP
@@ -513,10 +516,11 @@ static inline u8 snd_ice1712_read(struct snd_ice1712 *ice, u8 addr)
 
 struct snd_ice1712_card_info {
        unsigned int subvendor;
-       char *name;
-       char *model;
-       char *driver;
+       const char *name;
+       const char *model;
+       const char *driver;
        int (*chip_init)(struct snd_ice1712 *);
+       void (*chip_exit)(struct snd_ice1712 *);
        int (*build_controls)(struct snd_ice1712 *);
        unsigned int no_mpu401:1;
        unsigned int mpu401_1_info_flags;
index 245d874..26feeb8 100644 (file)
@@ -22,7 +22,6 @@
  *
  */
 
-#include <linux/io.h>
 #include <linux/delay.h>
 #include <linux/interrupt.h>
 #include <linux/init.h>
@@ -54,6 +53,7 @@
 #include "wtm.h"
 #include "se.h"
 #include "quartet.h"
+#include "psc724.h"
 
 MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>");
 MODULE_DESCRIPTION("VIA ICEnsemble ICE1724/1720 (Envy24HT/PT)");
@@ -106,7 +106,7 @@ static int PRO_RATE_LOCKED;
 static int PRO_RATE_RESET = 1;
 static unsigned int PRO_RATE_DEFAULT = 44100;
 
-static char *ext_clock_names[1] = { "IEC958 In" };
+static const char * const ext_clock_names[1] = { "IEC958 In" };
 
 /*
  *  Basic I/O
@@ -2042,7 +2042,7 @@ static struct snd_kcontrol_new snd_vt1724_pro_rate_reset __devinitdata = {
 static int snd_vt1724_pro_route_info(struct snd_kcontrol *kcontrol,
                                     struct snd_ctl_elem_info *uinfo)
 {
-       static char *texts[] = {
+       static const char * const texts[] = {
                "PCM Out", /* 0 */
                "H/W In 0", "H/W In 1", /* 1-2 */
                "IEC958 In L", "IEC958 In R", /* 3-4 */
@@ -2232,7 +2232,7 @@ static unsigned char ooaoo_sq210_eeprom[] __devinitdata = {
 };
 
 
-struct snd_ice1712_card_info snd_vt1724_ooaoo_cards[] __devinitdata = {
+static struct snd_ice1712_card_info snd_vt1724_ooaoo_cards[] __devinitdata = {
        {
                .name = "ooAoo SQ210a",
                .model = "sq210a",
@@ -2257,6 +2257,7 @@ static struct snd_ice1712_card_info *card_tables[] __devinitdata = {
        snd_vt1724_se_cards,
        snd_vt1724_qtet_cards,
        snd_vt1724_ooaoo_cards,
+       snd_vt1724_psc724_cards,
        NULL,
 };
 
@@ -2348,6 +2349,7 @@ static int __devinit snd_vt1724_read_eeprom(struct snd_ice1712 *ice,
                                ice->eeprom.subvendor = c->subvendor;
                        } else if (c->subvendor != ice->eeprom.subvendor)
                                continue;
+                       ice->card_info = c;
                        if (!c->eeprom_size || !c->eeprom_data)
                                goto found;
                        /* if the EEPROM is given by the driver, use it */
@@ -2371,7 +2373,7 @@ static int __devinit snd_vt1724_read_eeprom(struct snd_ice1712 *ice,
                return -EIO;
        }
        ice->eeprom.version = snd_vt1724_read_i2c(ice, dev, 0x05);
-       if (ice->eeprom.version != 2)
+       if (ice->eeprom.version != 1 && ice->eeprom.version != 2)
                printk(KERN_WARNING "ice1724: Invalid EEPROM version %i\n",
                       ice->eeprom.version);
        size = ice->eeprom.size - 6;
@@ -2788,7 +2790,12 @@ __found:
 
 static void __devexit snd_vt1724_remove(struct pci_dev *pci)
 {
-       snd_card_free(pci_get_drvdata(pci));
+       struct snd_card *card = pci_get_drvdata(pci);
+       struct snd_ice1712 *ice = card->private_data;
+
+       if (ice->card_info && ice->card_info->chip_exit)
+               ice->card_info->chip_exit(ice);
+       snd_card_free(card);
        pci_set_drvdata(pci, NULL);
 }
 
index 14fd536..a6b23b4 100644 (file)
@@ -23,7 +23,6 @@
  *
  */
 
-#include <asm/io.h>
 #include <linux/delay.h>
 #include <linux/interrupt.h>
 #include <linux/init.h>
@@ -435,7 +434,8 @@ static struct snd_kcontrol __devinit *ctl_find(struct snd_card *card,
 }
 
 static void __devinit add_slaves(struct snd_card *card,
-                                struct snd_kcontrol *master, char **list)
+                                struct snd_kcontrol *master,
+                                char * const *list)
 {
        for (; *list; list++) {
                struct snd_kcontrol *slave = ctl_find(card, *list);
index 726fd4b..d8d749e 100644 (file)
@@ -24,7 +24,6 @@
 
 #include <linux/init.h>
 #include <linux/slab.h>
-#include <linux/io.h>
 #include <sound/core.h>
 #include <sound/control.h>
 #include <sound/pcm.h>
@@ -358,7 +357,7 @@ static void wm8776_select_input(struct snd_maya44 *chip, int idx, int line)
 static int maya_rec_src_info(struct snd_kcontrol *kcontrol,
                             struct snd_ctl_elem_info *uinfo)
 {
-       static char *texts[] = { "Line", "Mic" };
+       static const char * const texts[] = { "Line", "Mic" };
 
        uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
        uinfo->count = 1;
@@ -407,7 +406,7 @@ static int maya_rec_src_put(struct snd_kcontrol *kcontrol,
 static int maya_pb_route_info(struct snd_kcontrol *kcontrol,
                              struct snd_ctl_elem_info *uinfo)
 {
-       static char *texts[] = {
+       static const char * const texts[] = {
                "PCM Out", /* 0 */
                "Input 1", "Input 2", "Input 3", "Input 4"
        };
index de29be8..c9be75a 100644 (file)
@@ -42,7 +42,6 @@
  *   Digital receiver: CS8414-CS (supported in this release)
  */
 
-#include <asm/io.h>
 #include <linux/delay.h>
 #include <linux/interrupt.h>
 #include <linux/init.h>
@@ -722,7 +721,7 @@ static int phase28_deemp_put(struct snd_kcontrol *kcontrol,
 static int phase28_oversampling_info(struct snd_kcontrol *k,
                                        struct snd_ctl_elem_info *uinfo)
 {
-       static char *texts[2] = { "128x", "64x" };
+       static const char * const texts[2] = { "128x", "64x"    };
 
        uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
        uinfo->count = 1;
index 92c1160..3ce1289 100644 (file)
@@ -21,7 +21,6 @@
  *
  */
 
-#include <asm/io.h>
 #include <linux/delay.h>
 #include <linux/interrupt.h>
 #include <linux/init.h>
index e36ddb9..3fcf581 100644 (file)
@@ -54,7 +54,6 @@
  *
  */      
 
-#include <asm/io.h>
 #include <linux/delay.h>
 #include <linux/interrupt.h>
 #include <linux/init.h>
@@ -283,7 +282,7 @@ static int stac9460_adc_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_el
 static int stac9460_mic_sw_info(struct snd_kcontrol *kcontrol,
                                struct snd_ctl_elem_info *uinfo)
 {
-       static char *texts[2] = { "Line In", "Mic" };
+       static const char * const texts[2] = { "Line In", "Mic" };
 
        uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
        uinfo->count = 1;
@@ -562,7 +561,7 @@ static unsigned char prodigy192_ak4114_read(void *private_data,
 static int ak4114_input_sw_info(struct snd_kcontrol *kcontrol,
                                struct snd_ctl_elem_info *uinfo)
 {
-       static char *texts[2] = { "Toslink", "Coax" };
+       static const char * const texts[2] = { "Toslink", "Coax" };
 
        uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
        uinfo->count = 1;
index 7bf093c..4fea87f 100644 (file)
@@ -25,7 +25,6 @@
  */
 
 
-#include <asm/io.h>
 #include <linux/delay.h>
 #include <linux/interrupt.h>
 #include <linux/init.h>
diff --git a/sound/pci/ice1712/psc724.c b/sound/pci/ice1712/psc724.c
new file mode 100644 (file)
index 0000000..0b6c4e6
--- /dev/null
@@ -0,0 +1,464 @@
+/*
+ *   ALSA driver for ICEnsemble VT1724 (Envy24HT)
+ *
+ *   Lowlevel functions for Philips PSC724 Ultimate Edge
+ *
+ *     Copyright (c) 2012 Ondrej Zary <linux@rainbow-software.org>
+ *
+ *   This program is free software; you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation; either version 2 of the License, or
+ *   (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+ *
+ */
+
+#include <linux/delay.h>
+#include <linux/init.h>
+#include <linux/slab.h>
+#include <sound/core.h>
+
+#include "ice1712.h"
+#include "envy24ht.h"
+#include "psc724.h"
+#include "wm8766.h"
+#include "wm8776.h"
+
+struct psc724_spec {
+       struct snd_wm8766 wm8766;
+       struct snd_wm8776 wm8776;
+       bool mute_all, jack_detect;
+       struct snd_ice1712 *ice;
+       struct delayed_work hp_work;
+       bool hp_connected;
+};
+
+/****************************************************************************/
+/*  PHILIPS PSC724 ULTIMATE EDGE                                            */
+/****************************************************************************/
+/*
+ *  VT1722 (Envy24GT) - 6 outputs, 4 inputs (only 2 used), 24-bit/96kHz
+ *
+ *  system configuration ICE_EEP2_SYSCONF=0x42
+ *    XIN1 49.152MHz
+ *    no MPU401
+ *    one stereo ADC, no S/PDIF receiver
+ *    three stereo DACs (FRONT, REAR, CENTER+LFE)
+ *
+ *  AC-Link configuration ICE_EEP2_ACLINK=0x80
+ *    use I2S, not AC97
+ *
+ *  I2S converters feature ICE_EEP2_I2S=0x30
+ *    I2S codec has no volume/mute control feature (bug!)
+ *    I2S codec does not support 96KHz or 192KHz (bug!)
+ *    I2S codec 24bits
+ *
+ *  S/PDIF configuration ICE_EEP2_SPDIF=0xc1
+ *    Enable integrated S/PDIF transmitter
+ *    internal S/PDIF out implemented
+ *    No S/PDIF input
+ *    External S/PDIF out implemented
+ *
+ *
+ * ** connected chips **
+ *
+ *  WM8776
+ *     2-channel DAC used for main output and stereo ADC (with 10-channel MUX)
+ *     AIN1: LINE IN, AIN2: CD/VIDEO, AIN3: AUX, AIN4: Front MIC, AIN5: Rear MIC
+ *     Controlled by I2C using VT1722 I2C interface:
+ *          MODE (pin16) -- GND
+ *          CE   (pin17) -- GND  I2C mode (address=0x34)
+ *          DI   (pin18) -- SDA  (VT1722 pin70)
+ *          CL   (pin19) -- SCLK (VT1722 pin71)
+ *
+ *  WM8766
+ *      6-channel DAC used for rear & center/LFE outputs (only 4 channels used)
+ *      Controlled by SPI using VT1722 GPIO pins:
+ *          MODE   (pin 1) -- GPIO19 (VT1722 pin99)
+ *          ML/I2S (pin11) -- GPIO18 (VT1722 pin98)
+ *          MC/IWL (pin12) -- GPIO17 (VT1722 pin97)
+ *          MD/DM  (pin13) -- GPIO16 (VT1722 pin96)
+ *          MUTE   (pin14) -- GPIO20 (VT1722 pin101)
+ *
+ *  GPIO14 is used as input for headphone jack detection (1 = connected)
+ *  GPIO22 is used as MUTE ALL output, grounding all 6 channels
+ *
+ * ** output pins and device names **
+ *
+ *   5.1ch name -- output connector color -- device (-D option)
+ *
+ *      FRONT 2ch                  -- green  -- plughw:0,0
+ *      CENTER(Lch) SUBWOOFER(Rch) -- orange -- plughw:0,2,0
+ *      REAR 2ch                   -- black  -- plughw:0,2,1
+ */
+
+/* codec access low-level functions */
+
+#define GPIO_HP_JACK   (1 << 14)
+#define GPIO_MUTE_SUR  (1 << 20)
+#define GPIO_MUTE_ALL  (1 << 22)
+
+#define JACK_INTERVAL  1000
+
+#define PSC724_SPI_DELAY 1
+
+#define PSC724_SPI_DATA        (1 << 16)
+#define PSC724_SPI_CLK (1 << 17)
+#define PSC724_SPI_LOAD        (1 << 18)
+#define PSC724_SPI_MASK        (PSC724_SPI_DATA | PSC724_SPI_CLK | PSC724_SPI_LOAD)
+
+static void psc724_wm8766_write(struct snd_wm8766 *wm, u16 addr, u16 data)
+{
+       struct psc724_spec *spec = container_of(wm, struct psc724_spec, wm8766);
+       struct snd_ice1712 *ice = spec->ice;
+       u32 st, bits;
+       int i;
+
+       snd_ice1712_save_gpio_status(ice);
+
+       st = ((addr & 0x7f) << 9) | (data & 0x1ff);
+       snd_ice1712_gpio_set_dir(ice, ice->gpio.direction | PSC724_SPI_MASK);
+       snd_ice1712_gpio_set_mask(ice, ice->gpio.write_mask & ~PSC724_SPI_MASK);
+       bits = snd_ice1712_gpio_read(ice) & ~PSC724_SPI_MASK;
+       snd_ice1712_gpio_write(ice, bits);
+
+       for (i = 0; i < 16; i++) {
+               udelay(PSC724_SPI_DELAY);
+               bits &= ~PSC724_SPI_CLK;
+               /* MSB first */
+               st <<= 1;
+               if (st & 0x10000)
+                       bits |= PSC724_SPI_DATA;
+               else
+                       bits &= ~PSC724_SPI_DATA;
+               snd_ice1712_gpio_write(ice, bits);
+               /* CLOCK high */
+               udelay(PSC724_SPI_DELAY);
+               bits |= PSC724_SPI_CLK;
+               snd_ice1712_gpio_write(ice, bits);
+       }
+       /* LOAD high */
+       udelay(PSC724_SPI_DELAY);
+       bits |= PSC724_SPI_LOAD;
+       snd_ice1712_gpio_write(ice, bits);
+       /* LOAD low, DATA and CLOCK high */
+       udelay(PSC724_SPI_DELAY);
+       bits |= (PSC724_SPI_DATA | PSC724_SPI_CLK);
+       snd_ice1712_gpio_write(ice, bits);
+
+       snd_ice1712_restore_gpio_status(ice);
+}
+
+static void psc724_wm8776_write(struct snd_wm8776 *wm, u8 addr, u8 data)
+{
+       struct psc724_spec *spec = container_of(wm, struct psc724_spec, wm8776);
+
+       snd_vt1724_write_i2c(spec->ice, 0x34, addr, data);
+}
+
+/* mute all */
+
+static void psc724_set_master_switch(struct snd_ice1712 *ice, bool on)
+{
+       unsigned int bits = snd_ice1712_gpio_read(ice);
+       struct psc724_spec *spec = ice->spec;
+
+       spec->mute_all = !on;
+       if (on)
+               bits &= ~(GPIO_MUTE_ALL | GPIO_MUTE_SUR);
+       else
+               bits |= GPIO_MUTE_ALL | GPIO_MUTE_SUR;
+       snd_ice1712_gpio_write(ice, bits);
+}
+
+static bool psc724_get_master_switch(struct snd_ice1712 *ice)
+{
+       struct psc724_spec *spec = ice->spec;
+
+       return !spec->mute_all;
+}
+
+/* jack detection */
+
+static void psc724_set_jack_state(struct snd_ice1712 *ice, bool hp_connected)
+{
+       struct psc724_spec *spec = ice->spec;
+       struct snd_ctl_elem_id elem_id;
+       struct snd_kcontrol *kctl;
+       u16 power = spec->wm8776.regs[WM8776_REG_PWRDOWN] & ~WM8776_PWR_HPPD;
+
+       psc724_set_master_switch(ice, !hp_connected);
+       if (!hp_connected)
+               power |= WM8776_PWR_HPPD;
+       snd_wm8776_set_power(&spec->wm8776, power);
+       spec->hp_connected = hp_connected;
+       /* notify about master speaker mute change */
+       memset(&elem_id, 0, sizeof(elem_id));
+       elem_id.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
+       strncpy(elem_id.name, "Master Speakers Playback Switch",
+                                               sizeof(elem_id.name));
+       kctl = snd_ctl_find_id(ice->card, &elem_id);
+       snd_ctl_notify(ice->card, SNDRV_CTL_EVENT_MASK_VALUE, &kctl->id);
+       /* and headphone mute change */
+       strncpy(elem_id.name, spec->wm8776.ctl[WM8776_CTL_HP_SW].name,
+                                               sizeof(elem_id.name));
+       kctl = snd_ctl_find_id(ice->card, &elem_id);
+       snd_ctl_notify(ice->card, SNDRV_CTL_EVENT_MASK_VALUE, &kctl->id);
+}
+
+static void psc724_update_hp_jack_state(struct work_struct *work)
+{
+       struct psc724_spec *spec = container_of(work, struct psc724_spec,
+                                               hp_work.work);
+       struct snd_ice1712 *ice = spec->ice;
+       bool hp_connected = snd_ice1712_gpio_read(ice) & GPIO_HP_JACK;
+
+       schedule_delayed_work(&spec->hp_work, msecs_to_jiffies(JACK_INTERVAL));
+       if (hp_connected == spec->hp_connected)
+               return;
+       psc724_set_jack_state(ice, hp_connected);
+}
+
+static void psc724_set_jack_detection(struct snd_ice1712 *ice, bool on)
+{
+       struct psc724_spec *spec = ice->spec;
+
+       if (spec->jack_detect == on)
+               return;
+
+       spec->jack_detect = on;
+       if (on) {
+               bool hp_connected = snd_ice1712_gpio_read(ice) & GPIO_HP_JACK;
+               psc724_set_jack_state(ice, hp_connected);
+               schedule_delayed_work(&spec->hp_work,
+                                       msecs_to_jiffies(JACK_INTERVAL));
+       } else
+               cancel_delayed_work_sync(&spec->hp_work);
+}
+
+static bool psc724_get_jack_detection(struct snd_ice1712 *ice)
+{
+       struct psc724_spec *spec = ice->spec;
+
+       return spec->jack_detect;
+}
+
+/* mixer controls */
+
+struct psc724_control {
+       const char *name;
+       void (*set)(struct snd_ice1712 *ice, bool on);
+       bool (*get)(struct snd_ice1712 *ice);
+};
+
+static const struct psc724_control psc724_cont[] = {
+       {
+               .name = "Master Speakers Playback Switch",
+               .set = psc724_set_master_switch,
+               .get = psc724_get_master_switch,
+       },
+       {
+               .name = "Headphone Jack Detection Playback Switch",
+               .set = psc724_set_jack_detection,
+               .get = psc724_get_jack_detection,
+       },
+};
+
+static int psc724_ctl_get(struct snd_kcontrol *kcontrol,
+                                 struct snd_ctl_elem_value *ucontrol)
+{
+       struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
+       int n = kcontrol->private_value;
+
+       ucontrol->value.integer.value[0] = psc724_cont[n].get(ice);
+
+       return 0;
+}
+
+static int psc724_ctl_put(struct snd_kcontrol *kcontrol,
+                                 struct snd_ctl_elem_value *ucontrol)
+{
+       struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
+       int n = kcontrol->private_value;
+
+       psc724_cont[n].set(ice, ucontrol->value.integer.value[0]);
+
+       return 0;
+}
+
+static const char *front_volume        = "Front Playback Volume";
+static const char *front_switch        = "Front Playback Switch";
+static const char *front_zc    = "Front Zero Cross Detect Playback Switch";
+static const char *front_izd   = "Front Infinite Zero Detect Playback Switch";
+static const char *front_phase = "Front Phase Invert Playback Switch";
+static const char *front_deemph        = "Front Deemphasis Playback Switch";
+static const char *ain1_switch = "Line Capture Switch";
+static const char *ain2_switch = "CD Capture Switch";
+static const char *ain3_switch = "AUX Capture Switch";
+static const char *ain4_switch = "Front Mic Capture Switch";
+static const char *ain5_switch = "Rear Mic Capture Switch";
+static const char *rear_volume = "Surround Playback Volume";
+static const char *clfe_volume = "CLFE Playback Volume";
+static const char *rear_switch = "Surround Playback Switch";
+static const char *clfe_switch = "CLFE Playback Switch";
+static const char *rear_phase  = "Surround Phase Invert Playback Switch";
+static const char *clfe_phase  = "CLFE Phase Invert Playback Switch";
+static const char *rear_deemph = "Surround Deemphasis Playback Switch";
+static const char *clfe_deemph = "CLFE Deemphasis Playback Switch";
+static const char *rear_clfe_izd = "Rear Infinite Zero Detect Playback Switch";
+static const char *rear_clfe_zc        = "Rear Zero Cross Detect Playback Switch";
+
+static int __devinit psc724_add_controls(struct snd_ice1712 *ice)
+{
+       struct snd_kcontrol_new cont;
+       struct snd_kcontrol *ctl;
+       int err, i;
+       struct psc724_spec *spec = ice->spec;
+
+       spec->wm8776.ctl[WM8776_CTL_DAC_VOL].name = front_volume;
+       spec->wm8776.ctl[WM8776_CTL_DAC_SW].name = front_switch;
+       spec->wm8776.ctl[WM8776_CTL_DAC_ZC_SW].name = front_zc;
+       spec->wm8776.ctl[WM8776_CTL_AUX_SW].name = NULL;
+       spec->wm8776.ctl[WM8776_CTL_DAC_IZD_SW].name = front_izd;
+       spec->wm8776.ctl[WM8776_CTL_PHASE_SW].name = front_phase;
+       spec->wm8776.ctl[WM8776_CTL_DEEMPH_SW].name = front_deemph;
+       spec->wm8776.ctl[WM8776_CTL_INPUT1_SW].name = ain1_switch;
+       spec->wm8776.ctl[WM8776_CTL_INPUT2_SW].name = ain2_switch;
+       spec->wm8776.ctl[WM8776_CTL_INPUT3_SW].name = ain3_switch;
+       spec->wm8776.ctl[WM8776_CTL_INPUT4_SW].name = ain4_switch;
+       spec->wm8776.ctl[WM8776_CTL_INPUT5_SW].name = ain5_switch;
+       snd_wm8776_build_controls(&spec->wm8776);
+       spec->wm8766.ctl[WM8766_CTL_CH1_VOL].name = rear_volume;
+       spec->wm8766.ctl[WM8766_CTL_CH2_VOL].name = clfe_volume;
+       spec->wm8766.ctl[WM8766_CTL_CH3_VOL].name = NULL;
+       spec->wm8766.ctl[WM8766_CTL_CH1_SW].name = rear_switch;
+       spec->wm8766.ctl[WM8766_CTL_CH2_SW].name = clfe_switch;
+       spec->wm8766.ctl[WM8766_CTL_CH3_SW].name = NULL;
+       spec->wm8766.ctl[WM8766_CTL_PHASE1_SW].name = rear_phase;
+       spec->wm8766.ctl[WM8766_CTL_PHASE2_SW].name = clfe_phase;
+       spec->wm8766.ctl[WM8766_CTL_PHASE3_SW].name = NULL;
+       spec->wm8766.ctl[WM8766_CTL_DEEMPH1_SW].name = rear_deemph;
+       spec->wm8766.ctl[WM8766_CTL_DEEMPH2_SW].name = clfe_deemph;
+       spec->wm8766.ctl[WM8766_CTL_DEEMPH3_SW].name = NULL;
+       spec->wm8766.ctl[WM8766_CTL_IZD_SW].name = rear_clfe_izd;
+       spec->wm8766.ctl[WM8766_CTL_ZC_SW].name = rear_clfe_zc;
+       snd_wm8766_build_controls(&spec->wm8766);
+
+       memset(&cont, 0, sizeof(cont));
+       cont.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
+       for (i = 0; i < ARRAY_SIZE(psc724_cont); i++) {
+               cont.private_value = i;
+               cont.name = psc724_cont[i].name;
+               cont.access = SNDRV_CTL_ELEM_ACCESS_READWRITE;
+               cont.info = snd_ctl_boolean_mono_info;
+               cont.get = psc724_ctl_get;
+               cont.put = psc724_ctl_put;
+               ctl = snd_ctl_new1(&cont, ice);
+               if (!ctl)
+                       return -ENOMEM;
+               err = snd_ctl_add(ice->card, ctl);
+               if (err < 0)
+                       return err;
+       }
+
+       return 0;
+}
+
+static void psc724_set_pro_rate(struct snd_ice1712 *ice, unsigned int rate)
+{
+       struct psc724_spec *spec = ice->spec;
+       /* restore codec volume settings after rate change (PMCLK stop) */
+       snd_wm8776_volume_restore(&spec->wm8776);
+       snd_wm8766_volume_restore(&spec->wm8766);
+}
+
+/* power management */
+
+#ifdef CONFIG_PM_SLEEP
+static int psc724_resume(struct snd_ice1712 *ice)
+{
+       struct psc724_spec *spec = ice->spec;
+
+       snd_wm8776_resume(&spec->wm8776);
+       snd_wm8766_resume(&spec->wm8766);
+
+       return 0;
+}
+#endif
+
+/* init */
+
+static int __devinit psc724_init(struct snd_ice1712 *ice)
+{
+       struct psc724_spec *spec;
+
+       spec = kzalloc(sizeof(*spec), GFP_KERNEL);
+       if (!spec)
+               return -ENOMEM;
+       ice->spec = spec;
+       spec->ice = ice;
+
+       ice->num_total_dacs = 6;
+       ice->num_total_adcs = 2;
+       spec->wm8776.ops.write = psc724_wm8776_write;
+       spec->wm8776.card = ice->card;
+       snd_wm8776_init(&spec->wm8776);
+       spec->wm8766.ops.write = psc724_wm8766_write;
+       spec->wm8766.card = ice->card;
+#ifdef CONFIG_PM_SLEEP
+       ice->pm_resume = psc724_resume;
+       ice->pm_suspend_enabled = 1;
+#endif
+       snd_wm8766_init(&spec->wm8766);
+       snd_wm8766_set_if(&spec->wm8766,
+                       WM8766_IF_FMT_I2S | WM8766_IF_IWL_24BIT);
+       ice->gpio.set_pro_rate = psc724_set_pro_rate;
+       INIT_DELAYED_WORK(&spec->hp_work, psc724_update_hp_jack_state);
+       psc724_set_jack_detection(ice, true);
+       return 0;
+}
+
+static void psc724_exit(struct snd_ice1712 *ice)
+{
+       struct psc724_spec *spec = ice->spec;
+
+       cancel_delayed_work_sync(&spec->hp_work);
+}
+
+/* PSC724 has buggy EEPROM (no 96&192kHz, all FFh GPIOs), so override it here */
+static unsigned char psc724_eeprom[] __devinitdata = {
+       [ICE_EEP2_SYSCONF]      = 0x42, /* 49.152MHz, 1 ADC, 3 DACs */
+       [ICE_EEP2_ACLINK]       = 0x80, /* I2S */
+       [ICE_EEP2_I2S]          = 0xf0, /* I2S volume, 96kHz, 24bit */
+       [ICE_EEP2_SPDIF]        = 0xc1, /* spdif out-en, out-int, no input */
+       /* GPIO outputs */
+       [ICE_EEP2_GPIO_DIR2]    = 0x5f, /* MUTE_ALL,WM8766 MUTE/MODE/ML/MC/MD */
+       /* GPIO write enable */
+       [ICE_EEP2_GPIO_MASK]    = 0xff, /* read-only */
+       [ICE_EEP2_GPIO_MASK1]   = 0xff, /* read-only */
+       [ICE_EEP2_GPIO_MASK2]   = 0xa0, /* MUTE_ALL,WM8766 MUTE/MODE/ML/MC/MD */
+       /* GPIO initial state */
+       [ICE_EEP2_GPIO_STATE2]  = 0x20, /* unmuted, all WM8766 pins low */
+};
+
+struct snd_ice1712_card_info snd_vt1724_psc724_cards[] __devinitdata = {
+       {
+               .subvendor = VT1724_SUBDEVICE_PSC724,
+               .name = "Philips PSC724 Ultimate Edge",
+               .model = "psc724",
+               .chip_init = psc724_init,
+               .chip_exit = psc724_exit,
+               .build_controls = psc724_add_controls,
+               .eeprom_size = sizeof(psc724_eeprom),
+               .eeprom_data = psc724_eeprom,
+       },
+       {} /*terminator*/
+};
diff --git a/sound/pci/ice1712/psc724.h b/sound/pci/ice1712/psc724.h
new file mode 100644 (file)
index 0000000..858e5fd
--- /dev/null
@@ -0,0 +1,13 @@
+#ifndef __SOUND_PSC724_H
+#define __SOUND_PSC724_H
+
+/* ID */
+#define PSC724_DEVICE_DESC     \
+               "{Philips,PSC724 Ultimate Edge},"
+
+#define VT1724_SUBDEVICE_PSC724                0xab170619
+
+/* entry struct */
+extern struct snd_ice1712_card_info snd_vt1724_psc724_cards[];
+
+#endif /* __SOUND_PSC724_H */
index 1948632..c85b2ff 100644 (file)
@@ -22,7 +22,6 @@
  *
  */
 
-#include <asm/io.h>
 #include <linux/delay.h>
 #include <linux/interrupt.h>
 #include <linux/init.h>
@@ -47,7 +46,7 @@ struct qtet_kcontrol_private {
        unsigned int bit;
        void (*set_register)(struct snd_ice1712 *ice, unsigned int val);
        unsigned int (*get_register)(struct snd_ice1712 *ice);
-       unsigned char *texts[2];
+       unsigned char * const texts[2];
 };
 
 enum {
@@ -63,7 +62,7 @@ enum {
        OUT34_MON12,
 };
 
-static char *ext_clock_names[3] = {"IEC958 In", "Word Clock 1xFS",
+static const char * const ext_clock_names[3] = {"IEC958 In", "Word Clock 1xFS",
        "Word Clock 256xFS"};
 
 /* chip address on I2C bus */
@@ -551,7 +550,8 @@ static int qtet_mute_put(struct snd_kcontrol *kcontrol,
 static int qtet_ain12_enum_info(struct snd_kcontrol *kcontrol,
                struct snd_ctl_elem_info *uinfo)
 {
-       static char *texts[3] = {"Line In 1/2", "Mic", "Mic + Low-cut"};
+       static const char * const texts[3] =
+               {"Line In 1/2", "Mic", "Mic + Low-cut"};
        uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
        uinfo->count = 1;
        uinfo->value.enumerated.items = ARRAY_SIZE(texts);
@@ -816,7 +816,7 @@ static struct snd_kcontrol __devinit *ctl_find(struct snd_card *card,
 }
 
 static void __devinit add_slaves(struct snd_card *card,
-               struct snd_kcontrol *master, char **list)
+               struct snd_kcontrol *master, char * const *list)
 {
        for (; *list; list++) {
                struct snd_kcontrol *slave = ctl_find(card, *list);
index b508bb3..a1b7975 100644 (file)
@@ -21,7 +21,6 @@
  *
  */      
 
-#include <asm/io.h>
 #include <linux/delay.h>
 #include <linux/interrupt.h>
 #include <linux/init.h>
index 69673b9..53b555f 100644 (file)
@@ -22,7 +22,6 @@
  *
  */      
 
-#include <asm/io.h>
 #include <linux/delay.h>
 #include <linux/interrupt.h>
 #include <linux/init.h>
@@ -253,7 +252,7 @@ static void se200pci_WM8776_set_input_volume(struct snd_ice1712 *ice,
        se200pci_WM8776_write(ice, 0x0f, vol2 | 0x100);
 }
 
-static const char *se200pci_sel[] = {
+static const char * const se200pci_sel[] = {
        "LINE-IN", "CD-IN", "MIC-IN", "ALL-MIX", NULL
 };
 
@@ -278,7 +277,7 @@ static void se200pci_WM8776_set_afl(struct snd_ice1712 *ice, unsigned int afl)
                se200pci_WM8776_write(ice, 0x16, 0x001);
 }
 
-static const char *se200pci_agc[] = {
+static const char * const se200pci_agc[] = {
        "Off", "LimiterMode", "ALCMode", NULL
 };
 
@@ -352,7 +351,7 @@ static void se200pci_set_pro_rate(struct snd_ice1712 *ice, unsigned int rate)
 }
 
 struct se200pci_control {
-       char *name;
+       const char *name;
        enum {
                WM8766,
                WM8776in,
@@ -363,7 +362,7 @@ struct se200pci_control {
        } target;
        enum { VOLUME1, VOLUME2, BOOLEAN, ENUM } type;
        int ch;
-       const char **member;
+       const char * const *member;
        const char *comment;
 };
 
@@ -421,7 +420,7 @@ static const struct se200pci_control se200pci_cont[] = {
 
 static int se200pci_get_enum_count(int n)
 {
-       const char **member;
+       const char * const *member;
        int c;
 
        member = se200pci_cont[n].member;
index 4c551e1..8a0a839 100644 (file)
@@ -21,7 +21,6 @@
  *
  */      
 
-#include <asm/io.h>
 #include <linux/delay.h>
 #include <linux/interrupt.h>
 #include <linux/init.h>
diff --git a/sound/pci/ice1712/wm8766.c b/sound/pci/ice1712/wm8766.c
new file mode 100644 (file)
index 0000000..8072ade
--- /dev/null
@@ -0,0 +1,361 @@
+/*
+ *   ALSA driver for ICEnsemble VT17xx
+ *
+ *   Lowlevel functions for WM8766 codec
+ *
+ *     Copyright (c) 2012 Ondrej Zary <linux@rainbow-software.org>
+ *
+ *   This program is free software; you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation; either version 2 of the License, or
+ *   (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+ *
+ */
+
+#include <linux/delay.h>
+#include <sound/core.h>
+#include <sound/control.h>
+#include <sound/tlv.h>
+#include "wm8766.h"
+
+/* low-level access */
+
+static void snd_wm8766_write(struct snd_wm8766 *wm, u16 addr, u16 data)
+{
+       if (addr < WM8766_REG_RESET)
+               wm->regs[addr] = data;
+       wm->ops.write(wm, addr, data);
+}
+
+/* mixer controls */
+
+static const DECLARE_TLV_DB_SCALE(wm8766_tlv, -12750, 50, 1);
+
+static struct snd_wm8766_ctl snd_wm8766_default_ctl[WM8766_CTL_COUNT] = {
+       [WM8766_CTL_CH1_VOL] = {
+               .name = "Channel 1 Playback Volume",
+               .type = SNDRV_CTL_ELEM_TYPE_INTEGER,
+               .tlv = wm8766_tlv,
+               .reg1 = WM8766_REG_DACL1,
+               .reg2 = WM8766_REG_DACR1,
+               .mask1 = WM8766_VOL_MASK,
+               .mask2 = WM8766_VOL_MASK,
+               .max = 0xff,
+               .flags = WM8766_FLAG_STEREO | WM8766_FLAG_VOL_UPDATE,
+       },
+       [WM8766_CTL_CH2_VOL] = {
+               .name = "Channel 2 Playback Volume",
+               .type = SNDRV_CTL_ELEM_TYPE_INTEGER,
+               .tlv = wm8766_tlv,
+               .reg1 = WM8766_REG_DACL2,
+               .reg2 = WM8766_REG_DACR2,
+               .mask1 = WM8766_VOL_MASK,
+               .mask2 = WM8766_VOL_MASK,
+               .max = 0xff,
+               .flags = WM8766_FLAG_STEREO | WM8766_FLAG_VOL_UPDATE,
+       },
+       [WM8766_CTL_CH3_VOL] = {
+               .name = "Channel 3 Playback Volume",
+               .type = SNDRV_CTL_ELEM_TYPE_INTEGER,
+               .tlv = wm8766_tlv,
+               .reg1 = WM8766_REG_DACL3,
+               .reg2 = WM8766_REG_DACR3,
+               .mask1 = WM8766_VOL_MASK,
+               .mask2 = WM8766_VOL_MASK,
+               .max = 0xff,
+               .flags = WM8766_FLAG_STEREO | WM8766_FLAG_VOL_UPDATE,
+       },
+       [WM8766_CTL_CH1_SW] = {
+               .name = "Channel 1 Playback Switch",
+               .type = SNDRV_CTL_ELEM_TYPE_BOOLEAN,
+               .reg1 = WM8766_REG_DACCTRL2,
+               .mask1 = WM8766_DAC2_MUTE1,
+               .flags = WM8766_FLAG_INVERT,
+       },
+       [WM8766_CTL_CH2_SW] = {
+               .name = "Channel 2 Playback Switch",
+               .type = SNDRV_CTL_ELEM_TYPE_BOOLEAN,
+               .reg1 = WM8766_REG_DACCTRL2,
+               .mask1 = WM8766_DAC2_MUTE2,
+               .flags = WM8766_FLAG_INVERT,
+       },
+       [WM8766_CTL_CH3_SW] = {
+               .name = "Channel 3 Playback Switch",
+               .type = SNDRV_CTL_ELEM_TYPE_BOOLEAN,
+               .reg1 = WM8766_REG_DACCTRL2,
+               .mask1 = WM8766_DAC2_MUTE3,
+               .flags = WM8766_FLAG_INVERT,
+       },
+       [WM8766_CTL_PHASE1_SW] = {
+               .name = "Channel 1 Phase Invert Playback Switch",
+               .type = SNDRV_CTL_ELEM_TYPE_BOOLEAN,
+               .reg1 = WM8766_REG_IFCTRL,
+               .mask1 = WM8766_PHASE_INVERT1,
+       },
+       [WM8766_CTL_PHASE2_SW] = {
+               .name = "Channel 2 Phase Invert Playback Switch",
+               .type = SNDRV_CTL_ELEM_TYPE_BOOLEAN,
+               .reg1 = WM8766_REG_IFCTRL,
+               .mask1 = WM8766_PHASE_INVERT2,
+       },
+       [WM8766_CTL_PHASE3_SW] = {
+               .name = "Channel 3 Phase Invert Playback Switch",
+               .type = SNDRV_CTL_ELEM_TYPE_BOOLEAN,
+               .reg1 = WM8766_REG_IFCTRL,
+               .mask1 = WM8766_PHASE_INVERT3,
+       },
+       [WM8766_CTL_DEEMPH1_SW] = {
+               .name = "Channel 1 Deemphasis Playback Switch",
+               .type = SNDRV_CTL_ELEM_TYPE_BOOLEAN,
+               .reg1 = WM8766_REG_DACCTRL2,
+               .mask1 = WM8766_DAC2_DEEMP1,
+       },
+       [WM8766_CTL_DEEMPH2_SW] = {
+               .name = "Channel 2 Deemphasis Playback Switch",
+               .type = SNDRV_CTL_ELEM_TYPE_BOOLEAN,
+               .reg1 = WM8766_REG_DACCTRL2,
+               .mask1 = WM8766_DAC2_DEEMP2,
+       },
+       [WM8766_CTL_DEEMPH3_SW] = {
+               .name = "Channel 3 Deemphasis Playback Switch",
+               .type = SNDRV_CTL_ELEM_TYPE_BOOLEAN,
+               .reg1 = WM8766_REG_DACCTRL2,
+               .mask1 = WM8766_DAC2_DEEMP3,
+       },
+       [WM8766_CTL_IZD_SW] = {
+               .name = "Infinite Zero Detect Playback Switch",
+               .type = SNDRV_CTL_ELEM_TYPE_BOOLEAN,
+               .reg1 = WM8766_REG_DACCTRL1,
+               .mask1 = WM8766_DAC_IZD,
+       },
+       [WM8766_CTL_ZC_SW] = {
+               .name = "Zero Cross Detect Playback Switch",
+               .type = SNDRV_CTL_ELEM_TYPE_BOOLEAN,
+               .reg1 = WM8766_REG_DACCTRL2,
+               .mask1 = WM8766_DAC2_ZCD,
+               .flags = WM8766_FLAG_INVERT,
+       },
+};
+
+/* exported functions */
+
+void snd_wm8766_init(struct snd_wm8766 *wm)
+{
+       int i;
+       static const u16 default_values[] = {
+               0x000, 0x100,
+               0x120, 0x000,
+               0x000, 0x100, 0x000, 0x100, 0x000,
+               0x000, 0x080,
+       };
+
+       memcpy(wm->ctl, snd_wm8766_default_ctl, sizeof(wm->ctl));
+
+       snd_wm8766_write(wm, WM8766_REG_RESET, 0x00); /* reset */
+       udelay(10);
+       /* load defaults */
+       for (i = 0; i < ARRAY_SIZE(default_values); i++)
+               snd_wm8766_write(wm, i, default_values[i]);
+}
+
+void snd_wm8766_resume(struct snd_wm8766 *wm)
+{
+       int i;
+
+       for (i = 0; i < WM8766_REG_COUNT; i++)
+               snd_wm8766_write(wm, i, wm->regs[i]);
+}
+
+void snd_wm8766_set_if(struct snd_wm8766 *wm, u16 dac)
+{
+       u16 val = wm->regs[WM8766_REG_IFCTRL] & ~WM8766_IF_MASK;
+
+       dac &= WM8766_IF_MASK;
+       snd_wm8766_write(wm, WM8766_REG_IFCTRL, val | dac);
+}
+
+void snd_wm8766_set_master_mode(struct snd_wm8766 *wm, u16 mode)
+{
+       u16 val = wm->regs[WM8766_REG_DACCTRL3] & ~WM8766_DAC3_MSTR_MASK;
+
+       mode &= WM8766_DAC3_MSTR_MASK;
+       snd_wm8766_write(wm, WM8766_REG_DACCTRL3, val | mode);
+}
+
+void snd_wm8766_set_power(struct snd_wm8766 *wm, u16 power)
+{
+       u16 val = wm->regs[WM8766_REG_DACCTRL3] & ~WM8766_DAC3_POWER_MASK;
+
+       power &= WM8766_DAC3_POWER_MASK;
+       snd_wm8766_write(wm, WM8766_REG_DACCTRL3, val | power);
+}
+
+void snd_wm8766_volume_restore(struct snd_wm8766 *wm)
+{
+       u16 val = wm->regs[WM8766_REG_DACR1];
+       /* restore volume after MCLK stopped */
+       snd_wm8766_write(wm, WM8766_REG_DACR1, val | WM8766_VOL_UPDATE);
+}
+
+/* mixer callbacks */
+
+static int snd_wm8766_volume_info(struct snd_kcontrol *kcontrol,
+                                  struct snd_ctl_elem_info *uinfo)
+{
+       struct snd_wm8766 *wm = snd_kcontrol_chip(kcontrol);
+       int n = kcontrol->private_value;
+
+       uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
+       uinfo->count = (wm->ctl[n].flags & WM8766_FLAG_STEREO) ? 2 : 1;
+       uinfo->value.integer.min = wm->ctl[n].min;
+       uinfo->value.integer.max = wm->ctl[n].max;
+
+       return 0;
+}
+
+static int snd_wm8766_enum_info(struct snd_kcontrol *kcontrol,
+                                     struct snd_ctl_elem_info *uinfo)
+{
+       struct snd_wm8766 *wm = snd_kcontrol_chip(kcontrol);
+       int n = kcontrol->private_value;
+
+       return snd_ctl_enum_info(uinfo, 1, wm->ctl[n].max,
+                                               wm->ctl[n].enum_names);
+}
+
+static int snd_wm8766_ctl_get(struct snd_kcontrol *kcontrol,
+                                 struct snd_ctl_elem_value *ucontrol)
+{
+       struct snd_wm8766 *wm = snd_kcontrol_chip(kcontrol);
+       int n = kcontrol->private_value;
+       u16 val1, val2;
+
+       if (wm->ctl[n].get)
+               wm->ctl[n].get(wm, &val1, &val2);
+       else {
+               val1 = wm->regs[wm->ctl[n].reg1] & wm->ctl[n].mask1;
+               val1 >>= __ffs(wm->ctl[n].mask1);
+               if (wm->ctl[n].flags & WM8766_FLAG_STEREO) {
+                       val2 = wm->regs[wm->ctl[n].reg2] & wm->ctl[n].mask2;
+                       val2 >>= __ffs(wm->ctl[n].mask2);
+                       if (wm->ctl[n].flags & WM8766_FLAG_VOL_UPDATE)
+                               val2 &= ~WM8766_VOL_UPDATE;
+               }
+       }
+       if (wm->ctl[n].flags & WM8766_FLAG_INVERT) {
+               val1 = wm->ctl[n].max - (val1 - wm->ctl[n].min);
+               val2 = wm->ctl[n].max - (val2 - wm->ctl[n].min);
+       }
+       ucontrol->value.integer.value[0] = val1;
+       if (wm->ctl[n].flags & WM8766_FLAG_STEREO)
+               ucontrol->value.integer.value[1] = val2;
+
+       return 0;
+}
+
+static int snd_wm8766_ctl_put(struct snd_kcontrol *kcontrol,
+                                 struct snd_ctl_elem_value *ucontrol)
+{
+       struct snd_wm8766 *wm = snd_kcontrol_chip(kcontrol);
+       int n = kcontrol->private_value;
+       u16 val, regval1, regval2;
+
+       /* this also works for enum because value is an union */
+       regval1 = ucontrol->value.integer.value[0];
+       regval2 = ucontrol->value.integer.value[1];
+       if (wm->ctl[n].flags & WM8766_FLAG_INVERT) {
+               regval1 = wm->ctl[n].max - (regval1 - wm->ctl[n].min);
+               regval2 = wm->ctl[n].max - (regval2 - wm->ctl[n].min);
+       }
+       if (wm->ctl[n].set)
+               wm->ctl[n].set(wm, regval1, regval2);
+       else {
+               val = wm->regs[wm->ctl[n].reg1] & ~wm->ctl[n].mask1;
+               val |= regval1 << __ffs(wm->ctl[n].mask1);
+               /* both stereo controls in one register */
+               if (wm->ctl[n].flags & WM8766_FLAG_STEREO &&
+                               wm->ctl[n].reg1 == wm->ctl[n].reg2) {
+                       val &= ~wm->ctl[n].mask2;
+                       val |= regval2 << __ffs(wm->ctl[n].mask2);
+               }
+               snd_wm8766_write(wm, wm->ctl[n].reg1, val);
+               /* stereo controls in different registers */
+               if (wm->ctl[n].flags & WM8766_FLAG_STEREO &&
+                               wm->ctl[n].reg1 != wm->ctl[n].reg2) {
+                       val = wm->regs[wm->ctl[n].reg2] & ~wm->ctl[n].mask2;
+                       val |= regval2 << __ffs(wm->ctl[n].mask2);
+                       if (wm->ctl[n].flags & WM8766_FLAG_VOL_UPDATE)
+                               val |= WM8766_VOL_UPDATE;
+                       snd_wm8766_write(wm, wm->ctl[n].reg2, val);
+               }
+       }
+
+       return 0;
+}
+
+static int snd_wm8766_add_control(struct snd_wm8766 *wm, int num)
+{
+       struct snd_kcontrol_new cont;
+       struct snd_kcontrol *ctl;
+
+       memset(&cont, 0, sizeof(cont));
+       cont.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
+       cont.private_value = num;
+       cont.name = wm->ctl[num].name;
+       cont.access = SNDRV_CTL_ELEM_ACCESS_READWRITE;
+       if (wm->ctl[num].flags & WM8766_FLAG_LIM ||
+           wm->ctl[num].flags & WM8766_FLAG_ALC)
+               cont.access |= SNDRV_CTL_ELEM_ACCESS_INACTIVE;
+       cont.tlv.p = NULL;
+       cont.get = snd_wm8766_ctl_get;
+       cont.put = snd_wm8766_ctl_put;
+
+       switch (wm->ctl[num].type) {
+       case SNDRV_CTL_ELEM_TYPE_INTEGER:
+               cont.info = snd_wm8766_volume_info;
+               cont.access |= SNDRV_CTL_ELEM_ACCESS_TLV_READ;
+               cont.tlv.p = wm->ctl[num].tlv;
+               break;
+       case SNDRV_CTL_ELEM_TYPE_BOOLEAN:
+               wm->ctl[num].max = 1;
+               if (wm->ctl[num].flags & WM8766_FLAG_STEREO)
+                       cont.info = snd_ctl_boolean_stereo_info;
+               else
+                       cont.info = snd_ctl_boolean_mono_info;
+               break;
+       case SNDRV_CTL_ELEM_TYPE_ENUMERATED:
+               cont.info = snd_wm8766_enum_info;
+               break;
+       default:
+               return -EINVAL;
+       }
+       ctl = snd_ctl_new1(&cont, wm);
+       if (!ctl)
+               return -ENOMEM;
+       wm->ctl[num].kctl = ctl;
+
+       return snd_ctl_add(wm->card, ctl);
+}
+
+int snd_wm8766_build_controls(struct snd_wm8766 *wm)
+{
+       int err, i;
+
+       for (i = 0; i < WM8766_CTL_COUNT; i++)
+               if (wm->ctl[i].name) {
+                       err = snd_wm8766_add_control(wm, i);
+                       if (err < 0)
+                               return err;
+               }
+
+       return 0;
+}
diff --git a/sound/pci/ice1712/wm8766.h b/sound/pci/ice1712/wm8766.h
new file mode 100644 (file)
index 0000000..c119f84
--- /dev/null
@@ -0,0 +1,163 @@
+#ifndef __SOUND_WM8766_H
+#define __SOUND_WM8766_H
+
+/*
+ *   ALSA driver for ICEnsemble VT17xx
+ *
+ *   Lowlevel functions for WM8766 codec
+ *
+ *     Copyright (c) 2012 Ondrej Zary <linux@rainbow-software.org>
+ *
+ *   This program is free software; you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation; either version 2 of the License, or
+ *   (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+ *
+ */
+
+#define WM8766_REG_DACL1       0x00
+#define WM8766_REG_DACR1       0x01
+#define WM8766_VOL_MASK                        0x1ff           /* incl. update bit */
+#define WM8766_VOL_UPDATE              (1 << 8)        /* update volume */
+#define WM8766_REG_DACCTRL1    0x02
+#define WM8766_DAC_MUTEALL             (1 << 0)
+#define WM8766_DAC_DEEMPALL            (1 << 1)
+#define WM8766_DAC_PDWN                        (1 << 2)
+#define WM8766_DAC_ATC                 (1 << 3)
+#define WM8766_DAC_IZD                 (1 << 4)
+#define WM8766_DAC_PL_MASK             0x1e0
+#define WM8766_DAC_PL_LL               (1 << 5)        /* L chan: L signal */
+#define WM8766_DAC_PL_LR               (2 << 5)        /* L chan: R signal */
+#define WM8766_DAC_PL_LB               (3 << 5)        /* L chan: both */
+#define WM8766_DAC_PL_RL               (1 << 7)        /* R chan: L signal */
+#define WM8766_DAC_PL_RR               (2 << 7)        /* R chan: R signal */
+#define WM8766_DAC_PL_RB               (3 << 7)        /* R chan: both */
+#define WM8766_REG_IFCTRL      0x03
+#define WM8766_IF_FMT_RIGHTJ           (0 << 0)
+#define WM8766_IF_FMT_LEFTJ            (1 << 0)
+#define WM8766_IF_FMT_I2S              (2 << 0)
+#define WM8766_IF_FMT_DSP              (3 << 0)
+#define WM8766_IF_DSP_LATE             (1 << 2)        /* in DSP mode */
+#define WM8766_IF_LRC_INVERTED         (1 << 2)        /* in other modes */
+#define WM8766_IF_BCLK_INVERTED                (1 << 3)
+#define WM8766_IF_IWL_16BIT            (0 << 4)
+#define WM8766_IF_IWL_20BIT            (1 << 4)
+#define WM8766_IF_IWL_24BIT            (2 << 4)
+#define WM8766_IF_IWL_32BIT            (3 << 4)
+#define WM8766_IF_MASK                 0x3f
+#define WM8766_PHASE_INVERT1           (1 << 6)
+#define WM8766_PHASE_INVERT2           (1 << 7)
+#define WM8766_PHASE_INVERT3           (1 << 8)
+#define WM8766_REG_DACL2       0x04
+#define WM8766_REG_DACR2       0x05
+#define WM8766_REG_DACL3       0x06
+#define WM8766_REG_DACR3       0x07
+#define WM8766_REG_MASTDA      0x08
+#define WM8766_REG_DACCTRL2    0x09
+#define WM8766_DAC2_ZCD                        (1 << 0)
+#define WM8766_DAC2_ZFLAG_ALL          (0 << 1)
+#define WM8766_DAC2_ZFLAG_1            (1 << 1)
+#define WM8766_DAC2_ZFLAG_2            (2 << 1)
+#define WM8766_DAC2_ZFLAG_3            (3 << 1)
+#define WM8766_DAC2_MUTE1              (1 << 3)
+#define WM8766_DAC2_MUTE2              (1 << 4)
+#define WM8766_DAC2_MUTE3              (1 << 5)
+#define WM8766_DAC2_DEEMP1             (1 << 6)
+#define WM8766_DAC2_DEEMP2             (1 << 7)
+#define WM8766_DAC2_DEEMP3             (1 << 8)
+#define WM8766_REG_DACCTRL3    0x0a
+#define WM8766_DAC3_DACPD1             (1 << 1)
+#define WM8766_DAC3_DACPD2             (1 << 2)
+#define WM8766_DAC3_DACPD3             (1 << 3)
+#define WM8766_DAC3_PWRDNALL           (1 << 4)
+#define WM8766_DAC3_POWER_MASK         0x1e
+#define WM8766_DAC3_MASTER             (1 << 5)
+#define WM8766_DAC3_DAC128FS           (0 << 6)
+#define WM8766_DAC3_DAC192FS           (1 << 6)
+#define WM8766_DAC3_DAC256FS           (2 << 6)
+#define WM8766_DAC3_DAC384FS           (3 << 6)
+#define WM8766_DAC3_DAC512FS           (4 << 6)
+#define WM8766_DAC3_DAC768FS           (5 << 6)
+#define WM8766_DAC3_MSTR_MASK          0x1e0
+#define WM8766_REG_MUTE1       0x0c
+#define WM8766_MUTE1_MPD               (1 << 6)
+#define WM8766_REG_MUTE2       0x0f
+#define WM8766_MUTE2_MPD               (1 << 5)
+#define WM8766_REG_RESET       0x1f
+
+#define WM8766_REG_COUNT       0x10    /* don't cache the RESET register */
+
+struct snd_wm8766;
+
+struct snd_wm8766_ops {
+       void (*write)(struct snd_wm8766 *wm, u16 addr, u16 data);
+};
+
+enum snd_wm8766_ctl_id {
+       WM8766_CTL_CH1_VOL,
+       WM8766_CTL_CH2_VOL,
+       WM8766_CTL_CH3_VOL,
+       WM8766_CTL_CH1_SW,
+       WM8766_CTL_CH2_SW,
+       WM8766_CTL_CH3_SW,
+       WM8766_CTL_PHASE1_SW,
+       WM8766_CTL_PHASE2_SW,
+       WM8766_CTL_PHASE3_SW,
+       WM8766_CTL_DEEMPH1_SW,
+       WM8766_CTL_DEEMPH2_SW,
+       WM8766_CTL_DEEMPH3_SW,
+       WM8766_CTL_IZD_SW,
+       WM8766_CTL_ZC_SW,
+
+       WM8766_CTL_COUNT,
+};
+
+#define WM8766_ENUM_MAX                16
+
+#define WM8766_FLAG_STEREO     (1 << 0)
+#define WM8766_FLAG_VOL_UPDATE (1 << 1)
+#define WM8766_FLAG_INVERT     (1 << 2)
+#define WM8766_FLAG_LIM                (1 << 3)
+#define WM8766_FLAG_ALC                (1 << 4)
+
+struct snd_wm8766_ctl {
+       struct snd_kcontrol *kctl;
+       const char *name;
+       snd_ctl_elem_type_t type;
+       const char *const enum_names[WM8766_ENUM_MAX];
+       const unsigned int *tlv;
+       u16 reg1, reg2, mask1, mask2, min, max, flags;
+       void (*set)(struct snd_wm8766 *wm, u16 ch1, u16 ch2);
+       void (*get)(struct snd_wm8766 *wm, u16 *ch1, u16 *ch2);
+};
+
+enum snd_wm8766_agc_mode { WM8766_AGC_OFF, WM8766_AGC_LIM, WM8766_AGC_ALC };
+
+struct snd_wm8766 {
+       struct snd_card *card;
+       struct snd_wm8766_ctl ctl[WM8766_CTL_COUNT];
+       enum snd_wm8766_agc_mode agc_mode;
+       struct snd_wm8766_ops ops;
+       u16 regs[WM8766_REG_COUNT];     /* 9-bit registers */
+};
+
+
+
+void snd_wm8766_init(struct snd_wm8766 *wm);
+void snd_wm8766_resume(struct snd_wm8766 *wm);
+void snd_wm8766_set_if(struct snd_wm8766 *wm, u16 dac);
+void snd_wm8766_set_master_mode(struct snd_wm8766 *wm, u16 mode);
+void snd_wm8766_set_power(struct snd_wm8766 *wm, u16 power);
+void snd_wm8766_volume_restore(struct snd_wm8766 *wm);
+int snd_wm8766_build_controls(struct snd_wm8766 *wm);
+
+#endif /* __SOUND_WM8766_H */
diff --git a/sound/pci/ice1712/wm8776.c b/sound/pci/ice1712/wm8776.c
new file mode 100644 (file)
index 0000000..a3c05fe
--- /dev/null
@@ -0,0 +1,633 @@
+/*
+ *   ALSA driver for ICEnsemble VT17xx
+ *
+ *   Lowlevel functions for WM8776 codec
+ *
+ *     Copyright (c) 2012 Ondrej Zary <linux@rainbow-software.org>
+ *
+ *   This program is free software; you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation; either version 2 of the License, or
+ *   (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+ *
+ */
+
+#include <linux/delay.h>
+#include <sound/core.h>
+#include <sound/control.h>
+#include <sound/tlv.h>
+#include "wm8776.h"
+
+/* low-level access */
+
+static void snd_wm8776_write(struct snd_wm8776 *wm, u16 addr, u16 data)
+{
+       u8 bus_addr = addr << 1 | data >> 8;    /* addr + 9th data bit */
+       u8 bus_data = data & 0xff;              /* remaining 8 data bits */
+
+       if (addr < WM8776_REG_RESET)
+               wm->regs[addr] = data;
+       wm->ops.write(wm, bus_addr, bus_data);
+}
+
+/* register-level functions */
+
+static void snd_wm8776_activate_ctl(struct snd_wm8776 *wm,
+                                   const char *ctl_name,
+                                   bool active)
+{
+       struct snd_card *card = wm->card;
+       struct snd_kcontrol *kctl;
+       struct snd_kcontrol_volatile *vd;
+       struct snd_ctl_elem_id elem_id;
+       unsigned int index_offset;
+
+       memset(&elem_id, 0, sizeof(elem_id));
+       strncpy(elem_id.name, ctl_name, sizeof(elem_id.name));
+       elem_id.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
+       kctl = snd_ctl_find_id(card, &elem_id);
+       if (!kctl)
+               return;
+       index_offset = snd_ctl_get_ioff(kctl, &kctl->id);
+       vd = &kctl->vd[index_offset];
+       if (active)
+               vd->access &= ~SNDRV_CTL_ELEM_ACCESS_INACTIVE;
+       else
+               vd->access |= SNDRV_CTL_ELEM_ACCESS_INACTIVE;
+       snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_INFO, &kctl->id);
+}
+
+static void snd_wm8776_update_agc_ctl(struct snd_wm8776 *wm)
+{
+       int i, flags_on = 0, flags_off = 0;
+
+       switch (wm->agc_mode) {
+       case WM8776_AGC_OFF:
+               flags_off = WM8776_FLAG_LIM | WM8776_FLAG_ALC;
+               break;
+       case WM8776_AGC_LIM:
+               flags_off = WM8776_FLAG_ALC;
+               flags_on = WM8776_FLAG_LIM;
+               break;
+       case WM8776_AGC_ALC_R:
+       case WM8776_AGC_ALC_L:
+       case WM8776_AGC_ALC_STEREO:
+               flags_off = WM8776_FLAG_LIM;
+               flags_on = WM8776_FLAG_ALC;
+               break;
+       }
+
+       for (i = 0; i < WM8776_CTL_COUNT; i++)
+               if (wm->ctl[i].flags & flags_off)
+                       snd_wm8776_activate_ctl(wm, wm->ctl[i].name, false);
+               else if (wm->ctl[i].flags & flags_on)
+                       snd_wm8776_activate_ctl(wm, wm->ctl[i].name, true);
+}
+
+static void snd_wm8776_set_agc(struct snd_wm8776 *wm, u16 agc, u16 nothing)
+{
+       u16 alc1 = wm->regs[WM8776_REG_ALCCTRL1] & ~WM8776_ALC1_LCT_MASK;
+       u16 alc2 = wm->regs[WM8776_REG_ALCCTRL2] & ~WM8776_ALC2_LCEN;
+
+       switch (agc) {
+       case 0: /* Off */
+               wm->agc_mode = WM8776_AGC_OFF;
+               break;
+       case 1: /* Limiter */
+               alc2 |= WM8776_ALC2_LCEN;
+               wm->agc_mode = WM8776_AGC_LIM;
+               break;
+       case 2: /* ALC Right */
+               alc1 |= WM8776_ALC1_LCSEL_ALCR;
+               alc2 |= WM8776_ALC2_LCEN;
+               wm->agc_mode = WM8776_AGC_ALC_R;
+               break;
+       case 3: /* ALC Left */
+               alc1 |= WM8776_ALC1_LCSEL_ALCL;
+               alc2 |= WM8776_ALC2_LCEN;
+               wm->agc_mode = WM8776_AGC_ALC_L;
+               break;
+       case 4: /* ALC Stereo */
+               alc1 |= WM8776_ALC1_LCSEL_ALCSTEREO;
+               alc2 |= WM8776_ALC2_LCEN;
+               wm->agc_mode = WM8776_AGC_ALC_STEREO;
+               break;
+       }
+       snd_wm8776_write(wm, WM8776_REG_ALCCTRL1, alc1);
+       snd_wm8776_write(wm, WM8776_REG_ALCCTRL2, alc2);
+       snd_wm8776_update_agc_ctl(wm);
+}
+
+static void snd_wm8776_get_agc(struct snd_wm8776 *wm, u16 *mode, u16 *nothing)
+{
+       *mode = wm->agc_mode;
+}
+
+/* mixer controls */
+
+static const DECLARE_TLV_DB_SCALE(wm8776_hp_tlv, -7400, 100, 1);
+static const DECLARE_TLV_DB_SCALE(wm8776_dac_tlv, -12750, 50, 1);
+static const DECLARE_TLV_DB_SCALE(wm8776_adc_tlv, -10350, 50, 1);
+static const DECLARE_TLV_DB_SCALE(wm8776_lct_tlv, -1600, 100, 0);
+static const DECLARE_TLV_DB_SCALE(wm8776_maxgain_tlv, 0, 400, 0);
+static const DECLARE_TLV_DB_SCALE(wm8776_ngth_tlv, -7800, 600, 0);
+static const DECLARE_TLV_DB_SCALE(wm8776_maxatten_lim_tlv, -1200, 100, 0);
+static const DECLARE_TLV_DB_SCALE(wm8776_maxatten_alc_tlv, -2100, 400, 0);
+
+static struct snd_wm8776_ctl snd_wm8776_default_ctl[WM8776_CTL_COUNT] = {
+       [WM8776_CTL_DAC_VOL] = {
+               .name = "Master Playback Volume",
+               .type = SNDRV_CTL_ELEM_TYPE_INTEGER,
+               .tlv = wm8776_dac_tlv,
+               .reg1 = WM8776_REG_DACLVOL,
+               .reg2 = WM8776_REG_DACRVOL,
+               .mask1 = WM8776_DACVOL_MASK,
+               .mask2 = WM8776_DACVOL_MASK,
+               .max = 0xff,
+               .flags = WM8776_FLAG_STEREO | WM8776_FLAG_VOL_UPDATE,
+       },
+       [WM8776_CTL_DAC_SW] = {
+               .name = "Master Playback Switch",
+               .type = SNDRV_CTL_ELEM_TYPE_BOOLEAN,
+               .reg1 = WM8776_REG_DACCTRL1,
+               .reg2 = WM8776_REG_DACCTRL1,
+               .mask1 = WM8776_DAC_PL_LL,
+               .mask2 = WM8776_DAC_PL_RR,
+               .flags = WM8776_FLAG_STEREO,
+       },
+       [WM8776_CTL_DAC_ZC_SW] = {
+               .name = "Master Zero Cross Detect Playback Switch",
+               .type = SNDRV_CTL_ELEM_TYPE_BOOLEAN,
+               .reg1 = WM8776_REG_DACCTRL1,
+               .mask1 = WM8776_DAC_DZCEN,
+       },
+       [WM8776_CTL_HP_VOL] = {
+               .name = "Headphone Playback Volume",
+               .type = SNDRV_CTL_ELEM_TYPE_INTEGER,
+               .tlv = wm8776_hp_tlv,
+               .reg1 = WM8776_REG_HPLVOL,
+               .reg2 = WM8776_REG_HPRVOL,
+               .mask1 = WM8776_HPVOL_MASK,
+               .mask2 = WM8776_HPVOL_MASK,
+               .min = 0x2f,
+               .max = 0x7f,
+               .flags = WM8776_FLAG_STEREO | WM8776_FLAG_VOL_UPDATE,
+       },
+       [WM8776_CTL_HP_SW] = {
+               .name = "Headphone Playback Switch",
+               .type = SNDRV_CTL_ELEM_TYPE_BOOLEAN,
+               .reg1 = WM8776_REG_PWRDOWN,
+               .mask1 = WM8776_PWR_HPPD,
+               .flags = WM8776_FLAG_INVERT,
+       },
+       [WM8776_CTL_HP_ZC_SW] = {
+               .name = "Headphone Zero Cross Detect Playback Switch",
+               .type = SNDRV_CTL_ELEM_TYPE_BOOLEAN,
+               .reg1 = WM8776_REG_HPLVOL,
+               .reg2 = WM8776_REG_HPRVOL,
+               .mask1 = WM8776_VOL_HPZCEN,
+               .mask2 = WM8776_VOL_HPZCEN,
+               .flags = WM8776_FLAG_STEREO,
+       },
+       [WM8776_CTL_AUX_SW] = {
+               .name = "AUX Playback Switch",
+               .type = SNDRV_CTL_ELEM_TYPE_BOOLEAN,
+               .reg1 = WM8776_REG_OUTMUX,
+               .mask1 = WM8776_OUTMUX_AUX,
+       },
+       [WM8776_CTL_BYPASS_SW] = {
+               .name = "Bypass Playback Switch",
+               .type = SNDRV_CTL_ELEM_TYPE_BOOLEAN,
+               .reg1 = WM8776_REG_OUTMUX,
+               .mask1 = WM8776_OUTMUX_BYPASS,
+       },
+       [WM8776_CTL_DAC_IZD_SW] = {
+               .name = "Infinite Zero Detect Playback Switch",
+               .type = SNDRV_CTL_ELEM_TYPE_BOOLEAN,
+               .reg1 = WM8776_REG_DACCTRL1,
+               .mask1 = WM8776_DAC_IZD,
+       },
+       [WM8776_CTL_PHASE_SW] = {
+               .name = "Phase Invert Playback Switch",
+               .type = SNDRV_CTL_ELEM_TYPE_BOOLEAN,
+               .reg1 = WM8776_REG_PHASESWAP,
+               .reg2 = WM8776_REG_PHASESWAP,
+               .mask1 = WM8776_PHASE_INVERTL,
+               .mask2 = WM8776_PHASE_INVERTR,
+               .flags = WM8776_FLAG_STEREO,
+       },
+       [WM8776_CTL_DEEMPH_SW] = {
+               .name = "Deemphasis Playback Switch",
+               .type = SNDRV_CTL_ELEM_TYPE_BOOLEAN,
+               .reg1 = WM8776_REG_DACCTRL2,
+               .mask1 = WM8776_DAC2_DEEMPH,
+       },
+       [WM8776_CTL_ADC_VOL] = {
+               .name = "Input Capture Volume",
+               .type = SNDRV_CTL_ELEM_TYPE_INTEGER,
+               .tlv = wm8776_adc_tlv,
+               .reg1 = WM8776_REG_ADCLVOL,
+               .reg2 = WM8776_REG_ADCRVOL,
+               .mask1 = WM8776_ADC_GAIN_MASK,
+               .mask2 = WM8776_ADC_GAIN_MASK,
+               .max = 0xff,
+               .flags = WM8776_FLAG_STEREO | WM8776_FLAG_VOL_UPDATE,
+       },
+       [WM8776_CTL_ADC_SW] = {
+               .name = "Input Capture Switch",
+               .type = SNDRV_CTL_ELEM_TYPE_BOOLEAN,
+               .reg1 = WM8776_REG_ADCMUX,
+               .reg2 = WM8776_REG_ADCMUX,
+               .mask1 = WM8776_ADC_MUTEL,
+               .mask2 = WM8776_ADC_MUTER,
+               .flags = WM8776_FLAG_STEREO | WM8776_FLAG_INVERT,
+       },
+       [WM8776_CTL_INPUT1_SW] = {
+               .name = "AIN1 Capture Switch",
+               .type = SNDRV_CTL_ELEM_TYPE_BOOLEAN,
+               .reg1 = WM8776_REG_ADCMUX,
+               .mask1 = WM8776_ADC_MUX_AIN1,
+       },
+       [WM8776_CTL_INPUT2_SW] = {
+               .name = "AIN2 Capture Switch",
+               .type = SNDRV_CTL_ELEM_TYPE_BOOLEAN,
+               .reg1 = WM8776_REG_ADCMUX,
+               .mask1 = WM8776_ADC_MUX_AIN2,
+       },
+       [WM8776_CTL_INPUT3_SW] = {
+               .name = "AIN3 Capture Switch",
+               .type = SNDRV_CTL_ELEM_TYPE_BOOLEAN,
+               .reg1 = WM8776_REG_ADCMUX,
+               .mask1 = WM8776_ADC_MUX_AIN3,
+       },
+       [WM8776_CTL_INPUT4_SW] = {
+               .name = "AIN4 Capture Switch",
+               .type = SNDRV_CTL_ELEM_TYPE_BOOLEAN,
+               .reg1 = WM8776_REG_ADCMUX,
+               .mask1 = WM8776_ADC_MUX_AIN4,
+       },
+       [WM8776_CTL_INPUT5_SW] = {
+               .name = "AIN5 Capture Switch",
+               .type = SNDRV_CTL_ELEM_TYPE_BOOLEAN,
+               .reg1 = WM8776_REG_ADCMUX,
+               .mask1 = WM8776_ADC_MUX_AIN5,
+       },
+       [WM8776_CTL_AGC_SEL] = {
+               .name = "AGC Select Capture Enum",
+               .type = SNDRV_CTL_ELEM_TYPE_ENUMERATED,
+               .enum_names = { "Off", "Limiter", "ALC Right", "ALC Left",
+                               "ALC Stereo" },
+               .max = 5,       /* .enum_names item count */
+               .set = snd_wm8776_set_agc,
+               .get = snd_wm8776_get_agc,
+       },
+       [WM8776_CTL_LIM_THR] = {
+               .name = "Limiter Threshold Capture Volume",
+               .type = SNDRV_CTL_ELEM_TYPE_INTEGER,
+               .tlv = wm8776_lct_tlv,
+               .reg1 = WM8776_REG_ALCCTRL1,
+               .mask1 = WM8776_ALC1_LCT_MASK,
+               .max = 15,
+               .flags = WM8776_FLAG_LIM,
+       },
+       [WM8776_CTL_LIM_ATK] = {
+               .name = "Limiter Attack Time Capture Enum",
+               .type = SNDRV_CTL_ELEM_TYPE_ENUMERATED,
+               .enum_names = { "0.25 ms", "0.5 ms", "1 ms", "2 ms", "4 ms",
+                       "8 ms", "16 ms", "32 ms", "64 ms", "128 ms", "256 ms" },
+               .max = 11,      /* .enum_names item count */
+               .reg1 = WM8776_REG_ALCCTRL3,
+               .mask1 = WM8776_ALC3_ATK_MASK,
+               .flags = WM8776_FLAG_LIM,
+       },
+       [WM8776_CTL_LIM_DCY] = {
+               .name = "Limiter Decay Time Capture Enum",
+               .type = SNDRV_CTL_ELEM_TYPE_ENUMERATED,
+               .enum_names = { "1.2 ms", "2.4 ms", "4.8 ms", "9.6 ms",
+                       "19.2 ms", "38.4 ms", "76.8 ms", "154 ms", "307 ms",
+                       "614 ms", "1.23 s" },
+               .max = 11,      /* .enum_names item count */
+               .reg1 = WM8776_REG_ALCCTRL3,
+               .mask1 = WM8776_ALC3_DCY_MASK,
+               .flags = WM8776_FLAG_LIM,
+       },
+       [WM8776_CTL_LIM_TRANWIN] = {
+               .name = "Limiter Transient Window Capture Enum",
+               .type = SNDRV_CTL_ELEM_TYPE_ENUMERATED,
+               .enum_names = { "0 us", "62.5 us", "125 us", "250 us", "500 us",
+                       "1 ms", "2 ms", "4 ms" },
+               .max = 8,       /* .enum_names item count */
+               .reg1 = WM8776_REG_LIMITER,
+               .mask1 = WM8776_LIM_TRANWIN_MASK,
+               .flags = WM8776_FLAG_LIM,
+       },
+       [WM8776_CTL_LIM_MAXATTN] = {
+               .name = "Limiter Maximum Attenuation Capture Volume",
+               .type = SNDRV_CTL_ELEM_TYPE_INTEGER,
+               .tlv = wm8776_maxatten_lim_tlv,
+               .reg1 = WM8776_REG_LIMITER,
+               .mask1 = WM8776_LIM_MAXATTEN_MASK,
+               .min = 3,
+               .max = 12,
+               .flags = WM8776_FLAG_LIM | WM8776_FLAG_INVERT,
+       },
+       [WM8776_CTL_ALC_TGT] = {
+               .name = "ALC Target Level Capture Volume",
+               .type = SNDRV_CTL_ELEM_TYPE_INTEGER,
+               .tlv = wm8776_lct_tlv,
+               .reg1 = WM8776_REG_ALCCTRL1,
+               .mask1 = WM8776_ALC1_LCT_MASK,
+               .max = 15,
+               .flags = WM8776_FLAG_ALC,
+       },
+       [WM8776_CTL_ALC_ATK] = {
+               .name = "ALC Attack Time Capture Enum",
+               .type = SNDRV_CTL_ELEM_TYPE_ENUMERATED,
+               .enum_names = { "8.40 ms", "16.8 ms", "33.6 ms", "67.2 ms",
+                       "134 ms", "269 ms", "538 ms", "1.08 s", "2.15 s",
+                       "4.3 s", "8.6 s" },
+               .max = 11,      /* .enum_names item count */
+               .reg1 = WM8776_REG_ALCCTRL3,
+               .mask1 = WM8776_ALC3_ATK_MASK,
+               .flags = WM8776_FLAG_ALC,
+       },
+       [WM8776_CTL_ALC_DCY] = {
+               .name = "ALC Decay Time Capture Enum",
+               .type = SNDRV_CTL_ELEM_TYPE_ENUMERATED,
+               .enum_names = { "33.5 ms", "67.0 ms", "134 ms", "268 ms",
+                       "536 ms", "1.07 s", "2.14 s", "4.29 s", "8.58 s",
+                       "17.2 s", "34.3 s" },
+               .max = 11,      /* .enum_names item count */
+               .reg1 = WM8776_REG_ALCCTRL3,
+               .mask1 = WM8776_ALC3_DCY_MASK,
+               .flags = WM8776_FLAG_ALC,
+       },
+       [WM8776_CTL_ALC_MAXGAIN] = {
+               .name = "ALC Maximum Gain Capture Volume",
+               .type = SNDRV_CTL_ELEM_TYPE_INTEGER,
+               .tlv = wm8776_maxgain_tlv,
+               .reg1 = WM8776_REG_ALCCTRL1,
+               .mask1 = WM8776_ALC1_MAXGAIN_MASK,
+               .min = 1,
+               .max = 7,
+               .flags = WM8776_FLAG_ALC,
+       },
+       [WM8776_CTL_ALC_MAXATTN] = {
+               .name = "ALC Maximum Attenuation Capture Volume",
+               .type = SNDRV_CTL_ELEM_TYPE_INTEGER,
+               .tlv = wm8776_maxatten_alc_tlv,
+               .reg1 = WM8776_REG_LIMITER,
+               .mask1 = WM8776_LIM_MAXATTEN_MASK,
+               .min = 10,
+               .max = 15,
+               .flags = WM8776_FLAG_ALC | WM8776_FLAG_INVERT,
+       },
+       [WM8776_CTL_ALC_HLD] = {
+               .name = "ALC Hold Time Capture Enum",
+               .type = SNDRV_CTL_ELEM_TYPE_ENUMERATED,
+               .enum_names = { "0 ms", "2.67 ms", "5.33 ms", "10.6 ms",
+                       "21.3 ms", "42.7 ms", "85.3 ms", "171 ms", "341 ms",
+                       "683 ms", "1.37 s", "2.73 s", "5.46 s", "10.9 s",
+                       "21.8 s", "43.7 s" },
+               .max = 16,      /* .enum_names item count */
+               .reg1 = WM8776_REG_ALCCTRL2,
+               .mask1 = WM8776_ALC2_HOLD_MASK,
+               .flags = WM8776_FLAG_ALC,
+       },
+       [WM8776_CTL_NGT_SW] = {
+               .name = "Noise Gate Capture Switch",
+               .type = SNDRV_CTL_ELEM_TYPE_BOOLEAN,
+               .reg1 = WM8776_REG_NOISEGATE,
+               .mask1 = WM8776_NGAT_ENABLE,
+               .flags = WM8776_FLAG_ALC,
+       },
+       [WM8776_CTL_NGT_THR] = {
+               .name = "Noise Gate Threshold Capture Volume",
+               .type = SNDRV_CTL_ELEM_TYPE_INTEGER,
+               .tlv = wm8776_ngth_tlv,
+               .reg1 = WM8776_REG_NOISEGATE,
+               .mask1 = WM8776_NGAT_THR_MASK,
+               .max = 7,
+               .flags = WM8776_FLAG_ALC,
+       },
+};
+
+/* exported functions */
+
+void snd_wm8776_init(struct snd_wm8776 *wm)
+{
+       int i;
+       static const u16 default_values[] = {
+               0x000, 0x100, 0x000,
+               0x000, 0x100, 0x000,
+               0x000, 0x090, 0x000, 0x000,
+               0x022, 0x022, 0x022,
+               0x008, 0x0cf, 0x0cf, 0x07b, 0x000,
+               0x032, 0x000, 0x0a6, 0x001, 0x001
+       };
+
+       memcpy(wm->ctl, snd_wm8776_default_ctl, sizeof(wm->ctl));
+
+       snd_wm8776_write(wm, WM8776_REG_RESET, 0x00); /* reset */
+       udelay(10);
+       /* load defaults */
+       for (i = 0; i < ARRAY_SIZE(default_values); i++)
+               snd_wm8776_write(wm, i, default_values[i]);
+}
+
+void snd_wm8776_resume(struct snd_wm8776 *wm)
+{
+       int i;
+
+       for (i = 0; i < WM8776_REG_COUNT; i++)
+               snd_wm8776_write(wm, i, wm->regs[i]);
+}
+
+void snd_wm8776_set_dac_if(struct snd_wm8776 *wm, u16 dac)
+{
+       snd_wm8776_write(wm, WM8776_REG_DACIFCTRL, dac);
+}
+
+void snd_wm8776_set_adc_if(struct snd_wm8776 *wm, u16 adc)
+{
+       snd_wm8776_write(wm, WM8776_REG_ADCIFCTRL, adc);
+}
+
+void snd_wm8776_set_master_mode(struct snd_wm8776 *wm, u16 mode)
+{
+       snd_wm8776_write(wm, WM8776_REG_MSTRCTRL, mode);
+}
+
+void snd_wm8776_set_power(struct snd_wm8776 *wm, u16 power)
+{
+       snd_wm8776_write(wm, WM8776_REG_PWRDOWN, power);
+}
+
+void snd_wm8776_volume_restore(struct snd_wm8776 *wm)
+{
+       u16 val = wm->regs[WM8776_REG_DACRVOL];
+       /* restore volume after MCLK stopped */
+       snd_wm8776_write(wm, WM8776_REG_DACRVOL, val | WM8776_VOL_UPDATE);
+}
+
+/* mixer callbacks */
+
+static int snd_wm8776_volume_info(struct snd_kcontrol *kcontrol,
+                                  struct snd_ctl_elem_info *uinfo)
+{
+       struct snd_wm8776 *wm = snd_kcontrol_chip(kcontrol);
+       int n = kcontrol->private_value;
+
+       uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
+       uinfo->count = (wm->ctl[n].flags & WM8776_FLAG_STEREO) ? 2 : 1;
+       uinfo->value.integer.min = wm->ctl[n].min;
+       uinfo->value.integer.max = wm->ctl[n].max;
+
+       return 0;
+}
+
+static int snd_wm8776_enum_info(struct snd_kcontrol *kcontrol,
+                                     struct snd_ctl_elem_info *uinfo)
+{
+       struct snd_wm8776 *wm = snd_kcontrol_chip(kcontrol);
+       int n = kcontrol->private_value;
+
+       return snd_ctl_enum_info(uinfo, 1, wm->ctl[n].max,
+                                               wm->ctl[n].enum_names);
+}
+
+static int snd_wm8776_ctl_get(struct snd_kcontrol *kcontrol,
+                                 struct snd_ctl_elem_value *ucontrol)
+{
+       struct snd_wm8776 *wm = snd_kcontrol_chip(kcontrol);
+       int n = kcontrol->private_value;
+       u16 val1, val2;
+
+       if (wm->ctl[n].get)
+               wm->ctl[n].get(wm, &val1, &val2);
+       else {
+               val1 = wm->regs[wm->ctl[n].reg1] & wm->ctl[n].mask1;
+               val1 >>= __ffs(wm->ctl[n].mask1);
+               if (wm->ctl[n].flags & WM8776_FLAG_STEREO) {
+                       val2 = wm->regs[wm->ctl[n].reg2] & wm->ctl[n].mask2;
+                       val2 >>= __ffs(wm->ctl[n].mask2);
+                       if (wm->ctl[n].flags & WM8776_FLAG_VOL_UPDATE)
+                               val2 &= ~WM8776_VOL_UPDATE;
+               }
+       }
+       if (wm->ctl[n].flags & WM8776_FLAG_INVERT) {
+               val1 = wm->ctl[n].max - (val1 - wm->ctl[n].min);
+               val2 = wm->ctl[n].max - (val2 - wm->ctl[n].min);
+       }
+       ucontrol->value.integer.value[0] = val1;
+       if (wm->ctl[n].flags & WM8776_FLAG_STEREO)
+               ucontrol->value.integer.value[1] = val2;
+
+       return 0;
+}
+
+static int snd_wm8776_ctl_put(struct snd_kcontrol *kcontrol,
+                                 struct snd_ctl_elem_value *ucontrol)
+{
+       struct snd_wm8776 *wm = snd_kcontrol_chip(kcontrol);
+       int n = kcontrol->private_value;
+       u16 val, regval1, regval2;
+
+       /* this also works for enum because value is an union */
+       regval1 = ucontrol->value.integer.value[0];
+       regval2 = ucontrol->value.integer.value[1];
+       if (wm->ctl[n].flags & WM8776_FLAG_INVERT) {
+               regval1 = wm->ctl[n].max - (regval1 - wm->ctl[n].min);
+               regval2 = wm->ctl[n].max - (regval2 - wm->ctl[n].min);
+       }
+       if (wm->ctl[n].set)
+               wm->ctl[n].set(wm, regval1, regval2);
+       else {
+               val = wm->regs[wm->ctl[n].reg1] & ~wm->ctl[n].mask1;
+               val |= regval1 << __ffs(wm->ctl[n].mask1);
+               /* both stereo controls in one register */
+               if (wm->ctl[n].flags & WM8776_FLAG_STEREO &&
+                               wm->ctl[n].reg1 == wm->ctl[n].reg2) {
+                       val &= ~wm->ctl[n].mask2;
+                       val |= regval2 << __ffs(wm->ctl[n].mask2);
+               }
+               snd_wm8776_write(wm, wm->ctl[n].reg1, val);
+               /* stereo controls in different registers */
+               if (wm->ctl[n].flags & WM8776_FLAG_STEREO &&
+                               wm->ctl[n].reg1 != wm->ctl[n].reg2) {
+                       val = wm->regs[wm->ctl[n].reg2] & ~wm->ctl[n].mask2;
+                       val |= regval2 << __ffs(wm->ctl[n].mask2);
+                       if (wm->ctl[n].flags & WM8776_FLAG_VOL_UPDATE)
+                               val |= WM8776_VOL_UPDATE;
+                       snd_wm8776_write(wm, wm->ctl[n].reg2, val);
+               }
+       }
+
+       return 0;
+}
+
+static int snd_wm8776_add_control(struct snd_wm8776 *wm, int num)
+{
+       struct snd_kcontrol_new cont;
+       struct snd_kcontrol *ctl;
+
+       memset(&cont, 0, sizeof(cont));
+       cont.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
+       cont.private_value = num;
+       cont.name = wm->ctl[num].name;
+       cont.access = SNDRV_CTL_ELEM_ACCESS_READWRITE;
+       if (wm->ctl[num].flags & WM8776_FLAG_LIM ||
+           wm->ctl[num].flags & WM8776_FLAG_ALC)
+               cont.access |= SNDRV_CTL_ELEM_ACCESS_INACTIVE;
+       cont.tlv.p = NULL;
+       cont.get = snd_wm8776_ctl_get;
+       cont.put = snd_wm8776_ctl_put;
+
+       switch (wm->ctl[num].type) {
+       case SNDRV_CTL_ELEM_TYPE_INTEGER:
+               cont.info = snd_wm8776_volume_info;
+               cont.access |= SNDRV_CTL_ELEM_ACCESS_TLV_READ;
+               cont.tlv.p = wm->ctl[num].tlv;
+               break;
+       case SNDRV_CTL_ELEM_TYPE_BOOLEAN:
+               wm->ctl[num].max = 1;
+               if (wm->ctl[num].flags & WM8776_FLAG_STEREO)
+                       cont.info = snd_ctl_boolean_stereo_info;
+               else
+                       cont.info = snd_ctl_boolean_mono_info;
+               break;
+       case SNDRV_CTL_ELEM_TYPE_ENUMERATED:
+               cont.info = snd_wm8776_enum_info;
+               break;
+       default:
+               return -EINVAL;
+       }
+       ctl = snd_ctl_new1(&cont, wm);
+       if (!ctl)
+               return -ENOMEM;
+
+       return snd_ctl_add(wm->card, ctl);
+}
+
+int snd_wm8776_build_controls(struct snd_wm8776 *wm)
+{
+       int err, i;
+
+       for (i = 0; i < WM8776_CTL_COUNT; i++)
+               if (wm->ctl[i].name) {
+                       err = snd_wm8776_add_control(wm, i);
+                       if (err < 0)
+                               return err;
+               }
+
+       return 0;
+}
diff --git a/sound/pci/ice1712/wm8776.h b/sound/pci/ice1712/wm8776.h
new file mode 100644 (file)
index 0000000..93a2d69
--- /dev/null
@@ -0,0 +1,226 @@
+#ifndef __SOUND_WM8776_H
+#define __SOUND_WM8776_H
+
+/*
+ *   ALSA driver for ICEnsemble VT17xx
+ *
+ *   Lowlevel functions for WM8776 codec
+ *
+ *     Copyright (c) 2012 Ondrej Zary <linux@rainbow-software.org>
+ *
+ *   This program is free software; you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation; either version 2 of the License, or
+ *   (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+ *
+ */
+
+#define WM8776_REG_HPLVOL      0x00
+#define WM8776_REG_HPRVOL      0x01
+#define WM8776_REG_HPMASTER    0x02
+#define WM8776_HPVOL_MASK              0x17f           /* incl. update bit */
+#define WM8776_VOL_HPZCEN              (1 << 7)        /* zero cross detect */
+#define WM8776_VOL_UPDATE              (1 << 8)        /* update volume */
+#define WM8776_REG_DACLVOL     0x03
+#define WM8776_REG_DACRVOL     0x04
+#define WM8776_REG_DACMASTER   0x05
+#define WM8776_DACVOL_MASK             0x1ff           /* incl. update bit */
+#define WM8776_REG_PHASESWAP   0x06
+#define WM8776_PHASE_INVERTL           (1 << 0)
+#define WM8776_PHASE_INVERTR           (1 << 1)
+#define WM8776_REG_DACCTRL1    0x07
+#define WM8776_DAC_DZCEN               (1 << 0)
+#define WM8776_DAC_ATC                 (1 << 1)
+#define WM8776_DAC_IZD                 (1 << 2)
+#define WM8776_DAC_TOD                 (1 << 3)
+#define WM8776_DAC_PL_MASK             0xf0
+#define WM8776_DAC_PL_LL               (1 << 4)        /* L chan: L signal */
+#define WM8776_DAC_PL_LR               (2 << 4)        /* L chan: R signal */
+#define WM8776_DAC_PL_LB               (3 << 4)        /* L chan: both */
+#define WM8776_DAC_PL_RL               (1 << 6)        /* R chan: L signal */
+#define WM8776_DAC_PL_RR               (2 << 6)        /* R chan: R signal */
+#define WM8776_DAC_PL_RB               (3 << 6)        /* R chan: both */
+#define WM8776_REG_DACMUTE     0x08
+#define WM8776_DACMUTE                 (1 << 0)
+#define WM8776_REG_DACCTRL2    0x09
+#define WM8776_DAC2_DEEMPH             (1 << 0)
+#define WM8776_DAC2_ZFLAG_DISABLE      (0 << 1)
+#define WM8776_DAC2_ZFLAG_OWN          (1 << 1)
+#define WM8776_DAC2_ZFLAG_BOTH         (2 << 1)
+#define WM8776_DAC2_ZFLAG_EITHER       (3 << 1)
+#define WM8776_REG_DACIFCTRL   0x0a
+#define WM8776_FMT_RIGHTJ              (0 << 0)
+#define WM8776_FMT_LEFTJ               (1 << 0)
+#define WM8776_FMT_I2S                 (2 << 0)
+#define WM8776_FMT_DSP                 (3 << 0)
+#define WM8776_FMT_DSP_LATE            (1 << 2)        /* in DSP mode */
+#define WM8776_FMT_LRC_INVERTED                (1 << 2)        /* in other modes */
+#define WM8776_FMT_BCLK_INVERTED       (1 << 3)
+#define WM8776_FMT_16BIT               (0 << 4)
+#define WM8776_FMT_20BIT               (1 << 4)
+#define WM8776_FMT_24BIT               (2 << 4)
+#define WM8776_FMT_32BIT               (3 << 4)
+#define WM8776_REG_ADCIFCTRL   0x0b
+#define WM8776_FMT_ADCMCLK_INVERTED    (1 << 6)
+#define WM8776_FMT_ADCHPD              (1 << 8)
+#define WM8776_REG_MSTRCTRL    0x0c
+#define WM8776_IF_ADC256FS             (2 << 0)
+#define WM8776_IF_ADC384FS             (3 << 0)
+#define WM8776_IF_ADC512FS             (4 << 0)
+#define WM8776_IF_ADC768FS             (5 << 0)
+#define WM8776_IF_OVERSAMP64           (1 << 3)
+#define WM8776_IF_DAC128FS             (0 << 4)
+#define WM8776_IF_DAC192FS             (1 << 4)
+#define WM8776_IF_DAC256FS             (2 << 4)
+#define WM8776_IF_DAC384FS             (3 << 4)
+#define WM8776_IF_DAC512FS             (4 << 4)
+#define WM8776_IF_DAC768FS             (5 << 4)
+#define WM8776_IF_DAC_MASTER           (1 << 7)
+#define WM8776_IF_ADC_MASTER           (1 << 8)
+#define WM8776_REG_PWRDOWN     0x0d
+#define WM8776_PWR_PDWN                        (1 << 0)
+#define WM8776_PWR_ADCPD               (1 << 1)
+#define WM8776_PWR_DACPD               (1 << 2)
+#define WM8776_PWR_HPPD                        (1 << 3)
+#define WM8776_PWR_AINPD               (1 << 6)
+#define WM8776_REG_ADCLVOL     0x0e
+#define WM8776_REG_ADCRVOL     0x0f
+#define WM8776_ADC_GAIN_MASK           0xff
+#define WM8776_ADC_ZCEN                        (1 << 8)
+#define WM8776_REG_ALCCTRL1    0x10
+#define WM8776_ALC1_LCT_MASK           0x0f    /* 0=-16dB, 1=-15dB..15=-1dB */
+#define WM8776_ALC1_MAXGAIN_MASK       0x70    /* 0,1=0dB, 2=+4dB...7=+24dB */
+#define WM8776_ALC1_LCSEL_MASK         0x180
+#define WM8776_ALC1_LCSEL_LIMITER      (0 << 7)
+#define WM8776_ALC1_LCSEL_ALCR         (1 << 7)
+#define WM8776_ALC1_LCSEL_ALCL         (2 << 7)
+#define WM8776_ALC1_LCSEL_ALCSTEREO    (3 << 7)
+#define WM8776_REG_ALCCTRL2    0x11
+#define WM8776_ALC2_HOLD_MASK          0x0f    /*0=0ms, 1=2.67ms, 2=5.33ms.. */
+#define WM8776_ALC2_ZCEN               (1 << 7)
+#define WM8776_ALC2_LCEN               (1 << 8)
+#define WM8776_REG_ALCCTRL3    0x12
+#define WM8776_ALC3_ATK_MASK           0x0f
+#define WM8776_ALC3_DCY_MASK           0xf0
+#define WM8776_ALC3_FDECAY             (1 << 8)
+#define WM8776_REG_NOISEGATE   0x13
+#define WM8776_NGAT_ENABLE             (1 << 0)
+#define WM8776_NGAT_THR_MASK           0x1c    /*0=-78dB, 1=-72dB...7=-36dB */
+#define WM8776_REG_LIMITER     0x14
+#define WM8776_LIM_MAXATTEN_MASK       0x0f
+#define WM8776_LIM_TRANWIN_MASK                0x70    /*0=0us, 1=62.5us, 2=125us.. */
+#define WM8776_REG_ADCMUX      0x15
+#define WM8776_ADC_MUX_AIN1            (1 << 0)
+#define WM8776_ADC_MUX_AIN2            (1 << 1)
+#define WM8776_ADC_MUX_AIN3            (1 << 2)
+#define WM8776_ADC_MUX_AIN4            (1 << 3)
+#define WM8776_ADC_MUX_AIN5            (1 << 4)
+#define WM8776_ADC_MUTER               (1 << 6)
+#define WM8776_ADC_MUTEL               (1 << 7)
+#define WM8776_ADC_LRBOTH              (1 << 8)
+#define WM8776_REG_OUTMUX      0x16
+#define WM8776_OUTMUX_DAC              (1 << 0)
+#define WM8776_OUTMUX_AUX              (1 << 1)
+#define WM8776_OUTMUX_BYPASS           (1 << 2)
+#define WM8776_REG_RESET       0x17
+
+#define WM8776_REG_COUNT       0x17    /* don't cache the RESET register */
+
+struct snd_wm8776;
+
+struct snd_wm8776_ops {
+       void (*write)(struct snd_wm8776 *wm, u8 addr, u8 data);
+};
+
+enum snd_wm8776_ctl_id {
+       WM8776_CTL_DAC_VOL,
+       WM8776_CTL_DAC_SW,
+       WM8776_CTL_DAC_ZC_SW,
+       WM8776_CTL_HP_VOL,
+       WM8776_CTL_HP_SW,
+       WM8776_CTL_HP_ZC_SW,
+       WM8776_CTL_AUX_SW,
+       WM8776_CTL_BYPASS_SW,
+       WM8776_CTL_DAC_IZD_SW,
+       WM8776_CTL_PHASE_SW,
+       WM8776_CTL_DEEMPH_SW,
+       WM8776_CTL_ADC_VOL,
+       WM8776_CTL_ADC_SW,
+       WM8776_CTL_INPUT1_SW,
+       WM8776_CTL_INPUT2_SW,
+       WM8776_CTL_INPUT3_SW,
+       WM8776_CTL_INPUT4_SW,
+       WM8776_CTL_INPUT5_SW,
+       WM8776_CTL_AGC_SEL,
+       WM8776_CTL_LIM_THR,
+       WM8776_CTL_LIM_ATK,
+       WM8776_CTL_LIM_DCY,
+       WM8776_CTL_LIM_TRANWIN,
+       WM8776_CTL_LIM_MAXATTN,
+       WM8776_CTL_ALC_TGT,
+       WM8776_CTL_ALC_ATK,
+       WM8776_CTL_ALC_DCY,
+       WM8776_CTL_ALC_MAXGAIN,
+       WM8776_CTL_ALC_MAXATTN,
+       WM8776_CTL_ALC_HLD,
+       WM8776_CTL_NGT_SW,
+       WM8776_CTL_NGT_THR,
+
+       WM8776_CTL_COUNT,
+};
+
+#define WM8776_ENUM_MAX                16
+
+#define WM8776_FLAG_STEREO     (1 << 0)
+#define WM8776_FLAG_VOL_UPDATE (1 << 1)
+#define WM8776_FLAG_INVERT     (1 << 2)
+#define WM8776_FLAG_LIM                (1 << 3)
+#define WM8776_FLAG_ALC                (1 << 4)
+
+struct snd_wm8776_ctl {
+       const char *name;
+       snd_ctl_elem_type_t type;
+       const char *const enum_names[WM8776_ENUM_MAX];
+       const unsigned int *tlv;
+       u16 reg1, reg2, mask1, mask2, min, max, flags;
+       void (*set)(struct snd_wm8776 *wm, u16 ch1, u16 ch2);
+       void (*get)(struct snd_wm8776 *wm, u16 *ch1, u16 *ch2);
+};
+
+enum snd_wm8776_agc_mode {
+       WM8776_AGC_OFF,
+       WM8776_AGC_LIM,
+       WM8776_AGC_ALC_R,
+       WM8776_AGC_ALC_L,
+       WM8776_AGC_ALC_STEREO
+};
+
+struct snd_wm8776 {
+       struct snd_card *card;
+       struct snd_wm8776_ctl ctl[WM8776_CTL_COUNT];
+       enum snd_wm8776_agc_mode agc_mode;
+       struct snd_wm8776_ops ops;
+       u16 regs[WM8776_REG_COUNT];     /* 9-bit registers */
+};
+
+
+
+void snd_wm8776_init(struct snd_wm8776 *wm);
+void snd_wm8776_resume(struct snd_wm8776 *wm);
+void snd_wm8776_set_dac_if(struct snd_wm8776 *wm, u16 dac);
+void snd_wm8776_set_adc_if(struct snd_wm8776 *wm, u16 adc);
+void snd_wm8776_set_master_mode(struct snd_wm8776 *wm, u16 mode);
+void snd_wm8776_set_power(struct snd_wm8776 *wm, u16 power);
+void snd_wm8776_volume_restore(struct snd_wm8776 *wm);
+int snd_wm8776_build_controls(struct snd_wm8776 *wm);
+
+#endif /* __SOUND_WM8776_H */
index e618f78..184163b 100644 (file)
@@ -25,7 +25,6 @@
 
 
 
-#include <linux/io.h>
 #include <linux/delay.h>
 #include <linux/interrupt.h>
 #include <linux/init.h>
index 3d71423..8104eab 100644 (file)
@@ -52,6 +52,7 @@ static DEFINE_PCI_DEVICE_TABLE(xonar_ids) = {
        { OXYGEN_PCI_SUBID(0x1043, 0x835d) },
        { OXYGEN_PCI_SUBID(0x1043, 0x835e) },
        { OXYGEN_PCI_SUBID(0x1043, 0x838e) },
+       { OXYGEN_PCI_SUBID(0x1043, 0x8522) },
        { OXYGEN_PCI_SUBID_BROKEN_EEPROM },
        { }
 };
index 63cff90..b555b62 100644 (file)
@@ -1255,7 +1255,6 @@ static void dump_wm87x6_registers(struct oxygen *chip,
 }
 
 static const struct oxygen_model model_xonar_ds = {
-       .shortname = "Xonar DS",
        .longname = "Asus Virtuoso 66",
        .chip = "AV200",
        .init = xonar_ds_init,
@@ -1327,6 +1326,11 @@ int __devinit get_xonar_wm87x6_model(struct oxygen *chip,
        switch (id->subdevice) {
        case 0x838e:
                chip->model = model_xonar_ds;
+               chip->model.shortname = "Xonar DS";
+               break;
+       case 0x8522:
+               chip->model = model_xonar_ds;
+               chip->model.shortname = "Xonar DSX";
                break;
        case 0x835e:
                chip->model = model_xonar_hdav_slim;
index ff77b28..225dfd7 100644 (file)
@@ -90,7 +90,7 @@ config SND_USB_CAIAQ_INPUT
 
 config SND_USB_US122L
        tristate "Tascam US-122L USB driver"
-       depends on X86 && EXPERIMENTAL
+       depends on X86
        select SND_HWDEP
        select SND_RAWMIDI
        help
index 5c12a3f..e7329d0 100644 (file)
@@ -173,11 +173,8 @@ static int init_pitch_v2(struct snd_usb_audio *chip, int iface,
 {
        struct usb_device *dev = chip->dev;
        unsigned char data[1];
-       unsigned int ep;
        int err;
 
-       ep = get_endpoint(alts, 0)->bEndpointAddress;
-
        data[0] = 1;
        if ((err = snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), UAC2_CS_CUR,
                                   USB_TYPE_CLASS | USB_RECIP_ENDPOINT | USB_DIR_OUT,
index 88d8ceb..49c788d 100644 (file)
@@ -1456,6 +1456,40 @@ YAMAHA_DEVICE(0x7010, "UB99"),
                }
        }
 },
+{
+       /* Advanced mode of the Roland VG-99, with MIDI and 24-bit PCM at 44.1
+        * kHz. In standard mode, the device has ID 0582:00b3, and offers
+        * 16-bit PCM at 44.1 kHz with no MIDI.
+        */
+       USB_DEVICE(0x0582, 0x00b2),
+       .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
+               .vendor_name = "Roland",
+               .product_name = "VG-99",
+               .ifnum = QUIRK_ANY_INTERFACE,
+               .type = QUIRK_COMPOSITE,
+               .data = (const struct snd_usb_audio_quirk[]) {
+                       {
+                               .ifnum = 0,
+                               .type = QUIRK_AUDIO_STANDARD_INTERFACE
+                       },
+                       {
+                               .ifnum = 1,
+                               .type = QUIRK_AUDIO_STANDARD_INTERFACE
+                       },
+                       {
+                               .ifnum = 2,
+                               .type = QUIRK_MIDI_FIXED_ENDPOINT,
+                               .data = & (const struct snd_usb_midi_endpoint_info) {
+                                       .out_cables = 0x0003,
+                                       .in_cables  = 0x0003
+                               }
+                       },
+                       {
+                               .ifnum = -1
+                       }
+               }
+       }
+},
 {
        /* Roland SonicCell */
        USB_DEVICE(0x0582, 0x00c2),
@@ -2880,6 +2914,47 @@ YAMAHA_DEVICE(0x7010, "UB99"),
        }
 },
 
+/* Reloop Play */
+{
+       USB_DEVICE(0x200c, 0x100b),
+       .bInterfaceClass = USB_CLASS_PER_INTERFACE,
+       .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) {
+               .ifnum = QUIRK_ANY_INTERFACE,
+               .type = QUIRK_COMPOSITE,
+               .data = &(const struct snd_usb_audio_quirk[]) {
+                       {
+                               .ifnum = 0,
+                               .type = QUIRK_AUDIO_STANDARD_MIXER,
+                       },
+                       {
+                               .ifnum = 1,
+                               .type = QUIRK_AUDIO_FIXED_ENDPOINT,
+                               .data = &(const struct audioformat) {
+                                       .formats = SNDRV_PCM_FMTBIT_S24_3LE,
+                                       .channels = 4,
+                                       .iface = 1,
+                                       .altsetting = 1,
+                                       .altset_idx = 1,
+                                       .attributes = UAC_EP_CS_ATTR_SAMPLE_RATE,
+                                       .endpoint = 0x01,
+                                       .ep_attr = USB_ENDPOINT_SYNC_ADAPTIVE,
+                                       .rates = SNDRV_PCM_RATE_44100 |
+                                                SNDRV_PCM_RATE_48000,
+                                       .rate_min = 44100,
+                                       .rate_max = 48000,
+                                       .nr_rates = 2,
+                                       .rate_table = (unsigned int[]) {
+                                               44100, 48000
+                                       }
+                               }
+                       },
+                       {
+                               .ifnum = -1
+                       }
+               }
+       }
+},
+
 {
        /*
         * Some USB MIDI devices don't have an audio control interface,