Commit 0a8ba6ee authored by Uwe Kleine-König's avatar Uwe Kleine-König Committed by Mark Brown

ASoC: rx51: use flags argument of devm_gpiod_get to set direction

Since 39b2bbe3 (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: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: default avatarJarkko Nikula <jarkko.nikula@bitmer.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 5edf1e06
...@@ -455,50 +455,36 @@ static int rx51_soc_probe(struct platform_device *pdev) ...@@ -455,50 +455,36 @@ static int rx51_soc_probe(struct platform_device *pdev)
snd_soc_card_set_drvdata(card, pdata); snd_soc_card_set_drvdata(card, pdata);
pdata->tvout_selection_gpio = devm_gpiod_get(card->dev, pdata->tvout_selection_gpio = devm_gpiod_get(card->dev,
"tvout-selection"); "tvout-selection",
GPIOD_OUT_LOW);
if (IS_ERR(pdata->tvout_selection_gpio)) { if (IS_ERR(pdata->tvout_selection_gpio)) {
dev_err(card->dev, "could not get tvout selection gpio\n"); dev_err(card->dev, "could not get tvout selection gpio\n");
return PTR_ERR(pdata->tvout_selection_gpio); 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, pdata->jack_detection_gpio = devm_gpiod_get(card->dev,
"jack-detection"); "jack-detection",
GPIOD_ASIS);
if (IS_ERR(pdata->jack_detection_gpio)) { if (IS_ERR(pdata->jack_detection_gpio)) {
dev_err(card->dev, "could not get jack detection gpio\n"); dev_err(card->dev, "could not get jack detection gpio\n");
return PTR_ERR(pdata->jack_detection_gpio); 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)) { if (IS_ERR(pdata->eci_sw_gpio)) {
dev_err(card->dev, "could not get eci switch gpio\n"); dev_err(card->dev, "could not get eci switch gpio\n");
return PTR_ERR(pdata->eci_sw_gpio); 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, pdata->speaker_amp_gpio = devm_gpiod_get(card->dev,
"speaker-amplifier"); "speaker-amplifier",
GPIOD_OUT_LOW);
if (IS_ERR(pdata->speaker_amp_gpio)) { if (IS_ERR(pdata->speaker_amp_gpio)) {
dev_err(card->dev, "could not get speaker enable gpio\n"); dev_err(card->dev, "could not get speaker enable gpio\n");
return PTR_ERR(pdata->speaker_amp_gpio); 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); err = devm_snd_soc_register_card(card->dev, card);
if (err) { if (err) {
dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", err); dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", err);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment