mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-20 08:50:46 +07:00
drm/panel: panasonic-vvx10f034n00: 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-16-sam@ravnborg.org
This commit is contained in:
parent
faf7e4f47c
commit
581ee32ede
@ -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/module.h>
|
||||
#include <linux/of.h>
|
||||
@ -31,7 +30,6 @@ struct wuxga_nt_panel {
|
||||
struct drm_panel base;
|
||||
struct mipi_dsi_device *dsi;
|
||||
|
||||
struct backlight_device *backlight;
|
||||
struct regulator *supply;
|
||||
|
||||
bool prepared;
|
||||
@ -62,12 +60,6 @@ static int wuxga_nt_panel_disable(struct drm_panel *panel)
|
||||
|
||||
mipi_ret = mipi_dsi_shutdown_peripheral(wuxga_nt->dsi);
|
||||
|
||||
if (wuxga_nt->backlight) {
|
||||
wuxga_nt->backlight->props.power = FB_BLANK_POWERDOWN;
|
||||
wuxga_nt->backlight->props.state |= BL_CORE_FBBLANK;
|
||||
bl_ret = backlight_update_status(wuxga_nt->backlight);
|
||||
}
|
||||
|
||||
wuxga_nt->enabled = false;
|
||||
|
||||
return mipi_ret ? mipi_ret : bl_ret;
|
||||
@ -142,12 +134,6 @@ static int wuxga_nt_panel_enable(struct drm_panel *panel)
|
||||
if (wuxga_nt->enabled)
|
||||
return 0;
|
||||
|
||||
if (wuxga_nt->backlight) {
|
||||
wuxga_nt->backlight->props.power = FB_BLANK_UNBLANK;
|
||||
wuxga_nt->backlight->props.state &= ~BL_CORE_FBBLANK;
|
||||
backlight_update_status(wuxga_nt->backlight);
|
||||
}
|
||||
|
||||
wuxga_nt->enabled = true;
|
||||
|
||||
return 0;
|
||||
@ -206,7 +192,6 @@ MODULE_DEVICE_TABLE(of, wuxga_nt_of_match);
|
||||
static int wuxga_nt_panel_add(struct wuxga_nt_panel *wuxga_nt)
|
||||
{
|
||||
struct device *dev = &wuxga_nt->dsi->dev;
|
||||
struct device_node *np;
|
||||
int ret;
|
||||
|
||||
wuxga_nt->mode = &default_mode;
|
||||
@ -215,38 +200,20 @@ static int wuxga_nt_panel_add(struct wuxga_nt_panel *wuxga_nt)
|
||||
if (IS_ERR(wuxga_nt->supply))
|
||||
return PTR_ERR(wuxga_nt->supply);
|
||||
|
||||
np = of_parse_phandle(dev->of_node, "backlight", 0);
|
||||
if (np) {
|
||||
wuxga_nt->backlight = of_find_backlight_by_node(np);
|
||||
of_node_put(np);
|
||||
|
||||
if (!wuxga_nt->backlight)
|
||||
return -EPROBE_DEFER;
|
||||
}
|
||||
|
||||
drm_panel_init(&wuxga_nt->base, &wuxga_nt->dsi->dev,
|
||||
&wuxga_nt_panel_funcs, DRM_MODE_CONNECTOR_DSI);
|
||||
|
||||
ret = drm_panel_add(&wuxga_nt->base);
|
||||
if (ret < 0)
|
||||
goto put_backlight;
|
||||
ret = drm_panel_of_backlight(&wuxga_nt->base);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return 0;
|
||||
|
||||
put_backlight:
|
||||
if (wuxga_nt->backlight)
|
||||
put_device(&wuxga_nt->backlight->dev);
|
||||
|
||||
return ret;
|
||||
return drm_panel_add(&wuxga_nt->base);
|
||||
}
|
||||
|
||||
static void wuxga_nt_panel_del(struct wuxga_nt_panel *wuxga_nt)
|
||||
{
|
||||
if (wuxga_nt->base.dev)
|
||||
drm_panel_remove(&wuxga_nt->base);
|
||||
|
||||
if (wuxga_nt->backlight)
|
||||
put_device(&wuxga_nt->backlight->dev);
|
||||
}
|
||||
|
||||
static int wuxga_nt_panel_probe(struct mipi_dsi_device *dsi)
|
||||
@ -281,7 +248,7 @@ static int wuxga_nt_panel_remove(struct mipi_dsi_device *dsi)
|
||||
struct wuxga_nt_panel *wuxga_nt = mipi_dsi_get_drvdata(dsi);
|
||||
int ret;
|
||||
|
||||
ret = wuxga_nt_panel_disable(&wuxga_nt->base);
|
||||
ret = drm_panel_disable(&wuxga_nt->base);
|
||||
if (ret < 0)
|
||||
dev_err(&dsi->dev, "failed to disable panel: %d\n", ret);
|
||||
|
||||
@ -298,7 +265,7 @@ static void wuxga_nt_panel_shutdown(struct mipi_dsi_device *dsi)
|
||||
{
|
||||
struct wuxga_nt_panel *wuxga_nt = mipi_dsi_get_drvdata(dsi);
|
||||
|
||||
wuxga_nt_panel_disable(&wuxga_nt->base);
|
||||
drm_panel_disable(&wuxga_nt->base);
|
||||
}
|
||||
|
||||
static struct mipi_dsi_driver wuxga_nt_panel_driver = {
|
||||
|
Loading…
Reference in New Issue
Block a user