On Sun, Mar 07, 2010 at 09:09:27PM -0700, Ted Roby wrote: > On Sun, Mar 7, 2010 at 7:31 PM, Jacob Meuser <jake...@sdf.lonestar.org>wrote: > > > > hmm. ok. I think I know what the problem is. that change you made to > > set outputs.hp_source=mix4 makes sense. did you try that with the diff? > > > > > Tested. No change.
hmm. why is that silent? another GPIO needs to be unmuted perhaps? > > but the real bugger is that you have 'spkr' and 'spkr2'. are there really > > two sets of built-in speakers? I guess so, as this would explain why > > muting outputs.spkr only diminishes the sound. the problem is that > > spkr2 ends up where hp should be (that is, hp should get mix4, the > > first stereo pair output, by default). > > > > I can only assume there are two sets. Sound from this model of Macbook > is better (louder, more range) than the sound I experienced from a G4 > Powerbook. Four little cones would certainly account for that. > > > > > > can you build a kernel with AZALIA_DEBUG defined (uncomment it it > > azalia.h) and send me the dmesg from that? I need to know how the > > widgets are described by the codec. > > > > The following dmesg includes prior suggested patch to azalia_codec.c > and AZALIA_DEBUG defined > > azalia0: unknown14 wcap=40018f<CONNLIST,UNSOL,AMPOV,OUTAMP,INAMP,STEREO> > > cap=373c<VREF100,VREF80,VREFGND,VREF50,VREFHIZ,INPUT,OUTPUT,HEADPHONE,PRESENCE> > [04/00] color=unknown device=spkr conn=fixed conntype=unknown > location=n/a chassis=internal special=none > inamp: mute=0 size=39 steps=3 offset=0 > outamp: mute=1 size=0 steps=0 offset=0 > connections=0xc,0xd,0xe,0xf,0x26; selected=0xc there's 1 fixed internal stereo speaker > azalia0: green15 wcap=40018f<CONNLIST,UNSOL,AMPOV,OUTAMP,INAMP,STEREO> > > cap=373c<VREF100,VREF80,VREFGND,VREF50,VREFHIZ,INPUT,OUTPUT,HEADPHONE,PRESENCE> > [05/00] color=green device=hp conn=jack conntype=combination > location=rear chassis=external special=none > inamp: mute=0 size=39 steps=3 offset=0 > outamp: mute=1 size=0 steps=0 offset=0 > connections=0xc,0xd,0xe,0xf,0x26; selected=0xd that's the headphone jack > azalia0: unknown16 wcap=40018f<CONNLIST,UNSOL,AMPOV,OUTAMP,INAMP,STEREO> > cap=3c<INPUT,OUTPUT,HEADPHONE,PRESENCE> > [04/01] color=unknown device=spkr conn=fixed conntype=unknown > location=n/a chassis=internal special=none > inamp: mute=0 size=39 steps=3 offset=0 > outamp: mute=1 size=0 steps=0 offset=0 > connections=0xc,0xd,0xe,0xf,0x26; selected=0xe and there's fixed internal stereo speaker #2 the following should deal better with the two speaker sets. can you check that plugging into the headphone jack now mutes all built-in speakers? please send 'mixerctl -v' output with this patch applied. -- jake...@sdf.lonestar.org SDF Public Access UNIX System - http://sdf.lonestar.org Index: azalia.c =================================================================== RCS file: /cvs/src/sys/dev/pci/azalia.c,v retrieving revision 1.166 diff -u -p azalia.c --- azalia.c 24 Dec 2009 10:12:19 -0000 1.166 +++ azalia.c 8 Mar 2010 04:21:01 -0000 @@ -1660,7 +1660,8 @@ azalia_codec_init(codec_t *this) this->na_dacs = this->na_dacs_d = 0; this->na_adcs = this->na_adcs_d = 0; - this->speaker = this->spkr_dac = this->fhp = this->fhp_dac = + this->speaker = this->speaker2 = this->spkr_dac = + this->fhp = this->fhp_dac = this->mic = this->mic_adc = -1; this->nsense_pins = 0; this->nout_jacks = 0; @@ -1704,13 +1705,22 @@ azalia_codec_init(codec_t *this) case CORB_CD_FIXED: switch (w->d.pin.device) { case CORB_CD_SPEAKER: - if ((this->speaker == -1) || - (w->d.pin.association < - this->w[this->speaker].d.pin.association)) { + if (this->speaker == -1) { this->speaker = i; + } else if (w->d.pin.association < + this->w[this->speaker].d.pin.association || + (w->d.pin.association == + this->w[this->speaker].d.pin.association && + w->d.pin.sequence < + this->w[this->speaker].d.pin.sequence)) { + this->speaker2 = this->speaker; + this->speaker = i; + } else { + this->speaker2 = i; + } + if (this->speaker == i) this->spkr_dac = azalia_codec_find_defdac(this, i, 0); - } break; case CORB_CD_MICIN: this->mic = i; @@ -1938,7 +1948,8 @@ azalia_codec_sort_pins(codec_t *this) switch(w->d.pin.device) { /* primary - output by default */ case CORB_CD_SPEAKER: - if (w->nid == this->speaker) + if (w->nid == this->speaker || + w->nid == this->speaker2) break; /* FALLTHROUGH */ case CORB_CD_HEADPHONE: @@ -1991,7 +2002,8 @@ azalia_codec_sort_pins(codec_t *this) break; /* secondary - output by default */ case CORB_CD_SPEAKER: - if (w->nid == this->speaker) + if (w->nid == this->speaker || + w->nid == this->speaker2) break; /* FALLTHROUGH */ case CORB_CD_HEADPHONE: @@ -2264,6 +2276,27 @@ azalia_codec_select_spkrdac(codec_t *this) this->spkr_dac = conv; else this->opins[0].conv = conv; + } + } + + /* If there is a speaker2, try to connect it to spkr_dac. */ + if (this->speaker2 != -1) { + conn = conv = -1; + w = &this->w[this->speaker2]; + for (i = 0; i < w->nconnections; i++) { + conv = azalia_codec_find_defdac(this, + w->connections[i], 1); + if (conv == this->spkr_dac) { + conn = i; + break; + } + } + if (conn != -1) { + err = azalia_comresp(this, w->nid, + CORB_SET_CONNECTION_SELECT_CONTROL, conn, 0); + if (err) + return(err); + w->selected = conn; } } Index: azalia.h =================================================================== RCS file: /cvs/src/sys/dev/pci/azalia.h,v retrieving revision 1.58 diff -u -p azalia.h --- azalia.h 22 Dec 2009 08:48:14 -0000 1.58 +++ azalia.h 8 Mar 2010 04:21:01 -0000 @@ -691,7 +691,8 @@ typedef struct codec_t { nid_t mic; /* fixed (internal) mic */ nid_t mic_adc; nid_t speaker; /* fixed (internal) speaker */ - nid_t spkr_dac; + nid_t speaker2; /* 2nd fixed (internal) speaker */ + nid_t spkr_dac; /* default DAC for speaker and speaker2 */ nid_t input_mixer; nid_t fhp; /* front headphone jack */ nid_t fhp_dac; Index: azalia_codec.c =================================================================== RCS file: /cvs/src/sys/dev/pci/azalia_codec.c,v retrieving revision 1.141 diff -u -p azalia_codec.c --- azalia_codec.c 11 Feb 2010 21:33:39 -0000 1.141 +++ azalia_codec.c 8 Mar 2010 04:21:01 -0000 @@ -547,11 +547,17 @@ azalia_unsol_event(codec_t *this, int tag) mc.un.ord = vol; err = azalia_mixer_set(this, this->speaker, MI_TARGET_OUTAMP, &mc); + if (this->speaker2 != -1) + err = azalia_mixer_set(this, this->speaker2, + MI_TARGET_OUTAMP, &mc); break; case AZ_SPKR_MUTE_SPKR_DIR: mc.un.ord = vol ? 0 : 1; err = azalia_mixer_set(this, this->speaker, MI_TARGET_PINDIR, &mc); + if (this->speaker2 != -1) + err = azalia_mixer_set(this, this->speaker2, + MI_TARGET_PINDIR, &mc); break; case AZ_SPKR_MUTE_DAC_MUTE: mc.un.ord = vol; @@ -763,7 +769,8 @@ azalia_mixer_init(codec_t *this) /* input mute */ if (w->widgetcap & COP_AWCAP_INAMP && w->inamp_cap & COP_AMPCAP_MUTE && - w->nid != this->speaker) { + w->nid != this->speaker && + w->nid != this->speaker2) { if (w->type != COP_AWTYPE_AUDIO_MIXER) { MIXER_REG_PROLOG; snprintf(d->label.name, sizeof(d->label.name), @@ -790,7 +797,8 @@ azalia_mixer_init(codec_t *this) if (!azalia_widget_enabled(this, w->connections[j])) continue; - if (w->connections[j] == this->speaker) + if (w->connections[j] == this->speaker || + w->connections[j] == this->speaker2) continue; d->un.s.member[k].mask = 1 << j; strlcpy(d->un.s.member[k].label.name, @@ -807,7 +815,8 @@ azalia_mixer_init(codec_t *this) /* input gain */ if (w->widgetcap & COP_AWCAP_INAMP && COP_AMPCAP_NUMSTEPS(w->inamp_cap) && - w->nid != this->speaker) { + w->nid != this->speaker && + w->nid != this->speaker2) { if (w->type != COP_AWTYPE_AUDIO_SELECTOR && w->type != COP_AWTYPE_AUDIO_MIXER) { MIXER_REG_PROLOG; @@ -829,7 +838,8 @@ azalia_mixer_init(codec_t *this) if (!azalia_widget_enabled(this, w->connections[j])) continue; - if (w->connections[j] == this->speaker) + if (w->connections[j] == this->speaker || + w->connections[j] == this->speaker2) continue; MIXER_REG_PROLOG; snprintf(d->label.name, @@ -868,7 +878,8 @@ azalia_mixer_init(codec_t *this) if (!azalia_widget_enabled(this, w->connections[j])) continue; - if (w->connections[j] == this->speaker) + if (w->connections[j] == this->speaker || + w->connections[j] == this->speaker2) continue; d->un.s.member[k].mask = 1 << j; strlcpy(d->un.s.member[k].label.name,