summaryrefslogtreecommitdiff
path: root/drivers/gpu
diff options
context:
space:
mode:
authorPaul Cercueil <paul@crapouillou.net>2020-08-11 02:22:36 +0200
committerSam Ravnborg <sam@ravnborg.org>2020-08-15 16:08:03 +0200
commit5b44f125eff9df72336a12cf9839323dd7b70b74 (patch)
tree0ce3839b71bbec4f2764ed1892b2a2b16ba67bf8 /drivers/gpu
parent72957f48aaaa4e62bff22af81b5d96ca6bd0f492 (diff)
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: Paul Cercueil <paul@crapouillou.net> Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Link: https://patchwork.freedesktop.org/patch/msgid/20200811002240.55194-2-paul@crapouillou.net
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/panel/panel-novatek-nt39016.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/drivers/gpu/drm/panel/panel-novatek-nt39016.c b/drivers/gpu/drm/panel/panel-novatek-nt39016.c
index 3d15d9925204..ba05165b6050 100644
--- a/drivers/gpu/drm/panel/panel-novatek-nt39016.c
+++ b/drivers/gpu/drm/panel/panel-novatek-nt39016.c
@@ -6,7 +6,6 @@
* Copyright (C) 2019, Paul Cercueil <paul@crapouillou.net>
*/
-#include <linux/backlight.h>
#include <linux/delay.h>
#include <linux/device.h>
#include <linux/gpio/consumer.h>
@@ -63,8 +62,6 @@ struct nt39016 {
const struct nt39016_panel_info *panel_info;
struct gpio_desc *reset_gpio;
-
- struct backlight_device *backlight;
};
static inline struct nt39016 *to_nt39016(struct drm_panel *panel)
@@ -180,14 +177,12 @@ static int nt39016_enable(struct drm_panel *drm_panel)
return ret;
}
- if (panel->backlight) {
+ if (drm_panel->backlight) {
/* Wait for the picture to be ready before enabling backlight */
msleep(150);
-
- ret = backlight_enable(panel->backlight);
}
- return ret;
+ return 0;
}
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);
int err;
- backlight_disable(panel->backlight);
-
err = regmap_write(panel->map, NT39016_REG_SYSTEM,
NT39016_SYSTEM_RESET_N);
if (err) {
@@ -292,9 +285,8 @@ static int nt39016_probe(struct spi_device *spi)
return PTR_ERR(panel->map);
}
- panel->backlight = devm_of_find_backlight(dev);
- if (IS_ERR(panel->backlight)) {
- err = PTR_ERR(panel->backlight);
+ err = drm_panel_of_backlight(&panel->drm_panel);
+ if (err) {
if (err != -EPROBE_DEFER)
dev_err(dev, "Failed to get backlight handle");
return err;