mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	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>
This commit is contained in:
		
							parent
							
								
									971645d1fd
								
							
						
					
					
						commit
						18c44db8ca
					
				
					 2 changed files with 23 additions and 5 deletions
				
			
		| 
						 | 
					@ -18,6 +18,9 @@ Required properties:
 | 
				
			||||||
   Documentation/devicetree/bindings/video/display-timing.txt for display
 | 
					   Documentation/devicetree/bindings/video/display-timing.txt for display
 | 
				
			||||||
   timing binding details.
 | 
					   timing binding details.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Optional properties:
 | 
				
			||||||
 | 
					- backlight: phandle of the backlight device attached to the panel
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Recommended properties:
 | 
					Recommended properties:
 | 
				
			||||||
 - pinctrl-names, pinctrl-0: the pincontrol settings to configure
 | 
					 - pinctrl-names, pinctrl-0: the pincontrol settings to configure
 | 
				
			||||||
   muxing properly for pins that connect to TFP410 device
 | 
					   muxing properly for pins that connect to TFP410 device
 | 
				
			||||||
| 
						 | 
					@ -29,6 +32,8 @@ Example:
 | 
				
			||||||
		compatible = "ti,tilcdc,panel";
 | 
							compatible = "ti,tilcdc,panel";
 | 
				
			||||||
		pinctrl-names = "default";
 | 
							pinctrl-names = "default";
 | 
				
			||||||
		pinctrl-0 = <&bone_lcd3_cape_lcd_pins>;
 | 
							pinctrl-0 = <&bone_lcd3_cape_lcd_pins>;
 | 
				
			||||||
 | 
							backlight = <&backlight>;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		panel-info {
 | 
							panel-info {
 | 
				
			||||||
			ac-bias           = <255>;
 | 
								ac-bias           = <255>;
 | 
				
			||||||
			ac-bias-intrpt    = <0>;
 | 
								ac-bias-intrpt    = <0>;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -342,7 +342,7 @@ static struct tilcdc_panel_info *of_get_panel_info(struct device_node *np)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int panel_probe(struct platform_device *pdev)
 | 
					static int panel_probe(struct platform_device *pdev)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct device_node *node = pdev->dev.of_node;
 | 
						struct device_node *bl_node, *node = pdev->dev.of_node;
 | 
				
			||||||
	struct panel_module *panel_mod;
 | 
						struct panel_module *panel_mod;
 | 
				
			||||||
	struct tilcdc_module *mod;
 | 
						struct tilcdc_module *mod;
 | 
				
			||||||
	struct pinctrl *pinctrl;
 | 
						struct pinctrl *pinctrl;
 | 
				
			||||||
| 
						 | 
					@ -358,6 +358,17 @@ static int panel_probe(struct platform_device *pdev)
 | 
				
			||||||
	if (!panel_mod)
 | 
						if (!panel_mod)
 | 
				
			||||||
		return -ENOMEM;
 | 
							return -ENOMEM;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						bl_node = of_parse_phandle(node, "backlight", 0);
 | 
				
			||||||
 | 
						if (bl_node) {
 | 
				
			||||||
 | 
							panel_mod->backlight = of_find_backlight_by_node(bl_node);
 | 
				
			||||||
 | 
							of_node_put(bl_node);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if (!panel_mod->backlight)
 | 
				
			||||||
 | 
								return -EPROBE_DEFER;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							dev_info(&pdev->dev, "found backlight\n");
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	mod = &panel_mod->base;
 | 
						mod = &panel_mod->base;
 | 
				
			||||||
	pdev->dev.platform_data = mod;
 | 
						pdev->dev.platform_data = mod;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -381,10 +392,6 @@ static int panel_probe(struct platform_device *pdev)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	mod->preferred_bpp = panel_mod->info->bpp;
 | 
						mod->preferred_bpp = panel_mod->info->bpp;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	panel_mod->backlight = of_find_backlight_by_node(node);
 | 
					 | 
				
			||||||
	if (panel_mod->backlight)
 | 
					 | 
				
			||||||
		dev_info(&pdev->dev, "found backlight\n");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
fail_timings:
 | 
					fail_timings:
 | 
				
			||||||
| 
						 | 
					@ -392,6 +399,8 @@ static int panel_probe(struct platform_device *pdev)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
fail_free:
 | 
					fail_free:
 | 
				
			||||||
	tilcdc_module_cleanup(mod);
 | 
						tilcdc_module_cleanup(mod);
 | 
				
			||||||
 | 
						if (panel_mod->backlight)
 | 
				
			||||||
 | 
							put_device(&panel_mod->backlight->dev);
 | 
				
			||||||
	return ret;
 | 
						return ret;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -399,6 +408,10 @@ static int panel_remove(struct platform_device *pdev)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct tilcdc_module *mod = dev_get_platdata(&pdev->dev);
 | 
						struct tilcdc_module *mod = dev_get_platdata(&pdev->dev);
 | 
				
			||||||
	struct panel_module *panel_mod = to_panel_module(mod);
 | 
						struct panel_module *panel_mod = to_panel_module(mod);
 | 
				
			||||||
 | 
						struct backlight_device *backlight = panel_mod->backlight;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (backlight)
 | 
				
			||||||
 | 
							put_device(&backlight->dev);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	display_timings_release(panel_mod->timings);
 | 
						display_timings_release(panel_mod->timings);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue