Skip to content

Commit

Permalink
[ALSA] emu10k1 - Use enum for emu_model types
Browse files Browse the repository at this point in the history
Use enum instead of digits for emu_model types.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
  • Loading branch information
Takashi Iwai authored and Mercurial server committed Jan 31, 2008
1 parent 88aa139 commit 3839e4f
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 21 deletions.
8 changes: 8 additions & 0 deletions include/sound/emu10k1.h
Original file line number Diff line number Diff line change
Expand Up @@ -1642,6 +1642,14 @@ struct snd_emu10k1_midi {
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 {
u32 vendor;
u32 device;
Expand Down
29 changes: 16 additions & 13 deletions sound/pci/emu10k1/emu10k1_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -725,15 +725,18 @@ int emu1010_firmware_thread(void *data) {
/* Return to Audio Dock programming mode */
snd_printk(KERN_INFO "emu1010: Loading Audio Dock Firmware\n");
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) {
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) {
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) {
continue;
}
Expand Down Expand Up @@ -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);
switch (emu->card_capabilities->emu_model) {
case 1:
case EMU_MODEL_EMU1010:
filename = HANA_FILENAME;
break;
case 2:
case EMU_MODEL_EMU1010B:
filename = EMU1010B_FILENAME;
break;
case 3:
case EMU_MODEL_EMU1616:
filename = EMU1010_NOTEBOOK_FILENAME;
break;
case 4:
case EMU_MODEL_EMU0404:
filename = EMU0404_FILENAME;
break;
default:
Expand Down Expand Up @@ -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 */
#endif
/* Default outputs */
if (emu->card_capabilities->emu_model == 3) {
if (emu->card_capabilities->emu_model == EMU_MODEL_EMU1616) {
/* 1616(M) cardbus default outputs */
/* ALICE2 bus 0xa0 */
snd_emu1010_fpga_link_dst_src_write(emu,
Expand Down Expand Up @@ -1250,7 +1253,7 @@ static int snd_emu10k1_free(struct snd_emu10k1 *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 */
snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_PWR, 0 );
}
Expand Down Expand Up @@ -1394,7 +1397,7 @@ static struct snd_emu_chip_details emu_chip_details[] = {
.emu10k2_chip = 1,
.ca0102_chip = 1,
.spk71 = 1,
.emu_model = 4} , /* EMU 0404 */
.emu_model = EMU_MODEL_EMU0404} , /* EMU 0404 */
/* Tested by James@superbug.co.uk 4th Nov 2007. */
{.vendor = 0x1102, .device = 0x0008, .subsystem = 0x42011102,
.driver = "Audigy2", .name = "E-mu 1010 Notebook [MAEM8950]",
Expand All @@ -1403,23 +1406,23 @@ static struct snd_emu_chip_details emu_chip_details[] = {
.ca0108_chip = 1,
.ca_cardbus_chip = 1,
.spk71 = 1 ,
.emu_model = 3} ,
.emu_model = EMU_MODEL_EMU1616},
/* Tested by James@superbug.co.uk 4th Nov 2007. */
{.vendor = 0x1102, .device = 0x0008, .subsystem = 0x40041102,
.driver = "Audigy2", .name = "E-mu 1010b PCI [MAEM????]",
.id = "EMU1010",
.emu10k2_chip = 1,
.ca0108_chip = 1,
.spk71 = 1,
.emu_model = 2} ,
.emu_model = EMU_MODEL_EMU1010B},
/* Tested by James@superbug.co.uk 8th July 2005. */
{.vendor = 0x1102, .device = 0x0004, .subsystem = 0x40011102,
.driver = "Audigy2", .name = "E-mu 1010 [4001]",
.id = "EMU1010",
.emu10k2_chip = 1,
.ca0102_chip = 1,
.spk71 = 1,
.emu_model = 1} , /* Emu 1010 */
.emu_model = EMU_MODEL_EMU1010} , /* Emu 1010 */
/* Audigy4 (Not PRO) SB0610 */
{.vendor = 0x1102, .device = 0x0008,
.driver = "Audigy2", .name = "Audigy 2 Value [Unknown]",
Expand Down
20 changes: 12 additions & 8 deletions sound/pci/emu10k1/emumixer.c
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ static int snd_emu1010_input_output_source_info(struct snd_kcontrol *kcontrol,

uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
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;
items = emu1616_src_texts;
} else {
Expand All @@ -421,7 +421,8 @@ static int snd_emu1010_output_source_get(struct snd_kcontrol *kcontrol,
channel = (kcontrol->private_value) & 0xff;
/* Limit: emu1010_output_dst, emu->emu1010.output_source */
if (channel >= 24 ||
(emu->card_capabilities->emu_model == 3 && channel >= 18))
(emu->card_capabilities->emu_model == EMU_MODEL_EMU1616 &&
channel >= 18))
return -EINVAL;
ucontrol->value.enumerated.item[0] = emu->emu1010.output_source[channel];
return 0;
Expand All @@ -436,17 +437,19 @@ static int snd_emu1010_output_source_put(struct snd_kcontrol *kcontrol,

val = ucontrol->value.enumerated.item[0];
if (val >= 53 ||
(emu->card_capabilities->emu_model == 3 && val >= 49))
(emu->card_capabilities->emu_model == EMU_MODEL_EMU1616 &&
val >= 49))
return -EINVAL;
channel = (kcontrol->private_value) & 0xff;
/* Limit: emu1010_output_dst, emu->emu1010.output_source */
if (channel >= 24 ||
(emu->card_capabilities->emu_model == 3 && channel >= 18))
(emu->card_capabilities->emu_model == EMU_MODEL_EMU1616 &&
channel >= 18))
return -EINVAL;
if (emu->emu1010.output_source[channel] == val)
return 0;
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,
emu1616_output_dst[channel], emu1616_src_regs[val]);
else
Expand Down Expand Up @@ -478,7 +481,8 @@ static int snd_emu1010_input_source_put(struct snd_kcontrol *kcontrol,

val = ucontrol->value.enumerated.item[0];
if (val >= 53 ||
(emu->card_capabilities->emu_model == 3 && val >= 49))
(emu->card_capabilities->emu_model == EMU_MODEL_EMU1616 &&
val >= 49))
return -EINVAL;
channel = (kcontrol->private_value) & 0xff;
/* Limit: emu1010_input_dst, emu->emu1010.input_source */
Expand All @@ -487,7 +491,7 @@ static int snd_emu1010_input_source_put(struct snd_kcontrol *kcontrol,
if (emu->emu1010.input_source[channel] == val)
return 0;
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,
emu1010_input_dst[channel], emu1616_src_regs[val]);
else
Expand Down Expand Up @@ -1991,7 +1995,7 @@ int __devinit snd_emu10k1_mixer(struct snd_emu10k1 *emu,
return err;
}

if (emu->card_capabilities->emu_model == 3) {
if (emu->card_capabilities->emu_model == EMU_MODEL_EMU1616) {
/* 1616(m) cardbus */
int i;

Expand Down

0 comments on commit 3839e4f

Please sign in to comment.