Commit fbf73098 authored by Tomi Valkeinen's avatar Tomi Valkeinen

OMAPDSS: panel-lgphilips-lb035q02: 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 driver's handling of the enable GPIO to use gpiod.
Signed-off-by: default avatarTomi Valkeinen <tomi.valkeinen@ti.com>
parent e2ccb0ee
...@@ -50,9 +50,10 @@ struct panel_drv_data { ...@@ -50,9 +50,10 @@ struct panel_drv_data {
struct omap_video_timings videomode; struct omap_video_timings videomode;
int reset_gpio; /* used for non-DT boot, to be removed */
int backlight_gpio; int backlight_gpio;
int enable_gpio;
struct gpio_desc *enable_gpio;
}; };
#define to_panel_data(p) container_of(p, struct panel_drv_data, dssdev) #define to_panel_data(p) container_of(p, struct panel_drv_data, dssdev)
...@@ -165,8 +166,8 @@ static int lb035q02_enable(struct omap_dss_device *dssdev) ...@@ -165,8 +166,8 @@ static int lb035q02_enable(struct omap_dss_device *dssdev)
if (r) if (r)
return r; return r;
if (gpio_is_valid(ddata->enable_gpio)) if (ddata->enable_gpio)
gpio_set_value_cansleep(ddata->enable_gpio, 1); gpiod_set_value_cansleep(ddata->enable_gpio, 1);
if (gpio_is_valid(ddata->backlight_gpio)) if (gpio_is_valid(ddata->backlight_gpio))
gpio_set_value_cansleep(ddata->backlight_gpio, 1); gpio_set_value_cansleep(ddata->backlight_gpio, 1);
...@@ -184,8 +185,8 @@ static void lb035q02_disable(struct omap_dss_device *dssdev) ...@@ -184,8 +185,8 @@ static void lb035q02_disable(struct omap_dss_device *dssdev)
if (!omapdss_device_is_enabled(dssdev)) if (!omapdss_device_is_enabled(dssdev))
return; return;
if (gpio_is_valid(ddata->enable_gpio)) if (ddata->enable_gpio)
gpio_set_value_cansleep(ddata->enable_gpio, 0); gpiod_set_value_cansleep(ddata->enable_gpio, 0);
if (gpio_is_valid(ddata->backlight_gpio)) if (gpio_is_valid(ddata->backlight_gpio))
gpio_set_value_cansleep(ddata->backlight_gpio, 0); gpio_set_value_cansleep(ddata->backlight_gpio, 0);
...@@ -243,6 +244,7 @@ static int lb035q02_probe_pdata(struct spi_device *spi) ...@@ -243,6 +244,7 @@ static int lb035q02_probe_pdata(struct spi_device *spi)
const struct panel_lb035q02_platform_data *pdata; const struct panel_lb035q02_platform_data *pdata;
struct panel_drv_data *ddata = dev_get_drvdata(&spi->dev); struct panel_drv_data *ddata = dev_get_drvdata(&spi->dev);
struct omap_dss_device *dssdev, *in; struct omap_dss_device *dssdev, *in;
int r;
pdata = dev_get_platdata(&spi->dev); pdata = dev_get_platdata(&spi->dev);
...@@ -260,10 +262,19 @@ static int lb035q02_probe_pdata(struct spi_device *spi) ...@@ -260,10 +262,19 @@ static int lb035q02_probe_pdata(struct spi_device *spi)
dssdev = &ddata->dssdev; dssdev = &ddata->dssdev;
dssdev->name = pdata->name; dssdev->name = pdata->name;
ddata->enable_gpio = pdata->enable_gpio; r = devm_gpio_request_one(&spi->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; ddata->backlight_gpio = pdata->backlight_gpio;
return 0; return 0;
err_gpio:
omap_dss_put_device(ddata->in);
return r;
} }
static int lb035q02_panel_spi_probe(struct spi_device *spi) static int lb035q02_panel_spi_probe(struct spi_device *spi)
...@@ -288,13 +299,6 @@ static int lb035q02_panel_spi_probe(struct spi_device *spi) ...@@ -288,13 +299,6 @@ static int lb035q02_panel_spi_probe(struct spi_device *spi)
return -ENODEV; return -ENODEV;
} }
if (gpio_is_valid(ddata->enable_gpio)) {
r = devm_gpio_request_one(&spi->dev, ddata->enable_gpio,
GPIOF_OUT_INIT_LOW, "panel enable");
if (r)
goto err_gpio;
}
if (gpio_is_valid(ddata->backlight_gpio)) { if (gpio_is_valid(ddata->backlight_gpio)) {
r = devm_gpio_request_one(&spi->dev, ddata->backlight_gpio, r = devm_gpio_request_one(&spi->dev, ddata->backlight_gpio,
GPIOF_OUT_INIT_LOW, "panel backlight"); GPIOF_OUT_INIT_LOW, "panel backlight");
......
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