Takashi Iwai | 1835a0f | 2011-10-27 22:12:46 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Jack-detection handling for HD-audio |
| 3 | * |
| 4 | * Copyright (c) 2011 Takashi Iwai <tiwai@suse.de> |
| 5 | * |
| 6 | * This driver is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; either version 2 of the License, or |
| 9 | * (at your option) any later version. |
| 10 | */ |
| 11 | |
| 12 | #include <linux/init.h> |
| 13 | #include <linux/slab.h> |
Takashi Iwai | bf815bf | 2011-11-16 14:28:33 +0100 | [diff] [blame] | 14 | #include <linux/export.h> |
Takashi Iwai | 1835a0f | 2011-10-27 22:12:46 +0200 | [diff] [blame] | 15 | #include <sound/core.h> |
Takashi Iwai | 01a61e1 | 2011-10-28 00:03:22 +0200 | [diff] [blame] | 16 | #include <sound/control.h> |
Takashi Iwai | aad37db | 2011-11-02 08:54:51 +0100 | [diff] [blame] | 17 | #include <sound/jack.h> |
Takashi Iwai | 1835a0f | 2011-10-27 22:12:46 +0200 | [diff] [blame] | 18 | #include "hda_codec.h" |
| 19 | #include "hda_local.h" |
Takashi Iwai | 128bc4b | 2012-05-07 17:42:31 +0200 | [diff] [blame] | 20 | #include "hda_auto_parser.h" |
Takashi Iwai | 1835a0f | 2011-10-27 22:12:46 +0200 | [diff] [blame] | 21 | #include "hda_jack.h" |
| 22 | |
Takashi Iwai | a9c7417 | 2012-02-13 11:41:42 +0100 | [diff] [blame] | 23 | bool is_jack_detectable(struct hda_codec *codec, hda_nid_t nid) |
| 24 | { |
Takashi Iwai | 71b1e9e4 | 2012-02-13 11:55:02 +0100 | [diff] [blame] | 25 | if (codec->no_jack_detect) |
| 26 | return false; |
Takashi Iwai | a9c7417 | 2012-02-13 11:41:42 +0100 | [diff] [blame] | 27 | if (!(snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_PRES_DETECT)) |
| 28 | return false; |
David Henningsson | 5fe8e1e | 2012-09-07 07:25:44 +0200 | [diff] [blame] | 29 | if (get_defcfg_misc(snd_hda_codec_get_pincfg(codec, nid)) & |
| 30 | AC_DEFCFG_MISC_NO_PRESENCE) |
Takashi Iwai | a9c7417 | 2012-02-13 11:41:42 +0100 | [diff] [blame] | 31 | return false; |
Takashi Iwai | 76a19c6 | 2013-01-07 12:11:33 +0100 | [diff] [blame] | 32 | if (!(get_wcaps(codec, nid) & AC_WCAP_UNSOL_CAP) && |
| 33 | !codec->jackpoll_interval) |
Takashi Iwai | a9c7417 | 2012-02-13 11:41:42 +0100 | [diff] [blame] | 34 | return false; |
| 35 | return true; |
| 36 | } |
Takashi Iwai | 2698ea9 | 2013-12-18 07:45:52 +0100 | [diff] [blame] | 37 | EXPORT_SYMBOL_GPL(is_jack_detectable); |
Takashi Iwai | a9c7417 | 2012-02-13 11:41:42 +0100 | [diff] [blame] | 38 | |
Takashi Iwai | 1835a0f | 2011-10-27 22:12:46 +0200 | [diff] [blame] | 39 | /* execute pin sense measurement */ |
| 40 | static u32 read_pin_sense(struct hda_codec *codec, hda_nid_t nid) |
| 41 | { |
| 42 | u32 pincap; |
Takashi Iwai | 9cc159c | 2012-12-21 15:31:41 +0100 | [diff] [blame] | 43 | u32 val; |
Takashi Iwai | 1835a0f | 2011-10-27 22:12:46 +0200 | [diff] [blame] | 44 | |
| 45 | if (!codec->no_trigger_sense) { |
| 46 | pincap = snd_hda_query_pin_caps(codec, nid); |
| 47 | if (pincap & AC_PINCAP_TRIG_REQ) /* need trigger? */ |
| 48 | snd_hda_codec_read(codec, nid, 0, |
| 49 | AC_VERB_SET_PIN_SENSE, 0); |
| 50 | } |
Takashi Iwai | 9cc159c | 2012-12-21 15:31:41 +0100 | [diff] [blame] | 51 | val = snd_hda_codec_read(codec, nid, 0, |
Takashi Iwai | 1835a0f | 2011-10-27 22:12:46 +0200 | [diff] [blame] | 52 | AC_VERB_GET_PIN_SENSE, 0); |
Takashi Iwai | 9cc159c | 2012-12-21 15:31:41 +0100 | [diff] [blame] | 53 | if (codec->inv_jack_detect) |
| 54 | val ^= AC_PINSENSE_PRESENCE; |
| 55 | return val; |
Takashi Iwai | 1835a0f | 2011-10-27 22:12:46 +0200 | [diff] [blame] | 56 | } |
| 57 | |
| 58 | /** |
| 59 | * snd_hda_jack_tbl_get - query the jack-table entry for the given NID |
Takashi Iwai | a11e9b1 | 2014-10-29 15:06:01 +0100 | [diff] [blame^] | 60 | * @codec: the HDA codec |
| 61 | * @nid: pin NID to refer to |
Takashi Iwai | 1835a0f | 2011-10-27 22:12:46 +0200 | [diff] [blame] | 62 | */ |
| 63 | struct hda_jack_tbl * |
| 64 | snd_hda_jack_tbl_get(struct hda_codec *codec, hda_nid_t nid) |
| 65 | { |
| 66 | struct hda_jack_tbl *jack = codec->jacktbl.list; |
| 67 | int i; |
| 68 | |
| 69 | if (!nid || !jack) |
| 70 | return NULL; |
| 71 | for (i = 0; i < codec->jacktbl.used; i++, jack++) |
| 72 | if (jack->nid == nid) |
| 73 | return jack; |
| 74 | return NULL; |
| 75 | } |
Takashi Iwai | 2698ea9 | 2013-12-18 07:45:52 +0100 | [diff] [blame] | 76 | EXPORT_SYMBOL_GPL(snd_hda_jack_tbl_get); |
Takashi Iwai | 1835a0f | 2011-10-27 22:12:46 +0200 | [diff] [blame] | 77 | |
| 78 | /** |
Takashi Iwai | 3a93897 | 2011-10-28 01:16:55 +0200 | [diff] [blame] | 79 | * snd_hda_jack_tbl_get_from_tag - query the jack-table entry for the given tag |
Takashi Iwai | a11e9b1 | 2014-10-29 15:06:01 +0100 | [diff] [blame^] | 80 | * @codec: the HDA codec |
| 81 | * @tag: tag value to refer to |
Takashi Iwai | 3a93897 | 2011-10-28 01:16:55 +0200 | [diff] [blame] | 82 | */ |
| 83 | struct hda_jack_tbl * |
| 84 | snd_hda_jack_tbl_get_from_tag(struct hda_codec *codec, unsigned char tag) |
| 85 | { |
| 86 | struct hda_jack_tbl *jack = codec->jacktbl.list; |
| 87 | int i; |
| 88 | |
| 89 | if (!tag || !jack) |
| 90 | return NULL; |
| 91 | for (i = 0; i < codec->jacktbl.used; i++, jack++) |
| 92 | if (jack->tag == tag) |
| 93 | return jack; |
| 94 | return NULL; |
| 95 | } |
Takashi Iwai | 2698ea9 | 2013-12-18 07:45:52 +0100 | [diff] [blame] | 96 | EXPORT_SYMBOL_GPL(snd_hda_jack_tbl_get_from_tag); |
Takashi Iwai | 3a93897 | 2011-10-28 01:16:55 +0200 | [diff] [blame] | 97 | |
| 98 | /** |
Takashi Iwai | 1835a0f | 2011-10-27 22:12:46 +0200 | [diff] [blame] | 99 | * snd_hda_jack_tbl_new - create a jack-table entry for the given NID |
Takashi Iwai | a11e9b1 | 2014-10-29 15:06:01 +0100 | [diff] [blame^] | 100 | * @codec: the HDA codec |
| 101 | * @nid: pin NID to assign |
Takashi Iwai | 1835a0f | 2011-10-27 22:12:46 +0200 | [diff] [blame] | 102 | */ |
Takashi Iwai | 81965f1 | 2014-09-11 14:22:03 +0200 | [diff] [blame] | 103 | static struct hda_jack_tbl * |
Takashi Iwai | 1835a0f | 2011-10-27 22:12:46 +0200 | [diff] [blame] | 104 | snd_hda_jack_tbl_new(struct hda_codec *codec, hda_nid_t nid) |
| 105 | { |
| 106 | struct hda_jack_tbl *jack = snd_hda_jack_tbl_get(codec, nid); |
| 107 | if (jack) |
| 108 | return jack; |
Takashi Iwai | 1835a0f | 2011-10-27 22:12:46 +0200 | [diff] [blame] | 109 | jack = snd_array_new(&codec->jacktbl); |
| 110 | if (!jack) |
| 111 | return NULL; |
| 112 | jack->nid = nid; |
| 113 | jack->jack_dirty = 1; |
Takashi Iwai | 3a93897 | 2011-10-28 01:16:55 +0200 | [diff] [blame] | 114 | jack->tag = codec->jacktbl.used; |
Takashi Iwai | 1835a0f | 2011-10-27 22:12:46 +0200 | [diff] [blame] | 115 | return jack; |
| 116 | } |
| 117 | |
| 118 | void snd_hda_jack_tbl_clear(struct hda_codec *codec) |
| 119 | { |
Takashi Iwai | 1a4f69d | 2014-09-11 15:22:46 +0200 | [diff] [blame] | 120 | struct hda_jack_tbl *jack = codec->jacktbl.list; |
| 121 | int i; |
| 122 | |
| 123 | for (i = 0; i < codec->jacktbl.used; i++, jack++) { |
| 124 | struct hda_jack_callback *cb, *next; |
Takashi Iwai | 31ef225 | 2011-12-01 17:41:36 +0100 | [diff] [blame] | 125 | #ifdef CONFIG_SND_HDA_INPUT_JACK |
Takashi Iwai | 1a4f69d | 2014-09-11 15:22:46 +0200 | [diff] [blame] | 126 | /* free jack instances manually when clearing/reconfiguring */ |
| 127 | if (!codec->bus->shutdown && jack->jack) |
| 128 | snd_device_free(codec->bus->card, jack->jack); |
| 129 | #endif |
| 130 | for (cb = jack->callback; cb; cb = next) { |
| 131 | next = cb->next; |
| 132 | kfree(cb); |
Takashi Iwai | 31ef225 | 2011-12-01 17:41:36 +0100 | [diff] [blame] | 133 | } |
| 134 | } |
Takashi Iwai | 1835a0f | 2011-10-27 22:12:46 +0200 | [diff] [blame] | 135 | snd_array_free(&codec->jacktbl); |
| 136 | } |
| 137 | |
Dylan Reid | 0619ba8 | 2012-11-19 19:48:07 +0100 | [diff] [blame] | 138 | #define get_jack_plug_state(sense) !!(sense & AC_PINSENSE_PRESENCE) |
| 139 | |
Takashi Iwai | 1835a0f | 2011-10-27 22:12:46 +0200 | [diff] [blame] | 140 | /* update the cached value and notification flag if needed */ |
| 141 | static void jack_detect_update(struct hda_codec *codec, |
| 142 | struct hda_jack_tbl *jack) |
| 143 | { |
David Henningsson | 80c8bfb | 2012-06-04 09:33:51 +0200 | [diff] [blame] | 144 | if (!jack->jack_dirty) |
| 145 | return; |
| 146 | |
| 147 | if (jack->phantom_jack) |
| 148 | jack->pin_sense = AC_PINSENSE_PRESENCE; |
| 149 | else |
Takashi Iwai | 35be544 | 2011-11-02 08:36:06 +0100 | [diff] [blame] | 150 | jack->pin_sense = read_pin_sense(codec, jack->nid); |
David Henningsson | 80c8bfb | 2012-06-04 09:33:51 +0200 | [diff] [blame] | 151 | |
Dylan Reid | 0619ba8 | 2012-11-19 19:48:07 +0100 | [diff] [blame] | 152 | /* A gating jack indicates the jack is invalid if gating is unplugged */ |
| 153 | if (jack->gating_jack && !snd_hda_jack_detect(codec, jack->gating_jack)) |
| 154 | jack->pin_sense &= ~AC_PINSENSE_PRESENCE; |
| 155 | |
David Henningsson | 80c8bfb | 2012-06-04 09:33:51 +0200 | [diff] [blame] | 156 | jack->jack_dirty = 0; |
Dylan Reid | 0619ba8 | 2012-11-19 19:48:07 +0100 | [diff] [blame] | 157 | |
| 158 | /* If a jack is gated by this one update it. */ |
| 159 | if (jack->gated_jack) { |
| 160 | struct hda_jack_tbl *gated = |
| 161 | snd_hda_jack_tbl_get(codec, jack->gated_jack); |
| 162 | if (gated) { |
| 163 | gated->jack_dirty = 1; |
| 164 | jack_detect_update(codec, gated); |
| 165 | } |
| 166 | } |
Takashi Iwai | 1835a0f | 2011-10-27 22:12:46 +0200 | [diff] [blame] | 167 | } |
| 168 | |
| 169 | /** |
| 170 | * snd_hda_set_dirty_all - Mark all the cached as dirty |
Takashi Iwai | a11e9b1 | 2014-10-29 15:06:01 +0100 | [diff] [blame^] | 171 | * @codec: the HDA codec |
Takashi Iwai | 1835a0f | 2011-10-27 22:12:46 +0200 | [diff] [blame] | 172 | * |
| 173 | * This function sets the dirty flag to all entries of jack table. |
| 174 | * It's called from the resume path in hda_codec.c. |
| 175 | */ |
| 176 | void snd_hda_jack_set_dirty_all(struct hda_codec *codec) |
| 177 | { |
| 178 | struct hda_jack_tbl *jack = codec->jacktbl.list; |
| 179 | int i; |
| 180 | |
| 181 | for (i = 0; i < codec->jacktbl.used; i++, jack++) |
| 182 | if (jack->nid) |
| 183 | jack->jack_dirty = 1; |
| 184 | } |
Takashi Iwai | 2698ea9 | 2013-12-18 07:45:52 +0100 | [diff] [blame] | 185 | EXPORT_SYMBOL_GPL(snd_hda_jack_set_dirty_all); |
Takashi Iwai | 1835a0f | 2011-10-27 22:12:46 +0200 | [diff] [blame] | 186 | |
| 187 | /** |
| 188 | * snd_hda_pin_sense - execute pin sense measurement |
| 189 | * @codec: the CODEC to sense |
| 190 | * @nid: the pin NID to sense |
| 191 | * |
| 192 | * Execute necessary pin sense measurement and return its Presence Detect, |
| 193 | * Impedance, ELD Valid etc. status bits. |
| 194 | */ |
| 195 | u32 snd_hda_pin_sense(struct hda_codec *codec, hda_nid_t nid) |
| 196 | { |
| 197 | struct hda_jack_tbl *jack = snd_hda_jack_tbl_get(codec, nid); |
| 198 | if (jack) { |
| 199 | jack_detect_update(codec, jack); |
| 200 | return jack->pin_sense; |
| 201 | } |
| 202 | return read_pin_sense(codec, nid); |
| 203 | } |
Takashi Iwai | 2698ea9 | 2013-12-18 07:45:52 +0100 | [diff] [blame] | 204 | EXPORT_SYMBOL_GPL(snd_hda_pin_sense); |
Takashi Iwai | 1835a0f | 2011-10-27 22:12:46 +0200 | [diff] [blame] | 205 | |
| 206 | /** |
Takashi Iwai | 60ea8ca | 2013-07-19 16:59:46 +0200 | [diff] [blame] | 207 | * snd_hda_jack_detect_state - query pin Presence Detect status |
Takashi Iwai | 1835a0f | 2011-10-27 22:12:46 +0200 | [diff] [blame] | 208 | * @codec: the CODEC to sense |
| 209 | * @nid: the pin NID to sense |
| 210 | * |
Takashi Iwai | 60ea8ca | 2013-07-19 16:59:46 +0200 | [diff] [blame] | 211 | * Query and return the pin's Presence Detect status, as either |
| 212 | * HDA_JACK_NOT_PRESENT, HDA_JACK_PRESENT or HDA_JACK_PHANTOM. |
Takashi Iwai | 1835a0f | 2011-10-27 22:12:46 +0200 | [diff] [blame] | 213 | */ |
Takashi Iwai | 60ea8ca | 2013-07-19 16:59:46 +0200 | [diff] [blame] | 214 | int snd_hda_jack_detect_state(struct hda_codec *codec, hda_nid_t nid) |
Takashi Iwai | 1835a0f | 2011-10-27 22:12:46 +0200 | [diff] [blame] | 215 | { |
Takashi Iwai | 60ea8ca | 2013-07-19 16:59:46 +0200 | [diff] [blame] | 216 | struct hda_jack_tbl *jack = snd_hda_jack_tbl_get(codec, nid); |
| 217 | if (jack && jack->phantom_jack) |
| 218 | return HDA_JACK_PHANTOM; |
| 219 | else if (snd_hda_pin_sense(codec, nid) & AC_PINSENSE_PRESENCE) |
| 220 | return HDA_JACK_PRESENT; |
| 221 | else |
| 222 | return HDA_JACK_NOT_PRESENT; |
Takashi Iwai | 1835a0f | 2011-10-27 22:12:46 +0200 | [diff] [blame] | 223 | } |
Takashi Iwai | 2698ea9 | 2013-12-18 07:45:52 +0100 | [diff] [blame] | 224 | EXPORT_SYMBOL_GPL(snd_hda_jack_detect_state); |
Takashi Iwai | 1835a0f | 2011-10-27 22:12:46 +0200 | [diff] [blame] | 225 | |
| 226 | /** |
| 227 | * snd_hda_jack_detect_enable - enable the jack-detection |
Takashi Iwai | a11e9b1 | 2014-10-29 15:06:01 +0100 | [diff] [blame^] | 228 | * @codec: the HDA codec |
| 229 | * @nid: pin NID to enable |
| 230 | * @func: callback function to register |
Takashi Iwai | bda17b82 | 2014-09-11 14:39:09 +0200 | [diff] [blame] | 231 | * |
| 232 | * In the case of error, the return value will be a pointer embedded with |
| 233 | * errno. Check and handle the return value appropriately with standard |
| 234 | * macros such as @IS_ERR() and @PTR_ERR(). |
Takashi Iwai | 1835a0f | 2011-10-27 22:12:46 +0200 | [diff] [blame] | 235 | */ |
Takashi Iwai | 1a4f69d | 2014-09-11 15:22:46 +0200 | [diff] [blame] | 236 | struct hda_jack_callback * |
Takashi Iwai | bda17b82 | 2014-09-11 14:39:09 +0200 | [diff] [blame] | 237 | snd_hda_jack_detect_enable_callback(struct hda_codec *codec, hda_nid_t nid, |
Takashi Iwai | 1a4f69d | 2014-09-11 15:22:46 +0200 | [diff] [blame] | 238 | hda_jack_callback_fn func) |
Takashi Iwai | 1835a0f | 2011-10-27 22:12:46 +0200 | [diff] [blame] | 239 | { |
Takashi Iwai | 1a4f69d | 2014-09-11 15:22:46 +0200 | [diff] [blame] | 240 | struct hda_jack_tbl *jack; |
| 241 | struct hda_jack_callback *callback = NULL; |
Takashi Iwai | bda17b82 | 2014-09-11 14:39:09 +0200 | [diff] [blame] | 242 | int err; |
| 243 | |
Takashi Iwai | 1a4f69d | 2014-09-11 15:22:46 +0200 | [diff] [blame] | 244 | jack = snd_hda_jack_tbl_new(codec, nid); |
Takashi Iwai | 1835a0f | 2011-10-27 22:12:46 +0200 | [diff] [blame] | 245 | if (!jack) |
Takashi Iwai | bda17b82 | 2014-09-11 14:39:09 +0200 | [diff] [blame] | 246 | return ERR_PTR(-ENOMEM); |
Takashi Iwai | 1a4f69d | 2014-09-11 15:22:46 +0200 | [diff] [blame] | 247 | if (func) { |
| 248 | callback = kzalloc(sizeof(*callback), GFP_KERNEL); |
| 249 | if (!callback) |
| 250 | return ERR_PTR(-ENOMEM); |
| 251 | callback->func = func; |
| 252 | callback->tbl = jack; |
| 253 | callback->next = jack->callback; |
| 254 | jack->callback = callback; |
| 255 | } |
| 256 | |
Takashi Iwai | 3a93897 | 2011-10-28 01:16:55 +0200 | [diff] [blame] | 257 | if (jack->jack_detect) |
Takashi Iwai | 1a4f69d | 2014-09-11 15:22:46 +0200 | [diff] [blame] | 258 | return callback; /* already registered */ |
Takashi Iwai | 3a93897 | 2011-10-28 01:16:55 +0200 | [diff] [blame] | 259 | jack->jack_detect = 1; |
David Henningsson | 34a9318 | 2012-10-17 14:45:05 +0200 | [diff] [blame] | 260 | if (codec->jackpoll_interval > 0) |
Takashi Iwai | 1a4f69d | 2014-09-11 15:22:46 +0200 | [diff] [blame] | 261 | return callback; /* No unsol if we're polling instead */ |
Takashi Iwai | bda17b82 | 2014-09-11 14:39:09 +0200 | [diff] [blame] | 262 | err = snd_hda_codec_write_cache(codec, nid, 0, |
Takashi Iwai | 1835a0f | 2011-10-27 22:12:46 +0200 | [diff] [blame] | 263 | AC_VERB_SET_UNSOLICITED_ENABLE, |
Takashi Iwai | 3a93897 | 2011-10-28 01:16:55 +0200 | [diff] [blame] | 264 | AC_USRSP_EN | jack->tag); |
Takashi Iwai | bda17b82 | 2014-09-11 14:39:09 +0200 | [diff] [blame] | 265 | if (err < 0) |
| 266 | return ERR_PTR(err); |
Takashi Iwai | 1a4f69d | 2014-09-11 15:22:46 +0200 | [diff] [blame] | 267 | return callback; |
Takashi Iwai | 1835a0f | 2011-10-27 22:12:46 +0200 | [diff] [blame] | 268 | } |
Takashi Iwai | 2698ea9 | 2013-12-18 07:45:52 +0100 | [diff] [blame] | 269 | EXPORT_SYMBOL_GPL(snd_hda_jack_detect_enable_callback); |
David Henningsson | 954df2a | 2012-09-25 11:30:59 +0200 | [diff] [blame] | 270 | |
Takashi Iwai | 62f949b | 2014-09-11 14:06:53 +0200 | [diff] [blame] | 271 | int snd_hda_jack_detect_enable(struct hda_codec *codec, hda_nid_t nid) |
David Henningsson | 954df2a | 2012-09-25 11:30:59 +0200 | [diff] [blame] | 272 | { |
Takashi Iwai | bda17b82 | 2014-09-11 14:39:09 +0200 | [diff] [blame] | 273 | return PTR_ERR_OR_ZERO(snd_hda_jack_detect_enable_callback(codec, nid, NULL)); |
David Henningsson | 954df2a | 2012-09-25 11:30:59 +0200 | [diff] [blame] | 274 | } |
Takashi Iwai | 2698ea9 | 2013-12-18 07:45:52 +0100 | [diff] [blame] | 275 | EXPORT_SYMBOL_GPL(snd_hda_jack_detect_enable); |
Takashi Iwai | 01a61e1 | 2011-10-28 00:03:22 +0200 | [diff] [blame] | 276 | |
Takashi Iwai | 01a61e1 | 2011-10-28 00:03:22 +0200 | [diff] [blame] | 277 | /** |
Dylan Reid | 0619ba8 | 2012-11-19 19:48:07 +0100 | [diff] [blame] | 278 | * snd_hda_jack_set_gating_jack - Set gating jack. |
Takashi Iwai | a11e9b1 | 2014-10-29 15:06:01 +0100 | [diff] [blame^] | 279 | * @codec: the HDA codec |
| 280 | * @gated_nid: gated pin NID |
| 281 | * @gating_nid: gating pin NID |
Dylan Reid | 0619ba8 | 2012-11-19 19:48:07 +0100 | [diff] [blame] | 282 | * |
| 283 | * Indicates the gated jack is only valid when the gating jack is plugged. |
| 284 | */ |
| 285 | int snd_hda_jack_set_gating_jack(struct hda_codec *codec, hda_nid_t gated_nid, |
| 286 | hda_nid_t gating_nid) |
| 287 | { |
Chih-Chung Chang | bde7bc6 | 2013-08-05 16:38:42 +0800 | [diff] [blame] | 288 | struct hda_jack_tbl *gated = snd_hda_jack_tbl_new(codec, gated_nid); |
| 289 | struct hda_jack_tbl *gating = snd_hda_jack_tbl_new(codec, gating_nid); |
Dylan Reid | 0619ba8 | 2012-11-19 19:48:07 +0100 | [diff] [blame] | 290 | |
| 291 | if (!gated || !gating) |
| 292 | return -EINVAL; |
| 293 | |
| 294 | gated->gating_jack = gating_nid; |
| 295 | gating->gated_jack = gated_nid; |
| 296 | |
| 297 | return 0; |
| 298 | } |
Takashi Iwai | 2698ea9 | 2013-12-18 07:45:52 +0100 | [diff] [blame] | 299 | EXPORT_SYMBOL_GPL(snd_hda_jack_set_gating_jack); |
Dylan Reid | 0619ba8 | 2012-11-19 19:48:07 +0100 | [diff] [blame] | 300 | |
| 301 | /** |
Takashi Iwai | 01a61e1 | 2011-10-28 00:03:22 +0200 | [diff] [blame] | 302 | * snd_hda_jack_report_sync - sync the states of all jacks and report if changed |
Takashi Iwai | a11e9b1 | 2014-10-29 15:06:01 +0100 | [diff] [blame^] | 303 | * @codec: the HDA codec |
Takashi Iwai | 01a61e1 | 2011-10-28 00:03:22 +0200 | [diff] [blame] | 304 | */ |
| 305 | void snd_hda_jack_report_sync(struct hda_codec *codec) |
| 306 | { |
Dylan Reid | 0619ba8 | 2012-11-19 19:48:07 +0100 | [diff] [blame] | 307 | struct hda_jack_tbl *jack; |
Takashi Iwai | 35be544 | 2011-11-02 08:36:06 +0100 | [diff] [blame] | 308 | int i, state; |
Takashi Iwai | 01a61e1 | 2011-10-28 00:03:22 +0200 | [diff] [blame] | 309 | |
Dylan Reid | 0619ba8 | 2012-11-19 19:48:07 +0100 | [diff] [blame] | 310 | /* update all jacks at first */ |
| 311 | jack = codec->jacktbl.list; |
| 312 | for (i = 0; i < codec->jacktbl.used; i++, jack++) |
| 313 | if (jack->nid) |
| 314 | jack_detect_update(codec, jack); |
| 315 | |
| 316 | /* report the updated jacks; it's done after updating all jacks |
| 317 | * to make sure that all gating jacks properly have been set |
| 318 | */ |
| 319 | jack = codec->jacktbl.list; |
Takashi Iwai | 01a61e1 | 2011-10-28 00:03:22 +0200 | [diff] [blame] | 320 | for (i = 0; i < codec->jacktbl.used; i++, jack++) |
| 321 | if (jack->nid) { |
David Henningsson | 0f56895 | 2013-11-07 13:38:24 +0100 | [diff] [blame] | 322 | if (!jack->kctl || jack->block_report) |
Takashi Iwai | cfc7c9d | 2011-11-11 17:53:03 +0100 | [diff] [blame] | 323 | continue; |
Takashi Iwai | 35be544 | 2011-11-02 08:36:06 +0100 | [diff] [blame] | 324 | state = get_jack_plug_state(jack->pin_sense); |
Takashi Iwai | aad37db | 2011-11-02 08:54:51 +0100 | [diff] [blame] | 325 | snd_kctl_jack_report(codec->bus->card, jack->kctl, state); |
Takashi Iwai | 31ef225 | 2011-12-01 17:41:36 +0100 | [diff] [blame] | 326 | #ifdef CONFIG_SND_HDA_INPUT_JACK |
| 327 | if (jack->jack) |
| 328 | snd_jack_report(jack->jack, |
| 329 | state ? jack->type : 0); |
| 330 | #endif |
Takashi Iwai | 01a61e1 | 2011-10-28 00:03:22 +0200 | [diff] [blame] | 331 | } |
| 332 | } |
Takashi Iwai | 2698ea9 | 2013-12-18 07:45:52 +0100 | [diff] [blame] | 333 | EXPORT_SYMBOL_GPL(snd_hda_jack_report_sync); |
Takashi Iwai | 01a61e1 | 2011-10-28 00:03:22 +0200 | [diff] [blame] | 334 | |
Takashi Iwai | 31ef225 | 2011-12-01 17:41:36 +0100 | [diff] [blame] | 335 | #ifdef CONFIG_SND_HDA_INPUT_JACK |
| 336 | /* guess the jack type from the pin-config */ |
| 337 | static int get_input_jack_type(struct hda_codec *codec, hda_nid_t nid) |
| 338 | { |
| 339 | unsigned int def_conf = snd_hda_codec_get_pincfg(codec, nid); |
| 340 | switch (get_defcfg_device(def_conf)) { |
| 341 | case AC_JACK_LINE_OUT: |
| 342 | case AC_JACK_SPEAKER: |
| 343 | return SND_JACK_LINEOUT; |
| 344 | case AC_JACK_HP_OUT: |
| 345 | return SND_JACK_HEADPHONE; |
| 346 | case AC_JACK_SPDIF_OUT: |
| 347 | case AC_JACK_DIG_OTHER_OUT: |
| 348 | return SND_JACK_AVOUT; |
| 349 | case AC_JACK_MIC_IN: |
| 350 | return SND_JACK_MICROPHONE; |
| 351 | default: |
| 352 | return SND_JACK_LINEIN; |
| 353 | } |
| 354 | } |
| 355 | |
| 356 | static void hda_free_jack_priv(struct snd_jack *jack) |
| 357 | { |
| 358 | struct hda_jack_tbl *jacks = jack->private_data; |
| 359 | jacks->nid = 0; |
| 360 | jacks->jack = NULL; |
| 361 | } |
| 362 | #endif |
| 363 | |
Takashi Iwai | 01a61e1 | 2011-10-28 00:03:22 +0200 | [diff] [blame] | 364 | /** |
| 365 | * snd_hda_jack_add_kctl - Add a kctl for the given pin |
Takashi Iwai | a11e9b1 | 2014-10-29 15:06:01 +0100 | [diff] [blame^] | 366 | * @codec: the HDA codec |
| 367 | * @nid: pin NID to assign |
| 368 | * @name: string name for the jack |
| 369 | * @idx: index number for the jack |
| 370 | * @phantom_jack: flag to deal as a phantom jack |
Takashi Iwai | 01a61e1 | 2011-10-28 00:03:22 +0200 | [diff] [blame] | 371 | * |
| 372 | * This assigns a jack-detection kctl to the given pin. The kcontrol |
| 373 | * will have the given name and index. |
| 374 | */ |
David Henningsson | 80c8bfb | 2012-06-04 09:33:51 +0200 | [diff] [blame] | 375 | static int __snd_hda_jack_add_kctl(struct hda_codec *codec, hda_nid_t nid, |
| 376 | const char *name, int idx, bool phantom_jack) |
Takashi Iwai | 01a61e1 | 2011-10-28 00:03:22 +0200 | [diff] [blame] | 377 | { |
| 378 | struct hda_jack_tbl *jack; |
| 379 | struct snd_kcontrol *kctl; |
Takashi Iwai | 31ef225 | 2011-12-01 17:41:36 +0100 | [diff] [blame] | 380 | int err, state; |
Takashi Iwai | 01a61e1 | 2011-10-28 00:03:22 +0200 | [diff] [blame] | 381 | |
Takashi Iwai | 3a93897 | 2011-10-28 01:16:55 +0200 | [diff] [blame] | 382 | jack = snd_hda_jack_tbl_new(codec, nid); |
Takashi Iwai | 01a61e1 | 2011-10-28 00:03:22 +0200 | [diff] [blame] | 383 | if (!jack) |
| 384 | return 0; |
| 385 | if (jack->kctl) |
| 386 | return 0; /* already created */ |
Takashi Iwai | 35be544 | 2011-11-02 08:36:06 +0100 | [diff] [blame] | 387 | kctl = snd_kctl_jack_new(name, idx, codec); |
Takashi Iwai | 01a61e1 | 2011-10-28 00:03:22 +0200 | [diff] [blame] | 388 | if (!kctl) |
| 389 | return -ENOMEM; |
Takashi Iwai | 31ef225 | 2011-12-01 17:41:36 +0100 | [diff] [blame] | 390 | err = snd_hda_ctl_add(codec, nid, kctl); |
| 391 | if (err < 0) |
| 392 | return err; |
Takashi Iwai | 01a61e1 | 2011-10-28 00:03:22 +0200 | [diff] [blame] | 393 | jack->kctl = kctl; |
David Henningsson | 80c8bfb | 2012-06-04 09:33:51 +0200 | [diff] [blame] | 394 | jack->phantom_jack = !!phantom_jack; |
| 395 | |
Takashi Iwai | 31ef225 | 2011-12-01 17:41:36 +0100 | [diff] [blame] | 396 | state = snd_hda_jack_detect(codec, nid); |
| 397 | snd_kctl_jack_report(codec->bus->card, kctl, state); |
| 398 | #ifdef CONFIG_SND_HDA_INPUT_JACK |
David Henningsson | 80c8bfb | 2012-06-04 09:33:51 +0200 | [diff] [blame] | 399 | if (!phantom_jack) { |
| 400 | jack->type = get_input_jack_type(codec, nid); |
| 401 | err = snd_jack_new(codec->bus->card, name, jack->type, |
| 402 | &jack->jack); |
| 403 | if (err < 0) |
| 404 | return err; |
| 405 | jack->jack->private_data = jack; |
| 406 | jack->jack->private_free = hda_free_jack_priv; |
| 407 | snd_jack_report(jack->jack, state ? jack->type : 0); |
| 408 | } |
Takashi Iwai | 31ef225 | 2011-12-01 17:41:36 +0100 | [diff] [blame] | 409 | #endif |
Takashi Iwai | 01a61e1 | 2011-10-28 00:03:22 +0200 | [diff] [blame] | 410 | return 0; |
| 411 | } |
David Henningsson | 80c8bfb | 2012-06-04 09:33:51 +0200 | [diff] [blame] | 412 | |
| 413 | int snd_hda_jack_add_kctl(struct hda_codec *codec, hda_nid_t nid, |
| 414 | const char *name, int idx) |
| 415 | { |
| 416 | return __snd_hda_jack_add_kctl(codec, nid, name, idx, false); |
| 417 | } |
Takashi Iwai | 2698ea9 | 2013-12-18 07:45:52 +0100 | [diff] [blame] | 418 | EXPORT_SYMBOL_GPL(snd_hda_jack_add_kctl); |
Takashi Iwai | 01a61e1 | 2011-10-28 00:03:22 +0200 | [diff] [blame] | 419 | |
Takashi Iwai | f46c329 | 2012-07-17 16:48:27 +0200 | [diff] [blame] | 420 | /* get the unique index number for the given kctl name */ |
| 421 | static int get_unique_index(struct hda_codec *codec, const char *name, int idx) |
| 422 | { |
| 423 | struct hda_jack_tbl *jack; |
| 424 | int i, len = strlen(name); |
| 425 | again: |
| 426 | jack = codec->jacktbl.list; |
| 427 | for (i = 0; i < codec->jacktbl.used; i++, jack++) { |
| 428 | /* jack->kctl.id contains "XXX Jack" name string with index */ |
| 429 | if (jack->kctl && |
| 430 | !strncmp(name, jack->kctl->id.name, len) && |
| 431 | !strcmp(" Jack", jack->kctl->id.name + len) && |
| 432 | jack->kctl->id.index == idx) { |
| 433 | idx++; |
| 434 | goto again; |
| 435 | } |
| 436 | } |
| 437 | return idx; |
| 438 | } |
| 439 | |
Takashi Iwai | 201e06f | 2011-11-16 15:33:26 +0100 | [diff] [blame] | 440 | static int add_jack_kctl(struct hda_codec *codec, hda_nid_t nid, |
David Henningsson | b26b511 | 2013-04-11 11:30:30 +0200 | [diff] [blame] | 441 | const struct auto_pin_cfg *cfg, |
| 442 | const char *base_name) |
Takashi Iwai | 01a61e1 | 2011-10-28 00:03:22 +0200 | [diff] [blame] | 443 | { |
Takashi Iwai | 3a93897 | 2011-10-28 01:16:55 +0200 | [diff] [blame] | 444 | unsigned int def_conf, conn; |
Takashi Iwai | 975cc02 | 2013-06-28 11:56:49 +0200 | [diff] [blame] | 445 | char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; |
Takashi Iwai | 201e06f | 2011-11-16 15:33:26 +0100 | [diff] [blame] | 446 | int idx, err; |
David Henningsson | 80c8bfb | 2012-06-04 09:33:51 +0200 | [diff] [blame] | 447 | bool phantom_jack; |
Takashi Iwai | 3a93897 | 2011-10-28 01:16:55 +0200 | [diff] [blame] | 448 | |
Takashi Iwai | 01a61e1 | 2011-10-28 00:03:22 +0200 | [diff] [blame] | 449 | if (!nid) |
| 450 | return 0; |
Takashi Iwai | 3a93897 | 2011-10-28 01:16:55 +0200 | [diff] [blame] | 451 | def_conf = snd_hda_codec_get_pincfg(codec, nid); |
| 452 | conn = get_defcfg_connect(def_conf); |
David Henningsson | 80c8bfb | 2012-06-04 09:33:51 +0200 | [diff] [blame] | 453 | if (conn == AC_JACK_PORT_NONE) |
Takashi Iwai | 3a93897 | 2011-10-28 01:16:55 +0200 | [diff] [blame] | 454 | return 0; |
David Henningsson | 80c8bfb | 2012-06-04 09:33:51 +0200 | [diff] [blame] | 455 | phantom_jack = (conn != AC_JACK_PORT_COMPLEX) || |
| 456 | !is_jack_detectable(codec, nid); |
Takashi Iwai | 3a93897 | 2011-10-28 01:16:55 +0200 | [diff] [blame] | 457 | |
David Henningsson | b26b511 | 2013-04-11 11:30:30 +0200 | [diff] [blame] | 458 | if (base_name) { |
| 459 | strlcpy(name, base_name, sizeof(name)); |
| 460 | idx = 0; |
| 461 | } else |
| 462 | snd_hda_get_pin_label(codec, nid, cfg, name, sizeof(name), &idx); |
David Henningsson | 80c8bfb | 2012-06-04 09:33:51 +0200 | [diff] [blame] | 463 | if (phantom_jack) |
| 464 | /* Example final name: "Internal Mic Phantom Jack" */ |
| 465 | strncat(name, " Phantom", sizeof(name) - strlen(name) - 1); |
Takashi Iwai | f46c329 | 2012-07-17 16:48:27 +0200 | [diff] [blame] | 466 | idx = get_unique_index(codec, name, idx); |
David Henningsson | 80c8bfb | 2012-06-04 09:33:51 +0200 | [diff] [blame] | 467 | err = __snd_hda_jack_add_kctl(codec, nid, name, idx, phantom_jack); |
Takashi Iwai | 3a93897 | 2011-10-28 01:16:55 +0200 | [diff] [blame] | 468 | if (err < 0) |
| 469 | return err; |
David Henningsson | 80c8bfb | 2012-06-04 09:33:51 +0200 | [diff] [blame] | 470 | |
| 471 | if (!phantom_jack) |
Takashi Iwai | 62f949b | 2014-09-11 14:06:53 +0200 | [diff] [blame] | 472 | return snd_hda_jack_detect_enable(codec, nid); |
David Henningsson | 80c8bfb | 2012-06-04 09:33:51 +0200 | [diff] [blame] | 473 | return 0; |
Takashi Iwai | 01a61e1 | 2011-10-28 00:03:22 +0200 | [diff] [blame] | 474 | } |
| 475 | |
| 476 | /** |
| 477 | * snd_hda_jack_add_kctls - Add kctls for all pins included in the given pincfg |
Takashi Iwai | a11e9b1 | 2014-10-29 15:06:01 +0100 | [diff] [blame^] | 478 | * @codec: the HDA codec |
| 479 | * @cfg: pin config table to parse |
Takashi Iwai | 01a61e1 | 2011-10-28 00:03:22 +0200 | [diff] [blame] | 480 | */ |
| 481 | int snd_hda_jack_add_kctls(struct hda_codec *codec, |
| 482 | const struct auto_pin_cfg *cfg) |
| 483 | { |
| 484 | const hda_nid_t *p; |
Takashi Iwai | f46c329 | 2012-07-17 16:48:27 +0200 | [diff] [blame] | 485 | int i, err; |
Takashi Iwai | 01a61e1 | 2011-10-28 00:03:22 +0200 | [diff] [blame] | 486 | |
David Henningsson | b26b511 | 2013-04-11 11:30:30 +0200 | [diff] [blame] | 487 | for (i = 0; i < cfg->num_inputs; i++) { |
| 488 | /* If we have headphone mics; make sure they get the right name |
| 489 | before grabbed by output pins */ |
| 490 | if (cfg->inputs[i].is_headphone_mic) { |
| 491 | if (auto_cfg_hp_outs(cfg) == 1) |
| 492 | err = add_jack_kctl(codec, auto_cfg_hp_pins(cfg)[0], |
| 493 | cfg, "Headphone Mic"); |
| 494 | else |
| 495 | err = add_jack_kctl(codec, cfg->inputs[i].pin, |
| 496 | cfg, "Headphone Mic"); |
| 497 | } else |
| 498 | err = add_jack_kctl(codec, cfg->inputs[i].pin, cfg, |
| 499 | NULL); |
| 500 | if (err < 0) |
| 501 | return err; |
| 502 | } |
| 503 | |
Takashi Iwai | 01a61e1 | 2011-10-28 00:03:22 +0200 | [diff] [blame] | 504 | for (i = 0, p = cfg->line_out_pins; i < cfg->line_outs; i++, p++) { |
David Henningsson | b26b511 | 2013-04-11 11:30:30 +0200 | [diff] [blame] | 505 | err = add_jack_kctl(codec, *p, cfg, NULL); |
Takashi Iwai | 01a61e1 | 2011-10-28 00:03:22 +0200 | [diff] [blame] | 506 | if (err < 0) |
| 507 | return err; |
| 508 | } |
| 509 | for (i = 0, p = cfg->hp_pins; i < cfg->hp_outs; i++, p++) { |
| 510 | if (*p == *cfg->line_out_pins) /* might be duplicated */ |
| 511 | break; |
David Henningsson | b26b511 | 2013-04-11 11:30:30 +0200 | [diff] [blame] | 512 | err = add_jack_kctl(codec, *p, cfg, NULL); |
Takashi Iwai | 01a61e1 | 2011-10-28 00:03:22 +0200 | [diff] [blame] | 513 | if (err < 0) |
| 514 | return err; |
| 515 | } |
| 516 | for (i = 0, p = cfg->speaker_pins; i < cfg->speaker_outs; i++, p++) { |
| 517 | if (*p == *cfg->line_out_pins) /* might be duplicated */ |
| 518 | break; |
David Henningsson | b26b511 | 2013-04-11 11:30:30 +0200 | [diff] [blame] | 519 | err = add_jack_kctl(codec, *p, cfg, NULL); |
Takashi Iwai | 01a61e1 | 2011-10-28 00:03:22 +0200 | [diff] [blame] | 520 | if (err < 0) |
| 521 | return err; |
| 522 | } |
| 523 | for (i = 0, p = cfg->dig_out_pins; i < cfg->dig_outs; i++, p++) { |
David Henningsson | b26b511 | 2013-04-11 11:30:30 +0200 | [diff] [blame] | 524 | err = add_jack_kctl(codec, *p, cfg, NULL); |
Takashi Iwai | 01a61e1 | 2011-10-28 00:03:22 +0200 | [diff] [blame] | 525 | if (err < 0) |
| 526 | return err; |
| 527 | } |
David Henningsson | b26b511 | 2013-04-11 11:30:30 +0200 | [diff] [blame] | 528 | err = add_jack_kctl(codec, cfg->dig_in_pin, cfg, NULL); |
Takashi Iwai | 01a61e1 | 2011-10-28 00:03:22 +0200 | [diff] [blame] | 529 | if (err < 0) |
| 530 | return err; |
David Henningsson | b26b511 | 2013-04-11 11:30:30 +0200 | [diff] [blame] | 531 | err = add_jack_kctl(codec, cfg->mono_out_pin, cfg, NULL); |
Takashi Iwai | 01a61e1 | 2011-10-28 00:03:22 +0200 | [diff] [blame] | 532 | if (err < 0) |
| 533 | return err; |
| 534 | return 0; |
| 535 | } |
Takashi Iwai | 2698ea9 | 2013-12-18 07:45:52 +0100 | [diff] [blame] | 536 | EXPORT_SYMBOL_GPL(snd_hda_jack_add_kctls); |
David Henningsson | 954df2a | 2012-09-25 11:30:59 +0200 | [diff] [blame] | 537 | |
Dylan Reid | 0619ba8 | 2012-11-19 19:48:07 +0100 | [diff] [blame] | 538 | static void call_jack_callback(struct hda_codec *codec, |
| 539 | struct hda_jack_tbl *jack) |
| 540 | { |
Takashi Iwai | 1a4f69d | 2014-09-11 15:22:46 +0200 | [diff] [blame] | 541 | struct hda_jack_callback *cb; |
| 542 | |
| 543 | for (cb = jack->callback; cb; cb = cb->next) |
| 544 | cb->func(codec, cb); |
Dylan Reid | 0619ba8 | 2012-11-19 19:48:07 +0100 | [diff] [blame] | 545 | if (jack->gated_jack) { |
| 546 | struct hda_jack_tbl *gated = |
| 547 | snd_hda_jack_tbl_get(codec, jack->gated_jack); |
Takashi Iwai | 1a4f69d | 2014-09-11 15:22:46 +0200 | [diff] [blame] | 548 | if (gated) { |
| 549 | for (cb = gated->callback; cb; cb = cb->next) |
| 550 | cb->func(codec, cb); |
| 551 | } |
Dylan Reid | 0619ba8 | 2012-11-19 19:48:07 +0100 | [diff] [blame] | 552 | } |
| 553 | } |
| 554 | |
David Henningsson | 954df2a | 2012-09-25 11:30:59 +0200 | [diff] [blame] | 555 | void snd_hda_jack_unsol_event(struct hda_codec *codec, unsigned int res) |
| 556 | { |
| 557 | struct hda_jack_tbl *event; |
| 558 | int tag = (res >> AC_UNSOL_RES_TAG_SHIFT) & 0x7f; |
| 559 | |
| 560 | event = snd_hda_jack_tbl_get_from_tag(codec, tag); |
| 561 | if (!event) |
| 562 | return; |
| 563 | event->jack_dirty = 1; |
| 564 | |
Dylan Reid | 0619ba8 | 2012-11-19 19:48:07 +0100 | [diff] [blame] | 565 | call_jack_callback(codec, event); |
David Henningsson | 954df2a | 2012-09-25 11:30:59 +0200 | [diff] [blame] | 566 | snd_hda_jack_report_sync(codec); |
| 567 | } |
Takashi Iwai | 2698ea9 | 2013-12-18 07:45:52 +0100 | [diff] [blame] | 568 | EXPORT_SYMBOL_GPL(snd_hda_jack_unsol_event); |
David Henningsson | 954df2a | 2012-09-25 11:30:59 +0200 | [diff] [blame] | 569 | |
David Henningsson | 26a6cb6 | 2012-10-09 15:04:21 +0200 | [diff] [blame] | 570 | void snd_hda_jack_poll_all(struct hda_codec *codec) |
| 571 | { |
| 572 | struct hda_jack_tbl *jack = codec->jacktbl.list; |
| 573 | int i, changes = 0; |
| 574 | |
| 575 | for (i = 0; i < codec->jacktbl.used; i++, jack++) { |
| 576 | unsigned int old_sense; |
| 577 | if (!jack->nid || !jack->jack_dirty || jack->phantom_jack) |
| 578 | continue; |
| 579 | old_sense = get_jack_plug_state(jack->pin_sense); |
| 580 | jack_detect_update(codec, jack); |
| 581 | if (old_sense == get_jack_plug_state(jack->pin_sense)) |
| 582 | continue; |
| 583 | changes = 1; |
Dylan Reid | 0619ba8 | 2012-11-19 19:48:07 +0100 | [diff] [blame] | 584 | call_jack_callback(codec, jack); |
David Henningsson | 26a6cb6 | 2012-10-09 15:04:21 +0200 | [diff] [blame] | 585 | } |
| 586 | if (changes) |
| 587 | snd_hda_jack_report_sync(codec); |
| 588 | } |
Takashi Iwai | 2698ea9 | 2013-12-18 07:45:52 +0100 | [diff] [blame] | 589 | EXPORT_SYMBOL_GPL(snd_hda_jack_poll_all); |
David Henningsson | 26a6cb6 | 2012-10-09 15:04:21 +0200 | [diff] [blame] | 590 | |