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.
+/* 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_resetup(codec, idx);
--
1.7.9.5
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 pci/hda/ patch_realtek. c | 49 +++++++ +++++++ +++++++ +++++++ ------- ------
Tested-by: Chih-Hsyuan Ho <email address hidden>
Signed-off-by: David Henningsson <email address hidden>
---
sound/
1 file changed, 34 insertions(+), 15 deletions(-)
Alsa info: /bugs.launchpad .net/ubuntu/ +source/ linux/+ bug/1018262/ +attachment/ 3205361/ +files/ alsa-info- 1015cx- unplugged. log
https:/
diff --git a/sound/ pci/hda/ patch_realtek. c b/sound/ pci/hda/ patch_realtek. c pci/hda/ patch_realtek. c pci/hda/ patch_realtek. c outputs( struct hda_codec *codec); dmic_sync( struct hda_codec *codec, bool force);
index 5c81ee9..6174d4a 100644
--- a/sound/
+++ b/sound/
@@ -303,6 +303,38 @@ static inline hda_nid_t get_capsrc(struct alc_spec *spec, int idx)
static void call_update_
static void alc_inv_
+/* for shared I/O, change the pin-control accordingly */ shared_ mic_hp( struct hda_codec *codec, bool set_as_mic) inputs[ 1].pin; get_default_ vref(codec, pin); type(get_ wcaps(codec, vref_pin)) == AC_WID_PIN && connect( snd_hda_ codec_get_ pincfg( codec, vref_pin)) == AC_JACK_PORT_NONE) { get_default_ vref(codec, vref_pin); set_pin_ ctl(codec, vref_pin, PIN_IN | (set_as_mic ? vref_val : 0)); set_pin_ ctl(codec, pin, val); speaker = !set_as_mic; outputs( codec); select( struct hda_codec *codec, unsigned int adc_idx, select( struct hda_codec *codec, unsigned int adc_idx, >cur_mux[ adc_idx] = idx;
+static void update_
+{
+ struct alc_spec *spec = codec->spec;
+ unsigned int val;
+ hda_nid_t pin = spec->autocfg.
+ /* 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_
+
+ /* 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_
+ get_defcfg_
+ unsigned int vref_val = snd_hda_
+ if (vref_val != AC_PINCTL_VREF_HIZ)
+ snd_hda_
+ }
+ }
+
+ val = set_as_mic ? val | PIN_IN : PIN_HP;
+ snd_hda_
+
+ spec->automute_
+ call_update_
+}
+
/* select the given imux item; either unmute exclusively or select the route */
static int alc_mux_
unsigned int idx, bool force)
@@ -329,21 +361,8 @@ static int alc_mux_
return 0;
spec-
- /* for shared I/O, change the pin-control accordingly */ shared_ mic_hp) { inputs[ 1].pin; cur_mux[ adc_idx] ) get_default_ vref(codec, pin) | PIN_IN; set_pin_ ctl(codec, pin, val); speaker = !spec-> cur_mux[ adc_idx] ; outputs( codec); shared_ mic_hp) shared_ mic_hp( codec, spec->cur_ mux[adc_ idx]);
- if (spec->
- unsigned int val;
- hda_nid_t pin = spec->autocfg.
- /* NOTE: this assumes that there are only two inputs, the
- * first is the real internal mic and the second is HP jack.
- */
- if (spec->
- val = snd_hda_
- else
- val = PIN_HP;
- snd_hda_
- spec->automute_
- call_update_
- }
+ if (spec->
+ update_
if (spec-> dyn_adc_ switch) { dyn_adc_ pcm_resetup( codec, idx);
alc_
--
1.7.9.5