diff options
author | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2014-05-15 12:50:00 +0300 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2014-05-20 14:39:39 +0300 |
commit | 1b71f1047ee17f4ba48097f134f894d7289fa7a1 (patch) | |
tree | 40a052e2ebb4bf3031dcb9751e193b3299fa5e07 /drivers/video | |
parent | fbf7309823a15da2b96e8e15781b8ac9074b44c0 (diff) | |
download | linux-1b71f1047ee17f4ba48097f134f894d7289fa7a1.tar.bz2 |
OMAPDSS: panel-lgphilips-lb035q02: Add DT support
Add DT support for panel-lgphilips-lb035q02.
We disable the use of the backlight_gpio as it should be handled via
backlight framework with DT boots.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Tested-by: Florian Vaussard <florian.vaussard@epfl.ch>
Diffstat (limited to 'drivers/video')
-rw-r--r-- | drivers/video/fbdev/omap2/displays-new/panel-lgphilips-lb035q02.c | 45 |
1 files changed, 44 insertions, 1 deletions
diff --git a/drivers/video/fbdev/omap2/displays-new/panel-lgphilips-lb035q02.c b/drivers/video/fbdev/omap2/displays-new/panel-lgphilips-lb035q02.c index 6e6acd696a70..cc5b5124e0b4 100644 --- a/drivers/video/fbdev/omap2/displays-new/panel-lgphilips-lb035q02.c +++ b/drivers/video/fbdev/omap2/displays-new/panel-lgphilips-lb035q02.c @@ -159,7 +159,8 @@ static int lb035q02_enable(struct omap_dss_device *dssdev) if (omapdss_device_is_enabled(dssdev)) return 0; - in->ops.dpi->set_data_lines(in, ddata->data_lines); + if (ddata->data_lines) + in->ops.dpi->set_data_lines(in, ddata->data_lines); in->ops.dpi->set_timings(in, &ddata->videomode); r = in->ops.dpi->enable(in); @@ -277,6 +278,35 @@ err_gpio: return r; } +static int lb035q02_probe_of(struct spi_device *spi) +{ + struct device_node *node = spi->dev.of_node; + struct panel_drv_data *ddata = dev_get_drvdata(&spi->dev); + struct omap_dss_device *in; + struct gpio_desc *gpio; + + gpio = devm_gpiod_get(&spi->dev, "enable"); + if (IS_ERR(gpio)) { + dev_err(&spi->dev, "failed to parse enable gpio\n"); + return PTR_ERR(gpio); + } else { + gpiod_direction_output(gpio, 0); + ddata->enable_gpio = gpio; + } + + ddata->backlight_gpio = -ENOENT; + + in = omapdss_of_find_source_for_first_ep(node); + if (IS_ERR(in)) { + dev_err(&spi->dev, "failed to find video source\n"); + return PTR_ERR(in); + } + + ddata->in = in; + + return 0; +} + static int lb035q02_panel_spi_probe(struct spi_device *spi) { struct panel_drv_data *ddata; @@ -295,6 +325,10 @@ static int lb035q02_panel_spi_probe(struct spi_device *spi) r = lb035q02_probe_pdata(spi); if (r) return r; + } else if (spi->dev.of_node) { + r = lb035q02_probe_of(spi); + if (r) + return r; } else { return -ENODEV; } @@ -346,17 +380,26 @@ static int lb035q02_panel_spi_remove(struct spi_device *spi) return 0; } +static const struct of_device_id lb035q02_of_match[] = { + { .compatible = "omapdss,lgphilips,lb035q02", }, + {}, +}; + +MODULE_DEVICE_TABLE(of, lb035q02_of_match); + static struct spi_driver lb035q02_spi_driver = { .probe = lb035q02_panel_spi_probe, .remove = lb035q02_panel_spi_remove, .driver = { .name = "panel_lgphilips_lb035q02", .owner = THIS_MODULE, + .of_match_table = lb035q02_of_match, }, }; module_spi_driver(lb035q02_spi_driver); +MODULE_ALIAS("spi:lgphilips,lb035q02"); MODULE_AUTHOR("Tomi Valkeinen <tomi.valkeinen@ti.com>"); MODULE_DESCRIPTION("LG.Philips LB035Q02 LCD Panel driver"); MODULE_LICENSE("GPL"); |