Commit 12a6cbd4 authored by Philippe CORNU's avatar Philippe CORNU Committed by Thierry Reding

drm/panel: otm8009a: Use new backlight API

The backlight API provides new functions to enable and disable the
backlight and which hide the intricacies of achieving the correct
result.
Signed-off-by: default avatarPhilippe Cornu <philippe.cornu@st.com>
Signed-off-by: default avatarThierry Reding <treding@nvidia.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180423141054.13128-5-philippe.cornu@st.com
parent 6982b943
...@@ -260,11 +260,7 @@ static int otm8009a_disable(struct drm_panel *panel) ...@@ -260,11 +260,7 @@ static int otm8009a_disable(struct drm_panel *panel)
if (!ctx->enabled) if (!ctx->enabled)
return 0; /* This is not an issue so we return 0 here */ return 0; /* This is not an issue so we return 0 here */
/* Power off the backlight. Note: end-user still controls brightness */ backlight_disable(ctx->bl_dev);
ctx->bl_dev->props.power = FB_BLANK_POWERDOWN;
ret = backlight_update_status(ctx->bl_dev);
if (ret)
return ret;
ret = mipi_dsi_dcs_set_display_off(dsi); ret = mipi_dsi_dcs_set_display_off(dsi);
if (ret) if (ret)
...@@ -338,12 +334,7 @@ static int otm8009a_enable(struct drm_panel *panel) ...@@ -338,12 +334,7 @@ static int otm8009a_enable(struct drm_panel *panel)
if (ctx->enabled) if (ctx->enabled)
return 0; return 0;
/* backlight_enable(ctx->bl_dev);
* Power on the backlight. Note: end-user still controls brightness
* Note: ctx->prepared must be true before updating the backlight.
*/
ctx->bl_dev->props.power = FB_BLANK_UNBLANK;
backlight_update_status(ctx->bl_dev);
ctx->enabled = true; ctx->enabled = true;
...@@ -459,11 +450,14 @@ static int otm8009a_probe(struct mipi_dsi_device *dsi) ...@@ -459,11 +450,14 @@ static int otm8009a_probe(struct mipi_dsi_device *dsi)
ctx->panel.dev = dev; ctx->panel.dev = dev;
ctx->panel.funcs = &otm8009a_drm_funcs; ctx->panel.funcs = &otm8009a_drm_funcs;
ctx->bl_dev = backlight_device_register(dev_name(dev), dev, ctx, ctx->bl_dev = devm_backlight_device_register(dev, dev_name(dev),
&otm8009a_backlight_ops, NULL); dsi->host->dev, ctx,
&otm8009a_backlight_ops,
NULL);
if (IS_ERR(ctx->bl_dev)) { if (IS_ERR(ctx->bl_dev)) {
dev_err(dev, "failed to register backlight device\n"); ret = PTR_ERR(ctx->bl_dev);
return PTR_ERR(ctx->bl_dev); dev_err(dev, "failed to register backlight: %d\n", ret);
return ret;
} }
ctx->bl_dev->props.max_brightness = OTM8009A_BACKLIGHT_MAX; ctx->bl_dev->props.max_brightness = OTM8009A_BACKLIGHT_MAX;
...@@ -491,8 +485,6 @@ static int otm8009a_remove(struct mipi_dsi_device *dsi) ...@@ -491,8 +485,6 @@ static int otm8009a_remove(struct mipi_dsi_device *dsi)
mipi_dsi_detach(dsi); mipi_dsi_detach(dsi);
drm_panel_remove(&ctx->panel); drm_panel_remove(&ctx->panel);
backlight_device_unregister(ctx->bl_dev);
return 0; return 0;
} }
......
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