Commit 67679b1f authored by Vedran Miletic's avatar Vedran Miletic Committed by Takashi Iwai

ALSA: emu10k1: fix coding style for emu10k1_main.c

I fixed all of coding style errors and some warnings, now it is down to:
checkpatch.pl-0.24 --no-tree --file --strict --terse emu10k1_main.c
total: 0 errors, 62 warnings, 7 checks, 2075 lines checked
Signed-off-by: default avatarVedran Miletic <rivanvx@gmail.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 718a2594
...@@ -69,7 +69,7 @@ MODULE_FIRMWARE(EMU1010_NOTEBOOK_FILENAME); ...@@ -69,7 +69,7 @@ MODULE_FIRMWARE(EMU1010_NOTEBOOK_FILENAME);
* EMU10K1 init / done * EMU10K1 init / done
*************************************************************************/ *************************************************************************/
void snd_emu10k1_voice_init(struct snd_emu10k1 * emu, int ch) void snd_emu10k1_voice_init(struct snd_emu10k1 *emu, int ch)
{ {
snd_emu10k1_ptr_write(emu, DCYSUSV, ch, 0); snd_emu10k1_ptr_write(emu, DCYSUSV, ch, 0);
snd_emu10k1_ptr_write(emu, IP, ch, 0); snd_emu10k1_ptr_write(emu, IP, ch, 0);
...@@ -151,9 +151,9 @@ static unsigned int i2c_adc_init[][2] = { ...@@ -151,9 +151,9 @@ static unsigned int i2c_adc_init[][2] = {
{ 0x12, 0x32 }, /* ALC Control 3 */ { 0x12, 0x32 }, /* ALC Control 3 */
{ 0x13, 0x00 }, /* Noise gate control */ { 0x13, 0x00 }, /* Noise gate control */
{ 0x14, 0xa6 }, /* Limiter control */ { 0x14, 0xa6 }, /* Limiter control */
{ 0x15, ADC_MUX_2 }, /* ADC Mixer control. Mic for Audigy 2 ZS Notebook */ { 0x15, ADC_MUX_2 }, /* ADC Mixer control. Mic for A2ZS Notebook */
}; };
static int snd_emu10k1_init(struct snd_emu10k1 *emu, int enable_ir, int resume) static int snd_emu10k1_init(struct snd_emu10k1 *emu, int enable_ir, int resume)
{ {
unsigned int silent_page; unsigned int silent_page;
...@@ -161,8 +161,8 @@ static int snd_emu10k1_init(struct snd_emu10k1 *emu, int enable_ir, int resume) ...@@ -161,8 +161,8 @@ static int snd_emu10k1_init(struct snd_emu10k1 *emu, int enable_ir, int resume)
u32 tmp; u32 tmp;
/* disable audio and lock cache */ /* disable audio and lock cache */
outl(HCFG_LOCKSOUNDCACHE | HCFG_LOCKTANKCACHE_MASK | HCFG_MUTEBUTTONENABLE, outl(HCFG_LOCKSOUNDCACHE | HCFG_LOCKTANKCACHE_MASK |
emu->port + HCFG); HCFG_MUTEBUTTONENABLE, emu->port + HCFG);
/* reset recording buffers */ /* reset recording buffers */
snd_emu10k1_ptr_write(emu, MICBS, 0, ADCBS_BUFSIZE_NONE); snd_emu10k1_ptr_write(emu, MICBS, 0, ADCBS_BUFSIZE_NONE);
...@@ -179,7 +179,7 @@ static int snd_emu10k1_init(struct snd_emu10k1 *emu, int enable_ir, int resume) ...@@ -179,7 +179,7 @@ static int snd_emu10k1_init(struct snd_emu10k1 *emu, int enable_ir, int resume)
snd_emu10k1_ptr_write(emu, SOLEL, 0, 0); snd_emu10k1_ptr_write(emu, SOLEL, 0, 0);
snd_emu10k1_ptr_write(emu, SOLEH, 0, 0); snd_emu10k1_ptr_write(emu, SOLEH, 0, 0);
if (emu->audigy){ if (emu->audigy) {
/* set SPDIF bypass mode */ /* set SPDIF bypass mode */
snd_emu10k1_ptr_write(emu, SPBYPASS, 0, SPBYPASS_FORMAT); snd_emu10k1_ptr_write(emu, SPBYPASS, 0, SPBYPASS_FORMAT);
/* enable rear left + rear right AC97 slots */ /* enable rear left + rear right AC97 slots */
...@@ -197,12 +197,12 @@ static int snd_emu10k1_init(struct snd_emu10k1 *emu, int enable_ir, int resume) ...@@ -197,12 +197,12 @@ static int snd_emu10k1_init(struct snd_emu10k1 *emu, int enable_ir, int resume)
if (emu->card_capabilities->ca0151_chip) { /* audigy2 */ if (emu->card_capabilities->ca0151_chip) { /* audigy2 */
/* Hacks for Alice3 to work independent of haP16V driver */ /* Hacks for Alice3 to work independent of haP16V driver */
//Setup SRCMulti_I2S SamplingRate /* Setup SRCMulti_I2S SamplingRate */
tmp = snd_emu10k1_ptr_read(emu, A_SPDIF_SAMPLERATE, 0); tmp = snd_emu10k1_ptr_read(emu, A_SPDIF_SAMPLERATE, 0);
tmp &= 0xfffff1ff; tmp &= 0xfffff1ff;
tmp |= (0x2<<9); tmp |= (0x2<<9);
snd_emu10k1_ptr_write(emu, A_SPDIF_SAMPLERATE, 0, tmp); snd_emu10k1_ptr_write(emu, A_SPDIF_SAMPLERATE, 0, tmp);
/* Setup SRCSel (Enable Spdif,I2S SRCMulti) */ /* Setup SRCSel (Enable Spdif,I2S SRCMulti) */
snd_emu10k1_ptr20_write(emu, SRCSel, 0, 0x14); snd_emu10k1_ptr20_write(emu, SRCSel, 0, 0x14);
/* Setup SRCMulti Input Audio Enable */ /* Setup SRCMulti Input Audio Enable */
...@@ -217,7 +217,7 @@ static int snd_emu10k1_init(struct snd_emu10k1 *emu, int enable_ir, int resume) ...@@ -217,7 +217,7 @@ static int snd_emu10k1_init(struct snd_emu10k1 *emu, int enable_ir, int resume)
if (emu->card_capabilities->ca0108_chip) { /* audigy2 Value */ if (emu->card_capabilities->ca0108_chip) { /* audigy2 Value */
/* Hacks for Alice3 to work independent of haP16V driver */ /* Hacks for Alice3 to work independent of haP16V driver */
snd_printk(KERN_INFO "Audigy2 value: Special config.\n"); snd_printk(KERN_INFO "Audigy2 value: Special config.\n");
//Setup SRCMulti_I2S SamplingRate /* Setup SRCMulti_I2S SamplingRate */
tmp = snd_emu10k1_ptr_read(emu, A_SPDIF_SAMPLERATE, 0); tmp = snd_emu10k1_ptr_read(emu, A_SPDIF_SAMPLERATE, 0);
tmp &= 0xfffff1ff; tmp &= 0xfffff1ff;
tmp |= (0x2<<9); tmp |= (0x2<<9);
...@@ -270,13 +270,13 @@ static int snd_emu10k1_init(struct snd_emu10k1 *emu, int enable_ir, int resume) ...@@ -270,13 +270,13 @@ static int snd_emu10k1_init(struct snd_emu10k1 *emu, int enable_ir, int resume)
size = ARRAY_SIZE(i2c_adc_init); size = ARRAY_SIZE(i2c_adc_init);
for (n = 0; n < size; n++) for (n = 0; n < size; n++)
snd_emu10k1_i2c_write(emu, i2c_adc_init[n][0], i2c_adc_init[n][1]); snd_emu10k1_i2c_write(emu, i2c_adc_init[n][0], i2c_adc_init[n][1]);
for (n=0; n < 4; n++) { for (n = 0; n < 4; n++) {
emu->i2c_capture_volume[n][0]= 0xcf; emu->i2c_capture_volume[n][0] = 0xcf;
emu->i2c_capture_volume[n][1]= 0xcf; emu->i2c_capture_volume[n][1] = 0xcf;
} }
} }
snd_emu10k1_ptr_write(emu, PTB, 0, emu->ptb_pages.addr); snd_emu10k1_ptr_write(emu, PTB, 0, emu->ptb_pages.addr);
snd_emu10k1_ptr_write(emu, TCB, 0, 0); /* taken from original driver */ snd_emu10k1_ptr_write(emu, TCB, 0, 0); /* taken from original driver */
snd_emu10k1_ptr_write(emu, TCBS, 0, 4); /* taken from original driver */ snd_emu10k1_ptr_write(emu, TCBS, 0, 4); /* taken from original driver */
...@@ -313,7 +313,7 @@ static int snd_emu10k1_init(struct snd_emu10k1 *emu, int enable_ir, int resume) ...@@ -313,7 +313,7 @@ static int snd_emu10k1_init(struct snd_emu10k1 *emu, int enable_ir, int resume)
(emu->model == 0x21 && emu->revision < 6)) (emu->model == 0x21 && emu->revision < 6))
outl(HCFG_LOCKTANKCACHE_MASK | HCFG_AUTOMUTE, emu->port + HCFG); outl(HCFG_LOCKTANKCACHE_MASK | HCFG_AUTOMUTE, emu->port + HCFG);
else else
// With on-chip joystick /* With on-chip joystick */
outl(HCFG_LOCKTANKCACHE_MASK | HCFG_AUTOMUTE | HCFG_JOYENABLE, emu->port + HCFG); outl(HCFG_LOCKTANKCACHE_MASK | HCFG_AUTOMUTE | HCFG_JOYENABLE, emu->port + HCFG);
if (enable_ir) { /* enable IR for SB Live */ if (enable_ir) { /* enable IR for SB Live */
...@@ -335,9 +335,9 @@ static int snd_emu10k1_init(struct snd_emu10k1 *emu, int enable_ir, int resume) ...@@ -335,9 +335,9 @@ static int snd_emu10k1_init(struct snd_emu10k1 *emu, int enable_ir, int resume)
outl(reg | HCFG_GPOUT1 | HCFG_GPOUT2, emu->port + HCFG); outl(reg | HCFG_GPOUT1 | HCFG_GPOUT2, emu->port + HCFG);
udelay(100); udelay(100);
outl(reg, emu->port + HCFG); outl(reg, emu->port + HCFG);
} }
} }
if (emu->card_capabilities->emu_model) { if (emu->card_capabilities->emu_model) {
; /* Disable all access to A_IOCFG for the emu1010 */ ; /* Disable all access to A_IOCFG for the emu1010 */
} else if (emu->card_capabilities->i2c_adc) { } else if (emu->card_capabilities->i2c_adc) {
...@@ -364,7 +364,7 @@ static void snd_emu10k1_audio_enable(struct snd_emu10k1 *emu) ...@@ -364,7 +364,7 @@ static void snd_emu10k1_audio_enable(struct snd_emu10k1 *emu)
; /* Disable A_IOCFG for Audigy 2 ZS Notebook */ ; /* Disable A_IOCFG for Audigy 2 ZS Notebook */
} else if (emu->audigy) { } else if (emu->audigy) {
outl(inl(emu->port + A_IOCFG) & ~0x44, emu->port + A_IOCFG); outl(inl(emu->port + A_IOCFG) & ~0x44, emu->port + A_IOCFG);
if (emu->card_capabilities->ca0151_chip) { /* audigy2 */ if (emu->card_capabilities->ca0151_chip) { /* audigy2 */
/* Unmute Analog now. Set GPO6 to 1 for Apollo. /* Unmute Analog now. Set GPO6 to 1 for Apollo.
* This has to be done after init ALice3 I2SOut beyond 48KHz. * This has to be done after init ALice3 I2SOut beyond 48KHz.
...@@ -378,12 +378,12 @@ static void snd_emu10k1_audio_enable(struct snd_emu10k1 *emu) ...@@ -378,12 +378,12 @@ static void snd_emu10k1_audio_enable(struct snd_emu10k1 *emu)
outl(inl(emu->port + A_IOCFG) | 0x0080, emu->port + A_IOCFG); outl(inl(emu->port + A_IOCFG) | 0x0080, emu->port + A_IOCFG);
} }
} }
#if 0 #if 0
{ {
unsigned int tmp; unsigned int tmp;
/* FIXME: the following routine disables LiveDrive-II !! */ /* FIXME: the following routine disables LiveDrive-II !! */
// TOSLink detection /* TOSLink detection */
emu->tos_link = 0; emu->tos_link = 0;
tmp = inl(emu->port + HCFG); tmp = inl(emu->port + HCFG);
if (tmp & (HCFG_GPINPUT0 | HCFG_GPINPUT1)) { if (tmp & (HCFG_GPINPUT0 | HCFG_GPINPUT1)) {
...@@ -400,7 +400,7 @@ static void snd_emu10k1_audio_enable(struct snd_emu10k1 *emu) ...@@ -400,7 +400,7 @@ static void snd_emu10k1_audio_enable(struct snd_emu10k1 *emu)
snd_emu10k1_intr_enable(emu, INTE_PCIERRORENABLE); snd_emu10k1_intr_enable(emu, INTE_PCIERRORENABLE);
} }
int snd_emu10k1_done(struct snd_emu10k1 * emu) int snd_emu10k1_done(struct snd_emu10k1 *emu)
{ {
int ch; int ch;
...@@ -495,7 +495,7 @@ int snd_emu10k1_done(struct snd_emu10k1 * emu) ...@@ -495,7 +495,7 @@ int snd_emu10k1_done(struct snd_emu10k1 * emu)
#define EC_LAST_PROMFILE_ADDR 0x2f #define EC_LAST_PROMFILE_ADDR 0x2f
#define EC_SERIALNUM_ADDR 0x30 /* First word of serial number. The #define EC_SERIALNUM_ADDR 0x30 /* First word of serial number. The
* can be up to 30 characters in length * can be up to 30 characters in length
* and is stored as a NULL-terminated * and is stored as a NULL-terminated
* ASCII string. Any unused bytes must be * ASCII string. Any unused bytes must be
...@@ -503,8 +503,8 @@ int snd_emu10k1_done(struct snd_emu10k1 * emu) ...@@ -503,8 +503,8 @@ int snd_emu10k1_done(struct snd_emu10k1 * emu)
#define EC_CHECKSUM_ADDR 0x3f /* Location at which checksum is stored */ #define EC_CHECKSUM_ADDR 0x3f /* Location at which checksum is stored */
/* Most of this stuff is pretty self-evident. According to the hardware /* Most of this stuff is pretty self-evident. According to the hardware
* dudes, we need to leave the ADCCAL bit low in order to avoid a DC * dudes, we need to leave the ADCCAL bit low in order to avoid a DC
* offset problem. Weird. * offset problem. Weird.
*/ */
#define EC_RAW_RUN_MODE (EC_DACMUTEN | EC_ADCRSTN | EC_TRIM_MUTEN | \ #define EC_RAW_RUN_MODE (EC_DACMUTEN | EC_ADCRSTN | EC_TRIM_MUTEN | \
...@@ -523,7 +523,7 @@ int snd_emu10k1_done(struct snd_emu10k1 * emu) ...@@ -523,7 +523,7 @@ int snd_emu10k1_done(struct snd_emu10k1 * emu)
* register. * register.
*/ */
static void snd_emu10k1_ecard_write(struct snd_emu10k1 * emu, unsigned int value) static void snd_emu10k1_ecard_write(struct snd_emu10k1 *emu, unsigned int value)
{ {
unsigned short count; unsigned short count;
unsigned int data; unsigned int data;
...@@ -561,7 +561,7 @@ static void snd_emu10k1_ecard_write(struct snd_emu10k1 * emu, unsigned int value ...@@ -561,7 +561,7 @@ static void snd_emu10k1_ecard_write(struct snd_emu10k1 * emu, unsigned int value
* channel. * channel.
*/ */
static void snd_emu10k1_ecard_setadcgain(struct snd_emu10k1 * emu, static void snd_emu10k1_ecard_setadcgain(struct snd_emu10k1 *emu,
unsigned short gain) unsigned short gain)
{ {
unsigned int bit; unsigned int bit;
...@@ -574,7 +574,7 @@ static void snd_emu10k1_ecard_setadcgain(struct snd_emu10k1 * emu, ...@@ -574,7 +574,7 @@ static void snd_emu10k1_ecard_setadcgain(struct snd_emu10k1 * emu,
for (bit = (1 << 15); bit; bit >>= 1) { for (bit = (1 << 15); bit; bit >>= 1) {
unsigned int value; unsigned int value;
value = emu->ecard_ctrl & ~(EC_TRIM_CSN | EC_TRIM_SDATA); value = emu->ecard_ctrl & ~(EC_TRIM_CSN | EC_TRIM_SDATA);
if (gain & bit) if (gain & bit)
...@@ -589,7 +589,7 @@ static void snd_emu10k1_ecard_setadcgain(struct snd_emu10k1 * emu, ...@@ -589,7 +589,7 @@ static void snd_emu10k1_ecard_setadcgain(struct snd_emu10k1 * emu,
snd_emu10k1_ecard_write(emu, emu->ecard_ctrl); snd_emu10k1_ecard_write(emu, emu->ecard_ctrl);
} }
static int snd_emu10k1_ecard_init(struct snd_emu10k1 * emu) static int snd_emu10k1_ecard_init(struct snd_emu10k1 *emu)
{ {
unsigned int hc_value; unsigned int hc_value;
...@@ -598,7 +598,7 @@ static int snd_emu10k1_ecard_init(struct snd_emu10k1 * emu) ...@@ -598,7 +598,7 @@ static int snd_emu10k1_ecard_init(struct snd_emu10k1 * emu)
EC_SPDIF0_SELECT(EC_DEFAULT_SPDIF0_SEL) | EC_SPDIF0_SELECT(EC_DEFAULT_SPDIF0_SEL) |
EC_SPDIF1_SELECT(EC_DEFAULT_SPDIF1_SEL); EC_SPDIF1_SELECT(EC_DEFAULT_SPDIF1_SEL);
/* Step 0: Set the codec type in the hardware control register /* Step 0: Set the codec type in the hardware control register
* and enable audio output */ * and enable audio output */
hc_value = inl(emu->port + HCFG); hc_value = inl(emu->port + HCFG);
outl(hc_value | HCFG_AUDIOENABLE | HCFG_CODECFORMAT_I2S, emu->port + HCFG); outl(hc_value | HCFG_AUDIOENABLE | HCFG_CODECFORMAT_I2S, emu->port + HCFG);
...@@ -629,7 +629,7 @@ static int snd_emu10k1_ecard_init(struct snd_emu10k1 * emu) ...@@ -629,7 +629,7 @@ static int snd_emu10k1_ecard_init(struct snd_emu10k1 * emu)
return 0; return 0;
} }
static int snd_emu10k1_cardbus_init(struct snd_emu10k1 * emu) static int snd_emu10k1_cardbus_init(struct snd_emu10k1 *emu)
{ {
unsigned long special_port; unsigned long special_port;
unsigned int value; unsigned int value;
...@@ -656,7 +656,7 @@ static int snd_emu10k1_cardbus_init(struct snd_emu10k1 * emu) ...@@ -656,7 +656,7 @@ static int snd_emu10k1_cardbus_init(struct snd_emu10k1 * emu)
return 0; return 0;
} }
static int snd_emu1010_load_firmware(struct snd_emu10k1 * emu, const char * filename) static int snd_emu1010_load_firmware(struct snd_emu10k1 *emu, const char *filename)
{ {
int err; int err;
int n, i; int n, i;
...@@ -666,11 +666,12 @@ static int snd_emu1010_load_firmware(struct snd_emu10k1 * emu, const char * file ...@@ -666,11 +666,12 @@ static int snd_emu1010_load_firmware(struct snd_emu10k1 * emu, const char * file
unsigned long flags; unsigned long flags;
const struct firmware *fw_entry; const struct firmware *fw_entry;
if ((err = request_firmware(&fw_entry, filename, &emu->pci->dev)) != 0) { err = request_firmware(&fw_entry, filename, &emu->pci->dev);
snd_printk(KERN_ERR "firmware: %s not found. Err=%d\n",filename, err); if (err != 0) {
snd_printk(KERN_ERR "firmware: %s not found. Err = %d\n", filename, err);
return err; return err;
} }
snd_printk(KERN_INFO "firmware size=0x%zx\n", fw_entry->size); snd_printk(KERN_INFO "firmware size = 0x%zx\n", fw_entry->size);
/* The FPGA is a Xilinx Spartan IIE XC2S50E */ /* The FPGA is a Xilinx Spartan IIE XC2S50E */
/* GPIO7 -> FPGA PGMN /* GPIO7 -> FPGA PGMN
...@@ -685,13 +686,13 @@ static int snd_emu1010_load_firmware(struct snd_emu10k1 * emu, const char * file ...@@ -685,13 +686,13 @@ static int snd_emu1010_load_firmware(struct snd_emu10k1 * emu, const char * file
outl(0x80, emu->port + A_IOCFG); /* Leave bit 7 set during netlist setup. */ outl(0x80, emu->port + A_IOCFG); /* Leave bit 7 set during netlist setup. */
write_post = inl(emu->port + A_IOCFG); write_post = inl(emu->port + A_IOCFG);
udelay(100); /* Allow FPGA memory to clean */ udelay(100); /* Allow FPGA memory to clean */
for(n = 0; n < fw_entry->size; n++) { for (n = 0; n < fw_entry->size; n++) {
value=fw_entry->data[n]; value = fw_entry->data[n];
for(i = 0; i < 8; i++) { for (i = 0; i < 8; i++) {
reg = 0x80; reg = 0x80;
if (value & 0x1) if (value & 0x1)
reg = reg | 0x20; reg = reg | 0x20;
value = value >> 1; value = value >> 1;
outl(reg, emu->port + A_IOCFG); outl(reg, emu->port + A_IOCFG);
write_post = inl(emu->port + A_IOCFG); write_post = inl(emu->port + A_IOCFG);
outl(reg | 0x40, emu->port + A_IOCFG); outl(reg | 0x40, emu->port + A_IOCFG);
...@@ -703,14 +704,14 @@ static int snd_emu1010_load_firmware(struct snd_emu10k1 * emu, const char * file ...@@ -703,14 +704,14 @@ static int snd_emu1010_load_firmware(struct snd_emu10k1 * emu, const char * file
write_post = inl(emu->port + A_IOCFG); write_post = inl(emu->port + A_IOCFG);
spin_unlock_irqrestore(&emu->emu_lock, flags); spin_unlock_irqrestore(&emu->emu_lock, flags);
release_firmware(fw_entry); release_firmware(fw_entry);
return 0; return 0;
} }
static int emu1010_firmware_thread(void *data) static int emu1010_firmware_thread(void *data)
{ {
struct snd_emu10k1 * emu = data; struct snd_emu10k1 *emu = data;
int tmp,tmp2; int tmp, tmp2;
int reg; int reg;
int err; int err;
...@@ -719,50 +720,50 @@ static int emu1010_firmware_thread(void *data) ...@@ -719,50 +720,50 @@ static int emu1010_firmware_thread(void *data)
msleep_interruptible(1000); msleep_interruptible(1000);
if (kthread_should_stop()) if (kthread_should_stop())
break; break;
snd_emu1010_fpga_read(emu, EMU_HANA_IRQ_STATUS, &tmp ); /* IRQ Status */ snd_emu1010_fpga_read(emu, EMU_HANA_IRQ_STATUS, &tmp); /* IRQ Status */
snd_emu1010_fpga_read(emu, EMU_HANA_OPTION_CARDS, &reg ); /* OPTIONS: Which cards are attached to the EMU */ snd_emu1010_fpga_read(emu, EMU_HANA_OPTION_CARDS, &reg); /* OPTIONS: Which cards are attached to the EMU */
if (reg & EMU_HANA_OPTION_DOCK_OFFLINE) { if (reg & EMU_HANA_OPTION_DOCK_OFFLINE) {
/* Audio Dock attached */ /* Audio Dock attached */
/* Return to Audio Dock programming mode */ /* Return to Audio Dock programming mode */
snd_printk(KERN_INFO "emu1010: Loading Audio Dock Firmware\n"); snd_printk(KERN_INFO "emu1010: Loading Audio Dock Firmware\n");
snd_emu1010_fpga_write(emu, EMU_HANA_FPGA_CONFIG, EMU_HANA_FPGA_CONFIG_AUDIODOCK ); snd_emu1010_fpga_write(emu, EMU_HANA_FPGA_CONFIG, EMU_HANA_FPGA_CONFIG_AUDIODOCK);
if (emu->card_capabilities->emu_model == if (emu->card_capabilities->emu_model ==
EMU_MODEL_EMU1010) { EMU_MODEL_EMU1010) {
if ((err = snd_emu1010_load_firmware(emu, DOCK_FILENAME)) != 0) { err = snd_emu1010_load_firmware(emu, DOCK_FILENAME);
if (err != 0)
continue; continue;
}
} else if (emu->card_capabilities->emu_model == } else if (emu->card_capabilities->emu_model ==
EMU_MODEL_EMU1010B) { EMU_MODEL_EMU1010B) {
if ((err = snd_emu1010_load_firmware(emu, MICRO_DOCK_FILENAME)) != 0) { err = snd_emu1010_load_firmware(emu, MICRO_DOCK_FILENAME);
if (err != 0)
continue; continue;
}
} else if (emu->card_capabilities->emu_model == } else if (emu->card_capabilities->emu_model ==
EMU_MODEL_EMU1616) { EMU_MODEL_EMU1616) {
if ((err = snd_emu1010_load_firmware(emu, MICRO_DOCK_FILENAME)) != 0) { err = snd_emu1010_load_firmware(emu, MICRO_DOCK_FILENAME);
if (err != 0)
continue; continue;
}
} }
snd_emu1010_fpga_write(emu, EMU_HANA_FPGA_CONFIG, 0 ); snd_emu1010_fpga_write(emu, EMU_HANA_FPGA_CONFIG, 0);
snd_emu1010_fpga_read(emu, EMU_HANA_IRQ_STATUS, &reg ); snd_emu1010_fpga_read(emu, EMU_HANA_IRQ_STATUS, &reg);
snd_printk(KERN_INFO "emu1010: EMU_HANA+DOCK_IRQ_STATUS=0x%x\n",reg); snd_printk(KERN_INFO "emu1010: EMU_HANA+DOCK_IRQ_STATUS = 0x%x\n", reg);
/* ID, should read & 0x7f = 0x55 when FPGA programmed. */ /* ID, should read & 0x7f = 0x55 when FPGA programmed. */
snd_emu1010_fpga_read(emu, EMU_HANA_ID, &reg ); snd_emu1010_fpga_read(emu, EMU_HANA_ID, &reg);
snd_printk(KERN_INFO "emu1010: EMU_HANA+DOCK_ID=0x%x\n",reg); snd_printk(KERN_INFO "emu1010: EMU_HANA+DOCK_ID = 0x%x\n", reg);
if ((reg & 0x1f) != 0x15) { if ((reg & 0x1f) != 0x15) {
/* FPGA failed to be programmed */ /* FPGA failed to be programmed */
snd_printk(KERN_INFO "emu1010: Loading Audio Dock Firmware file failed, reg=0x%x\n", reg); snd_printk(KERN_INFO "emu1010: Loading Audio Dock Firmware file failed, reg = 0x%x\n", reg);
continue; continue;
} }
snd_printk(KERN_INFO "emu1010: Audio Dock Firmware loaded\n"); snd_printk(KERN_INFO "emu1010: Audio Dock Firmware loaded\n");
snd_emu1010_fpga_read(emu, EMU_DOCK_MAJOR_REV, &tmp ); snd_emu1010_fpga_read(emu, EMU_DOCK_MAJOR_REV, &tmp);
snd_emu1010_fpga_read(emu, EMU_DOCK_MINOR_REV, &tmp2 ); snd_emu1010_fpga_read(emu, EMU_DOCK_MINOR_REV, &tmp2);
snd_printk("Audio Dock ver:%d.%d\n",tmp ,tmp2); snd_printk("Audio Dock ver:%d.%d\n", tmp, tmp2);
/* Sync clocking between 1010 and Dock */ /* Sync clocking between 1010 and Dock */
/* Allow DLL to settle */ /* Allow DLL to settle */
msleep(10); msleep(10);
/* Unmute all. Default is muted after a firmware load */ /* Unmute all. Default is muted after a firmware load */
snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, EMU_UNMUTE ); snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, EMU_UNMUTE);
} }
} }
snd_printk(KERN_INFO "emu1010: firmware thread stopping\n"); snd_printk(KERN_INFO "emu1010: firmware thread stopping\n");
...@@ -800,10 +801,10 @@ static int emu1010_firmware_thread(void *data) ...@@ -800,10 +801,10 @@ static int emu1010_firmware_thread(void *data)
* 16 x 16-bit playback - snd_emu10k1_fx8010_playback_ops * 16 x 16-bit playback - snd_emu10k1_fx8010_playback_ops
* 16 x 32-bit capture - snd_emu10k1_capture_efx_ops * 16 x 32-bit capture - snd_emu10k1_capture_efx_ops
*/ */
static int snd_emu10k1_emu1010_init(struct snd_emu10k1 * emu) static int snd_emu10k1_emu1010_init(struct snd_emu10k1 *emu)
{ {
unsigned int i; unsigned int i;
int tmp,tmp2; int tmp, tmp2;
int reg; int reg;
int err; int err;
const char *filename = NULL; const char *filename = NULL;
...@@ -818,7 +819,7 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 * emu) ...@@ -818,7 +819,7 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 * emu)
* Lock Tank Memory Cache, * Lock Tank Memory Cache,
* Mute all codecs. * Mute all codecs.
*/ */
outl(0x0005a004, emu->port + HCFG); outl(0x0005a004, emu->port + HCFG);
/* AC97 2.1, Any 16Meg of 4Gig address, Auto-Mute, EMU32 Slave, /* AC97 2.1, Any 16Meg of 4Gig address, Auto-Mute, EMU32 Slave,
* Mute all codecs. * Mute all codecs.
*/ */
...@@ -829,25 +830,25 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 * emu) ...@@ -829,25 +830,25 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 * emu)
outl(0x0005a000, emu->port + HCFG); outl(0x0005a000, emu->port + HCFG);
/* Disable 48Volt power to Audio Dock */ /* Disable 48Volt power to Audio Dock */
snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_PWR, 0 ); snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_PWR, 0);
/* ID, should read & 0x7f = 0x55. (Bit 7 is the IRQ bit) */ /* ID, should read & 0x7f = 0x55. (Bit 7 is the IRQ bit) */
snd_emu1010_fpga_read(emu, EMU_HANA_ID, &reg ); snd_emu1010_fpga_read(emu, EMU_HANA_ID, &reg);
snd_printdd("reg1=0x%x\n",reg); snd_printdd("reg1 = 0x%x\n", reg);
if ((reg & 0x3f) == 0x15) { if ((reg & 0x3f) == 0x15) {
/* FPGA netlist already present so clear it */ /* FPGA netlist already present so clear it */
/* Return to programming mode */ /* Return to programming mode */
snd_emu1010_fpga_write(emu, EMU_HANA_FPGA_CONFIG, 0x02 ); snd_emu1010_fpga_write(emu, EMU_HANA_FPGA_CONFIG, 0x02);
} }
snd_emu1010_fpga_read(emu, EMU_HANA_ID, &reg ); snd_emu1010_fpga_read(emu, EMU_HANA_ID, &reg);
snd_printdd("reg2=0x%x\n",reg); snd_printdd("reg2 = 0x%x\n", reg);
if ((reg & 0x3f) == 0x15) { if ((reg & 0x3f) == 0x15) {
/* FPGA failed to return to programming mode */ /* FPGA failed to return to programming mode */
snd_printk(KERN_INFO "emu1010: FPGA failed to return to programming mode\n"); snd_printk(KERN_INFO "emu1010: FPGA failed to return to programming mode\n");
return -ENODEV; return -ENODEV;
} }
snd_printk(KERN_INFO "emu1010: EMU_HANA_ID=0x%x\n",reg); snd_printk(KERN_INFO "emu1010: EMU_HANA_ID = 0x%x\n", reg);
switch (emu->card_capabilities->emu_model) { switch (emu->card_capabilities->emu_model) {
case EMU_MODEL_EMU1010: case EMU_MODEL_EMU1010:
filename = HANA_FILENAME; filename = HANA_FILENAME;
...@@ -876,25 +877,25 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 * emu) ...@@ -876,25 +877,25 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 * emu)
} }
/* ID, should read & 0x7f = 0x55 when FPGA programmed. */ /* ID, should read & 0x7f = 0x55 when FPGA programmed. */
snd_emu1010_fpga_read(emu, EMU_HANA_ID, &reg ); snd_emu1010_fpga_read(emu, EMU_HANA_ID, &reg);
if ((reg & 0x3f) != 0x15) { if ((reg & 0x3f) != 0x15) {
/* FPGA failed to be programmed */ /* FPGA failed to be programmed */
snd_printk(KERN_INFO "emu1010: Loading Hana Firmware file failed, reg=0x%x\n", reg); snd_printk(KERN_INFO "emu1010: Loading Hana Firmware file failed, reg = 0x%x\n", reg);
return -ENODEV; return -ENODEV;
} }
snd_printk(KERN_INFO "emu1010: Hana Firmware loaded\n"); snd_printk(KERN_INFO "emu1010: Hana Firmware loaded\n");
snd_emu1010_fpga_read(emu, EMU_HANA_MAJOR_REV, &tmp ); snd_emu1010_fpga_read(emu, EMU_HANA_MAJOR_REV, &tmp);
snd_emu1010_fpga_read(emu, EMU_HANA_MINOR_REV, &tmp2 ); snd_emu1010_fpga_read(emu, EMU_HANA_MINOR_REV, &tmp2);
snd_printk("Hana ver:%d.%d\n",tmp ,tmp2); snd_printk("emu1010: Hana version: %d.%d\n", tmp, tmp2);
/* Enable 48Volt power to Audio Dock */ /* Enable 48Volt power to Audio Dock */
snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_PWR, EMU_HANA_DOCK_PWR_ON ); snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_PWR, EMU_HANA_DOCK_PWR_ON);
snd_emu1010_fpga_read(emu, EMU_HANA_OPTION_CARDS, &reg ); snd_emu1010_fpga_read(emu, EMU_HANA_OPTION_CARDS, &reg);
snd_printk(KERN_INFO "emu1010: Card options=0x%x\n",reg); snd_printk(KERN_INFO "emu1010: Card options = 0x%x\n", reg);
snd_emu1010_fpga_read(emu, EMU_HANA_OPTION_CARDS, &reg ); snd_emu1010_fpga_read(emu, EMU_HANA_OPTION_CARDS, &reg);
snd_printk(KERN_INFO "emu1010: Card options=0x%x\n",reg); snd_printk(KERN_INFO "emu1010: Card options = 0x%x\n", reg);
snd_emu1010_fpga_read(emu, EMU_HANA_OPTICAL_TYPE, &tmp ); snd_emu1010_fpga_read(emu, EMU_HANA_OPTICAL_TYPE, &tmp);
/* Optical -> ADAT I/O */ /* Optical -> ADAT I/O */
/* 0 : SPDIF /* 0 : SPDIF
* 1 : ADAT * 1 : ADAT
...@@ -904,41 +905,42 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 * emu) ...@@ -904,41 +905,42 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 * emu)
tmp = 0; tmp = 0;
tmp = (emu->emu1010.optical_in ? EMU_HANA_OPTICAL_IN_ADAT : 0) | tmp = (emu->emu1010.optical_in ? EMU_HANA_OPTICAL_IN_ADAT : 0) |
(emu->emu1010.optical_out ? EMU_HANA_OPTICAL_OUT_ADAT : 0); (emu->emu1010.optical_out ? EMU_HANA_OPTICAL_OUT_ADAT : 0);
snd_emu1010_fpga_write(emu, EMU_HANA_OPTICAL_TYPE, tmp ); snd_emu1010_fpga_write(emu, EMU_HANA_OPTICAL_TYPE, tmp);
snd_emu1010_fpga_read(emu, EMU_HANA_ADC_PADS, &tmp ); snd_emu1010_fpga_read(emu, EMU_HANA_ADC_PADS, &tmp);
/* Set no attenuation on Audio Dock pads. */ /* Set no attenuation on Audio Dock pads. */
snd_emu1010_fpga_write(emu, EMU_HANA_ADC_PADS, 0x00 ); snd_emu1010_fpga_write(emu, EMU_HANA_ADC_PADS, 0x00);
emu->emu1010.adc_pads = 0x00; emu->emu1010.adc_pads = 0x00;
snd_emu1010_fpga_read(emu, EMU_HANA_DOCK_MISC, &tmp ); snd_emu1010_fpga_read(emu, EMU_HANA_DOCK_MISC, &tmp);
/* Unmute Audio dock DACs, Headphone source DAC-4. */ /* Unmute Audio dock DACs, Headphone source DAC-4. */
snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_MISC, 0x30 ); snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_MISC, 0x30);
snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_LEDS_2, 0x12 ); snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_LEDS_2, 0x12);
snd_emu1010_fpga_read(emu, EMU_HANA_DAC_PADS, &tmp ); snd_emu1010_fpga_read(emu, EMU_HANA_DAC_PADS, &tmp);
/* DAC PADs. */ /* DAC PADs. */
snd_emu1010_fpga_write(emu, EMU_HANA_DAC_PADS, 0x0f ); snd_emu1010_fpga_write(emu, EMU_HANA_DAC_PADS, 0x0f);
emu->emu1010.dac_pads = 0x0f; emu->emu1010.dac_pads = 0x0f;
snd_emu1010_fpga_read(emu, EMU_HANA_DOCK_MISC, &tmp ); snd_emu1010_fpga_read(emu, EMU_HANA_DOCK_MISC, &tmp);
snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_MISC, 0x30 ); snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_MISC, 0x30);
snd_emu1010_fpga_read(emu, EMU_HANA_SPDIF_MODE, &tmp ); snd_emu1010_fpga_read(emu, EMU_HANA_SPDIF_MODE, &tmp);
/* SPDIF Format. Set Consumer mode, 24bit, copy enable */ /* SPDIF Format. Set Consumer mode, 24bit, copy enable */
snd_emu1010_fpga_write(emu, EMU_HANA_SPDIF_MODE, 0x10 ); snd_emu1010_fpga_write(emu, EMU_HANA_SPDIF_MODE, 0x10);
/* MIDI routing */ /* MIDI routing */
snd_emu1010_fpga_write(emu, EMU_HANA_MIDI_IN, 0x19 ); snd_emu1010_fpga_write(emu, EMU_HANA_MIDI_IN, 0x19);
/* Unknown. */ /* Unknown. */
snd_emu1010_fpga_write(emu, EMU_HANA_MIDI_OUT, 0x0c ); snd_emu1010_fpga_write(emu, EMU_HANA_MIDI_OUT, 0x0c);
/* snd_emu1010_fpga_write(emu, 0x09, 0x0f ); // IRQ Enable: All on */ /* IRQ Enable: Alll on */
/* snd_emu1010_fpga_write(emu, 0x09, 0x0f ); */
/* IRQ Enable: All off */ /* IRQ Enable: All off */
snd_emu1010_fpga_write(emu, EMU_HANA_IRQ_ENABLE, 0x00 ); snd_emu1010_fpga_write(emu, EMU_HANA_IRQ_ENABLE, 0x00);
snd_emu1010_fpga_read(emu, EMU_HANA_OPTION_CARDS, &reg ); snd_emu1010_fpga_read(emu, EMU_HANA_OPTION_CARDS, &reg);
snd_printk(KERN_INFO "emu1010: Card options3=0x%x\n",reg); snd_printk(KERN_INFO "emu1010: Card options3 = 0x%x\n", reg);
/* Default WCLK set to 48kHz. */ /* Default WCLK set to 48kHz. */
snd_emu1010_fpga_write(emu, EMU_HANA_DEFCLOCK, 0x00 ); snd_emu1010_fpga_write(emu, EMU_HANA_DEFCLOCK, 0x00);
/* Word Clock source, Internal 48kHz x1 */ /* Word Clock source, Internal 48kHz x1 */
snd_emu1010_fpga_write(emu, EMU_HANA_WCLOCK, EMU_HANA_WCLOCK_INT_48K ); snd_emu1010_fpga_write(emu, EMU_HANA_WCLOCK, EMU_HANA_WCLOCK_INT_48K);
//snd_emu1010_fpga_write(emu, EMU_HANA_WCLOCK, EMU_HANA_WCLOCK_INT_48K | EMU_HANA_WCLOCK_4X ); /* snd_emu1010_fpga_write(emu, EMU_HANA_WCLOCK, EMU_HANA_WCLOCK_INT_48K | EMU_HANA_WCLOCK_4X); */
/* Audio Dock LEDs. */ /* Audio Dock LEDs. */
snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_LEDS_2, 0x12 ); snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_LEDS_2, 0x12);
#if 0 #if 0
/* For 96kHz */ /* For 96kHz */
...@@ -992,7 +994,7 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 * emu) ...@@ -992,7 +994,7 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 * emu)
* Defaults only, users will set their own values anyways, let's * Defaults only, users will set their own values anyways, let's
* just copy/paste. * just copy/paste.
*/ */
snd_emu1010_fpga_link_dst_src_write(emu, snd_emu1010_fpga_link_dst_src_write(emu,
EMU_DST_ALICE2_EMU32_8, EMU_SRC_DOCK_MIC_A1); EMU_DST_ALICE2_EMU32_8, EMU_SRC_DOCK_MIC_A1);
snd_emu1010_fpga_link_dst_src_write(emu, snd_emu1010_fpga_link_dst_src_write(emu,
...@@ -1037,19 +1039,19 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 * emu) ...@@ -1037,19 +1039,19 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 * emu)
snd_emu1010_fpga_link_dst_src_write(emu, snd_emu1010_fpga_link_dst_src_write(emu,
EMU_DST_ALICE2_EMU32_F, EMU_SRC_HAMOA_ADC_LEFT2); EMU_DST_ALICE2_EMU32_F, EMU_SRC_HAMOA_ADC_LEFT2);
#endif #endif
for (i = 0;i < 0x20; i++ ) { for (i = 0; i < 0x20; i++) {
/* AudioDock Elink <- Silence */ /* AudioDock Elink <- Silence */
snd_emu1010_fpga_link_dst_src_write(emu, 0x0100+i, EMU_SRC_SILENCE); snd_emu1010_fpga_link_dst_src_write(emu, 0x0100 + i, EMU_SRC_SILENCE);
} }
for (i = 0;i < 4; i++) { for (i = 0; i < 4; i++) {
/* Hana SPDIF Out <- Silence */ /* Hana SPDIF Out <- Silence */
snd_emu1010_fpga_link_dst_src_write(emu, 0x0200+i, EMU_SRC_SILENCE); snd_emu1010_fpga_link_dst_src_write(emu, 0x0200 + i, EMU_SRC_SILENCE);
} }
for (i = 0;i < 7; i++) { for (i = 0; i < 7; i++) {
/* Hamoa DAC <- Silence */ /* Hamoa DAC <- Silence */
snd_emu1010_fpga_link_dst_src_write(emu, 0x0300+i, EMU_SRC_SILENCE); snd_emu1010_fpga_link_dst_src_write(emu, 0x0300 + i, EMU_SRC_SILENCE);
} }
for (i = 0;i < 7; i++) { for (i = 0; i < 7; i++) {
/* Hana ADAT Out <- Silence */ /* Hana ADAT Out <- Silence */
snd_emu1010_fpga_link_dst_src_write(emu, EMU_DST_HANA_ADAT + i, EMU_SRC_SILENCE); snd_emu1010_fpga_link_dst_src_write(emu, EMU_DST_HANA_ADAT + i, EMU_SRC_SILENCE);
} }
...@@ -1065,30 +1067,30 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 * emu) ...@@ -1065,30 +1067,30 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 * emu)
EMU_DST_ALICE_I2S2_LEFT, EMU_SRC_DOCK_ADC3_LEFT1); EMU_DST_ALICE_I2S2_LEFT, EMU_SRC_DOCK_ADC3_LEFT1);
snd_emu1010_fpga_link_dst_src_write(emu, snd_emu1010_fpga_link_dst_src_write(emu,
EMU_DST_ALICE_I2S2_RIGHT, EMU_SRC_DOCK_ADC3_RIGHT1); EMU_DST_ALICE_I2S2_RIGHT, EMU_SRC_DOCK_ADC3_RIGHT1);
snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, 0x01 ); // Unmute all snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, 0x01); /* Unmute all */
snd_emu1010_fpga_read(emu, EMU_HANA_OPTION_CARDS, &tmp);
snd_emu1010_fpga_read(emu, EMU_HANA_OPTION_CARDS, &tmp );
/* AC97 1.03, Any 32Meg of 2Gig address, Auto-Mute, EMU32 Slave, /* AC97 1.03, Any 32Meg of 2Gig address, Auto-Mute, EMU32 Slave,
* Lock Sound Memory Cache, Lock Tank Memory Cache, * Lock Sound Memory Cache, Lock Tank Memory Cache,
* Mute all codecs. * Mute all codecs.
*/ */
outl(0x0000a000, emu->port + HCFG); outl(0x0000a000, emu->port + HCFG);
/* AC97 1.03, Any 32Meg of 2Gig address, Auto-Mute, EMU32 Slave, /* AC97 1.03, Any 32Meg of 2Gig address, Auto-Mute, EMU32 Slave,
* Lock Sound Memory Cache, Lock Tank Memory Cache, * Lock Sound Memory Cache, Lock Tank Memory Cache,
* Un-Mute all codecs. * Un-Mute all codecs.
*/ */
outl(0x0000a001, emu->port + HCFG); outl(0x0000a001, emu->port + HCFG);
/* Initial boot complete. Now patches */ /* Initial boot complete. Now patches */
snd_emu1010_fpga_read(emu, EMU_HANA_OPTION_CARDS, &tmp ); snd_emu1010_fpga_read(emu, EMU_HANA_OPTION_CARDS, &tmp);
snd_emu1010_fpga_write(emu, EMU_HANA_MIDI_IN, 0x19 ); /* MIDI Route */ snd_emu1010_fpga_write(emu, EMU_HANA_MIDI_IN, 0x19); /* MIDI Route */
snd_emu1010_fpga_write(emu, EMU_HANA_MIDI_OUT, 0x0c ); /* Unknown */ snd_emu1010_fpga_write(emu, EMU_HANA_MIDI_OUT, 0x0c); /* Unknown */
snd_emu1010_fpga_write(emu, EMU_HANA_MIDI_IN, 0x19 ); /* MIDI Route */ snd_emu1010_fpga_write(emu, EMU_HANA_MIDI_IN, 0x19); /* MIDI Route */
snd_emu1010_fpga_write(emu, EMU_HANA_MIDI_OUT, 0x0c ); /* Unknown */ snd_emu1010_fpga_write(emu, EMU_HANA_MIDI_OUT, 0x0c); /* Unknown */
snd_emu1010_fpga_read(emu, EMU_HANA_SPDIF_MODE, &tmp ); snd_emu1010_fpga_read(emu, EMU_HANA_SPDIF_MODE, &tmp);
snd_emu1010_fpga_write(emu, EMU_HANA_SPDIF_MODE, 0x10 ); /* SPDIF Format spdif (or 0x11 for aes/ebu) */ snd_emu1010_fpga_write(emu, EMU_HANA_SPDIF_MODE, 0x10); /* SPDIF Format spdif (or 0x11 for aes/ebu) */
/* Start Micro/Audio Dock firmware loader thread */ /* Start Micro/Audio Dock firmware loader thread */
if (!emu->emu1010.firmware_thread) { if (!emu->emu1010.firmware_thread) {
...@@ -1218,20 +1220,20 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 * emu) ...@@ -1218,20 +1220,20 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 * emu)
emu->emu1010.output_source[23] = 28; emu->emu1010.output_source[23] = 28;
} }
/* TEMP: Select SPDIF in/out */ /* TEMP: Select SPDIF in/out */
//snd_emu1010_fpga_write(emu, EMU_HANA_OPTICAL_TYPE, 0x0); /* Output spdif */ /* snd_emu1010_fpga_write(emu, EMU_HANA_OPTICAL_TYPE, 0x0); */ /* Output spdif */
/* TEMP: Select 48kHz SPDIF out */ /* TEMP: Select 48kHz SPDIF out */
snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, 0x0); /* Mute all */ snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, 0x0); /* Mute all */
snd_emu1010_fpga_write(emu, EMU_HANA_DEFCLOCK, 0x0); /* Default fallback clock 48kHz */ snd_emu1010_fpga_write(emu, EMU_HANA_DEFCLOCK, 0x0); /* Default fallback clock 48kHz */
/* Word Clock source, Internal 48kHz x1 */ /* Word Clock source, Internal 48kHz x1 */
snd_emu1010_fpga_write(emu, EMU_HANA_WCLOCK, EMU_HANA_WCLOCK_INT_48K ); snd_emu1010_fpga_write(emu, EMU_HANA_WCLOCK, EMU_HANA_WCLOCK_INT_48K);
//snd_emu1010_fpga_write(emu, EMU_HANA_WCLOCK, EMU_HANA_WCLOCK_INT_48K | EMU_HANA_WCLOCK_4X ); /* snd_emu1010_fpga_write(emu, EMU_HANA_WCLOCK, EMU_HANA_WCLOCK_INT_48K | EMU_HANA_WCLOCK_4X); */
emu->emu1010.internal_clock = 1; /* 48000 */ emu->emu1010.internal_clock = 1; /* 48000 */
snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_LEDS_2, 0x12);/* Set LEDs on Audio Dock */ snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_LEDS_2, 0x12); /* Set LEDs on Audio Dock */
snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, 0x1); /* Unmute all */ snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, 0x1); /* Unmute all */
//snd_emu1010_fpga_write(emu, 0x7, 0x0); /* Mute all */ /* snd_emu1010_fpga_write(emu, 0x7, 0x0); */ /* Mute all */
//snd_emu1010_fpga_write(emu, 0x7, 0x1); /* Unmute all */ /* snd_emu1010_fpga_write(emu, 0x7, 0x1); */ /* Unmute all */
//snd_emu1010_fpga_write(emu, 0xe, 0x12); /* Set LEDs on Audio Dock */ /* snd_emu1010_fpga_write(emu, 0xe, 0x12); */ /* Set LEDs on Audio Dock */
return 0; return 0;
} }
...@@ -1247,13 +1249,13 @@ static void free_pm_buffer(struct snd_emu10k1 *emu); ...@@ -1247,13 +1249,13 @@ static void free_pm_buffer(struct snd_emu10k1 *emu);
static int snd_emu10k1_free(struct snd_emu10k1 *emu) static int snd_emu10k1_free(struct snd_emu10k1 *emu)
{ {
if (emu->port) { /* avoid access to already used hardware */ if (emu->port) { /* avoid access to already used hardware */
snd_emu10k1_fx8010_tram_setup(emu, 0); snd_emu10k1_fx8010_tram_setup(emu, 0);
snd_emu10k1_done(emu); snd_emu10k1_done(emu);
snd_emu10k1_free_efx(emu); snd_emu10k1_free_efx(emu);
} }
if (emu->card_capabilities->emu_model == EMU_MODEL_EMU1010) { if (emu->card_capabilities->emu_model == EMU_MODEL_EMU1010) {
/* Disable 48Volt power to Audio Dock */ /* Disable 48Volt power to Audio Dock */
snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_PWR, 0 ); snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_PWR, 0);
} }
if (emu->emu1010.firmware_thread) if (emu->emu1010.firmware_thread)
kthread_stop(emu->emu1010.firmware_thread); kthread_stop(emu->emu1010.firmware_thread);
...@@ -1278,7 +1280,7 @@ static int snd_emu10k1_free(struct snd_emu10k1 *emu) ...@@ -1278,7 +1280,7 @@ static int snd_emu10k1_free(struct snd_emu10k1 *emu)
#endif #endif
if (emu->port) if (emu->port)
pci_release_regions(emu->pci); pci_release_regions(emu->pci);
if (emu->card_capabilities->ca0151_chip) /* P16V */ if (emu->card_capabilities->ca0151_chip) /* P16V */
snd_p16v_free(emu); snd_p16v_free(emu);
pci_disable_device(emu->pci); pci_disable_device(emu->pci);
kfree(emu); kfree(emu);
...@@ -1704,13 +1706,13 @@ static struct snd_emu_chip_details emu_chip_details[] = { ...@@ -1704,13 +1706,13 @@ static struct snd_emu_chip_details emu_chip_details[] = {
}; };
int __devinit snd_emu10k1_create(struct snd_card *card, int __devinit snd_emu10k1_create(struct snd_card *card,
struct pci_dev * pci, struct pci_dev *pci,
unsigned short extin_mask, unsigned short extin_mask,
unsigned short extout_mask, unsigned short extout_mask,
long max_cache_bytes, long max_cache_bytes,
int enable_ir, int enable_ir,
uint subsystem, uint subsystem,
struct snd_emu10k1 ** remu) struct snd_emu10k1 **remu)
{ {
struct snd_emu10k1 *emu; struct snd_emu10k1 *emu;
int idx, err; int idx, err;
...@@ -1720,11 +1722,12 @@ int __devinit snd_emu10k1_create(struct snd_card *card, ...@@ -1720,11 +1722,12 @@ int __devinit snd_emu10k1_create(struct snd_card *card,
static struct snd_device_ops ops = { static struct snd_device_ops ops = {
.dev_free = snd_emu10k1_dev_free, .dev_free = snd_emu10k1_dev_free,
}; };
*remu = NULL; *remu = NULL;
/* enable PCI device */ /* enable PCI device */
if ((err = pci_enable_device(pci)) < 0) err = pci_enable_device(pci);
if (err < 0)
return err; return err;
emu = kzalloc(sizeof(*emu), GFP_KERNEL); emu = kzalloc(sizeof(*emu), GFP_KERNEL);
...@@ -1751,16 +1754,17 @@ int __devinit snd_emu10k1_create(struct snd_card *card, ...@@ -1751,16 +1754,17 @@ int __devinit snd_emu10k1_create(struct snd_card *card,
emu->revision = pci->revision; emu->revision = pci->revision;
pci_read_config_dword(pci, PCI_SUBSYSTEM_VENDOR_ID, &emu->serial); pci_read_config_dword(pci, PCI_SUBSYSTEM_VENDOR_ID, &emu->serial);
pci_read_config_word(pci, PCI_SUBSYSTEM_ID, &emu->model); pci_read_config_word(pci, PCI_SUBSYSTEM_ID, &emu->model);
snd_printdd("vendor=0x%x, device=0x%x, subsystem_vendor_id=0x%x, subsystem_id=0x%x\n",pci->vendor, pci->device, emu->serial, emu->model); snd_printdd("vendor = 0x%x, device = 0x%x, subsystem_vendor_id = 0x%x, subsystem_id = 0x%x\n", pci->vendor, pci->device, emu->serial, emu->model);
for (c = emu_chip_details; c->vendor; c++) { for (c = emu_chip_details; c->vendor; c++) {
if (c->vendor == pci->vendor && c->device == pci->device) { if (c->vendor == pci->vendor && c->device == pci->device) {
if (subsystem) { if (subsystem) {
if (c->subsystem && (c->subsystem == subsystem) ) { if (c->subsystem && (c->subsystem == subsystem))
break; break;
} else continue; else
continue;
} else { } else {
if (c->subsystem && (c->subsystem != emu->serial) ) if (c->subsystem && (c->subsystem != emu->serial))
continue; continue;
if (c->revision && c->revision != emu->revision) if (c->revision && c->revision != emu->revision)
continue; continue;
...@@ -1776,14 +1780,18 @@ int __devinit snd_emu10k1_create(struct snd_card *card, ...@@ -1776,14 +1780,18 @@ int __devinit snd_emu10k1_create(struct snd_card *card,
} }
emu->card_capabilities = c; emu->card_capabilities = c;
if (c->subsystem && !subsystem) if (c->subsystem && !subsystem)
snd_printdd("Sound card name=%s\n", c->name); snd_printdd("Sound card name = %s\n", c->name);
else if (subsystem) else if (subsystem)
snd_printdd("Sound card name=%s, vendor=0x%x, device=0x%x, subsystem=0x%x. Forced to subsytem=0x%x\n", snd_printdd("Sound card name = %s, "
c->name, pci->vendor, pci->device, emu->serial, c->subsystem); "vendor = 0x%x, device = 0x%x, subsystem = 0x%x. "
else "Forced to subsytem = 0x%x\n", c->name,
snd_printdd("Sound card name=%s, vendor=0x%x, device=0x%x, subsystem=0x%x.\n", pci->vendor, pci->device, emu->serial, c->subsystem);
c->name, pci->vendor, pci->device, emu->serial); else
snd_printdd("Sound card name = %s, "
"vendor = 0x%x, device = 0x%x, subsystem = 0x%x.\n",
c->name, pci->vendor, pci->device,
emu->serial);
if (!*card->id && c->id) { if (!*card->id && c->id) {
int i, n = 0; int i, n = 0;
strlcpy(card->id, c->id, sizeof(card->id)); strlcpy(card->id, c->id, sizeof(card->id));
...@@ -1817,7 +1825,8 @@ int __devinit snd_emu10k1_create(struct snd_card *card, ...@@ -1817,7 +1825,8 @@ int __devinit snd_emu10k1_create(struct snd_card *card,
else else
emu->gpr_base = FXGPREGBASE; emu->gpr_base = FXGPREGBASE;
if ((err = pci_request_regions(pci, "EMU10K1")) < 0) { err = pci_request_regions(pci, "EMU10K1");
if (err < 0) {
kfree(emu); kfree(emu);
pci_disable_device(pci); pci_disable_device(pci);
return err; return err;
...@@ -1864,21 +1873,25 @@ int __devinit snd_emu10k1_create(struct snd_card *card, ...@@ -1864,21 +1873,25 @@ int __devinit snd_emu10k1_create(struct snd_card *card,
emu->enable_ir = enable_ir; emu->enable_ir = enable_ir;
if (emu->card_capabilities->ca_cardbus_chip) { if (emu->card_capabilities->ca_cardbus_chip) {
if ((err = snd_emu10k1_cardbus_init(emu)) < 0) err = snd_emu10k1_cardbus_init(emu);
if (err < 0)
goto error; goto error;
} }
if (emu->card_capabilities->ecard) { if (emu->card_capabilities->ecard) {
if ((err = snd_emu10k1_ecard_init(emu)) < 0) err = snd_emu10k1_ecard_init(emu);
if (err < 0)
goto error; goto error;
} else if (emu->card_capabilities->emu_model) { } else if (emu->card_capabilities->emu_model) {
if ((err = snd_emu10k1_emu1010_init(emu)) < 0) { err = snd_emu10k1_emu1010_init(emu);
snd_emu10k1_free(emu); if (err < 0) {
return err; snd_emu10k1_free(emu);
} return err;
}
} else { } else {
/* 5.1: Enable the additional AC97 Slots. If the emu10k1 version /* 5.1: Enable the additional AC97 Slots. If the emu10k1 version
does not support this, it shouldn't do any harm */ does not support this, it shouldn't do any harm */
snd_emu10k1_ptr_write(emu, AC97SLOT, 0, AC97SLOT_CNTR|AC97SLOT_LFE); snd_emu10k1_ptr_write(emu, AC97SLOT, 0,
AC97SLOT_CNTR|AC97SLOT_LFE);
} }
/* initialize TRAM setup */ /* initialize TRAM setup */
...@@ -1918,7 +1931,7 @@ int __devinit snd_emu10k1_create(struct snd_card *card, ...@@ -1918,7 +1931,7 @@ int __devinit snd_emu10k1_create(struct snd_card *card,
snd_emu10k1_synth_alloc(emu, 4096); snd_emu10k1_synth_alloc(emu, 4096);
if (emu->reserved_page) if (emu->reserved_page)
emu->reserved_page->map_locked = 1; emu->reserved_page->map_locked = 1;
/* Clear silent pages and set up pointers */ /* Clear silent pages and set up pointers */
memset(emu->silent_page.area, 0, PAGE_SIZE); memset(emu->silent_page.area, 0, PAGE_SIZE);
silent_page = emu->silent_page.addr << 1; silent_page = emu->silent_page.addr << 1;
...@@ -1931,19 +1944,23 @@ int __devinit snd_emu10k1_create(struct snd_card *card, ...@@ -1931,19 +1944,23 @@ int __devinit snd_emu10k1_create(struct snd_card *card,
emu->voices[idx].number = idx; emu->voices[idx].number = idx;
} }
if ((err = snd_emu10k1_init(emu, enable_ir, 0)) < 0) err = snd_emu10k1_init(emu, enable_ir, 0);
if (err < 0)
goto error; goto error;
#ifdef CONFIG_PM #ifdef CONFIG_PM
if ((err = alloc_pm_buffer(emu)) < 0) err = alloc_pm_buffer(emu);
if (err < 0)
goto error; goto error;
#endif #endif
/* Initialize the effect engine */ /* Initialize the effect engine */
if ((err = snd_emu10k1_init_efx(emu)) < 0) err = snd_emu10k1_init_efx(emu);
if (err < 0)
goto error; goto error;
snd_emu10k1_audio_enable(emu); snd_emu10k1_audio_enable(emu);
if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, emu, &ops)) < 0) err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, emu, &ops);
if (err < 0)
goto error; goto error;
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
...@@ -1983,7 +2000,7 @@ static int __devinit alloc_pm_buffer(struct snd_emu10k1 *emu) ...@@ -1983,7 +2000,7 @@ static int __devinit alloc_pm_buffer(struct snd_emu10k1 *emu)
if (emu->audigy) if (emu->audigy)
size += ARRAY_SIZE(saved_regs_audigy); size += ARRAY_SIZE(saved_regs_audigy);
emu->saved_ptr = vmalloc(4 * NUM_G * size); emu->saved_ptr = vmalloc(4 * NUM_G * size);
if (! emu->saved_ptr) if (!emu->saved_ptr)
return -ENOMEM; return -ENOMEM;
if (snd_emu10k1_efx_alloc_pm_buffer(emu) < 0) if (snd_emu10k1_efx_alloc_pm_buffer(emu) < 0)
return -ENOMEM; return -ENOMEM;
...@@ -2028,7 +2045,7 @@ void snd_emu10k1_resume_init(struct snd_emu10k1 *emu) ...@@ -2028,7 +2045,7 @@ void snd_emu10k1_resume_init(struct snd_emu10k1 *emu)
if (emu->card_capabilities->ecard) if (emu->card_capabilities->ecard)
snd_emu10k1_ecard_init(emu); snd_emu10k1_ecard_init(emu);
else if (emu->card_capabilities->emu_model) else if (emu->card_capabilities->emu_model)
snd_emu10k1_emu1010_init(emu); snd_emu10k1_emu1010_init(emu);
else else
snd_emu10k1_ptr_write(emu, AC97SLOT, 0, AC97SLOT_CNTR|AC97SLOT_LFE); snd_emu10k1_ptr_write(emu, AC97SLOT, 0, AC97SLOT_CNTR|AC97SLOT_LFE);
snd_emu10k1_init(emu, emu->enable_ir, 1); snd_emu10k1_init(emu, emu->enable_ir, 1);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment