ALSA: hda - Create jack-detection kcontrols
Create kcontrols for pin jack-detections, which work similarly like jack-input layer. Each control will notify when the jack is plugged or unplugged, and also user can read the value at any time via the normal control API. The control elements are created with iface=CARD, so that they won't appear in the mixer apps. So far, only the pins that enabled the jack-detection are registered. For covering all pins, the transition of the common unsol-tag handling would be needed. Stay tuned. Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
@ -1500,6 +1500,11 @@ static int via_build_controls(struct hda_codec *codec)
|
||||
analog_low_current_mode(codec);
|
||||
|
||||
via_free_kctls(codec); /* no longer needed */
|
||||
|
||||
err = snd_hda_jack_add_kctls(codec, &spec->autocfg);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1722,6 +1727,7 @@ static void via_unsol_event(struct hda_codec *codec,
|
||||
via_hp_automute(codec);
|
||||
else if (res == VIA_GPIO_EVENT)
|
||||
via_gpio_control(codec);
|
||||
snd_hda_jack_report_sync(codec);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
@ -2771,6 +2777,7 @@ static int via_init(struct hda_codec *codec)
|
||||
via_auto_init_unsol_event(codec);
|
||||
|
||||
via_hp_automute(codec);
|
||||
snd_hda_jack_report_sync(codec);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user