hda-intel, ALC861 and Asus A6rp laptop - problem with headphones almost solved

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




Hi!

Alsa: 1.0.13rc2
Kernel: 2.6.17.11
Linux: Ubuntu 6.06 Dapper Drake
Laptop: Asus A6rp-ap002
Sound chpset: ALC861

I was working on patch for Alsa, that could allow me and other owners of Asus A6rp laptop use headphones.
Here is bug whitch I posted some time ago: https://bugtrack.alsa-project.org/alsa-bug/view.php?id=2320
As I wrote in it the model=uniwill-m31 is working for me, but without headphones...
Few days ago I found free time to read output of codec#0 and find a solution for my problem.
In the attachement you can find codec#0 output and .patch file for patch_realtek.c.
Basically this file works, but not always.
After modyfing the file I typed this command in terminal in alsa-driver-1.0.13rc2 directory:
make && sudo make install && sleep 3 && sudo /etc/init.d/alsasound restart
And the sound appeard in headphones and everything was working fine, even 6ch mode was working (built-in speakers, mic and line-in jacks as outputs, hp jack - silent(?) ).
To make the sound clear I had to mute in gnome volume manager line-in and cd-in.
The problem is that the sound was only to the next start of alsasound... Really don't know why...
I made few changes in patch_realtek.c, recompiled Alsa and undo changes and one more time recompiled Alsa and the sound was back again...
Now, after reboot, there is no sound in headphones... And recompiling doesn't help...
Propably the sound will appear after (x)th compilation, but why? Why it is not working all the time?
And why the ALC861 is detected to be the ALC660?
Hope someone will help me 100% solve this problem.

Mariusz

P.S.
The new kernel 2.6.18 has been released. I'm going to try Alsa with it.
--- hda_old/patch_realtek.c     2006-09-12 15:40:56.000000000 +0200
+++ hda/patch_realtek.c 2006-09-23 19:25:45.000000000 +0200
@@ -91,6 +91,7 @@
        ALC861_3ST_DIG,
        ALC861_6ST_DIG,
        ALC861_UNIWILL_M31,
+       ALC861_ASUS_A6RP,
        ALC861_AUTO,
        ALC861_MODEL_LAST,
 };
@@ -6070,6 +6071,45 @@
        { 4, alc861_uniwill_m31_ch4_init },
 };

+/* Set mic1 and line-in as input and unmute the mixer */
+static struct hda_verb alc861_asus_a6rp_ch2_init[] = {
+       /* set pin widget 1Ah (line in) for input */
+       { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
+       /* set pin widget 18h (mic1/2) for input, for mic also enable the vref */
+       { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
+
+       { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
+#if 0
+       { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
+       { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/+#endif
+       { } /* end */
+};
+/* Set mic1 nad line-in as output and mute mixer */
+static struct hda_verb alc861_asus_a6rp_ch6_init[] = {
+       /* set pin widget 1Ah (line in) for output (Back Surround)*/
+       { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
+//     { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
+       /* set pin widget 18h (mic1) for output (CLFE)*/
+       { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
+//     { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
+
+       { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
+       { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
+
+       { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
+//#if 0
+       { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
+       { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/+//#endif
+       { } /* end */
+};
+
+static struct hda_channel_mode alc861_asus_a6rp_modes[2] = {
+       { 2, alc861_asus_a6rp_ch2_init },
+       { 6, alc861_asus_a6rp_ch6_init },
+};
+
 /* patch-ALC861 */

 static struct snd_kcontrol_new alc861_base_mixer[] = {
@@ -6188,6 +6228,48 @@
        },
        { } /* end */
 };
+
+static struct snd_kcontrol_new alc861_asus_a6rp_mixer[] = {
+        /* output mixer control */
+       HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
+       HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
+       HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),+       HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
+       /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
+
+       /* Input mixer control */
+       /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
+          HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
+       HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
+       HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
+       HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
+       HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
+       HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
+       HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
+       HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
+       HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), // was HDA_INPUT(?)
+
+       /* Capture mixer control */
+       HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
+       HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
+       {
+               .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+               .name = "Capture Source",
+               .count = 1,
+               .info = alc_mux_enum_info,
+               .get = alc_mux_enum_get,
+               .put = alc_mux_enum_put,
+       },
+       {
+               .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+               .name = "Channel Mode",
+               .info = alc_ch_mode_info,
+               .get = alc_ch_mode_get,
+               .put = alc_ch_mode_put,
+                .private_value = ARRAY_SIZE(alc861_asus_a6rp_modes),
+       },
+       { }
+};

 /*
  * generic initialization of ADC, input mixers and output mixers
@@ -6377,6 +6459,68 @@
        { }
 };

+static struct hda_verb alc861_asus_a6rp_init_verbs[] = {
+       /*
+        * Unmute ADC0 and set the default input to mic-in
+        */
+       /* port-A for surround (rear panel) | according to codec#0 this is the HP jack*/
+       { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, // was 0x00
+       /* route front PCM to HP */
+       //{ 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
+       /* port-B for mic-in (rear panel) with vref */
+       { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
+       /* port-C for line-in (rear panel) */
+       { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
+       /* port-D for Front */
+       { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
+       { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
+       /* port-E for HP out (front panel) */
+       { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, // this has to be set to VREF80
+       /* route front PCM to HP */
+       { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x01 },
+       /* port-F for mic-in (front panel) with vref */
+       { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
+       /* port-G for CLFE (rear panel) */
+       { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
+       /* port-H for side (rear panel) */
+       { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
+       /* CD-in */
+       { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
+       /* route front mic to ADC1*/
+       {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
+       {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
+       /* Unmute DAC0~3 & spdif out*/
+       {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
+       {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
+       {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
+       {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
+       {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
+
+       /* Unmute Mixer 14 (mic) 1c (Line in)*/
+       {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
+        {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
+       {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
+        {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
+
+       /* Unmute Stereo Mixer 15 */
+       {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
+       {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
+       {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
+       {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c          }, //Output 0~12 step
+
+       {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
+       {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
+       {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
+       {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
+       {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
+       {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
+       {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
+       {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
+       {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, // hp used DAC 3 (Front)
+       {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
+       { }
+};
+
 /*
  * generic initialization of ADC, input mixers and output mixers
  */
@@ -6714,6 +6858,9 @@
        { .modelname = "uniwill-m31", .config = ALC861_UNIWILL_M31},
        { .pci_subvendor = 0x1584, .pci_subdevice = 0x9072,
          .config = ALC861_UNIWILL_M31 },
+       { .modelname = "asus-a6rp", .config = ALC861_ASUS_A6RP},
+       { .pci_subvendor = 0x1043, .pci_subdevice = 0x1393,
+         .config = ALC861_ASUS_A6RP },
        { .modelname = "auto", .config = ALC861_AUTO },
        {}
 };
@@ -6781,6 +6928,19 @@
                .adc_nids = alc861_adc_nids,
                .input_mux = &alc861_capture_source,
        },
+       [ALC861_ASUS_A6RP] = {
+               .mixers = { alc861_asus_a6rp_mixer },
+               .init_verbs = { alc861_asus_a6rp_init_verbs },
+               .num_dacs = ARRAY_SIZE(alc861_dac_nids),
+               .dac_nids = alc861_dac_nids,
+               .dig_out_nid = ALC861_DIGOUT_NID,
+               .num_channel_mode = ARRAY_SIZE(alc861_asus_a6rp_modes),
+               .channel_mode = alc861_asus_a6rp_modes,
+               .need_dac_fix = 1,
+               .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
+               .adc_nids = alc861_adc_nids,
+               .input_mux = &alc861_capture_source,
+       },

 };

Attachment: codec#0
Description: Binary data

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/alsa-devel

[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux