Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 31 Oct 2012 02:00:41 +0100
From:      Big Yuuta <init.py@gmail.com>
To:        Alexander Motin <mav@freebsd.org>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: No sound from speaker, using Realtek ALC269 and snd_hda
Message-ID:  <CAN5iB8SMET51d2fJcRzFzSN1fpF0gzyE0Xw2eCx-WZciM8nWFA@mail.gmail.com>
In-Reply-To: <508F9D57.7030004@FreeBSD.org>
References:  <CAN5iB8RJe=JY2zsDG40gtCwcf4uJBt0+txiSSuHqnZ1Ob6=HZg@mail.gmail.com> <508D8755.1080501@FreeBSD.org> <CAN5iB8T9RySw4h5HaM=pCA_G8n4yVa+Awdz4_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+BbSHDXhX65_DwiMjAjUpgO273-=VpUYicD_hDjcA@mail.gmail.com> <508EA9B0.2070501@FreeBSD.org> <CAN5iB8SxZqbZqxa6R0Ywr-iFbV9_0Y--ZcUNu271nFT-Cog41g@mail.gmail.com> <508EB2F7.2000303@FreeBSD.org> <CAN5iB8RQSk7+F3EhgrJMr4kpWhZ8hEjfmuW3LmXJLf_JTPoFfQ@mail.gmail.com> <CAN5iB8S_BQfRMgjYqzY6QDP6UnXPgCst49iJ9=su3CMuWZzUpg@mail.gmail.com> <508F9D57.7030004@FreeBSD.org>

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help
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.

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?


On Tue, Oct 30, 2012 at 10:26 AM, Alexander Motin <mav@freebsd.org> wrote:
> On 30.10.2012 09:17, Big Yuuta wrote:
>>
>> Hi Alexander,
>>
>> I got the sound out of that speaker!! :)
>>
>> I actually started to read your code, and I'm still trying to understand
>> the stuff in it (I never wrote a device driver)
>>
>> Anyway, so I did a little hack'ish modification (just to test) in function
>>
>> 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;
>>
>>      // Do not mute, even if asked for. Test to be removed of course
>>      lmute = 0;
>>      rmute = 0;
>>
>>
>> I know, this is absolutely NOT the way to do it, but I wanted to see
>> if the speaker wasn't muted (or the mixer that controls it)
>> and it -actually- WAS muted!
>>
>> Now, I guess I'll have to read the whole code, try to understand its
>> internals, and I hope to be able to write a patch to add to hdaa_patches.c
>
>
> Speaker should be muted on headphones connection. That is one of two ways of
> handling playback redirection. But it should be unmuted on disconnection.
> You may try to set sysctl hw.snd.verbose=4 and connect/disconnect
> headphones. It should report which controls are affected and how.
>
> You may try this hack to use pin controls instead of muters for redirection:
> --- hdaa.c      (revision 242315)
> +++ hdaa.c      (working copy)
> @@ -260,7 +260,7 @@
>         /* (Un)Mute headphone pin. */
>         ctl = hdaa_audio_ctl_amp_get(devinfo,
>             w->nid, HDAA_CTL_IN, -1, 1);
> -       if (ctl != NULL && ctl->mute) {
> +       if (ctl != NULL && ctl->mute && 0) {
>                 /* If pin has muter - use it. */
>                 val = connected ? 0 : 1;
>                 if (val != ctl->forcemute) {
> @@ -290,7 +290,7 @@ hdaa_hpredir_handler(struct hdaa_widget *w)
>                         continue;
>                 ctl = hdaa_audio_ctl_amp_get(devinfo,
>                     as->pins[j], HDAA_CTL_IN, -1, 1);
> -               if (ctl != NULL && ctl->mute) {
> +               if (ctl != NULL && ctl->mute && 0) {
>                         /* If pin has muter - use it. */
>                         val = connected ? 1 : 0;
>                         if (val == ctl->forcemute)
>
>
> --
> Alexander Motin



Want to link to this message? Use this URL: <http://docs.FreeBSD.org/cgi/mid.cgi?CAN5iB8SMET51d2fJcRzFzSN1fpF0gzyE0Xw2eCx-WZciM8nWFA>