Commit 16793e00 authored by Sam Ravnborg's avatar Sam Ravnborg

drm/panel: innolux-p079zca: use drm_panel backlight support

Use the backlight support in drm_panel to simplify the driver
Signed-off-by: default avatarSam Ravnborg <sam@ravnborg.org>
Reviewed-by: default avatarLaurent 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-11-sam@ravnborg.org
parent 2b33e191
......@@ -3,7 +3,6 @@
* Copyright (c) 2017, Fuzhou Rockchip Electronics Co., Ltd
*/
#include <linux/backlight.h>
#include <linux/delay.h>
#include <linux/gpio/consumer.h>
#include <linux/module.h>
......@@ -52,7 +51,6 @@ struct innolux_panel {
struct mipi_dsi_device *link;
const struct panel_desc *desc;
struct backlight_device *backlight;
struct regulator_bulk_data *supplies;
struct gpio_desc *enable_gpio;
......@@ -72,8 +70,6 @@ static int innolux_panel_disable(struct drm_panel *panel)
if (!innolux->enabled)
return 0;
backlight_disable(innolux->backlight);
innolux->enabled = false;
return 0;
......@@ -204,18 +200,10 @@ static int innolux_panel_prepare(struct drm_panel *panel)
static int innolux_panel_enable(struct drm_panel *panel)
{
struct innolux_panel *innolux = to_innolux_panel(panel);
int ret;
if (innolux->enabled)
return 0;
ret = backlight_enable(innolux->backlight);
if (ret) {
DRM_DEV_ERROR(panel->dev,
"Failed to enable backlight %d\n", ret);
return ret;
}
innolux->enabled = true;
return 0;
......@@ -482,13 +470,13 @@ static int innolux_panel_add(struct mipi_dsi_device *dsi,
innolux->enable_gpio = NULL;
}
innolux->backlight = devm_of_find_backlight(dev);
if (IS_ERR(innolux->backlight))
return PTR_ERR(innolux->backlight);
drm_panel_init(&innolux->base, dev, &innolux_panel_funcs,
DRM_MODE_CONNECTOR_DSI);
err = drm_panel_of_backlight(&innolux->base);
if (err)
return err;
err = drm_panel_add(&innolux->base);
if (err < 0)
return err;
......@@ -526,12 +514,12 @@ static int innolux_panel_remove(struct mipi_dsi_device *dsi)
struct innolux_panel *innolux = mipi_dsi_get_drvdata(dsi);
int err;
err = innolux_panel_unprepare(&innolux->base);
err = drm_panel_unprepare(&innolux->base);
if (err < 0)
DRM_DEV_ERROR(&dsi->dev, "failed to unprepare panel: %d\n",
err);
err = innolux_panel_disable(&innolux->base);
err = drm_panel_disable(&innolux->base);
if (err < 0)
DRM_DEV_ERROR(&dsi->dev, "failed to disable panel: %d\n", err);
......@@ -549,8 +537,8 @@ static void innolux_panel_shutdown(struct mipi_dsi_device *dsi)
{
struct innolux_panel *innolux = mipi_dsi_get_drvdata(dsi);
innolux_panel_unprepare(&innolux->base);
innolux_panel_disable(&innolux->base);
drm_panel_unprepare(&innolux->base);
drm_panel_disable(&innolux->base);
}
static struct mipi_dsi_driver innolux_panel_driver = {
......
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