[PATCH v2 13/24] drm/panel: samsung-s6e63m0: Backlight update
Sam Ravnborg
sam at ravnborg.org
Sun Aug 23 10:45:21 UTC 2020
- Use drm_panel backlight support
- Use macro for backlight initialization
Signed-off-by: Sam Ravnborg <sam at ravnborg.org>
Cc: Paweł Chmiel <pawel.mikolaj.chmiel at gmail.com>
Cc: Thierry Reding <thierry.reding at gmail.com>
Cc: Sam Ravnborg <sam at ravnborg.org>
---
drivers/gpu/drm/panel/panel-samsung-s6e63m0.c | 25 +++++++------------
1 file changed, 9 insertions(+), 16 deletions(-)
diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c b/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c
index a5f76eb4fa25..e30ef655a3c3 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;
@@ -395,7 +390,7 @@ static int s6e63m0_set_brightness(struct backlight_device *bd)
{
struct s6e63m0 *ctx = bl_get_data(bd);
- int brightness = bd->props.brightness;
+ int brightness = backlight_get_brightness(bd);
/* disable and set new gamma */
s6e63m0_dcs_write(ctx, s6e63m0_gamma_22[brightness],
@@ -413,23 +408,21 @@ static const struct backlight_ops s6e63m0_backlight_ops = {
static int s6e63m0_backlight_register(struct s6e63m0 *ctx)
{
- struct backlight_properties props = {
- .type = BACKLIGHT_RAW,
- .brightness = MAX_BRIGHTNESS,
- .max_brightness = MAX_BRIGHTNESS
- };
+ DECLARE_BACKLIGHT_INIT_RAW(props, MAX_BRIGHTNESS, MAX_BRIGHTNESS);
struct device *dev = ctx->dev;
+ struct backlight_device *bd;
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);
+ bd = devm_backlight_device_register(dev, "panel", dev, ctx,
+ &s6e63m0_backlight_ops, &props);
+ if (IS_ERR(bd)) {
+ ret = PTR_ERR(bd);
DRM_DEV_ERROR(dev, "error registering backlight device (%d)\n",
ret);
+ return ret;
}
+ ctx->panel.backlight = bd;
return ret;
}
--
2.25.1
More information about the dri-devel
mailing list