linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ASoC: tegra: Read and use the GPIO flags of the headphone detect
@ 2014-10-21 15:33 Alban Bedel
  2014-10-21 16:14 ` Stephen Warren
  2014-10-21 21:23 ` Mark Brown
  0 siblings, 2 replies; 3+ messages in thread
From: Alban Bedel @ 2014-10-21 15:33 UTC (permalink / raw)
  To: linux-kernel
  Cc: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	Stephen Warren, Thierry Reding, Alexandre Courbot, Alban Bedel,
	Lars-Peter Clausen, alsa-devel, linux-tegra

The headphone detect was hardcoded to low-active, use the flags from
DT to allow high-active as well.

Signed-off-by: Alban Bedel <alban.bedel@avionic-design.de>
---
 sound/soc/tegra/tegra_rt5640.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/sound/soc/tegra/tegra_rt5640.c b/sound/soc/tegra/tegra_rt5640.c
index a689883..4ebe387 100644
--- a/sound/soc/tegra/tegra_rt5640.c
+++ b/sound/soc/tegra/tegra_rt5640.c
@@ -44,6 +44,7 @@
 struct tegra_rt5640 {
 	struct tegra_asoc_utils_data util_data;
 	int gpio_hp_det;
+	enum of_gpio_flags gpio_hp_det_flags;
 };
 
 static int tegra_rt5640_asoc_hw_params(struct snd_pcm_substream *substream,
@@ -119,6 +120,8 @@ static int tegra_rt5640_asoc_init(struct snd_soc_pcm_runtime *rtd)
 
 	if (gpio_is_valid(machine->gpio_hp_det)) {
 		tegra_rt5640_hp_jack_gpio.gpio = machine->gpio_hp_det;
+		tegra_rt5640_hp_jack_gpio.invert =
+			!!(machine->gpio_hp_det_flags & OF_GPIO_ACTIVE_LOW);
 		snd_soc_jack_add_gpios(&tegra_rt5640_hp_jack,
 						1,
 						&tegra_rt5640_hp_jack_gpio);
@@ -180,7 +183,8 @@ static int tegra_rt5640_probe(struct platform_device *pdev)
 	platform_set_drvdata(pdev, card);
 	snd_soc_card_set_drvdata(card, machine);
 
-	machine->gpio_hp_det = of_get_named_gpio(np, "nvidia,hp-det-gpios", 0);
+	machine->gpio_hp_det = of_get_named_gpio_flags(
+		np, "nvidia,hp-det-gpios", 0, &machine->gpio_hp_det_flags);
 	if (machine->gpio_hp_det == -EPROBE_DEFER)
 		return -EPROBE_DEFER;
 
-- 
2.1.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ASoC: tegra: Read and use the GPIO flags of the headphone detect
  2014-10-21 15:33 [PATCH] ASoC: tegra: Read and use the GPIO flags of the headphone detect Alban Bedel
@ 2014-10-21 16:14 ` Stephen Warren
  2014-10-21 21:23 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Stephen Warren @ 2014-10-21 16:14 UTC (permalink / raw)
  To: Alban Bedel, linux-kernel
  Cc: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	Thierry Reding, Alexandre Courbot, Lars-Peter Clausen, alsa-devel,
	linux-tegra

On 10/21/2014 09:33 AM, Alban Bedel wrote:
> The headphone detect was hardcoded to low-active, use the flags from
> DT to allow high-active as well.

> diff --git a/sound/soc/tegra/tegra_rt5640.c b/sound/soc/tegra/tegra_rt5640.c

> @@ -44,6 +44,7 @@
>   struct tegra_rt5640 {
>   	struct tegra_asoc_utils_data util_data;
>   	int gpio_hp_det;
> +	enum of_gpio_flags gpio_hp_det_flags;

I have no idea why that's an enum if it's meant to be interpreted as a 
bit mask, but that's an issue with of_gpio.h, not this patch.

Acked-by: Stephen Warren <swarren@nvidia.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ASoC: tegra: Read and use the GPIO flags of the headphone detect
  2014-10-21 15:33 [PATCH] ASoC: tegra: Read and use the GPIO flags of the headphone detect Alban Bedel
  2014-10-21 16:14 ` Stephen Warren
@ 2014-10-21 21:23 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2014-10-21 21:23 UTC (permalink / raw)
  To: Alban Bedel
  Cc: linux-kernel, Liam Girdwood, Jaroslav Kysela, Takashi Iwai,
	Stephen Warren, Thierry Reding, Alexandre Courbot,
	Lars-Peter Clausen, alsa-devel, linux-tegra

[-- Attachment #1: Type: text/plain, Size: 185 bytes --]

On Tue, Oct 21, 2014 at 05:33:29PM +0200, Alban Bedel wrote:
> The headphone detect was hardcoded to low-active, use the flags from
> DT to allow high-active as well.

Applied, thanks.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-10-21 21:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-21 15:33 [PATCH] ASoC: tegra: Read and use the GPIO flags of the headphone detect Alban Bedel
2014-10-21 16:14 ` Stephen Warren
2014-10-21 21:23 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).