Lines Matching full:jack
3 // soc-jack.c -- ALSA SoC jack handling
9 #include <sound/jack.h>
21 * snd_soc_jack_report - Report the current status for a jack
23 * @jack: the jack
34 void snd_soc_jack_report(struct snd_soc_jack *jack, int status, int mask) in snd_soc_jack_report() argument
40 if (!jack || !jack->jack) in snd_soc_jack_report()
42 trace_snd_soc_jack_report(jack, mask, status); in snd_soc_jack_report()
44 dapm = &jack->card->dapm; in snd_soc_jack_report()
46 mutex_lock(&jack->mutex); in snd_soc_jack_report()
48 jack->status &= ~mask; in snd_soc_jack_report()
49 jack->status |= status & mask; in snd_soc_jack_report()
51 trace_snd_soc_jack_notify(jack, status); in snd_soc_jack_report()
53 list_for_each_entry(pin, &jack->pins, list) { in snd_soc_jack_report()
54 int enable = pin->mask & jack->status; in snd_soc_jack_report()
69 blocking_notifier_call_chain(&jack->notifier, jack->status, jack); in snd_soc_jack_report()
74 snd_jack_report(jack->jack, jack->status); in snd_soc_jack_report()
76 mutex_unlock(&jack->mutex); in snd_soc_jack_report()
81 * snd_soc_jack_add_zones - Associate voltage zones with jack
83 * @jack: ASoC jack
88 * array will be associated with the jack.
90 int snd_soc_jack_add_zones(struct snd_soc_jack *jack, int count, in snd_soc_jack_add_zones() argument
97 list_add(&(zones[i].list), &jack->jack_zones); in snd_soc_jack_add_zones()
105 * the type of jack from the zones declared in the jack type
107 * @jack: ASoC jack
108 * @micbias_voltage: mic bias voltage at adc channel when jack is plugged in
111 * the type of jack from the already declared jack zones
113 int snd_soc_jack_get_type(struct snd_soc_jack *jack, int micbias_voltage) in snd_soc_jack_get_type() argument
117 list_for_each_entry(zone, &jack->jack_zones, list) { in snd_soc_jack_get_type()
127 * snd_soc_jack_add_pins - Associate DAPM pins with an ASoC jack
129 * @jack: ASoC jack created with snd_soc_card_jack_new_pins()
135 * state of the jack whenever the jack status is updated.
137 int snd_soc_jack_add_pins(struct snd_soc_jack *jack, int count, in snd_soc_jack_add_pins() argument
144 dev_err(jack->card->dev, "ASoC: No name for pin %d\n", in snd_soc_jack_add_pins()
149 dev_err(jack->card->dev, "ASoC: No mask for pin %d" in snd_soc_jack_add_pins()
155 list_add(&(pins[i].list), &jack->pins); in snd_soc_jack_add_pins()
156 snd_jack_add_new_kctl(jack->jack, pins[i].pin, pins[i].mask); in snd_soc_jack_add_pins()
159 /* Update to reflect the last reported status; canned jack in snd_soc_jack_add_pins()
163 snd_soc_jack_report(jack, 0, 0); in snd_soc_jack_add_pins()
170 * snd_soc_jack_notifier_register - Register a notifier for jack status
172 * @jack: ASoC jack
175 * Register for notification of the current status of the jack. Note
176 * that it is not possible to report additional jack events in the
181 void snd_soc_jack_notifier_register(struct snd_soc_jack *jack, in snd_soc_jack_notifier_register() argument
184 blocking_notifier_chain_register(&jack->notifier, nb); in snd_soc_jack_notifier_register()
189 * snd_soc_jack_notifier_unregister - Unregister a notifier for jack status
191 * @jack: ASoC jack
196 void snd_soc_jack_notifier_unregister(struct snd_soc_jack *jack, in snd_soc_jack_notifier_unregister() argument
199 blocking_notifier_chain_unregister(&jack->notifier, nb); in snd_soc_jack_notifier_unregister()
206 struct snd_soc_jack *jack; member
213 struct snd_soc_jack *jack = gpio->jack; in snd_soc_jack_gpio_detect() local
229 snd_soc_jack_report(jack, report, gpio->report); in snd_soc_jack_gpio_detect()
236 struct device *dev = gpio->jack->card->dev; in gpio_handler()
279 static void jack_free_gpios(struct snd_soc_jack *jack, int count, in jack_free_gpios() argument
290 gpios[i].jack = NULL; in jack_free_gpios()
298 jack_free_gpios(tbl->jack, tbl->count, tbl->gpios); in jack_devres_free_gpios()
302 * snd_soc_jack_add_gpios - Associate GPIO pins with an ASoC jack
304 * @jack: ASoC jack
311 int snd_soc_jack_add_gpios(struct snd_soc_jack *jack, int count, in snd_soc_jack_add_gpios() argument
320 tbl->jack = jack; in snd_soc_jack_add_gpios()
326 dev_err(jack->card->dev, in snd_soc_jack_add_gpios()
350 dev_err(jack->card->dev, in snd_soc_jack_add_gpios()
366 gpios[i].jack = jack; in snd_soc_jack_add_gpios()
381 dev_err(jack->card->dev, in snd_soc_jack_add_gpios()
396 /* Update initial jack status */ in snd_soc_jack_add_gpios()
401 devres_add(jack->card->dev, tbl); in snd_soc_jack_add_gpios()
407 jack_free_gpios(jack, i, gpios); in snd_soc_jack_add_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, in snd_soc_jack_add_gpiods() argument
434 return snd_soc_jack_add_gpios(jack, count, gpios); in snd_soc_jack_add_gpiods()
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, in snd_soc_jack_free_gpios() argument
450 jack_free_gpios(jack, count, gpios); in snd_soc_jack_free_gpios()
451 devres_destroy(jack->card->dev, jack_devres_free_gpios, NULL, NULL); in snd_soc_jack_free_gpios()