• Home
  • Raw
  • Download

Lines Matching full:jack

3 // soc-jack.c  --  ALSA SoC jack handling
9 #include <sound/jack.h>
22 struct snd_soc_jack *jack; member
27 * snd_soc_component_set_jack - configure component jack.
29 * @jack: structure to use for the jack
30 * @data: can be used if codec driver need extra data for configuring jack
32 * Configures and enables jack detection function.
35 struct snd_soc_jack *jack, void *data) in snd_soc_component_set_jack() argument
38 return component->driver->set_jack(component, jack, data); in snd_soc_component_set_jack()
45 * snd_soc_card_jack_new - Create a new jack
47 * @id: an identifying string for this jack
49 * this jack
50 * @jack: structure to use for the jack
51 * @pins: Array of jack pins to be added to the jack or NULL
54 * Creates a new jack object.
57 * On success jack will be initialised.
60 struct snd_soc_jack *jack, struct snd_soc_jack_pin *pins, in snd_soc_card_jack_new() argument
65 mutex_init(&jack->mutex); in snd_soc_card_jack_new()
66 jack->card = card; in snd_soc_card_jack_new()
67 INIT_LIST_HEAD(&jack->pins); in snd_soc_card_jack_new()
68 INIT_LIST_HEAD(&jack->jack_zones); in snd_soc_card_jack_new()
69 BLOCKING_INIT_NOTIFIER_HEAD(&jack->notifier); in snd_soc_card_jack_new()
71 ret = snd_jack_new(card->snd_card, id, type, &jack->jack, false, false); in snd_soc_card_jack_new()
76 return snd_soc_jack_add_pins(jack, num_pins, pins); in snd_soc_card_jack_new()
83 * snd_soc_jack_report - Report the current status for a jack
85 * @jack: the jack
96 void snd_soc_jack_report(struct snd_soc_jack *jack, int status, int mask) in snd_soc_jack_report() argument
103 if (!jack) in snd_soc_jack_report()
105 trace_snd_soc_jack_report(jack, mask, status); in snd_soc_jack_report()
107 dapm = &jack->card->dapm; in snd_soc_jack_report()
109 mutex_lock(&jack->mutex); in snd_soc_jack_report()
111 jack->status &= ~mask; in snd_soc_jack_report()
112 jack->status |= status & mask; in snd_soc_jack_report()
114 trace_snd_soc_jack_notify(jack, status); in snd_soc_jack_report()
116 list_for_each_entry(pin, &jack->pins, list) { in snd_soc_jack_report()
117 enable = pin->mask & jack->status; in snd_soc_jack_report()
132 blocking_notifier_call_chain(&jack->notifier, jack->status, jack); in snd_soc_jack_report()
137 snd_jack_report(jack->jack, jack->status); in snd_soc_jack_report()
139 mutex_unlock(&jack->mutex); in snd_soc_jack_report()
144 * snd_soc_jack_add_zones - Associate voltage zones with jack
146 * @jack: ASoC jack
151 * array will be associated with the jack.
153 int snd_soc_jack_add_zones(struct snd_soc_jack *jack, int count, in snd_soc_jack_add_zones() argument
160 list_add(&(zones[i].list), &jack->jack_zones); in snd_soc_jack_add_zones()
168 * the type of jack from the zones declared in the jack type
170 * @jack: ASoC jack
171 * @micbias_voltage: mic bias voltage at adc channel when jack is plugged in
174 * the type of jack from the already declared jack zones
176 int snd_soc_jack_get_type(struct snd_soc_jack *jack, int micbias_voltage) in snd_soc_jack_get_type() argument
180 list_for_each_entry(zone, &jack->jack_zones, list) { in snd_soc_jack_get_type()
190 * snd_soc_jack_add_pins - Associate DAPM pins with an ASoC jack
192 * @jack: ASoC jack
198 * state of the jack whenever the jack status is updated.
200 int snd_soc_jack_add_pins(struct snd_soc_jack *jack, int count, in snd_soc_jack_add_pins() argument
207 dev_err(jack->card->dev, "ASoC: No name for pin %d\n", in snd_soc_jack_add_pins()
212 dev_err(jack->card->dev, "ASoC: No mask for pin %d" in snd_soc_jack_add_pins()
218 list_add(&(pins[i].list), &jack->pins); in snd_soc_jack_add_pins()
219 snd_jack_add_new_kctl(jack->jack, pins[i].pin, pins[i].mask); in snd_soc_jack_add_pins()
222 /* Update to reflect the last reported status; canned jack in snd_soc_jack_add_pins()
226 snd_soc_jack_report(jack, 0, 0); in snd_soc_jack_add_pins()
233 * snd_soc_jack_notifier_register - Register a notifier for jack status
235 * @jack: ASoC jack
238 * Register for notification of the current status of the jack. Note
239 * that it is not possible to report additional jack events in the
244 void snd_soc_jack_notifier_register(struct snd_soc_jack *jack, in snd_soc_jack_notifier_register() argument
247 blocking_notifier_chain_register(&jack->notifier, nb); in snd_soc_jack_notifier_register()
252 * snd_soc_jack_notifier_unregister - Unregister a notifier for jack status
254 * @jack: ASoC jack
259 void snd_soc_jack_notifier_unregister(struct snd_soc_jack *jack, in snd_soc_jack_notifier_unregister() argument
262 blocking_notifier_chain_unregister(&jack->notifier, nb); in snd_soc_jack_notifier_unregister()
270 struct snd_soc_jack *jack = gpio->jack; in snd_soc_jack_gpio_detect() local
286 snd_soc_jack_report(jack, report, gpio->report); in snd_soc_jack_gpio_detect()
293 struct device *dev = gpio->jack->card->dev; in gpio_handler()
336 static void jack_free_gpios(struct snd_soc_jack *jack, int count, in jack_free_gpios() argument
347 gpios[i].jack = NULL; in jack_free_gpios()
355 jack_free_gpios(tbl->jack, tbl->count, tbl->gpios); in jack_devres_free_gpios()
359 * snd_soc_jack_add_gpios - Associate GPIO pins with an ASoC jack
361 * @jack: ASoC jack
368 int snd_soc_jack_add_gpios(struct snd_soc_jack *jack, int count, in snd_soc_jack_add_gpios() argument
377 tbl->jack = jack; in snd_soc_jack_add_gpios()
383 dev_err(jack->card->dev, in snd_soc_jack_add_gpios()
407 dev_err(jack->card->dev, in snd_soc_jack_add_gpios()
423 gpios[i].jack = jack; in snd_soc_jack_add_gpios()
437 dev_err(jack->card->dev, in snd_soc_jack_add_gpios()
452 /* Update initial jack status */ in snd_soc_jack_add_gpios()
457 devres_add(jack->card->dev, tbl); in snd_soc_jack_add_gpios()
463 jack_free_gpios(jack, i, gpios); in snd_soc_jack_add_gpios()
471 * snd_soc_jack_add_gpiods - Associate GPIO descriptor pins with an ASoC jack
474 * @jack: ASoC jack
482 struct snd_soc_jack *jack, in snd_soc_jack_add_gpiods() argument
490 return snd_soc_jack_add_gpios(jack, count, gpios); in snd_soc_jack_add_gpiods()
495 * snd_soc_jack_free_gpios - Release GPIO pins' resources of an ASoC jack
497 * @jack: ASoC jack
501 * Release gpio and irq resources for gpio pins associated with an ASoC jack.
503 void snd_soc_jack_free_gpios(struct snd_soc_jack *jack, int count, in snd_soc_jack_free_gpios() argument
506 jack_free_gpios(jack, count, gpios); in snd_soc_jack_free_gpios()
507 devres_destroy(jack->card->dev, jack_devres_free_gpios, NULL, NULL); in snd_soc_jack_free_gpios()