From owner-freebsd-questions@FreeBSD.ORG Wed Oct 31 01:00:43 2012 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 90A8FCD0; Wed, 31 Oct 2012 01:00:43 +0000 (UTC) (envelope-from init.py@gmail.com) Received: from mail-la0-f54.google.com (mail-la0-f54.google.com [209.85.215.54]) by mx1.freebsd.org (Postfix) with ESMTP id AE5778FC15; Wed, 31 Oct 2012 01:00:42 +0000 (UTC) Received: by mail-la0-f54.google.com with SMTP id e12so839922lag.13 for ; Tue, 30 Oct 2012 18:00:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=RKEzt79j6odPyFJzfXhOdx2jv5SR8sUkB1uSOjquOmE=; b=eFdguNZtYNFtKli6jLr47V1gVIE03fNbnEmK6XGVKTRJIaLz/ShfAnUp7exeAqThzs UjIXeaa/1u9C7Pc/K2XLaTzfYXBsiJpNx/oEKpbjU3H9atfNBHLVk+dYAEcXMyPOqo+r qNAvt/NAkp8mMqMFDU5+HZOkhl+ZI+GYE2PKOZMQ+yn35D00ZElkbEMQaXGD1HTkOJQo jvMczU2DhnicMpNumKrcAlT4bYegLtUcPYn3L0tyNfoHZWGhobhR7E5CWg03D/hBZJsE vSlyCnMeMWVxHar84BUAOiRSrGGMIK0SwNx+vyuFmzbf6nTppxou5az07yJen1Nqwum3 it0w== MIME-Version: 1.0 Received: by 10.112.85.199 with SMTP id j7mr5703406lbz.69.1351645241445; Tue, 30 Oct 2012 18:00:41 -0700 (PDT) Received: by 10.114.60.114 with HTTP; Tue, 30 Oct 2012 18:00:41 -0700 (PDT) In-Reply-To: <508F9D57.7030004@FreeBSD.org> References: <508D8755.1080501@FreeBSD.org> <508D98C9.30603@FreeBSD.org> <508DA4D0.8040604@FreeBSD.org> <508EA9B0.2070501@FreeBSD.org> <508EB2F7.2000303@FreeBSD.org> <508F9D57.7030004@FreeBSD.org> Date: Wed, 31 Oct 2012 02:00:41 +0100 Message-ID: Subject: Re: No sound from speaker, using Realtek ALC269 and snd_hda From: Big Yuuta To: Alexander Motin Content-Type: text/plain; charset=ISO-8859-1 Cc: freebsd-questions@freebsd.org X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Oct 2012 01:00:43 -0000 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 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