From 52b723888c1a55d34551f9b0b9d9296e0e3e8d3c Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 30 Jun 2005 13:47:06 +0200 Subject: [ALSA] Fix resume of intel8x0 Intel8x0 driver,AC97 Codec Fix resume of intel8x0 driver. The ac97 codec didn't restore some registers properly, and the restore of ICH4 SPDIF and SDIN settings was missing. Signed-off-by: Takashi Iwai --- sound/pci/ac97/ac97_codec.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sound/pci/ac97/ac97_codec.c') diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c index a4b72cd..0677d41 100644 --- a/sound/pci/ac97/ac97_codec.c +++ b/sound/pci/ac97/ac97_codec.c @@ -367,6 +367,7 @@ int snd_ac97_update(ac97_t *ac97, unsigned short reg, unsigned short value) ac97->regs[reg] = value; ac97->bus->ops->write(ac97, reg, value); } + set_bit(reg, ac97->reg_accessed); up(&ac97->reg_mutex); return change; } @@ -410,6 +411,7 @@ int snd_ac97_update_bits_nolock(ac97_t *ac97, unsigned short reg, ac97->regs[reg] = new; ac97->bus->ops->write(ac97, reg, new); } + set_bit(reg, ac97->reg_accessed); return change; } -- cgit v1.1 From ef21ca24faf28df6d06939e77d5032a313490289 Mon Sep 17 00:00:00 2001 From: Nishanth Aravamudan Date: Sat, 9 Jul 2005 10:13:22 +0200 Subject: [ALSA] sound/pci: fix-up sleeping paths ENS1370/1+ driver,ES1968 driver,Intel8x0 driver,VIA82xx driver VIA82xx-modem driver,AC97 Codec,ALI5451 driver,CS46xx driver MIXART driver,RME HDSP driver,Trident driver,YMFPCI driver Description: Fix-up sleeping in sound/pci. These changes fall under the following two categories: 1) Replace schedule_timeout() with msleep() to guarantee the task delays as expected. This also involved replacing/removing custom sleep functions. 2) Do not assume jiffies will only increment by one if you request a 1 jiffy sleep, i.e. use time_after/time_before in while loops. Signed-off-by: Nishanth Aravamudan Signed-off-by: Jaroslav Kysela --- sound/pci/ac97/ac97_codec.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'sound/pci/ac97/ac97_codec.c') diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c index 0677d41..94cd989 100644 --- a/sound/pci/ac97/ac97_codec.c +++ b/sound/pci/ac97/ac97_codec.c @@ -2227,6 +2227,7 @@ void snd_ac97_restore_iec958(ac97_t *ac97) void snd_ac97_resume(ac97_t *ac97) { int i; + unsigned long end_time; if (ac97->bus->ops->reset) { ac97->bus->ops->reset(ac97); @@ -2244,26 +2245,26 @@ void snd_ac97_resume(ac97_t *ac97) snd_ac97_write(ac97, AC97_POWERDOWN, ac97->regs[AC97_POWERDOWN]); if (ac97_is_audio(ac97)) { ac97->bus->ops->write(ac97, AC97_MASTER, 0x8101); - for (i = HZ/10; i >= 0; i--) { + end_time = jiffies + msecs_to_jiffies(100); + do { if (snd_ac97_read(ac97, AC97_MASTER) == 0x8101) break; set_current_state(TASK_UNINTERRUPTIBLE); schedule_timeout(1); - } + } while (time_after_eq(end_time, jiffies)); /* FIXME: extra delay */ ac97->bus->ops->write(ac97, AC97_MASTER, 0x8000); - if (snd_ac97_read(ac97, AC97_MASTER) != 0x8000) { - set_current_state(TASK_UNINTERRUPTIBLE); - schedule_timeout(HZ/4); - } + if (snd_ac97_read(ac97, AC97_MASTER) != 0x8000) + msleep(250); } else { - for (i = HZ/10; i >= 0; i--) { + end_time = jiffies + msecs_to_jiffies(100); + do { unsigned short val = snd_ac97_read(ac97, AC97_EXTENDED_MID); if (val != 0xffff && (val & 1) != 0) break; set_current_state(TASK_UNINTERRUPTIBLE); schedule_timeout(1); - } + } while (time_after_eq(end_time, jiffies)); } __reset_ready: -- cgit v1.1 From c9eab129fcbcef364b34fb3a70cb2531847e1edf Mon Sep 17 00:00:00 2001 From: James Courtier-Dutton Date: Sun, 10 Jul 2005 12:04:29 +0200 Subject: [ALSA] ac97: Fix volume control bit size detection for STAC9704. AC97 Codec Signed-off-by: James Courtier-Dutton --- sound/pci/ac97/ac97_codec.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'sound/pci/ac97/ac97_codec.c') diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c index 94cd989..1f09653 100644 --- a/sound/pci/ac97/ac97_codec.c +++ b/sound/pci/ac97/ac97_codec.c @@ -1078,6 +1078,11 @@ static void check_volume_resolution(ac97_t *ac97, int reg, unsigned char *lo_max for (i = 0 ; i < ARRAY_SIZE(cbit); i++) { unsigned short val; snd_ac97_write(ac97, reg, 0x8080 | cbit[i] | (cbit[i] << 8)); + /* Do the read twice due to buffers on some ac97 codecs. + * e.g. The STAC9704 returns exactly what you wrote the the register + * if you read it immediately. This causes the detect routine to fail. + */ + val = snd_ac97_read(ac97, reg); val = snd_ac97_read(ac97, reg); if (! *lo_max && (val & 0x7f) == cbit[i]) *lo_max = max[i]; -- cgit v1.1 From 7858ffa062886706026cfff3ba80b8400b520501 Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Mon, 11 Jul 2005 15:37:19 +0200 Subject: [ALSA] ac97 - remove unused variable AC97 Codec remove a variable made obsolete by the last change Signed-off-by: Clemens Ladisch --- sound/pci/ac97/ac97_codec.c | 1 - 1 file changed, 1 deletion(-) (limited to 'sound/pci/ac97/ac97_codec.c') diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c index 1f09653..6983eea 100644 --- a/sound/pci/ac97/ac97_codec.c +++ b/sound/pci/ac97/ac97_codec.c @@ -2231,7 +2231,6 @@ void snd_ac97_restore_iec958(ac97_t *ac97) */ void snd_ac97_resume(ac97_t *ac97) { - int i; unsigned long end_time; if (ac97->bus->ops->reset) { -- cgit v1.1