On Mon, Mar 8, 2010 at 1:29 AM, Jacob Meuser <[email protected]>wrote:
>
> won't help with this problem. the GPIOs in azalia aren't exposed
> through gpioctl.
>
I've learned something!
>
> it's probably a matter of figuring out what's "special" about the
> headphone jack on the Macs. turning on VRef for output seems odd, but
> apparently works for some of the MacbookPro models.
>
> of course, you'll probably want to turn up outputs.master and/or
> outputs.mix3 ...
>
>
Actually, the headphones jack is now working correctly.
I had applied your larger patch to fresh sources, not including your first
patch.
I put 0x00a1106b back to AZ_QRK_WID_OVREF50.
Now that I've eliminated user retardation all seems well with no mixerctl
changes.
On a related note, I have not spent enough time with CVS to figure out easy
patch management while helping you. I applied these patches the
old-fashioned way.
Hence, my desire to show you these diffs (functional!):
--- azalia.c.orig Mon Mar 8 08:04:56 2010
+++ azalia.c Mon Mar 8 08:04:56 2010
@@ -1660,7 +1660,8 @@
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 @@
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 @@
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 @@
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 @@
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;
}
}
--- azalia.h.orig Mon Mar 8 08:04:56 2010
+++ azalia.h Mon Mar 8 08:04:56 2010
@@ -536,7 +536,7 @@
} __packed rirb_entry_t;
-#define AZALIA_DEBUG
+/* #define AZALIA_DEBUG */
#ifdef AZALIA_DEBUG
# define DPRINTF(x) do { printf x; } while (0/*CONSTCOND*/)
#else
@@ -691,7 +691,8 @@
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;
--- azalia_codec.c.orig Mon Mar 8 08:04:56 2010
+++ azalia_codec.c Mon Mar 8 08:04:56 2010
@@ -132,7 +132,8 @@
this->subid == 0x00a3106b) { /* APPLE_MB4 */
this->qrks |= AZ_QRK_GPIO_UNMUTE_0;
}
- if (this->subid == 0x00a0106b)
+ if (this->subid == 0x00a1106b ||
+ this->subid == 0x00a0106b)
this->qrks |= AZ_QRK_WID_OVREF50;
break;
case 0x10ec0888:
@@ -547,11 +548,17 @@
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 +770,8 @@
/* 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 +798,8 @@
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 +816,8 @@
/* 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 +839,8 @@
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 +879,8 @@
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,