From 2e75d050e42d1c61e820f9a35078a2f69e02cc3e Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Sat, 3 May 2008 18:46:56 +0200 Subject: [ALSA] ac97 - Add a workaround for broken quirk for VT1617A codec On boards with VT1617A codec, the sound disappears suddenly. This looks like a problem with HPE-bit control that is supposed to be set in patch_vt1617a(). However, on such problematic hardwares, the bit is actually reset mysteriously. The patch adds a workaround for the wrong quirk. Signed-off-by: Takashi Iwai --- sound/pci/ac97/ac97_patch.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'sound/pci/ac97') diff --git a/sound/pci/ac97/ac97_patch.c b/sound/pci/ac97/ac97_patch.c index 39198e505b1..2da89810ca1 100644 --- a/sound/pci/ac97/ac97_patch.c +++ b/sound/pci/ac97/ac97_patch.c @@ -3446,6 +3446,7 @@ static const struct snd_kcontrol_new snd_ac97_controls_vt1617a[] = { int patch_vt1617a(struct snd_ac97 * ac97) { int err = 0; + int val; /* we choose to not fail out at this point, but we tell the caller when we return */ @@ -3456,7 +3457,13 @@ int patch_vt1617a(struct snd_ac97 * ac97) /* bring analog power consumption to normal by turning off the * headphone amplifier, like WinXP driver for EPIA SP */ - snd_ac97_write_cache(ac97, 0x5c, 0x20); + /* We need to check the bit before writing it. + * On some (many?) hardwares, setting bit actually clears it! + */ + val = snd_ac97_read(ac97, 0x5c); + if (!(val & 0x20)) + snd_ac97_write_cache(ac97, 0x5c, 0x20); + ac97->ext_id |= AC97_EI_SPDIF; /* force the detection of spdif */ ac97->rates[AC97_RATES_SPDIF] = SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000; ac97->build_ops = &patch_vt1616_ops; -- cgit v1.2.3