summaryrefslogtreecommitdiffstats
path: root/include/sound
diff options
context:
space:
mode:
authorJarkko Nikula <jarkko.nikula@linux.intel.com>2014-05-26 13:34:37 +0200
committerMark Brown <broonie@linaro.org>2014-05-26 16:26:00 +0200
commitf025d3b9c64e1f7feb75a559d4a12f5f8c6a4a25 (patch)
tree819909f51afd408c50379e69c55d29337365d02c /include/sound
parentASoC: jack: Basic GPIO descriptor conversion (diff)
downloadlinux-f025d3b9c64e1f7feb75a559d4a12f5f8c6a4a25.tar.xz
linux-f025d3b9c64e1f7feb75a559d4a12f5f8c6a4a25.zip
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/sound')
-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);
#ifdef CONFIG_GPIOLIB
int snd_soc_jack_add_gpios(struct snd_soc_jack *jack, int count,
struct snd_soc_jack_gpio *gpios);
+int snd_soc_jack_add_gpiods(struct device *gpiod_dev,
+ struct snd_soc_jack *jack,
+ int count, struct snd_soc_jack_gpio *gpios);
void snd_soc_jack_free_gpios(struct snd_soc_jack *jack, int count,
struct snd_soc_jack_gpio *gpios);
#else
@@ -462,6 +465,13 @@ static inline int snd_soc_jack_add_gpios(struct snd_soc_jack *jack, int count,
return 0;
}
+int snd_soc_jack_add_gpiods(struct device *gpiod_dev,
+ struct snd_soc_jack *jack,
+ int count, struct snd_soc_jack_gpio *gpios)
+{
+ return 0;
+}
+
static inline void snd_soc_jack_free_gpios(struct snd_soc_jack *jack, int count,
struct snd_soc_jack_gpio *gpios)
{
@@ -586,7 +596,9 @@ struct snd_soc_jack_zone {
/**
* struct snd_soc_jack_gpio - Describes a gpio pin for jack detection
*
- * @gpio: gpio number
+ * @gpio: legacy gpio number
+ * @idx: gpio descriptor index within the GPIO consumer device
+ * @gpiod_dev GPIO consumer device
* @name: gpio name
* @report: value to report when jack detected
* @invert: report presence in low state
@@ -598,6 +610,8 @@ struct snd_soc_jack_zone {
*/
struct snd_soc_jack_gpio {
unsigned int gpio;
+ unsigned int idx;
+ struct device *gpiod_dev;
const char *name;
int report;
int invert;