Lines Matching refs:jack
3 // soc-jack.c -- ALSA SoC jack handling
9 #include <sound/jack.h>
22 struct snd_soc_jack *jack;
27 * snd_soc_jack_report - Report the current status for a jack
29 * @jack: the jack
40 void snd_soc_jack_report(struct snd_soc_jack *jack, int status, int mask)
47 if (!jack)
49 trace_snd_soc_jack_report(jack, mask, status);
51 dapm = &jack->card->dapm;
53 mutex_lock(&jack->mutex);
55 jack->status &= ~mask;
56 jack->status |= status & mask;
58 trace_snd_soc_jack_notify(jack, status);
60 list_for_each_entry(pin, &jack->pins, list) {
61 enable = pin->mask & jack->status;
76 blocking_notifier_call_chain(&jack->notifier, jack->status, jack);
81 snd_jack_report(jack->jack, jack->status);
83 mutex_unlock(&jack->mutex);
88 * snd_soc_jack_add_zones - Associate voltage zones with jack
90 * @jack: ASoC jack
95 * array will be associated with the jack.
97 int snd_soc_jack_add_zones(struct snd_soc_jack *jack, int count,
104 list_add(&(zones[i].list), &jack->jack_zones);
112 * the type of jack from the zones declared in the jack type
114 * @jack: ASoC jack
115 * @micbias_voltage: mic bias voltage at adc channel when jack is plugged in
118 * the type of jack from the already declared jack zones
120 int snd_soc_jack_get_type(struct snd_soc_jack *jack, int micbias_voltage)
124 list_for_each_entry(zone, &jack->jack_zones, list) {
134 * snd_soc_jack_add_pins - Associate DAPM pins with an ASoC jack
136 * @jack: ASoC jack
142 * state of the jack whenever the jack status is updated.
144 int snd_soc_jack_add_pins(struct snd_soc_jack *jack, int count,
151 dev_err(jack->card->dev, "ASoC: No name for pin %d\n",
156 dev_err(jack->card->dev, "ASoC: No mask for pin %d"
162 list_add(&(pins[i].list), &jack->pins);
163 snd_jack_add_new_kctl(jack->jack, pins[i].pin, pins[i].mask);
166 /* Update to reflect the last reported status; canned jack
170 snd_soc_jack_report(jack, 0, 0);
177 * snd_soc_jack_notifier_register - Register a notifier for jack status
179 * @jack: ASoC jack
182 * Register for notification of the current status of the jack. Note
183 * that it is not possible to report additional jack events in the
188 void snd_soc_jack_notifier_register(struct snd_soc_jack *jack,
191 blocking_notifier_chain_register(&jack->notifier, nb);
196 * snd_soc_jack_notifier_unregister - Unregister a notifier for jack status
198 * @jack: ASoC jack
203 void snd_soc_jack_notifier_unregister(struct snd_soc_jack *jack,
206 blocking_notifier_chain_unregister(&jack->notifier, nb);
214 struct snd_soc_jack *jack = gpio->jack;
230 snd_soc_jack_report(jack, report, gpio->report);
237 struct device *dev = gpio->jack->card->dev;
280 static void jack_free_gpios(struct snd_soc_jack *jack, int count,
291 gpios[i].jack = NULL;
299 jack_free_gpios(tbl->jack, tbl->count, tbl->gpios);
303 * snd_soc_jack_add_gpios - Associate GPIO pins with an ASoC jack
305 * @jack: ASoC jack
312 int snd_soc_jack_add_gpios(struct snd_soc_jack *jack, int count,
321 tbl->jack = jack;
327 dev_err(jack->card->dev,
351 dev_err(jack->card->dev,
367 gpios[i].jack = jack;
381 dev_err(jack->card->dev,
396 /* Update initial jack status */
401 devres_add(jack->card->dev, tbl);
407 jack_free_gpios(jack, i, gpios);
415 * snd_soc_jack_add_gpiods - Associate GPIO descriptor pins with an ASoC jack
418 * @jack: ASoC jack
426 struct snd_soc_jack *jack,
434 return snd_soc_jack_add_gpios(jack, count, gpios);
439 * snd_soc_jack_free_gpios - Release GPIO pins' resources of an ASoC jack
441 * @jack: ASoC jack
445 * Release gpio and irq resources for gpio pins associated with an ASoC jack.
447 void snd_soc_jack_free_gpios(struct snd_soc_jack *jack, int count,
450 jack_free_gpios(jack, count, gpios);
451 devres_destroy(jack->card->dev, jack_devres_free_gpios, NULL, NULL);