aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
authorEzequiel Garcia <ezequiel@vanguardiasur.com.ar>2014-09-02 08:51:20 -0400
committerDave Airlie <airlied@redhat.com>2014-09-16 20:55:10 -0400
commit18c44db8cafe9bda4fcb51bfc05c1f1d7cefc44c (patch)
tree11e9acff4f78b2edee93676925a52122460c5788 /drivers/gpu/drm
parent971645d1fd734b8098a5113d61ab9ea93ce83921 (diff)
drm/tilcdc: panel: Fix backlight devicetree support
The current backlight support is broken; the driver expects a backlight-class in the panel devicetree node. Fix this by implementing it properly, getting an optional backlight from a phandle. This shouldn't cause any backward-compatibility DT issue because the current implementation doesn't work and is not even documented. Tested-by: Darren Etheridge <detheridge@ti.com> Tested-by: Johannes Pointner <johannes.pointner@br-automation.com> Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r--drivers/gpu/drm/tilcdc/tilcdc_panel.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_panel.c b/drivers/gpu/drm/tilcdc/tilcdc_panel.c
index c716c128ded2..3dcf08e4dc91 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_panel.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_panel.c
@@ -342,7 +342,7 @@ static struct tilcdc_panel_info *of_get_panel_info(struct device_node *np)
342 342
343static int panel_probe(struct platform_device *pdev) 343static int panel_probe(struct platform_device *pdev)
344{ 344{
345 struct device_node *node = pdev->dev.of_node; 345 struct device_node *bl_node, *node = pdev->dev.of_node;
346 struct panel_module *panel_mod; 346 struct panel_module *panel_mod;
347 struct tilcdc_module *mod; 347 struct tilcdc_module *mod;
348 struct pinctrl *pinctrl; 348 struct pinctrl *pinctrl;
@@ -358,6 +358,17 @@ static int panel_probe(struct platform_device *pdev)
358 if (!panel_mod) 358 if (!panel_mod)
359 return -ENOMEM; 359 return -ENOMEM;
360 360
361 bl_node = of_parse_phandle(node, "backlight", 0);
362 if (bl_node) {
363 panel_mod->backlight = of_find_backlight_by_node(bl_node);
364 of_node_put(bl_node);
365
366 if (!panel_mod->backlight)
367 return -EPROBE_DEFER;
368
369 dev_info(&pdev->dev, "found backlight\n");
370 }
371
361 mod = &panel_mod->base; 372 mod = &panel_mod->base;
362 pdev->dev.platform_data = mod; 373 pdev->dev.platform_data = mod;
363 374
@@ -381,10 +392,6 @@ static int panel_probe(struct platform_device *pdev)
381 392
382 mod->preferred_bpp = panel_mod->info->bpp; 393 mod->preferred_bpp = panel_mod->info->bpp;
383 394
384 panel_mod->backlight = of_find_backlight_by_node(node);
385 if (panel_mod->backlight)
386 dev_info(&pdev->dev, "found backlight\n");
387
388 return 0; 395 return 0;
389 396
390fail_timings: 397fail_timings:
@@ -392,6 +399,8 @@ fail_timings:
392 399
393fail_free: 400fail_free:
394 tilcdc_module_cleanup(mod); 401 tilcdc_module_cleanup(mod);
402 if (panel_mod->backlight)
403 put_device(&panel_mod->backlight->dev);
395 return ret; 404 return ret;
396} 405}
397 406
@@ -399,6 +408,10 @@ static int panel_remove(struct platform_device *pdev)
399{ 408{
400 struct tilcdc_module *mod = dev_get_platdata(&pdev->dev); 409 struct tilcdc_module *mod = dev_get_platdata(&pdev->dev);
401 struct panel_module *panel_mod = to_panel_module(mod); 410 struct panel_module *panel_mod = to_panel_module(mod);
411 struct backlight_device *backlight = panel_mod->backlight;
412
413 if (backlight)
414 put_device(&backlight->dev);
402 415
403 display_timings_release(panel_mod->timings); 416 display_timings_release(panel_mod->timings);
404 417