All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: rx51: use flags argument of devm_gpiod_get to set direction
@ 2015-05-19  7:48 Uwe Kleine-König
  2015-05-19  8:16 ` Jarkko Nikula
  2015-05-20 18:09 ` Mark Brown
  0 siblings, 2 replies; 5+ messages in thread
From: Uwe Kleine-König @ 2015-05-19  7:48 UTC (permalink / raw)
  To: Peter Ujfalusi, Jarkko Nikula, Liam Girdwood, Mark Brown
  Cc: Sebastian Reichel, linux-omap, alsa-devel, kernel, Linus Walleij,
	Alexandre Courbot

Since 39b2bbe3d715 (gpio: add flags argument to gpiod_get*() functions)
which appeared in v3.17-rc1, the gpiod_get* functions take an additional
parameter that allows to specify direction and initial value for output.

Use this to simplify the driver. Furthermore this is one caller less
that stops us making the flags argument to gpiod_get*() mandatory.

Fixes: 386e81ab3b4d ("ASoC: omap: rx51: get GPIO numbers via gpiod API")
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 sound/soc/omap/rx51.c | 30 ++++++++----------------------
 1 file changed, 8 insertions(+), 22 deletions(-)

diff --git a/sound/soc/omap/rx51.c b/sound/soc/omap/rx51.c
index c2ddf0fbfa28..fded99362d39 100644
--- a/sound/soc/omap/rx51.c
+++ b/sound/soc/omap/rx51.c
@@ -455,50 +455,36 @@ static int rx51_soc_probe(struct platform_device *pdev)
 	snd_soc_card_set_drvdata(card, pdata);
 
 	pdata->tvout_selection_gpio = devm_gpiod_get(card->dev,
-						     "tvout-selection");
+						     "tvout-selection",
+						     GPIOD_OUT_LOW);
 	if (IS_ERR(pdata->tvout_selection_gpio)) {
 		dev_err(card->dev, "could not get tvout selection gpio\n");
 		return PTR_ERR(pdata->tvout_selection_gpio);
 	}
 
-	err = gpiod_direction_output(pdata->tvout_selection_gpio, 0);
-	if (err) {
-		dev_err(card->dev, "could not setup tvout selection gpio\n");
-		return err;
-	}
-
 	pdata->jack_detection_gpio = devm_gpiod_get(card->dev,
-						    "jack-detection");
+						    "jack-detection",
+						    GPIOD_ASIS);
 	if (IS_ERR(pdata->jack_detection_gpio)) {
 		dev_err(card->dev, "could not get jack detection gpio\n");
 		return PTR_ERR(pdata->jack_detection_gpio);
 	}
 
-	pdata->eci_sw_gpio = devm_gpiod_get(card->dev, "eci-switch");
+	pdata->eci_sw_gpio = devm_gpiod_get(card->dev, "eci-switch",
+					    GPIOD_OUT_HIGH);
 	if (IS_ERR(pdata->eci_sw_gpio)) {
 		dev_err(card->dev, "could not get eci switch gpio\n");
 		return PTR_ERR(pdata->eci_sw_gpio);
 	}
 
-	err = gpiod_direction_output(pdata->eci_sw_gpio, 1);
-	if (err) {
-		dev_err(card->dev, "could not setup eci switch gpio\n");
-		return err;
-	}
-
 	pdata->speaker_amp_gpio = devm_gpiod_get(card->dev,
-						 "speaker-amplifier");
+						 "speaker-amplifier",
+						 GPIOD_OUT_LOW);
 	if (IS_ERR(pdata->speaker_amp_gpio)) {
 		dev_err(card->dev, "could not get speaker enable gpio\n");
 		return PTR_ERR(pdata->speaker_amp_gpio);
 	}
 
-	err = gpiod_direction_output(pdata->speaker_amp_gpio, 0);
-	if (err) {
-		dev_err(card->dev, "could not setup speaker enable gpio\n");
-		return err;
-	}
-
 	err = devm_snd_soc_register_card(card->dev, card);
 	if (err) {
 		dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", err);
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH] ASoC: rx51: use flags argument of devm_gpiod_get to set direction
  2015-05-19  7:48 [PATCH] ASoC: rx51: use flags argument of devm_gpiod_get to set direction Uwe Kleine-König
@ 2015-05-19  8:16 ` Jarkko Nikula
  2015-05-19 10:44   ` Mark Brown
  2015-05-20 18:09 ` Mark Brown
  1 sibling, 1 reply; 5+ messages in thread
From: Jarkko Nikula @ 2015-05-19  8:16 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Alexandre Courbot, alsa-devel, Linus Walleij, Liam Girdwood,
	Sebastian Reichel, Peter Ujfalusi, Mark Brown, kernel,
	linux-omap

On Tue, May 19, 2015 at 09:48:08AM +0200, Uwe Kleine-König wrote:
> Since 39b2bbe3d715 (gpio: add flags argument to gpiod_get*() functions)
> which appeared in v3.17-rc1, the gpiod_get* functions take an additional
> parameter that allows to specify direction and initial value for output.
> 
> Use this to simplify the driver. Furthermore this is one caller less
> that stops us making the flags argument to gpiod_get*() mandatory.
> 
> Fixes: 386e81ab3b4d ("ASoC: omap: rx51: get GPIO numbers via gpiod API")
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
>  sound/soc/omap/rx51.c | 30 ++++++++----------------------
>  1 file changed, 8 insertions(+), 22 deletions(-)
> 
I don't think Fixes tag is justified. Otherwise than that

Acked-by: Jarkko Nikula <jarkko.nikula@bitmer.com

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

* Re: [PATCH] ASoC: rx51: use flags argument of devm_gpiod_get to set direction
  2015-05-19  8:16 ` Jarkko Nikula
@ 2015-05-19 10:44   ` Mark Brown
  2015-05-19 12:10     ` Uwe Kleine-König
  0 siblings, 1 reply; 5+ messages in thread
From: Mark Brown @ 2015-05-19 10:44 UTC (permalink / raw)
  To: Jarkko Nikula
  Cc: Uwe Kleine-König, Peter Ujfalusi, Liam Girdwood,
	Sebastian Reichel, linux-omap, alsa-devel, kernel, Linus Walleij,
	Alexandre Courbot

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

On Tue, May 19, 2015 at 11:16:50AM +0300, Jarkko Nikula wrote:

> I don't think Fixes tag is justified. Otherwise than that

Yes, I don't see any bug fixing here - am I missing something?

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

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

* Re: [PATCH] ASoC: rx51: use flags argument of devm_gpiod_get to set direction
  2015-05-19 10:44   ` Mark Brown
@ 2015-05-19 12:10     ` Uwe Kleine-König
  0 siblings, 0 replies; 5+ messages in thread
From: Uwe Kleine-König @ 2015-05-19 12:10 UTC (permalink / raw)
  To: Mark Brown
  Cc: Jarkko Nikula, Peter Ujfalusi, Liam Girdwood, Sebastian Reichel,
	linux-omap, alsa-devel, kernel, Linus Walleij, Alexandre Courbot

On Tue, May 19, 2015 at 11:44:58AM +0100, Mark Brown wrote:
> On Tue, May 19, 2015 at 11:16:50AM +0300, Jarkko Nikula wrote:
> 
> > I don't think Fixes tag is justified. Otherwise than that
> 
> Yes, I don't see any bug fixing here - am I missing something?
It only becomes a bug once the flags parameter becomes mandatory. But
right, currently it's not a bug, just inefficient use of the gpiod
stuff.

Feel free to drop the Fixes: on application.

Best regards
Uwe



-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH] ASoC: rx51: use flags argument of devm_gpiod_get to set direction
  2015-05-19  7:48 [PATCH] ASoC: rx51: use flags argument of devm_gpiod_get to set direction Uwe Kleine-König
  2015-05-19  8:16 ` Jarkko Nikula
@ 2015-05-20 18:09 ` Mark Brown
  1 sibling, 0 replies; 5+ messages in thread
From: Mark Brown @ 2015-05-20 18:09 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Peter Ujfalusi, Jarkko Nikula, Liam Girdwood, Sebastian Reichel,
	linux-omap, alsa-devel, kernel, Linus Walleij, Alexandre Courbot

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

On Tue, May 19, 2015 at 09:48:08AM +0200, Uwe Kleine-König wrote:
> Since 39b2bbe3d715 (gpio: add flags argument to gpiod_get*() functions)
> which appeared in v3.17-rc1, the gpiod_get* functions take an additional
> parameter that allows to specify direction and initial value for output.

Applied, thanks.

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

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

end of thread, other threads:[~2015-05-20 18:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-19  7:48 [PATCH] ASoC: rx51: use flags argument of devm_gpiod_get to set direction Uwe Kleine-König
2015-05-19  8:16 ` Jarkko Nikula
2015-05-19 10:44   ` Mark Brown
2015-05-19 12:10     ` Uwe Kleine-König
2015-05-20 18:09 ` Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.