Commit 3839e4f1 authored by Takashi Iwai's avatar Takashi Iwai Committed by Mercurial server

[ALSA] emu10k1 - Use enum for emu_model types

Use enum instead of digits for emu_model types.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarJaroslav Kysela <perex@perex.cz>
parent 88aa1390
...@@ -1642,6 +1642,14 @@ struct snd_emu10k1_midi { ...@@ -1642,6 +1642,14 @@ struct snd_emu10k1_midi {
void (*interrupt)(struct snd_emu10k1 *emu, unsigned int status); void (*interrupt)(struct snd_emu10k1 *emu, unsigned int status);
}; };
enum {
EMU_MODEL_SB,
EMU_MODEL_EMU1010,
EMU_MODEL_EMU1010B,
EMU_MODEL_EMU1616,
EMU_MODEL_EMU0404,
};
struct snd_emu_chip_details { struct snd_emu_chip_details {
u32 vendor; u32 vendor;
u32 device; u32 device;
......
...@@ -725,15 +725,18 @@ int emu1010_firmware_thread(void *data) { ...@@ -725,15 +725,18 @@ int emu1010_firmware_thread(void *data) {
/* 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 == 1) { if (emu->card_capabilities->emu_model ==
EMU_MODEL_EMU1010) {
if ((err = snd_emu1010_load_firmware(emu, DOCK_FILENAME)) != 0) { if ((err = snd_emu1010_load_firmware(emu, DOCK_FILENAME)) != 0) {
continue; continue;
} }
} else if (emu->card_capabilities->emu_model == 2) { } else if (emu->card_capabilities->emu_model ==
EMU_MODEL_EMU1010B) {
if ((err = snd_emu1010_load_firmware(emu, MICRO_DOCK_FILENAME)) != 0) { if ((err = snd_emu1010_load_firmware(emu, MICRO_DOCK_FILENAME)) != 0) {
continue; continue;
} }
} else if (emu->card_capabilities->emu_model == 3) { } else if (emu->card_capabilities->emu_model ==
EMU_MODEL_EMU1616) {
if ((err = snd_emu1010_load_firmware(emu, MICRO_DOCK_FILENAME)) != 0) { if ((err = snd_emu1010_load_firmware(emu, MICRO_DOCK_FILENAME)) != 0) {
continue; continue;
} }
...@@ -845,16 +848,16 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 * emu) ...@@ -845,16 +848,16 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 * emu)
} }
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 1: case EMU_MODEL_EMU1010:
filename = HANA_FILENAME; filename = HANA_FILENAME;
break; break;
case 2: case EMU_MODEL_EMU1010B:
filename = EMU1010B_FILENAME; filename = EMU1010B_FILENAME;
break; break;
case 3: case EMU_MODEL_EMU1616:
filename = EMU1010_NOTEBOOK_FILENAME; filename = EMU1010_NOTEBOOK_FILENAME;
break; break;
case 4: case EMU_MODEL_EMU0404:
filename = EMU0404_FILENAME; filename = EMU0404_FILENAME;
break; break;
default: default:
...@@ -1103,7 +1106,7 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 * emu) ...@@ -1103,7 +1106,7 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 * emu)
EMU_DST_HANA_SPDIF_RIGHT1, EMU_SRC_ALICE_EMU32A + 3); /* ALICE2 bus 0xb3 */ EMU_DST_HANA_SPDIF_RIGHT1, EMU_SRC_ALICE_EMU32A + 3); /* ALICE2 bus 0xb3 */
#endif #endif
/* Default outputs */ /* Default outputs */
if (emu->card_capabilities->emu_model == 3) { if (emu->card_capabilities->emu_model == EMU_MODEL_EMU1616) {
/* 1616(M) cardbus default outputs */ /* 1616(M) cardbus default outputs */
/* ALICE2 bus 0xa0 */ /* ALICE2 bus 0xa0 */
snd_emu1010_fpga_link_dst_src_write(emu, snd_emu1010_fpga_link_dst_src_write(emu,
...@@ -1250,7 +1253,7 @@ static int snd_emu10k1_free(struct snd_emu10k1 *emu) ...@@ -1250,7 +1253,7 @@ static int snd_emu10k1_free(struct snd_emu10k1 *emu)
} }
snd_emu10k1_free_efx(emu); snd_emu10k1_free_efx(emu);
} }
if (emu->card_capabilities->emu_model == 1) { 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 );
} }
...@@ -1394,7 +1397,7 @@ static struct snd_emu_chip_details emu_chip_details[] = { ...@@ -1394,7 +1397,7 @@ static struct snd_emu_chip_details emu_chip_details[] = {
.emu10k2_chip = 1, .emu10k2_chip = 1,
.ca0102_chip = 1, .ca0102_chip = 1,
.spk71 = 1, .spk71 = 1,
.emu_model = 4} , /* EMU 0404 */ .emu_model = EMU_MODEL_EMU0404} , /* EMU 0404 */
/* Tested by James@superbug.co.uk 4th Nov 2007. */ /* Tested by James@superbug.co.uk 4th Nov 2007. */
{.vendor = 0x1102, .device = 0x0008, .subsystem = 0x42011102, {.vendor = 0x1102, .device = 0x0008, .subsystem = 0x42011102,
.driver = "Audigy2", .name = "E-mu 1010 Notebook [MAEM8950]", .driver = "Audigy2", .name = "E-mu 1010 Notebook [MAEM8950]",
...@@ -1403,7 +1406,7 @@ static struct snd_emu_chip_details emu_chip_details[] = { ...@@ -1403,7 +1406,7 @@ static struct snd_emu_chip_details emu_chip_details[] = {
.ca0108_chip = 1, .ca0108_chip = 1,
.ca_cardbus_chip = 1, .ca_cardbus_chip = 1,
.spk71 = 1 , .spk71 = 1 ,
.emu_model = 3} , .emu_model = EMU_MODEL_EMU1616},
/* Tested by James@superbug.co.uk 4th Nov 2007. */ /* Tested by James@superbug.co.uk 4th Nov 2007. */
{.vendor = 0x1102, .device = 0x0008, .subsystem = 0x40041102, {.vendor = 0x1102, .device = 0x0008, .subsystem = 0x40041102,
.driver = "Audigy2", .name = "E-mu 1010b PCI [MAEM????]", .driver = "Audigy2", .name = "E-mu 1010b PCI [MAEM????]",
...@@ -1411,7 +1414,7 @@ static struct snd_emu_chip_details emu_chip_details[] = { ...@@ -1411,7 +1414,7 @@ static struct snd_emu_chip_details emu_chip_details[] = {
.emu10k2_chip = 1, .emu10k2_chip = 1,
.ca0108_chip = 1, .ca0108_chip = 1,
.spk71 = 1, .spk71 = 1,
.emu_model = 2} , .emu_model = EMU_MODEL_EMU1010B},
/* Tested by James@superbug.co.uk 8th July 2005. */ /* Tested by James@superbug.co.uk 8th July 2005. */
{.vendor = 0x1102, .device = 0x0004, .subsystem = 0x40011102, {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x40011102,
.driver = "Audigy2", .name = "E-mu 1010 [4001]", .driver = "Audigy2", .name = "E-mu 1010 [4001]",
...@@ -1419,7 +1422,7 @@ static struct snd_emu_chip_details emu_chip_details[] = { ...@@ -1419,7 +1422,7 @@ static struct snd_emu_chip_details emu_chip_details[] = {
.emu10k2_chip = 1, .emu10k2_chip = 1,
.ca0102_chip = 1, .ca0102_chip = 1,
.spk71 = 1, .spk71 = 1,
.emu_model = 1} , /* Emu 1010 */ .emu_model = EMU_MODEL_EMU1010} , /* Emu 1010 */
/* Audigy4 (Not PRO) SB0610 */ /* Audigy4 (Not PRO) SB0610 */
{.vendor = 0x1102, .device = 0x0008, {.vendor = 0x1102, .device = 0x0008,
.driver = "Audigy2", .name = "Audigy 2 Value [Unknown]", .driver = "Audigy2", .name = "Audigy 2 Value [Unknown]",
......
...@@ -397,7 +397,7 @@ static int snd_emu1010_input_output_source_info(struct snd_kcontrol *kcontrol, ...@@ -397,7 +397,7 @@ static int snd_emu1010_input_output_source_info(struct snd_kcontrol *kcontrol,
uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
uinfo->count = 1; uinfo->count = 1;
if (emu->card_capabilities->emu_model == 3) { /* 1616(m) cardbus */ if (emu->card_capabilities->emu_model == EMU_MODEL_EMU1616) {
uinfo->value.enumerated.items = 49; uinfo->value.enumerated.items = 49;
items = emu1616_src_texts; items = emu1616_src_texts;
} else { } else {
...@@ -421,7 +421,8 @@ static int snd_emu1010_output_source_get(struct snd_kcontrol *kcontrol, ...@@ -421,7 +421,8 @@ static int snd_emu1010_output_source_get(struct snd_kcontrol *kcontrol,
channel = (kcontrol->private_value) & 0xff; channel = (kcontrol->private_value) & 0xff;
/* Limit: emu1010_output_dst, emu->emu1010.output_source */ /* Limit: emu1010_output_dst, emu->emu1010.output_source */
if (channel >= 24 || if (channel >= 24 ||
(emu->card_capabilities->emu_model == 3 && channel >= 18)) (emu->card_capabilities->emu_model == EMU_MODEL_EMU1616 &&
channel >= 18))
return -EINVAL; return -EINVAL;
ucontrol->value.enumerated.item[0] = emu->emu1010.output_source[channel]; ucontrol->value.enumerated.item[0] = emu->emu1010.output_source[channel];
return 0; return 0;
...@@ -436,17 +437,19 @@ static int snd_emu1010_output_source_put(struct snd_kcontrol *kcontrol, ...@@ -436,17 +437,19 @@ static int snd_emu1010_output_source_put(struct snd_kcontrol *kcontrol,
val = ucontrol->value.enumerated.item[0]; val = ucontrol->value.enumerated.item[0];
if (val >= 53 || if (val >= 53 ||
(emu->card_capabilities->emu_model == 3 && val >= 49)) (emu->card_capabilities->emu_model == EMU_MODEL_EMU1616 &&
val >= 49))
return -EINVAL; return -EINVAL;
channel = (kcontrol->private_value) & 0xff; channel = (kcontrol->private_value) & 0xff;
/* Limit: emu1010_output_dst, emu->emu1010.output_source */ /* Limit: emu1010_output_dst, emu->emu1010.output_source */
if (channel >= 24 || if (channel >= 24 ||
(emu->card_capabilities->emu_model == 3 && channel >= 18)) (emu->card_capabilities->emu_model == EMU_MODEL_EMU1616 &&
channel >= 18))
return -EINVAL; return -EINVAL;
if (emu->emu1010.output_source[channel] == val) if (emu->emu1010.output_source[channel] == val)
return 0; return 0;
emu->emu1010.output_source[channel] = val; emu->emu1010.output_source[channel] = val;
if (emu->card_capabilities->emu_model == 3) /* 1616(m) cardbus */ if (emu->card_capabilities->emu_model == EMU_MODEL_EMU1616)
snd_emu1010_fpga_link_dst_src_write(emu, snd_emu1010_fpga_link_dst_src_write(emu,
emu1616_output_dst[channel], emu1616_src_regs[val]); emu1616_output_dst[channel], emu1616_src_regs[val]);
else else
...@@ -478,7 +481,8 @@ static int snd_emu1010_input_source_put(struct snd_kcontrol *kcontrol, ...@@ -478,7 +481,8 @@ static int snd_emu1010_input_source_put(struct snd_kcontrol *kcontrol,
val = ucontrol->value.enumerated.item[0]; val = ucontrol->value.enumerated.item[0];
if (val >= 53 || if (val >= 53 ||
(emu->card_capabilities->emu_model == 3 && val >= 49)) (emu->card_capabilities->emu_model == EMU_MODEL_EMU1616 &&
val >= 49))
return -EINVAL; return -EINVAL;
channel = (kcontrol->private_value) & 0xff; channel = (kcontrol->private_value) & 0xff;
/* Limit: emu1010_input_dst, emu->emu1010.input_source */ /* Limit: emu1010_input_dst, emu->emu1010.input_source */
...@@ -487,7 +491,7 @@ static int snd_emu1010_input_source_put(struct snd_kcontrol *kcontrol, ...@@ -487,7 +491,7 @@ static int snd_emu1010_input_source_put(struct snd_kcontrol *kcontrol,
if (emu->emu1010.input_source[channel] == val) if (emu->emu1010.input_source[channel] == val)
return 0; return 0;
emu->emu1010.input_source[channel] = val; emu->emu1010.input_source[channel] = val;
if (emu->card_capabilities->emu_model == 3) /* 1616(m) cardbus */ if (emu->card_capabilities->emu_model == EMU_MODEL_EMU1616)
snd_emu1010_fpga_link_dst_src_write(emu, snd_emu1010_fpga_link_dst_src_write(emu,
emu1010_input_dst[channel], emu1616_src_regs[val]); emu1010_input_dst[channel], emu1616_src_regs[val]);
else else
...@@ -1991,7 +1995,7 @@ int __devinit snd_emu10k1_mixer(struct snd_emu10k1 *emu, ...@@ -1991,7 +1995,7 @@ int __devinit snd_emu10k1_mixer(struct snd_emu10k1 *emu,
return err; return err;
} }
if (emu->card_capabilities->emu_model == 3) { if (emu->card_capabilities->emu_model == EMU_MODEL_EMU1616) {
/* 1616(m) cardbus */ /* 1616(m) cardbus */
int i; int i;
......
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