aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJarkko Nikula <jarkko.nikula@linux.intel.com>2014-05-26 07:34:37 -0400
committerMark Brown <broonie@linaro.org>2014-05-26 10:26:00 -0400
commitf025d3b9c64e1f7feb75a559d4a12f5f8c6a4a25 (patch)
tree819909f51afd408c50379e69c55d29337365d02c /include
parent50dfb69d1bb0062e2811547525c73e9a45a423e9 (diff)
ASoC: jack: Add support for GPIO descriptor defined jack pins
Allow jack GPIO pins be defined also using GPIO descriptor-based interface in addition to legacy GPIO numbers. This is done by adding two new fields to struct snd_soc_jack_gpio: idx and gpiod_dev. Legacy GPIO numbers are used only when GPIO consumer device gpiod_dev is NULL and otherwise idx is the descriptor index within the GPIO consumer device. New function snd_soc_jack_add_gpiods() is added for typical cases where all GPIO descriptor jack pins belong to same GPIO consumer device. For other cases the caller must set the gpiod_dev in struct snd_soc_jack_gpio before calling snd_soc_jack_add_gpios(). Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'include')
-rw-r--r--include/sound/soc.h16
1 files changed, 15 insertions, 1 deletions
diff --git a/include/sound/soc.h b/include/sound/soc.h
index c6bd40f2c40b..61bea882a74b 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -453,6 +453,9 @@ int snd_soc_jack_get_type(struct snd_soc_jack *jack, int micbias_voltage);
453#ifdef CONFIG_GPIOLIB 453#ifdef CONFIG_GPIOLIB
454int snd_soc_jack_add_gpios(struct snd_soc_jack *jack, int count, 454int snd_soc_jack_add_gpios(struct snd_soc_jack *jack, int count,
455 struct snd_soc_jack_gpio *gpios); 455 struct snd_soc_jack_gpio *gpios);
456int snd_soc_jack_add_gpiods(struct device *gpiod_dev,
457 struct snd_soc_jack *jack,
458 int count, struct snd_soc_jack_gpio *gpios);
456void snd_soc_jack_free_gpios(struct snd_soc_jack *jack, int count, 459void snd_soc_jack_free_gpios(struct snd_soc_jack *jack, int count,
457 struct snd_soc_jack_gpio *gpios); 460 struct snd_soc_jack_gpio *gpios);
458#else 461#else
@@ -462,6 +465,13 @@ static inline int snd_soc_jack_add_gpios(struct snd_soc_jack *jack, int count,
462 return 0; 465 return 0;
463} 466}
464 467
468int snd_soc_jack_add_gpiods(struct device *gpiod_dev,
469 struct snd_soc_jack *jack,
470 int count, struct snd_soc_jack_gpio *gpios)
471{
472 return 0;
473}
474
465static inline void snd_soc_jack_free_gpios(struct snd_soc_jack *jack, int count, 475static inline void snd_soc_jack_free_gpios(struct snd_soc_jack *jack, int count,
466 struct snd_soc_jack_gpio *gpios) 476 struct snd_soc_jack_gpio *gpios)
467{ 477{
@@ -586,7 +596,9 @@ struct snd_soc_jack_zone {
586/** 596/**
587 * struct snd_soc_jack_gpio - Describes a gpio pin for jack detection 597 * struct snd_soc_jack_gpio - Describes a gpio pin for jack detection
588 * 598 *
589 * @gpio: gpio number 599 * @gpio: legacy gpio number
600 * @idx: gpio descriptor index within the GPIO consumer device
601 * @gpiod_dev GPIO consumer device
590 * @name: gpio name 602 * @name: gpio name
591 * @report: value to report when jack detected 603 * @report: value to report when jack detected
592 * @invert: report presence in low state 604 * @invert: report presence in low state
@@ -598,6 +610,8 @@ struct snd_soc_jack_zone {
598 */ 610 */
599struct snd_soc_jack_gpio { 611struct snd_soc_jack_gpio {
600 unsigned int gpio; 612 unsigned int gpio;
613 unsigned int idx;
614 struct device *gpiod_dev;
601 const char *name; 615 const char *name;
602 int report; 616 int report;
603 int invert; 617 int invert;