mirror of https://gitee.com/openkylin/linux.git
drm/panel: raydium-rm68200: use drm_panel backlight support
Use the backlight support in drm_panel to simplify the driver Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Cc: Thierry Reding <thierry.reding@gmail.com> Cc: Sam Ravnborg <sam@ravnborg.org> Link: https://patchwork.freedesktop.org/patch/msgid/20191207140353.23967-17-sam@ravnborg.org
This commit is contained in:
parent
581ee32ede
commit
924735c40e
|
@ -6,9 +6,9 @@
|
|||
* Yannick Fertre <yannick.fertre@st.com>
|
||||
*/
|
||||
|
||||
#include <linux/backlight.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/gpio/consumer.h>
|
||||
#include <linux/mod_devicetable.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/regulator/consumer.h>
|
||||
|
||||
|
@ -78,7 +78,6 @@ struct rm68200 {
|
|||
struct drm_panel panel;
|
||||
struct gpio_desc *reset_gpio;
|
||||
struct regulator *supply;
|
||||
struct backlight_device *backlight;
|
||||
bool prepared;
|
||||
bool enabled;
|
||||
};
|
||||
|
@ -242,8 +241,6 @@ static int rm68200_disable(struct drm_panel *panel)
|
|||
if (!ctx->enabled)
|
||||
return 0;
|
||||
|
||||
backlight_disable(ctx->backlight);
|
||||
|
||||
ctx->enabled = false;
|
||||
|
||||
return 0;
|
||||
|
@ -328,8 +325,6 @@ static int rm68200_enable(struct drm_panel *panel)
|
|||
if (ctx->enabled)
|
||||
return 0;
|
||||
|
||||
backlight_enable(ctx->backlight);
|
||||
|
||||
ctx->enabled = true;
|
||||
|
||||
return 0;
|
||||
|
@ -392,10 +387,6 @@ static int rm68200_probe(struct mipi_dsi_device *dsi)
|
|||
return ret;
|
||||
}
|
||||
|
||||
ctx->backlight = devm_of_find_backlight(dev);
|
||||
if (IS_ERR(ctx->backlight))
|
||||
return PTR_ERR(ctx->backlight);
|
||||
|
||||
mipi_dsi_set_drvdata(dsi, ctx);
|
||||
|
||||
ctx->dev = dev;
|
||||
|
@ -408,6 +399,10 @@ static int rm68200_probe(struct mipi_dsi_device *dsi)
|
|||
drm_panel_init(&ctx->panel, dev, &rm68200_drm_funcs,
|
||||
DRM_MODE_CONNECTOR_DSI);
|
||||
|
||||
ret = drm_panel_of_backlight(&ctx->panel);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
drm_panel_add(&ctx->panel);
|
||||
|
||||
ret = mipi_dsi_attach(dsi);
|
||||
|
|
Loading…
Reference in New Issue