[alsa-devel] ALSA - No sound on MBA2,1

Bruno Prémont bonbons at linux-vserver.org
Wed Dec 4 13:42:09 CET 2013


Hi Takashi,

On Wed, 04 Dec 2013 12:18:14 +0100 Takashi Iwai wrote:
> At Wed, 4 Dec 2013 11:47:41 +0100, Bruno Prémont wrote:
> > On Wed, 04 Dec 2013 08:14:18 +0100 Takashi Iwai wrote:
> > > At Tue, 3 Dec 2013 22:54:13 +0100, Bruno Prémont wrote:
> > > > Hi Takashi,
> > > > 
> > > > Since I started using Linux on a MBA2,1 I never had sound working.
> > > > recently searching for some solution to get sound working I saw that
> > > > some users had sound with 3.2.x kernels and reported it stopped working
> > > > somewhere between 3.2 and 3.4.
> > > > 
> > > > Thus I tried bisecting this and found two steps of losing sound support,
> > > > a first one being losing sound output on built-in speaker, a second
> > > > point where sound through headphone jack stopped working.
> > > > 
> > > > Even with 3.2 non of the mute options is working (I did not try recording
> > > > via build-in microphone)
> > > > 
> > > > ...
> > > > 
> > > > Attached is the output of `alsa-info --with-devices` under current 3.12.2
> > > > kernel and under 3.2.53.
> > > > 
> > > > As this all seems related to quirks being replaced with auto-parsing.
> > > > Trying to revert the commits on top of 3.12.x looks unworkable.
> > > > 
> > > > Is there some extra data I should try to provide or a workaround/fix I
> > > > could try out? I'm booting in EFI mode using EFI stub (did backport it
> > > > from 3.3 to 3.2 for bisecting/testing 3.2).
> > > 
> > > You seem to be passing model=3stack, and this must break things.
> > > To be sure, try sound.git tree for-linus branch without any options.
> > >   git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git
> > 
> > I tried your branch (with merged rc2 from Linus) and there is still no
> > sound.
> > (took some time to test as kernel freezes during boot somewhere in
> > nouveau, thus me merging in rc2 in the hope of a fix for that)
> 
> Thanks.  Could you try the patch below?

Wow, that patch does a marvelous job!

Controls listed by alsamixer seem to all work the way they are intended,
MASTER affects both headphone jack and built-in speaker, muting works
per-channel as does volume.

Even the toggle "Headphone/mic jack" seems to perform the operation
indicated by its name (though I did not try recording yet).


So the patch is (Reported-and-)Tested-by: Bruno Prémont <bonbons at linux-vserver.org>

Thanks for your quick response and looking into this!



A rather borderline question/observation:
When plugging in headphone and the jack is configured as headphone
built-in speaker gets muted (seems reasonable default, hardware
triggered).
Is it possible to have that auto-muting reported in mixer and possibly
overridden via mixer if wanted (possibly via
mute-speaker-if-headphone-plugged option)?


Bruno

> ---
> diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
> index d510a88dfe0a..59c36de0cdc2 100644
> --- a/sound/pci/hda/patch_realtek.c
> +++ b/sound/pci/hda/patch_realtek.c
> @@ -1827,6 +1827,7 @@ enum {
>  	ALC889_FIXUP_DAC_ROUTE,
>  	ALC889_FIXUP_MBP_VREF,
>  	ALC889_FIXUP_IMAC91_VREF,
> +	ALC889_FIXUP_MBA21_VREF,
>  	ALC882_FIXUP_INV_DMIC,
>  	ALC882_FIXUP_NO_PRIMARY_HP,
>  	ALC887_FIXUP_ASUS_BASS,
> @@ -1931,17 +1932,13 @@ static void alc889_fixup_mbp_vref(struct hda_codec *codec,
>  	}
>  }
>  
> -/* Set VREF on speaker pins on imac91 */
> -static void alc889_fixup_imac91_vref(struct hda_codec *codec,
> -				     const struct hda_fixup *fix, int action)
> +static void alc889_fixup_mac_pins(struct hda_codec *codec,
> +				  const hda_nid_t *nids, int num_nids)
>  {
>  	struct alc_spec *spec = codec->spec;
> -	static hda_nid_t nids[2] = { 0x18, 0x1a };
>  	int i;
>  
> -	if (action != HDA_FIXUP_ACT_INIT)
> -		return;
> -	for (i = 0; i < ARRAY_SIZE(nids); i++) {
> +	for (i = 0; i < num_nids; i++) {
>  		unsigned int val;
>  		val = snd_hda_codec_get_pin_target(codec, nids[i]);
>  		val |= AC_PINCTL_VREF_50;
> @@ -1950,6 +1947,26 @@ static void alc889_fixup_imac91_vref(struct hda_codec *codec,
>  	spec->gen.keep_vref_in_automute = 1;
>  }
>  
> +/* Set VREF on speaker pins on imac91 */
> +static void alc889_fixup_imac91_vref(struct hda_codec *codec,
> +				     const struct hda_fixup *fix, int action)
> +{
> +	static hda_nid_t nids[2] = { 0x18, 0x1a };
> +
> +	if (action == HDA_FIXUP_ACT_INIT)
> +		alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
> +}
> +
> +/* Set VREF on speaker pins on mba21 */
> +static void alc889_fixup_mba21_vref(struct hda_codec *codec,
> +				    const struct hda_fixup *fix, int action)
> +{
> +	static hda_nid_t nids[2] = { 0x18, 0x19 };
> +
> +	if (action == HDA_FIXUP_ACT_INIT)
> +		alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
> +}
> +
>  /* Don't take HP output as primary
>   * Strangely, the speaker output doesn't work on Vaio Z and some Vaio
>   * all-in-one desktop PCs (for example VGC-LN51JGB) through DAC 0x05
> @@ -2149,6 +2166,12 @@ static const struct hda_fixup alc882_fixups[] = {
>  		.chained = true,
>  		.chain_id = ALC882_FIXUP_GPIO1,
>  	},
> +	[ALC889_FIXUP_MBA21_VREF] = {
> +		.type = HDA_FIXUP_FUNC,
> +		.v.func = alc889_fixup_mba21_vref,
> +		.chained = true,
> +		.chain_id = ALC889_FIXUP_MBP_VREF,
> +	},
>  	[ALC882_FIXUP_INV_DMIC] = {
>  		.type = HDA_FIXUP_FUNC,
>  		.v.func = alc_fixup_inv_dmic_0x12,
> @@ -2219,7 +2242,7 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = {
>  	SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889_FIXUP_MBP_VREF),
>  	SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD),
>  	SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC889_FIXUP_MBP_VREF),
> -	SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC889_FIXUP_MBP_VREF),
> +	SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC889_FIXUP_MBA21_VREF),
>  	SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889_FIXUP_MBP_VREF),
>  	SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
>  	SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_FIXUP_MACPRO_GPIO),


More information about the Alsa-devel mailing list