aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/es1968.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2006-10-23 13:58:33 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-23 13:58:33 -0400
commitdee6515b6d12188f4b9bbe76613371f7840a8a53 (patch)
tree3acf4736ff5204871e194f3d2988efa75e136cb8 /sound/pci/es1968.c
parent73441c665bee555526b1cf3eef603a0cff0b7e19 (diff)
parent68e7fffc0f3e95063ba5bd94ee6f9b8927247297 (diff)
Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/perex/alsa
* 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/perex/alsa: [ALSA] hda-intel - Add check of MSI availabity [ALSA] version 1.0.13 [ALSA] Fix addition of user-defined boolean controls [ALSA] Fix AC97 power-saving mode [ALSA] Fix re-use of va_list [ALSA] hda_intel: add ATI RS690 HDMI audio support [ALSA] hda-codec - Add model entry for ASUS U5F laptop [ALSA] Fix dependency of snd-adlib driver in Kconfig [ALSA] Various fixes for suspend/resume of ALSA PCI drivers [ALSA] hda-codec - Fix assignment of PCM devices for Realtek codecs [ALSA] sound/isa/opti9xx/opti92x-ad1848.c: check kmalloc() return value [ALSA] sound/isa/ad1816a/ad1816a.c: check kmalloc() return value [ALSA] sound/isa/cmi8330.c: check kmalloc() return value [ALSA] sound/isa/gus/interwave.c: check kmalloc() return value
Diffstat (limited to 'sound/pci/es1968.c')
-rw-r--r--sound/pci/es1968.c71
1 files changed, 10 insertions, 61 deletions
diff --git a/sound/pci/es1968.c b/sound/pci/es1968.c
index b9d723c7e1db..092da53e1464 100644
--- a/sound/pci/es1968.c
+++ b/sound/pci/es1968.c
@@ -432,46 +432,6 @@ MODULE_PARM_DESC(joystick, "Enable joystick.");
432#define ESM_MODE_PLAY 0 432#define ESM_MODE_PLAY 0
433#define ESM_MODE_CAPTURE 1 433#define ESM_MODE_CAPTURE 1
434 434
435/* acpi states */
436enum {
437 ACPI_D0=0,
438 ACPI_D1,
439 ACPI_D2,
440 ACPI_D3
441};
442
443/* bits in the acpi masks */
444#define ACPI_12MHZ ( 1 << 15)
445#define ACPI_24MHZ ( 1 << 14)
446#define ACPI_978 ( 1 << 13)
447#define ACPI_SPDIF ( 1 << 12)
448#define ACPI_GLUE ( 1 << 11)
449#define ACPI__10 ( 1 << 10) /* reserved */
450#define ACPI_PCIINT ( 1 << 9)
451#define ACPI_HV ( 1 << 8) /* hardware volume */
452#define ACPI_GPIO ( 1 << 7)
453#define ACPI_ASSP ( 1 << 6)
454#define ACPI_SB ( 1 << 5) /* sb emul */
455#define ACPI_FM ( 1 << 4) /* fm emul */
456#define ACPI_RB ( 1 << 3) /* ringbus / aclink */
457#define ACPI_MIDI ( 1 << 2)
458#define ACPI_GP ( 1 << 1) /* game port */
459#define ACPI_WP ( 1 << 0) /* wave processor */
460
461#define ACPI_ALL (0xffff)
462#define ACPI_SLEEP (~(ACPI_SPDIF|ACPI_ASSP|ACPI_SB|ACPI_FM| \
463 ACPI_MIDI|ACPI_GP|ACPI_WP))
464#define ACPI_NONE (ACPI__10)
465
466/* these masks indicate which units we care about at
467 which states */
468static u16 acpi_state_mask[] = {
469 [ACPI_D0] = ACPI_ALL,
470 [ACPI_D1] = ACPI_SLEEP,
471 [ACPI_D2] = ACPI_SLEEP,
472 [ACPI_D3] = ACPI_NONE
473};
474
475 435
476/* APU use in the driver */ 436/* APU use in the driver */
477enum snd_enum_apu_type { 437enum snd_enum_apu_type {
@@ -2160,21 +2120,6 @@ static void snd_es1968_reset(struct es1968 *chip)
2160} 2120}
2161 2121
2162/* 2122/*
2163 * power management
2164 */
2165static void snd_es1968_set_acpi(struct es1968 *chip, int state)
2166{
2167 u16 active_mask = acpi_state_mask[state];
2168
2169 pci_set_power_state(chip->pci, state);
2170 /* make sure the units we care about are on
2171 XXX we might want to do this before state flipping? */
2172 pci_write_config_word(chip->pci, 0x54, ~ active_mask);
2173 pci_write_config_word(chip->pci, 0x56, ~ active_mask);
2174}
2175
2176
2177/*
2178 * initialize maestro chip 2123 * initialize maestro chip
2179 */ 2124 */
2180static void snd_es1968_chip_init(struct es1968 *chip) 2125static void snd_es1968_chip_init(struct es1968 *chip)
@@ -2196,9 +2141,6 @@ static void snd_es1968_chip_init(struct es1968 *chip)
2196 * IRQs. 2141 * IRQs.
2197 */ 2142 */
2198 2143
2199 /* do config work at full power */
2200 snd_es1968_set_acpi(chip, ACPI_D0);
2201
2202 /* Config Reg A */ 2144 /* Config Reg A */
2203 pci_read_config_word(pci, ESM_CONFIG_A, &w); 2145 pci_read_config_word(pci, ESM_CONFIG_A, &w);
2204 2146
@@ -2397,9 +2339,10 @@ static int es1968_suspend(struct pci_dev *pci, pm_message_t state)
2397 snd_pcm_suspend_all(chip->pcm); 2339 snd_pcm_suspend_all(chip->pcm);
2398 snd_ac97_suspend(chip->ac97); 2340 snd_ac97_suspend(chip->ac97);
2399 snd_es1968_bob_stop(chip); 2341 snd_es1968_bob_stop(chip);
2400 snd_es1968_set_acpi(chip, ACPI_D3); 2342
2401 pci_disable_device(pci); 2343 pci_disable_device(pci);
2402 pci_save_state(pci); 2344 pci_save_state(pci);
2345 pci_set_power_state(pci, pci_choose_state(pci, state));
2403 return 0; 2346 return 0;
2404} 2347}
2405 2348
@@ -2413,9 +2356,16 @@ static int es1968_resume(struct pci_dev *pci)
2413 return 0; 2356 return 0;
2414 2357
2415 /* restore all our config */ 2358 /* restore all our config */
2359 pci_set_power_state(pci, PCI_D0);
2416 pci_restore_state(pci); 2360 pci_restore_state(pci);
2417 pci_enable_device(pci); 2361 if (pci_enable_device(pci) < 0) {
2362 printk(KERN_ERR "es1968: pci_enable_device failed, "
2363 "disabling device\n");
2364 snd_card_disconnect(card);
2365 return -EIO;
2366 }
2418 pci_set_master(pci); 2367 pci_set_master(pci);
2368
2419 snd_es1968_chip_init(chip); 2369 snd_es1968_chip_init(chip);
2420 2370
2421 /* need to restore the base pointers.. */ 2371 /* need to restore the base pointers.. */
@@ -2514,7 +2464,6 @@ static int snd_es1968_free(struct es1968 *chip)
2514 if (chip->irq >= 0) 2464 if (chip->irq >= 0)
2515 free_irq(chip->irq, (void *)chip); 2465 free_irq(chip->irq, (void *)chip);
2516 snd_es1968_free_gameport(chip); 2466 snd_es1968_free_gameport(chip);
2517 snd_es1968_set_acpi(chip, ACPI_D3);
2518 chip->master_switch = NULL; 2467 chip->master_switch = NULL;
2519 chip->master_volume = NULL; 2468 chip->master_volume = NULL;
2520 pci_release_regions(chip->pci); 2469 pci_release_regions(chip->pci);