emu10k1: clean up card features
PATCH 1/1 emu10k1: clean up card features
This patch converts the emu10k1 driver to use the card capabilities structure for some more things.
Not extensively tested but seems to work.
? alsa/alsa-kernel/Documentation/emu10k1-jack.txt ? alsa/alsa-kernel/pci/emu10k1/alsafoo.patch
Index: alsa/alsa-kernel/include/emu10k1.h
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/include/emu10k1.h,v retrieving revision 1.62
alsa-kernel/include/emu10k1.h +3 -6
@@ -1046,6 +1046,7 @@unsigned char ca0108_chip;/* Audigy 2 Value */ unsigned char ca0151_chip;/* P16V */ unsigned char spk71;/* Has 7.1 speakers */ +unsigned char sblive51;/* SBLive! 5.1 - extout 0x11 -> center, 0x12 -> lfe */ unsigned char spdif_bug;/* Has Spdif phasing bug */ unsigned char ac97_chip;/* Has an AC97 chip */ unsigned char ecard;/* APS EEPROM */
@@ -1057,11 +1058,8 @@int irq;unsigned long port;/* I/O port number */ - unsigned int APS: 1, /* APS flag */ - no_ac97: 1, /* no AC'97 */ - tos_link: 1, /* tos link detected */ - rear_ac97: 1, /* rear channels are on AC'97 */ - spk71:1; /* 7.1 configuration (Audigy 2 ZS) */ + unsigned int tos_link: 1, /* tos link detected */ + rear_ac97: 1; /* rear channels are on AC'97 */const emu_chip_details_t *card_capabilities;/* Contains profile of card capabilities */ unsigned int audigy;/* is Audigy? */ unsigned int revision;/* chip revision */
@@ -1456,7 +1454,6 @@#endif typedef struct { - unsigned int card; /* card type */ unsigned int internal_tram_size; /* in samples */ unsigned int external_tram_size; /* in samples */ char fxbus_names[16][32]; /* names of FXBUSes */
Index: alsa/alsa-kernel/pci/emu10k1/emu10k1_main.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/pci/emu10k1/emu10k1_main.c,v retrieving revision 1.49
alsa-kernel/pci/emu10k1/emu10k1_main.c +12 -15
@@ -170,7 +170,7 @@SPCS_GENERATIONSTATUS |0x00001200 | 0x00000000 | SPCS_EMPHASIS_NONE | SPCS_COPYRIGHT); -if (emu->audigy && emu->revision ==4 ) {/* audigy2 */ +if (emu->card_capabilities->ca0151_chip) {/* audigy2 */ /* Hacks for Alice3 to work independent of haP16V driver */ u32 tmp;
@@ -600,7 +600,7 @@if (emu->port)pci_release_regions (emu->pci);pci_disable_device (emu->pci); -if (emu->audigy && emu->revision ==4 )/* P16V */ +if (emu->card_capabilities->ca0151_chip)/* P16V */ snd_p16v_free (emu);kfree (emu);return 0 ;
@@ -688,15 +688,22 @@ {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80641102, .driver = "EMU10K1", .name = "SB Live 5.1", .emu10k1_chip = 1, - .ac97_chip = 1} , + .ac97_chip = 1, + .sblive51 = 1} , {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80401102, .driver = "EMU10K1", .name = "SBLive! Platinum [CT4760P]", .emu10k1_chip = 1, .ac97_chip = 1} , + {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80271102, + .driver = "EMU10K1", .name = "SBLive! Value [CT4832]", + .emu10k1_chip = 1, + .ac97_chip = 1, + .sblive51 = 1} , {.vendor = 0x1102, .device = 0x0002, .driver = "EMU10K1", .name = "SB Live [Unknown]", .emu10k1_chip = 1, - .ac97_chip = 1} , + .ac97_chip = 1, + .sblive51 = 1} , { } /* terminator */ };
@@ -747,7 +754,6 @@ emu->revision = revision;pci_read_config_dword (pci,PCI_SUBSYSTEM_VENDOR_ID , &emu->serial);pci_read_config_word (pci,PCI_SUBSYSTEM_ID , &emu->model); - emu->card_type =EMU10K1_CARD_CREATIVE ;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++) {
@@ -825,15 +831,6 @@pci_set_master (pci); -if (c->ecard) { - emu->card_type =EMU10K1_CARD_EMUAPS ; - emu->APS =1 ; - } -if (! c->ac97_chip) - emu->no_ac97 =1 ; - - emu->spk71 = c->spk71; - emu->fx8010.fxbus_mask =0x303f ;if (extin_mask ==0 ) extin_mask =0x3fcf ;
@@ -842,7 +839,7 @@ emu->fx8010.extin_mask = extin_mask; emu->fx8010.extout_mask = extout_mask; -if (emu->APS) { +if (emu->card_capabilities->ecard) {if ((err =snd_emu10k1_ecard_init (emu)) <0 ) {snd_emu10k1_free (emu);return err;
Index: alsa/alsa-kernel/pci/emu10k1/emufx.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/pci/emu10k1/emufx.c,v retrieving revision 1.73
alsa-kernel/pci/emu10k1/emufx.c +30 -26
129 lines not on this page · raw message
Index: alsa/alsa-kernel/pci/emu10k1/emumixer.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/pci/emu10k1/emumixer.c,v retrieving revision 1.34
alsa-kernel/pci/emu10k1/emumixer.c +5 -5
@@ -791,7 +791,7 @@NULL }; -if (!emu->no_ac97) { +if (emu->card_capabilities->ac97_chip) {ac97_bus_t *pbus;ac97_template_t ac97;static ac97_bus_ops_t ops = {
@@ -833,7 +833,7 @@for (; *c; c++)remove_ctl (card, *c); }else { -if (emu->APS) +if (emu->card_capabilities->ecard)strcpy (emu->card->mixername,"EMU APS" );else if (emu->audigy)strcpy (emu->card->mixername,"SB Audigy" );
@@ -918,7 +918,7 @@ mix->attn[0 ] =0xffff ; } -if (! emu->APS) {/* FIXME: APS has these controls? */ +if (! emu->card_capabilities->ecard) {/* FIXME: APS has these controls? */ /* sb live! and audigy */ if ((kctl =snd_ctl_new1 (&snd_emu10k1_spdif_mask_control, emu)) ==NULL )return -ENOMEM ;
@@ -939,14 +939,14 @@return -ENOMEM ;if ((err =snd_ctl_add (card, kctl)))return err; - }else if (! emu->APS) { + }else if (! emu->card_capabilities->ecard) {/* sb live! */ if ((kctl =snd_ctl_new1 (&snd_emu10k1_shared_spdif, emu)) ==NULL )return -ENOMEM ;if ((err =snd_ctl_add (card, kctl)))return err; } -if (emu->audigy && emu->revision ==4 ) {/* P16V */ +if (emu->card_capabilities->ca0151_chip) {/* P16V */ if ((err =snd_p16v_mixer (emu)))return err; }
Index: alsa/alsa-kernel/pci/emu10k1/emuproc.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/pci/emu10k1/emuproc.c,v retrieving revision 1.26
alsa-kernel/pci/emu10k1/emuproc.c +1 -1
@@ -182,7 +182,7 @@snd_iprintf (buffer,"EMU10K1\n\n" );snd_iprintf (buffer,"Card : %s\n" , - emu->audigy ?"Audigy" : (emu->APS ?"EMU APS" :"Creative" )); + emu->audigy ?"Audigy" : (emu->card_capabilities->ecard ?"EMU APS" :"Creative" ));snd_iprintf (buffer,"Internal TRAM (words) : 0x%x\n" , emu->fx8010.itram_size);snd_iprintf (buffer,"External TRAM (words) : 0x%x\n" , (int )emu->fx8010.etram_pages.bytes /2 );snd_iprintf (buffer,"\n" );
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
Takashi Iwai
AppliedAt Wed, 30 Mar 2005 03:17:22 -0500,
Quoted 7 lines · Lee Revell
This patch converts the emu10k1 driver to use the card capabilities structure for some more things.
Not extensively tested but seems to work.
Signed-off-by Lee Revell <[email protected]>
Applied to CVS. Thanks.
Takashi
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click