From: Tomi Valkeinen Date: Thu, 24 Apr 2014 09:36:52 +0000 (+0300) Subject: OMAPDSS: panel-dpi: use gpiod for enable gpio X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=56610d9c11b4798d72e2cca4189392c21dc77265;p=linux-beck.git OMAPDSS: panel-dpi: use gpiod for enable gpio The new gpiod API supports automatic handling of active-high/active-low with DT. To make it possible to use that when booting with DT, change the panel-dpi's handling of the enable GPIO to use gpiod. Signed-off-by: Tomi Valkeinen --- diff --git a/drivers/video/fbdev/omap2/displays-new/panel-dpi.c b/drivers/video/fbdev/omap2/displays-new/panel-dpi.c index 5f8f7e7c81ef..d379dec3bd4a 100644 --- a/drivers/video/fbdev/omap2/displays-new/panel-dpi.c +++ b/drivers/video/fbdev/omap2/displays-new/panel-dpi.c @@ -25,8 +25,10 @@ struct panel_drv_data { struct omap_video_timings videomode; + /* used for non-DT boot, to be removed */ int backlight_gpio; - int enable_gpio; + + struct gpio_desc *enable_gpio; }; #define to_panel_data(p) container_of(p, struct panel_drv_data, dssdev) @@ -77,8 +79,8 @@ static int panel_dpi_enable(struct omap_dss_device *dssdev) if (r) return r; - if (gpio_is_valid(ddata->enable_gpio)) - gpio_set_value_cansleep(ddata->enable_gpio, 1); + if (ddata->enable_gpio) + gpiod_set_value_cansleep(ddata->enable_gpio, 1); if (gpio_is_valid(ddata->backlight_gpio)) gpio_set_value_cansleep(ddata->backlight_gpio, 1); @@ -96,8 +98,8 @@ static void panel_dpi_disable(struct omap_dss_device *dssdev) if (!omapdss_device_is_enabled(dssdev)) return; - if (gpio_is_valid(ddata->enable_gpio)) - gpio_set_value_cansleep(ddata->enable_gpio, 0); + if (ddata->enable_gpio) + gpiod_set_value_cansleep(ddata->enable_gpio, 0); if (gpio_is_valid(ddata->backlight_gpio)) gpio_set_value_cansleep(ddata->backlight_gpio, 0); @@ -156,6 +158,7 @@ static int panel_dpi_probe_pdata(struct platform_device *pdev) struct panel_drv_data *ddata = platform_get_drvdata(pdev); struct omap_dss_device *dssdev, *in; struct videomode vm; + int r; pdata = dev_get_platdata(&pdev->dev); @@ -176,10 +179,20 @@ static int panel_dpi_probe_pdata(struct platform_device *pdev) dssdev = &ddata->dssdev; dssdev->name = pdata->name; - ddata->enable_gpio = pdata->enable_gpio; + r = devm_gpio_request_one(&pdev->dev, pdata->enable_gpio, + GPIOF_OUT_INIT_LOW, "panel enable"); + if (r) + goto err_gpio; + + ddata->enable_gpio = gpio_to_desc(pdata->enable_gpio); + ddata->backlight_gpio = pdata->backlight_gpio; return 0; + +err_gpio: + omap_dss_put_device(ddata->in); + return r; } static int panel_dpi_probe(struct platform_device *pdev) @@ -202,13 +215,6 @@ static int panel_dpi_probe(struct platform_device *pdev) return -ENODEV; } - if (gpio_is_valid(ddata->enable_gpio)) { - r = devm_gpio_request_one(&pdev->dev, ddata->enable_gpio, - GPIOF_OUT_INIT_LOW, "panel enable"); - if (r) - goto err_gpio; - } - if (gpio_is_valid(ddata->backlight_gpio)) { r = devm_gpio_request_one(&pdev->dev, ddata->backlight_gpio, GPIOF_OUT_INIT_LOW, "panel backlight");