Commit 5b44f125 authored by Paul Cercueil's avatar Paul Cercueil Committed by Sam Ravnborg

drm/panel: novatek,nt39016: Handle backlight the standard way

Instead of manipulating the backlight directly in this driver, register
it in the probe using drm_panel_of_backlight() and let the drm_panel
framework code handle it.
Signed-off-by: default avatarPaul Cercueil <paul@crapouillou.net>
Signed-off-by: default avatarSam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200811002240.55194-2-paul@crapouillou.net
parent 72957f48
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
* Copyright (C) 2019, Paul Cercueil <paul@crapouillou.net> * Copyright (C) 2019, Paul Cercueil <paul@crapouillou.net>
*/ */
#include <linux/backlight.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/device.h> #include <linux/device.h>
#include <linux/gpio/consumer.h> #include <linux/gpio/consumer.h>
...@@ -63,8 +62,6 @@ struct nt39016 { ...@@ -63,8 +62,6 @@ struct nt39016 {
const struct nt39016_panel_info *panel_info; const struct nt39016_panel_info *panel_info;
struct gpio_desc *reset_gpio; struct gpio_desc *reset_gpio;
struct backlight_device *backlight;
}; };
static inline struct nt39016 *to_nt39016(struct drm_panel *panel) static inline struct nt39016 *to_nt39016(struct drm_panel *panel)
...@@ -180,14 +177,12 @@ static int nt39016_enable(struct drm_panel *drm_panel) ...@@ -180,14 +177,12 @@ static int nt39016_enable(struct drm_panel *drm_panel)
return ret; return ret;
} }
if (panel->backlight) { if (drm_panel->backlight) {
/* Wait for the picture to be ready before enabling backlight */ /* Wait for the picture to be ready before enabling backlight */
msleep(150); msleep(150);
ret = backlight_enable(panel->backlight);
} }
return ret; return 0;
} }
static int nt39016_disable(struct drm_panel *drm_panel) static int nt39016_disable(struct drm_panel *drm_panel)
...@@ -195,8 +190,6 @@ static int nt39016_disable(struct drm_panel *drm_panel) ...@@ -195,8 +190,6 @@ static int nt39016_disable(struct drm_panel *drm_panel)
struct nt39016 *panel = to_nt39016(drm_panel); struct nt39016 *panel = to_nt39016(drm_panel);
int err; int err;
backlight_disable(panel->backlight);
err = regmap_write(panel->map, NT39016_REG_SYSTEM, err = regmap_write(panel->map, NT39016_REG_SYSTEM,
NT39016_SYSTEM_RESET_N); NT39016_SYSTEM_RESET_N);
if (err) { if (err) {
...@@ -292,9 +285,8 @@ static int nt39016_probe(struct spi_device *spi) ...@@ -292,9 +285,8 @@ static int nt39016_probe(struct spi_device *spi)
return PTR_ERR(panel->map); return PTR_ERR(panel->map);
} }
panel->backlight = devm_of_find_backlight(dev); err = drm_panel_of_backlight(&panel->drm_panel);
if (IS_ERR(panel->backlight)) { if (err) {
err = PTR_ERR(panel->backlight);
if (err != -EPROBE_DEFER) if (err != -EPROBE_DEFER)
dev_err(dev, "Failed to get backlight handle"); dev_err(dev, "Failed to get backlight handle");
return err; return err;
......
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