Skip to content

Commit

Permalink
ASoC: jack - add_gpiods accepts filled descriptors
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
  • Loading branch information
dgreid authored and broonie committed May 25, 2015
1 parent 1fb1e0e commit e616d2e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions sound/soc/soc-jack.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit e616d2e

Please sign in to comment.