[ASUS 1015cx] Retask single 3-pin jack as microphone

Bug #1018262 reported by David Henningsson
18
This bug affects 4 people
Affects Status Importance Assigned to Milestone
linux (Ubuntu)
Fix Released
Undecided
David Henningsson
pulseaudio (Ubuntu)
Fix Released
Undecided
David Henningsson

Bug Description

Asus 1015 CX has only one 3-pin jack, that can be used as either a headphone jack or a mic jack, but not both simultaneously.

Currently only the headphone function is working.

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

Alsa-info

Changed in pulseaudio (Ubuntu):
assignee: nobody → David Henningsson (diwic)
Changed in linux (Ubuntu):
assignee: nobody → David Henningsson (diwic)
Revision history for this message
Brad Figg (brad-figg) wrote : Missing required logs.

This bug is missing log files that will aid in diagnosing the problem. From a terminal window please run:

apport-collect 1018262

and then change the status of the bug to 'Confirmed'.

If, due to the nature of the issue you have encountered, you are unable to run this command, please add a comment stating that fact and change the bug status to 'Confirmed'.

This change has been made by an automated script, maintained by the Ubuntu Kernel Team.

Changed in linux (Ubuntu):
status: New → Incomplete
tags: added: precise
Revision history for this message
David Henningsson (diwic) wrote : [PATCH 1/2] ALSA: HDA: Support single 3-pin jack without VREF on the actual pin
Download full text (3.2 KiB)

Some ASUS device has a single 3-pin jack that can either be a mic or
a headphone, but the pin does not have VREF capabilities. We've been
told by Realtek to instead enable VREF on pin 0x18 in that case.

BugLink: https://bugs.launchpad.net/bugs/1018262
Tested-by: Chih-Hsyuan Ho <email address hidden>
Signed-off-by: David Henningsson <email address hidden>
---
 sound/pci/hda/patch_realtek.c | 49 ++++++++++++++++++++++++++++-------------
 1 file changed, 34 insertions(+), 15 deletions(-)

Alsa info:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1018262/+attachment/3205361/+files/alsa-info-1015cx-unplugged.log

diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 5c81ee9..6174d4a 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -303,6 +303,38 @@ static inline hda_nid_t get_capsrc(struct alc_spec *spec, int idx)
 static void call_update_outputs(struct hda_codec *codec);
 static void alc_inv_dmic_sync(struct hda_codec *codec, bool force);

+/* for shared I/O, change the pin-control accordingly */
+static void update_shared_mic_hp(struct hda_codec *codec, bool set_as_mic)
+{
+ struct alc_spec *spec = codec->spec;
+ unsigned int val;
+ hda_nid_t pin = spec->autocfg.inputs[1].pin;
+ /* NOTE: this assumes that there are only two inputs, the
+ * first is the real internal mic and the second is HP/mic jack.
+ */
+
+ val = snd_hda_get_default_vref(codec, pin);
+
+ /* This pin does not have vref caps - let's instead enable vref on pin 0x18
+ instead, as suggested by Realtek */
+ if (val == AC_PINCTL_VREF_HIZ) {
+ const hda_nid_t vref_pin = 0x18;
+ /* Sanity check pin 0x18 */
+ if (get_wcaps_type(get_wcaps(codec, vref_pin)) == AC_WID_PIN &&
+ get_defcfg_connect(snd_hda_codec_get_pincfg(codec, vref_pin)) == AC_JACK_PORT_NONE) {
+ unsigned int vref_val = snd_hda_get_default_vref(codec, vref_pin);
+ if (vref_val != AC_PINCTL_VREF_HIZ)
+ snd_hda_set_pin_ctl(codec, vref_pin, PIN_IN | (set_as_mic ? vref_val : 0));
+ }
+ }
+
+ val = set_as_mic ? val | PIN_IN : PIN_HP;
+ snd_hda_set_pin_ctl(codec, pin, val);
+
+ spec->automute_speaker = !set_as_mic;
+ call_update_outputs(codec);
+}
+
 /* select the given imux item; either unmute exclusively or select the route */
 static int alc_mux_select(struct hda_codec *codec, unsigned int adc_idx,
      unsigned int idx, bool force)
@@ -329,21 +361,8 @@ static int alc_mux_select(struct hda_codec *codec, unsigned int adc_idx,
   return 0;
  spec->cur_mux[adc_idx] = idx;

- /* for shared I/O, change the pin-control accordingly */
- if (spec->shared_mic_hp) {
- unsigned int val;
- hda_nid_t pin = spec->autocfg.inputs[1].pin;
- /* NOTE: this assumes that there are only two inputs, the
- * first is the real internal mic and the second is HP jack.
- */
- if (spec->cur_mux[adc_idx])
- val = snd_hda_get_default_vref(codec, pin) | PIN_IN;
- else
- val = PIN_HP;
- snd_hda_set_pin_ctl(codec, pin, val);
- spec->automute_speaker = !spec->cur_mux[adc_idx];
- call_update_outputs(codec);
- }
+ if (spec->shared_mic_hp)
+ update_shared_mic_hp(codec, spec->cur_mux[adc_idx]);

  if (spec->dyn_adc_switch) {
   alc_dyn_adc_pcm...

Read more...

Revision history for this message
David Henningsson (diwic) wrote : [PATCH 2/2] ALSA: hda - give 3-pin jack the name "Headphone Mic Jack"

This 3-pin jack was labeled "Headphone Jack", but it could also be
used as a mic jack just by switching "Input Source". Therefore we need
to call the jack something else, to make sure PulseAudio can use the
speaker together with the external mic. (PulseAudio might mute the
speaker if it detects a headphone being plugged in.)

Signed-off-by: David Henningsson <email address hidden>
---
 sound/pci/hda/patch_realtek.c | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 6174d4a..7189e07 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -2001,13 +2001,31 @@ static int __alc_build_controls(struct hda_codec *codec)
  return 0;
 }

-static int alc_build_controls(struct hda_codec *codec)
+static int alc_build_jacks(struct hda_codec *codec)
 {
  struct alc_spec *spec = codec->spec;
+
+ if (spec->shared_mic_hp) {
+ int err;
+ int nid = spec->autocfg.inputs[1].pin;
+ err = snd_hda_jack_add_kctl(codec, nid, "Headphone Mic", 0);
+ if (err < 0)
+ return err;
+ err = snd_hda_jack_detect_enable(codec, nid, 0);
+ if (err < 0)
+ return err;
+ }
+
+ return snd_hda_jack_add_kctls(codec, &spec->autocfg);
+}
+
+static int alc_build_controls(struct hda_codec *codec)
+{
  int err = __alc_build_controls(codec);
  if (err < 0)
   return err;
- err = snd_hda_jack_add_kctls(codec, &spec->autocfg);
+
+ err = alc_build_jacks(codec);
  if (err < 0)
   return err;
  alc_apply_fixup(codec, ALC_FIXUP_ACT_BUILD);
--
1.7.9.5

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

Kernel patches accepted into Takashi's tree.

Changed in linux (Ubuntu):
status: Incomplete → In Progress
Changed in pulseaudio (Ubuntu):
status: New → In Progress
Revision history for this message
David Henningsson (diwic) wrote :

And this is the proposed PulseAudio patch.

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

commit 5780b627e24113323427c102175296ae43dfb9d7
Author: David Henningsson <email address hidden>
Date: Wed Jun 27 18:45:45 2012 +0200

    ALSA: hda - give 3-pin jack the name "Headphone Mic Jack"

and

commit 00227f15a0ad8401d2b0b67905da63e75b544895
Author: David Henningsson <email address hidden>
Date: Wed Jun 27 18:45:44 2012 +0200

    ALSA: HDA: Support single 3-pin jack without VREF on the actual pin

Are scheduled for Linux-3.6. They will need backport to Quantal if we decide to go with 3.5 kernel.

Pulseaudio patches are awaiting further testing from someone with the hardware at hand.

Changed in linux (Ubuntu):
status: In Progress → Fix Committed
Changed in pulseaudio (Ubuntu):
status: In Progress → Incomplete
tags: added: blocks-hwcert-enablement
Revision history for this message
David Henningsson (diwic) wrote :

This replaces the previous patch

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

Updated patch to turn auto-mute mode off

Revision history for this message
Francesco Bonanno (mibo-fra) wrote :

Hello everyone, i've the same problem; but my netbook is an ASUS EeePC 1001px and it uses a one 4-pin jack. I'd like to look the patch at the moment, but in your opinion I can use it ? I'd like to use a 3-pin jack headphone with integrated microphone and a 2-pin stereo microphone only. I've to add a particular, I use at the moment the developement branch of ubuntu (12.10) , but I've had this problem in all version of ubuntu since ubuntu 10.04 (the first version of ubuntu I had installed on the ASUS netbook) . Thanks for the help , Francesco .

Revision history for this message
Francesco Bonanno (mibo-fra) wrote :

I've seen the patch, and well with those I can't use the stereo microphon, but I think I'll use more the jack headphone/microphone. I've seen you ( David Henningsson ) have created a ppa for this problem, but there aren't any packages in that. I've Ubuntu 12.10 developement branch so if it isn't a problem, if you add packages in that ppa with the patches , I'll can test it :D . Ever thanks for help and good work :) .

Revision history for this message
Francesco Bonanno (mibo-fra) wrote :

*Forever

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

@Franesco, uhmm, if you really want to turn your four-pin jack into a three-pin jack I guess you could try disabling the external microphone in hda-jack-retask, and then use the patches on top of that, but I have no idea if that will work. Your hardware might not support it physically.

Revision history for this message
Francesco Bonanno (mibo-fra) wrote :

Well, I have confused ideas now. This is for a little particular. The series of the asus eeepc 1001px have a lot of subseries, for example my eeepc is an asus eeepc 1001px-blk003x , but exist the asus eeepc 1001px-whi006s etc, so I'm sorry, but at the moment I'm not sure about my eeepc 1001px uses a 3-pin jack o 4-pin jack, sorry :D . But is there a program o a utility I can use to determinate I'm using a 4 o 3 pin jack ? Thanks for help :D . Francesco :) .

Revision history for this message
Francesco Bonanno (mibo-fra) wrote :

Nothing, nothing, is a 3-pin jack too :D , so when I've time, I'll download source code of Linux , the patches and I'll patch the kernel source and I'll start to compile it :D . Bye and thank you :D .

Revision history for this message
Francesco Bonanno (mibo-fra) wrote :

*"It is" , sorry for the error, I can speak and write in English very well, but my mother tongue is Italian, so when I'm inattentive, I'll make some mistakes, but I know in English the subject must be specified (the other hand, in Italian there is this possibility, this is the reason of my error :D) , sorry :) .

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package linux - 3.5.0-14.15

---------------
linux (3.5.0-14.15) quantal-proposed; urgency=low

  [ Andy Whitcroft ]

  * SAUCE: fs: d_revalidate methods may be passed a NULL nameidata
    - LP: #1038075

  [ Dave Airlie ]

  * SAUCE: drm/vmwgfx: add MODULE_DEVICE_TABLE so vmwgfx loads at boot
    - LP: #1039157

  [ Ike Panhc ]

  * [Config] Enable CONFIG_DEVPTS_MULTIPLE_INSTANCES for highbank
    - LP: #1038259

  [ Tim Gardner ]

  * SAUCE: wlcore: Declare MODULE_FIRMWARE usage
    - LP: #1042918

  [ Upstream Kernel Changes ]

  * asus-nb-wmi: add some video toggle keys
    - LP: #1022427
  * [media] uvcvideo: Fix frame drop in bulk video stream
  * [media] uvcvideo: Fix alternate setting selection
  * Input: wacom - add support to Cintiq 22HD
    - LP: #1043733
  * ALSA: HDA: Create phantom jacks for fixed inputs and outputs
  * ALSA: HDA: Support single 3-pin jack without VREF on the actual pin
    - LP: #1018262
  * ALSA: hda - give 3-pin jack the name "Headphone Mic Jack"
  * ALSA: hda - Do not set GPIOs for speakers on IDT if there are no
    speakers
    - LP: #1040077
  * ALSA: hda - Fix pop noise in headphones on S3 for Asus X55A, X55V
    - LP: #1034779
  * ALSA: hda - Always call standard unsolicited event for Realtek codecs
    - LP: #1021192
  * ALSA: hda - Add the inverted digital mic workaround to Realtek codecs
  * ALSA: hda - Add inverted mic quirks for Asus U41SV, Acer 1810TZ and
    AOD260
    - LP: #1006089, #996611, #997227
  * ALSA: hda - don't create dysfunctional mixer controls for ca0132
    - LP: #1038651
  * ALSA: hda - Don't send invalid volume knob command on IDT 92hd75bxx
 -- Leann Ogasawara <email address hidden> Thu, 06 Sep 2012 10:06:28 -0700

Changed in linux (Ubuntu):
status: Fix Committed → Fix Released
Revision history for this message
Francesco Bonanno (mibo-fra) wrote :

More or less it works now .

Revision history for this message
Adam Conrad (adconrad) wrote : Update Released

The verification of this Stable Release Update has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regresssions.

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

I think this is working nowadays; we have plenty of Dell hardware that now works in similar ways (although not exactly the same).
And it seems difficult to find the hardware to verify, so I'm marking this as Fix Released. If you still find the bug with the Asus 1015 CX in the latest release of ubuntu, please reopen the bug.

Changed in pulseaudio (Ubuntu):
status: Incomplete → 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.