aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>2015-05-19 03:48:08 -0400
committerMark Brown <broonie@kernel.org>2015-05-20 14:08:05 -0400
commit0a8ba6eeb6501a77619f49440c85dad14fe9c7a2 (patch)
tree02d6e2390f83c199ff63364e94d85e3961a7208f
parent5edf1e06927caba17ffa4489f2d81700cc932969 (diff)
ASoC: rx51: use flags argument of devm_gpiod_get to set direction
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. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Acked-by: Jarkko Nikula <jarkko.nikula@bitmer.com> Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--sound/soc/omap/rx51.c30
1 files 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)
455 snd_soc_card_set_drvdata(card, pdata); 455 snd_soc_card_set_drvdata(card, pdata);
456 456
457 pdata->tvout_selection_gpio = devm_gpiod_get(card->dev, 457 pdata->tvout_selection_gpio = devm_gpiod_get(card->dev,
458 "tvout-selection"); 458 "tvout-selection",
459 GPIOD_OUT_LOW);
459 if (IS_ERR(pdata->tvout_selection_gpio)) { 460 if (IS_ERR(pdata->tvout_selection_gpio)) {
460 dev_err(card->dev, "could not get tvout selection gpio\n"); 461 dev_err(card->dev, "could not get tvout selection gpio\n");
461 return PTR_ERR(pdata->tvout_selection_gpio); 462 return PTR_ERR(pdata->tvout_selection_gpio);
462 } 463 }
463 464
464 err = gpiod_direction_output(pdata->tvout_selection_gpio, 0);
465 if (err) {
466 dev_err(card->dev, "could not setup tvout selection gpio\n");
467 return err;
468 }
469
470 pdata->jack_detection_gpio = devm_gpiod_get(card->dev, 465 pdata->jack_detection_gpio = devm_gpiod_get(card->dev,
471 "jack-detection"); 466 "jack-detection",
467 GPIOD_ASIS);
472 if (IS_ERR(pdata->jack_detection_gpio)) { 468 if (IS_ERR(pdata->jack_detection_gpio)) {
473 dev_err(card->dev, "could not get jack detection gpio\n"); 469 dev_err(card->dev, "could not get jack detection gpio\n");
474 return PTR_ERR(pdata->jack_detection_gpio); 470 return PTR_ERR(pdata->jack_detection_gpio);
475 } 471 }
476 472
477 pdata->eci_sw_gpio = devm_gpiod_get(card->dev, "eci-switch"); 473 pdata->eci_sw_gpio = devm_gpiod_get(card->dev, "eci-switch",
474 GPIOD_OUT_HIGH);
478 if (IS_ERR(pdata->eci_sw_gpio)) { 475 if (IS_ERR(pdata->eci_sw_gpio)) {
479 dev_err(card->dev, "could not get eci switch gpio\n"); 476 dev_err(card->dev, "could not get eci switch gpio\n");
480 return PTR_ERR(pdata->eci_sw_gpio); 477 return PTR_ERR(pdata->eci_sw_gpio);
481 } 478 }
482 479
483 err = gpiod_direction_output(pdata->eci_sw_gpio, 1);
484 if (err) {
485 dev_err(card->dev, "could not setup eci switch gpio\n");
486 return err;
487 }
488
489 pdata->speaker_amp_gpio = devm_gpiod_get(card->dev, 480 pdata->speaker_amp_gpio = devm_gpiod_get(card->dev,
490 "speaker-amplifier"); 481 "speaker-amplifier",
482 GPIOD_OUT_LOW);
491 if (IS_ERR(pdata->speaker_amp_gpio)) { 483 if (IS_ERR(pdata->speaker_amp_gpio)) {
492 dev_err(card->dev, "could not get speaker enable gpio\n"); 484 dev_err(card->dev, "could not get speaker enable gpio\n");
493 return PTR_ERR(pdata->speaker_amp_gpio); 485 return PTR_ERR(pdata->speaker_amp_gpio);
494 } 486 }
495 487
496 err = gpiod_direction_output(pdata->speaker_amp_gpio, 0);
497 if (err) {
498 dev_err(card->dev, "could not setup speaker enable gpio\n");
499 return err;
500 }
501
502 err = devm_snd_soc_register_card(card->dev, card); 488 err = devm_snd_soc_register_card(card->dev, card);
503 if (err) { 489 if (err) {
504 dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", err); 490 dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", err);