Headphone not working on a desktop machine

Bug #1155016 reported by David Henningsson
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
linux (Ubuntu)
Fix Released
Undecided
David Henningsson

Bug Description

On a desktop machine we're currently enabling, the front headphone output does not work (no or very weak output).

Please don't triage, this is for tracking purposes only.

Changed in linux (Ubuntu):
assignee: nobody → David Henningsson (diwic)
status: New → In Progress
Revision history for this message
David Henningsson (diwic) wrote : [PATCH] ALSA: hda - Disable IDT eapd_switch if there are no internal speakers

If there are no internal speakers, we should not turn the eapd switch
off, because it might be necessary to keep high for Headphone.

BugLink: https://bugs.launchpad.net/bugs/1155016
Signed-off-by: David Henningsson <email address hidden>
---
 sound/pci/hda/patch_sigmatel.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

Hi Takashi,

I encountered the bug when working with a pre-release machine (so no alsa-info, unfortunately).

Feel free to commit if you think this is a good idea. Or can you think of a use case
where this would cause a regression?

diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index d57c81e..66200ea8 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -3524,6 +3524,31 @@ static int stac_parse_auto_config(struct hda_codec *codec)
  if (err < 0)
   return err;

+ /* Don't GPIO-mute speakers if there are no internal speakers, because
+ the GPIO might be necessary for Headphone */
+ if (spec->eapd_switch) {
+ hda_nid_t *nid_pin;
+ int nids, i;
+ bool found = false;
+ if (spec->gen.autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT) {
+ nid_pin = spec->gen.autocfg.line_out_pins;
+ nids = spec->gen.autocfg.line_outs;
+ } else {
+ nid_pin = spec->gen.autocfg.speaker_pins;
+ nids = spec->gen.autocfg.speaker_outs;
+ }
+ for (i = 0; i < nids; i++) {
+ unsigned int def_conf = snd_hda_codec_get_pincfg(codec, nid_pin[i]);
+ unsigned int attr = snd_hda_get_input_pin_attr(def_conf);
+ if (attr == INPUT_PIN_ATTR_INT) {
+ found = true;
+ break;
+ }
+ }
+ if (!found)
+ spec->eapd_switch = 0;
+ }
+
  /* minimum value is actually mute */
  spec->gen.vmaster_tlv[3] |= TLV_DB_SCALE_MUTE;

--
1.7.9.5

Revision history for this message
Takashi Iwai (tiwai) wrote :

At Thu, 14 Mar 2013 10:42:00 +0100,
David Henningsson wrote:
>
> If there are no internal speakers, we should not turn the eapd switch
> off, because it might be necessary to keep high for Headphone.
>
> BugLink: https://bugs.launchpad.net/bugs/1155016
> Signed-off-by: David Henningsson <email address hidden>
> ---
> sound/pci/hda/patch_sigmatel.c | 25 +++++++++++++++++++++++++
> 1 file changed, 25 insertions(+)
>
> Hi Takashi,
>
> I encountered the bug when working with a pre-release machine (so no alsa-info, unfortunately).
>
> Feel free to commit if you think this is a good idea. Or can you think of a use case
> where this would cause a regression?

I'm inclined for avoiding applying this at that place for all IDT/STAC
codecs, but only to specific codec. patch_stac92hd73xx() is the only
IDT codecs setting spec->eapd_switch, and other places are only for
legacy STAC codecs, which I don't want to touch too much any longer.

spec->eapd_switch can be set on/off well even after calling
stac_parse_auto_config(), I guess, so it can be done in patch_*() as
well.

That is, I mean a patch like below.

thanks,

Takashi

---
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index d57c81e..b82cbc5 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -815,6 +815,29 @@ static int find_mute_led_cfg(struct hda_codec *codec, int default_polarity)
  return 0;
 }

+/* check whether a built-in speaker is included in parsed pins */
+static bool has_builtin_speaker(struct hda_codec *codec)
+{
+ struct sigmatel_spec *spec = codec->spec;
+ hda_nid_t *nid_pin;
+ int nids, i;
+
+ if (spec->gen.autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT) {
+ nid_pin = spec->gen.autocfg.line_out_pins;
+ nids = spec->gen.autocfg.line_outs;
+ } else {
+ nid_pin = spec->gen.autocfg.speaker_pins;
+ nids = spec->gen.autocfg.speaker_outs;
+ }
+
+ for (i = 0; i < nids; i++) {
+ unsigned int def_conf = snd_hda_codec_get_pincfg(codec, nid_pin[i]);
+ if (snd_hda_get_input_pin_attr(def_conf) == INPUT_PIN_ATTR_INT)
+ return true;
+ }
+ return false;
+}
+
 /*
  * PC beep controls
  */
@@ -3891,6 +3914,12 @@ static int patch_stac92hd73xx(struct hda_codec *codec)
   return err;
  }

+ /* Don't GPIO-mute speakers if there are no internal speakers, because
+ * the GPIO might be necessary for Headphone
+ */
+ if (spec->eapd_switch && !has_builtin_speaker(codec))
+ spec->eapd_switch = false;
+
  codec->proc_widget_hook = stac92hd7x_proc_hook;

  snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);

Revision history for this message
David Henningsson (diwic) wrote :

Patch committed upstream (after some modification by upstream) as http://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/commit/?id=303985f81019571db0b3a6f01fc7f03eb350657e

Will be in tomorrow's daily dkms package.

Changed in linux (Ubuntu):
status: In Progress → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package linux - 3.9.0-0.2

---------------
linux (3.9.0-0.2) saucy; urgency=low

  [ Tim Gardner ]

  * Enable extras packaging for amd64/i386.
    Fixes build depenencies with brittany and linux-meta.
 -- Tim Gardner <email address hidden> Mon, 29 Apr 2013 05:37:01 -0600

Changed in linux (Ubuntu):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.