aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/patch_cirrus.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2011-10-27 18:03:22 -0400
committerTakashi Iwai <tiwai@suse.de>2011-11-16 05:12:17 -0500
commit01a61e12b4602c82bde9797d0e153f3e53c95b04 (patch)
tree04f817cb8cec2bae3edcc9a873aea1b674b146ad /sound/pci/hda/patch_cirrus.c
parent1835a0f9a2121ce3198dab67507d4d3e960cc09e (diff)
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>
Diffstat (limited to 'sound/pci/hda/patch_cirrus.c')
-rw-r--r--sound/pci/hda/patch_cirrus.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/sound/pci/hda/patch_cirrus.c b/sound/pci/hda/patch_cirrus.c
index 6f158777f71a..135fd49cd49d 100644
--- a/sound/pci/hda/patch_cirrus.c
+++ b/sound/pci/hda/patch_cirrus.c
@@ -1192,11 +1192,14 @@ static int cs_init(struct hda_codec *codec)
1192 init_output(codec); 1192 init_output(codec);
1193 init_input(codec); 1193 init_input(codec);
1194 init_digital(codec); 1194 init_digital(codec);
1195 snd_hda_jack_report_sync(codec);
1196
1195 return 0; 1197 return 0;
1196} 1198}
1197 1199
1198static int cs_build_controls(struct hda_codec *codec) 1200static int cs_build_controls(struct hda_codec *codec)
1199{ 1201{
1202 struct cs_spec *spec = codec->spec;
1200 int err; 1203 int err;
1201 1204
1202 err = build_output(codec); 1205 err = build_output(codec);
@@ -1211,7 +1214,15 @@ static int cs_build_controls(struct hda_codec *codec)
1211 err = build_digital_input(codec); 1214 err = build_digital_input(codec);
1212 if (err < 0) 1215 if (err < 0)
1213 return err; 1216 return err;
1214 return cs_init(codec); 1217 err = cs_init(codec);
1218 if (err < 0)
1219 return err;
1220
1221 err = snd_hda_jack_add_kctls(codec, &spec->autocfg);
1222 if (err < 0)
1223 return err;
1224
1225 return 0;
1215} 1226}
1216 1227
1217static void cs_free(struct hda_codec *codec) 1228static void cs_free(struct hda_codec *codec)
@@ -1234,6 +1245,7 @@ static void cs_unsol_event(struct hda_codec *codec, unsigned int res)
1234 cs_automic(codec); 1245 cs_automic(codec);
1235 break; 1246 break;
1236 } 1247 }
1248 snd_hda_jack_report_sync(codec);
1237} 1249}
1238 1250
1239static const struct hda_codec_ops cs_patch_ops = { 1251static const struct hda_codec_ops cs_patch_ops = {
@@ -1611,6 +1623,7 @@ static int cs421x_init(struct hda_codec *codec)
1611 init_output(codec); 1623 init_output(codec);
1612 init_input(codec); 1624 init_input(codec);
1613 init_cs421x_digital(codec); 1625 init_cs421x_digital(codec);
1626 snd_hda_jack_report_sync(codec);
1614 1627
1615 return 0; 1628 return 0;
1616} 1629}
@@ -1786,6 +1799,7 @@ static int build_cs421x_output(struct hda_codec *codec)
1786 1799
1787static int cs421x_build_controls(struct hda_codec *codec) 1800static int cs421x_build_controls(struct hda_codec *codec)
1788{ 1801{
1802 struct cs_spec *spec = codec->spec;
1789 int err; 1803 int err;
1790 1804
1791 err = build_cs421x_output(codec); 1805 err = build_cs421x_output(codec);
@@ -1797,7 +1811,15 @@ static int cs421x_build_controls(struct hda_codec *codec)
1797 err = build_digital_output(codec); 1811 err = build_digital_output(codec);
1798 if (err < 0) 1812 if (err < 0)
1799 return err; 1813 return err;
1800 return cs421x_init(codec); 1814 err = cs421x_init(codec);
1815 if (err < 0)
1816 return err;
1817
1818 err = snd_hda_jack_add_kctls(codec, &spec->autocfg);
1819 if (err < 0)
1820 return err;
1821
1822 return 0;
1801} 1823}
1802 1824
1803static void cs421x_unsol_event(struct hda_codec *codec, unsigned int res) 1825static 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)
1814 cs_automic(codec); 1836 cs_automic(codec);
1815 break; 1837 break;
1816 } 1838 }
1839 snd_hda_jack_report_sync(codec);
1817} 1840}
1818 1841
1819static int parse_cs421x_input(struct hda_codec *codec) 1842static int parse_cs421x_input(struct hda_codec *codec)