Ignore:
Timestamp:
Jul 16, 2007, 2:45:34 AM (18 years ago)
Author:
Brendan Oakley
Message:

Merged to Alsa 0.9.0rc6

Location:
GPL/branches/alsa-resync1/alsa-kernel/pci
Files:
18 deleted
9 edited

Legend:

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

    r76 r215  
    792792                {
    793793                        /* E */ 0x8000,0x8000,
    794                         /* F */ 0x8000,0x8000
     794                        /* F */ 0xffff,0xffff
    795795                }
    796796        };
     
    981981                0x18000000,                     /* Phi increment for approx 32k operation */
    982982                0x8000,0x8000,                  /* Volume controls are unused at this time */
    983                 0x8000,0x8000
     983                0xffff,0xffff
    984984        };
    985985 
     
    13581358                }
    13591359
    1360                 /* cs46xx_dsp_set_src_sample_rate(chip,src_scb,sample_rate); */
     1360                if (pcm_channel_id != DSP_IEC958_CHANNEL ||
     1361                    !(ins->spdif_status_out & DSP_SPDIF_STATUS_AC3_MODE))
     1362                        cs46xx_dsp_set_src_sample_rate(chip,src_scb,sample_rate);
    13611363
    13621364                ins->nsrc_scb ++;
  • GPL/branches/alsa-resync1/alsa-kernel/pci/ice1712/ak4524.c

    r212 r215  
    22 *   ALSA driver for ICEnsemble ICE1712 (Envy24)
    33 *
    4  *   AK4524 / AK4528 interface
     4 *   AK4524 / AK4528 / AK4529 interface
    55 *
    66 *      Copyright (c) 2000 Jaroslav Kysela <perex@suse.cz>
     
    6868        addr &= 0x07;
    6969        /* build I2C address + data byte */
     70        /* assume C1=1, C0=0 */
    7071        addrdata = 0xa000 | (addr << 8) | data;
    7172        for (idx = 15; idx >= 0; idx--) {
     
    8182        }
    8283
     84        if (ak->type == SND_AK4524) {
    8385        if ((addr != 0x04 && addr != 0x05) || (data & 0x80) == 0)
    8486                ak->images[chip][addr] = data;
    8587        else
    8688                ak->ipga_gain[chip][addr-4] = data;
     89        }
    8790
    8891        if (ak->cs_mask == ak->cs_addr) {
     
    113116        ak4524_t *ak = &ice->ak4524;
    114117       
     118        switch (ak->type) {
     119        case SND_AK4524:
     120        case SND_AK4528:
    115121        for (chip = 0; chip < ak->num_dacs/2; chip++) {
    116122                snd_ice1712_ak4524_write(ice, chip, 0x01, state ? 0x00 : 0x03);
    117123                if (state)
    118124                        continue;
    119                 for (reg = 0x04; reg < (ak->is_ak4528 ? 0x06 : 0x08); reg++)
     125                        /* DAC volumes */
     126                        for (reg = 0x04; reg < (ak->type == SND_AK4528 ? 0x06 : 0x08); reg++)
    120127                        snd_ice1712_ak4524_write(ice, chip, reg, ak->images[chip][reg]);
    121                 if (ak->is_ak4528)
     128                        if (ak->type == SND_AK4528)
    122129                        continue;
     130                        /* IPGA */
    123131                for (reg = 0x04; reg < 0x06; reg++)
    124132                        snd_ice1712_ak4524_write(ice, chip, reg, ak->ipga_gain[chip][reg-4]);
     133                }
     134                break;
     135        case SND_AK4529:
     136                /* FIXME: needed for ak4529? */
     137                break;
    125138        }
    126139}
     
    131144void __devinit snd_ice1712_ak4524_init(ice1712_t *ice)
    132145{
    133         static unsigned char inits[] = {
     146        static unsigned char inits_ak4524[] = {
    134147                0x00, 0x07, /* 0: all power up */
    135148                0x01, 0x00, /* 1: ADC/DAC reset */
     
    145158                0xff, 0xff
    146159        };
    147         int chip, idx;
    148         unsigned char *ptr, reg, data;
     160        static unsigned char inits_ak4528[] = {
     161                0x00, 0x07, /* 0: all power up */
     162                0x01, 0x00, /* 1: ADC/DAC reset */
     163                0x02, 0x60, /* 2: 24bit I2S */
     164                0x03, 0x0d, /* 3: deemphasis off, turn LR highpass filters on */
     165                0x01, 0x03, /* 1: ADC/DAC enable */
     166                0x04, 0x00, /* 4: ADC left muted */
     167                0x05, 0x00, /* 5: ADC right muted */
     168                0xff, 0xff
     169        };
     170        static unsigned char inits_ak4529[] = {
     171                0x09, 0x01, /* 9: ATS=0, RSTN=1 */
     172                0x0a, 0x3f, /* A: all power up, no zero/overflow detection */
     173                0x00, 0x08, /* 0: TDM=0, 24bit I2S, SMUTE=0 */
     174                0x01, 0x00, /* 1: ACKS=0, ADC, loop off */
     175                0x02, 0xff, /* 2: LOUT1 muted */
     176                0x03, 0xff, /* 3: ROUT1 muted */
     177                0x04, 0xff, /* 4: LOUT2 muted */
     178                0x05, 0xff, /* 5: ROUT2 muted */
     179                0x06, 0xff, /* 6: LOUT3 muted */
     180                0x07, 0xff, /* 7: ROUT3 muted */
     181                0x0b, 0xff, /* B: LOUT4 muted */
     182                0x0c, 0xff, /* C: ROUT4 muted */
     183                0x08, 0x55, /* 8: deemphasis all off */
     184                0xff, 0xff
     185        };
     186        int chip, num_chips;
     187        unsigned char *ptr, reg, data, *inits;
    149188        ak4524_t *ak = &ice->ak4524;
    150189
    151         for (chip = idx = 0; chip < ak->num_dacs/2; chip++) {
     190        switch (ak->type) {
     191        case SND_AK4524:
     192                inits = inits_ak4524;
     193                num_chips = ak->num_dacs / 2;
     194                break;
     195        case SND_AK4528:
     196                inits = inits_ak4528;
     197                num_chips = ak->num_dacs / 2;
     198                break;
     199        case SND_AK4529:
     200        default:
     201                inits = inits_ak4529;
     202                num_chips = 1;
     203                break;
     204        }
     205
     206        for (chip = 0; chip < num_chips; chip++) {
    152207                ptr = inits;
    153208                while (*ptr != 0xff) {
    154209                        reg = *ptr++;
    155210                        data = *ptr++;
    156                         if (ak->is_ak4528) {
    157                                 if (reg > 5)
    158                                         continue;
    159                                 if (reg >= 4 && (data & 0x80))
    160                                         continue;
    161                         }
    162                         if (reg == 0x03 && ak->is_ak4528)
    163                                 data = 0x0d;    /* deemphasis off, turn LR highpass filters on */
    164211                        snd_ice1712_ak4524_write(ice, chip, reg, data);
    165212                }
    166213        }
    167214}
     215
     216
     217#define AK_GET_CHIP(val)                (((val) >> 8) & 0xff)
     218#define AK_GET_ADDR(val)                ((val) & 0xff)
     219#define AK_GET_SHIFT(val)               (((val) >> 16) & 0xff)
     220#define AK_COMPOSE(chip,addr,shift)     (((chip) << 8) | (addr) | ((shift) << 16))
    168221
    169222static int snd_ice1712_ak4524_volume_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo)
     
    179232{
    180233        ice1712_t *ice = snd_kcontrol_chip(kcontrol);
    181         int chip = kcontrol->private_value / 8;
    182         int addr = kcontrol->private_value % 8;
     234        int chip = AK_GET_CHIP(kcontrol->private_value);
     235        int addr = AK_GET_ADDR(kcontrol->private_value);
    183236        ucontrol->value.integer.value[0] = ice->ak4524.images[chip][addr];
    184237        return 0;
     
    188241{
    189242        ice1712_t *ice = snd_kcontrol_chip(kcontrol);
    190         int chip = kcontrol->private_value / 8;
    191         int addr = kcontrol->private_value % 8;
     243        int chip = AK_GET_CHIP(kcontrol->private_value);
     244        int addr = AK_GET_ADDR(kcontrol->private_value);
    192245        unsigned char nval = ucontrol->value.integer.value[0];
    193246        int change = ice->ak4524.images[chip][addr] != nval;
     
    209262{
    210263        ice1712_t *ice = snd_kcontrol_chip(kcontrol);
    211         int chip = kcontrol->private_value / 8;
    212         int addr = kcontrol->private_value % 8;
     264        int chip = AK_GET_CHIP(kcontrol->private_value);
     265        int addr = AK_GET_ADDR(kcontrol->private_value);
    213266        ucontrol->value.integer.value[0] = ice->ak4524.ipga_gain[chip][addr-4] & 0x7f;
    214267        return 0;
     
    218271{
    219272        ice1712_t *ice = snd_kcontrol_chip(kcontrol);
    220         int chip = kcontrol->private_value / 8;
    221         int addr = kcontrol->private_value % 8;
     273        int chip = AK_GET_CHIP(kcontrol->private_value);
     274        int addr = AK_GET_ADDR(kcontrol->private_value);
    222275        unsigned char nval = (ucontrol->value.integer.value[0] % 37) | 0x80;
    223276        int change = ice->ak4524.ipga_gain[chip][addr] != nval;
     
    244297{
    245298        ice1712_t *ice = snd_kcontrol_chip(kcontrol);
    246         int chip = kcontrol->id.index;
    247         ucontrol->value.enumerated.item[0] = ice->ak4524.images[chip][3] & 3;
     299        int chip = AK_GET_CHIP(kcontrol->private_value);
     300        int addr = AK_GET_ADDR(kcontrol->private_value);
     301        int shift = AK_GET_SHIFT(kcontrol->private_value);
     302        ucontrol->value.enumerated.item[0] = (ice->ak4524.images[chip][addr] >> shift) & 3;
    248303        return 0;
    249304}
     
    252307{
    253308        ice1712_t *ice = snd_kcontrol_chip(kcontrol);
    254         int chip = kcontrol->id.index;
    255         unsigned char nval = ucontrol->value.enumerated.item[0];
     309        int chip = AK_GET_CHIP(kcontrol->private_value);
     310        int addr = AK_GET_ADDR(kcontrol->private_value);
     311        int shift = AK_GET_SHIFT(kcontrol->private_value);
     312        unsigned char nval = ucontrol->value.enumerated.item[0] & 3;
    256313        int change;
    257         nval |= (nval & 3) | (ice->ak4524.images[chip][3] & ~3);
    258         change = ice->ak4524.images[chip][3] != nval;
     314       
     315        nval = (nval << shift) | (ice->ak4524.images[chip][addr] & ~(3 << shift));
     316        change = ice->ak4524.images[chip][addr] != nval;
    259317        if (change)
    260                 snd_ice1712_ak4524_write(ice, chip, 3, nval);
     318                snd_ice1712_ak4524_write(ice, chip, addr, nval);
    261319        return change;
    262320}
     
    281339                        ctl.get = snd_ice1712_ak4524_volume_get;
    282340                        ctl.put = snd_ice1712_ak4524_volume_put;
    283                 if (ak->is_ak4528)
    284                                 ctl.private_value = (idx / 2) * 8 + (idx % 2) + 4; /* register 4 & 5 */
    285                         else
    286                                 ctl.private_value = (idx / 2) * 8 + (idx % 2) + 6; /* register 6 & 7 */
     341                switch (ak->type) {
     342                case SND_AK4524:
     343                        ctl.private_value = AK_COMPOSE(idx/2, (idx%2) + 6, 0); /* register 6 & 7 */
     344                        break;
     345                case SND_AK4528:
     346                        ctl.private_value = AK_COMPOSE(idx/2, (idx%2) + 4, 0); /* register 4 & 5 */
     347                        break;
     348                case SND_AK4529: {
     349                        int val = idx < 6 ? idx + 2 : (idx - 6) + 0xb; /* registers 2-7 and b,c */
     350                        ctl.private_value = AK_COMPOSE(0, val, 0);
     351                        break;
     352                }
     353                }
    287354                        ctl.private_data = ice;
    288355                        if ((err = snd_ctl_add(ice->card, snd_ctl_new(&ctl))) < 0)
    289356                                return err;
    290357                }
    291         for (idx = 0; idx < ak->num_adcs && !ak->is_ak4528; ++idx) {
     358        for (idx = 0; idx < ak->num_adcs && ak->type == SND_AK4524; ++idx) {
    292359                        snd_kcontrol_t ctl;
    293360                        memset(&ctl, 0, sizeof(ctl));
     
    299366                        ctl.get = snd_ice1712_ak4524_volume_get;
    300367                        ctl.put = snd_ice1712_ak4524_volume_put;
    301                         ctl.private_value = (idx / 2) * 8 + (idx % 2) + 4; /* register 4 & 5 */
     368                ctl.private_value = AK_COMPOSE(idx/2, (idx%2) + 4, 0); /* register 4 & 5 */
    302369                        ctl.private_data = ice;
    303370                        if ((err = snd_ctl_add(ice->card, snd_ctl_new(&ctl))) < 0)
     
    311378                        ctl.get = snd_ice1712_ak4524_ipga_gain_get;
    312379                        ctl.put = snd_ice1712_ak4524_ipga_gain_put;
    313                         ctl.private_value = (idx / 2) * 8 + (idx % 2) + 4; /* register 4 & 5 */
     380                ctl.private_value = AK_COMPOSE(idx/2, (idx%2) + 4, 0); /* register 4 & 5 */
    314381                        ctl.private_data = ice;
    315382                        if ((err = snd_ctl_add(ice->card, snd_ctl_new(&ctl))) < 0)
     
    326393                        ctl.get = snd_ice1712_ak4524_deemphasis_get;
    327394                        ctl.put = snd_ice1712_ak4524_deemphasis_put;
     395                switch (ak->type) {
     396                case SND_AK4524:
     397                case SND_AK4528:
     398                        ctl.private_value = AK_COMPOSE(idx, 3, 0); /* register 3 */
     399                        break;
     400                case SND_AK4529: {
     401                        int shift = idx == 3 ? 6 : (2 - idx) * 2;
     402                        ctl.private_value = AK_COMPOSE(0, 8, shift); /* register 8 with shift */
     403                        break;
     404                }
     405                }
    328406                        ctl.private_data = ice;
    329407                        if ((err = snd_ctl_add(ice->card, snd_ctl_new(&ctl))) < 0)
  • GPL/branches/alsa-resync1/alsa-kernel/pci/ice1712/delta.c

    r212 r215  
    258258 * change the rate of AK4524 on Delta 44/66, AP, 1010LT
    259259 */
    260 static void delta_ak4524_set_rate_val(ice1712_t *ice, unsigned char val)
     260static void delta_ak4524_set_rate_val(ice1712_t *ice, unsigned int rate)
    261261{
    262262        unsigned char tmp, tmp2;
     263
     264        if (rate == 0)  /* no hint - S/PDIF input is master, simply return */
     265                return;
    263266
    264267        /* check before reset ak4524 to avoid unnecessary clicks */
     
    268271        tmp2 = tmp;
    269272        tmp2 &= ~ICE1712_DELTA_DFS;
    270         if (val == 15 || val == 11 || val == 7)
     273        if (rate > 48000)
    271274                tmp2 |= ICE1712_DELTA_DFS;
    272275        if (tmp == tmp2)
     
    276279        snd_ice1712_ak4524_reset(ice, 1);
    277280        down(&ice->gpio_mutex);
    278         tmp = snd_ice1712_read(ice, ICE1712_IREG_GPIO_DATA);
    279         if (val == 15 || val == 11 || val == 7) {
     281        tmp = snd_ice1712_read(ice, ICE1712_IREG_GPIO_DATA) & ~ICE1712_DELTA_DFS;
     282        if (rate > 48000)
    280283                tmp |= ICE1712_DELTA_DFS;
    281         } else {
    282                 tmp &= ~ICE1712_DELTA_DFS;
    283         }
    284284        snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, tmp);
    285285        up(&ice->gpio_mutex);
     
    338338                ice->num_total_dacs = 2;
    339339                break;
     340        case ICE1712_SUBDEVICE_DELTA410:
     341                ice->num_total_dacs = 8;
     342                break;
    340343        case ICE1712_SUBDEVICE_DELTA44:
    341344        case ICE1712_SUBDEVICE_DELTA66:
     
    351354        switch (ice->eeprom.subvendor) {
    352355        case ICE1712_SUBDEVICE_AUDIOPHILE:
     356        case ICE1712_SUBDEVICE_DELTA410:
    353357        case ICE1712_SUBDEVICE_DELTA1010LT:
    354358                if ((err = snd_i2c_bus_create(ice->card, "ICE1712 GPIO 1", NULL, &ice->i2c)) < 0) {
     
    379383        switch (ice->eeprom.subvendor) {
    380384        case ICE1712_SUBDEVICE_AUDIOPHILE:
     385        case ICE1712_SUBDEVICE_DELTA410:
    381386                ak->num_adcs = ak->num_dacs = 2;
    382                 ak->is_ak4528 = 1;
    383                 ak->cif = 0; /* the default level of the CIF pin from AK4524 */
     387                ak->type = SND_AK4528;
     388                if (ice->eeprom.subvendor == ICE1712_SUBDEVICE_DELTA410) {
     389                        ak->num_dacs = 8;
     390                        ak->type = SND_AK4529;
     391                }
     392                ak->cif = 0; /* the default level of the CIF pin from AK4528/4529 */
    384393                ak->data_mask = ICE1712_DELTA_AP_DOUT;
    385394                ak->clk_mask = ICE1712_DELTA_AP_CCLK;
    386                 ak->cs_mask = ak->cs_addr = ICE1712_DELTA_AP_CS_CODEC; /* select AK4528 codec */
     395                ak->cs_mask = ak->cs_addr = ICE1712_DELTA_AP_CS_CODEC; /* select AK4528/4529 codec */
    387396                ak->cs_none = 0;
    388397                ak->add_flags = ICE1712_DELTA_AP_CS_DIGITAL; /* assert digital high */
     
    393402        case ICE1712_SUBDEVICE_DELTA1010LT:
    394403                ak->num_adcs = ak->num_dacs = 8;
     404                ak->type = SND_AK4524;
    395405                ak->cif = 0; /* the default level of the CIF pin from AK4524 */
    396406                ak->data_mask = ICE1712_DELTA_1010LT_DOUT;
     
    407417        case ICE1712_SUBDEVICE_DELTA44:
    408418                ak->num_adcs = ak->num_dacs = 4;
     419                ak->type = SND_AK4524;
    409420                ak->cif = 0; /* the default level of the CIF pin from AK4524 */
    410421                ak->data_mask = ICE1712_DELTA_CODEC_SERIAL_DATA;
     
    472483        case ICE1712_SUBDEVICE_DELTA66:
    473484        case ICE1712_SUBDEVICE_AUDIOPHILE:
     485        case ICE1712_SUBDEVICE_DELTA410:
     486        case ICE1712_SUBDEVICE_DELTA1010LT:
    474487                err = snd_ice1712_spdif_build_controls(ice);
    475488                if (err < 0)
     
    491504        /* ak4524 controls */
    492505        switch (ice->eeprom.subvendor) {
     506        case ICE1712_SUBDEVICE_DELTA1010LT:
    493507        case ICE1712_SUBDEVICE_AUDIOPHILE:
     508        case ICE1712_SUBDEVICE_DELTA410:
    494509        case ICE1712_SUBDEVICE_DELTA44:
    495510        case ICE1712_SUBDEVICE_DELTA66:
     
    539554        },
    540555        {
     556                ICE1712_SUBDEVICE_DELTA410,
     557                "M Audio Delta 410",
     558                snd_ice1712_delta_init,
     559                snd_ice1712_delta_add_controls,
     560        },
     561        {
    541562                ICE1712_SUBDEVICE_DELTA1010LT,
    542563                "M Audio Delta 1010LT",
  • GPL/branches/alsa-resync1/alsa-kernel/pci/ice1712/delta.h

    r212 r215  
    3838#define ICE1712_SUBDEVICE_DELTA44       0x121433d6
    3939#define ICE1712_SUBDEVICE_AUDIOPHILE    0x121434d6
     40#define ICE1712_SUBDEVICE_DELTA410      0x121438d6
    4041#define ICE1712_SUBDEVICE_DELTA1010LT   0x12143bd6
    4142
     
    107108/* 0x80 = CODEC_CHIP_B */
    108109
    109 /* MidiMan M-Audio Audiophile definitions */
     110/* MidiMan M-Audio Audiophile/Delta410 definitions */
     111/* thanks to Kristof Pelckmans <Kristof.Pelckmans@antwerpen.be> for Delta410 info */
    110112/* 0x01 = DFS */
    111113#define ICE1712_DELTA_AP_CCLK   0x02    /* SPI clock */
     
    115117#define ICE1712_DELTA_AP_CS_DIGITAL 0x10 /* CS8427 chip select */
    116118                                        /* low signal = select */
    117 #define ICE1712_DELTA_AP_CS_CODEC 0x20  /* AK4528 chip select */
     119#define ICE1712_DELTA_AP_CS_CODEC 0x20  /* AK4528 (audiophile), AK4529 (Delta410) chip select */
    118120                                        /* low signal = select */
    119121
  • GPL/branches/alsa-resync1/alsa-kernel/pci/ice1712/ews.c

    r212 r215  
    407407        case ICE1712_SUBDEVICE_EWS88MT:
    408408                ak->num_adcs = ak->num_dacs = 8;
     409                ak->type = SND_AK4524;
    409410                ak->cif = 1; /* CIF high */
    410411                ak->data_mask = ICE1712_EWS88_SERIAL_DATA;
     
    419420        case ICE1712_SUBDEVICE_EWX2496:
    420421                ak->num_adcs = ak->num_dacs = 2;
     422                ak->type = SND_AK4524;
    421423                ak->cif = 1; /* CIF high */
    422424                ak->data_mask = ICE1712_EWS88_SERIAL_DATA;
     
    431433        case ICE1712_SUBDEVICE_DMX6FIRE:
    432434                ak->num_adcs = ak->num_dacs = 6;
     435                ak->type = SND_AK4524;
    433436                ak->cif = 1; /* CIF high */
    434437                ak->data_mask = ICE1712_6FIRE_SERIAL_DATA;
  • GPL/branches/alsa-resync1/alsa-kernel/pci/ice1712/ice1712.c

    r212 r215  
    105105static int snd_ice1712_build_controls(ice1712_t *ice);
    106106
     107static int PRO_RATE_LOCKED = 0;
     108static int PRO_RATE_RESET = 1;
     109static unsigned int PRO_RATE_DEFAULT = 44100;
     110
    107111/*
    108112 *  Basic I/O
    109113 */
     114 
     115static inline int is_spdif_master(ice1712_t *ice)
     116{
     117        return (inb(ICEMT(ice, RATE)) & ICE1712_SPDIF_MASTER) ? 1 : 0;
     118}
     119
     120static inline int is_pro_rate_locked(ice1712_t *ice)
     121{
     122        return is_spdif_master(ice) || PRO_RATE_LOCKED;
     123}
    110124
    111125static inline void snd_ice1712_ds_write(ice1712_t * ice, u8 channel, u8 addr, u32 data)
     
    981995/*
    982996 */
    983 static void snd_ice1712_set_pro_rate(ice1712_t *ice, snd_pcm_substream_t *substream)
     997static void snd_ice1712_set_pro_rate(ice1712_t *ice, unsigned int rate, int do_not_lock)
    984998{
    985999        unsigned long flags;
    986         unsigned int rate;
    9871000        unsigned char val;
     1001        int old_lock_value;
    9881002
    9891003        spin_lock_irqsave(&ice->reg_lock, flags);
    990         if ((inb(ICEMT(ice, PLAYBACK_CONTROL)) & (ICE1712_CAPTURE_START_SHADOW|
     1004        old_lock_value = PRO_RATE_LOCKED;
     1005        if (do_not_lock)
     1006                PRO_RATE_LOCKED = 0;
     1007        if (inb(ICEMT(ice, PLAYBACK_CONTROL)) & (ICE1712_CAPTURE_START_SHADOW|
    9911008                                                  ICE1712_PLAYBACK_PAUSE|
    992                                                   ICE1712_PLAYBACK_START)) ||
    993             (inb(ICEMT(ice, RATE)) & ICE1712_SPDIF_MASTER)) {
     1009                                                 ICE1712_PLAYBACK_START)) {
    9941010                spin_unlock_irqrestore(&ice->reg_lock, flags);
    9951011                return;
    9961012        }
    997         rate = substream->runtime->rate;
     1013        if (!is_pro_rate_locked(ice))
     1014                goto __unlock;
     1015
    9981016        switch (rate) {
    9991017        case 8000: val = 6; break;
     
    10161034        }
    10171035        outb(val, ICEMT(ice, RATE));
     1036        PRO_RATE_LOCKED = old_lock_value;
     1037
     1038      __unlock:
    10181039        spin_unlock_irqrestore(&ice->reg_lock, flags);
    10191040
    10201041        if (ice->ak4524.ops.set_rate_val)
    1021                 ice->ak4524.ops.set_rate_val(ice, val);
     1042                ice->ak4524.ops.set_rate_val(ice, rate);
    10221043}
    10231044
     
    10281049
    10291050        ice->playback_pro_size = snd_pcm_lib_buffer_bytes(substream);
    1030         snd_ice1712_set_pro_rate(ice, substream);
     1051        snd_ice1712_set_pro_rate(ice, substream->runtime->rate, 0);
    10311052        spin_lock_irqsave(&ice->reg_lock, flags);
    10321053        outl(substream->runtime->dma_addr, ICEMT(ice, PLAYBACK_ADDR));
     
    10471068
    10481069        ice->capture_pro_size = snd_pcm_lib_buffer_bytes(substream);
    1049         snd_ice1712_set_pro_rate(ice, substream);
     1070        snd_ice1712_set_pro_rate(ice, substream->runtime->rate, 0);
    10501071        spin_lock_irqsave(&ice->reg_lock, flags);
    10511072        outl(substream->runtime->dma_addr, ICEMT(ice, CAPTURE_ADDR));
     
    11521173        ice1712_t *ice = snd_pcm_substream_chip(substream);
    11531174
     1175        if (PRO_RATE_RESET)
     1176                snd_ice1712_set_pro_rate(ice, PRO_RATE_DEFAULT, 0);
    11541177        ice->playback_pro_substream = NULL;
    11551178        if (ice->spdif.ops.close)
     
    11631186        ice1712_t *ice = snd_pcm_substream_chip(substream);
    11641187
     1188        if (PRO_RATE_RESET)
     1189                snd_ice1712_set_pro_rate(ice, PRO_RATE_DEFAULT, 0);
    11651190        ice->capture_pro_substream = NULL;
    11661191        return 0;
     
    14961521}
    14971522
    1498 static void __exit snd_ice1712_proc_done(ice1712_t * ice)
     1523static void snd_ice1712_proc_done(ice1712_t * ice)
    14991524{
    15001525        if (ice->proc_entry) {
     
    15331558/*
    15341559 */
    1535 static int snd_ice1712_spdif_default_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo)
     1560static int snd_ice1712_spdif_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo)
    15361561{
    15371562        uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958;
     
    15621587        .iface =                SNDRV_CTL_ELEM_IFACE_PCM,
    15631588        .name =           SNDRV_CTL_NAME_IEC958("",PLAYBACK,DEFAULT),
    1564         .info =         snd_ice1712_spdif_default_info,
     1589        .info =         snd_ice1712_spdif_info,
    15651590        .get =          snd_ice1712_spdif_default_get,
    15661591        .put =          snd_ice1712_spdif_default_put
    15671592};
    1568 
    1569 static int snd_ice1712_spdif_mask_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo)
    1570 {
    1571         uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958;
    1572         uinfo->count = 1;
    1573         return 0;
    1574 }
    15751593
    15761594static int snd_ice1712_spdif_maskc_get(snd_kcontrol_t * kcontrol,
     
    16211639        .iface =                SNDRV_CTL_ELEM_IFACE_MIXER,
    16221640        .name =           SNDRV_CTL_NAME_IEC958("",PLAYBACK,CON_MASK),
    1623         .info =         snd_ice1712_spdif_mask_info,
     1641        .info =         snd_ice1712_spdif_info,
    16241642        .get =          snd_ice1712_spdif_maskc_get,
    16251643};
     
    16301648        .iface =                SNDRV_CTL_ELEM_IFACE_MIXER,
    16311649        .name =           SNDRV_CTL_NAME_IEC958("",PLAYBACK,PRO_MASK),
    1632         .info =         snd_ice1712_spdif_mask_info,
     1650        .info =         snd_ice1712_spdif_info,
    16331651        .get =          snd_ice1712_spdif_maskp_get,
    16341652};
    1635 
    1636 static int snd_ice1712_spdif_stream_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo)
    1637 {
    1638         uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958;
    1639         uinfo->count = 1;
    1640         return 0;
    1641 }
    16421653
    16431654static int snd_ice1712_spdif_stream_get(snd_kcontrol_t * kcontrol,
     
    16641675        .iface =                SNDRV_CTL_ELEM_IFACE_PCM,
    16651676        .name =           SNDRV_CTL_NAME_IEC958("",PLAYBACK,PCM_STREAM),
    1666         .info =         snd_ice1712_spdif_stream_info,
     1677        .info =         snd_ice1712_spdif_info,
    16671678        .get =          snd_ice1712_spdif_stream_get,
    16681679        .put =          snd_ice1712_spdif_stream_put
     
    17101721}
    17111722
    1712 static int snd_ice1712_pro_spdif_master_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo)
     1723/*
     1724 *  rate
     1725 */
     1726static int snd_ice1712_pro_internal_clock_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo)
     1727{
     1728        static char *texts[] = {
     1729                "8000",         /* 0: 6 */
     1730                "9600",         /* 1: 3 */
     1731                "11025",        /* 2: 10 */
     1732                "12000",        /* 3: 2 */
     1733                "16000",        /* 4: 5 */
     1734                "22050",        /* 5: 9 */
     1735                "24000",        /* 6: 1 */
     1736                "32000",        /* 7: 4 */
     1737                "44100",        /* 8: 8 */
     1738                "48000",        /* 9: 0 */
     1739                "64000",        /* 10: 15 */
     1740                "88200",        /* 11: 11 */
     1741                "96000",        /* 12: 7 */
     1742                "IEC958 Input", /* 13: -- */
     1743        };
     1744        uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
     1745        uinfo->count = 1;
     1746        uinfo->value.enumerated.items = 14;
     1747        if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items)
     1748                uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1;
     1749        strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
     1750        return 0;
     1751}
     1752
     1753static int snd_ice1712_pro_internal_clock_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol)
     1754{
     1755        ice1712_t *ice = snd_kcontrol_chip(kcontrol);
     1756        static unsigned char xlate[16] = {
     1757                9, 6, 3, 1, 7, 4, 0, 12, 8, 5, 2, 11, 255, 255, 255, 10
     1758        };
     1759        unsigned char val;
     1760       
     1761        spin_lock_irq(&ice->reg_lock);
     1762        if (is_spdif_master(ice)) {
     1763                ucontrol->value.enumerated.item[0] = 13;
     1764        } else {
     1765                val = xlate[inb(ICEMT(ice, RATE)) & 15];
     1766                if (val == 255) {
     1767                        snd_BUG();
     1768                        val = 0;
     1769                }
     1770                ucontrol->value.enumerated.item[0] = val;
     1771        }
     1772        spin_unlock_irq(&ice->reg_lock);
     1773        return 0;
     1774}
     1775
     1776static int snd_ice1712_pro_internal_clock_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol)
     1777{
     1778        ice1712_t *ice = snd_kcontrol_chip(kcontrol);
     1779        static unsigned int xrate[13] = {
     1780                8000, 9600, 11025, 12000, 1600, 22050, 24000,
     1781                32000, 44100, 48000, 64000, 88200, 96000
     1782        };
     1783        unsigned char oval;
     1784        int change = 0;
     1785
     1786        spin_lock_irq(&ice->reg_lock);
     1787        oval = inb(ICEMT(ice, RATE));
     1788        if (ucontrol->value.enumerated.item[0] == 13) {
     1789                outb(oval | ICE1712_SPDIF_MASTER, ICEMT(ice, RATE));
     1790        } else {
     1791                PRO_RATE_DEFAULT = xrate[ucontrol->value.integer.value[0] % 13];
     1792                snd_ice1712_set_pro_rate(ice, PRO_RATE_DEFAULT, 1);
     1793        }
     1794        change = inb(ICEMT(ice, RATE)) != oval;
     1795
     1796        if ((oval & ICE1712_SPDIF_MASTER) != (inb(ICEMT(ice, RATE)) & ICE1712_SPDIF_MASTER)) {
     1797                /* change CS8427 clock source too */
     1798                if (ice->cs8427) {
     1799                        snd_ice1712_cs8427_set_input_clock(ice, is_spdif_master(ice));
     1800                }
     1801                /* notify ak4524 chip as well */
     1802                if (is_spdif_master(ice) && ice->ak4524.ops.set_rate_val)
     1803                        ice->ak4524.ops.set_rate_val(ice, 0);
     1804        }
     1805
     1806        return change;
     1807}
     1808
     1809static snd_kcontrol_new_t snd_ice1712_pro_internal_clock = __devinitdata {
     1810        .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
     1811        .name = "Multi Track Internal Clock",
     1812        .info = snd_ice1712_pro_internal_clock_info,
     1813        .get = snd_ice1712_pro_internal_clock_get,
     1814        .put = snd_ice1712_pro_internal_clock_put
     1815};
     1816
     1817static int snd_ice1712_pro_rate_locking_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo)
    17131818{
    17141819        uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
     
    17191824}
    17201825
    1721 static int snd_ice1712_pro_spdif_master_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol)
    1722 {
    1723         ice1712_t *ice = snd_kcontrol_chip(kcontrol);
    1724         unsigned long flags;
    1725        
    1726         spin_lock_irqsave(&ice->reg_lock, flags);
    1727         ucontrol->value.integer.value[0] = inb(ICEMT(ice, RATE)) & ICE1712_SPDIF_MASTER ? 1 : 0;
    1728         spin_unlock_irqrestore(&ice->reg_lock, flags);
    1729         return 0;
    1730 }
    1731 
    1732 static int snd_ice1712_pro_spdif_master_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol)
    1733 {
    1734         unsigned long flags;
    1735         ice1712_t *ice = snd_kcontrol_chip(kcontrol);
    1736         int nval, change;
    1737 
    1738         nval = ucontrol->value.integer.value[0] ? ICE1712_SPDIF_MASTER : 0;
    1739         spin_lock_irqsave(&ice->reg_lock, flags);
    1740         nval |= inb(ICEMT(ice, RATE)) & ~ICE1712_SPDIF_MASTER;
    1741         change = inb(ICEMT(ice, RATE)) != nval;
    1742         outb(nval, ICEMT(ice, RATE));
    1743         spin_unlock_irqrestore(&ice->reg_lock, flags);
    1744 
    1745         if (ice->cs8427) {
    1746                 /* change CS8427 clock source too */
    1747                 snd_ice1712_cs8427_set_input_clock(ice, ucontrol->value.integer.value[0]);
    1748         }
    1749 
     1826static int snd_ice1712_pro_rate_locking_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol)
     1827{
     1828        ucontrol->value.integer.value[0] = PRO_RATE_LOCKED ? 1 : 0;
     1829        return 0;
     1830}
     1831
     1832static int snd_ice1712_pro_rate_locking_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol)
     1833{
     1834        int change = 0;
     1835
     1836        change = PRO_RATE_LOCKED ? 1 : 0 != ucontrol->value.integer.value[0] ? 1 : 0;
     1837        PRO_RATE_LOCKED = ucontrol->value.integer.value[0] ? 1 : 0;
    17501838        return change;
    17511839}
    17521840
    1753 static snd_kcontrol_new_t snd_ice1712_pro_spdif_master __devinitdata = {
     1841static snd_kcontrol_new_t snd_ice1712_pro_rate_locking __devinitdata = {
    17541842        .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
    1755         .name = "Multi Track IEC958 Master",
    1756         .info = snd_ice1712_pro_spdif_master_info,
    1757         .get = snd_ice1712_pro_spdif_master_get,
    1758         .put = snd_ice1712_pro_spdif_master_put
     1843        .name = "Multi Track Rate Locking",
     1844        .info = snd_ice1712_pro_rate_locking_info,
     1845        .get = snd_ice1712_pro_rate_locking_get,
     1846        .put = snd_ice1712_pro_rate_locking_put
     1847};
     1848
     1849static int snd_ice1712_pro_rate_reset_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo)
     1850{
     1851        uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
     1852        uinfo->count = 1;
     1853        uinfo->value.integer.min = 0;
     1854        uinfo->value.integer.max = 1;
     1855        return 0;
     1856}
     1857
     1858static int snd_ice1712_pro_rate_reset_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol)
     1859{
     1860        ucontrol->value.integer.value[0] = PRO_RATE_RESET ? 1 : 0;
     1861        return 0;
     1862}
     1863
     1864static int snd_ice1712_pro_rate_reset_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol)
     1865{
     1866        int change = 0;
     1867
     1868        change = PRO_RATE_LOCKED ? 1 : 0 != ucontrol->value.integer.value[0] ? 1 : 0;
     1869        PRO_RATE_RESET = ucontrol->value.integer.value[0] ? 1 : 0;
     1870        return change;
     1871}
     1872
     1873static snd_kcontrol_new_t snd_ice1712_pro_rate_reset __devinitdata = {
     1874        .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
     1875        .name = "Multi Track Rate Reset",
     1876        .info = snd_ice1712_pro_rate_reset_info,
     1877        .get = snd_ice1712_pro_rate_reset_get,
     1878        .put = snd_ice1712_pro_rate_reset_put
    17591879};
    17601880
     
    21282248        if (err < 0)
    21292249                return err;
    2130         err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_pro_spdif_master, ice));
     2250        err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_pro_internal_clock, ice));
     2251        if (err < 0)
     2252                return err;
     2253        err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_pro_rate_locking, ice));
     2254        if (err < 0)
     2255                return err;
     2256        err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_pro_rate_reset, ice));
    21312257        if (err < 0)
    21322258                return err;
     
    22982424/*
    22992425 *
    2300  * Registraton
     2426 * Registration
    23012427 *
    23022428 */
  • GPL/branches/alsa-resync1/alsa-kernel/pci/ice1712/ice1712.h

    r212 r215  
    240240        int num_adcs;                   /* AK4524 or AK4528 ADCs */
    241241        int num_dacs;                   /* AK4524 or AK4528 DACs */
    242         unsigned char images[4][8];
     242        unsigned char images[4][16];
    243243        unsigned char ipga_gain[4][2];
    244244        /* */
    245         unsigned int is_ak4528: 1;      /* AK4524 or AK4528 */
     245        enum {
     246                SND_AK4524, SND_AK4528, SND_AK4529
     247        } type;
    246248        unsigned int cif: 1;
    247249        unsigned char data_mask;
     
    255257                int (*start)(ice1712_t *, unsigned char *, int);
    256258                void (*stop)(ice1712_t *, unsigned char *);
    257                 void (*set_rate_val)(ice1712_t *, unsigned char);
     259                void (*set_rate_val)(ice1712_t *, unsigned int);
    258260        } ops;
    259261};
  • GPL/branches/alsa-resync1/alsa-kernel/pci/rme9652/hammerfall_mem.c

    • Property svn:eol-style set to native
    r212 r215  
    2626    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
    2727
    28     hammerfall_mem.c,v 1.4 2002/10/21 18:28:25 perex Exp
     28    hammerfall_mem.c,v 1.5 2002/11/04 09:11:42 perex Exp
    2929
    3030
     
    3838#include <sound/driver.h>
    3939#endif
    40 #include <linux/config.h>
    4140#include <linux/version.h>
    4241#include <linux/module.h>
  • GPL/branches/alsa-resync1/alsa-kernel/pci/rme9652/hdsp.c

    • Property svn:eol-style set to native
    r212 r215  
    950950        if (up) {
    951951                if (!hmidi->istimer) {
     952                        init_timer(&hmidi->timer);
    952953                        hmidi->timer.function = snd_hdsp_midi_output_timer;
    953954                        hmidi->timer.data = (unsigned long) hmidi;
Note: See TracChangeset for help on using the changeset viewer.