summaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-jack.c
diff options
context:
space:
mode:
authorDylan Reid2015-05-23 00:09:20 +0200
committerMark Brown2015-05-25 14:11:45 +0200
commite616d2eba6d1ac8f3268cdf5d7b0424072c89a8d (patch)
treedd89f17a3a156552a3e58c616b6b1d40f829d010 /sound/soc/soc-jack.c
parentASoC: Add jack types to dt-bindings (diff)
downloadkernel-qcow2-linux-e616d2eba6d1ac8f3268cdf5d7b0424072c89a8d.tar.gz
kernel-qcow2-linux-e616d2eba6d1ac8f3268cdf5d7b0424072c89a8d.tar.xz
kernel-qcow2-linux-e616d2eba6d1ac8f3268cdf5d7b0424072c89a8d.zip
ASoC: jack - add_gpiods accepts filled descriptors
Allow for the desc field to be pre-filled when adding gpios to a jack. This allows drivers to get the gpios and decide if they should be added to the list or not. Specifically this will allow the gpio jack driver to add gpios based on device property specifications. Signed-off-by: Dylan Reid <dgreid@chromium.org> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/soc-jack.c')
-rw-r--r--sound/soc/soc-jack.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/sound/soc/soc-jack.c b/sound/soc/soc-jack.c
index 9f60c25c4568..171c4291ea21 100644
--- a/sound/soc/soc-jack.c
+++ b/sound/soc/soc-jack.c
@@ -315,8 +315,11 @@ int snd_soc_jack_add_gpios(struct snd_soc_jack *jack, int count,
goto undo;
}
- if (gpios[i].gpiod_dev) {
- /* GPIO descriptor */
+ if (gpios[i].desc) {
+ /* Already have a GPIO descriptor. */
+ goto got_gpio;
+ } else if (gpios[i].gpiod_dev) {
+ /* Get a GPIO descriptor */
gpios[i].desc = gpiod_get_index(gpios[i].gpiod_dev,
gpios[i].name,
gpios[i].idx, GPIOD_IN);
@@ -344,7 +347,7 @@ int snd_soc_jack_add_gpios(struct snd_soc_jack *jack, int count,
gpios[i].desc = gpio_to_desc(gpios[i].gpio);
}
-
+got_gpio:
INIT_DELAYED_WORK(&gpios[i].work, gpio_work);
gpios[i].jack = jack;