mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-05 10:04:12 +08:00
drm/panel: sharp-ls043t1le01: 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-22-sam@ravnborg.org
This commit is contained in:
parent
8bc0b56098
commit
8cc8517721
@ -7,7 +7,6 @@
|
||||
* Based on AUO panel driver by Rob Clark <robdclark@gmail.com>
|
||||
*/
|
||||
|
||||
#include <linux/backlight.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/gpio/consumer.h>
|
||||
#include <linux/module.h>
|
||||
@ -25,7 +24,6 @@ struct sharp_nt_panel {
|
||||
struct drm_panel base;
|
||||
struct mipi_dsi_device *dsi;
|
||||
|
||||
struct backlight_device *backlight;
|
||||
struct regulator *supply;
|
||||
struct gpio_desc *reset_gpio;
|
||||
|
||||
@ -107,8 +105,6 @@ static int sharp_nt_panel_disable(struct drm_panel *panel)
|
||||
if (!sharp_nt->enabled)
|
||||
return 0;
|
||||
|
||||
backlight_disable(sharp_nt->backlight);
|
||||
|
||||
sharp_nt->enabled = false;
|
||||
|
||||
return 0;
|
||||
@ -190,8 +186,6 @@ static int sharp_nt_panel_enable(struct drm_panel *panel)
|
||||
if (sharp_nt->enabled)
|
||||
return 0;
|
||||
|
||||
backlight_enable(sharp_nt->backlight);
|
||||
|
||||
sharp_nt->enabled = true;
|
||||
|
||||
return 0;
|
||||
@ -244,6 +238,7 @@ static const struct drm_panel_funcs sharp_nt_panel_funcs = {
|
||||
static int sharp_nt_panel_add(struct sharp_nt_panel *sharp_nt)
|
||||
{
|
||||
struct device *dev = &sharp_nt->dsi->dev;
|
||||
int ret;
|
||||
|
||||
sharp_nt->mode = &default_mode;
|
||||
|
||||
@ -260,14 +255,13 @@ static int sharp_nt_panel_add(struct sharp_nt_panel *sharp_nt)
|
||||
gpiod_set_value(sharp_nt->reset_gpio, 0);
|
||||
}
|
||||
|
||||
sharp_nt->backlight = devm_of_find_backlight(dev);
|
||||
|
||||
if (IS_ERR(sharp_nt->backlight))
|
||||
return PTR_ERR(sharp_nt->backlight);
|
||||
|
||||
drm_panel_init(&sharp_nt->base, &sharp_nt->dsi->dev,
|
||||
&sharp_nt_panel_funcs, DRM_MODE_CONNECTOR_DSI);
|
||||
|
||||
ret = drm_panel_of_backlight(&sharp_nt->base);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return drm_panel_add(&sharp_nt->base);
|
||||
}
|
||||
|
||||
@ -309,7 +303,7 @@ static int sharp_nt_panel_remove(struct mipi_dsi_device *dsi)
|
||||
struct sharp_nt_panel *sharp_nt = mipi_dsi_get_drvdata(dsi);
|
||||
int ret;
|
||||
|
||||
ret = sharp_nt_panel_disable(&sharp_nt->base);
|
||||
ret = drm_panel_disable(&sharp_nt->base);
|
||||
if (ret < 0)
|
||||
dev_err(&dsi->dev, "failed to disable panel: %d\n", ret);
|
||||
|
||||
@ -326,7 +320,7 @@ static void sharp_nt_panel_shutdown(struct mipi_dsi_device *dsi)
|
||||
{
|
||||
struct sharp_nt_panel *sharp_nt = mipi_dsi_get_drvdata(dsi);
|
||||
|
||||
sharp_nt_panel_disable(&sharp_nt->base);
|
||||
drm_panel_disable(&sharp_nt->base);
|
||||
}
|
||||
|
||||
static const struct of_device_id sharp_nt_of_match[] = {
|
||||
|
Loading…
Reference in New Issue
Block a user