Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 31 Oct 2012 10:35:43 +0200
From:      Alexander Motin <mav@FreeBSD.org>
To:        Big Yuuta <init.py@gmail.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: No sound from speaker, using Realtek ALC269 and snd_hda
Message-ID:  <5090E2DF.1040506@FreeBSD.org>
In-Reply-To: <CAN5iB8SMET51d2fJcRzFzSN1fpF0gzyE0Xw2eCx-WZciM8nWFA@mail.gmail.com>
References:  <CAN5iB8RJe=JY2zsDG40gtCwcf4uJBt0%2BtxiSSuHqnZ1Ob6=HZg@mail.gmail.com> <508D8755.1080501@FreeBSD.org> <CAN5iB8T9RySw4h5HaM=pCA_G8n4yVa%2BAwdz4_YO8yr-FFk3iZg@mail.gmail.com> <508D98C9.30603@FreeBSD.org> <CAN5iB8QMm80VWzRFMsD=_vDN0HNLCoU2tb-Bt6n5qjUOcLHDXA@mail.gmail.com> <CAN5iB8R--Jm5o57u3_xKwN_5Cd=3zSXEWj42DdxakXptBiYqKQ@mail.gmail.com> <508DA4D0.8040604@FreeBSD.org> <CAN5iB8ShL%2BBbSHDXhX65_DwiMjAjUpgO273-=VpUYicD_hDjcA@mail.gmail.com> <508EA9B0.2070501@FreeBSD.org> <CAN5iB8SxZqbZqxa6R0Ywr-iFbV9_0Y--ZcUNu271nFT-Cog41g@mail.gmail.com> <508EB2F7.2000303@FreeBSD.org> <CAN5iB8RQSk7%2BF3EhgrJMr4kpWhZ8hEjfmuW3LmXJLf_JTPoFfQ@mail.gmail.com> <CAN5iB8S_BQfRMgjYqzY6QDP6UnXPgCst49iJ9=su3CMuWZzUpg@mail.gmail.com> <508F9D57.7030004@FreeBSD.org> <CAN5iB8SMET51d2fJcRzFzSN1fpF0gzyE0Xw2eCx-WZciM8nWFA@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 31.10.2012 03:00, Big Yuuta wrote:
> Yes, actually I'm using  sysctl hw.snd.verbose=4 to understand
> what's happening inside.
>
>  From my tests, it's not a sense redirection problem. Because, when
> I unmute everything, and then I plug a headphone, the sound goes
> to the headphone and the internal speaker is mutted, and when I unplug
> it, the internal speaker gets the sound, and (nid 26: the headphone)
> is mutted.
>
> So, anyway, I'm still debugging it and I found out that I don't have
> to "unmute" everything, I just have to make sure that nid=15 is never
> mutted.
>
> i.e. the test I wrote in my last email could be more precise like this:
>
> hdaa_audio_ctl_amp_set_internal(struct hdaa_devinfo *devinfo, nid_t nid,
>                                          int index, int lmute, int rmute,
>                                          int left, int right, int dir)
> {
>          uint16_t v = 0;
>
>      if(nid == 15){ //just don't mute nid15, and it works
>             lmute = 0;
>             rmute = 0;
>       }
>
>
> Strange thing is from my dmesg here: http://dpaste.com/818967/plain/
> I thought that nid 15 wasn't used.
>
> hdaa0:             nid: 15 [DISABLED]
> hdaa0:            Name: audio mixer
> hdaa0:      Widget cap: 0x0020010a
> hdaa0:       Input amp: 0x80000000
> hdaa0:                  mute=1 step=0 size=0 offset=0
> hdaa0:     connections: 2
> hdaa0:           |
> hdaa0:           + [DISABLED] <- nid=2 [audio output]
> hdaa0:           + [DISABLED] <- nid=11 [audio mixer]
>
> Maybe it's disabled because others were disabled for other reasons?
> I honestly don't grok the whole thing yet.

The driver reports as disabled all parts of the CODEC that are unused in 
specific configuration. It is quite usual to have half of CODEC unused. 
To avoid unexpected effects driver mutes all disabled controls. 
According to information reported by CODEC, this mixer is really unused. 
I see no problem from the driver side there.

> We, IMVHO, probably just should add a patch inside hdaa_patches.c
> for this case:
>
>      case HDA_CODEC_ALC269:
>          if (subid == 0x10438437){ //0x10438437 is my subsystem id.
> 		    w = hdaa_widget_get(devinfo, 15);
>              if(w != NULL)
>                   //some magic to unmute it ?
>          }
>          break;
>
> What do you think?

I think Realtek engineers got crazy. They not only created several 
different CODECs sharing the same ID (my laptop also uses variant of 
ALC269, but it has no such problem), but also violated their own specs 
and information reported by CODEC. Patch below should hide problematic 
muter from the driver. Solution is far from perfect, but that is best I 
can propose without having more information. Please test it and report 
about results.

--- hdaa_patches.c      (revision 242352)
+++ hdaa_patches.c      (working copy)
@@ -541,6 +541,21 @@ hdaa_patch(struct hdaa_devinfo *devinfo)
                 if (w != NULL)
                         w->connsenable[0] = 0;
                 break;
+       case HDA_CODEC_ALC269:
+               /*
+                * ASUS EeePC 1001px has strange variant of ALC269 CODEC,
+                * that mutes speaker if unused mixer at NID 15 is muted.
+                * Probably CODEC incorrectly reports internal connections.
+                * Hide that muter from the driver.  There are several 
CODECs
+                * sharing this ID and I have not enough information about
+                * them to implement more universal solution.
+                */
+               if (subid == 0x10438437) {
+                       w = hdaa_widget_get(devinfo, 15);
+                       if (w != NULL)
+                               w->param.inamp_cap = 0;
+               }
+               break;
         case HDA_CODEC_CX20582:
         case HDA_CODEC_CX20583:
         case HDA_CODEC_CX20584:


-- 
Alexander Motin



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5090E2DF.1040506>