Ignore:
Timestamp:
Jul 14, 2007, 7:13:46 AM (18 years ago)
Author:
Brendan Oakley
Message:

Merged to Alsa 0.9.0rc5

Location:
GPL/branches/alsa-resync1/alsa-kernel/pci
Files:
10 added
12 edited
1 moved

Legend:

Unmodified
Added
Removed
  • GPL/branches/alsa-resync1/alsa-kernel/pci/cs4281.c

    r210 r212  
    21522152#ifndef MODULE
    21532153
    2154 /* format is: snd-cs4281=snd_enable,snd_index,snd_id */
     2154/* format is: snd-cs4281=enable,index,id */
    21552155
    21562156static int __init alsa_card_cs4281_setup(char *str)
  • GPL/branches/alsa-resync1/alsa-kernel/pci/es1968.c

    r210 r212  
    13291329
    13301330static snd_pcm_hardware_t snd_es1968_playback = {
    1331     /*  info:             */    (SNDRV_PCM_INFO_MMAP |
     1331        .info =                 (SNDRV_PCM_INFO_MMAP |
    13321332                                 SNDRV_PCM_INFO_MMAP_VALID |
    13331333                                 SNDRV_PCM_INFO_INTERLEAVED |
     
    13351335                                 /*SNDRV_PCM_INFO_PAUSE |*/
    13361336                                 SNDRV_PCM_INFO_RESUME),
    1337                                  /*     formats:          */    SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE,
    1338                                  /*     rates:            */    SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_48000,
    1339                                  /*     rate_min:         */    4000,
    1340                                  /*     rate_max:         */    48000,
    1341                                  /*     channels_min:     */    1,
    1342                                  /*     channels_max:     */    2,
    1343                                  /*     buffer_bytes_max: */    65536,
    1344                                  /*     period_bytes_min: */    256,
    1345                                  /*     period_bytes_max: */    65536,
    1346                                  /*     periods_min:      */    1,
    1347                                  /*     periods_max:      */    1024,
    1348                                  /*     fifo_size:        */    0,
     1337        .formats =              SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE,
     1338        .rates =                SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_48000,
     1339        .rate_min =             4000,
     1340        .rate_max =             48000,
     1341        .channels_min =         1,
     1342        .channels_max =         2,
     1343        .buffer_bytes_max =     65536,
     1344        .period_bytes_min =     256,
     1345        .period_bytes_max =     65536,
     1346        .periods_min =          1,
     1347        .periods_max =          1024,
     1348        .fifo_size =            0,
    13491349};
    13501350
    13511351static snd_pcm_hardware_t snd_es1968_capture = {
    1352     /*  info:             */    (SNDRV_PCM_INFO_NONINTERLEAVED |
     1352        .info =                 (SNDRV_PCM_INFO_NONINTERLEAVED |
    13531353                                 SNDRV_PCM_INFO_MMAP |
    13541354                                 SNDRV_PCM_INFO_MMAP_VALID |
     
    13561356                                 /*SNDRV_PCM_INFO_PAUSE |*/
    13571357                                 SNDRV_PCM_INFO_RESUME),
    1358                                  /*     formats:          */    /*SNDRV_PCM_FMTBIT_U8 |*/ SNDRV_PCM_FMTBIT_S16_LE,
    1359                                  /*     rates:            */    SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_48000,
    1360                                  /*     rate_min:         */    4000,
    1361                                  /*     rate_max:         */    48000,
    1362                                  /*     channels_min:     */    1,
    1363                                  /*     channels_max:     */    2,
    1364                                  /*     buffer_bytes_max: */    65536,
    1365                                  /*     period_bytes_min: */    256,
    1366                                  /*     period_bytes_max: */    65536,
    1367                                  /*     periods_min:      */    1,
    1368                                  /*     periods_max:      */    1024,
    1369                                  /*     fifo_size:        */    0,
     1358        .formats =              /*SNDRV_PCM_FMTBIT_U8 |*/ SNDRV_PCM_FMTBIT_S16_LE,
     1359        .rates =                SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_48000,
     1360        .rate_min =             4000,
     1361        .rate_max =             48000,
     1362        .channels_min =         1,
     1363        .channels_max =         2,
     1364        .buffer_bytes_max =     65536,
     1365        .period_bytes_min =     256,
     1366        .period_bytes_max =     65536,
     1367        .periods_min =          1,
     1368        .periods_max =          1024,
     1369        .fifo_size =            0,
    13701370};
    13711371
  • GPL/branches/alsa-resync1/alsa-kernel/pci/ice1712/ice1712.c

    r211 r212  
    2626*/
    2727
     28/*
     29 * Changes:
     30 *
     31 *  2002.09.09  Takashi Iwai <tiwai@suse.de>
     32 *      split the code to several files.  each low-level routine
     33 *      is stored in the local file and called from registration
     34 *      function from card_info struct.
     35 */
     36
     37
    2838#include <sound/driver.h>
    2939#include <asm/io.h>
     
    3444#include <linux/slab.h>
    3545#include <sound/core.h>
    36 #include <sound/control.h>
    37 #include <sound/pcm.h>
    38 #include <sound/ac97_codec.h>
    39 #include <sound/mpu401.h>
    40 #include <sound/i2c.h>
    4146#include <sound/cs8427.h>
    4247#include <sound/info.h>
     48#include <sound/mpu401.h>
    4349#define SNDRV_GET_ID
    4450#include <sound/initval.h>
     
    4652#include <sound/asoundef.h>
    4753
    48 #define SND_CS8403
    49 #define SND_CS8404
    50 #include <sound/cs8403.h>
     54#include "ice1712.h"
     55
     56/* lowlevel routines */
     57#include "delta.h"
     58#include "ews.h"
     59#include "hoontech.h"
    5160
    5261MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>");
     
    5463MODULE_LICENSE("GPL");
    5564MODULE_CLASSES("{sound}");
    56 MODULE_DEVICES("{{Hoontech SoundTrack DSP 24},"
    57                 "{MidiMan M Audio,Delta 1010},"
    58                 "{MidiMan M Audio,Delta DiO 2496},"
    59                 "{MidiMan M Audio,Delta 66},"
    60                 "{MidiMan M Audio,Delta 44},"
    61                 "{MidiMan M Audio,Audiophile 24/96},"
    62                 "{TerraTec,EWX 24/96},"
    63                 "{TerraTec,EWS 88MT},"
    64                 "{TerraTec,EWS 88D},"
    65                 "{TerraTec,DMX 6Fire},"
     65MODULE_DEVICES("{"
     66               HOONTECH_DEVICE_DESC
     67               DELTA_DEVICE_DESC
     68               EWS_DEVICE_DESC
    6669                "{ICEnsemble,Generic ICE1712},"
    6770                "{ICEnsemble,Generic Envy24}}");
    6871
    69 static int snd_index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;  /* Index 0-MAX */
    70 static char *snd_id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;   /* ID for this card */
    71 static int snd_enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;          /* Enable this card */
    72 static int snd_omni[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)] = 0};       /* Delta44 & 66 Omni I/O support */
    73 
    74 MODULE_PARM(snd_index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
    75 MODULE_PARM_DESC(snd_index, "Index value for ICE1712 soundcard.");
    76 MODULE_PARM_SYNTAX(snd_index, SNDRV_INDEX_DESC);
    77 MODULE_PARM(snd_id, "1-" __MODULE_STRING(SNDRV_CARDS) "s");
    78 MODULE_PARM_DESC(snd_id, "ID string for ICE1712 soundcard.");
    79 MODULE_PARM_SYNTAX(snd_id, SNDRV_ID_DESC);
    80 MODULE_PARM(snd_enable, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
    81 MODULE_PARM_DESC(snd_enable, "Enable ICE1712 soundcard.");
    82 MODULE_PARM_SYNTAX(snd_enable, SNDRV_ENABLE_DESC);
    83 MODULE_PARM(snd_omni, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
    84 MODULE_PARM_DESC(snd_omni, "Enable Midiman M-Audio Delta Omni I/O support.");
    85 MODULE_PARM_SYNTAX(snd_omni, SNDRV_ENABLED "," SNDRV_ENABLE_DESC);
     72static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;      /* Index 0-MAX */
     73static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;       /* ID for this card */
     74static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;              /* Enable this card */
     75static int omni[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)] = 0};   /* Delta44 & 66 Omni I/O support */
     76
     77MODULE_PARM(index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
     78MODULE_PARM_DESC(index, "Index value for ICE1712 soundcard.");
     79MODULE_PARM_SYNTAX(index, SNDRV_INDEX_DESC);
     80MODULE_PARM(id, "1-" __MODULE_STRING(SNDRV_CARDS) "s");
     81MODULE_PARM_DESC(id, "ID string for ICE1712 soundcard.");
     82MODULE_PARM_SYNTAX(id, SNDRV_ID_DESC);
     83MODULE_PARM(enable, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
     84MODULE_PARM_DESC(enable, "Enable ICE1712 soundcard.");
     85MODULE_PARM_SYNTAX(enable, SNDRV_ENABLE_DESC);
     86MODULE_PARM(omni, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
     87MODULE_PARM_DESC(omni, "Enable Midiman M-Audio Delta Omni I/O support.");
     88MODULE_PARM_SYNTAX(omni, SNDRV_ENABLED "," SNDRV_ENABLE_DESC);
    8689
    8790#ifndef PCI_VENDOR_ID_ICE
     
    9295#endif
    9396
    94 #define ICE1712_SUBDEVICE_STDSP24       0x12141217      /* Hoontech SoundTrack Audio DSP 24 */
    95 #define ICE1712_SUBDEVICE_DELTA1010     0x121430d6
    96 #define ICE1712_SUBDEVICE_DELTADIO2496  0x121431d6
    97 #define ICE1712_SUBDEVICE_DELTA66       0x121432d6
    98 #define ICE1712_SUBDEVICE_DELTA44       0x121433d6
    99 #define ICE1712_SUBDEVICE_AUDIOPHILE    0x121434d6
    100 #define ICE1712_SUBDEVICE_DELTA1010LT   0x12143bd6
    101 #define ICE1712_SUBDEVICE_EWX2496       0x3b153011
    102 #define ICE1712_SUBDEVICE_EWS88MT       0x3b151511
    103 #define ICE1712_SUBDEVICE_EWS88D        0x3b152b11
    104 #define ICE1712_SUBDEVICE_DMX6FIRE      0x3b153811
    105 
    106 /*
    107  *  Direct registers
    108  */
    109 
    110 #define ICEREG(ice, x) ((ice)->port + ICE1712_REG_##x)
    111 
    112 #define ICE1712_REG_CONTROL             0x00    /* byte */
    113 #define   ICE1712_RESET                 0x80    /* reset whole chip */
    114 #define   ICE1712_SERR_LEVEL            0x04    /* SERR# level otherwise edge */
    115 #define   ICE1712_NATIVE                0x01    /* native mode otherwise SB */
    116 #define ICE1712_REG_IRQMASK             0x01    /* byte */
    117 #define   ICE1712_IRQ_MPU1              0x80
    118 #define   ICE1712_IRQ_TIMER             0x40
    119 #define   ICE1712_IRQ_MPU2              0x20
    120 #define   ICE1712_IRQ_PROPCM            0x10
    121 #define   ICE1712_IRQ_FM                0x08    /* FM/MIDI - legacy */
    122 #define   ICE1712_IRQ_PBKDS             0x04    /* playback DS channels */
    123 #define   ICE1712_IRQ_CONCAP            0x02    /* consumer capture */
    124 #define   ICE1712_IRQ_CONPBK            0x01    /* consumer playback */
    125 #define ICE1712_REG_IRQSTAT             0x02    /* byte */
    126 /* look to ICE1712_IRQ_* */
    127 #define ICE1712_REG_INDEX               0x03    /* byte - indirect CCIxx regs */
    128 #define ICE1712_REG_DATA                0x04    /* byte - indirect CCIxx regs */
    129 #define ICE1712_REG_NMI_STAT1           0x05    /* byte */
    130 #define ICE1712_REG_NMI_DATA            0x06    /* byte */
    131 #define ICE1712_REG_NMI_INDEX           0x07    /* byte */
    132 #define ICE1712_REG_AC97_INDEX          0x08    /* byte */
    133 #define ICE1712_REG_AC97_CMD            0x09    /* byte */
    134 #define   ICE1712_AC97_COLD             0x80    /* cold reset */
    135 #define   ICE1712_AC97_WARM             0x40    /* warm reset */
    136 #define   ICE1712_AC97_WRITE            0x20    /* W: write, R: write in progress */
    137 #define   ICE1712_AC97_READ             0x10    /* W: read, R: read in progress */
    138 #define   ICE1712_AC97_READY            0x08    /* codec ready status bit */
    139 #define   ICE1712_AC97_PBK_VSR          0x02    /* playback VSR */
    140 #define   ICE1712_AC97_CAP_VSR          0x01    /* capture VSR */
    141 #define ICE1712_REG_AC97_DATA           0x0a    /* word (little endian) */
    142 #define ICE1712_REG_MPU1_CTRL           0x0c    /* byte */
    143 #define ICE1712_REG_MPU1_DATA           0x0d    /* byte */
    144 #define ICE1712_REG_I2C_DEV_ADDR        0x10    /* byte */
    145 #define   ICE1712_I2C_WRITE             0x01    /* write direction */
    146 #define ICE1712_REG_I2C_BYTE_ADDR       0x11    /* byte */
    147 #define ICE1712_REG_I2C_DATA            0x12    /* byte */
    148 #define ICE1712_REG_I2C_CTRL            0x13    /* byte */
    149 #define   ICE1712_I2C_EEPROM            0x80    /* EEPROM exists */
    150 #define   ICE1712_I2C_BUSY              0x01    /* busy bit */
    151 #define ICE1712_REG_CONCAP_ADDR         0x14    /* dword - consumer capture */
    152 #define ICE1712_REG_CONCAP_COUNT        0x18    /* word - current/base count */
    153 #define ICE1712_REG_SERR_SHADOW         0x1b    /* byte */
    154 #define ICE1712_REG_MPU2_CTRL           0x1c    /* byte */
    155 #define ICE1712_REG_MPU2_DATA           0x1d    /* byte */
    156 #define ICE1712_REG_TIMER               0x1e    /* word */
    157 
    158 /*
    159  *  Indirect registers
    160  */
    161 
    162 #define ICE1712_IREG_PBK_COUNT_HI       0x00
    163 #define ICE1712_IREG_PBK_COUNT_LO       0x01
    164 #define ICE1712_IREG_PBK_CTRL           0x02
    165 #define ICE1712_IREG_PBK_LEFT           0x03    /* left volume */
    166 #define ICE1712_IREG_PBK_RIGHT          0x04    /* right volume */
    167 #define ICE1712_IREG_PBK_SOFT           0x05    /* soft volume */
    168 #define ICE1712_IREG_PBK_RATE_LO        0x06
    169 #define ICE1712_IREG_PBK_RATE_MID       0x07
    170 #define ICE1712_IREG_PBK_RATE_HI        0x08
    171 #define ICE1712_IREG_CAP_COUNT_HI       0x10
    172 #define ICE1712_IREG_CAP_COUNT_LO       0x11
    173 #define ICE1712_IREG_CAP_CTRL           0x12
    174 #define ICE1712_IREG_GPIO_DATA          0x20
    175 #define ICE1712_IREG_GPIO_WRITE_MASK    0x21
    176 #define ICE1712_IREG_GPIO_DIRECTION     0x22
    177 #define ICE1712_IREG_CONSUMER_POWERDOWN 0x30
    178 #define ICE1712_IREG_PRO_POWERDOWN      0x31
    179 
    180 /*
    181  *  Consumer section direct DMA registers
    182  */
    183 
    184 #define ICEDS(ice, x) ((ice)->dmapath_port + ICE1712_DS_##x)
    185  
    186 #define ICE1712_DS_INTMASK              0x00    /* word - interrupt mask */
    187 #define ICE1712_DS_INTSTAT              0x02    /* word - interrupt status */
    188 #define ICE1712_DS_DATA                 0x04    /* dword - channel data */
    189 #define ICE1712_DS_INDEX                0x08    /* dword - channel index */
    190 
    191 /*
    192  *  Consumer section channel registers
    193  */
    194  
    195 #define ICE1712_DSC_ADDR0               0x00    /* dword - base address 0 */
    196 #define ICE1712_DSC_COUNT0              0x01    /* word - count 0 */
    197 #define ICE1712_DSC_ADDR1               0x02    /* dword - base address 1 */
    198 #define ICE1712_DSC_COUNT1              0x03    /* word - count 1 */
    199 #define ICE1712_DSC_CONTROL             0x04    /* byte - control & status */
    200 #define   ICE1712_BUFFER1               0x80    /* buffer1 is active */
    201 #define   ICE1712_BUFFER1_AUTO          0x40    /* buffer1 auto init */
    202 #define   ICE1712_BUFFER0_AUTO          0x20    /* buffer0 auto init */
    203 #define   ICE1712_FLUSH                 0x10    /* flush FIFO */
    204 #define   ICE1712_STEREO                0x08    /* stereo */
    205 #define   ICE1712_16BIT                 0x04    /* 16-bit data */
    206 #define   ICE1712_PAUSE                 0x02    /* pause */
    207 #define   ICE1712_START                 0x01    /* start */
    208 #define ICE1712_DSC_RATE                0x05    /* dword - rate */
    209 #define ICE1712_DSC_VOLUME              0x06    /* word - volume control */
    210 
    211 /*
    212  *  Professional multi-track direct control registers
    213  */
    214 
    215 #define ICEMT(ice, x) ((ice)->profi_port + ICE1712_MT_##x)
    216 
    217 #define ICE1712_MT_IRQ                  0x00    /* byte - interrupt mask */
    218 #define   ICE1712_MULTI_CAPTURE         0x80    /* capture IRQ */
    219 #define   ICE1712_MULTI_PLAYBACK        0x40    /* playback IRQ */
    220 #define   ICE1712_MULTI_CAPSTATUS       0x02    /* capture IRQ status */
    221 #define   ICE1712_MULTI_PBKSTATUS       0x01    /* playback IRQ status */
    222 #define ICE1712_MT_RATE                 0x01    /* byte - sampling rate select */
    223 #define   ICE1712_SPDIF_MASTER          0x10    /* S/PDIF input is master clock */
    224 #define ICE1712_MT_I2S_FORMAT           0x02    /* byte - I2S data format */
    225 #define ICE1712_MT_AC97_INDEX           0x04    /* byte - AC'97 index */
    226 #define ICE1712_MT_AC97_CMD             0x05    /* byte - AC'97 command & status */
    227 /* look to ICE1712_AC97_* */
    228 #define ICE1712_MT_AC97_DATA            0x06    /* word - AC'97 data */
    229 #define ICE1712_MT_PLAYBACK_ADDR        0x10    /* dword - playback address */
    230 #define ICE1712_MT_PLAYBACK_SIZE        0x14    /* word - playback size */
    231 #define ICE1712_MT_PLAYBACK_COUNT       0x16    /* word - playback count */
    232 #define ICE1712_MT_PLAYBACK_CONTROL     0x18    /* byte - control */
    233 #define   ICE1712_CAPTURE_START_SHADOW  0x04    /* capture start */
    234 #define   ICE1712_PLAYBACK_PAUSE        0x02    /* playback pause */
    235 #define   ICE1712_PLAYBACK_START        0x01    /* playback start */
    236 #define ICE1712_MT_CAPTURE_ADDR         0x20    /* dword - capture address */
    237 #define ICE1712_MT_CAPTURE_SIZE         0x24    /* word - capture size */
    238 #define ICE1712_MT_CAPTURE_COUNT        0x26    /* word - capture count */
    239 #define ICE1712_MT_CAPTURE_CONTROL      0x28    /* byte - control */
    240 #define   ICE1712_CAPTURE_START         0x01    /* capture start */
    241 #define ICE1712_MT_ROUTE_PSDOUT03       0x30    /* word */
    242 #define ICE1712_MT_ROUTE_SPDOUT         0x32    /* word */
    243 #define ICE1712_MT_ROUTE_CAPTURE        0x34    /* dword */
    244 #define ICE1712_MT_MONITOR_VOLUME       0x38    /* word */
    245 #define ICE1712_MT_MONITOR_INDEX        0x3a    /* byte */
    246 #define ICE1712_MT_MONITOR_RATE         0x3b    /* byte */
    247 #define ICE1712_MT_MONITOR_ROUTECTRL    0x3c    /* byte */
    248 #define   ICE1712_ROUTE_AC97            0x01    /* route digital mixer output to AC'97 */
    249 #define ICE1712_MT_MONITOR_PEAKINDEX    0x3e    /* byte */
    250 #define ICE1712_MT_MONITOR_PEAKDATA     0x3f    /* byte */
    251 
    252 /*
    253  *  Codec configuration bits
    254  */
    255 
    256 /* PCI[60] System Configuration */
    257 #define ICE1712_CFG_CLOCK       0xc0
    258 #define   ICE1712_CFG_CLOCK512  0x00    /* 22.5692Mhz, 44.1kHz*512 */
    259 #define   ICE1712_CFG_CLOCK384  0x40    /* 16.9344Mhz, 44.1kHz*384 */
    260 #define   ICE1712_CFG_EXT       0x80    /* external clock */
    261 #define ICE1712_CFG_2xMPU401    0x20    /* two MPU401 UARTs */
    262 #define ICE1712_CFG_NO_CON_AC97 0x10    /* consumer AC'97 codec is not present */
    263 #define ICE1712_CFG_ADC_MASK    0x0c    /* one, two, three, four stereo ADCs */
    264 #define ICE1712_CFG_DAC_MASK    0x03    /* one, two, three, four stereo DACs */
    265 /* PCI[61] AC-Link Configuration */
    266 #define ICE1712_CFG_PRO_I2S     0x80    /* multitrack converter: I2S or AC'97 */
    267 #define ICE1712_CFG_AC97_PACKED 0x01    /* split or packed mode - AC'97 */
    268 /* PCI[62] I2S Features */
    269 #define ICE1712_CFG_I2S_VOLUME  0x80    /* volume/mute capability */
    270 #define ICE1712_CFG_I2S_96KHZ   0x40    /* supports 96kHz sampling */
    271 #define ICE1712_CFG_I2S_RESMASK 0x30    /* resolution mask, 16,18,20,24-bit */
    272 #define ICE1712_CFG_I2S_OTHER   0x0f    /* other I2S IDs */
    273 /* PCI[63] S/PDIF Configuration */
    274 #define ICE1712_CFG_I2S_CHIPID  0xfc    /* I2S chip ID */
    275 #define ICE1712_CFG_SPDIF_IN    0x02    /* S/PDIF input is present */
    276 #define ICE1712_CFG_SPDIF_OUT   0x01    /* S/PDIF output is present */
    277 
    278 /*
    279  *  MidiMan M-Audio Delta GPIO definitions
    280  */
    281 
    282 /* MidiMan M-Audio Delta1010 */
    283 #define ICE1712_DELTA_DFS 0x01          /* fast/slow sample rate mode */
    284                                         /* (>48kHz must be 1) */
    285 #define ICE1712_DELTA_SPDIF_IN_STAT 0x02
    286                                         /* S/PDIF input status */
    287                                         /* 0 = valid signal is present */
    288                                         /* all except Delta44 */
    289                                         /* look to CS8414 datasheet */
    290 #define ICE1712_DELTA_SPDIF_OUT_STAT_CLOCK 0x04
    291                                         /* S/PDIF output status clock */
    292                                         /* (writting on rising edge - 0->1) */
    293                                         /* all except Delta44 */
    294                                         /* look to CS8404A datasheet */
    295 #define ICE1712_DELTA_SPDIF_OUT_STAT_DATA 0x08
    296                                         /* S/PDIF output status data */
    297                                         /* all except Delta44 */
    298                                         /* look to CS8404A datasheet */
    299 /* MidiMan M-Audio DeltaDiO */
    300 /* 0x01 = DFS */
    301 /* 0x02 = SPDIF_IN_STAT */
    302 /* 0x04 = SPDIF_OUT_STAT_CLOCK */
    303 /* 0x08 = SPDIF_OUT_STAT_DATA */
    304 #define ICE1712_DELTA_SPDIF_INPUT_SELECT 0x10
    305                                         /* coaxial (0), optical (1) */
    306                                         /* S/PDIF input select*/
    307 
    308 /* MidiMan M-Audio Delta1010 */
    309 /* 0x01 = DFS */
    310 /* 0x02 = SPDIF_IN_STAT */
    311 /* 0x04 = SPDIF_OUT_STAT_CLOCK */
    312 /* 0x08 = SPDIF_OUT_STAT_DATA */
    313 #define ICE1712_DELTA_WORD_CLOCK_SELECT 0x10
    314                                         /* 1 - clock are taken from S/PDIF input */
    315                                         /* 0 - clock are taken from Word Clock input */
    316                                         /* affected SPMCLKIN pin of Envy24 */
    317 #define ICE1712_DELTA_WORD_CLOCK_STATUS 0x20
    318                                         /* 0 = valid word clock signal is present */
    319 
    320 /* MidiMan M-Audio Delta66 */
    321 /* 0x01 = DFS */
    322 /* 0x02 = SPDIF_IN_STAT */
    323 /* 0x04 = SPDIF_OUT_STAT_CLOCK */
    324 /* 0x08 = SPDIF_OUT_STAT_DATA */
    325 #define ICE1712_DELTA_CODEC_SERIAL_DATA 0x10
    326                                         /* AKM4524 serial data */
    327 #define ICE1712_DELTA_CODEC_SERIAL_CLOCK 0x20
    328                                         /* AKM4524 serial clock */
    329                                         /* (writting on rising edge - 0->1 */
    330 #define ICE1712_DELTA_CODEC_CHIP_A      0x40
    331 #define ICE1712_DELTA_CODEC_CHIP_B      0x80
    332                                         /* 1 - select chip A or B */
    333 
    334 /* MidiMan M-Audio Delta44 */
    335 /* 0x01 = DFS */
    336 /* 0x10 = CODEC_SERIAL_DATA */
    337 /* 0x20 = CODEC_SERIAL_CLOCK */
    338 /* 0x40 = CODEC_CHIP_A */
    339 /* 0x80 = CODEC_CHIP_B */
    340 
    341 /* MidiMan M-Audio Audiophile definitions */
    342 /* 0x01 = DFS */
    343 #define ICE1712_DELTA_AP_CCLK   0x02    /* SPI clock */
    344                                         /* (clocking on rising edge - 0->1) */
    345 #define ICE1712_DELTA_AP_DIN    0x04    /* data input */
    346 #define ICE1712_DELTA_AP_DOUT   0x08    /* data output */
    347 #define ICE1712_DELTA_AP_CS_DIGITAL 0x10 /* CS8427 chip select */
    348                                         /* low signal = select */
    349 #define ICE1712_DELTA_AP_CS_CODEC 0x20  /* AK4528 chip select */
    350                                         /* low signal = select */
    351 
    352 /* Hoontech SoundTrack Audio DSP 24 GPIO definitions */
    353 
    354 #define ICE1712_STDSP24_0_BOX(r, x)     r[0] = ((r[0] & ~3) | ((x)&3))
    355 #define ICE1712_STDSP24_0_DAREAR(r, x)  r[0] = ((r[0] & ~4) | (((x)&1)<<2))
    356 #define ICE1712_STDSP24_1_CHN1(r, x)    r[1] = ((r[1] & ~1) | ((x)&1))
    357 #define ICE1712_STDSP24_1_CHN2(r, x)    r[1] = ((r[1] & ~2) | (((x)&1)<<1))
    358 #define ICE1712_STDSP24_1_CHN3(r, x)    r[1] = ((r[1] & ~4) | (((x)&1)<<2))
    359 #define ICE1712_STDSP24_2_CHN4(r, x)    r[2] = ((r[2] & ~1) | ((x)&1))
    360 #define ICE1712_STDSP24_2_MIDIIN(r, x)  r[2] = ((r[2] & ~2) | (((x)&1)<<1))
    361 #define ICE1712_STDSP24_2_MIDI1(r, x)   r[2] = ((r[2] & ~4) | (((x)&1)<<2))
    362 #define ICE1712_STDSP24_3_MIDI2(r, x)   r[3] = ((r[3] & ~1) | ((x)&1))
    363 #define ICE1712_STDSP24_3_MUTE(r, x)    r[3] = ((r[3] & ~2) | (((x)&1)<<1))
    364 #define ICE1712_STDSP24_3_INSEL(r, x)   r[3] = ((r[3] & ~4) | (((x)&1)<<2))
    365 #define ICE1712_STDSP24_SET_ADDR(r, a)  r[a&3] = ((r[a&3] & ~0x18) | (((a)&3)<<3))
    366 #define ICE1712_STDSP24_CLOCK(r, a, c)  r[a&3] = ((r[a&3] & ~0x20) | (((c)&1)<<5))
    367 #define ICE1712_STDSP24_CLOCK_BIT       (1<<5)
    368 
    369 /* Hoontech SoundTrack Audio DSP 24 box configuration definitions */
    370 
    371 #define ICE1712_STDSP24_DAREAR          (1<<0)
    372 #define ICE1712_STDSP24_MUTE            (1<<1)
    373 #define ICE1712_STDSP24_INSEL           (1<<2)
    374 
    375 #define ICE1712_STDSP24_BOX_CHN1        (1<<0)  /* input channel 1 */
    376 #define ICE1712_STDSP24_BOX_CHN2        (1<<1)  /* input channel 2 */
    377 #define ICE1712_STDSP24_BOX_CHN3        (1<<2)  /* input channel 3 */
    378 #define ICE1712_STDSP24_BOX_CHN4        (1<<3)  /* input channel 4 */
    379 #define ICE1712_STDSP24_BOX_MIDI1       (1<<8)
    380 #define ICE1712_STDSP24_BOX_MIDI2       (1<<9)
    381 
    382 /* TerraTec EWX 24/96 configuration definitions */
    383 
    384 #define ICE1712_EWX2496_AK4524_CS       0x01    /* AK4524 chip select; low = active */
    385 #define ICE1712_EWX2496_AIN_SEL         0x02    /* input sensitivity switch; high = louder */
    386 #define ICE1712_EWX2496_AOUT_SEL        0x04    /* output sensitivity switch; high = louder */
    387 #define ICE1712_EWX2496_RW              0x08    /* read/write switch for i2c; high = write  */
    388 #define ICE1712_EWX2496_SERIAL_DATA     0x10    /* i2c & ak4524 data */
    389 #define ICE1712_EWX2496_SERIAL_CLOCK    0x20    /* i2c & ak4524 clock */
    390 #define ICE1712_EWX2496_TX2             0x40    /* MIDI2 (not used) */
    391 #define ICE1712_EWX2496_RX2             0x80    /* MIDI2 (not used) */
    392 
    393 /* TerraTec EWS 88MT/D configuration definitions */
    394 /* RW, SDA snd SCLK are identical with EWX24/96 */
    395 #define ICE1712_EWS88_CS8414_RATE       0x07    /* CS8414 sample rate: gpio 0-2 */
    396 #define ICE1712_EWS88_RW                0x08    /* read/write switch for i2c; high = write  */
    397 #define ICE1712_EWS88_SERIAL_DATA       0x10    /* i2c & ak4524 data */
    398 #define ICE1712_EWS88_SERIAL_CLOCK      0x20    /* i2c & ak4524 clock */
    399 #define ICE1712_EWS88_TX2               0x40    /* MIDI2 (only on 88D) */
    400 #define ICE1712_EWS88_RX2               0x80    /* MIDI2 (only on 88D) */
    401 
    402 /* i2c address */
    403 #define ICE1712_EWS88MT_CS8404_ADDR     (0x40>>1)
    404 #define ICE1712_EWS88MT_INPUT_ADDR      (0x46>>1)
    405 #define ICE1712_EWS88MT_OUTPUT_ADDR     (0x48>>1)
    406 #define ICE1712_EWS88MT_OUTPUT_SENSE    0x40    /* mask */
    407 #define ICE1712_EWS88D_PCF_ADDR         (0x40>>1)
    408 
    409 /* TerraTec DMX 6Fire configuration definitions */
    410 #define ICE1712_6FIRE_AK4524_CS_MASK    0x07    /* AK4524 chip select #1-#3 */
    411 #define ICE1712_6FIRE_RW                0x08    /* read/write switch for i2c; high = write  */
    412 #define ICE1712_6FIRE_SERIAL_DATA       0x10    /* i2c & ak4524 data */
    413 #define ICE1712_6FIRE_SERIAL_CLOCK      0x20    /* i2c & ak4524 clock */
    414 #define ICE1712_6FIRE_TX2               0x40    /* MIDI2 */
    415 #define ICE1712_6FIRE_RX2               0x80    /* MIDI2 */
    416 
    417 #define ICE1712_6FIRE_CS8427_ADDR       (0x22>>1) /* ?? */
    418 
    419 /*
    420  * DMA mode values
    421  * identical with DMA_XXX on i386 architecture.
    422  */
    423 #define ICE1712_DMA_MODE_WRITE          0x48
    424 #define ICE1712_DMA_AUTOINIT            0x10
    425 
    426 
    427 /*
    428  * 
    429  */
    430 
    431 typedef struct _snd_ice1712 ice1712_t;
    432 
    433 typedef struct {
    434         unsigned int subvendor; /* PCI[2c-2f] */
    435         unsigned char size;     /* size of EEPROM image in bytes */
    436         unsigned char version;  /* must be 1 */
    437         unsigned char codec;    /* codec configuration PCI[60] */
    438         unsigned char aclink;   /* ACLink configuration PCI[61] */
    439         unsigned char i2sID;    /* PCI[62] */
    440         unsigned char spdif;    /* S/PDIF configuration PCI[63] */
    441         unsigned char gpiomask; /* GPIO initial mask, 0 = write, 1 = don't */
    442         unsigned char gpiostate; /* GPIO initial state */
    443         unsigned char gpiodir;  /* GPIO direction state */
    444         unsigned short ac97main;
    445         unsigned short ac97pcm;
    446         unsigned short ac97rec;
    447         unsigned char ac97recsrc;
    448         unsigned char dacID[4]; /* I2S IDs for DACs */
    449         unsigned char adcID[4]; /* I2S IDs for ADCs */
    450         unsigned char extra[4];
    451 } ice1712_eeprom_t;
    452 
    453 struct _snd_ice1712 {
    454         unsigned long conp_dma_size;
    455         unsigned long conc_dma_size;
    456         unsigned long prop_dma_size;
    457         unsigned long proc_dma_size;
    458         int irq;
    459 
    460         unsigned long port;
    461         struct resource *res_port;
    462         unsigned long ddma_port;
    463         struct resource *res_ddma_port;
    464         unsigned long dmapath_port;
    465         struct resource *res_dmapath_port;
    466         unsigned long profi_port;
    467         struct resource *res_profi_port;
    468 
    469         unsigned int config;    /* system configuration */
    470 
    471         struct pci_dev *pci;
    472         snd_card_t *card;
    473         snd_pcm_t *pcm;
    474         snd_pcm_t *pcm_ds;
    475         snd_pcm_t *pcm_pro;
    476         snd_pcm_substream_t *playback_con_substream;
    477         snd_pcm_substream_t *playback_con_substream_ds[6];
    478         snd_pcm_substream_t *capture_con_substream;
    479         snd_pcm_substream_t *playback_pro_substream;
    480         snd_pcm_substream_t *capture_pro_substream;
    481         unsigned int playback_pro_size;
    482         unsigned int capture_pro_size;
    483         unsigned int playback_con_virt_addr[6];
    484         unsigned int playback_con_active_buf[6];
    485         unsigned int capture_con_virt_addr;
    486         unsigned int ac97_ext_id;
    487         ac97_t *ac97;
    488         snd_rawmidi_t *rmidi[2];
    489 
    490         spinlock_t reg_lock;
    491         struct semaphore gpio_mutex;
    492         snd_info_entry_t *proc_entry;
    493 
    494         ice1712_eeprom_t eeprom;
    495 
    496         unsigned int pro_volumes[20];
    497         int ak4528: 1,                  /* AK4524 or AK4528 */
    498             omni: 1;                    /* Delta Omni I/O */
    499         int num_adcs;                   /* AK4524 or AK4528 ADCs */
    500         int num_dacs;                   /* AK4524 or AK4528 DACs */
    501         int num_total_dacs;             /* total DACs */
    502         unsigned char ak4524_images[4][8];
    503         unsigned char ak4524_ipga_gain[4][2];
    504         unsigned char hoontech_boxbits[4];
    505         unsigned int hoontech_config;
    506         unsigned short hoontech_boxconfig[4];
    507 
    508         snd_i2c_bus_t *i2c;             /* I2C bus */
    509         snd_i2c_device_t *cs8404;       /* CS8404A I2C device */
    510         snd_i2c_device_t *cs8427;       /* CS8427 I2C device */
    511         snd_i2c_device_t *pcf8574[2];   /* PCF8574 Output/Input (EWS88MT) */
    512         snd_i2c_device_t *pcf8575;      /* PCF8575 (EWS88D) */
    513        
    514         unsigned char cs8403_spdif_bits;
    515         unsigned char cs8403_spdif_stream_bits;
    516         snd_kcontrol_t *spdif_stream_ctl;
    517 
    518         unsigned char gpio_direction, gpio_write_mask;
    519 };
    520 
    521 #define chip_t ice1712_t
    522 
    52397static struct pci_device_id snd_ice1712_ids[] __devinitdata = {
    52498        { PCI_VENDOR_ID_ICE, PCI_DEVICE_ID_ICE_1712, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, },   /* ICE1712 */
     
    534108 *  Basic I/O
    535109 */
    536  
    537 static inline void snd_ice1712_write(ice1712_t * ice, u8 addr, u8 data)
    538 {
    539         outb(addr, ICEREG(ice, INDEX));
    540         outb(data, ICEREG(ice, DATA));
    541 }
    542 
    543 static inline u8 snd_ice1712_read(ice1712_t * ice, u8 addr)
    544 {
    545         outb(addr, ICEREG(ice, INDEX));
    546         return inb(ICEREG(ice, DATA));
    547 }
    548110
    549111static inline void snd_ice1712_ds_write(ice1712_t * ice, u8 channel, u8 addr, u32 data)
     
    708270
    709271
    710 /*
    711  */
    712 
    713 static void snd_ice1712_delta_cs8403_spdif_write(ice1712_t *ice, unsigned char bits)
    714 {
    715         unsigned char tmp, mask1, mask2;
    716         int idx;
    717         /* send byte to transmitter */
    718         mask1 = ICE1712_DELTA_SPDIF_OUT_STAT_CLOCK;
    719         mask2 = ICE1712_DELTA_SPDIF_OUT_STAT_DATA;
    720         down(&ice->gpio_mutex);
    721         tmp = snd_ice1712_read(ice, ICE1712_IREG_GPIO_DATA);
    722         for (idx = 7; idx >= 0; idx--) {
    723                 tmp &= ~(mask1 | mask2);
    724                 if (bits & (1 << idx))
    725                         tmp |= mask2;
    726                 snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, tmp);
    727                 udelay(100);
    728                 tmp |= mask1;
    729                 snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, tmp);
    730                 udelay(100);
    731         }
    732         tmp &= ~mask1;
    733         snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, tmp);
    734         up(&ice->gpio_mutex);
    735 }
    736 
    737272
    738273/*
    739274 * set gpio direction, write mask and data
    740275 */
    741 static void snd_ice1712_gpio_write_bits(ice1712_t *ice, int mask, int bits)
     276void snd_ice1712_gpio_write_bits(ice1712_t *ice, int mask, int bits)
    742277{
    743278        ice->gpio_direction |= mask;
     
    749284/*
    750285 */
    751 static void save_gpio_status(ice1712_t *ice, unsigned char *tmp)
     286void snd_ice1712_save_gpio_status(ice1712_t *ice, unsigned char *tmp)
    752287{
    753288        down(&ice->gpio_mutex);
     
    756291}
    757292
    758 static void restore_gpio_status(ice1712_t *ice, unsigned char *tmp)
     293void snd_ice1712_restore_gpio_status(ice1712_t *ice, unsigned char *tmp)
    759294{
    760295        snd_ice1712_write(ice, ICE1712_IREG_GPIO_DIRECTION, tmp[0]);
     
    765300}
    766301
     302
    767303/*
    768  * CS8427 via SPI mode (for Audiophile), emulated I2C
     304 *
     305 * CS8427 interface
     306 *
    769307 */
    770 
    771 /* send 8 bits */
    772 static void ap_cs8427_write_byte(ice1712_t *ice, unsigned char data, unsigned char tmp)
    773 {
    774         int idx;
    775 
    776         for (idx = 7; idx >= 0; idx--) {
    777                 tmp &= ~(ICE1712_DELTA_AP_DOUT|ICE1712_DELTA_AP_CCLK);
    778                 if (data & (1 << idx))
    779                         tmp |= ICE1712_DELTA_AP_DOUT;
    780                 snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, tmp);
    781                 udelay(5);
    782                 tmp |= ICE1712_DELTA_AP_CCLK;
    783                 snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, tmp);
    784                 udelay(5);
    785         }
    786 }
    787 
    788 /* read 8 bits */
    789 static unsigned char ap_cs8427_read_byte(ice1712_t *ice, unsigned char tmp)
    790 {
    791         unsigned char data = 0;
    792         int idx;
    793        
    794         for (idx = 7; idx >= 0; idx--) {
    795                 tmp &= ~ICE1712_DELTA_AP_CCLK;
    796                 snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, tmp);
    797                 udelay(5);
    798                 if (snd_ice1712_read(ice, ICE1712_IREG_GPIO_DATA) & ICE1712_DELTA_AP_DIN)
    799                         data |= 1 << idx;
    800                 tmp |= ICE1712_DELTA_AP_CCLK;
    801                 snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, tmp);
    802                 udelay(5);
    803         }
    804         return data;
    805 }
    806 
    807 /* assert chip select */
    808 static unsigned char ap_cs8427_codec_select(ice1712_t *ice)
    809 {
    810         unsigned char tmp;
    811         tmp = snd_ice1712_read(ice, ICE1712_IREG_GPIO_DATA);
    812         tmp |= ICE1712_DELTA_AP_CCLK | ICE1712_DELTA_AP_CS_CODEC;
    813         tmp &= ~ICE1712_DELTA_AP_CS_DIGITAL;
    814         snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, tmp);
    815         udelay(5);
    816         return tmp;
    817 }
    818 
    819 /* deassert chip select */
    820 static void ap_cs8427_codec_deassert(ice1712_t *ice, unsigned char tmp)
    821 {
    822         tmp |= ICE1712_DELTA_AP_CS_DIGITAL;
    823         snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, tmp);
    824 }
    825 
    826 /* sequential write */
    827 static int ap_cs8427_sendbytes(snd_i2c_device_t *device, unsigned char *bytes, int count)
    828 {
    829         ice1712_t *ice = snd_magic_cast(ice1712_t, device->bus->private_data, return -EIO);
    830         int res = count;
    831         unsigned char tmp;
    832 
    833         down(&ice->gpio_mutex);
    834         tmp = ap_cs8427_codec_select(ice);
    835         ap_cs8427_write_byte(ice, (device->addr << 1) | 0, tmp); /* address + write mode */
    836         while (count-- > 0)
    837                 ap_cs8427_write_byte(ice, *bytes++, tmp);
    838         ap_cs8427_codec_deassert(ice, tmp);
    839         up(&ice->gpio_mutex);
    840         return res;
    841 }
    842 
    843 /* sequential read */
    844 static int ap_cs8427_readbytes(snd_i2c_device_t *device, unsigned char *bytes, int count)
    845 {
    846         ice1712_t *ice = snd_magic_cast(ice1712_t, device->bus->private_data, return -EIO);
    847         int res = count;
    848         unsigned char tmp;
    849 
    850         down(&ice->gpio_mutex);
    851         tmp = ap_cs8427_codec_select(ice);
    852         ap_cs8427_write_byte(ice, (device->addr << 1) | 1, tmp); /* address + read mode */
    853         while (count-- > 0)
    854                 *bytes++ = ap_cs8427_read_byte(ice, tmp);
    855         ap_cs8427_codec_deassert(ice, tmp);
    856         up(&ice->gpio_mutex);
    857         return res;
    858 }
    859 
    860 static int ap_cs8427_probeaddr(snd_i2c_bus_t *bus, unsigned short addr)
    861 {
    862         if (addr == 0x10)
    863                 return 1;
    864         return -ENOENT;
    865 }
    866 
    867 static snd_i2c_ops_t ap_cs8427_i2c_ops = {
    868         .sendbytes = ap_cs8427_sendbytes,
    869         .readbytes = ap_cs8427_readbytes,
    870         .probeaddr = ap_cs8427_probeaddr,
    871 };
    872 
    873 /*
    874  * access via i2c mode (for EWX 24/96, EWS 88MT&D)
    875  */
    876 
    877 /* send SDA and SCL */
    878 static void ewx_i2c_setlines(snd_i2c_bus_t *bus, int clk, int data)
    879 {
    880         ice1712_t *ice = snd_magic_cast(ice1712_t, bus->private_data, return);
    881         unsigned char tmp = 0;
    882         if (clk)
    883                 tmp |= ICE1712_EWX2496_SERIAL_CLOCK;
    884         if (data)
    885                 tmp |= ICE1712_EWX2496_SERIAL_DATA;
    886         snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, tmp);
    887         udelay(5);
    888 }
    889 
    890 static int ewx_i2c_getclock(snd_i2c_bus_t *bus)
    891 {
    892         ice1712_t *ice = snd_magic_cast(ice1712_t, bus->private_data, return -EIO);
    893         return snd_ice1712_read(ice, ICE1712_IREG_GPIO_DATA) & ICE1712_EWX2496_SERIAL_CLOCK ? 1 : 0;
    894 }
    895 
    896 static int ewx_i2c_getdata(snd_i2c_bus_t *bus, int ack)
    897 {
    898         ice1712_t *ice = snd_magic_cast(ice1712_t, bus->private_data, return -EIO);
    899         int bit;
    900         /* set RW pin to low */
    901         snd_ice1712_write(ice, ICE1712_IREG_GPIO_WRITE_MASK, ~ICE1712_EWX2496_RW);
    902         snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, 0);
    903         if (ack)
    904                 udelay(5);
    905         bit = snd_ice1712_read(ice, ICE1712_IREG_GPIO_DATA) & ICE1712_EWX2496_SERIAL_DATA ? 1 : 0;
    906         /* set RW pin to high */
    907         snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, ICE1712_EWX2496_RW);
    908         /* reset write mask */
    909         snd_ice1712_write(ice, ICE1712_IREG_GPIO_WRITE_MASK, ~ICE1712_EWX2496_SERIAL_CLOCK);
    910         return bit;
    911 }
    912 
    913 static void ewx_i2c_start(snd_i2c_bus_t *bus)
    914 {
    915         ice1712_t *ice = snd_magic_cast(ice1712_t, bus->private_data, return);
    916         unsigned char mask;
    917 
    918         save_gpio_status(ice, (unsigned char *)&bus->private_value);
    919         /* set RW high */
    920         mask = ICE1712_EWX2496_RW;
    921         switch (ice->eeprom.subvendor) {
    922         case ICE1712_SUBDEVICE_EWX2496:
    923                 mask |= ICE1712_EWX2496_AK4524_CS; /* CS high also */
    924                 break;
    925         case ICE1712_SUBDEVICE_DMX6FIRE:
    926                 mask |= ICE1712_6FIRE_AK4524_CS_MASK; /* CS high also */
    927                 break;
    928         }
    929         snd_ice1712_gpio_write_bits(ice, mask, mask);
    930 }
    931 
    932 static void ewx_i2c_stop(snd_i2c_bus_t *bus)
    933 {
    934         ice1712_t *ice = snd_magic_cast(ice1712_t, bus->private_data, return);
    935         restore_gpio_status(ice, (unsigned char *)&bus->private_value);
    936 }
    937 
    938 static void ewx_i2c_direction(snd_i2c_bus_t *bus, int clock, int data)
    939 {
    940         ice1712_t *ice = snd_magic_cast(ice1712_t, bus->private_data, return);
    941         unsigned char mask = 0;
    942 
    943         if (clock)
    944                 mask |= ICE1712_EWX2496_SERIAL_CLOCK; /* write SCL */
    945         if (data)
    946                 mask |= ICE1712_EWX2496_SERIAL_DATA; /* write SDA */
    947         ice->gpio_direction &= ~(ICE1712_EWX2496_SERIAL_CLOCK|ICE1712_EWX2496_SERIAL_DATA);
    948         ice->gpio_direction |= mask;
    949         snd_ice1712_write(ice, ICE1712_IREG_GPIO_DIRECTION, ice->gpio_direction);
    950         snd_ice1712_write(ice, ICE1712_IREG_GPIO_WRITE_MASK, ~mask);
    951 }
    952 
    953 static snd_i2c_bit_ops_t snd_ice1712_ewx_cs8427_bit_ops = {
    954         .start = ewx_i2c_start,
    955         .stop = ewx_i2c_stop,
    956         .direction = ewx_i2c_direction,
    957         .setlines = ewx_i2c_setlines,
    958         .getclock = ewx_i2c_getclock,
    959         .getdata = ewx_i2c_getdata,
    960 };
    961 
    962 /* AK4524 chip select; address 0x48 bit 0-3 */
    963 static int snd_ice1712_ews88mt_chip_select(ice1712_t *ice, int chip_mask)
    964 {
    965         unsigned char data, ndata;
    966 
    967         snd_assert(chip_mask >= 0 && chip_mask <= 0x0f, return -EINVAL);
    968         snd_i2c_lock(ice->i2c);
    969         if (snd_i2c_readbytes(ice->pcf8574[1], &data, 1) != 1)
    970                 goto __error;
    971         ndata = (data & 0xf0) | chip_mask;
    972         if (ndata != data)
    973                 if (snd_i2c_sendbytes(ice->pcf8574[1], &ndata, 1) != 1)
    974                         goto __error;
    975         snd_i2c_unlock(ice->i2c);
    976         return 0;
    977 
    978      __error:
    979         snd_i2c_unlock(ice->i2c);
    980         snd_printk(KERN_ERR "AK4524 chip select failed, check cable to the front module\n");
    981         return -EIO;
    982 }
    983 
    984 /*
    985  * write AK4524 register
    986  */
    987 static void snd_ice1712_ak4524_write(ice1712_t *ice, int chip,
    988                                      unsigned char addr, unsigned char data)
    989 {
    990         unsigned char tmp, data_mask, clk_mask, saved[2];
    991         unsigned char codecs_mask;
    992         int idx, cif;
    993         unsigned int addrdata;
    994 
    995         snd_assert(chip >= 0 && chip < 4, return);
    996 
    997         if (ice->eeprom.subvendor == ICE1712_SUBDEVICE_EWS88MT) {
    998                 /* assert AK4524 CS */
    999                 if (snd_ice1712_ews88mt_chip_select(ice, ~(1 << chip) & 0x0f) < 0)
    1000                         return;
    1001                 //snd_ice1712_ews88mt_chip_select(ice, 0x0f);
    1002         }
    1003 
    1004         cif = 0; /* the default level of the CIF pin from AK4524 */
    1005         save_gpio_status(ice, saved);
    1006         tmp = snd_ice1712_read(ice, ICE1712_IREG_GPIO_DATA);
    1007         switch (ice->eeprom.subvendor) {
    1008         case ICE1712_SUBDEVICE_AUDIOPHILE:
    1009                 data_mask = ICE1712_DELTA_AP_DOUT;
    1010                 clk_mask = ICE1712_DELTA_AP_CCLK;
    1011                 codecs_mask = ICE1712_DELTA_AP_CS_CODEC; /* select AK4528 codec */
    1012                 tmp |= ICE1712_DELTA_AP_CS_DIGITAL; /* assert digital high */
    1013                 break;
    1014         case ICE1712_SUBDEVICE_EWX2496:
    1015                 data_mask = ICE1712_EWX2496_SERIAL_DATA;
    1016                 clk_mask = ICE1712_EWX2496_SERIAL_CLOCK;
    1017                 codecs_mask = ICE1712_EWX2496_AK4524_CS;
    1018                 tmp |= ICE1712_EWX2496_RW; /* set rw bit high */
    1019                 snd_ice1712_write(ice, ICE1712_IREG_GPIO_DIRECTION,
    1020                                   ice->gpio_direction | data_mask | clk_mask |
    1021                                   codecs_mask | ICE1712_EWX2496_RW);
    1022                 snd_ice1712_write(ice, ICE1712_IREG_GPIO_WRITE_MASK,
    1023                                   ~(data_mask | clk_mask |
    1024                                     codecs_mask | ICE1712_EWX2496_RW));
    1025                 cif = 1; /* CIF high */
    1026                 break;
    1027         case ICE1712_SUBDEVICE_EWS88MT:
    1028                 data_mask = ICE1712_EWS88_SERIAL_DATA;
    1029                 clk_mask = ICE1712_EWS88_SERIAL_CLOCK;
    1030                 codecs_mask = 0; /* no chip select on gpio */
    1031                 tmp |= ICE1712_EWS88_RW; /* set rw bit high */
    1032                 snd_ice1712_write(ice, ICE1712_IREG_GPIO_DIRECTION,
    1033                                   ice->gpio_direction | data_mask | clk_mask |
    1034                                   codecs_mask | ICE1712_EWS88_RW);
    1035                 snd_ice1712_write(ice, ICE1712_IREG_GPIO_WRITE_MASK,
    1036                                   ~(data_mask | clk_mask |
    1037                                     codecs_mask | ICE1712_EWS88_RW));
    1038                 cif = 1; /* CIF high */
    1039                 break;
    1040         case ICE1712_SUBDEVICE_DMX6FIRE:
    1041                 data_mask = ICE1712_6FIRE_SERIAL_DATA;
    1042                 clk_mask = ICE1712_6FIRE_SERIAL_CLOCK;
    1043                 codecs_mask = (1 << chip) & ICE1712_6FIRE_AK4524_CS_MASK;
    1044                 tmp |= ICE1712_6FIRE_RW; /* set rw bit high */
    1045                 snd_ice1712_write(ice, ICE1712_IREG_GPIO_DIRECTION,
    1046                                   ice->gpio_direction | data_mask | clk_mask |
    1047                                   codecs_mask | ICE1712_6FIRE_RW);
    1048                 snd_ice1712_write(ice, ICE1712_IREG_GPIO_WRITE_MASK,
    1049                                   ~(data_mask | clk_mask |
    1050                                     codecs_mask | ICE1712_6FIRE_RW));
    1051                 cif = 1; /* CIF high */
    1052                 break;
    1053         default:
    1054                 data_mask = ICE1712_DELTA_CODEC_SERIAL_DATA;
    1055                 clk_mask = ICE1712_DELTA_CODEC_SERIAL_CLOCK;
    1056                 codecs_mask = chip == 0 ? ICE1712_DELTA_CODEC_CHIP_A : ICE1712_DELTA_CODEC_CHIP_B;
    1057                 break;
    1058         }
    1059 
    1060         if (cif) {
    1061                 tmp |= codecs_mask; /* start without chip select */
    1062         } else {
    1063                 tmp &= ~codecs_mask; /* chip select low */
    1064                 snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, tmp);
    1065                 udelay(1);
    1066         }
    1067 
    1068         addr &= 0x07;
    1069         /* build I2C address + data byte */
    1070         addrdata = 0xa000 | (addr << 8) | data;
    1071         for (idx = 15; idx >= 0; idx--) {
    1072                 tmp &= ~(data_mask|clk_mask);
    1073                 if (addrdata & (1 << idx))
    1074                         tmp |= data_mask;
    1075                 snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, tmp);
    1076                 //udelay(200);
    1077                 udelay(1);
    1078                 tmp |= clk_mask;
    1079                 snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, tmp);
    1080                 udelay(1);
    1081         }
    1082 
    1083         if (ice->eeprom.subvendor == ICE1712_SUBDEVICE_EWS88MT) {
    1084                 restore_gpio_status(ice, saved);
    1085                 //snd_ice1712_ews88mt_chip_select(ice, ~(1 << chip) & 0x0f);
    1086                 udelay(1);
    1087                 snd_ice1712_ews88mt_chip_select(ice, 0x0f);
    1088         } else {
    1089                 if (cif) {
    1090                         /* assert a cs pulse to trigger */
    1091                         tmp &= ~codecs_mask;
    1092                         snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, tmp);
    1093                         udelay(1);
    1094                 }
    1095                 tmp |= codecs_mask; /* chip select high to trigger */
    1096                 snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, tmp);
    1097                 udelay(1);
    1098                 restore_gpio_status(ice, saved);
    1099         }
    1100 
    1101         if ((addr != 0x04 && addr != 0x05) || (data & 0x80) == 0)
    1102         ice->ak4524_images[chip][addr] = data;
    1103         else
    1104                 ice->ak4524_ipga_gain[chip][addr-4] = data;
    1105 }
    1106 
    1107 static void snd_ice1712_ak4524_reset(ice1712_t *ice, int state)
    1108 {
    1109         int chip;
    1110         unsigned char reg;
    1111        
    1112         for (chip = 0; chip < ice->num_dacs/2; chip++) {
    1113                 snd_ice1712_ak4524_write(ice, chip, 0x01, state ? 0x00 : 0x03);
    1114                 if (state)
    1115                         continue;
    1116                 for (reg = 0x04; reg < (ice->ak4528 ? 0x06 : 0x08); reg++)
    1117                         snd_ice1712_ak4524_write(ice, chip, reg, ice->ak4524_images[chip][reg]);
    1118                 if (ice->ak4528)
    1119                         continue;
    1120                 for (reg = 0x04; reg < 0x06; reg++)
    1121                         snd_ice1712_ak4524_write(ice, chip, reg, ice->ak4524_ipga_gain[chip][reg-4]);
    1122         }
    1123 }
    1124 
    1125 static void snd_ice1712_ews_cs8404_spdif_write(ice1712_t *ice, unsigned char bits)
    1126 {
    1127         unsigned char bytes[2];
    1128 
    1129         snd_i2c_lock(ice->i2c);
    1130         switch (ice->eeprom.subvendor) {
    1131         case ICE1712_SUBDEVICE_EWS88MT:
    1132                 snd_runtime_check(snd_i2c_sendbytes(ice->cs8404, &bits, 1) == 1, snd_i2c_unlock(ice->i2c); return);
    1133                 break;
    1134         case ICE1712_SUBDEVICE_EWS88D:
    1135                 snd_runtime_check(snd_i2c_readbytes(ice->pcf8575, bytes, 2) == 2, snd_i2c_unlock(ice->i2c); return);
    1136                 if (bits != bytes[1]) {
    1137                         bytes[1] = bits;
    1138                         snd_runtime_check(snd_i2c_readbytes(ice->pcf8575, bytes, 2) == 2, snd_i2c_unlock(ice->i2c); return);
    1139                 }
    1140                 break;
    1141         }
    1142         snd_i2c_unlock(ice->i2c);
    1143 }
    1144 
    1145308
    1146309/*
     
    1181344
    1182345/*
     346 * spdif callbacks
    1183347 */
    1184 static void snd_ice1712_set_pro_rate(ice1712_t *ice, snd_pcm_substream_t *substream)
    1185 {
    1186         unsigned long flags;
    1187         unsigned int rate;
    1188         unsigned char val, tmp;
    1189 
    1190         spin_lock_irqsave(&ice->reg_lock, flags);
    1191         if (inb(ICEMT(ice, PLAYBACK_CONTROL)) & (ICE1712_CAPTURE_START_SHADOW|
    1192                                                  ICE1712_PLAYBACK_PAUSE|
    1193                                                  ICE1712_PLAYBACK_START))
    1194                 goto __end;
    1195         if (inb(ICEMT(ice, RATE)) & ICE1712_SPDIF_MASTER)
    1196                 goto __end;
    1197         rate = substream->runtime->rate;
    1198         switch (rate) {
    1199         case 8000: val = 6; break;
    1200         case 9600: val = 3; break;
    1201         case 11025: val = 10; break;
    1202         case 12000: val = 2; break;
    1203         case 16000: val = 5; break;
    1204         case 22050: val = 9; break;
    1205         case 24000: val = 1; break;
    1206         case 32000: val = 4; break;
    1207         case 44100: val = 8; break;
    1208         case 48000: val = 0; break;
    1209         case 64000: val = 15; break;
    1210         case 88200: val = 11; break;
    1211         case 96000: val = 7; break;
    1212         default:
    1213                 snd_BUG();
    1214                 val = 0;
    1215                 break;
    1216         }
    1217         outb(val, ICEMT(ice, RATE));
    1218         switch (ice->eeprom.subvendor) {
    1219         case ICE1712_SUBDEVICE_DELTA1010:
    1220         case ICE1712_SUBDEVICE_DELTA1010LT:     // check it --jk
    1221         case ICE1712_SUBDEVICE_DELTADIO2496:
    1222         case ICE1712_SUBDEVICE_DELTA66:
    1223         case ICE1712_SUBDEVICE_DELTA44:
    1224         case ICE1712_SUBDEVICE_AUDIOPHILE:
    1225                 spin_unlock_irqrestore(&ice->reg_lock, flags);
    1226                 snd_ice1712_ak4524_reset(ice, 1);
    1227                 down(&ice->gpio_mutex);
    1228                 tmp = snd_ice1712_read(ice, ICE1712_IREG_GPIO_DATA);
    1229                 if (val == 15 || val == 11 || val == 7) {
    1230                         tmp |= ICE1712_DELTA_DFS;
    1231                 } else {
    1232                         tmp &= ~ICE1712_DELTA_DFS;
    1233                 }
    1234                 snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, tmp);
    1235                 up(&ice->gpio_mutex);
    1236                 snd_ice1712_ak4524_reset(ice, 0);
    1237                 return;
    1238         }
    1239       __end:
    1240         spin_unlock_irqrestore(&ice->reg_lock, flags);
    1241 }
     348static void open_cs8427(ice1712_t *ice, snd_pcm_substream_t * substream)
     349{
     350        snd_cs8427_iec958_active(ice->cs8427, 1);
     351}
     352
     353static void close_cs8427(ice1712_t *ice, snd_pcm_substream_t * substream)
     354{
     355        snd_cs8427_iec958_active(ice->cs8427, 0);
     356}
     357
     358static void setup_cs8427(ice1712_t *ice, snd_pcm_substream_t * substream)
     359{
     360        snd_cs8427_iec958_pcm(ice->cs8427, substream->runtime->rate);
     361}
     362
     363/*
     364 * create and initialize callbacks for cs8427 interface
     365 */
     366int __devinit snd_ice1712_init_cs8427(ice1712_t *ice, int addr)
     367{
     368        int err;
     369
     370        if ((err = snd_cs8427_create(ice->i2c, addr, &ice->cs8427)) < 0) {
     371                snd_printk("CS8427 initialization failed\n");
     372                return err;
     373        }
     374        ice->spdif.ops.open = open_cs8427;
     375        ice->spdif.ops.close = close_cs8427;
     376        ice->spdif.ops.setup = setup_cs8427;
     377        return 0;
     378}
     379
    1242380
    1243381/*
     
    1311449}
    1312450
     451
    1313452/*
    1314453 *  PCM part - misc
     
    1629768        ice->capture_con_substream = substream;
    1630769        runtime->hw = snd_ice1712_capture;
    1631         runtime->hw.rates = ice->ac97->rates_adc;
     770        runtime->hw.rates = ice->ac97->rates[AC97_RATES_ADC];
    1632771        if (!(runtime->hw.rates & SNDRV_PCM_RATE_8000))
    1633772                runtime->hw.rate_min = 48000;
     
    1661800        ice1712_t *ice = snd_pcm_substream_chip(substream);
    1662801
    1663         /* disable ADC power */
    1664         snd_ac97_update_bits(ice->ac97, AC97_POWERDOWN, 0x0100, 0x0100);
    1665802        ice->capture_con_substream = NULL;
    1666803        return 0;
     
    1785922        .mask = 0,
    1786923};
    1787 
    1788 #if 0
    1789 
    1790 static int snd_ice1712_playback_pro_ioctl(snd_pcm_substream_t * substream,
    1791                                           unsigned int cmd,
    1792                                           void *arg)
    1793 {
    1794         ice1712_t *ice = snd_pcm_substream_chip(substream);
    1795 
    1796         switch (cmd) {
    1797         case SNDRV_PCM_IOCTL1_DIG_INFO:
    1798         {
    1799                 snd_pcm_dig_info_t *info = arg;
    1800                 switch (ice->eeprom.subvendor) {
    1801                 case ICE1712_SUBDEVICE_DELTA1010:
    1802                 case ICE1712_SUBDEVICE_DELTADIO2496:
    1803                 case ICE1712_SUBDEVICE_DELTA66:
    1804                         return snd_ice1712_dig_cs8403_info(substream, info);
    1805                 }
    1806         }
    1807         case SNDRV_PCM_IOCTL1_DIG_PARAMS:
    1808         {
    1809                 snd_pcm_dig_params_t *params = arg;
    1810                 switch (ice->eeprom.subvendor) {
    1811                 case ICE1712_SUBDEVICE_DELTA1010:
    1812                 case ICE1712_SUBDEVICE_DELTADIO2496:
    1813                 case ICE1712_SUBDEVICE_DELTA66:
    1814                         return snd_ice1712_dig_cs8403_params(substream, params);
    1815                 }
    1816         }
    1817         default:
    1818                 break;
    1819         }
    1820         return snd_pcm_lib_ioctl(substream, cmd, arg);
    1821 }
    1822 
    1823 #endif
    1824924
    1825925static int snd_ice1712_pro_trigger(snd_pcm_substream_t *substream,
     
    1879979}
    1880980
     981/*
     982 */
     983static void snd_ice1712_set_pro_rate(ice1712_t *ice, snd_pcm_substream_t *substream)
     984{
     985        unsigned long flags;
     986        unsigned int rate;
     987        unsigned char val;
     988
     989        spin_lock_irqsave(&ice->reg_lock, flags);
     990        if ((inb(ICEMT(ice, PLAYBACK_CONTROL)) & (ICE1712_CAPTURE_START_SHADOW|
     991                                                  ICE1712_PLAYBACK_PAUSE|
     992                                                  ICE1712_PLAYBACK_START)) ||
     993            (inb(ICEMT(ice, RATE)) & ICE1712_SPDIF_MASTER)) {
     994                spin_unlock_irqrestore(&ice->reg_lock, flags);
     995                return;
     996        }
     997        rate = substream->runtime->rate;
     998        switch (rate) {
     999        case 8000: val = 6; break;
     1000        case 9600: val = 3; break;
     1001        case 11025: val = 10; break;
     1002        case 12000: val = 2; break;
     1003        case 16000: val = 5; break;
     1004        case 22050: val = 9; break;
     1005        case 24000: val = 1; break;
     1006        case 32000: val = 4; break;
     1007        case 44100: val = 8; break;
     1008        case 48000: val = 0; break;
     1009        case 64000: val = 15; break;
     1010        case 88200: val = 11; break;
     1011        case 96000: val = 7; break;
     1012        default:
     1013                snd_BUG();
     1014                val = 0;
     1015                break;
     1016        }
     1017        outb(val, ICEMT(ice, RATE));
     1018        spin_unlock_irqrestore(&ice->reg_lock, flags);
     1019
     1020        if (ice->ak4524.ops.set_rate_val)
     1021                ice->ak4524.ops.set_rate_val(ice, val);
     1022}
     1023
    18811024static int snd_ice1712_playback_pro_prepare(snd_pcm_substream_t * substream)
    18821025{
    18831026        unsigned long flags;
    18841027        ice1712_t *ice = snd_pcm_substream_chip(substream);
    1885         unsigned int tmp;
    1886         int change;
    18871028
    18881029        ice->playback_pro_size = snd_pcm_lib_buffer_bytes(substream);
     
    18921033        outw((ice->playback_pro_size >> 2) - 1, ICEMT(ice, PLAYBACK_SIZE));
    18931034        outw((snd_pcm_lib_period_bytes(substream) >> 2) - 1, ICEMT(ice, PLAYBACK_COUNT));
    1894         switch (ice->eeprom.subvendor) {
    1895         case ICE1712_SUBDEVICE_DELTA1010:
    1896         case ICE1712_SUBDEVICE_DELTADIO2496:
    1897         case ICE1712_SUBDEVICE_DELTA66:
    1898                 /* setup S/PDIF */
    1899                 tmp = ice->cs8403_spdif_stream_bits;
    1900                 if (tmp & 0x01)         /* consumer */
    1901                         tmp &= (tmp & 0x01) ? ~0x06 : ~0x18;
    1902                 switch (substream->runtime->rate) {
    1903                 case 32000: tmp |= (tmp & 0x01) ? 0x04 : 0x00; break;
    1904                 case 44100: tmp |= (tmp & 0x01) ? 0x00 : 0x10; break;
    1905                 case 48000: tmp |= (tmp & 0x01) ? 0x02 : 0x08; break;
    1906                 default: tmp |= (tmp & 0x01) ? 0x00 : 0x18; break;
    1907                 }
    1908                 change = ice->cs8403_spdif_stream_bits != tmp;
    1909                 ice->cs8403_spdif_stream_bits = tmp;
    19101035                spin_unlock_irqrestore(&ice->reg_lock, flags);
    1911                 if (change)
    1912                         snd_ctl_notify(ice->card, SNDRV_CTL_EVENT_MASK_VALUE, &ice->spdif_stream_ctl->id);
    1913                 snd_ice1712_delta_cs8403_spdif_write(ice, tmp);
    1914                 return 0;
    1915         case ICE1712_SUBDEVICE_EWX2496:
    1916         case ICE1712_SUBDEVICE_AUDIOPHILE:
    1917                 snd_cs8427_iec958_pcm(ice->cs8427, substream->runtime->rate);
    1918                 break;
    1919         case ICE1712_SUBDEVICE_EWS88MT:
    1920         case ICE1712_SUBDEVICE_EWS88D:
    1921                 /* setup S/PDIF */
    1922                 tmp = ice->cs8403_spdif_stream_bits;
    1923                 if (tmp & 0x10)         /* consumer */
    1924                         tmp &= (tmp & 0x01) ? ~0x06 : ~0x60;
    1925                 switch (substream->runtime->rate) {
    1926                 case 32000: tmp |= (tmp & 0x01) ? 0x02 : 0x00; break;
    1927                 case 44100: tmp |= (tmp & 0x01) ? 0x06 : 0x40; break;
    1928                 case 48000: tmp |= (tmp & 0x01) ? 0x04 : 0x20; break;
    1929                 default: tmp |= (tmp & 0x01) ? 0x06 : 0x40; break;
    1930                 }
    1931                 change = ice->cs8403_spdif_stream_bits != tmp;
    1932                 ice->cs8403_spdif_stream_bits = tmp;
    1933                 spin_unlock_irqrestore(&ice->reg_lock, flags);
    1934                 if (change)
    1935                         snd_ctl_notify(ice->card, SNDRV_CTL_EVENT_MASK_VALUE, &ice->spdif_stream_ctl->id);
    1936                 snd_ice1712_ews_cs8404_spdif_write(ice, tmp);
    1937                 return 0;
    1938         }
    1939 
    1940         spin_unlock_irqrestore(&ice->reg_lock, flags);
     1036
     1037        if (ice->spdif.ops.setup)
     1038                ice->spdif.ops.setup(ice, substream);
     1039
    19411040        return 0;
    19421041}
     
    20301129        snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, &hw_constraints_rates);
    20311130
    2032         ice->cs8403_spdif_stream_bits = ice->cs8403_spdif_bits;
    2033         if (ice->cs8427)
    2034                 snd_cs8427_iec958_active(ice->cs8427, 1);
     1131        if (ice->spdif.ops.open)
     1132                ice->spdif.ops.open(ice, substream);
    20351133
    20361134        return 0;
     
    20551153
    20561154        ice->playback_pro_substream = NULL;
    2057         if (ice->cs8427)
    2058                 snd_cs8427_iec958_active(ice->cs8427, 0);
     1155        if (ice->spdif.ops.close)
     1156                ice->spdif.ops.close(ice, substream);
    20591157
    20601158        return 0;
     
    22321330}
    22331331
    2234 static int snd_ice1712_ak4524_volume_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo)
    2235 {
    2236         uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
    2237         uinfo->count = 1;
    2238         uinfo->value.integer.min = 0;
    2239         uinfo->value.integer.max = 127;
    2240         return 0;
    2241 }
    2242 
    2243 static int snd_ice1712_ak4524_volume_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
    2244 {
    2245         ice1712_t *ice = snd_kcontrol_chip(kcontrol);
    2246         int chip = kcontrol->private_value / 8;
    2247         int addr = kcontrol->private_value % 8;
    2248         ucontrol->value.integer.value[0] = ice->ak4524_images[chip][addr];
    2249         return 0;
    2250 }
    2251 
    2252 static int snd_ice1712_ak4524_volume_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
    2253 {
    2254         ice1712_t *ice = snd_kcontrol_chip(kcontrol);
    2255         int chip = kcontrol->private_value / 8;
    2256         int addr = kcontrol->private_value % 8;
    2257         unsigned char nval = ucontrol->value.integer.value[0];
    2258         int change = ice->ak4524_images[chip][addr] != nval;
    2259         if (change)
    2260                 snd_ice1712_ak4524_write(ice, chip, addr, nval);
    2261         return change;
    2262 }
    2263 
    2264 static int snd_ice1712_ak4524_ipga_gain_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo)
    2265 {
    2266         uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
    2267         uinfo->count = 1;
    2268         uinfo->value.integer.min = 0;
    2269         uinfo->value.integer.max = 36;
    2270         return 0;
    2271 }
    2272 
    2273 static int snd_ice1712_ak4524_ipga_gain_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
    2274 {
    2275         ice1712_t *ice = snd_kcontrol_chip(kcontrol);
    2276         int chip = kcontrol->private_value / 8;
    2277         int addr = kcontrol->private_value % 8;
    2278         ucontrol->value.integer.value[0] = ice->ak4524_ipga_gain[chip][addr-4] & 0x7f;
    2279         return 0;
    2280 }
    2281 
    2282 static int snd_ice1712_ak4524_ipga_gain_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
    2283 {
    2284         ice1712_t *ice = snd_kcontrol_chip(kcontrol);
    2285         int chip = kcontrol->private_value / 8;
    2286         int addr = kcontrol->private_value % 8;
    2287         unsigned char nval = (ucontrol->value.integer.value[0] % 37) | 0x80;
    2288         int change = ice->ak4524_ipga_gain[chip][addr] != nval;
    2289         if (change)
    2290                 snd_ice1712_ak4524_write(ice, chip, addr, nval);
    2291         return change;
    2292 }
    2293 
    2294 static int snd_ice1712_ak4524_deemphasis_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo)
    2295 {
    2296         static char *texts[4] = {
    2297                 "44.1kHz", "Off", "48kHz", "32kHz",
    2298         };
    2299         uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
    2300         uinfo->count = 1;
    2301         uinfo->value.enumerated.items = 4;
    2302         if (uinfo->value.enumerated.item >= 4)
    2303                 uinfo->value.enumerated.item = 3;
    2304         strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
    2305         return 0;
    2306 }
    2307 
    2308 static int snd_ice1712_ak4524_deemphasis_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t *ucontrol)
    2309 {
    2310         ice1712_t *ice = snd_kcontrol_chip(kcontrol);
    2311         int chip = kcontrol->id.index;
    2312         ucontrol->value.enumerated.item[0] = ice->ak4524_images[chip][3] & 3;
    2313         return 0;
    2314 }
    2315 
    2316 static int snd_ice1712_ak4524_deemphasis_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
    2317 {
    2318         ice1712_t *ice = snd_kcontrol_chip(kcontrol);
    2319         int chip = kcontrol->id.index;
    2320         unsigned char nval = ucontrol->value.enumerated.item[0];
    2321         int change;
    2322         nval |= (nval & 3) | (ice->ak4524_images[chip][3] & ~3);
    2323         change = ice->ak4524_images[chip][3] != nval;
    2324         if (change)
    2325                 snd_ice1712_ak4524_write(ice, chip, 3, nval);
    2326         return change;
    2327 }
    23281332
    23291333static int __init snd_ice1712_build_pro_mixer(ice1712_t *ice)
     
    23971401}
    23981402
    2399 static void snd_ice1712_ac97_init(ac97_t *ac97)
    2400 {
    2401         // ice1712_t *ice = snd_magic_cast(ice1712_t, ac97->private_data, return);
    2402 
    2403         /* disable center DAC/surround DAC/LFE DAC/MIC ADC */
    2404         snd_ac97_update_bits(ac97, AC97_EXTENDED_STATUS, 0xe800, 0xe800);
    2405 }
    2406 
    24071403static void snd_ice1712_mixer_free_ac97(ac97_t *ac97)
    24081404{
     
    24201416                ac97.write = snd_ice1712_ac97_write;
    24211417                ac97.read = snd_ice1712_ac97_read;
    2422                 ac97.init = snd_ice1712_ac97_init;
    24231418                ac97.private_data = ice;
    24241419                ac97.private_free = snd_ice1712_mixer_free_ac97;
    2425                 if ((err = snd_ac97_mixer(ice->card, &ac97, &ice->ac97)) < 0) {
     1420                if ((err = snd_ac97_mixer(ice->card, &ac97, &ice->ac97)) < 0)
    24261421                        printk(KERN_WARNING "ice1712: cannot initialize ac97 for consumer, skipped\n");
    2427                         // return err;
    2428                 } else {
     1422                else {
    24291423                if ((err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_mixer_digmix_route_ac97, ice))) < 0)
    24301424                        return err;
     1425                        return 0;
    24311426                }
    2432                 return 0;
    24331427        }
    24341428        /* hmm.. can we have both consumer and pro ac97 mixers? */
     
    24381432                ac97.write = snd_ice1712_pro_ac97_write;
    24391433                ac97.read = snd_ice1712_pro_ac97_read;
    2440                 ac97.init = snd_ice1712_ac97_init;
    24411434                ac97.private_data = ice;
    24421435                ac97.private_free = snd_ice1712_mixer_free_ac97;
    24431436                if ((err = snd_ac97_mixer(ice->card, &ac97, &ice->ac97)) < 0)
    2444                         return err;
     1437                        printk(KERN_WARNING "ice1712: cannot initialize pro ac97, skipped\n");
     1438                else
    24451439                return 0;
    24461440        }
     
    25501544{
    25511545        ice1712_t *ice = snd_kcontrol_chip(kcontrol);
    2552        
    2553         switch (ice->eeprom.subvendor) {
    2554         case ICE1712_SUBDEVICE_DELTA1010:
    2555         case ICE1712_SUBDEVICE_DELTADIO2496:
    2556         case ICE1712_SUBDEVICE_DELTA66:
    2557                 snd_cs8403_decode_spdif_bits(&ucontrol->value.iec958, ice->cs8403_spdif_bits);
    2558                 break;
    2559         case ICE1712_SUBDEVICE_EWS88MT:
    2560         case ICE1712_SUBDEVICE_EWS88D:
    2561                 snd_cs8404_decode_spdif_bits(&ucontrol->value.iec958, ice->cs8403_spdif_bits);
    2562                 break;
    2563         }
     1546        if (ice->spdif.ops.default_get)
     1547                ice->spdif.ops.default_get(ice, ucontrol);
    25641548        return 0;
    25651549}
     
    25691553{
    25701554        ice1712_t *ice = snd_kcontrol_chip(kcontrol);
    2571         unsigned long flags;
    2572         unsigned int val;
    2573         int change;
    2574 
    2575         switch (ice->eeprom.subvendor) {
    2576         case ICE1712_SUBDEVICE_DELTA1010:
    2577         case ICE1712_SUBDEVICE_DELTADIO2496:
    2578         case ICE1712_SUBDEVICE_DELTA66:
    2579                 val = snd_cs8403_encode_spdif_bits(&ucontrol->value.iec958);
    2580                 spin_lock_irqsave(&ice->reg_lock, flags);
    2581                 change = ice->cs8403_spdif_bits != val;
    2582                 ice->cs8403_spdif_bits = val;
    2583                 if (change && ice->playback_pro_substream == NULL) {
    2584                         spin_unlock_irqrestore(&ice->reg_lock, flags);
    2585                         snd_ice1712_delta_cs8403_spdif_write(ice, val);
    2586                 } else {
    2587                         spin_unlock_irqrestore(&ice->reg_lock, flags);
    2588                 }
    2589                 break;
    2590         case ICE1712_SUBDEVICE_EWS88MT:
    2591         case ICE1712_SUBDEVICE_EWS88D:
    2592                 val = snd_cs8404_encode_spdif_bits(&ucontrol->value.iec958);
    2593                 spin_lock_irqsave(&ice->reg_lock, flags);
    2594                 change = ice->cs8403_spdif_bits != val;
    2595                 ice->cs8403_spdif_bits = val;
    2596                 if (change && ice->playback_pro_substream == NULL) {
    2597                         spin_unlock_irqrestore(&ice->reg_lock, flags);
    2598                         snd_ice1712_ews_cs8404_spdif_write(ice, val);
    2599                 } else {
    2600                         spin_unlock_irqrestore(&ice->reg_lock, flags);
    2601                 }
    2602                 break;
    2603         default:
    2604                 change = 0;
    2605         }
    2606         return change;
     1555        if (ice->spdif.ops.default_put)
     1556                return ice->spdif.ops.default_put(ice, ucontrol);
     1557        return 0;
    26071558}
    26081559
     
    26271578{
    26281579        ice1712_t *ice = snd_kcontrol_chip(kcontrol);
    2629 
    2630         switch (ice->eeprom.subvendor) {
    2631         case ICE1712_SUBDEVICE_DELTA1010:
    2632         case ICE1712_SUBDEVICE_DELTADIO2496:
    2633         case ICE1712_SUBDEVICE_DELTA66:
    2634         case ICE1712_SUBDEVICE_EWS88MT:
    2635         case ICE1712_SUBDEVICE_EWS88D:
     1580        if (ice->spdif.ops.default_get) {
    26361581                ucontrol->value.iec958.status[0] = IEC958_AES0_NONAUDIO |
    26371582                                                     IEC958_AES0_PROFESSIONAL |
     
    26411586                                                     IEC958_AES1_CON_CATEGORY;
    26421587                ucontrol->value.iec958.status[3] = IEC958_AES3_CON_FS;
    2643                 break;
    2644         case ICE1712_SUBDEVICE_AUDIOPHILE:
    2645         case ICE1712_SUBDEVICE_EWX2496:
     1588        } else {
    26461589                ucontrol->value.iec958.status[0] = 0xff;
    26471590                ucontrol->value.iec958.status[1] = 0xff;
     
    26491592                ucontrol->value.iec958.status[3] = 0xff;
    26501593                ucontrol->value.iec958.status[4] = 0xff;
    2651                 break;
    26521594        }
    26531595        return 0;
     
    26581600{
    26591601        ice1712_t *ice = snd_kcontrol_chip(kcontrol);
    2660 
    2661         switch (ice->eeprom.subvendor) {
    2662         case ICE1712_SUBDEVICE_DELTA1010:
    2663         case ICE1712_SUBDEVICE_DELTADIO2496:
    2664         case ICE1712_SUBDEVICE_DELTA66:
    2665         case ICE1712_SUBDEVICE_EWS88MT:
    2666         case ICE1712_SUBDEVICE_EWS88D:
     1602        if (ice->spdif.ops.default_get) {
    26671603                ucontrol->value.iec958.status[0] = IEC958_AES0_NONAUDIO |
    26681604                                                     IEC958_AES0_PROFESSIONAL |
     
    26701606                                                     IEC958_AES0_PRO_EMPHASIS;
    26711607                ucontrol->value.iec958.status[1] = IEC958_AES1_PRO_MODE;
    2672                 break;
    2673         case ICE1712_SUBDEVICE_AUDIOPHILE:
    2674         case ICE1712_SUBDEVICE_EWX2496:
     1608        } else {
    26751609                ucontrol->value.iec958.status[0] = 0xff;
    26761610                ucontrol->value.iec958.status[1] = 0xff;
     
    26781612                ucontrol->value.iec958.status[3] = 0xff;
    26791613                ucontrol->value.iec958.status[4] = 0xff;
    2680                 break;
    26811614        }
    26821615        return 0;
     
    27121645{
    27131646        ice1712_t *ice = snd_kcontrol_chip(kcontrol);
    2714 
    2715         switch (ice->eeprom.subvendor) {
    2716         case ICE1712_SUBDEVICE_DELTA1010:
    2717         case ICE1712_SUBDEVICE_DELTADIO2496:
    2718         case ICE1712_SUBDEVICE_DELTA66:
    2719                 snd_cs8403_decode_spdif_bits(&ucontrol->value.iec958, ice->cs8403_spdif_stream_bits);
    2720                 break;
    2721         case ICE1712_SUBDEVICE_EWS88MT:
    2722         case ICE1712_SUBDEVICE_EWS88D:
    2723                 snd_cs8404_decode_spdif_bits(&ucontrol->value.iec958, ice->cs8403_spdif_stream_bits);
    2724                 break;
    2725         }
     1647        if (ice->spdif.ops.stream_get)
     1648                ice->spdif.ops.stream_get(ice, ucontrol);
    27261649        return 0;
    27271650}
     
    27311654{
    27321655        ice1712_t *ice = snd_kcontrol_chip(kcontrol);
    2733         unsigned long flags;
    2734         unsigned int val;
    2735         int change;
    2736 
    2737         switch (ice->eeprom.subvendor) {
    2738         case ICE1712_SUBDEVICE_DELTA1010:
    2739         case ICE1712_SUBDEVICE_DELTADIO2496:
    2740         case ICE1712_SUBDEVICE_DELTA66:
    2741                 val = snd_cs8403_encode_spdif_bits(&ucontrol->value.iec958);
    2742                 spin_lock_irqsave(&ice->reg_lock, flags);
    2743                 change = ice->cs8403_spdif_stream_bits != val;
    2744                 ice->cs8403_spdif_stream_bits = val;
    2745                 if (change && ice->playback_pro_substream != NULL) {
    2746                         spin_unlock_irqrestore(&ice->reg_lock, flags);
    2747                         snd_ice1712_delta_cs8403_spdif_write(ice, val);
    2748                 } else {
    2749                         spin_unlock_irqrestore(&ice->reg_lock, flags);
    2750                 }
    2751                 break;
    2752         case ICE1712_SUBDEVICE_EWS88MT:
    2753         case ICE1712_SUBDEVICE_EWS88D:
    2754                 val = snd_cs8404_encode_spdif_bits(&ucontrol->value.iec958);
    2755                 spin_lock_irqsave(&ice->reg_lock, flags);
    2756                 change = ice->cs8403_spdif_stream_bits != val;
    2757                 ice->cs8403_spdif_stream_bits = val;
    2758                 if (change && ice->playback_pro_substream != NULL) {
    2759                         spin_unlock_irqrestore(&ice->reg_lock, flags);
    2760                         snd_ice1712_ews_cs8404_spdif_write(ice, val);
    2761                 } else {
    2762                         spin_unlock_irqrestore(&ice->reg_lock, flags);
    2763                 }
    2764                 break;
    2765         default:
    2766                 change = 0;
    2767         }
    2768         return change;
     1656        if (ice->spdif.ops.stream_put)
     1657                return ice->spdif.ops.stream_put(ice, ucontrol);
     1658        return 0;
    27691659}
    27701660
     
    27791669};
    27801670
    2781 #define ICE1712_GPIO(xiface, xname, xindex, mask, invert, xaccess) \
    2782 { .iface = xiface, .name = xname, .access = xaccess, .info = snd_ice1712_gpio_info, \
    2783   .get = snd_ice1712_gpio_get, .put = snd_ice1712_gpio_put, \
    2784   .private_value = mask | (invert << 24) }
    2785 
    2786 static int snd_ice1712_gpio_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo)
     1671int snd_ice1712_gpio_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo)
    27871672{
    27881673        uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
     
    27931678}
    27941679
    2795 static int snd_ice1712_gpio_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol)
     1680int snd_ice1712_gpio_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol)
    27961681{
    27971682        ice1712_t *ice = snd_kcontrol_chip(kcontrol);
     
    28001685        unsigned char saved[2];
    28011686       
    2802         save_gpio_status(ice, saved);
     1687        snd_ice1712_save_gpio_status(ice, saved);
    28031688        ucontrol->value.integer.value[0] = (snd_ice1712_read(ice, ICE1712_IREG_GPIO_DATA) & mask ? 1 : 0) ^ invert;
    2804         restore_gpio_status(ice, saved);
    2805         return 0;
    2806 }
    2807 
    2808 static int snd_ice1712_gpio_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol)
     1689        snd_ice1712_restore_gpio_status(ice, saved);
     1690        return 0;
     1691}
     1692
     1693int snd_ice1712_gpio_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol)
    28091694{
    28101695        ice1712_t *ice = snd_kcontrol_chip(kcontrol);
     
    28171702                return -EPERM;
    28181703        nval = (ucontrol->value.integer.value[0] ? mask : 0) ^ invert;
    2819         save_gpio_status(ice, saved);
     1704        snd_ice1712_save_gpio_status(ice, saved);
    28201705        val = snd_ice1712_read(ice, ICE1712_IREG_GPIO_DATA);
    28211706        nval |= val & ~mask;
    28221707        snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, nval);
    2823         restore_gpio_status(ice, saved);
     1708        snd_ice1712_restore_gpio_status(ice, saved);
    28241709        return val != nval;
    28251710}
    2826 
    2827 static snd_kcontrol_new_t snd_ice1712_delta1010_wordclock_select __devinitdata =
    2828 ICE1712_GPIO(SNDRV_CTL_ELEM_IFACE_PCM, "Word Clock Sync", 0, ICE1712_DELTA_WORD_CLOCK_SELECT, 1, 0);
    2829 static snd_kcontrol_new_t snd_ice1712_delta1010_wordclock_status __devinitdata =
    2830 ICE1712_GPIO(SNDRV_CTL_ELEM_IFACE_PCM, "Word Clock Status", 0, ICE1712_DELTA_WORD_CLOCK_STATUS, 1, SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE);
    2831 static snd_kcontrol_new_t snd_ice1712_deltadio2496_spdif_in_select __devinitdata =
    2832 ICE1712_GPIO(SNDRV_CTL_ELEM_IFACE_PCM, "IEC958 Input Optical", 0, ICE1712_DELTA_SPDIF_INPUT_SELECT, 0, 0);
    2833 static snd_kcontrol_new_t snd_ice1712_delta_spdif_in_status __devinitdata =
    2834 ICE1712_GPIO(SNDRV_CTL_ELEM_IFACE_PCM, "Delta IEC958 Input Status", 0, ICE1712_DELTA_SPDIF_IN_STAT, 1, SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE);
    28351711
    28361712static int snd_ice1712_pro_spdif_master_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo)
     
    31171993
    31181994/*
    3119  * EWX 24/96
    3120  */
    3121 
    3122 static int snd_ice1712_ewx_io_sense_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo){
    3123 
    3124         static char *texts[4] = {
    3125                 "+4dBu", "-10dBV",
    3126         };
    3127         uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
    3128         uinfo->count = 1;
    3129         uinfo->value.enumerated.items = 2;
    3130         if (uinfo->value.enumerated.item >= 2)
    3131                 uinfo->value.enumerated.item = 1;
    3132         strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
    3133         return 0;
    3134 }
    3135 
    3136 static int snd_ice1712_ewx_io_sense_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol)
    3137 {
    3138         ice1712_t *ice = snd_kcontrol_chip(kcontrol);
    3139         unsigned char mask = kcontrol->private_value & 0xff;
    3140         unsigned char saved[2];
    3141        
    3142         save_gpio_status(ice, saved);
    3143         ucontrol->value.enumerated.item[0] = snd_ice1712_read(ice, ICE1712_IREG_GPIO_DATA) & mask ? 1 : 0;
    3144         restore_gpio_status(ice, saved);
    3145         return 0;
    3146 }
    3147 
    3148 static int snd_ice1712_ewx_io_sense_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol)
    3149 {
    3150         ice1712_t *ice = snd_kcontrol_chip(kcontrol);
    3151         unsigned char mask = kcontrol->private_value & 0xff;
    3152         unsigned char saved[2];
    3153         int val, nval;
    3154 
    3155         if (kcontrol->private_value & (1 << 31))
    3156                 return -EPERM;
    3157         nval = ucontrol->value.enumerated.item[0] ? mask : 0;
    3158         save_gpio_status(ice, saved);
    3159         val = snd_ice1712_read(ice, ICE1712_IREG_GPIO_DATA);
    3160         nval |= val & ~mask;
    3161         snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, nval);
    3162         restore_gpio_status(ice, saved);
    3163         return val != nval;
    3164 }
    3165 
    3166 static snd_kcontrol_new_t snd_ice1712_ewx_input_sense __devinitdata = {
    3167         .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
    3168         .name = "Input Sensitivity Switch",
    3169         .info = snd_ice1712_ewx_io_sense_info,
    3170         .get = snd_ice1712_ewx_io_sense_get,
    3171         .put = snd_ice1712_ewx_io_sense_put,
    3172         .private_value = ICE1712_EWX2496_AIN_SEL,
    3173 };
    3174 
    3175 static snd_kcontrol_new_t snd_ice1712_ewx_output_sense __devinitdata = {
    3176         .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
    3177         .name = "Output Sensitivity Switch",
    3178         .info = snd_ice1712_ewx_io_sense_info,
    3179         .get = snd_ice1712_ewx_io_sense_get,
    3180         .put = snd_ice1712_ewx_io_sense_put,
    3181         .private_value = ICE1712_EWX2496_AOUT_SEL,
    3182 };
    3183 
    3184 
    3185 /*
    3186  * EWS88MT
    3187  */
    3188 /* analog output sensitivity;; address 0x48 bit 6 */
    3189 static int snd_ice1712_ews88mt_output_sense_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
    3190 {
    3191         ice1712_t *ice = snd_kcontrol_chip(kcontrol);
    3192         unsigned char data;
    3193 
    3194         snd_i2c_lock(ice->i2c);
    3195         if (snd_i2c_readbytes(ice->pcf8574[1], &data, 1) != 1) {
    3196                 snd_i2c_unlock(ice->i2c);
    3197                 return -EIO;
    3198         }
    3199         snd_i2c_unlock(ice->i2c);
    3200         ucontrol->value.enumerated.item[0] = data & ICE1712_EWS88MT_OUTPUT_SENSE ? 1 : 0; /* high = -10dBV, low = +4dBu */
    3201         return 0;
    3202 }
    3203 
    3204 /* analog output sensitivity;; address 0x48 bit 6 */
    3205 static int snd_ice1712_ews88mt_output_sense_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
    3206 {
    3207         ice1712_t *ice = snd_kcontrol_chip(kcontrol);
    3208         unsigned char data, ndata;
    3209 
    3210         snd_i2c_lock(ice->i2c);
    3211         if (snd_i2c_readbytes(ice->pcf8574[1], &data, 1) != 1) {
    3212                 snd_i2c_unlock(ice->i2c);
    3213                 return -EIO;
    3214         }
    3215         ndata = (data & ~ICE1712_EWS88MT_OUTPUT_SENSE) | (ucontrol->value.enumerated.item[0] ? ICE1712_EWS88MT_OUTPUT_SENSE : 0);
    3216         if (ndata != data && snd_i2c_sendbytes(ice->pcf8574[1], &ndata, 1) != 1) {
    3217                 snd_i2c_unlock(ice->i2c);
    3218                 return -EIO;
    3219         }
    3220         snd_i2c_unlock(ice->i2c);
    3221         return ndata != data;
    3222 }
    3223 
    3224 /* analog input sensitivity; address 0x46 */
    3225 static int snd_ice1712_ews88mt_input_sense_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
    3226 {
    3227         ice1712_t *ice = snd_kcontrol_chip(kcontrol);
    3228         int channel = kcontrol->id.index;
    3229         unsigned char data;
    3230 
    3231         snd_assert(channel >= 0 && channel <= 7, return 0);
    3232         snd_i2c_lock(ice->i2c);
    3233         if (snd_i2c_readbytes(ice->pcf8574[0], &data, 1) != 1) {
    3234                 snd_i2c_unlock(ice->i2c);
    3235                 return -EIO;
    3236         }
    3237         /* reversed; high = +4dBu, low = -10dBV */
    3238         ucontrol->value.enumerated.item[0] = data & (1 << channel) ? 0 : 1;
    3239         return 0;
    3240 }
    3241 
    3242 /* analog output sensitivity; address 0x46 */
    3243 static int snd_ice1712_ews88mt_input_sense_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
    3244 {
    3245         ice1712_t *ice = snd_kcontrol_chip(kcontrol);
    3246         int channel = kcontrol->id.index;
    3247         unsigned char data, ndata;
    3248 
    3249         snd_assert(channel >= 0 && channel <= 7, return 0);
    3250         snd_i2c_lock(ice->i2c);
    3251         if (snd_i2c_readbytes(ice->pcf8574[0], &data, 1) != 1) {
    3252                 snd_i2c_unlock(ice->i2c);
    3253                 return -EIO;
    3254         }
    3255         ndata = (data & ~(1 << channel)) | (ucontrol->value.enumerated.item[0] ? 0 : (1 << channel));
    3256         if (ndata != data && snd_i2c_sendbytes(ice->pcf8574[0], &ndata, 1) != 1) {
    3257                 snd_i2c_unlock(ice->i2c);
    3258                 return -EIO;
    3259         }
    3260         snd_i2c_unlock(ice->i2c);
    3261         return ndata != data;
    3262 }
    3263 
    3264 static snd_kcontrol_new_t snd_ice1712_ews88mt_input_sense __devinitdata = {
    3265         .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
    3266         .name = "Input Sensitivity Switch",
    3267         .info = snd_ice1712_ewx_io_sense_info,
    3268         .get = snd_ice1712_ews88mt_input_sense_get,
    3269         .put = snd_ice1712_ews88mt_input_sense_put,
    3270 };
    3271 
    3272 static snd_kcontrol_new_t snd_ice1712_ews88mt_output_sense __devinitdata = {
    3273         .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
    3274         .name = "Output Sensitivity Switch",
    3275         .info = snd_ice1712_ewx_io_sense_info,
    3276         .get = snd_ice1712_ews88mt_output_sense_get,
    3277         .put = snd_ice1712_ews88mt_output_sense_put,
    3278 };
    3279 
    3280 
    3281 /*
    3282  * EWS88D controls
    3283  */
    3284 
    3285 static int snd_ice1712_ews88d_control_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo)
    3286 {
    3287         uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
    3288         uinfo->count = 1;
    3289         uinfo->value.integer.min = 0;
    3290         uinfo->value.integer.max = 1;
    3291         return 0;
    3292 }
    3293 
    3294 static int snd_ice1712_ews88d_control_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
    3295 {
    3296         ice1712_t *ice = snd_kcontrol_chip(kcontrol);
    3297         int shift = kcontrol->private_value & 0xff;
    3298         int invert = (kcontrol->private_value >> 8) & 1;
    3299         unsigned char data[2];
    3300        
    3301         snd_i2c_lock(ice->i2c);
    3302         if (snd_i2c_readbytes(ice->pcf8575, data, 2) != 2) {
    3303                 snd_i2c_unlock(ice->i2c);
    3304                 return -EIO;
    3305         }
    3306         snd_i2c_unlock(ice->i2c);
    3307         data[0] = (data[shift >> 3] >> (shift & 7)) & 0x01;
    3308         if (invert)
    3309                 data[0] ^= 0x01;
    3310         ucontrol->value.integer.value[0] = data[0];
    3311         return 0;
    3312 }
    3313 
    3314 static int snd_ice1712_ews88d_control_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol)
    3315 {
    3316         ice1712_t *ice = snd_kcontrol_chip(kcontrol);
    3317         int shift = kcontrol->private_value & 0xff;
    3318         int invert = (kcontrol->private_value >> 8) & 1;
    3319         unsigned char data[2], ndata[2];
    3320         int change;
    3321 
    3322         snd_i2c_lock(ice->i2c);
    3323         if (snd_i2c_readbytes(ice->pcf8575, data, 2) != 2) {
    3324                 snd_i2c_unlock(ice->i2c);
    3325                 return -EIO;
    3326         }
    3327         ndata[shift >> 3] = data[shift >> 3] & ~(1 << (shift & 7));
    3328         if (invert) {
    3329                 if (! ucontrol->value.integer.value[0])
    3330                         ndata[shift >> 3] |= (1 << (shift & 7));
    3331         } else {
    3332                 if (ucontrol->value.integer.value[0])
    3333                         ndata[shift >> 3] |= (1 << (shift & 7));
    3334         }
    3335         change = (data[shift >> 3] != ndata[shift >> 3]);
    3336         if (change && snd_i2c_sendbytes(ice->pcf8575, data, 2) != 2) {
    3337                 snd_i2c_unlock(ice->i2c);
    3338                 return -EIO;
    3339         }
    3340         snd_i2c_unlock(ice->i2c);
    3341         return change;
    3342 }
    3343 
    3344 #define EWS88D_CONTROL(xiface, xname, xshift, xinvert, xaccess) \
    3345 { .iface = xiface,\
    3346   .name = xname,\
    3347   .access = xaccess,\
    3348   .info = snd_ice1712_ews88d_control_info,\
    3349   .get = snd_ice1712_ews88d_control_get,\
    3350   .put = snd_ice1712_ews88d_control_put,\
    3351   .private_value = xshift | (xinvert << 8),\
    3352 }
    3353 
    3354 static snd_kcontrol_new_t snd_ice1712_ews88d_controls[] __devinitdata = {
    3355         EWS88D_CONTROL(SNDRV_CTL_ELEM_IFACE_MIXER, "IEC958 Input Optical", 0, 1, 0), /* inverted */
    3356         EWS88D_CONTROL(SNDRV_CTL_ELEM_IFACE_MIXER, "ADAT Output Optical", 1, 0, 0),
    3357         EWS88D_CONTROL(SNDRV_CTL_ELEM_IFACE_MIXER, "ADAT External Master Clock", 2, 0, 0),
    3358         EWS88D_CONTROL(SNDRV_CTL_ELEM_IFACE_MIXER, "Enable ADAT", 3, 0, 0),
    3359         EWS88D_CONTROL(SNDRV_CTL_ELEM_IFACE_MIXER, "ADAT Through", 4, 1, 0),
    3360 };
    3361 
    3362 
    3363 /*
    3364  * DMX 6Fire controls
    3365  */
    3366 
    3367 #if 0 // XXX not working yet
    3368 static int snd_ice1712_6fire_read_pca(ice1712_t *ice)
    3369 {
    3370         unsigned char byte;
    3371         snd_i2c_lock(ice->i2c);
    3372         byte = 0; /* read port */
    3373         snd_i2c_sendbytes(ice->pcf8575, &byte, 1);
    3374         if (snd_i2c_readbytes(ice->pcf8575, &byte, 1) != 1) {
    3375                 snd_i2c_unlock(ice->i2c);
    3376                 return -EIO;
    3377         }
    3378         snd_i2c_unlock(ice->i2c);
    3379         return byte;
    3380 }
    3381 
    3382 static int snd_ice1712_6fire_write_pca(ice1712_t *ice, unsigned char data)
    3383 {
    3384         unsigned char bytes[2];
    3385         snd_i2c_lock(ice->i2c);
    3386         bytes[0] = 1; /* write port */
    3387         bytes[1] = data;
    3388         if (snd_i2c_sendbytes(ice->pcf8575, bytes, 2) != 2) {
    3389                 snd_i2c_unlock(ice->i2c);
    3390                 return -EIO;
    3391         }
    3392         snd_i2c_unlock(ice->i2c);
    3393         return 0;
    3394 }
    3395 
    3396 static int snd_ice1712_6fire_control_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo)
    3397 {
    3398         uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
    3399         uinfo->count = 1;
    3400         uinfo->value.integer.min = 0;
    3401         uinfo->value.integer.max = 1;
    3402         return 0;
    3403 }
    3404 
    3405 static int snd_ice1712_6fire_control_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
    3406 {
    3407         ice1712_t *ice = snd_kcontrol_chip(kcontrol);
    3408         int shift = kcontrol->private_value & 0xff;
    3409         int invert = (kcontrol->private_value >> 8) & 1;
    3410         int data;
    3411        
    3412         if ((data = snd_ice1712_6fire_read_pca(ice)) < 0)
    3413                 return data;
    3414         data = (data >> shift) & 1;
    3415         if (invert)
    3416                 data ^= 1;
    3417         ucontrol->value.integer.value[0] = data;
    3418         return 0;
    3419 }
    3420 
    3421 static int snd_ice1712_6fire_control_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
    3422 {
    3423         ice1712_t *ice = snd_kcontrol_chip(kcontrol);
    3424         int shift = kcontrol->private_value & 0xff;
    3425         int invert = (kcontrol->private_value >> 8) & 1;
    3426         int data, ndata;
    3427        
    3428         if ((data = snd_ice1712_6fire_read_pca(ice)) < 0)
    3429                 return data;
    3430         ndata = data & ~(1 << shift);
    3431         if (ucontrol->value.integer.value[0])
    3432                 ndata |= (1 << shift);
    3433         if (invert)
    3434                 ndata ^= (1 << shift);
    3435         if (data != ndata) {
    3436                 snd_ice1712_6fire_write_pca(ice, (unsigned char)ndata);
    3437                 return 1;
    3438         }
    3439         return 0;
    3440 }
    3441 
    3442 #define DMX6FIRE_CONTROL(xiface, xname, xshift, xinvert, xaccess) \
    3443 { .iface = xiface,\
    3444   .name = xname,\
    3445   .access = xaccess,\
    3446   .info = snd_ice1712_6fire_control_info,\
    3447   .get = snd_ice1712_6fire_control_get,\
    3448   .put = snd_ice1712_6fire_control_put,\
    3449   .private_value = xshift | (xinvert << 8),\
    3450 }
    3451 
    3452 static snd_kcontrol_new_t snd_ice1712_6fire_led __devinitdata =
    3453 DMX6FIRE_CONTROL(SNDRV_CTL_ELEM_IFACE_MIXER, "Breakbox LED", 6, 0, 0);
    3454 
    3455 #endif // XXX not working yet
    3456 
    3457 
    3458 /*
    34591995 *
    34601996 */
     
    35182054}
    35192055
    3520 static void __devinit snd_ice1712_ak4524_init(ice1712_t *ice)
    3521 {
    3522         static unsigned char inits[] = {
    3523                 0x00, 0x07, /* 0: all power up */
    3524                 0x01, 0x00, /* 1: ADC/DAC reset */
    3525                 0x02, 0x60, /* 2: 24bit I2S */
    3526                 0x03, 0x19, /* 3: deemphasis off */
    3527                 0x01, 0x03, /* 1: ADC/DAC enable */
    3528                 0x04, 0x00, /* 4: ADC left muted */
    3529                 0x05, 0x00, /* 5: ADC right muted */
    3530                 0x04, 0x80, /* 4: ADC IPGA gain 0dB */
    3531                 0x05, 0x80, /* 5: ADC IPGA gain 0dB */
    3532                 0x06, 0x00, /* 6: DAC left muted */
    3533                 0x07, 0x00, /* 7: DAC right muted */
    3534                 0xff, 0xff
    3535         };
    3536         int chip, idx;
    3537         unsigned char *ptr, reg, data;
    3538 
    3539         for (chip = idx = 0; chip < ice->num_dacs/2; chip++) {
    3540                 ptr = inits;
    3541                 while (*ptr != 0xff) {
    3542                         reg = *ptr++;
    3543                         data = *ptr++;
    3544                         if (ice->ak4528) {
    3545                                 if (reg > 5)
    3546                                         continue;
    3547                                 if (reg >= 4 && (data & 0x80))
    3548                                         continue;
    3549                         }
    3550                         if (reg == 0x03 && ice->ak4528)
    3551                                 data = 0x0d;    /* deemphasis off, turn LR highpass filters on */
    3552                         snd_ice1712_ak4524_write(ice, chip, reg, data);
    3553                 }
    3554         }
    3555 }
    3556 
    3557 static void __devinit snd_ice1712_stdsp24_gpio_write(ice1712_t *ice, unsigned char byte)
    3558 {
    3559         byte |= ICE1712_STDSP24_CLOCK_BIT;
    3560         udelay(100);
    3561         snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, byte);
    3562         byte &= ~ICE1712_STDSP24_CLOCK_BIT;
    3563         udelay(100);
    3564         snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, byte);
    3565         byte |= ICE1712_STDSP24_CLOCK_BIT;
    3566         udelay(100);
    3567         snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, byte);
    3568 }
    3569 
    3570 static void __devinit snd_ice1712_stdsp24_darear(ice1712_t *ice, int activate)
    3571 {
    3572         down(&ice->gpio_mutex);
    3573         ICE1712_STDSP24_0_DAREAR(ice->hoontech_boxbits, activate);
    3574         snd_ice1712_stdsp24_gpio_write(ice, ice->hoontech_boxbits[0]);
    3575         up(&ice->gpio_mutex);
    3576 }
    3577 
    3578 static void __devinit snd_ice1712_stdsp24_mute(ice1712_t *ice, int activate)
    3579 {
    3580         down(&ice->gpio_mutex);
    3581         ICE1712_STDSP24_3_MUTE(ice->hoontech_boxbits, activate);
    3582         snd_ice1712_stdsp24_gpio_write(ice, ice->hoontech_boxbits[3]);
    3583         up(&ice->gpio_mutex);
    3584 }
    3585 
    3586 static void __devinit snd_ice1712_stdsp24_insel(ice1712_t *ice, int activate)
    3587 {
    3588         down(&ice->gpio_mutex);
    3589         ICE1712_STDSP24_3_INSEL(ice->hoontech_boxbits, activate);
    3590         snd_ice1712_stdsp24_gpio_write(ice, ice->hoontech_boxbits[3]);
    3591         up(&ice->gpio_mutex);
    3592 }
    3593 
    3594 static void __devinit snd_ice1712_stdsp24_box_channel(ice1712_t *ice, int box, int chn, int activate)
    3595 {
    3596         down(&ice->gpio_mutex);
    3597 
    3598         /* select box */
    3599         ICE1712_STDSP24_0_BOX(ice->hoontech_boxbits, box);
    3600         snd_ice1712_stdsp24_gpio_write(ice, ice->hoontech_boxbits[0]);
    3601 
    3602         /* prepare for write */
    3603         if (chn == 3)
    3604                 ICE1712_STDSP24_2_CHN4(ice->hoontech_boxbits, 0);
    3605         ICE1712_STDSP24_2_MIDI1(ice->hoontech_boxbits, activate);
    3606         snd_ice1712_stdsp24_gpio_write(ice, ice->hoontech_boxbits[2]);
    3607 
    3608         ICE1712_STDSP24_1_CHN1(ice->hoontech_boxbits, 1);
    3609         ICE1712_STDSP24_1_CHN2(ice->hoontech_boxbits, 1);
    3610         ICE1712_STDSP24_1_CHN3(ice->hoontech_boxbits, 1);
    3611         ICE1712_STDSP24_2_CHN4(ice->hoontech_boxbits, 1);
    3612         snd_ice1712_stdsp24_gpio_write(ice, ice->hoontech_boxbits[1]);
    3613         snd_ice1712_stdsp24_gpio_write(ice, ice->hoontech_boxbits[2]);
    3614         udelay(100);
    3615         if (chn == 3) {
    3616                 ICE1712_STDSP24_2_CHN4(ice->hoontech_boxbits, 0);
    3617                 snd_ice1712_stdsp24_gpio_write(ice, ice->hoontech_boxbits[2]);
    3618         } else {
    3619                 switch (chn) {
    3620                 case 0: ICE1712_STDSP24_1_CHN1(ice->hoontech_boxbits, 0); break;
    3621                 case 1: ICE1712_STDSP24_1_CHN2(ice->hoontech_boxbits, 0); break;
    3622                 case 2: ICE1712_STDSP24_1_CHN3(ice->hoontech_boxbits, 0); break;
    3623                 }
    3624                 snd_ice1712_stdsp24_gpio_write(ice, ice->hoontech_boxbits[1]);
    3625         }
    3626         udelay(100);
    3627         ICE1712_STDSP24_1_CHN1(ice->hoontech_boxbits, 1);
    3628         ICE1712_STDSP24_1_CHN2(ice->hoontech_boxbits, 1);
    3629         ICE1712_STDSP24_1_CHN3(ice->hoontech_boxbits, 1);
    3630         ICE1712_STDSP24_2_CHN4(ice->hoontech_boxbits, 1);
    3631         snd_ice1712_stdsp24_gpio_write(ice, ice->hoontech_boxbits[1]);
    3632         snd_ice1712_stdsp24_gpio_write(ice, ice->hoontech_boxbits[2]);
    3633         udelay(100);
    3634 
    3635         ICE1712_STDSP24_2_MIDI1(ice->hoontech_boxbits, 0);
    3636         snd_ice1712_stdsp24_gpio_write(ice, ice->hoontech_boxbits[2]);
    3637 
    3638         up(&ice->gpio_mutex);
    3639 }
    3640 
    3641 static void __devinit snd_ice1712_stdsp24_box_midi(ice1712_t *ice, int box, int master, int slave)
    3642 {
    3643         down(&ice->gpio_mutex);
    3644 
    3645         /* select box */
    3646         ICE1712_STDSP24_0_BOX(ice->hoontech_boxbits, box);
    3647         snd_ice1712_stdsp24_gpio_write(ice, ice->hoontech_boxbits[0]);
    3648 
    3649         ICE1712_STDSP24_2_MIDIIN(ice->hoontech_boxbits, 1);
    3650         ICE1712_STDSP24_2_MIDI1(ice->hoontech_boxbits, master);
    3651         snd_ice1712_stdsp24_gpio_write(ice, ice->hoontech_boxbits[2]);
    3652 
    3653         udelay(100);
    3654        
    3655         ICE1712_STDSP24_2_MIDIIN(ice->hoontech_boxbits, 0);
    3656         snd_ice1712_stdsp24_gpio_write(ice, ice->hoontech_boxbits[2]);
    3657        
    3658         udelay(100);
    3659        
    3660         ICE1712_STDSP24_2_MIDIIN(ice->hoontech_boxbits, 1);
    3661         snd_ice1712_stdsp24_gpio_write(ice, ice->hoontech_boxbits[2]);
    3662 
    3663         udelay(100);
    3664 
    3665         /* MIDI2 is direct */
    3666         ICE1712_STDSP24_3_MIDI2(ice->hoontech_boxbits, slave);
    3667         snd_ice1712_stdsp24_gpio_write(ice, ice->hoontech_boxbits[3]);
    3668 
    3669         up(&ice->gpio_mutex);
    3670 }
    3671 
    3672 static void __devinit snd_ice1712_stdsp24_init(ice1712_t *ice)
    3673 {
    3674         int box, chn;
    3675 
    3676         ice->hoontech_boxbits[0] =
    3677         ice->hoontech_boxbits[1] =
    3678         ice->hoontech_boxbits[2] =
    3679         ice->hoontech_boxbits[3] = 0;   /* should be already */
    3680 
    3681         ICE1712_STDSP24_SET_ADDR(ice->hoontech_boxbits, 0);
    3682         ICE1712_STDSP24_CLOCK(ice->hoontech_boxbits, 0, 1);
    3683         ICE1712_STDSP24_0_BOX(ice->hoontech_boxbits, 0);
    3684         ICE1712_STDSP24_0_DAREAR(ice->hoontech_boxbits, 0);
    3685 
    3686         ICE1712_STDSP24_SET_ADDR(ice->hoontech_boxbits, 1);
    3687         ICE1712_STDSP24_CLOCK(ice->hoontech_boxbits, 1, 1);
    3688         ICE1712_STDSP24_1_CHN1(ice->hoontech_boxbits, 1);
    3689         ICE1712_STDSP24_1_CHN2(ice->hoontech_boxbits, 1);
    3690         ICE1712_STDSP24_1_CHN3(ice->hoontech_boxbits, 1);
    3691        
    3692         ICE1712_STDSP24_SET_ADDR(ice->hoontech_boxbits, 2);
    3693         ICE1712_STDSP24_CLOCK(ice->hoontech_boxbits, 2, 1);
    3694         ICE1712_STDSP24_2_CHN4(ice->hoontech_boxbits, 1);
    3695         ICE1712_STDSP24_2_MIDIIN(ice->hoontech_boxbits, 1);
    3696         ICE1712_STDSP24_2_MIDI1(ice->hoontech_boxbits, 0);
    3697 
    3698         ICE1712_STDSP24_SET_ADDR(ice->hoontech_boxbits, 3);
    3699         ICE1712_STDSP24_CLOCK(ice->hoontech_boxbits, 3, 1);
    3700         ICE1712_STDSP24_3_MIDI2(ice->hoontech_boxbits, 0);
    3701         ICE1712_STDSP24_3_MUTE(ice->hoontech_boxbits, 1);
    3702         ICE1712_STDSP24_3_INSEL(ice->hoontech_boxbits, 0);
    3703 
    3704         /* let's go - activate only functions in first box */
    3705         ice->hoontech_config = 0;
    3706                             /* ICE1712_STDSP24_MUTE |
    3707                                ICE1712_STDSP24_INSEL |
    3708                                ICE1712_STDSP24_DAREAR; */
    3709         ice->hoontech_boxconfig[0] = ICE1712_STDSP24_BOX_CHN1 |
    3710                                      ICE1712_STDSP24_BOX_CHN2 |
    3711                                      ICE1712_STDSP24_BOX_CHN3 |
    3712                                      ICE1712_STDSP24_BOX_CHN4 |
    3713                                      ICE1712_STDSP24_BOX_MIDI1 |
    3714                                      ICE1712_STDSP24_BOX_MIDI2;
    3715         ice->hoontech_boxconfig[1] =
    3716         ice->hoontech_boxconfig[2] =
    3717         ice->hoontech_boxconfig[3] = 0;
    3718         snd_ice1712_stdsp24_darear(ice, (ice->hoontech_config & ICE1712_STDSP24_DAREAR) ? 1 : 0);
    3719         snd_ice1712_stdsp24_mute(ice, (ice->hoontech_config & ICE1712_STDSP24_MUTE) ? 1 : 0);
    3720         snd_ice1712_stdsp24_insel(ice, (ice->hoontech_config & ICE1712_STDSP24_INSEL) ? 1 : 0);
    3721         for (box = 0; box < 4; box++) {
    3722                 for (chn = 0; chn < 4; chn++)
    3723                         snd_ice1712_stdsp24_box_channel(ice, box, chn, (ice->hoontech_boxconfig[box] & (1 << chn)) ? 1 : 0);
    3724                 snd_ice1712_stdsp24_box_midi(ice, box,
    3725                                 (ice->hoontech_boxconfig[box] & ICE1712_STDSP24_BOX_MIDI1) ? 1 : 0,
    3726                                 (ice->hoontech_boxconfig[box] & ICE1712_STDSP24_BOX_MIDI2) ? 1 : 0);
    3727         }
    3728 }
     2056
    37292057
    37302058static int __devinit snd_ice1712_chip_init(ice1712_t *ice)
    37312059{
    3732         int err, has_i2c = 0;
    3733 
    37342060        outb(ICE1712_RESET | ICE1712_NATIVE, ICEREG(ice, CONTROL));
    37352061        udelay(200);
     
    37622088        }
    37632089
    3764         /* determine I2C, DACs and ADCs */
    3765         switch (ice->eeprom.subvendor) {
    3766         case ICE1712_SUBDEVICE_AUDIOPHILE:
    3767                 ice->ak4528 = 1;
    3768                 /* follow thru */
    3769         case ICE1712_SUBDEVICE_EWX2496:
    3770                 has_i2c = 1;
    3771                 ice->num_adcs = ice->num_dacs = ice->num_total_dacs = 2;
    3772                 break; 
    3773         case ICE1712_SUBDEVICE_DELTA44:
    3774         case ICE1712_SUBDEVICE_DELTA66:
    3775                 ice->num_adcs = ice->num_dacs = ice->num_total_dacs = 4;
    3776                 if (ice->omni)
    3777                         ice->num_total_dacs = 8;
    3778                 break;
    3779         case ICE1712_SUBDEVICE_EWS88MT:
    3780                 has_i2c = 1;
    3781                 /* follow thru */
    3782         case ICE1712_SUBDEVICE_DELTA1010:
    3783         case ICE1712_SUBDEVICE_STDSP24:
    3784                 ice->num_adcs = ice->num_dacs = ice->num_total_dacs = 8;
    3785                 break;
    3786         case ICE1712_SUBDEVICE_EWS88D:
    3787                 has_i2c = 1;
    3788                 break;
    3789         case ICE1712_SUBDEVICE_DMX6FIRE:
    3790                 has_i2c = 1;
    3791                 ice->num_adcs = ice->num_dacs = ice->num_total_dacs = 6;
    3792                 break;
    3793         }
    3794 
    3795         if (has_i2c) {
    3796                 if ((err = snd_i2c_bus_create(ice->card, "ICE1712 GPIO 1", NULL, &ice->i2c)) < 0) {
    3797                         snd_printk("unable to create I2C bus\n");
    3798                         return err;
    3799                 }
    3800                 ice->i2c->private_data = ice;
    3801                 switch (ice->eeprom.subvendor) {
    3802                 case ICE1712_SUBDEVICE_AUDIOPHILE:
    3803                         ice->i2c->ops = &ap_cs8427_i2c_ops;
    3804                         break;
    3805                 case ICE1712_SUBDEVICE_EWX2496:
    3806                 case ICE1712_SUBDEVICE_EWS88MT:
    3807                 case ICE1712_SUBDEVICE_EWS88D:
    3808                 case ICE1712_SUBDEVICE_DMX6FIRE:
    3809                         ice->i2c->hw_ops.bit = &snd_ice1712_ewx_cs8427_bit_ops;
    3810                         break;
    3811                 }
    3812                 switch (ice->eeprom.subvendor) {
    3813                 case ICE1712_SUBDEVICE_AUDIOPHILE:
    3814                 case ICE1712_SUBDEVICE_EWX2496:
    3815                         if ((err = snd_cs8427_create(ice->i2c, CS8427_BASE_ADDR, &ice->cs8427)) < 0) {
    3816                                 snd_printk("CS8427 initialization failed\n");
    3817                                 return err;
    3818                         }
    3819                         break;
    3820                 case ICE1712_SUBDEVICE_DMX6FIRE:
    3821 #if 0 // XXX not working yet
    3822                         if ((err = snd_i2c_device_create(ice->i2c, "PCF9554", 0x40>>1, &ice->pcf8575)) < 0)
    3823                                 return err;
    3824                         if ((err = snd_cs8427_create(ice->i2c, 0x11, &ice->cs8427)) < 0) {
    3825                                 snd_printk("CS8427 initialization failed\n");
    3826                                 return err;
    3827                         }
    3828 #endif // XXX not working yet
    3829                         break;
    3830                 case ICE1712_SUBDEVICE_EWS88MT:
    3831                         if ((err = snd_i2c_device_create(ice->i2c, "CS8404", ICE1712_EWS88MT_CS8404_ADDR, &ice->cs8404)) < 0)
    3832                                 return err;
    3833                         if ((err = snd_i2c_device_create(ice->i2c, "PCF8574 (1st)", ICE1712_EWS88MT_INPUT_ADDR, &ice->pcf8574[0])) < 0)
    3834                                 return err;
    3835                         if ((err = snd_i2c_device_create(ice->i2c, "PCF8574 (2nd)", ICE1712_EWS88MT_OUTPUT_ADDR, &ice->pcf8574[1])) < 0)
    3836                                 return err;
    3837                         break;
    3838                 case ICE1712_SUBDEVICE_EWS88D:
    3839                         if ((err = snd_i2c_device_create(ice->i2c, "PCF8575", ICE1712_EWS88D_PCF_ADDR, &ice->pcf8575)) < 0)
    3840                                 return err;
    3841                         break;
    3842                 }
    3843         }
    3844         /* second stage of initialization, analog parts and others */
    3845         switch (ice->eeprom.subvendor) {
    3846         case ICE1712_SUBDEVICE_EWS88MT:
    3847                 /* Check if the front module is connected */
    3848                 if ((err = snd_ice1712_ews88mt_chip_select(ice, 0x0f)) < 0)
    3849                         return err;
    3850                 /* Fall through */
    3851         case ICE1712_SUBDEVICE_DELTA66:
    3852         case ICE1712_SUBDEVICE_DELTA44:
    3853         case ICE1712_SUBDEVICE_AUDIOPHILE:
    3854         case ICE1712_SUBDEVICE_EWX2496:
    3855         case ICE1712_SUBDEVICE_DMX6FIRE:
    3856                 snd_ice1712_ak4524_init(ice);
    3857                 break;
    3858         case ICE1712_SUBDEVICE_STDSP24:
    3859                 snd_ice1712_stdsp24_init(ice);
    3860                 break;
    3861         }
    3862         switch (ice->eeprom.subvendor) {
    3863         case ICE1712_SUBDEVICE_AUDIOPHILE:
    3864                 ice->cs8427_ops = &snd_ice1712_ap_cs8427_ops;
    3865                 snd_ice1712_cs8427_init(ice);
    3866                 break;
    3867         case ICE1712_SUBDEVICE_EWX2496:
    3868                 ice->cs8427_ops = &snd_ice1712_ewx_cs8427_ops;
    3869                 snd_ice1712_cs8427_init(ice);
    3870                 break;
    3871         case ICE1712_SUBDEVICE_DELTA1010:
    3872         case ICE1712_SUBDEVICE_DELTADIO2496:
    3873         case ICE1712_SUBDEVICE_DELTA66:
    3874                 /* Set spdif defaults */
    3875                 snd_ice1712_delta_cs8403_spdif_write(ice, ice->cs8403_spdif_bits);
    3876                 break;
    3877         }
    3878         switch (ice->eeprom.subvendor) {
    3879         case ICE1712_SUBDEVICE_EWS88MT:
    3880         case ICE1712_SUBDEVICE_EWS88D:
    3881                 /* Set spdif defaults */
    3882                 snd_ice1712_ews_cs8404_spdif_write(ice, ice->cs8403_spdif_bits);
    3883                 break;
    3884         }
    3885         return 0;
    3886 }
    3887 
    3888 static int __init snd_ice1712_build_controls(ice1712_t *ice)
     2090        return 0;
     2091}
     2092
     2093
     2094int __devinit snd_ice1712_spdif_build_controls(ice1712_t *ice)
     2095{
     2096        int err;
     2097        snd_kcontrol_t *kctl;
     2098
     2099        snd_assert(ice->pcm_pro != NULL, return -EIO);
     2100        err = snd_ctl_add(ice->card, kctl = snd_ctl_new1(&snd_ice1712_spdif_default, ice));
     2101        if (err < 0)
     2102                return err;
     2103        kctl->id.device = ice->pcm_pro->device;
     2104        err = snd_ctl_add(ice->card, kctl = snd_ctl_new1(&snd_ice1712_spdif_maskc, ice));
     2105        if (err < 0)
     2106                return err;
     2107        kctl->id.device = ice->pcm_pro->device;
     2108        err = snd_ctl_add(ice->card, kctl = snd_ctl_new1(&snd_ice1712_spdif_maskp, ice));
     2109        if (err < 0)
     2110                return err;
     2111        kctl->id.device = ice->pcm_pro->device;
     2112        err = snd_ctl_add(ice->card, kctl = snd_ctl_new1(&snd_ice1712_spdif_stream, ice));
     2113        if (err < 0)
     2114                return err;
     2115        kctl->id.device = ice->pcm_pro->device;
     2116        ice->spdif.stream_ctl = kctl;
     2117        return 0;
     2118}
     2119
     2120
     2121static int __devinit snd_ice1712_build_controls(ice1712_t *ice)
    38892122{
    38902123        unsigned int idx;
     
    39222155        if (err < 0)
    39232156                return err;
    3924         switch (ice->eeprom.subvendor) {
    3925         case ICE1712_SUBDEVICE_DELTA1010:
    3926                 err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_delta1010_wordclock_select, ice));
    3927                 if (err < 0)
    3928                         return err;
    3929                 err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_delta1010_wordclock_status, ice));
    3930                 if (err < 0)
    3931                         return err;
    3932                 break;
    3933         case ICE1712_SUBDEVICE_DELTADIO2496:
    3934                 err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_deltadio2496_spdif_in_select, ice));
    3935                 if (err < 0)
    3936                         return err;
    3937                 break;
    3938         }
    3939         switch (ice->eeprom.subvendor) {
    3940         case ICE1712_SUBDEVICE_DELTA1010:
    3941         case ICE1712_SUBDEVICE_DELTADIO2496:
    3942         case ICE1712_SUBDEVICE_DELTA66:
    3943         case ICE1712_SUBDEVICE_AUDIOPHILE:
    3944         case ICE1712_SUBDEVICE_EWX2496:
    3945         case ICE1712_SUBDEVICE_EWS88MT:
    3946         case ICE1712_SUBDEVICE_EWS88D:
    3947                 snd_assert(ice->pcm_pro != NULL, return -EIO);
    3948                 err = snd_ctl_add(ice->card, kctl = snd_ctl_new1(&snd_ice1712_spdif_default, ice));
    3949                 if (err < 0)
    3950                         return err;
    3951                 kctl->id.device = ice->pcm_pro->device;
    3952                 err = snd_ctl_add(ice->card, kctl = snd_ctl_new1(&snd_ice1712_spdif_maskc, ice));
    3953                 if (err < 0)
    3954                         return err;
    3955                 kctl->id.device = ice->pcm_pro->device;
    3956                 err = snd_ctl_add(ice->card, kctl = snd_ctl_new1(&snd_ice1712_spdif_maskp, ice));
    3957                 if (err < 0)
    3958                         return err;
    3959                 kctl->id.device = ice->pcm_pro->device;
    3960                 err = snd_ctl_add(ice->card, kctl = snd_ctl_new1(&snd_ice1712_spdif_stream, ice));
    3961                 if (err < 0)
    3962                         return err;
    3963                 kctl->id.device = ice->pcm_pro->device;
    3964                 ice->spdif_stream_ctl = kctl;
    3965                 break;
    3966         }
    3967         switch (ice->eeprom.subvendor) {
    3968         case ICE1712_SUBDEVICE_DELTA1010:
    3969         case ICE1712_SUBDEVICE_DELTADIO2496:
    3970         case ICE1712_SUBDEVICE_DELTA66:
    3971                 err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_delta_spdif_in_status, ice));
    3972                 if (err < 0)
    3973                         return err;
    3974                 break;
    3975         }
    3976         switch (ice->eeprom.subvendor) {
    3977         case ICE1712_SUBDEVICE_EWX2496:
    3978         case ICE1712_SUBDEVICE_AUDIOPHILE:
    3979         case ICE1712_SUBDEVICE_DELTA44:
    3980         case ICE1712_SUBDEVICE_DELTA66:
    3981         case ICE1712_SUBDEVICE_EWS88MT:
    3982         case ICE1712_SUBDEVICE_DMX6FIRE:
    3983                 for (idx = 0; idx < ice->num_dacs; ++idx) {
    3984                         snd_kcontrol_t ctl;
    3985                         memset(&ctl, 0, sizeof(ctl));
    3986                         strcpy(ctl.id.name, "DAC Volume");
    3987                         ctl.id.index = idx;
    3988                         ctl.id.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
    3989                         ctl.info = snd_ice1712_ak4524_volume_info;
    3990                         ctl.access = SNDRV_CTL_ELEM_ACCESS_READ|SNDRV_CTL_ELEM_ACCESS_WRITE;
    3991                         ctl.get = snd_ice1712_ak4524_volume_get;
    3992                         ctl.put = snd_ice1712_ak4524_volume_put;
    3993                         if (ice->ak4528)
    3994                                 ctl.private_value = (idx / 2) * 8 + (idx % 2) + 4; /* register 4 & 5 */
    3995                         else
    3996                                 ctl.private_value = (idx / 2) * 8 + (idx % 2) + 6; /* register 6 & 7 */
    3997                         ctl.private_data = ice;
    3998                         if ((err = snd_ctl_add(ice->card, snd_ctl_new(&ctl))) < 0)
    3999                                 return err;
    4000                 }
    4001                 for (idx = 0; idx < ice->num_adcs && !ice->ak4528; ++idx) {
    4002                         snd_kcontrol_t ctl;
    4003                         memset(&ctl, 0, sizeof(ctl));
    4004                         strcpy(ctl.id.name, "ADC Volume");
    4005                         ctl.id.index = idx;
    4006                         ctl.id.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
    4007                         ctl.info = snd_ice1712_ak4524_volume_info;
    4008                         ctl.access = SNDRV_CTL_ELEM_ACCESS_READ|SNDRV_CTL_ELEM_ACCESS_WRITE;
    4009                         ctl.get = snd_ice1712_ak4524_volume_get;
    4010                         ctl.put = snd_ice1712_ak4524_volume_put;
    4011                         ctl.private_value = (idx / 2) * 8 + (idx % 2) + 4; /* register 4 & 5 */
    4012                         ctl.private_data = ice;
    4013                         if ((err = snd_ctl_add(ice->card, snd_ctl_new(&ctl))) < 0)
    4014                                 return err;
    4015                         memset(&ctl, 0, sizeof(ctl));
    4016                         strcpy(ctl.id.name, "IPGA Analog Capture Volume");
    4017                         ctl.id.index = idx;
    4018                         ctl.id.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
    4019                         ctl.info = snd_ice1712_ak4524_ipga_gain_info;
    4020                         ctl.access = SNDRV_CTL_ELEM_ACCESS_READ|SNDRV_CTL_ELEM_ACCESS_WRITE;
    4021                         ctl.get = snd_ice1712_ak4524_ipga_gain_get;
    4022                         ctl.put = snd_ice1712_ak4524_ipga_gain_put;
    4023                         ctl.private_value = (idx / 2) * 8 + (idx % 2) + 4; /* register 4 & 5 */
    4024                         ctl.private_data = ice;
    4025                         if ((err = snd_ctl_add(ice->card, snd_ctl_new(&ctl))) < 0)
    4026                                 return err;
    4027                 }
    4028                 for (idx = 0; idx < ice->num_dacs/2; idx++) {
    4029                         snd_kcontrol_t ctl;
    4030                         memset(&ctl, 0, sizeof(ctl));
    4031                         strcpy(ctl.id.name, "Deemphasis");
    4032                         ctl.id.index = idx;
    4033                         ctl.id.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
    4034                         ctl.info = snd_ice1712_ak4524_deemphasis_info;
    4035                         ctl.access = SNDRV_CTL_ELEM_ACCESS_READ|SNDRV_CTL_ELEM_ACCESS_WRITE;
    4036                         ctl.get = snd_ice1712_ak4524_deemphasis_get;
    4037                         ctl.put = snd_ice1712_ak4524_deemphasis_put;
    4038                         ctl.private_data = ice;
    4039                         if ((err = snd_ctl_add(ice->card, snd_ctl_new(&ctl))) < 0)
    4040                                 return err;
    4041                 }
    4042                 break;
    4043         }
    4044         switch (ice->eeprom.subvendor) {
    4045         case ICE1712_SUBDEVICE_EWX2496:
    4046                 err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_ewx_input_sense, ice));
    4047                 if (err < 0)
    4048                         return err;
    4049                 err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_ewx_output_sense, ice));
    4050                 if (err < 0)
    4051                         return err;
    4052                 break;
    4053         case ICE1712_SUBDEVICE_EWS88MT:
    4054                 for (idx = 0; idx < 8; idx++) {
    4055                         kctl = snd_ctl_new1(&snd_ice1712_ews88mt_input_sense, ice);
    4056                         kctl->id.index = idx;
    4057                         err = snd_ctl_add(ice->card, kctl);
    4058                         if (err < 0)
    4059                                 return err;
    4060                 }
    4061                 err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_ews88mt_output_sense, ice));
    4062                 if (err < 0)
    4063                         return err;
    4064                 break;
    4065         case ICE1712_SUBDEVICE_EWS88D:
    4066                 for (idx = 0; idx < sizeof(snd_ice1712_ews88d_controls)/sizeof(snd_ice1712_ews88d_controls[0]); idx++) {
    4067                         err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_ews88d_controls[idx], ice));
    4068                 if (err < 0)
    4069                         return err;
    4070                 }
    4071                 break;
    4072         case ICE1712_SUBDEVICE_DMX6FIRE:
    4073 #if 0 // XXX not working yet
    4074                 err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_6fire_led, ice));
    4075                 if (err < 0)
    4076                         return err;
    4077 #endif
    4078                 break;
    4079         }
    4080 
    40812157        return 0;
    40822158}
     
    41512227        spin_lock_init(&ice->reg_lock);
    41522228        init_MUTEX(&ice->gpio_mutex);
    4153         ice->cs8403_spdif_bits =
    4154         ice->cs8403_spdif_stream_bits = (0x01 | /* consumer format */
     2229        ice->spdif.cs8403_bits =
     2230                ice->spdif.cs8403_stream_bits = (0x01 | /* consumer format */
    41552231                                         0x10 | /* no emphasis */
    41562232                                         0x20); /* PCM encoder/decoder */
     
    42192295}
    42202296
     2297
     2298/*
     2299 *
     2300 * Registraton
     2301 *
     2302 */
     2303
     2304static struct snd_ice1712_card_info no_matched __devinitdata;
     2305
     2306static struct snd_ice1712_card_info *card_tables[] __devinitdata = {
     2307        snd_ice1712_hoontech_cards,
     2308        snd_ice1712_delta_cards,
     2309        snd_ice1712_ews_cards,
     2310        0,
     2311};
     2312
     2313
    42212314static int __devinit snd_ice1712_probe(struct pci_dev *pci,
    4222                                     const struct pci_device_id *id)
     2315                                       const struct pci_device_id *pci_id)
    42232316{
    42242317        static int dev;
     
    42262319        ice1712_t *ice;
    42272320        int pcm_dev = 0, err;
     2321        struct snd_ice1712_card_info **tbl, *c;
    42282322
    42292323        if (dev >= SNDRV_CARDS)
    42302324                return -ENODEV;
    4231                 if (!snd_enable[dev]) {
     2325        if (!enable[dev]) {
    42322326                        dev++;
    42332327                        return -ENOENT;
    42342328                }
    42352329
    4236         card = snd_card_new(snd_index[dev], snd_id[dev], THIS_MODULE, 0);
     2330        card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0);
    42372331        if (card == NULL)
    42382332                return -ENOMEM;
    42392333
    4240         if ((err = snd_ice1712_create(card, pci, snd_omni[dev], &ice)) < 0) {
     2334        strcpy(card->driver, "ICE1712");
     2335        strcpy(card->shortname, "ICEnsemble ICE1712");
     2336       
     2337        if ((err = snd_ice1712_create(card, pci, omni[dev], &ice)) < 0) {
    42412338                snd_card_free(card);
    42422339                return err;
    42432340        }
     2341
     2342        for (tbl = card_tables; *tbl; tbl++) {
     2343                for (c = *tbl; c->subvendor; c++) {
     2344                        if (c->subvendor == ice->eeprom.subvendor) {
     2345                                strcpy(card->shortname, c->name);
     2346                                if (c->chip_init) {
     2347                                        if ((err = c->chip_init(ice)) < 0) {
     2348                                                snd_card_free(card);
     2349                                                return err;
     2350                                        }
     2351                                }
     2352                                goto __found;
     2353                        }
     2354                }
     2355        }
     2356        c = &no_matched;
     2357 __found:
    42442358
    42452359        if ((err = snd_ice1712_pcm_profi(ice, pcm_dev++, NULL)) < 0) {
     
    42642378        }
    42652379
     2380        if (c->build_controls) {
     2381                if ((err = c->build_controls(ice)) < 0) {
     2382                        snd_card_free(card);
     2383                        return err;
     2384                }
     2385        }
     2386
    42662387        if (!(ice->eeprom.codec & ICE1712_CFG_NO_CON_AC97))
    42672388                if ((err = snd_ice1712_pcm_ds(ice, pcm_dev++, NULL)) < 0) {
     
    42702391                }
    42712392
    4272         strcpy(card->driver, "ICE1712");
    4273         strcpy(card->shortname, "ICEnsemble ICE1712");
    4274        
    4275         switch (ice->eeprom.subvendor) {
    4276         case ICE1712_SUBDEVICE_STDSP24:
    4277                 strcpy(card->shortname, "Hoontech SoundTrack Audio DSP24");
    4278                 break;
    4279         case ICE1712_SUBDEVICE_DELTA1010:
    4280                 strcpy(card->shortname, "M Audio Delta 1010");
    4281                 break;
    4282         case ICE1712_SUBDEVICE_DELTADIO2496:
    4283                 strcpy(card->shortname, "M Audio Delta DiO 2496");
    4284                 goto __no_mpu401;
    4285         case ICE1712_SUBDEVICE_DELTA66:
    4286                 strcpy(card->shortname, "M Audio Delta 66");
    4287                 goto __no_mpu401;
    4288         case ICE1712_SUBDEVICE_DELTA44:
    4289                 strcpy(card->shortname, "M Audio Delta 44");
    4290                 goto __no_mpu401;
    4291         case ICE1712_SUBDEVICE_AUDIOPHILE:
    4292                 strcpy(card->shortname, "M Audio Audiophile 24/96");
    4293                 break;
    4294         case ICE1712_SUBDEVICE_DELTA1010LT:
    4295                 strcpy(card->shortname, "M Audio Delta 1010LT");
    4296                 break;
    4297         case ICE1712_SUBDEVICE_EWX2496:
    4298                 strcpy(card->shortname, "TerraTec EWX 24/96");
    4299                 break;
    4300         case ICE1712_SUBDEVICE_EWS88MT:
    4301                 strcpy(card->shortname, "TerraTec EWS 88MT");
    4302                 break;
    4303         case ICE1712_SUBDEVICE_EWS88D:
    4304                 strcpy(card->shortname, "TerraTec EWS 88D");
    4305                 break;
    4306         case ICE1712_SUBDEVICE_DMX6FIRE:
    4307                 strcpy(card->shortname, "TerraTec DMX 6Fire");
    4308                 break;
    4309         }
    4310 
     2393        if (! c->no_mpu401) {
    43112394        if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_ICE1712,
    43122395                                       ICEREG(ice, MPU1_CTRL), 1,
     
    43252408                        return err;
    43262409                }
    4327 
    4328       __no_mpu401:
     2410        }
     2411
    43292412        sprintf(card->longname, "%s at 0x%lx, irq %i",
    43302413                card->shortname, ice->port, ice->irq);
     
    43752458#ifndef MODULE
    43762459
    4377 /* format is: snd-ice1712=snd_enable,snd_index,snd_id */
     2460/* format is: snd-ice1712=enable,index,id */
    43782461
    43792462static int __init alsa_card_ice1712_setup(char *str)
     
    43832466        if (nr_dev >= SNDRV_CARDS)
    43842467                return 0;
    4385         (void)(get_option(&str,&snd_enable[nr_dev]) == 2 &&
    4386                get_option(&str,&snd_index[nr_dev]) == 2 &&
    4387                get_id(&str,&snd_id[nr_dev]) == 2);
     2468        (void)(get_option(&str,&enable[nr_dev]) == 2 &&
     2469               get_option(&str,&index[nr_dev]) == 2 &&
     2470               get_id(&str,&id[nr_dev]) == 2);
    43882471        nr_dev++;
    43892472        return 1;
  • GPL/branches/alsa-resync1/alsa-kernel/pci/korg1212/korg1212.c

    r210 r212  
    388388MODULE_DEVICES("{{KORG,korg1212}}");
    389389
    390 static int snd_index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;     /* Index 0-MAX */
    391 static char *snd_id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;      /* ID for this card */
    392 static int snd_enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */
    393 
    394 MODULE_PARM(snd_index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
    395 MODULE_PARM_DESC(snd_index, "Index value for Korg 1212 soundcard.");
    396 MODULE_PARM_SYNTAX(snd_index, SNDRV_INDEX_DESC);
    397 MODULE_PARM(snd_id, "1-" __MODULE_STRING(SNDRV_CARDS) "s");
    398 MODULE_PARM_DESC(snd_id, "ID string for Korg 1212 soundcard.");
    399 MODULE_PARM_SYNTAX(snd_id, SNDRV_ID_DESC);
    400 MODULE_PARM(snd_enable, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
    401 MODULE_PARM_DESC(snd_enable, "Enable Korg 1212 soundcard.");
    402 MODULE_PARM_SYNTAX(snd_enable, SNDRV_ENABLE_DESC);
     390static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;     /* Index 0-MAX */
     391static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;          /* ID for this card */
     392static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */
     393
     394MODULE_PARM(index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
     395MODULE_PARM_DESC(index, "Index value for Korg 1212 soundcard.");
     396MODULE_PARM_SYNTAX(index, SNDRV_INDEX_DESC);
     397MODULE_PARM(id, "1-" __MODULE_STRING(SNDRV_CARDS) "s");
     398MODULE_PARM_DESC(id, "ID string for Korg 1212 soundcard.");
     399MODULE_PARM_SYNTAX(id, SNDRV_ID_DESC);
     400MODULE_PARM(enable, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
     401MODULE_PARM_DESC(enable, "Enable Korg 1212 soundcard.");
     402MODULE_PARM_SYNTAX(enable, SNDRV_ENABLE_DESC);
    403403MODULE_AUTHOR("Haroldo Gamal <gamal@alternex.com.br>");
    404404
     
    22532253static int __devinit
    22542254snd_korg1212_probe(struct pci_dev *pci,
    2255                 const struct pci_device_id *id)
     2255                const struct pci_device_id *pci_id)
    22562256{
    22572257        static int dev;
     
    22632263                return -ENODEV;
    22642264        }
    2265         if (!snd_enable[dev]) {
     2265        if (!enable[dev]) {
    22662266                dev++;
    22672267                return -ENOENT;
    22682268        }
    2269         if ((card = snd_card_new(snd_index[dev], snd_id[dev], THIS_MODULE,
     2269        if ((card = snd_card_new(index[dev], id[dev], THIS_MODULE,
    22702270                                 sizeof(korg1212_t))) == NULL)
    22712271                return -ENOMEM;
     
    23352335#ifndef MODULE
    23362336
    2337 /* format is: snd-korg1212=snd_enable,snd_index,snd_id */
     2337/* format is: snd-korg1212=enable,index,id */
    23382338
    23392339static int __init alsa_card_korg1212_setup(char *str)
     
    23432343        if (nr_dev >= SNDRV_CARDS)
    23442344                return 0;
    2345         (void)(get_option(&str,&snd_enable[nr_dev]) == 2 &&
    2346                get_option(&str,&snd_index[nr_dev]) == 2 &&
    2347                get_id(&str,&snd_id[nr_dev]) == 2);
     2345        (void)(get_option(&str,&enable[nr_dev]) == 2 &&
     2346               get_option(&str,&index[nr_dev]) == 2 &&
     2347               get_id(&str,&id[nr_dev]) == 2);
    23482348        nr_dev++;
    23492349        return 1;
  • GPL/branches/alsa-resync1/alsa-kernel/pci/maestro3.c

    r207 r212  
    17681768static snd_pcm_hardware_t snd_m3_playback =
    17691769{
    1770     /*  info:             */    (SNDRV_PCM_INFO_MMAP |
     1770        .info =                 (SNDRV_PCM_INFO_MMAP |
    17711771                                 SNDRV_PCM_INFO_INTERLEAVED |
    17721772                                 SNDRV_PCM_INFO_MMAP_VALID |
     
    17741774                                 /*SNDRV_PCM_INFO_PAUSE |*/
    17751775                                 SNDRV_PCM_INFO_RESUME),
    1776                                  /*     formats:          */    SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE,
    1777                                  /*     rates:            */    SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_48000,
    1778                                  /*     rate_min:         */    8000,
    1779                                  /*     rate_max:         */    48000,
    1780                                  /*     channels_min:     */    1,
    1781                                  /*     channels_max:     */    2,
    1782                                  /*     buffer_bytes_max:  */   (512*1024),
    1783                                  /*     period_bytes_min:  */   64,
    1784                                  /*     period_bytes_max:  */   (512*1024),
    1785                                  /*     periods_min:      */    1,
    1786                                  /*     periods_max:      */    1024,
    1787                                  0
     1776        .formats =              SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE,
     1777        .rates =                SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_48000,
     1778        .rate_min =             8000,
     1779        .rate_max =             48000,
     1780        .channels_min =         1,
     1781        .channels_max =         2,
     1782        .buffer_bytes_max =     (512*1024),
     1783        .period_bytes_min =     64,
     1784        .period_bytes_max =     (512*1024),
     1785        .periods_min =          1,
     1786        .periods_max =          1024,
    17881787};
    17891788
    17901789static snd_pcm_hardware_t snd_m3_capture =
    17911790{
    1792     /*  info:             */    (SNDRV_PCM_INFO_MMAP |
     1791        .info =                 (SNDRV_PCM_INFO_MMAP |
    17931792                                 SNDRV_PCM_INFO_INTERLEAVED |
    17941793                                 SNDRV_PCM_INFO_MMAP_VALID |
     
    17961795                                 /*SNDRV_PCM_INFO_PAUSE |*/
    17971796                                 SNDRV_PCM_INFO_RESUME),
    1798                                  /*     formats:          */    SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE,
    1799                                  /*     rates:            */    SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_48000,
    1800                                  /*     rate_min:         */    8000,
    1801                                  /*     rate_max:         */    48000,
    1802                                  /*     channels_min:     */    1,
    1803                                  /*     channels_max:     */    2,
    1804                                  /*     buffer_bytes_max:  */   (512*1024),
    1805                                  /*     period_bytes_min:  */   64,
    1806                                  /*     period_bytes_max:  */   (512*1024),
    1807                                  /*     periods_min:      */    1,
    1808                                  /*     periods_max:      */    1024,
    1809                                  0
     1797        .formats =              SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE,
     1798        .rates =                SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_48000,
     1799        .rate_min =             8000,
     1800        .rate_max =             48000,
     1801        .channels_min =         1,
     1802        .channels_max =         2,
     1803        .buffer_bytes_max =     (512*1024),
     1804        .period_bytes_min =     64,
     1805        .period_bytes_max =     (512*1024),
     1806        .periods_min =          1,
     1807        .periods_max =          1024,
    18101808};
    18111809
     
    19231921
    19241922static snd_pcm_ops_t snd_m3_playback_ops = {
    1925     snd_m3_playback_open,
    1926     snd_m3_playback_close,
    1927     snd_pcm_lib_ioctl,
    1928     snd_m3_pcm_hw_params,
    1929     snd_m3_pcm_hw_free,
    1930     snd_m3_pcm_prepare,
    1931     snd_m3_pcm_trigger,
    1932     snd_m3_pcm_pointer,0,0
     1923        .open =         snd_m3_playback_open,
     1924        .close =        snd_m3_playback_close,
     1925        .ioctl =        snd_pcm_lib_ioctl,
     1926        .hw_params =    snd_m3_pcm_hw_params,
     1927        .hw_free =      snd_m3_pcm_hw_free,
     1928        .prepare =      snd_m3_pcm_prepare,
     1929        .trigger =      snd_m3_pcm_trigger,
     1930        .pointer =      snd_m3_pcm_pointer,
    19331931};
    19341932
    19351933static snd_pcm_ops_t snd_m3_capture_ops = {
    1936     snd_m3_capture_open,
    1937     snd_m3_capture_close,
    1938     snd_pcm_lib_ioctl,
    1939     snd_m3_pcm_hw_params,
    1940     snd_m3_pcm_hw_free,
    1941     snd_m3_pcm_prepare,
    1942     snd_m3_pcm_trigger,
    1943     snd_m3_pcm_pointer,0,0
     1934        .open =         snd_m3_capture_open,
     1935        .close =        snd_m3_capture_close,
     1936        .ioctl =        snd_pcm_lib_ioctl,
     1937        .hw_params =    snd_m3_pcm_hw_params,
     1938        .hw_free =      snd_m3_pcm_hw_free,
     1939        .prepare =      snd_m3_pcm_prepare,
     1940        .trigger =      snd_m3_pcm_trigger,
     1941        .pointer =      snd_m3_pcm_pointer,
    19441942};
    19451943
  • GPL/branches/alsa-resync1/alsa-kernel/pci/makefile.os2

    r32 r212  
    3535FILE2    = es1968.obj intel8x0.obj maestro3.obj via82xx.obj als4000.obj
    3636FILE3    = fm801.obj atiixp.obj bt87x.obj
    37 #ice1712.obj fm801.obj rme96.obj sonicvibes.obj
     37# rme96.obj sonicvibes.obj
    3838FILE4    =
    3939FILE5    =
     
    9191    @wmake $(NMAKEOPTS)
    9292    @cd ..
     93#    @echo BUILDING ice1712
     94#    @cd ice1712
     95#    @wmake $(NMAKEOPTS)
     96#    @cd ..
    9397##    @echo BUILDING korg1212
    9498##    @cd korg1212
  • GPL/branches/alsa-resync1/alsa-kernel/pci/rme96.c

    r210 r212  
    5252                "{RME,Digi96/8 PAD}}");
    5353
    54 static int snd_index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;  /* Index 0-MAX */
    55 static char *snd_id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;   /* ID for this card */
    56 static int snd_enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE;      /* Enable this card */
    57 
    58 MODULE_PARM(snd_index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
    59 MODULE_PARM_DESC(snd_index, "Index value for RME Digi96 soundcard.");
    60 MODULE_PARM_SYNTAX(snd_index, SNDRV_INDEX_DESC);
    61 MODULE_PARM(snd_id, "1-" __MODULE_STRING(SNDRV_CARDS) "s");
    62 MODULE_PARM_DESC(snd_id, "ID string for RME Digi96 soundcard.");
    63 MODULE_PARM_SYNTAX(snd_id, SNDRV_ID_DESC);
    64 MODULE_PARM(snd_enable, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
    65 MODULE_PARM_DESC(snd_enable, "Enable RME Digi96 soundcard.");
    66 MODULE_PARM_SYNTAX(snd_enable, SNDRV_ENABLE_DESC);
    67 MODULE_AUTHOR("Anders Torger <torger@ludd.luth.se>");
     54static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;      /* Index 0-MAX */
     55static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;       /* ID for this card */
     56static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;      /* Enable this card */
     57
     58MODULE_PARM(index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
     59MODULE_PARM_DESC(index, "Index value for RME Digi96 soundcard.");
     60MODULE_PARM_SYNTAX(index, SNDRV_INDEX_DESC);
     61MODULE_PARM(id, "1-" __MODULE_STRING(SNDRV_CARDS) "s");
     62MODULE_PARM_DESC(id, "ID string for RME Digi96 soundcard.");
     63MODULE_PARM_SYNTAX(id, SNDRV_ID_DESC);
     64MODULE_PARM(enable, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
     65MODULE_PARM_DESC(enable, "Enable RME Digi96 soundcard.");
     66MODULE_PARM_SYNTAX(enable, SNDRV_ENABLE_DESC);
    6867
    6968/*
     
    16131612
    16141613        spin_lock_init(&rme96->lock);
    1615         if ((rme96->iobase = (unsigned long) ioremap(rme96->port, RME96_IO_SIZE)) == 0) {
     1614        if ((rme96->iobase = (unsigned long) ioremap_nocache(rme96->port, RME96_IO_SIZE)) == 0) {
    16161615                snd_printk("unable to remap memory region 0x%lx-0x%lx\n", rme96->port, rme96->port + RME96_IO_SIZE - 1);
    16171616                return -ENOMEM;
     
    24192418static int __devinit
    24202419snd_rme96_probe(struct pci_dev *pci,
    2421                 const struct pci_device_id *id)
     2420                const struct pci_device_id *pci_id)
    24222421{
    24232422        static int dev;
     
    24302429                return -ENODEV;
    24312430        }
    2432                 if (!snd_enable[dev]) {
     2431        if (!enable[dev]) {
    24332432                        dev++;
    24342433                        return -ENOENT;
    24352434        }
    2436         if ((card = snd_card_new(snd_index[dev], snd_id[dev], THIS_MODULE,
     2435        if ((card = snd_card_new(index[dev], id[dev], THIS_MODULE,
    24372436                                 sizeof(rme96_t))) == NULL)
    24382437                return -ENOMEM;
     
    24972496        if ((err = pci_module_init(&driver)) < 0) {
    24982497#ifdef MODULE
    2499 //              snd_printk(KERN_ERR "No RME Digi96 cards found\n");
     2498                printk(KERN_ERR "No RME Digi96 cards found\n");
    25002499#endif
    25012500                return err;
     
    25142513#ifndef MODULE
    25152514
    2516 /* format is: snd-rme96=snd_enable,snd_index,snd_id */
     2515/* format is: snd-rme96=enable,index,id */
    25172516
    25182517static int __init alsa_card_rme96_setup(char *str)
     
    25222521        if (nr_dev >= SNDRV_CARDS)
    25232522                return 0;
    2524         (void)(get_option(&str,&snd_enable[nr_dev]) == 2 &&
    2525                get_option(&str,&snd_index[nr_dev]) == 2 &&
    2526                get_id(&str,&snd_id[nr_dev]) == 2);
     2523        (void)(get_option(&str,&enable[nr_dev]) == 2 &&
     2524               get_option(&str,&index[nr_dev]) == 2 &&
     2525               get_id(&str,&id[nr_dev]) == 2);
    25272526        nr_dev++;
    25282527        return 1;
  • GPL/branches/alsa-resync1/alsa-kernel/pci/rme9652/hammerfall_mem.c

    r207 r212  
    2626    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
    2727
    28     hammerfall_mem.c,v 1.2 2002/06/19 08:52:11 perex Exp
     28    hammerfall_mem.c,v 1.4 2002/10/21 18:28:25 perex Exp
    2929
    3030
     
    5252/* export */
    5353
    54 static int snd_enable[8] = {1,1,1,1,1,1,1,1};
    55 MODULE_PARM(snd_enable, "1-" __MODULE_STRING(HAMMERFALL_CARDS) "i");
    56 MODULE_PARM_DESC(snd_enable, "Enable cards to allocate buffers for.");
     54static int enable[8] = {1,1,1,1,1,1,1,1};
     55MODULE_PARM(enable, "1-" __MODULE_STRING(HAMMERFALL_CARDS) "i");
     56MODULE_PARM_DESC(enable, "Enable cards to allocate buffers for.");
    5757
    5858MODULE_AUTHOR("Winfried Ritsch, Paul Barton-Davis <pbd@op.net>");
     
    9696   undesirable. 
    9797*/
    98 
    99 /* remove hack for pci_alloc_consistent to avoid dependecy on snd module */
    100 #ifdef HACK_PCI_ALLOC_CONSISTENT
    101 #undef pci_alloc_consistent
    102 #endif
    10398
    10499static void *hammerfall_malloc_pages(struct pci_dev *pci,
     
    245240                        continue;
    246241
    247                 if (!snd_enable[i])
     242                if (!enable[i])
    248243                        continue;
    249244
  • GPL/branches/alsa-resync1/alsa-kernel/pci/rme9652/hdsp.c

    r210 r212  
    3939#include "digiface_firmware.dat"
    4040
    41 static int snd_index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;  /* Index 0-MAX */
    42 static char *snd_id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;   /* ID for this card */
    43 static int snd_enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;  /* Enable this card */
    44 static int snd_precise_ptr[SNDRV_CARDS] = { [0 ... (SNDRV_CARDS-1)] = 0 }; /* Enable precise pointer */
    45 static int snd_line_outs_monitor[SNDRV_CARDS] = { [0 ... (SNDRV_CARDS-1)] = 0}; /* Send all inputs/playback to line outs */
    46 static int snd_force_firmware[SNDRV_CARDS] = { [0 ... (SNDRV_CARDS-1)] = 0}; /* Force firmware reload */
    47 
    48 MODULE_PARM(snd_index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
    49 MODULE_PARM_DESC(snd_index, "Index value for RME Hammerfall DSP interface.");
    50 MODULE_PARM_SYNTAX(snd_index, SNDRV_INDEX_DESC);
    51 MODULE_PARM(snd_id, "1-" __MODULE_STRING(SNDRV_CARDS) "s");
    52 MODULE_PARM_DESC(snd_id, "ID string for RME Hammerfall DSP interface.");
    53 MODULE_PARM_SYNTAX(snd_id, SNDRV_ID_DESC);
    54 MODULE_PARM(snd_enable, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
    55 MODULE_PARM_DESC(snd_enable, "Enable/disable specific Hammerfall DSP soundcards.");
    56 MODULE_PARM_SYNTAX(snd_enable, SNDRV_ENABLE_DESC);
    57 MODULE_PARM(snd_precise_ptr, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
    58 MODULE_PARM_DESC(snd_precise_ptr, "Enable precise pointer (doesn't work reliably).");
    59 MODULE_PARM_SYNTAX(snd_precise_ptr, SNDRV_ENABLED "," SNDRV_BOOLEAN_FALSE_DESC);
    60 MODULE_PARM(snd_line_outs_monitor,"1-" __MODULE_STRING(SNDRV_CARDS) "i");
    61 MODULE_PARM_DESC(snd_line_outs_monitor, "Send all input and playback streams to line outs by default.");
    62 MODULE_PARM_SYNTAX(snd_line_outs_monitor, SNDRV_ENABLED "," SNDRV_BOOLEAN_FALSE_DESC);
    63 MODULE_PARM(snd_force_firmware,"1-" __MODULE_STRING(SNDRV_CARDS) "i");
    64 MODULE_PARM_DESC(snd_force_firmware, "Force a reload of the I/O box firmware");
    65 MODULE_PARM_SYNTAX(snd_force_firmware, SNDRV_ENABLED "," SNDRV_BOOLEAN_FALSE_DESC);
     41static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;      /* Index 0-MAX */
     42static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;       /* ID for this card */
     43static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;      /* Enable this card */
     44static int precise_ptr[SNDRV_CARDS] = { [0 ... (SNDRV_CARDS-1)] = 0 }; /* Enable precise pointer */
     45static int line_outs_monitor[SNDRV_CARDS] = { [0 ... (SNDRV_CARDS-1)] = 0}; /* Send all inputs/playback to line outs */
     46static int force_firmware[SNDRV_CARDS] = { [0 ... (SNDRV_CARDS-1)] = 0}; /* Force firmware reload */
     47
     48MODULE_PARM(index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
     49MODULE_PARM_DESC(index, "Index value for RME Hammerfall DSP interface.");
     50MODULE_PARM_SYNTAX(index, SNDRV_INDEX_DESC);
     51MODULE_PARM(id, "1-" __MODULE_STRING(SNDRV_CARDS) "s");
     52MODULE_PARM_DESC(id, "ID string for RME Hammerfall DSP interface.");
     53MODULE_PARM_SYNTAX(id, SNDRV_ID_DESC);
     54MODULE_PARM(enable, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
     55MODULE_PARM_DESC(enable, "Enable/disable specific Hammerfall DSP soundcards.");
     56MODULE_PARM_SYNTAX(enable, SNDRV_ENABLE_DESC);
     57MODULE_PARM(precise_ptr, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
     58MODULE_PARM_DESC(precise_ptr, "Enable precise pointer (doesn't work reliably).");
     59MODULE_PARM_SYNTAX(precise_ptr, SNDRV_ENABLED "," SNDRV_BOOLEAN_FALSE_DESC);
     60MODULE_PARM(line_outs_monitor,"1-" __MODULE_STRING(SNDRV_CARDS) "i");
     61MODULE_PARM_DESC(line_outs_monitor, "Send all input and playback streams to line outs by default.");
     62MODULE_PARM_SYNTAX(line_outs_monitor, SNDRV_ENABLED "," SNDRV_BOOLEAN_FALSE_DESC);
     63MODULE_PARM(force_firmware,"1-" __MODULE_STRING(SNDRV_CARDS) "i");
     64MODULE_PARM_DESC(force_firmware, "Force a reload of the I/O box firmware");
     65MODULE_PARM_SYNTAX(force_firmware, SNDRV_ENABLED "," SNDRV_BOOLEAN_FALSE_DESC);
    6666MODULE_AUTHOR("Paul Davis <pbd@op.net>");
    6767MODULE_DESCRIPTION("RME Hammerfall DSP");
     
    21912191                hdsp_write_gain (hdsp, i, MINUS_INFINITY_GAIN);
    21922192
    2193         if (snd_line_outs_monitor[hdsp->dev]) {
     2193        if (line_outs_monitor[hdsp->dev]) {
    21942194               
    21952195                snd_printk ("sending all inputs and playback streams to line outs.\n");
     
    28492849        }
    28502850
    2851         if (snd_force_firmware[hdsp->dev] || (hdsp_read (hdsp, HDSP_statusRegister) & HDSP_DllError) != 0) {
     2851        if (force_firmware[hdsp->dev] || (hdsp_read (hdsp, HDSP_statusRegister) & HDSP_DllError) != 0) {
    28522852
    28532853                snd_printk ("loading firmware\n");
     
    30693069
    30703070static int __devinit snd_hdsp_probe(struct pci_dev *pci,
    3071                                     const struct pci_device_id *id)
     3071                                    const struct pci_device_id *pci_id)
    30723072{
    30733073        static int dev;
     
    30783078        if (dev >= SNDRV_CARDS)
    30793079                return -ENODEV;
    3080         if (!snd_enable[dev]) {
     3080        if (!enable[dev]) {
    30813081                dev++;
    30823082                return -ENOENT;
    30833083        }
    30843084
    3085         if (!(card = snd_card_new(snd_index[dev], snd_id[dev], THIS_MODULE, sizeof(hdsp_t))))
     3085        if (!(card = snd_card_new(index[dev], id[dev], THIS_MODULE, sizeof(hdsp_t))))
    30863086                return -ENOMEM;
    30873087
     
    30913091        hdsp->pci = pci;
    30923092
    3093         if ((err = snd_hdsp_create(card, hdsp, snd_precise_ptr[dev])) < 0) {
     3093        if ((err = snd_hdsp_create(card, hdsp, precise_ptr[dev])) < 0) {
    30943094                snd_card_free(card);
    30953095                return err;
     
    31443144#ifndef MODULE
    31453145
    3146 /* format is: snd-hdsp=snd_enable,snd_index,snd_id */
     3146/* format is: snd-hdsp=enable,index,id */
    31473147
    31483148static int __init alsa_card_hdsp_setup(char *str)
     
    31523152        if (nr_dev >= SNDRV_CARDS)
    31533153                return 0;
    3154         (void)(get_option(&str,&snd_enable[nr_dev]) == 2 &&
    3155                get_option(&str,&snd_index[nr_dev]) == 2 &&
    3156                get_id(&str,&snd_id[nr_dev]) == 2);
     3154        (void)(get_option(&str,&enable[nr_dev]) == 2 &&
     3155               get_option(&str,&index[nr_dev]) == 2 &&
     3156               get_id(&str,&id[nr_dev]) == 2);
    31573157        nr_dev++;
    31583158        return 1;
  • GPL/branches/alsa-resync1/alsa-kernel/pci/rme9652/rme9652.c

    r210 r212  
    3535#include <sound/initval.h>
    3636
    37 static int snd_index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;  /* Index 0-MAX */
    38 static char *snd_id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;   /* ID for this card */
    39 static int snd_enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;  /* Enable this card */
    40 static int snd_precise_ptr[SNDRV_CARDS] = { [0 ... (SNDRV_CARDS-1)] = 0 }; /* Enable precise pointer */
    41 
    42 MODULE_PARM(snd_index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
    43 MODULE_PARM_DESC(snd_index, "Index value for RME Digi9652 (Hammerfall) soundcard.");
    44 MODULE_PARM_SYNTAX(snd_index, SNDRV_INDEX_DESC);
    45 MODULE_PARM(snd_id, "1-" __MODULE_STRING(SNDRV_CARDS) "s");
    46 MODULE_PARM_DESC(snd_id, "ID string for RME Digi9652 (Hammerfall) soundcard.");
    47 MODULE_PARM_SYNTAX(snd_id, SNDRV_ID_DESC);
    48 MODULE_PARM(snd_enable, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
    49 MODULE_PARM_DESC(snd_enable, "Enable/disable specific RME96{52,36} soundcards.");
    50 MODULE_PARM_SYNTAX(snd_enable, SNDRV_ENABLE_DESC);
    51 MODULE_PARM(snd_precise_ptr, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
    52 MODULE_PARM_DESC(snd_precise_ptr, "Enable precise pointer (doesn't work reliably).");
    53 MODULE_PARM_SYNTAX(snd_precise_ptr, SNDRV_ENABLED "," SNDRV_BOOLEAN_FALSE_DESC);
     37static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;      /* Index 0-MAX */
     38static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;       /* ID for this card */
     39static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;      /* Enable this card */
     40static int precise_ptr[SNDRV_CARDS] = { [0 ... (SNDRV_CARDS-1)] = 0 }; /* Enable precise pointer */
     41
     42MODULE_PARM(index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
     43MODULE_PARM_DESC(index, "Index value for RME Digi9652 (Hammerfall) soundcard.");
     44MODULE_PARM_SYNTAX(index, SNDRV_INDEX_DESC);
     45MODULE_PARM(id, "1-" __MODULE_STRING(SNDRV_CARDS) "s");
     46MODULE_PARM_DESC(id, "ID string for RME Digi9652 (Hammerfall) soundcard.");
     47MODULE_PARM_SYNTAX(id, SNDRV_ID_DESC);
     48MODULE_PARM(enable, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
     49MODULE_PARM_DESC(enable, "Enable/disable specific RME96{52,36} soundcards.");
     50MODULE_PARM_SYNTAX(enable, SNDRV_ENABLE_DESC);
     51MODULE_PARM(precise_ptr, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
     52MODULE_PARM_DESC(precise_ptr, "Enable precise pointer (doesn't work reliably).");
     53MODULE_PARM_SYNTAX(precise_ptr, SNDRV_ENABLED "," SNDRV_BOOLEAN_FALSE_DESC);
    5454MODULE_AUTHOR("Paul Davis <pbd@op.net>, Winfried Ritsch");
    5555MODULE_DESCRIPTION("RME Digi9652/Digi9636");
     
    27092709
    27102710static int __devinit snd_rme9652_probe(struct pci_dev *pci,
    2711                              const struct pci_device_id *id)
     2711                                       const struct pci_device_id *pci_id)
    27122712{
    27132713        static int dev;
     
    27182718        if (dev >= SNDRV_CARDS)
    27192719                return -ENODEV;
    2720                 if (!snd_enable[dev]) {
     2720        if (!enable[dev]) {
    27212721                        dev++;
    27222722                        return -ENOENT;
    27232723                }
    27242724
    2725         card = snd_card_new(snd_index[dev], snd_id[dev], THIS_MODULE,
     2725        card = snd_card_new(index[dev], id[dev], THIS_MODULE,
    27262726                            sizeof(rme9652_t));
    27272727
     
    27342734        rme9652->pci = pci;
    27352735
    2736         if ((err = snd_rme9652_create(card, rme9652, snd_precise_ptr[dev])) < 0) {
     2736        if ((err = snd_rme9652_create(card, rme9652, precise_ptr[dev])) < 0) {
    27372737                snd_card_free(card);
    27382738                return err;
     
    27892789#ifndef MODULE
    27902790
    2791 /* format is: snd-rme9652=snd_enable,snd_index,snd_id */
     2791/* format is: snd-rme9652=enable,index,id */
    27922792
    27932793static int __init alsa_card_rme9652_setup(char *str)
     
    27972797        if (nr_dev >= SNDRV_CARDS)
    27982798                return 0;
    2799         (void)(get_option(&str,&snd_enable[nr_dev]) == 2 &&
    2800                get_option(&str,&snd_index[nr_dev]) == 2 &&
    2801                get_id(&str,&snd_id[nr_dev]) == 2);
     2799        (void)(get_option(&str,&enable[nr_dev]) == 2 &&
     2800               get_option(&str,&index[nr_dev]) == 2 &&
     2801               get_id(&str,&id[nr_dev]) == 2);
    28022802        nr_dev++;
    28032803        return 1;
  • GPL/branches/alsa-resync1/alsa-kernel/pci/sonicvibes.c

    r210 r212  
    5454#endif
    5555
    56 static int snd_index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;  /* Index 0-MAX */
    57 static char *snd_id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;   /* ID for this card */
    58 static int snd_enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;  /* Enable this card */
     56static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;      /* Index 0-MAX */
     57static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;       /* ID for this card */
     58static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;      /* Enable this card */
    5959#ifdef TARGET_OS2
    60 static int snd_reverb[SNDRV_CARDS] = {0,0,0,0,0,0,0,0};
    61 static int snd_mge[SNDRV_CARDS] = {0,0,0,0,0,0,0,0};
     60static int reverb[SNDRV_CARDS] = {0,0,0,0,0,0,0,0};
     61static int mge[SNDRV_CARDS] = {0,0,0,0,0,0,0,0};
    6262#else
    63 static int snd_reverb[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 0};
    64 static int snd_mge[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 0};
     63static int reverb[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 0};
     64static int mge[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 0};
    6565#endif
    66 static unsigned int snd_dmaio = 0x7a00; /* DDMA i/o address */
    67 
    68 MODULE_PARM(snd_index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
    69 MODULE_PARM_DESC(snd_index, "Index value for S3 SonicVibes soundcard.");
    70 MODULE_PARM_SYNTAX(snd_index, SNDRV_INDEX_DESC);
    71 MODULE_PARM(snd_id, "1-" __MODULE_STRING(SNDRV_CARDS) "s");
    72 MODULE_PARM_DESC(snd_id, "ID string for S3 SonicVibes soundcard.");
    73 MODULE_PARM_SYNTAX(snd_id, SNDRV_ID_DESC);
    74 MODULE_PARM(snd_enable, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
    75 MODULE_PARM_DESC(snd_enable, "Enable S3 SonicVibes soundcard.");
    76 MODULE_PARM_SYNTAX(snd_enable, SNDRV_ENABLE_DESC);
    77 MODULE_PARM(snd_reverb, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
    78 MODULE_PARM_DESC(snd_reverb, "Enable reverb (SRAM is present) for S3 SonicVibes soundcard.");
    79 MODULE_PARM_SYNTAX(snd_reverb, SNDRV_ENABLED "," SNDRV_ENABLE_DESC);
    80 MODULE_PARM(snd_mge, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
    81 MODULE_PARM_DESC(snd_mge, "MIC Gain Enable for S3 SonicVibes soundcard.");
    82 MODULE_PARM_SYNTAX(snd_mge, SNDRV_ENABLED "," SNDRV_ENABLE_DESC);
    83 MODULE_PARM(snd_dmaio, "i");
    84 MODULE_PARM_DESC(snd_dmaio, "DDMA i/o base address for S3 SonicVibes soundcard.");
    85 MODULE_PARM_SYNTAX(snd_dmaio, "global," SNDRV_PORT_DESC);
     66static unsigned int dmaio = 0x7a00;     /* DDMA i/o address */
     67
     68MODULE_PARM(index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
     69MODULE_PARM_DESC(index, "Index value for S3 SonicVibes soundcard.");
     70MODULE_PARM_SYNTAX(index, SNDRV_INDEX_DESC);
     71MODULE_PARM(id, "1-" __MODULE_STRING(SNDRV_CARDS) "s");
     72MODULE_PARM_DESC(id, "ID string for S3 SonicVibes soundcard.");
     73MODULE_PARM_SYNTAX(id, SNDRV_ID_DESC);
     74MODULE_PARM(enable, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
     75MODULE_PARM_DESC(enable, "Enable S3 SonicVibes soundcard.");
     76MODULE_PARM_SYNTAX(enable, SNDRV_ENABLE_DESC);
     77MODULE_PARM(reverb, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
     78MODULE_PARM_DESC(reverb, "Enable reverb (SRAM is present) for S3 SonicVibes soundcard.");
     79MODULE_PARM_SYNTAX(reverb, SNDRV_ENABLED "," SNDRV_ENABLE_DESC);
     80MODULE_PARM(mge, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
     81MODULE_PARM_DESC(mge, "MIC Gain Enable for S3 SonicVibes soundcard.");
     82MODULE_PARM_SYNTAX(mge, SNDRV_ENABLED "," SNDRV_ENABLE_DESC);
     83MODULE_PARM(dmaio, "i");
     84MODULE_PARM_DESC(dmaio, "DDMA i/o base address for S3 SonicVibes soundcard.");
     85MODULE_PARM_SYNTAX(dmaio, "global," SNDRV_PORT_DESC);
    8686
    8787/*
     
    13311331        pci_read_config_dword(pci, 0x40, &dmaa);
    13321332        pci_read_config_dword(pci, 0x48, &dmac);
    1333         snd_dmaio &= ~0x0f;
     1333        dmaio &= ~0x0f;
    13341334        dmaa &= ~0x0f;
    13351335        dmac &= ~0x0f;
    13361336        if (!dmaa) {
    1337                 dmaa = snd_dmaio;
    1338                 snd_dmaio += 0x10;
     1337                dmaa = dmaio;
     1338                dmaio += 0x10;
    13391339                snd_printk("BIOS did not allocate DDMA channel A i/o, allocated at 0x%x\n", dmaa);
    13401340        }
    13411341        if (!dmac) {
    1342                 dmac = snd_dmaio;
    1343                 snd_dmaio += 0x10;
     1342                dmac = dmaio;
     1343                dmaio += 0x10;
    13441344                snd_printk("BIOS did not allocate DDMA channel C i/o, allocated at 0x%x\n", dmac);
    13451345        }
     
    14681468
    14691469static int __devinit snd_sonic_probe(struct pci_dev *pci,
    1470                                   const struct pci_device_id *id)
     1470                                     const struct pci_device_id *pci_id)
    14711471{
    14721472        static int dev;
     
    14791479        if (dev >= SNDRV_CARDS)
    14801480                return -ENODEV;
    1481                 if (!snd_enable[dev]) {
     1481        if (!enable[dev]) {
    14821482                        dev++;
    14831483                        return -ENOENT;
    14841484                }
    14851485 
    1486         card = snd_card_new(snd_index[dev], snd_id[dev], THIS_MODULE, 0);
     1486        card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0);
    14871487        if (card == NULL)
    14881488                return -ENOMEM;
     
    14951495        }
    14961496        if ((err = snd_sonicvibes_create(card, pci,
    1497                                          snd_reverb[dev] ? 1 : 0,
    1498                                          snd_mge[dev] ? 1 : 0,
     1497                                         reverb[dev] ? 1 : 0,
     1498                                         mge[dev] ? 1 : 0,
    14991499                                         &sonic)) < 0) {
    15001500                snd_card_free(card);
     
    15101510        }
    15111511        if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_SONICVIBES,
    1512                                        sonic->midi_port, MPU401_INFO_INTEGRATED,
     1512                                       sonic->midi_port, 1,
    15131513                                       sonic->irq, 0,
    15141514                                       &midi_uart)) < 0) {
     
    15851585#ifndef MODULE
    15861586
    1587 /* format is: snd-sonicvibes=snd_enable,snd_index,snd_id,
    1588                                   snd_reverb,snd_mge,snd_dmaio */
     1587/* format is: snd-sonicvibes=enable,index,id,
     1588                             reverb,mge,dmaio */
    15891589
    15901590static int __init alsa_card_sonicvibes_setup(char *str)
     
    15941594        if (nr_dev >= SNDRV_CARDS)
    15951595                return 0;
    1596         (void)(get_option(&str,&snd_enable[nr_dev]) == 2 &&
    1597                get_option(&str,&snd_index[nr_dev]) == 2 &&
    1598                get_id(&str,&snd_id[nr_dev]) == 2 &&
    1599                get_option(&str,&snd_reverb[nr_dev]) == 2 &&
    1600                get_option(&str,&snd_mge[nr_dev]) == 2 &&
    1601                get_option(&str,(int *)&snd_dmaio) == 2);
     1596        (void)(get_option(&str,&enable[nr_dev]) == 2 &&
     1597               get_option(&str,&index[nr_dev]) == 2 &&
     1598               get_id(&str,&id[nr_dev]) == 2 &&
     1599               get_option(&str,&reverb[nr_dev]) == 2 &&
     1600               get_option(&str,&mge[nr_dev]) == 2 &&
     1601               get_option(&str,(int *)&dmaio) == 2);
    16021602        nr_dev++;
    16031603        return 1;
  • GPL/branches/alsa-resync1/alsa-kernel/pci/trident/trident.c

    r210 r212  
    220220#ifndef MODULE
    221221
    222 /* format is: snd-trident=snd_enable,snd_index,snd_id,
    223                                snd_pcm_channels,snd_wavetable_size */
     222/* format is: snd-trident=enable,index,id,
     223                          pcm_channels,wavetable_size */
    224224
    225225static int __init alsa_card_trident_setup(char *str)
  • GPL/branches/alsa-resync1/alsa-kernel/pci/ymfpci/ymfpci.c

    r207 r212  
    309309#ifndef MODULE
    310310
    311 /* format is: snd-ymfpci=snd_enable,snd_index,snd_id,
    312                          snd_fm_port,snd_mpu_port */
     311/* format is: snd-ymfpci=enable,index,id,
     312                         fm_port,mpu_port */
    313313
    314314static int __init alsa_card_ymfpci_setup(char *str)
Note: See TracChangeset for help on using the changeset viewer.