45 lines
1.3 KiB
Diff
45 lines
1.3 KiB
Diff
From f4f362ffaf99101d69462b0579fd48fa632ef1dc Mon Sep 17 00:00:00 2001
|
|
From: Tobias Schramm <t.schramm@manjaro.org>
|
|
Date: Thu, 28 May 2020 14:36:47 +0200
|
|
Subject: [PATCH 6/8] ASoC: soc-jack.c: supported inverted jack detect GPIOs
|
|
|
|
Signed-off-by: Tobias Schramm <t.schramm@manjaro.org>
|
|
---
|
|
sound/soc/soc-jack.c | 7 ++++---
|
|
1 file changed, 4 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/sound/soc/soc-jack.c b/sound/soc/soc-jack.c
|
|
index 0f1820f36b4d..8d9d77814f33 100644
|
|
--- a/sound/soc/soc-jack.c
|
|
+++ b/sound/soc/soc-jack.c
|
|
@@ -216,8 +216,6 @@ static void snd_soc_jack_gpio_detect(struct snd_soc_jack_gpio *gpio)
|
|
int report;
|
|
|
|
enable = gpiod_get_value_cansleep(gpio->desc);
|
|
- if (gpio->invert)
|
|
- enable = !enable;
|
|
|
|
if (enable)
|
|
report = gpio->report;
|
|
@@ -346,6 +344,9 @@ int snd_soc_jack_add_gpios(struct snd_soc_jack *jack, int count,
|
|
goto undo;
|
|
}
|
|
} else {
|
|
+ int flags = GPIOF_IN;
|
|
+ if (gpios[i].invert)
|
|
+ flags |= GPIOF_ACTIVE_LOW;
|
|
/* legacy GPIO number */
|
|
if (!gpio_is_valid(gpios[i].gpio)) {
|
|
dev_err(jack->card->dev,
|
|
@@ -355,7 +356,7 @@ int snd_soc_jack_add_gpios(struct snd_soc_jack *jack, int count,
|
|
goto undo;
|
|
}
|
|
|
|
- ret = gpio_request_one(gpios[i].gpio, GPIOF_IN,
|
|
+ ret = gpio_request_one(gpios[i].gpio, flags,
|
|
gpios[i].name);
|
|
if (ret)
|
|
goto undo;
|
|
--
|
|
2.28.0
|
|
|