[PATCH v1 3/3] drm/panel: update backlight handling for samsung-s6e63m0
Sam Ravnborg
sam at ravnborg.org
Thu Apr 9 11:52:39 UTC 2020
The samsung-s6e63m0 had a local way to handle backlight.
Update the driver to use a devm_ based register function
and utilize drm_panel backlight support. The changes results
in a simpler driver with the same functionality.
Signed-off-by: Sam Ravnborg <sam at ravnborg.org>
Cc: Paweł Chmiel <pawel.mikolaj.chmiel at gmail.com>
Cc: Joonas Kylmälä <joonas.kylmala at iki.fi>
Cc: Andrzej Hajda <a.hajda at samsung.com>
Cc: Thierry Reding <thierry.reding at gmail.com>
Cc: Sam Ravnborg <sam at ravnborg.org>
---
drivers/gpu/drm/panel/panel-samsung-s6e63m0.c | 20 ++++++++-----------
1 file changed, 8 insertions(+), 12 deletions(-)
diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c b/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c
index a5f76eb4fa25..089bf4cff840 100644
--- a/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c
+++ b/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c
@@ -89,7 +89,6 @@ static u8 const s6e63m0_gamma_22[NUM_GAMMA_LEVELS][GAMMA_TABLE_COUNT] = {
struct s6e63m0 {
struct device *dev;
struct drm_panel panel;
- struct backlight_device *bl_dev;
struct regulator_bulk_data supplies[2];
struct gpio_desc *reset_gpio;
@@ -293,8 +292,6 @@ static int s6e63m0_disable(struct drm_panel *panel)
if (!ctx->enabled)
return 0;
- backlight_disable(ctx->bl_dev);
-
s6e63m0_dcs_write_seq_static(ctx, MIPI_DCS_ENTER_SLEEP_MODE);
msleep(200);
@@ -355,8 +352,6 @@ static int s6e63m0_enable(struct drm_panel *panel)
s6e63m0_dcs_write_seq_static(ctx, MIPI_DCS_SET_DISPLAY_ON);
- backlight_enable(ctx->bl_dev);
-
ctx->enabled = true;
return 0;
@@ -394,7 +389,6 @@ static const struct drm_panel_funcs s6e63m0_drm_funcs = {
static int s6e63m0_set_brightness(struct backlight_device *bd)
{
struct s6e63m0 *ctx = bl_get_data(bd);
-
int brightness = bd->props.brightness;
/* disable and set new gamma */
@@ -416,19 +410,21 @@ static int s6e63m0_backlight_register(struct s6e63m0 *ctx)
struct backlight_properties props = {
.type = BACKLIGHT_RAW,
.brightness = MAX_BRIGHTNESS,
- .max_brightness = MAX_BRIGHTNESS
+ .max_brightness = MAX_BRIGHTNESS,
};
+ struct backlight_device *backlight;
struct device *dev = ctx->dev;
int ret = 0;
- ctx->bl_dev = devm_backlight_device_register(dev, "panel", dev, ctx,
- &s6e63m0_backlight_ops,
- &props);
- if (IS_ERR(ctx->bl_dev)) {
- ret = PTR_ERR(ctx->bl_dev);
+ backlight = devm_backlight_device_register(dev, "panel", dev, ctx,
+ &s6e63m0_backlight_ops,
+ &props);
+ if (IS_ERR(backlight)) {
+ ret = PTR_ERR(backlight);
DRM_DEV_ERROR(dev, "error registering backlight device (%d)\n",
ret);
}
+ ctx->panel.backlight = backlight;
return ret;
}
--
2.20.1
More information about the dri-devel
mailing list