Lines Matching refs: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)
40 if (!jack || !jack->jack)
42 trace_snd_soc_jack_report(jack, mask, status);
44 dapm = &jack->card->dapm;
46 mutex_lock(&jack->mutex);
48 jack->status &= ~mask;
49 jack->status |= status & mask;
51 trace_snd_soc_jack_notify(jack, status);
53 list_for_each_entry(pin, &jack->pins, list) {
54 int enable = pin->mask & jack->status;
69 blocking_notifier_call_chain(&jack->notifier, jack->status, jack);
74 snd_jack_report(jack->jack, jack->status);
76 mutex_unlock(&jack->mutex);
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,
97 list_add(&(zones[i].list), &jack->jack_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)
117 list_for_each_entry(zone, &jack->jack_zones, list) {
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,
144 dev_err(jack->card->dev, "ASoC: No name for pin %d\n",
149 dev_err(jack->card->dev, "ASoC: No mask for pin %d"
155 list_add(&(pins[i].list), &jack->pins);
156 snd_jack_add_new_kctl(jack->jack, pins[i].pin, pins[i].mask);
159 /* Update to reflect the last reported status; canned jack
163 snd_soc_jack_report(jack, 0, 0);
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,
184 blocking_notifier_chain_register(&jack->notifier, nb);
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,
199 blocking_notifier_chain_unregister(&jack->notifier, nb);
206 struct snd_soc_jack *jack;
213 struct snd_soc_jack *jack = gpio->jack;
229 snd_soc_jack_report(jack, report, gpio->report);
236 struct device *dev = gpio->jack->card->dev;
279 static void jack_free_gpios(struct snd_soc_jack *jack, int count,
290 gpios[i].jack = NULL;
298 jack_free_gpios(tbl->jack, tbl->count, tbl->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,
320 tbl->jack = jack;
326 dev_err(jack->card->dev,
350 dev_err(jack->card->dev,
366 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);