diff options
author | David Henningsson <david.henningsson@canonical.com> | 2012-09-25 05:31:00 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2012-10-06 10:43:40 -0400 |
commit | 29adc4b9e6a96571e83353cdcb69628871984935 (patch) | |
tree | 7f10dd8540f5576d61ca00e2fccc175303420a08 /sound/pci/hda/patch_sigmatel.c | |
parent | 954df2a9686cebbb9cc4067697b370aa9ce77d4a (diff) |
ALSA: hda - make Realtek/Sigmatel/Conexant use the generic unsol event
For less duplication of code between codecs, and to make it easier
in the future to improve code for all codecs simultaneously.
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/patch_sigmatel.c')
-rw-r--r-- | sound/pci/hda/patch_sigmatel.c | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index bb6c50e7b5da..fe163547f906 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
@@ -4212,6 +4212,9 @@ static int stac_add_event(struct hda_codec *codec, hda_nid_t nid, | |||
4212 | return 0; | 4212 | return 0; |
4213 | } | 4213 | } |
4214 | 4214 | ||
4215 | static void handle_unsol_event(struct hda_codec *codec, | ||
4216 | struct hda_jack_tbl *event); | ||
4217 | |||
4215 | /* check if given nid is a valid pin and no other events are assigned | 4218 | /* check if given nid is a valid pin and no other events are assigned |
4216 | * to it. If OK, assign the event, set the unsol flag, and returns 1. | 4219 | * to it. If OK, assign the event, set the unsol flag, and returns 1. |
4217 | * Otherwise, returns zero. | 4220 | * Otherwise, returns zero. |
@@ -4229,6 +4232,7 @@ static int enable_pin_detect(struct hda_codec *codec, hda_nid_t nid, | |||
4229 | if (event->action && event->action != type) | 4232 | if (event->action && event->action != type) |
4230 | return 0; | 4233 | return 0; |
4231 | event->action = type; | 4234 | event->action = type; |
4235 | event->callback = handle_unsol_event; | ||
4232 | snd_hda_jack_detect_enable(codec, nid, 0); | 4236 | snd_hda_jack_detect_enable(codec, nid, 0); |
4233 | return 1; | 4237 | return 1; |
4234 | } | 4238 | } |
@@ -4867,20 +4871,6 @@ static void stac_issue_unsol_event(struct hda_codec *codec, hda_nid_t nid) | |||
4867 | handle_unsol_event(codec, event); | 4871 | handle_unsol_event(codec, event); |
4868 | } | 4872 | } |
4869 | 4873 | ||
4870 | static void stac92xx_unsol_event(struct hda_codec *codec, unsigned int res) | ||
4871 | { | ||
4872 | struct hda_jack_tbl *event; | ||
4873 | int tag; | ||
4874 | |||
4875 | tag = (res >> 26) & 0x7f; | ||
4876 | event = snd_hda_jack_tbl_get_from_tag(codec, tag); | ||
4877 | if (!event) | ||
4878 | return; | ||
4879 | event->jack_dirty = 1; | ||
4880 | handle_unsol_event(codec, event); | ||
4881 | snd_hda_jack_report_sync(codec); | ||
4882 | } | ||
4883 | |||
4884 | static int hp_blike_system(u32 subsystem_id); | 4874 | static int hp_blike_system(u32 subsystem_id); |
4885 | 4875 | ||
4886 | static void set_hp_led_gpio(struct hda_codec *codec) | 4876 | static void set_hp_led_gpio(struct hda_codec *codec) |
@@ -5131,7 +5121,7 @@ static const struct hda_codec_ops stac92xx_patch_ops = { | |||
5131 | .build_pcms = stac92xx_build_pcms, | 5121 | .build_pcms = stac92xx_build_pcms, |
5132 | .init = stac92xx_init, | 5122 | .init = stac92xx_init, |
5133 | .free = stac92xx_free, | 5123 | .free = stac92xx_free, |
5134 | .unsol_event = stac92xx_unsol_event, | 5124 | .unsol_event = snd_hda_jack_unsol_event, |
5135 | #ifdef CONFIG_PM | 5125 | #ifdef CONFIG_PM |
5136 | .suspend = stac92xx_suspend, | 5126 | .suspend = stac92xx_suspend, |
5137 | .resume = stac92xx_resume, | 5127 | .resume = stac92xx_resume, |