[alsa-devel] [PATCH] ac97 mono-out w/internal speaker
I have a wireless tablet (webdt310) http://dtresearch.com/product/wt310/index.htm
It has cs5536 audio and a realtek alc203 codec.
The headphone jack works perfectly, but the internal speaker was not.
After a bit a twiddling and reading the ALC203 data sheet, I finally figured out that the function of Pin 37 had to be changed to MONO-OUT to get sound out of the internal speaker.
I'm not sure that this is the best approach (maybe there could be some pin sensing?) but I added this as an ac97 quirk. Here's the patch.
diff -rub linux-2.6.26.orig/sound/pci/ac97/ac97_codec.c linux-2.6.26.new/sound/pci/ac97/ac97_codec.c --- linux-2.6.26.orig/sound/pci/ac97/ac97_codec.c 2008-07-29 15:30:57.000000000 -0500 +++ linux-2.6.26.new/sound/pci/ac97/ac97_codec.c 2008-08-04 10:58:12.000000000 -0500 @@ -2709,6 +2710,12 @@ return snd_ctl_add(ac97->bus->card, snd_ac97_cnew(&snd_ac97_alc_jack_detect, ac97)); }
+/* ac97 tune: turn on mono-out */ +static int tune_mono_out(struct snd_ac97 *ac97) +{ + snd_ac97_update_bits(ac97, 0x7a, 0x400, 0x400); + return 1; +} + /* ac97 tune: inversed EAPD bit */ static int tune_inv_eapd(struct snd_ac97 *ac97) { @@ -2801,6 +2808,7 @@ { "inv_eapd", tune_inv_eapd }, { "mute_led", tune_mute_led }, { "hp_mute_led", tune_hp_mute_led }, + { "mono_out", tune_mono_out }, };
At Mon, 4 Aug 2008 11:46:28 -0500, george pee wrote:
I have a wireless tablet (webdt310) http://dtresearch.com/product/wt310/index.htm
It has cs5536 audio and a realtek alc203 codec.
The headphone jack works perfectly, but the internal speaker was not.
After a bit a twiddling and reading the ALC203 data sheet, I finally figured out that the function of Pin 37 had to be changed to MONO-OUT to get sound out of the internal speaker.
I'm not sure that this is the best approach (maybe there could be some pin sensing?) but I added this as an ac97 quirk. Here's the patch.
I prefer this kind of change with ac97->patch(). How about the patch below (untested)?
thanks,
Takashi
--- diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c index f6a7d72..171559c 100644 --- a/sound/pci/ac97/ac97_codec.c +++ b/sound/pci/ac97/ac97_codec.c @@ -122,7 +122,7 @@ static const struct ac97_codec_id snd_ac97_codec_ids[] = { { 0x414c4740, 0xfffffff0, "ALC202", NULL, NULL }, { 0x414c4750, 0xfffffff0, "ALC250", NULL, NULL }, { 0x414c4760, 0xfffffff0, "ALC655", patch_alc655, NULL }, -{ 0x414c4770, 0xfffffff0, "ALC203", NULL, NULL }, +{ 0x414c4770, 0xfffffff0, "ALC203", patch_alc203, NULL }, { 0x414c4781, 0xffffffff, "ALC658D", NULL, NULL }, /* already patched */ { 0x414c4780, 0xfffffff0, "ALC658", patch_alc655, NULL }, { 0x414c4790, 0xfffffff0, "ALC850", patch_alc850, NULL }, diff --git a/sound/pci/ac97/ac97_patch.c b/sound/pci/ac97/ac97_patch.c index f4fbc79..bb028f8 100644 --- a/sound/pci/ac97/ac97_patch.c +++ b/sound/pci/ac97/ac97_patch.c @@ -2560,6 +2560,14 @@ static int patch_ad1986(struct snd_ac97 * ac97) return 0; }
+/* + * realtek ALC203: use mono-out for pin 37 + */ +static int patch_alc203(struct snd_ac97 *ac97) +{ + snd_ac97_update_bits(ac97, 0x7a, 0x400, 0x400); + return 0; +}
/* * realtek ALC65x/850 codecs
It works!
The reason that I did it the other way is because I didn't know if all alc203 users want that pin used that way, and since I hadn't seen any issues, I figured that it be better to make it something that I could turn on just for my device.
On Tue, Aug 5, 2008 at 5:05 AM, Takashi Iwai tiwai@suse.de wrote:
At Mon, 4 Aug 2008 11:46:28 -0500, george pee wrote:
I have a wireless tablet (webdt310) http://dtresearch.com/product/wt310/index.htm
It has cs5536 audio and a realtek alc203 codec.
The headphone jack works perfectly, but the internal speaker was not.
After a bit a twiddling and reading the ALC203 data sheet, I finally
figured
out that the function of Pin 37 had to be changed to MONO-OUT to get
sound
out of the internal speaker.
I'm not sure that this is the best approach (maybe there could be some
pin
sensing?) but I added this as an ac97 quirk. Here's the patch.
I prefer this kind of change with ac97->patch(). How about the patch below (untested)?
thanks,
Takashi
diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c index f6a7d72..171559c 100644 --- a/sound/pci/ac97/ac97_codec.c +++ b/sound/pci/ac97/ac97_codec.c @@ -122,7 +122,7 @@ static const struct ac97_codec_id snd_ac97_codec_ids[] = { { 0x414c4740, 0xfffffff0, "ALC202", NULL, NULL }, { 0x414c4750, 0xfffffff0, "ALC250", NULL, NULL }, { 0x414c4760, 0xfffffff0, "ALC655", patch_alc655, NULL }, -{ 0x414c4770, 0xfffffff0, "ALC203", NULL, NULL }, +{ 0x414c4770, 0xfffffff0, "ALC203", patch_alc203, NULL }, { 0x414c4781, 0xffffffff, "ALC658D", NULL, NULL }, /* already patched */ { 0x414c4780, 0xfffffff0, "ALC658", patch_alc655, NULL }, { 0x414c4790, 0xfffffff0, "ALC850", patch_alc850, NULL }, diff --git a/sound/pci/ac97/ac97_patch.c b/sound/pci/ac97/ac97_patch.c index f4fbc79..bb028f8 100644 --- a/sound/pci/ac97/ac97_patch.c +++ b/sound/pci/ac97/ac97_patch.c @@ -2560,6 +2560,14 @@ static int patch_ad1986(struct snd_ac97 * ac97) return 0; }
+/*
- realtek ALC203: use mono-out for pin 37
- */
+static int patch_alc203(struct snd_ac97 *ac97) +{
snd_ac97_update_bits(ac97, 0x7a, 0x400, 0x400);
return 0;
+}
/*
- realtek ALC65x/850 codecs
At Tue, 5 Aug 2008 08:33:34 -0500, george pee wrote:
It works!
The reason that I did it the other way is because I didn't know if all alc203 users want that pin used that way, and since I hadn't seen any issues, I figured that it be better to make it something that I could turn on just for my device.
Yes, that's a slight concern, too. OTOH, the mono-out is more likely used than vrefout3, and thus turning on as default would help for others that have the same problem but didn't notice yet.
In the worst case, we can add some PCI SSID check in patch_alc203().
Anyway, thanks for confirmation. I applied the patch now.
Takashi
On Tue, Aug 5, 2008 at 5:05 AM, Takashi Iwai tiwai@suse.de wrote:
At Mon, 4 Aug 2008 11:46:28 -0500, george pee wrote: > > I have a wireless tablet (webdt310) > http://dtresearch.com/product/wt310/index.htm > > It has cs5536 audio and a realtek alc203 codec. > > The headphone jack works perfectly, but the internal speaker was not. > > After a bit a twiddling and reading the ALC203 data sheet, I finally figured > out that the function of Pin 37 had to be changed to MONO-OUT to get sound > out of the > internal speaker. > > I'm not sure that this is the best approach (maybe there could be some pin > sensing?) > but I added this as an ac97 quirk. Here's the patch. I prefer this kind of change with ac97->patch(). How about the patch below (untested)? thanks, Takashi --- diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c index f6a7d72..171559c 100644 --- a/sound/pci/ac97/ac97_codec.c +++ b/sound/pci/ac97/ac97_codec.c @@ -122,7 +122,7 @@ static const struct ac97_codec_id snd_ac97_codec_ids[] = { { 0x414c4740, 0xfffffff0, "ALC202", NULL, NULL }, { 0x414c4750, 0xfffffff0, "ALC250", NULL, NULL }, { 0x414c4760, 0xfffffff0, "ALC655", patch_alc655, NULL }, -{ 0x414c4770, 0xfffffff0, "ALC203", NULL, NULL }, +{ 0x414c4770, 0xfffffff0, "ALC203", patch_alc203, NULL }, { 0x414c4781, 0xffffffff, "ALC658D", NULL, NULL }, /* already patched */ { 0x414c4780, 0xfffffff0, "ALC658", patch_alc655, NULL }, { 0x414c4790, 0xfffffff0, "ALC850", patch_alc850, NULL }, diff --git a/sound/pci/ac97/ac97_patch.c b/sound/pci/ac97/ac97_patch.c index f4fbc79..bb028f8 100644 --- a/sound/pci/ac97/ac97_patch.c +++ b/sound/pci/ac97/ac97_patch.c @@ -2560,6 +2560,14 @@ static int patch_ad1986(struct snd_ac97 * ac97) return 0; } +/* + * realtek ALC203: use mono-out for pin 37 + */ +static int patch_alc203(struct snd_ac97 *ac97) +{ + snd_ac97_update_bits(ac97, 0x7a, 0x400, 0x400); + return 0; +} /* * realtek ALC65x/850 codecs
participants (2)
-
george pee
-
Takashi Iwai