From d83c671fb7023f69a9582e622d01525054f23b66 Mon Sep 17 00:00:00 2001 From: James Courtier-Dutton Date: Mon, 31 Oct 2005 10:27:41 +0000 Subject: [PATCH] [PATCH] Creative Audigy 2 cardbus: Add IO window wakeup magic This adds the magic IO wakeup code for the CardBus version of the Creative Labs Audigy 2 to the snd-emu10k1 driver. Without the magic IO enable sequence, reading from the IO region of the card will fail spectacularly, and the machine will hang. My next task will be getting the driver to actually play sound without distortion. Signed-off-by: James Courtier-Dutton [ This is a work-in-progress, but since it avoids a total lockup if the emu10k module is loaded on a machine with the cardbus card inserted, we're better off with it than without it, even if sound quality is bad right now ] Signed-off-by: Linus Torvalds --- include/sound/emu10k1.h | 1 + sound/pci/emu10k1/emu10k1_main.c | 39 ++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/include/sound/emu10k1.h b/include/sound/emu10k1.h index 14cb2718cb77..46e3c0bf3c94 100644 --- a/include/sound/emu10k1.h +++ b/include/sound/emu10k1.h @@ -1055,6 +1055,7 @@ typedef struct { unsigned char emu10k2_chip; /* Audigy 1 or Audigy 2. */ unsigned char ca0102_chip; /* Audigy 1 or Audigy 2. Not SB Audigy 2 Value. */ unsigned char ca0108_chip; /* Audigy 2 Value */ + unsigned char ca_cardbus_chip; /* Audigy 2 ZS Notebook */ unsigned char ca0151_chip; /* P16V */ unsigned char spk71; /* Has 7.1 speakers */ unsigned char sblive51; /* SBLive! 5.1 - extout 0x11 -> center, 0x12 -> lfe */ diff --git a/sound/pci/emu10k1/emu10k1_main.c b/sound/pci/emu10k1/emu10k1_main.c index e9cd8e054f25..53aeff0b783a 100644 --- a/sound/pci/emu10k1/emu10k1_main.c +++ b/sound/pci/emu10k1/emu10k1_main.c @@ -579,6 +579,30 @@ static int __devinit snd_emu10k1_ecard_init(emu10k1_t * emu) return 0; } +static int __devinit snd_emu10k1_cardbus_init(emu10k1_t * emu) +{ + unsigned long special_port; + unsigned int value; + + /* Special initialisation routine + * before the rest of the IO-Ports become active. + */ + special_port = emu->port + 0x38; + value = inl(special_port); + outl(0x00d00000, special_port); + value = inl(special_port); + outl(0x00d00001, special_port); + value = inl(special_port); + outl(0x00d0005f, special_port); + value = inl(special_port); + outl(0x00d0007f, special_port); + value = inl(special_port); + outl(0x0090007f, special_port); + value = inl(special_port); + + return 0; +} + /* * Create the EMU10K1 instance */ @@ -624,6 +648,16 @@ static emu_chip_details_t emu_chip_details[] = { .ca0108_chip = 1, .spk71 = 1, .ac97_chip = 1} , + /* Audigy 2 ZS Notebook Cardbus card.*/ + /* Tested by James@superbug.co.uk 30th October 2005 */ + /* Not working yet, but progressing. */ + {.vendor = 0x1102, .device = 0x0008, .subsystem = 0x20011102, + .driver = "Audigy2", .name = "Audigy 2 ZS Notebook [SB0530]", + .id = "Audigy2", + .emu10k2_chip = 1, + .ca0108_chip = 1, + .ca_cardbus_chip = 1, + .spk71 = 1} , {.vendor = 0x1102, .device = 0x0008, .driver = "Audigy2", .name = "Audigy 2 Value [Unknown]", .id = "Audigy2", @@ -1011,6 +1045,11 @@ int __devinit snd_emu10k1_create(snd_card_t * card, snd_emu10k1_free(emu); return err; } + } else if (emu->card_capabilities->ca_cardbus_chip) { + if ((err = snd_emu10k1_cardbus_init(emu)) < 0) { + snd_emu10k1_free(emu); + return err; + } } else { /* 5.1: Enable the additional AC97 Slots. If the emu10k1 version does not support this, it shouldn't do any harm */