Commit a18dc740 authored by Sam Ravnborg's avatar Sam Ravnborg

drm/tilcdc: use devm_of_find_backlight

Look up backlight device using devm_of_find_backlight().
This simplifies the code and prevents us from hardcoding
the node name in the driver.
Signed-off-by: default avatarSam Ravnborg <sam@ravnborg.org>
Reviewed-by: default avatarTomi Valkeinen <tomi.valkeinen@ti.com>
Cc: Jyri Sarha <jsarha@ti.com>
Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200514191001.457441-3-sam@ravnborg.org
parent 1efa9eff
...@@ -299,7 +299,8 @@ static struct tilcdc_panel_info *of_get_panel_info(struct device_node *np) ...@@ -299,7 +299,8 @@ 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 *bl_node, *node = pdev->dev.of_node; struct device_node *node = pdev->dev.of_node;
struct backlight_device *backlight;
struct panel_module *panel_mod; struct panel_module *panel_mod;
struct tilcdc_module *mod; struct tilcdc_module *mod;
struct pinctrl *pinctrl; struct pinctrl *pinctrl;
...@@ -315,16 +316,10 @@ static int panel_probe(struct platform_device *pdev) ...@@ -315,16 +316,10 @@ 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); backlight = devm_of_find_backlight(&pdev->dev);
if (bl_node) { if (IS_ERR(backlight))
panel_mod->backlight = of_find_backlight_by_node(bl_node); return PTR_ERR(backlight);
of_node_put(bl_node); panel_mod->backlight = backlight;
if (!panel_mod->backlight)
return -EPROBE_DEFER;
dev_info(&pdev->dev, "found backlight\n");
}
panel_mod->enable_gpio = devm_gpiod_get_optional(&pdev->dev, "enable", panel_mod->enable_gpio = devm_gpiod_get_optional(&pdev->dev, "enable",
GPIOD_OUT_LOW); GPIOD_OUT_LOW);
......
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