^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: GPL-2.0+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) //
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) // soc-jack.c -- ALSA SoC jack handling
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) //
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) // Copyright 2008 Wolfson Microelectronics PLC.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) //
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) // Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #include <sound/jack.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <sound/soc.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <linux/gpio.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <linux/gpio/consumer.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <linux/interrupt.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <linux/workqueue.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include <linux/delay.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include <linux/export.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #include <linux/suspend.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #include <trace/events/asoc.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) struct jack_gpio_tbl {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) int count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) struct snd_soc_jack *jack;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) struct snd_soc_jack_gpio *gpios;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) * snd_soc_jack_report - Report the current status for a jack
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) * @jack: the jack
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) * @status: a bitmask of enum snd_jack_type values that are currently detected.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) * @mask: a bitmask of enum snd_jack_type values that being reported.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) * If configured using snd_soc_jack_add_pins() then the associated
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) * DAPM pins will be enabled or disabled as appropriate and DAPM
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) * synchronised.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) * Note: This function uses mutexes and should be called from a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) * context which can sleep (such as a workqueue).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) void snd_soc_jack_report(struct snd_soc_jack *jack, int status, int mask)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) struct snd_soc_dapm_context *dapm;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) struct snd_soc_jack_pin *pin;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) unsigned int sync = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) int enable;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) if (!jack)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) trace_snd_soc_jack_report(jack, mask, status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) dapm = &jack->card->dapm;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) mutex_lock(&jack->mutex);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) jack->status &= ~mask;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) jack->status |= status & mask;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) trace_snd_soc_jack_notify(jack, status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) list_for_each_entry(pin, &jack->pins, list) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) enable = pin->mask & jack->status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) if (pin->invert)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) enable = !enable;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) if (enable)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) snd_soc_dapm_enable_pin(dapm, pin->pin);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) snd_soc_dapm_disable_pin(dapm, pin->pin);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) /* we need to sync for this case only */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) sync = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) /* Report before the DAPM sync to help users updating micbias status */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) blocking_notifier_call_chain(&jack->notifier, jack->status, jack);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) if (sync)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) snd_soc_dapm_sync(dapm);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) snd_jack_report(jack->jack, jack->status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) mutex_unlock(&jack->mutex);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) EXPORT_SYMBOL_GPL(snd_soc_jack_report);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) * snd_soc_jack_add_zones - Associate voltage zones with jack
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) * @jack: ASoC jack
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) * @count: Number of zones
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) * @zones: Array of zones
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) * After this function has been called the zones specified in the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) * array will be associated with the jack.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) int snd_soc_jack_add_zones(struct snd_soc_jack *jack, int count,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) struct snd_soc_jack_zone *zones)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) int i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) for (i = 0; i < count; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) INIT_LIST_HEAD(&zones[i].list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) list_add(&(zones[i].list), &jack->jack_zones);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) EXPORT_SYMBOL_GPL(snd_soc_jack_add_zones);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) * snd_soc_jack_get_type - Based on the mic bias value, this function returns
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) * the type of jack from the zones declared in the jack type
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) * @jack: ASoC jack
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) * @micbias_voltage: mic bias voltage at adc channel when jack is plugged in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) * Based on the mic bias value passed, this function helps identify
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) * the type of jack from the already declared jack zones
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) int snd_soc_jack_get_type(struct snd_soc_jack *jack, int micbias_voltage)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) struct snd_soc_jack_zone *zone;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) list_for_each_entry(zone, &jack->jack_zones, list) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) if (micbias_voltage >= zone->min_mv &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) micbias_voltage < zone->max_mv)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) return zone->jack_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) EXPORT_SYMBOL_GPL(snd_soc_jack_get_type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) * snd_soc_jack_add_pins - Associate DAPM pins with an ASoC jack
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) * @jack: ASoC jack
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) * @count: Number of pins
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) * @pins: Array of pins
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) * After this function has been called the DAPM pins specified in the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) * pins array will have their status updated to reflect the current
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) * state of the jack whenever the jack status is updated.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) int snd_soc_jack_add_pins(struct snd_soc_jack *jack, int count,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) struct snd_soc_jack_pin *pins)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) int i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) for (i = 0; i < count; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) if (!pins[i].pin) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) dev_err(jack->card->dev, "ASoC: No name for pin %d\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) i);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) if (!pins[i].mask) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) dev_err(jack->card->dev, "ASoC: No mask for pin %d"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) " (%s)\n", i, pins[i].pin);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) INIT_LIST_HEAD(&pins[i].list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) list_add(&(pins[i].list), &jack->pins);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) snd_jack_add_new_kctl(jack->jack, pins[i].pin, pins[i].mask);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) /* Update to reflect the last reported status; canned jack
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) * implementations are likely to set their state before the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) * card has an opportunity to associate pins.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) snd_soc_jack_report(jack, 0, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) EXPORT_SYMBOL_GPL(snd_soc_jack_add_pins);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) * snd_soc_jack_notifier_register - Register a notifier for jack status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) * @jack: ASoC jack
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) * @nb: Notifier block to register
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) * Register for notification of the current status of the jack. Note
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) * that it is not possible to report additional jack events in the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) * callback from the notifier, this is intended to support
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) * applications such as enabling electrical detection only when a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) * mechanical detection event has occurred.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) void snd_soc_jack_notifier_register(struct snd_soc_jack *jack,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) struct notifier_block *nb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) blocking_notifier_chain_register(&jack->notifier, nb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) EXPORT_SYMBOL_GPL(snd_soc_jack_notifier_register);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) * snd_soc_jack_notifier_unregister - Unregister a notifier for jack status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) * @jack: ASoC jack
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) * @nb: Notifier block to unregister
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) * Stop notifying for status changes.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) void snd_soc_jack_notifier_unregister(struct snd_soc_jack *jack,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) struct notifier_block *nb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) blocking_notifier_chain_unregister(&jack->notifier, nb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) EXPORT_SYMBOL_GPL(snd_soc_jack_notifier_unregister);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) #ifdef CONFIG_GPIOLIB
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) /* gpio detect */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) static void snd_soc_jack_gpio_detect(struct snd_soc_jack_gpio *gpio)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) struct snd_soc_jack *jack = gpio->jack;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) int enable;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) int report;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) enable = gpiod_get_value_cansleep(gpio->desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) if (gpio->invert)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) enable = !enable;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) if (enable)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) report = gpio->report;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) report = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) if (gpio->jack_status_check)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) report = gpio->jack_status_check(gpio->data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) snd_soc_jack_report(jack, report, gpio->report);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) /* irq handler for gpio pin */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) static irqreturn_t gpio_handler(int irq, void *data)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) struct snd_soc_jack_gpio *gpio = data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) struct device *dev = gpio->jack->card->dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) trace_snd_soc_jack_irq(gpio->name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) if (device_may_wakeup(dev))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) pm_wakeup_event(dev, gpio->debounce_time + 50);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) queue_delayed_work(system_power_efficient_wq, &gpio->work,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) msecs_to_jiffies(gpio->debounce_time));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) return IRQ_HANDLED;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) /* gpio work */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) static void gpio_work(struct work_struct *work)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) struct snd_soc_jack_gpio *gpio;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) gpio = container_of(work, struct snd_soc_jack_gpio, work.work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) snd_soc_jack_gpio_detect(gpio);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) static int snd_soc_jack_pm_notifier(struct notifier_block *nb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) unsigned long action, void *data)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) struct snd_soc_jack_gpio *gpio =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) container_of(nb, struct snd_soc_jack_gpio, pm_notifier);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) switch (action) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) case PM_POST_SUSPEND:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) case PM_POST_HIBERNATION:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) case PM_POST_RESTORE:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) * Use workqueue so we do not have to care about running
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) * concurrently with work triggered by the interrupt handler.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) queue_delayed_work(system_power_efficient_wq, &gpio->work, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) return NOTIFY_DONE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) static void jack_free_gpios(struct snd_soc_jack *jack, int count,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) struct snd_soc_jack_gpio *gpios)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) int i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) for (i = 0; i < count; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) gpiod_unexport(gpios[i].desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) unregister_pm_notifier(&gpios[i].pm_notifier);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) free_irq(gpiod_to_irq(gpios[i].desc), &gpios[i]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) cancel_delayed_work_sync(&gpios[i].work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) gpiod_put(gpios[i].desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) gpios[i].jack = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) static void jack_devres_free_gpios(struct device *dev, void *res)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) struct jack_gpio_tbl *tbl = res;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) jack_free_gpios(tbl->jack, tbl->count, tbl->gpios);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) * snd_soc_jack_add_gpios - Associate GPIO pins with an ASoC jack
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) * @jack: ASoC jack
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) * @count: number of pins
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) * @gpios: array of gpio pins
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) * This function will request gpio, set data direction and request irq
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) * for each gpio in the array.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) int snd_soc_jack_add_gpios(struct snd_soc_jack *jack, int count,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) struct snd_soc_jack_gpio *gpios)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) int i, ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) struct jack_gpio_tbl *tbl;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) tbl = devres_alloc(jack_devres_free_gpios, sizeof(*tbl), GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) if (!tbl)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) tbl->jack = jack;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) tbl->count = count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) tbl->gpios = gpios;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) for (i = 0; i < count; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) if (!gpios[i].name) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) dev_err(jack->card->dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) "ASoC: No name for gpio at index %d\n", i);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) ret = -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) goto undo;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) if (gpios[i].desc) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) /* Already have a GPIO descriptor. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) goto got_gpio;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) } else if (gpios[i].gpiod_dev) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) /* Get a GPIO descriptor */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) gpios[i].desc = gpiod_get_index(gpios[i].gpiod_dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) gpios[i].name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) gpios[i].idx, GPIOD_IN);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) if (IS_ERR(gpios[i].desc)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) ret = PTR_ERR(gpios[i].desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) dev_err(gpios[i].gpiod_dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) "ASoC: Cannot get gpio at index %d: %d",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) i, ret);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) goto undo;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) /* legacy GPIO number */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) if (!gpio_is_valid(gpios[i].gpio)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) dev_err(jack->card->dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) "ASoC: Invalid gpio %d\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) gpios[i].gpio);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) ret = -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) goto undo;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) ret = gpio_request_one(gpios[i].gpio, GPIOF_IN,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) gpios[i].name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) if (ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) goto undo;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) gpios[i].desc = gpio_to_desc(gpios[i].gpio);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) got_gpio:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) INIT_DELAYED_WORK(&gpios[i].work, gpio_work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) gpios[i].jack = jack;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) ret = request_any_context_irq(gpiod_to_irq(gpios[i].desc),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) gpio_handler,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) IRQF_TRIGGER_RISING |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) IRQF_TRIGGER_FALLING,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) gpios[i].name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) &gpios[i]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) if (ret < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) goto err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) if (gpios[i].wake) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) ret = irq_set_irq_wake(gpiod_to_irq(gpios[i].desc), 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) if (ret != 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) dev_err(jack->card->dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) "ASoC: Failed to mark GPIO at index %d as wake source: %d\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) i, ret);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) * Register PM notifier so we do not miss state transitions
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) * happening while system is asleep.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) gpios[i].pm_notifier.notifier_call = snd_soc_jack_pm_notifier;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) register_pm_notifier(&gpios[i].pm_notifier);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) /* Expose GPIO value over sysfs for diagnostic purposes */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) gpiod_export(gpios[i].desc, false);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) /* Update initial jack status */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) schedule_delayed_work(&gpios[i].work,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) msecs_to_jiffies(gpios[i].debounce_time));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) devres_add(jack->card->dev, tbl);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) err:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) gpio_free(gpios[i].gpio);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) undo:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) jack_free_gpios(jack, i, gpios);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) devres_free(tbl);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) EXPORT_SYMBOL_GPL(snd_soc_jack_add_gpios);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) * snd_soc_jack_add_gpiods - Associate GPIO descriptor pins with an ASoC jack
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) * @gpiod_dev: GPIO consumer device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418) * @jack: ASoC jack
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) * @count: number of pins
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) * @gpios: array of gpio pins
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) * This function will request gpio, set data direction and request irq
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) * for each gpio in the array.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) int snd_soc_jack_add_gpiods(struct device *gpiod_dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426) struct snd_soc_jack *jack,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427) int count, struct snd_soc_jack_gpio *gpios)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429) int i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431) for (i = 0; i < count; i++)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) gpios[i].gpiod_dev = gpiod_dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) return snd_soc_jack_add_gpios(jack, count, gpios);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436) EXPORT_SYMBOL_GPL(snd_soc_jack_add_gpiods);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439) * snd_soc_jack_free_gpios - Release GPIO pins' resources of an ASoC jack
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441) * @jack: ASoC jack
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442) * @count: number of pins
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443) * @gpios: array of gpio pins
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445) * Release gpio and irq resources for gpio pins associated with an ASoC jack.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447) void snd_soc_jack_free_gpios(struct snd_soc_jack *jack, int count,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448) struct snd_soc_jack_gpio *gpios)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450) jack_free_gpios(jack, count, gpios);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451) devres_destroy(jack->card->dev, jack_devres_free_gpios, NULL, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453) EXPORT_SYMBOL_GPL(snd_soc_jack_free_gpios);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454) #endif /* CONFIG_GPIOLIB */