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:
@@ -1192,11 +1192,14 @@ static int cs_init(struct hda_codec *codec)
|
||||
init_output(codec);
|
||||
init_input(codec);
|
||||
init_digital(codec);
|
||||
snd_hda_jack_report_sync(codec);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cs_build_controls(struct hda_codec *codec)
|
||||
{
|
||||
struct cs_spec *spec = codec->spec;
|
||||
int err;
|
||||
|
||||
err = build_output(codec);
|
||||
@@ -1211,7 +1214,15 @@ static int cs_build_controls(struct hda_codec *codec)
|
||||
err = build_digital_input(codec);
|
||||
if (err < 0)
|
||||
return err;
|
||||
return cs_init(codec);
|
||||
err = cs_init(codec);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
err = snd_hda_jack_add_kctls(codec, &spec->autocfg);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void cs_free(struct hda_codec *codec)
|
||||
@@ -1234,6 +1245,7 @@ static void cs_unsol_event(struct hda_codec *codec, unsigned int res)
|
||||
cs_automic(codec);
|
||||
break;
|
||||
}
|
||||
snd_hda_jack_report_sync(codec);
|
||||
}
|
||||
|
||||
static const struct hda_codec_ops cs_patch_ops = {
|
||||
@@ -1611,6 +1623,7 @@ static int cs421x_init(struct hda_codec *codec)
|
||||
init_output(codec);
|
||||
init_input(codec);
|
||||
init_cs421x_digital(codec);
|
||||
snd_hda_jack_report_sync(codec);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1786,6 +1799,7 @@ static int build_cs421x_output(struct hda_codec *codec)
|
||||
|
||||
static int cs421x_build_controls(struct hda_codec *codec)
|
||||
{
|
||||
struct cs_spec *spec = codec->spec;
|
||||
int err;
|
||||
|
||||
err = build_cs421x_output(codec);
|
||||
@@ -1797,7 +1811,15 @@ static int cs421x_build_controls(struct hda_codec *codec)
|
||||
err = build_digital_output(codec);
|
||||
if (err < 0)
|
||||
return err;
|
||||
return cs421x_init(codec);
|
||||
err = cs421x_init(codec);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
err = snd_hda_jack_add_kctls(codec, &spec->autocfg);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void cs421x_unsol_event(struct hda_codec *codec, unsigned int res)
|
||||
@@ -1814,6 +1836,7 @@ static void cs421x_unsol_event(struct hda_codec *codec, unsigned int res)
|
||||
cs_automic(codec);
|
||||
break;
|
||||
}
|
||||
snd_hda_jack_report_sync(codec);
|
||||
}
|
||||
|
||||
static int parse_cs421x_input(struct hda_codec *codec)
|
||||
|
Reference in New Issue
Block a user