diff options
author | Takashi Iwai <tiwai@suse.de> | 2014-09-11 09:22:46 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2014-09-16 11:23:44 -0400 |
commit | 1a4f69d5aaecb39a980fc20b14ec800fd5b53061 (patch) | |
tree | f0fad4d91cbee4fa3436b53c16a5e436cc381550 | |
parent | bda17b82bfa9601f167ec338755b0b96909db5a0 (diff) |
ALSA: hda - Allow multiple callbacks for jack
So far, hda_jack infrastructure allows only one callback per jack, and
this makes things slightly complicated when a driver wants to assign
multiple tasks to a jack, e.g. the standard auto-mute with a power
up/down sequence. This can be simplified if the hda_jack accepts
multiple callbacks.
This patch is such an extension: the callback-specific part (the
function and private_data) is split to another struct from
hda_jack_tbl, and multiple such objects can be assigned to a single
hda_jack_tbl entry.
The new struct hda_jack_callback is passed to each callback function
now, thus the patch became bigger than expected. But these changes
are mostly trivial.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r-- | sound/pci/hda/hda_generic.c | 19 | ||||
-rw-r--r-- | sound/pci/hda/hda_generic.h | 12 | ||||
-rw-r--r-- | sound/pci/hda/hda_jack.c | 58 | ||||
-rw-r--r-- | sound/pci/hda/hda_jack.h | 17 | ||||
-rw-r--r-- | sound/pci/hda/patch_cirrus.c | 2 | ||||
-rw-r--r-- | sound/pci/hda/patch_conexant.c | 3 | ||||
-rw-r--r-- | sound/pci/hda/patch_hdmi.c | 14 | ||||
-rw-r--r-- | sound/pci/hda/patch_realtek.c | 12 | ||||
-rw-r--r-- | sound/pci/hda/patch_sigmatel.c | 24 | ||||
-rw-r--r-- | sound/pci/hda/patch_via.c | 11 |
10 files changed, 107 insertions, 65 deletions
diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c index 4d605e4ac41c..32a85f9cac4b 100644 --- a/sound/pci/hda/hda_generic.c +++ b/sound/pci/hda/hda_generic.c | |||
@@ -2032,7 +2032,8 @@ static int create_speaker_out_ctls(struct hda_codec *codec) | |||
2032 | * independent HP controls | 2032 | * independent HP controls |
2033 | */ | 2033 | */ |
2034 | 2034 | ||
2035 | static void call_hp_automute(struct hda_codec *codec, struct hda_jack_tbl *jack); | 2035 | static void call_hp_automute(struct hda_codec *codec, |
2036 | struct hda_jack_callback *jack); | ||
2036 | static int indep_hp_info(struct snd_kcontrol *kcontrol, | 2037 | static int indep_hp_info(struct snd_kcontrol *kcontrol, |
2037 | struct snd_ctl_elem_info *uinfo) | 2038 | struct snd_ctl_elem_info *uinfo) |
2038 | { | 2039 | { |
@@ -3948,7 +3949,8 @@ static void call_update_outputs(struct hda_codec *codec) | |||
3948 | } | 3949 | } |
3949 | 3950 | ||
3950 | /* standard HP-automute helper */ | 3951 | /* standard HP-automute helper */ |
3951 | void snd_hda_gen_hp_automute(struct hda_codec *codec, struct hda_jack_tbl *jack) | 3952 | void snd_hda_gen_hp_automute(struct hda_codec *codec, |
3953 | struct hda_jack_callback *jack) | ||
3952 | { | 3954 | { |
3953 | struct hda_gen_spec *spec = codec->spec; | 3955 | struct hda_gen_spec *spec = codec->spec; |
3954 | hda_nid_t *pins = spec->autocfg.hp_pins; | 3956 | hda_nid_t *pins = spec->autocfg.hp_pins; |
@@ -3968,7 +3970,8 @@ void snd_hda_gen_hp_automute(struct hda_codec *codec, struct hda_jack_tbl *jack) | |||
3968 | EXPORT_SYMBOL_GPL(snd_hda_gen_hp_automute); | 3970 | EXPORT_SYMBOL_GPL(snd_hda_gen_hp_automute); |
3969 | 3971 | ||
3970 | /* standard line-out-automute helper */ | 3972 | /* standard line-out-automute helper */ |
3971 | void snd_hda_gen_line_automute(struct hda_codec *codec, struct hda_jack_tbl *jack) | 3973 | void snd_hda_gen_line_automute(struct hda_codec *codec, |
3974 | struct hda_jack_callback *jack) | ||
3972 | { | 3975 | { |
3973 | struct hda_gen_spec *spec = codec->spec; | 3976 | struct hda_gen_spec *spec = codec->spec; |
3974 | 3977 | ||
@@ -3988,7 +3991,8 @@ void snd_hda_gen_line_automute(struct hda_codec *codec, struct hda_jack_tbl *jac | |||
3988 | EXPORT_SYMBOL_GPL(snd_hda_gen_line_automute); | 3991 | EXPORT_SYMBOL_GPL(snd_hda_gen_line_automute); |
3989 | 3992 | ||
3990 | /* standard mic auto-switch helper */ | 3993 | /* standard mic auto-switch helper */ |
3991 | void snd_hda_gen_mic_autoswitch(struct hda_codec *codec, struct hda_jack_tbl *jack) | 3994 | void snd_hda_gen_mic_autoswitch(struct hda_codec *codec, |
3995 | struct hda_jack_callback *jack) | ||
3992 | { | 3996 | { |
3993 | struct hda_gen_spec *spec = codec->spec; | 3997 | struct hda_gen_spec *spec = codec->spec; |
3994 | int i; | 3998 | int i; |
@@ -4011,7 +4015,8 @@ void snd_hda_gen_mic_autoswitch(struct hda_codec *codec, struct hda_jack_tbl *ja | |||
4011 | EXPORT_SYMBOL_GPL(snd_hda_gen_mic_autoswitch); | 4015 | EXPORT_SYMBOL_GPL(snd_hda_gen_mic_autoswitch); |
4012 | 4016 | ||
4013 | /* call appropriate hooks */ | 4017 | /* call appropriate hooks */ |
4014 | static void call_hp_automute(struct hda_codec *codec, struct hda_jack_tbl *jack) | 4018 | static void call_hp_automute(struct hda_codec *codec, |
4019 | struct hda_jack_callback *jack) | ||
4015 | { | 4020 | { |
4016 | struct hda_gen_spec *spec = codec->spec; | 4021 | struct hda_gen_spec *spec = codec->spec; |
4017 | if (spec->hp_automute_hook) | 4022 | if (spec->hp_automute_hook) |
@@ -4021,7 +4026,7 @@ static void call_hp_automute(struct hda_codec *codec, struct hda_jack_tbl *jack) | |||
4021 | } | 4026 | } |
4022 | 4027 | ||
4023 | static void call_line_automute(struct hda_codec *codec, | 4028 | static void call_line_automute(struct hda_codec *codec, |
4024 | struct hda_jack_tbl *jack) | 4029 | struct hda_jack_callback *jack) |
4025 | { | 4030 | { |
4026 | struct hda_gen_spec *spec = codec->spec; | 4031 | struct hda_gen_spec *spec = codec->spec; |
4027 | if (spec->line_automute_hook) | 4032 | if (spec->line_automute_hook) |
@@ -4031,7 +4036,7 @@ static void call_line_automute(struct hda_codec *codec, | |||
4031 | } | 4036 | } |
4032 | 4037 | ||
4033 | static void call_mic_autoswitch(struct hda_codec *codec, | 4038 | static void call_mic_autoswitch(struct hda_codec *codec, |
4034 | struct hda_jack_tbl *jack) | 4039 | struct hda_jack_callback *jack) |
4035 | { | 4040 | { |
4036 | struct hda_gen_spec *spec = codec->spec; | 4041 | struct hda_gen_spec *spec = codec->spec; |
4037 | if (spec->mic_autoswitch_hook) | 4042 | if (spec->mic_autoswitch_hook) |
diff --git a/sound/pci/hda/hda_generic.h b/sound/pci/hda/hda_generic.h index 72f5624125fb..61dd5153f512 100644 --- a/sound/pci/hda/hda_generic.h +++ b/sound/pci/hda/hda_generic.h | |||
@@ -284,11 +284,11 @@ struct hda_gen_spec { | |||
284 | 284 | ||
285 | /* automute / autoswitch hooks */ | 285 | /* automute / autoswitch hooks */ |
286 | void (*hp_automute_hook)(struct hda_codec *codec, | 286 | void (*hp_automute_hook)(struct hda_codec *codec, |
287 | struct hda_jack_tbl *tbl); | 287 | struct hda_jack_callback *cb); |
288 | void (*line_automute_hook)(struct hda_codec *codec, | 288 | void (*line_automute_hook)(struct hda_codec *codec, |
289 | struct hda_jack_tbl *tbl); | 289 | struct hda_jack_callback *cb); |
290 | void (*mic_autoswitch_hook)(struct hda_codec *codec, | 290 | void (*mic_autoswitch_hook)(struct hda_codec *codec, |
291 | struct hda_jack_tbl *tbl); | 291 | struct hda_jack_callback *cb); |
292 | }; | 292 | }; |
293 | 293 | ||
294 | int snd_hda_gen_spec_init(struct hda_gen_spec *spec); | 294 | int snd_hda_gen_spec_init(struct hda_gen_spec *spec); |
@@ -320,11 +320,11 @@ int snd_hda_gen_build_pcms(struct hda_codec *codec); | |||
320 | 320 | ||
321 | /* standard jack event callbacks */ | 321 | /* standard jack event callbacks */ |
322 | void snd_hda_gen_hp_automute(struct hda_codec *codec, | 322 | void snd_hda_gen_hp_automute(struct hda_codec *codec, |
323 | struct hda_jack_tbl *jack); | 323 | struct hda_jack_callback *jack); |
324 | void snd_hda_gen_line_automute(struct hda_codec *codec, | 324 | void snd_hda_gen_line_automute(struct hda_codec *codec, |
325 | struct hda_jack_tbl *jack); | 325 | struct hda_jack_callback *jack); |
326 | void snd_hda_gen_mic_autoswitch(struct hda_codec *codec, | 326 | void snd_hda_gen_mic_autoswitch(struct hda_codec *codec, |
327 | struct hda_jack_tbl *jack); | 327 | struct hda_jack_callback *jack); |
328 | void snd_hda_gen_update_outputs(struct hda_codec *codec); | 328 | void snd_hda_gen_update_outputs(struct hda_codec *codec); |
329 | 329 | ||
330 | #ifdef CONFIG_PM | 330 | #ifdef CONFIG_PM |
diff --git a/sound/pci/hda/hda_jack.c b/sound/pci/hda/hda_jack.c index a5fe1b428015..f56765ae73a7 100644 --- a/sound/pci/hda/hda_jack.c +++ b/sound/pci/hda/hda_jack.c | |||
@@ -111,17 +111,21 @@ snd_hda_jack_tbl_new(struct hda_codec *codec, hda_nid_t nid) | |||
111 | 111 | ||
112 | void snd_hda_jack_tbl_clear(struct hda_codec *codec) | 112 | void snd_hda_jack_tbl_clear(struct hda_codec *codec) |
113 | { | 113 | { |
114 | struct hda_jack_tbl *jack = codec->jacktbl.list; | ||
115 | int i; | ||
116 | |||
117 | for (i = 0; i < codec->jacktbl.used; i++, jack++) { | ||
118 | struct hda_jack_callback *cb, *next; | ||
114 | #ifdef CONFIG_SND_HDA_INPUT_JACK | 119 | #ifdef CONFIG_SND_HDA_INPUT_JACK |
115 | /* free jack instances manually when clearing/reconfiguring */ | 120 | /* free jack instances manually when clearing/reconfiguring */ |
116 | if (!codec->bus->shutdown && codec->jacktbl.list) { | 121 | if (!codec->bus->shutdown && jack->jack) |
117 | struct hda_jack_tbl *jack = codec->jacktbl.list; | 122 | snd_device_free(codec->bus->card, jack->jack); |
118 | int i; | 123 | #endif |
119 | for (i = 0; i < codec->jacktbl.used; i++, jack++) { | 124 | for (cb = jack->callback; cb; cb = next) { |
120 | if (jack->jack) | 125 | next = cb->next; |
121 | snd_device_free(codec->bus->card, jack->jack); | 126 | kfree(cb); |
122 | } | 127 | } |
123 | } | 128 | } |
124 | #endif | ||
125 | snd_array_free(&codec->jacktbl); | 129 | snd_array_free(&codec->jacktbl); |
126 | } | 130 | } |
127 | 131 | ||
@@ -219,28 +223,38 @@ EXPORT_SYMBOL_GPL(snd_hda_jack_detect_state); | |||
219 | * errno. Check and handle the return value appropriately with standard | 223 | * errno. Check and handle the return value appropriately with standard |
220 | * macros such as @IS_ERR() and @PTR_ERR(). | 224 | * macros such as @IS_ERR() and @PTR_ERR(). |
221 | */ | 225 | */ |
222 | struct hda_jack_tbl * | 226 | struct hda_jack_callback * |
223 | snd_hda_jack_detect_enable_callback(struct hda_codec *codec, hda_nid_t nid, | 227 | snd_hda_jack_detect_enable_callback(struct hda_codec *codec, hda_nid_t nid, |
224 | hda_jack_callback cb) | 228 | hda_jack_callback_fn func) |
225 | { | 229 | { |
226 | struct hda_jack_tbl *jack = snd_hda_jack_tbl_new(codec, nid); | 230 | struct hda_jack_tbl *jack; |
231 | struct hda_jack_callback *callback = NULL; | ||
227 | int err; | 232 | int err; |
228 | 233 | ||
234 | jack = snd_hda_jack_tbl_new(codec, nid); | ||
229 | if (!jack) | 235 | if (!jack) |
230 | return ERR_PTR(-ENOMEM); | 236 | return ERR_PTR(-ENOMEM); |
237 | if (func) { | ||
238 | callback = kzalloc(sizeof(*callback), GFP_KERNEL); | ||
239 | if (!callback) | ||
240 | return ERR_PTR(-ENOMEM); | ||
241 | callback->func = func; | ||
242 | callback->tbl = jack; | ||
243 | callback->next = jack->callback; | ||
244 | jack->callback = callback; | ||
245 | } | ||
246 | |||
231 | if (jack->jack_detect) | 247 | if (jack->jack_detect) |
232 | return jack; /* already registered */ | 248 | return callback; /* already registered */ |
233 | jack->jack_detect = 1; | 249 | jack->jack_detect = 1; |
234 | if (cb) | ||
235 | jack->callback = cb; | ||
236 | if (codec->jackpoll_interval > 0) | 250 | if (codec->jackpoll_interval > 0) |
237 | return jack; /* No unsol if we're polling instead */ | 251 | return callback; /* No unsol if we're polling instead */ |
238 | err = snd_hda_codec_write_cache(codec, nid, 0, | 252 | err = snd_hda_codec_write_cache(codec, nid, 0, |
239 | AC_VERB_SET_UNSOLICITED_ENABLE, | 253 | AC_VERB_SET_UNSOLICITED_ENABLE, |
240 | AC_USRSP_EN | jack->tag); | 254 | AC_USRSP_EN | jack->tag); |
241 | if (err < 0) | 255 | if (err < 0) |
242 | return ERR_PTR(err); | 256 | return ERR_PTR(err); |
243 | return jack; | 257 | return callback; |
244 | } | 258 | } |
245 | EXPORT_SYMBOL_GPL(snd_hda_jack_detect_enable_callback); | 259 | EXPORT_SYMBOL_GPL(snd_hda_jack_detect_enable_callback); |
246 | 260 | ||
@@ -503,13 +517,17 @@ EXPORT_SYMBOL_GPL(snd_hda_jack_add_kctls); | |||
503 | static void call_jack_callback(struct hda_codec *codec, | 517 | static void call_jack_callback(struct hda_codec *codec, |
504 | struct hda_jack_tbl *jack) | 518 | struct hda_jack_tbl *jack) |
505 | { | 519 | { |
506 | if (jack->callback) | 520 | struct hda_jack_callback *cb; |
507 | jack->callback(codec, jack); | 521 | |
522 | for (cb = jack->callback; cb; cb = cb->next) | ||
523 | cb->func(codec, cb); | ||
508 | if (jack->gated_jack) { | 524 | if (jack->gated_jack) { |
509 | struct hda_jack_tbl *gated = | 525 | struct hda_jack_tbl *gated = |
510 | snd_hda_jack_tbl_get(codec, jack->gated_jack); | 526 | snd_hda_jack_tbl_get(codec, jack->gated_jack); |
511 | if (gated && gated->callback) | 527 | if (gated) { |
512 | gated->callback(codec, gated); | 528 | for (cb = gated->callback; cb; cb = cb->next) |
529 | cb->func(codec, cb); | ||
530 | } | ||
513 | } | 531 | } |
514 | } | 532 | } |
515 | 533 | ||
diff --git a/sound/pci/hda/hda_jack.h b/sound/pci/hda/hda_jack.h index 668669ce3e52..b41e0a3ea1fb 100644 --- a/sound/pci/hda/hda_jack.h +++ b/sound/pci/hda/hda_jack.h | |||
@@ -14,14 +14,21 @@ | |||
14 | 14 | ||
15 | struct auto_pin_cfg; | 15 | struct auto_pin_cfg; |
16 | struct hda_jack_tbl; | 16 | struct hda_jack_tbl; |
17 | struct hda_jack_callback; | ||
17 | 18 | ||
18 | typedef void (*hda_jack_callback) (struct hda_codec *, struct hda_jack_tbl *); | 19 | typedef void (*hda_jack_callback_fn) (struct hda_codec *, struct hda_jack_callback *); |
20 | |||
21 | struct hda_jack_callback { | ||
22 | struct hda_jack_tbl *tbl; | ||
23 | hda_jack_callback_fn func; | ||
24 | unsigned int private_data; /* arbitrary data */ | ||
25 | struct hda_jack_callback *next; | ||
26 | }; | ||
19 | 27 | ||
20 | struct hda_jack_tbl { | 28 | struct hda_jack_tbl { |
21 | hda_nid_t nid; | 29 | hda_nid_t nid; |
22 | unsigned char tag; /* unsol event tag */ | 30 | unsigned char tag; /* unsol event tag */ |
23 | unsigned int private_data; /* arbitrary data */ | 31 | struct hda_jack_callback *callback; |
24 | hda_jack_callback callback; | ||
25 | /* jack-detection stuff */ | 32 | /* jack-detection stuff */ |
26 | unsigned int pin_sense; /* cached pin-sense value */ | 33 | unsigned int pin_sense; /* cached pin-sense value */ |
27 | unsigned int jack_detect:1; /* capable of jack-detection? */ | 34 | unsigned int jack_detect:1; /* capable of jack-detection? */ |
@@ -47,9 +54,9 @@ void snd_hda_jack_tbl_clear(struct hda_codec *codec); | |||
47 | void snd_hda_jack_set_dirty_all(struct hda_codec *codec); | 54 | void snd_hda_jack_set_dirty_all(struct hda_codec *codec); |
48 | 55 | ||
49 | int snd_hda_jack_detect_enable(struct hda_codec *codec, hda_nid_t nid); | 56 | int snd_hda_jack_detect_enable(struct hda_codec *codec, hda_nid_t nid); |
50 | struct hda_jack_tbl * | 57 | struct hda_jack_callback * |
51 | snd_hda_jack_detect_enable_callback(struct hda_codec *codec, hda_nid_t nid, | 58 | snd_hda_jack_detect_enable_callback(struct hda_codec *codec, hda_nid_t nid, |
52 | hda_jack_callback cb); | 59 | hda_jack_callback_fn cb); |
53 | 60 | ||
54 | int snd_hda_jack_set_gating_jack(struct hda_codec *codec, hda_nid_t gated_nid, | 61 | int snd_hda_jack_set_gating_jack(struct hda_codec *codec, hda_nid_t gated_nid, |
55 | hda_nid_t gating_nid); | 62 | hda_nid_t gating_nid); |
diff --git a/sound/pci/hda/patch_cirrus.c b/sound/pci/hda/patch_cirrus.c index 69b0ffc55a51..1589c9bcce3e 100644 --- a/sound/pci/hda/patch_cirrus.c +++ b/sound/pci/hda/patch_cirrus.c | |||
@@ -982,7 +982,7 @@ static void cs4210_pinmux_init(struct hda_codec *codec) | |||
982 | } | 982 | } |
983 | 983 | ||
984 | static void cs4210_spdif_automute(struct hda_codec *codec, | 984 | static void cs4210_spdif_automute(struct hda_codec *codec, |
985 | struct hda_jack_tbl *tbl) | 985 | struct hda_jack_callback *tbl) |
986 | { | 986 | { |
987 | struct cs_spec *spec = codec->spec; | 987 | struct cs_spec *spec = codec->spec; |
988 | bool spdif_present = false; | 988 | bool spdif_present = false; |
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c index e0c5bc1d671b..d5b0582daaf0 100644 --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c | |||
@@ -393,7 +393,8 @@ static void olpc_xo_update_mic_pins(struct hda_codec *codec) | |||
393 | } | 393 | } |
394 | 394 | ||
395 | /* mic_autoswitch hook */ | 395 | /* mic_autoswitch hook */ |
396 | static void olpc_xo_automic(struct hda_codec *codec, struct hda_jack_tbl *jack) | 396 | static void olpc_xo_automic(struct hda_codec *codec, |
397 | struct hda_jack_callback *jack) | ||
397 | { | 398 | { |
398 | struct conexant_spec *spec = codec->spec; | 399 | struct conexant_spec *spec = codec->spec; |
399 | int saved_cached_write = codec->cached_write; | 400 | int saved_cached_write = codec->cached_write; |
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c index 8f94527f1890..39862e98551c 100644 --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c | |||
@@ -1163,17 +1163,23 @@ static void hdmi_setup_audio_infoframe(struct hda_codec *codec, | |||
1163 | 1163 | ||
1164 | static bool hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, int repoll); | 1164 | static bool hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, int repoll); |
1165 | 1165 | ||
1166 | static void jack_callback(struct hda_codec *codec, struct hda_jack_tbl *jack) | 1166 | static void check_presence_and_report(struct hda_codec *codec, hda_nid_t nid) |
1167 | { | 1167 | { |
1168 | struct hdmi_spec *spec = codec->spec; | 1168 | struct hdmi_spec *spec = codec->spec; |
1169 | int pin_idx = pin_nid_to_pin_index(codec, jack->nid); | 1169 | int pin_idx = pin_nid_to_pin_index(codec, nid); |
1170 | |||
1170 | if (pin_idx < 0) | 1171 | if (pin_idx < 0) |
1171 | return; | 1172 | return; |
1172 | |||
1173 | if (hdmi_present_sense(get_pin(spec, pin_idx), 1)) | 1173 | if (hdmi_present_sense(get_pin(spec, pin_idx), 1)) |
1174 | snd_hda_jack_report_sync(codec); | 1174 | snd_hda_jack_report_sync(codec); |
1175 | } | 1175 | } |
1176 | 1176 | ||
1177 | static void jack_callback(struct hda_codec *codec, | ||
1178 | struct hda_jack_callback *jack) | ||
1179 | { | ||
1180 | check_presence_and_report(codec, jack->tbl->nid); | ||
1181 | } | ||
1182 | |||
1177 | static void hdmi_intrinsic_event(struct hda_codec *codec, unsigned int res) | 1183 | static void hdmi_intrinsic_event(struct hda_codec *codec, unsigned int res) |
1178 | { | 1184 | { |
1179 | int tag = res >> AC_UNSOL_RES_TAG_SHIFT; | 1185 | int tag = res >> AC_UNSOL_RES_TAG_SHIFT; |
@@ -1190,7 +1196,7 @@ static void hdmi_intrinsic_event(struct hda_codec *codec, unsigned int res) | |||
1190 | codec->addr, jack->nid, dev_entry, !!(res & AC_UNSOL_RES_IA), | 1196 | codec->addr, jack->nid, dev_entry, !!(res & AC_UNSOL_RES_IA), |
1191 | !!(res & AC_UNSOL_RES_PD), !!(res & AC_UNSOL_RES_ELDV)); | 1197 | !!(res & AC_UNSOL_RES_PD), !!(res & AC_UNSOL_RES_ELDV)); |
1192 | 1198 | ||
1193 | jack_callback(codec, jack); | 1199 | check_presence_and_report(codec, jack->nid); |
1194 | } | 1200 | } |
1195 | 1201 | ||
1196 | static void hdmi_non_intrinsic_event(struct hda_codec *codec, unsigned int res) | 1202 | static void hdmi_non_intrinsic_event(struct hda_codec *codec, unsigned int res) |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index ac00420e59ff..a109fdb085f9 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -264,7 +264,8 @@ static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, | |||
264 | } | 264 | } |
265 | 265 | ||
266 | /* update the master volume per volume-knob's unsol event */ | 266 | /* update the master volume per volume-knob's unsol event */ |
267 | static void alc_update_knob_master(struct hda_codec *codec, struct hda_jack_tbl *jack) | 267 | static void alc_update_knob_master(struct hda_codec *codec, |
268 | struct hda_jack_callback *jack) | ||
268 | { | 269 | { |
269 | unsigned int val; | 270 | unsigned int val; |
270 | struct snd_kcontrol *kctl; | 271 | struct snd_kcontrol *kctl; |
@@ -276,7 +277,7 @@ static void alc_update_knob_master(struct hda_codec *codec, struct hda_jack_tbl | |||
276 | uctl = kzalloc(sizeof(*uctl), GFP_KERNEL); | 277 | uctl = kzalloc(sizeof(*uctl), GFP_KERNEL); |
277 | if (!uctl) | 278 | if (!uctl) |
278 | return; | 279 | return; |
279 | val = snd_hda_codec_read(codec, jack->nid, 0, | 280 | val = snd_hda_codec_read(codec, jack->tbl->nid, 0, |
280 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); | 281 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
281 | val &= HDA_AMP_VOLMASK; | 282 | val &= HDA_AMP_VOLMASK; |
282 | uctl->value.integer.value[0] = val; | 283 | uctl->value.integer.value[0] = val; |
@@ -3272,7 +3273,7 @@ static void alc269_fixup_quanta_mute(struct hda_codec *codec, | |||
3272 | } | 3273 | } |
3273 | 3274 | ||
3274 | static void alc269_x101_hp_automute_hook(struct hda_codec *codec, | 3275 | static void alc269_x101_hp_automute_hook(struct hda_codec *codec, |
3275 | struct hda_jack_tbl *jack) | 3276 | struct hda_jack_callback *jack) |
3276 | { | 3277 | { |
3277 | struct alc_spec *spec = codec->spec; | 3278 | struct alc_spec *spec = codec->spec; |
3278 | int vref; | 3279 | int vref; |
@@ -3926,7 +3927,8 @@ static void alc_update_headset_mode_hook(struct hda_codec *codec, | |||
3926 | alc_update_headset_mode(codec); | 3927 | alc_update_headset_mode(codec); |
3927 | } | 3928 | } |
3928 | 3929 | ||
3929 | static void alc_update_headset_jack_cb(struct hda_codec *codec, struct hda_jack_tbl *jack) | 3930 | static void alc_update_headset_jack_cb(struct hda_codec *codec, |
3931 | struct hda_jack_callback *jack) | ||
3930 | { | 3932 | { |
3931 | struct alc_spec *spec = codec->spec; | 3933 | struct alc_spec *spec = codec->spec; |
3932 | spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN; | 3934 | spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN; |
@@ -4166,7 +4168,7 @@ static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec, | |||
4166 | } | 4168 | } |
4167 | 4169 | ||
4168 | static void alc283_hp_automute_hook(struct hda_codec *codec, | 4170 | static void alc283_hp_automute_hook(struct hda_codec *codec, |
4169 | struct hda_jack_tbl *jack) | 4171 | struct hda_jack_callback *jack) |
4170 | { | 4172 | { |
4171 | struct alc_spec *spec = codec->spec; | 4173 | struct alc_spec *spec = codec->spec; |
4172 | int vref; | 4174 | int vref; |
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 4b338beb9449..3193529607f2 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
@@ -481,7 +481,7 @@ static void stac_toggle_power_map(struct hda_codec *codec, hda_nid_t nid, | |||
481 | 481 | ||
482 | /* update power bit per jack plug/unplug */ | 482 | /* update power bit per jack plug/unplug */ |
483 | static void jack_update_power(struct hda_codec *codec, | 483 | static void jack_update_power(struct hda_codec *codec, |
484 | struct hda_jack_tbl *jack) | 484 | struct hda_jack_callback *jack) |
485 | { | 485 | { |
486 | struct sigmatel_spec *spec = codec->spec; | 486 | struct sigmatel_spec *spec = codec->spec; |
487 | int i; | 487 | int i; |
@@ -489,9 +489,9 @@ static void jack_update_power(struct hda_codec *codec, | |||
489 | if (!spec->num_pwrs) | 489 | if (!spec->num_pwrs) |
490 | return; | 490 | return; |
491 | 491 | ||
492 | if (jack && jack->nid) { | 492 | if (jack && jack->tbl->nid) { |
493 | stac_toggle_power_map(codec, jack->nid, | 493 | stac_toggle_power_map(codec, jack->tbl->nid, |
494 | snd_hda_jack_detect(codec, jack->nid), | 494 | snd_hda_jack_detect(codec, jack->tbl->nid), |
495 | true); | 495 | true); |
496 | return; | 496 | return; |
497 | } | 497 | } |
@@ -499,8 +499,7 @@ static void jack_update_power(struct hda_codec *codec, | |||
499 | /* update all jacks */ | 499 | /* update all jacks */ |
500 | for (i = 0; i < spec->num_pwrs; i++) { | 500 | for (i = 0; i < spec->num_pwrs; i++) { |
501 | hda_nid_t nid = spec->pwr_nids[i]; | 501 | hda_nid_t nid = spec->pwr_nids[i]; |
502 | jack = snd_hda_jack_tbl_get(codec, nid); | 502 | if (!snd_hda_jack_tbl_get(codec, nid)) |
503 | if (!jack) | ||
504 | continue; | 503 | continue; |
505 | stac_toggle_power_map(codec, nid, | 504 | stac_toggle_power_map(codec, nid, |
506 | snd_hda_jack_detect(codec, nid), | 505 | snd_hda_jack_detect(codec, nid), |
@@ -512,27 +511,28 @@ static void jack_update_power(struct hda_codec *codec, | |||
512 | } | 511 | } |
513 | 512 | ||
514 | static void stac_hp_automute(struct hda_codec *codec, | 513 | static void stac_hp_automute(struct hda_codec *codec, |
515 | struct hda_jack_tbl *jack) | 514 | struct hda_jack_callback *jack) |
516 | { | 515 | { |
517 | snd_hda_gen_hp_automute(codec, jack); | 516 | snd_hda_gen_hp_automute(codec, jack); |
518 | jack_update_power(codec, jack); | 517 | jack_update_power(codec, jack); |
519 | } | 518 | } |
520 | 519 | ||
521 | static void stac_line_automute(struct hda_codec *codec, | 520 | static void stac_line_automute(struct hda_codec *codec, |
522 | struct hda_jack_tbl *jack) | 521 | struct hda_jack_callback *jack) |
523 | { | 522 | { |
524 | snd_hda_gen_line_automute(codec, jack); | 523 | snd_hda_gen_line_automute(codec, jack); |
525 | jack_update_power(codec, jack); | 524 | jack_update_power(codec, jack); |
526 | } | 525 | } |
527 | 526 | ||
528 | static void stac_mic_autoswitch(struct hda_codec *codec, | 527 | static void stac_mic_autoswitch(struct hda_codec *codec, |
529 | struct hda_jack_tbl *jack) | 528 | struct hda_jack_callback *jack) |
530 | { | 529 | { |
531 | snd_hda_gen_mic_autoswitch(codec, jack); | 530 | snd_hda_gen_mic_autoswitch(codec, jack); |
532 | jack_update_power(codec, jack); | 531 | jack_update_power(codec, jack); |
533 | } | 532 | } |
534 | 533 | ||
535 | static void stac_vref_event(struct hda_codec *codec, struct hda_jack_tbl *event) | 534 | static void stac_vref_event(struct hda_codec *codec, |
535 | struct hda_jack_callback *event) | ||
536 | { | 536 | { |
537 | unsigned int data; | 537 | unsigned int data; |
538 | 538 | ||
@@ -3011,7 +3011,7 @@ static void stac92hd71bxx_fixup_hp_m4(struct hda_codec *codec, | |||
3011 | const struct hda_fixup *fix, int action) | 3011 | const struct hda_fixup *fix, int action) |
3012 | { | 3012 | { |
3013 | struct sigmatel_spec *spec = codec->spec; | 3013 | struct sigmatel_spec *spec = codec->spec; |
3014 | struct hda_jack_tbl *jack; | 3014 | struct hda_jack_callback *jack; |
3015 | 3015 | ||
3016 | if (action != HDA_FIXUP_ACT_PRE_PROBE) | 3016 | if (action != HDA_FIXUP_ACT_PRE_PROBE) |
3017 | return; | 3017 | return; |
@@ -4033,7 +4033,7 @@ static void stac9205_fixup_dell_m43(struct hda_codec *codec, | |||
4033 | const struct hda_fixup *fix, int action) | 4033 | const struct hda_fixup *fix, int action) |
4034 | { | 4034 | { |
4035 | struct sigmatel_spec *spec = codec->spec; | 4035 | struct sigmatel_spec *spec = codec->spec; |
4036 | struct hda_jack_tbl *jack; | 4036 | struct hda_jack_callback *jack; |
4037 | 4037 | ||
4038 | if (action == HDA_FIXUP_ACT_PRE_PROBE) { | 4038 | if (action == HDA_FIXUP_ACT_PRE_PROBE) { |
4039 | snd_hda_apply_pincfgs(codec, dell_9205_m43_pin_configs); | 4039 | snd_hda_apply_pincfgs(codec, dell_9205_m43_pin_configs); |
diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c index 2a8be5a5da15..8d234ab9f06b 100644 --- a/sound/pci/hda/patch_via.c +++ b/sound/pci/hda/patch_via.c | |||
@@ -118,7 +118,7 @@ static void via_playback_pcm_hook(struct hda_pcm_stream *hinfo, | |||
118 | struct hda_codec *codec, | 118 | struct hda_codec *codec, |
119 | struct snd_pcm_substream *substream, | 119 | struct snd_pcm_substream *substream, |
120 | int action); | 120 | int action); |
121 | static void via_hp_automute(struct hda_codec *codec, struct hda_jack_tbl *tbl); | 121 | static void via_hp_automute(struct hda_codec *codec, struct hda_jack_callback *tbl); |
122 | 122 | ||
123 | static struct via_spec *via_new_spec(struct hda_codec *codec) | 123 | static struct via_spec *via_new_spec(struct hda_codec *codec) |
124 | { | 124 | { |
@@ -575,19 +575,22 @@ static const struct snd_kcontrol_new vt1708_jack_detect_ctl[] = { | |||
575 | {} /* terminator */ | 575 | {} /* terminator */ |
576 | }; | 576 | }; |
577 | 577 | ||
578 | static void via_hp_automute(struct hda_codec *codec, struct hda_jack_tbl *tbl) | 578 | static void via_hp_automute(struct hda_codec *codec, |
579 | struct hda_jack_callback *tbl) | ||
579 | { | 580 | { |
580 | set_widgets_power_state(codec); | 581 | set_widgets_power_state(codec); |
581 | snd_hda_gen_hp_automute(codec, tbl); | 582 | snd_hda_gen_hp_automute(codec, tbl); |
582 | } | 583 | } |
583 | 584 | ||
584 | static void via_line_automute(struct hda_codec *codec, struct hda_jack_tbl *tbl) | 585 | static void via_line_automute(struct hda_codec *codec, |
586 | struct hda_jack_callback *tbl) | ||
585 | { | 587 | { |
586 | set_widgets_power_state(codec); | 588 | set_widgets_power_state(codec); |
587 | snd_hda_gen_line_automute(codec, tbl); | 589 | snd_hda_gen_line_automute(codec, tbl); |
588 | } | 590 | } |
589 | 591 | ||
590 | static void via_jack_powerstate_event(struct hda_codec *codec, struct hda_jack_tbl *tbl) | 592 | static void via_jack_powerstate_event(struct hda_codec *codec, |
593 | struct hda_jack_callback *tbl) | ||
591 | { | 594 | { |
592 | set_widgets_power_state(codec); | 595 | set_widgets_power_state(codec); |
593 | } | 596 | } |