No sound from speaker, using Realtek ALC269 and snd_hda

Big Yuuta init.py at gmail.com
Wed Oct 31 01:00:43 UTC 2012


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 at 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


More information about the freebsd-questions mailing list