void snd_aw2_saa7146_setup(struct snd_aw2_saa7146 *chip, void __iomem *pci_base_addr) { /* set PCI burst/threshold Burst length definition VALUE BURST LENGTH 000 1 Dword 001 2 Dwords 010 4 Dwords 011 8 Dwords 100 16 Dwords 101 32 Dwords 110 64 Dwords 111 128 Dwords Threshold definition VALUE WRITE MODE READ MODE 00 1 Dword of valid data 1 empty Dword 01 4 Dwords of valid data 4 empty Dwords 10 8 Dwords of valid data 8 empty Dwords 11 16 Dwords of valid data 16 empty Dwords */ unsigned int acon2; unsigned int acon1 = 0; int i; /* Set base addr */ chip->base_addr = pci_base_addr; /* disable all irqs */ WRITEREG(0, IER); /* reset saa7146 */ WRITEREG((MRST_N << 16), MC1); /* enable audio interface */ #ifdef __BIG_ENDIAN acon1 |= A1_SWAP; acon1 |= A2_SWAP; #endif /* WS0_CTRL, WS0_SYNC: input TSL1, I2S */ /* At initialization WS1 and WS2 are disabled (configured as input) */ acon1 |= 0 * WS1_CTRL; acon1 |= 0 * WS2_CTRL; /* WS4 is not used. So it must not restart A2. This is why it is configured as output (force to low) */ acon1 |= 3 * WS4_CTRL; /* WS3_CTRL, WS3_SYNC: output TSL2, I2S */ acon1 |= 2 * WS3_CTRL; /* A1 and A2 are active and asynchronous */ acon1 |= 3 * AUDIO_MODE; WRITEREG(acon1, ACON1); /* The following comes from original windows driver. It is needed to have a correct behavior of input and output simultenously, but I don't know why ! */ WRITEREG(3 * (BurstA1_in) + 3 * (ThreshA1_in) + 3 * (BurstA1_out) + 3 * (ThreshA1_out) + 3 * (BurstA2_out) + 3 * (ThreshA2_out), PCI_BT_A); /* enable audio port pins */ WRITEREG((EAP << 16) | EAP, MC1); /* enable I2C */ WRITEREG((EI2C << 16) | EI2C, MC1); /* enable interrupts */ WRITEREG(A1_out | A2_out | A1_in | IIC_S | IIC_E, IER); /* audio configuration */ acon2 = A2_CLKSRC | BCLK1_OEN; WRITEREG(acon2, ACON2); /* By default use analog input */ snd_aw2_saa7146_use_digital_input(chip, 0); /* TSL setup */ for (i = 0; i < 8; ++i) { WRITEREG(tsl1[i], TSL1 + (i * 4)); WRITEREG(tsl2[i], TSL2 + (i * 4)); } }
void snd_aw2_saa7146_setup(struct snd_aw2_saa7146 *chip, void __iomem *pci_base_addr) { unsigned int acon2; unsigned int acon1 = 0; int i; chip->base_addr = pci_base_addr; WRITEREG(0, IER); WRITEREG((MRST_N << 16), MC1); #ifdef __BIG_ENDIAN acon1 |= A1_SWAP; acon1 |= A2_SWAP; #endif acon1 |= 0 * WS1_CTRL; acon1 |= 0 * WS2_CTRL; acon1 |= 3 * WS4_CTRL; acon1 |= 2 * WS3_CTRL; acon1 |= 3 * AUDIO_MODE; WRITEREG(acon1, ACON1); WRITEREG(3 * (BurstA1_in) + 3 * (ThreshA1_in) + 3 * (BurstA1_out) + 3 * (ThreshA1_out) + 3 * (BurstA2_out) + 3 * (ThreshA2_out), PCI_BT_A); WRITEREG((EAP << 16) | EAP, MC1); WRITEREG((EI2C << 16) | EI2C, MC1); WRITEREG(A1_out | A2_out | A1_in | IIC_S | IIC_E, IER); acon2 = A2_CLKSRC | BCLK1_OEN; WRITEREG(acon2, ACON2); snd_aw2_saa7146_use_digital_input(chip, 0); for (i = 0; i < 8; ++i) { WRITEREG(tsl1[i], TSL1 + (i * 4)); WRITEREG(tsl2[i], TSL2 + (i * 4)); } }