Lines Matching full:jack
3 // soc-jack.c -- ALSA SoC jack handling
9 #include <sound/jack.h>
20 * snd_soc_jack_report - Report the current status for a jack
22 * @jack: the jack
33 void snd_soc_jack_report(struct snd_soc_jack *jack, int status, int mask) in snd_soc_jack_report() argument
39 if (!jack || !jack->jack) in snd_soc_jack_report()
41 trace_snd_soc_jack_report(jack, mask, status); in snd_soc_jack_report()
43 dapm = &jack->card->dapm; in snd_soc_jack_report()
45 mutex_lock(&jack->mutex); in snd_soc_jack_report()
47 jack->status &= ~mask; in snd_soc_jack_report()
48 jack->status |= status & mask; in snd_soc_jack_report()
50 trace_snd_soc_jack_notify(jack, status); in snd_soc_jack_report()
52 list_for_each_entry(pin, &jack->pins, list) { in snd_soc_jack_report()
53 int enable = pin->mask & jack->status; in snd_soc_jack_report()
68 blocking_notifier_call_chain(&jack->notifier, jack->status, jack); in snd_soc_jack_report()
73 snd_jack_report(jack->jack, jack->status); in snd_soc_jack_report()
75 mutex_unlock(&jack->mutex); in snd_soc_jack_report()
80 * snd_soc_jack_add_zones - Associate voltage zones with jack
82 * @jack: ASoC jack
87 * array will be associated with the jack.
89 int snd_soc_jack_add_zones(struct snd_soc_jack *jack, int count, in snd_soc_jack_add_zones() argument
96 list_add(&(zones[i].list), &jack->jack_zones); in snd_soc_jack_add_zones()
104 * the type of jack from the zones declared in the jack type
106 * @jack: ASoC jack
107 * @micbias_voltage: mic bias voltage at adc channel when jack is plugged in
110 * the type of jack from the already declared jack zones
112 int snd_soc_jack_get_type(struct snd_soc_jack *jack, int micbias_voltage) in snd_soc_jack_get_type() argument
116 list_for_each_entry(zone, &jack->jack_zones, list) { in snd_soc_jack_get_type()
126 * snd_soc_jack_add_pins - Associate DAPM pins with an ASoC jack
128 * @jack: ASoC jack created with snd_soc_card_jack_new_pins()
134 * state of the jack whenever the jack status is updated.
136 int snd_soc_jack_add_pins(struct snd_soc_jack *jack, int count, in snd_soc_jack_add_pins() argument
143 dev_err(jack->card->dev, "ASoC: No name for pin %d\n", in snd_soc_jack_add_pins()
148 dev_err(jack->card->dev, "ASoC: No mask for pin %d" in snd_soc_jack_add_pins()
154 list_add(&(pins[i].list), &jack->pins); in snd_soc_jack_add_pins()
155 snd_jack_add_new_kctl(jack->jack, pins[i].pin, pins[i].mask); in snd_soc_jack_add_pins()
158 /* Update to reflect the last reported status; canned jack in snd_soc_jack_add_pins()
162 snd_soc_jack_report(jack, 0, 0); in snd_soc_jack_add_pins()
169 * snd_soc_jack_notifier_register - Register a notifier for jack status
171 * @jack: ASoC jack
174 * Register for notification of the current status of the jack. Note
175 * that it is not possible to report additional jack events in the
180 void snd_soc_jack_notifier_register(struct snd_soc_jack *jack, in snd_soc_jack_notifier_register() argument
183 blocking_notifier_chain_register(&jack->notifier, nb); in snd_soc_jack_notifier_register()
188 * snd_soc_jack_notifier_unregister - Unregister a notifier for jack status
190 * @jack: ASoC jack
195 void snd_soc_jack_notifier_unregister(struct snd_soc_jack *jack, in snd_soc_jack_notifier_unregister() argument
198 blocking_notifier_chain_unregister(&jack->notifier, nb); in snd_soc_jack_notifier_unregister()
205 struct snd_soc_jack *jack; member
212 struct snd_soc_jack *jack = gpio->jack; in snd_soc_jack_gpio_detect() local
228 snd_soc_jack_report(jack, report, gpio->report); in snd_soc_jack_gpio_detect()
235 struct device *dev = gpio->jack->card->dev; in gpio_handler()
278 static void jack_free_gpios(struct snd_soc_jack *jack, int count, in jack_free_gpios() argument
289 gpios[i].jack = NULL; in jack_free_gpios()
297 jack_free_gpios(tbl->jack, tbl->count, tbl->gpios); in jack_devres_free_gpios()
301 * snd_soc_jack_add_gpios - Associate GPIO pins with an ASoC jack
303 * @jack: ASoC jack
310 int snd_soc_jack_add_gpios(struct snd_soc_jack *jack, int count, in snd_soc_jack_add_gpios() argument
319 tbl->jack = jack; in snd_soc_jack_add_gpios()
325 dev_err(jack->card->dev, in snd_soc_jack_add_gpios()
347 dev_err(jack->card->dev, "ASoC: Invalid gpio at index %d\n", i); in snd_soc_jack_add_gpios()
353 gpios[i].jack = jack; in snd_soc_jack_add_gpios()
368 dev_err(jack->card->dev, in snd_soc_jack_add_gpios()
383 /* Update initial jack status */ in snd_soc_jack_add_gpios()
388 devres_add(jack->card->dev, tbl); in snd_soc_jack_add_gpios()
392 jack_free_gpios(jack, i, gpios); in snd_soc_jack_add_gpios()
400 * snd_soc_jack_add_gpiods - Associate GPIO descriptor pins with an ASoC jack
403 * @jack: ASoC jack
411 struct snd_soc_jack *jack, in snd_soc_jack_add_gpiods() argument
419 return snd_soc_jack_add_gpios(jack, count, gpios); in snd_soc_jack_add_gpiods()
424 * snd_soc_jack_free_gpios - Release GPIO pins' resources of an ASoC jack
426 * @jack: ASoC jack
430 * Release gpio and irq resources for gpio pins associated with an ASoC jack.
432 void snd_soc_jack_free_gpios(struct snd_soc_jack *jack, int count, in snd_soc_jack_free_gpios() argument
435 jack_free_gpios(jack, count, gpios); in snd_soc_jack_free_gpios()
436 devres_destroy(jack->card->dev, jack_devres_free_gpios, NULL, NULL); in snd_soc_jack_free_gpios()