diff options
author | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2015-02-11 11:32:53 -0500 |
---|---|---|
committer | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2015-07-06 04:10:21 -0400 |
commit | 26a5bd26499fba331ecaa1e8ce8cc2b8c6fac569 (patch) | |
tree | bf61d565d6b910e87fea709bd53a367cc7177d6a /drivers/gpu/drm/tilcdc | |
parent | 89ae3d3b9a384e75158f71ea9b878c8a45f3d582 (diff) |
drm/tilcdc: panel: make better use of gpiod API
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.
Furthermore there is devm_gpiod_get_optional which is designed to get
optional gpios.
Simplify driver accordingly.
Acked-by: Alexandre Courbot <acourbot@nvidia.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Diffstat (limited to 'drivers/gpu/drm/tilcdc')
-rw-r--r-- | drivers/gpu/drm/tilcdc/tilcdc_panel.c | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_panel.c b/drivers/gpu/drm/tilcdc/tilcdc_panel.c index 7a0315855e90..0af8bed7ce1e 100644 --- a/drivers/gpu/drm/tilcdc/tilcdc_panel.c +++ b/drivers/gpu/drm/tilcdc/tilcdc_panel.c | |||
@@ -375,25 +375,17 @@ static int panel_probe(struct platform_device *pdev) | |||
375 | dev_info(&pdev->dev, "found backlight\n"); | 375 | dev_info(&pdev->dev, "found backlight\n"); |
376 | } | 376 | } |
377 | 377 | ||
378 | panel_mod->enable_gpio = devm_gpiod_get(&pdev->dev, "enable"); | 378 | panel_mod->enable_gpio = devm_gpiod_get_optional(&pdev->dev, "enable", |
379 | GPIOD_OUT_LOW); | ||
379 | if (IS_ERR(panel_mod->enable_gpio)) { | 380 | if (IS_ERR(panel_mod->enable_gpio)) { |
380 | ret = PTR_ERR(panel_mod->enable_gpio); | 381 | ret = PTR_ERR(panel_mod->enable_gpio); |
381 | if (ret != -ENOENT) { | 382 | dev_err(&pdev->dev, "failed to request enable GPIO\n"); |
382 | dev_err(&pdev->dev, "failed to request enable GPIO\n"); | 383 | goto fail_backlight; |
383 | goto fail_backlight; | ||
384 | } | ||
385 | |||
386 | /* Optional GPIO is not here, continue silently. */ | ||
387 | panel_mod->enable_gpio = NULL; | ||
388 | } else { | ||
389 | ret = gpiod_direction_output(panel_mod->enable_gpio, 0); | ||
390 | if (ret < 0) { | ||
391 | dev_err(&pdev->dev, "failed to setup GPIO\n"); | ||
392 | goto fail_backlight; | ||
393 | } | ||
394 | dev_info(&pdev->dev, "found enable GPIO\n"); | ||
395 | } | 384 | } |
396 | 385 | ||
386 | if (panel_mod->enable_gpio) | ||
387 | dev_info(&pdev->dev, "found enable GPIO\n"); | ||
388 | |||
397 | mod = &panel_mod->base; | 389 | mod = &panel_mod->base; |
398 | pdev->dev.platform_data = mod; | 390 | pdev->dev.platform_data = mod; |
399 | 391 | ||