diff options
author | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2014-05-15 05:50:00 -0400 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2014-05-20 07:39:39 -0400 |
commit | 1b71f1047ee17f4ba48097f134f894d7289fa7a1 (patch) | |
tree | 40a052e2ebb4bf3031dcb9751e193b3299fa5e07 /drivers/video | |
parent | fbf7309823a15da2b96e8e15781b8ac9074b44c0 (diff) |
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) | |||
159 | if (omapdss_device_is_enabled(dssdev)) | 159 | if (omapdss_device_is_enabled(dssdev)) |
160 | return 0; | 160 | return 0; |
161 | 161 | ||
162 | in->ops.dpi->set_data_lines(in, ddata->data_lines); | 162 | if (ddata->data_lines) |
163 | in->ops.dpi->set_data_lines(in, ddata->data_lines); | ||
163 | in->ops.dpi->set_timings(in, &ddata->videomode); | 164 | in->ops.dpi->set_timings(in, &ddata->videomode); |
164 | 165 | ||
165 | r = in->ops.dpi->enable(in); | 166 | r = in->ops.dpi->enable(in); |
@@ -277,6 +278,35 @@ err_gpio: | |||
277 | return r; | 278 | return r; |
278 | } | 279 | } |
279 | 280 | ||
281 | static int lb035q02_probe_of(struct spi_device *spi) | ||
282 | { | ||
283 | struct device_node *node = spi->dev.of_node; | ||
284 | struct panel_drv_data *ddata = dev_get_drvdata(&spi->dev); | ||
285 | struct omap_dss_device *in; | ||
286 | struct gpio_desc *gpio; | ||
287 | |||
288 | gpio = devm_gpiod_get(&spi->dev, "enable"); | ||
289 | if (IS_ERR(gpio)) { | ||
290 | dev_err(&spi->dev, "failed to parse enable gpio\n"); | ||
291 | return PTR_ERR(gpio); | ||
292 | } else { | ||
293 | gpiod_direction_output(gpio, 0); | ||
294 | ddata->enable_gpio = gpio; | ||
295 | } | ||
296 | |||
297 | ddata->backlight_gpio = -ENOENT; | ||
298 | |||
299 | in = omapdss_of_find_source_for_first_ep(node); | ||
300 | if (IS_ERR(in)) { | ||
301 | dev_err(&spi->dev, "failed to find video source\n"); | ||
302 | return PTR_ERR(in); | ||
303 | } | ||
304 | |||
305 | ddata->in = in; | ||
306 | |||
307 | return 0; | ||
308 | } | ||
309 | |||
280 | static int lb035q02_panel_spi_probe(struct spi_device *spi) | 310 | static int lb035q02_panel_spi_probe(struct spi_device *spi) |
281 | { | 311 | { |
282 | struct panel_drv_data *ddata; | 312 | struct panel_drv_data *ddata; |
@@ -295,6 +325,10 @@ static int lb035q02_panel_spi_probe(struct spi_device *spi) | |||
295 | r = lb035q02_probe_pdata(spi); | 325 | r = lb035q02_probe_pdata(spi); |
296 | if (r) | 326 | if (r) |
297 | return r; | 327 | return r; |
328 | } else if (spi->dev.of_node) { | ||
329 | r = lb035q02_probe_of(spi); | ||
330 | if (r) | ||
331 | return r; | ||
298 | } else { | 332 | } else { |
299 | return -ENODEV; | 333 | return -ENODEV; |
300 | } | 334 | } |
@@ -346,17 +380,26 @@ static int lb035q02_panel_spi_remove(struct spi_device *spi) | |||
346 | return 0; | 380 | return 0; |
347 | } | 381 | } |
348 | 382 | ||
383 | static const struct of_device_id lb035q02_of_match[] = { | ||
384 | { .compatible = "omapdss,lgphilips,lb035q02", }, | ||
385 | {}, | ||
386 | }; | ||
387 | |||
388 | MODULE_DEVICE_TABLE(of, lb035q02_of_match); | ||
389 | |||
349 | static struct spi_driver lb035q02_spi_driver = { | 390 | static struct spi_driver lb035q02_spi_driver = { |
350 | .probe = lb035q02_panel_spi_probe, | 391 | .probe = lb035q02_panel_spi_probe, |
351 | .remove = lb035q02_panel_spi_remove, | 392 | .remove = lb035q02_panel_spi_remove, |
352 | .driver = { | 393 | .driver = { |
353 | .name = "panel_lgphilips_lb035q02", | 394 | .name = "panel_lgphilips_lb035q02", |
354 | .owner = THIS_MODULE, | 395 | .owner = THIS_MODULE, |
396 | .of_match_table = lb035q02_of_match, | ||
355 | }, | 397 | }, |
356 | }; | 398 | }; |
357 | 399 | ||
358 | module_spi_driver(lb035q02_spi_driver); | 400 | module_spi_driver(lb035q02_spi_driver); |
359 | 401 | ||
402 | MODULE_ALIAS("spi:lgphilips,lb035q02"); | ||
360 | MODULE_AUTHOR("Tomi Valkeinen <tomi.valkeinen@ti.com>"); | 403 | MODULE_AUTHOR("Tomi Valkeinen <tomi.valkeinen@ti.com>"); |
361 | MODULE_DESCRIPTION("LG.Philips LB035Q02 LCD Panel driver"); | 404 | MODULE_DESCRIPTION("LG.Philips LB035Q02 LCD Panel driver"); |
362 | MODULE_LICENSE("GPL"); | 405 | MODULE_LICENSE("GPL"); |