drm/panel: feiyang-fy07024di26a30d: use drm_panel backlight support
authorSam Ravnborg <sam@ravnborg.org>
Sat, 7 Dec 2019 14:03:36 +0000 (15:03 +0100)
committerSam Ravnborg <sam@ravnborg.org>
Mon, 9 Dec 2019 21:57:26 +0000 (22:57 +0100)
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: Jagan Teki <jagan@amarulasolutions.com>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20191207140353.23967-9-sam@ravnborg.org
drivers/gpu/drm/panel/panel-feiyang-fy07024di26a30d.c

index 0157d1844e3efb1607d590dedb5ac1de48b058e2..95b789ab9d295cbe6de7c60d33ec3565d902d1d1 100644 (file)
@@ -9,7 +9,6 @@
 #include <drm/drm_panel.h>
 #include <drm/drm_print.h>
 
-#include <linux/backlight.h>
 #include <linux/gpio/consumer.h>
 #include <linux/delay.h>
 #include <linux/module.h>
@@ -22,7 +21,6 @@ struct feiyang {
        struct drm_panel        panel;
        struct mipi_dsi_device  *dsi;
 
-       struct backlight_device *backlight;
        struct regulator        *dvdd;
        struct regulator        *avdd;
        struct gpio_desc        *reset;
@@ -102,7 +100,6 @@ static int feiyang_enable(struct drm_panel *panel)
        msleep(200);
 
        mipi_dsi_dcs_set_display_on(ctx->dsi);
-       backlight_enable(ctx->backlight);
 
        return 0;
 }
@@ -111,7 +108,6 @@ static int feiyang_disable(struct drm_panel *panel)
 {
        struct feiyang *ctx = panel_to_feiyang(panel);
 
-       backlight_disable(ctx->backlight);
        return mipi_dsi_dcs_set_display_off(ctx->dsi);
 }
 
@@ -225,9 +221,9 @@ static int feiyang_dsi_probe(struct mipi_dsi_device *dsi)
                return PTR_ERR(ctx->reset);
        }
 
-       ctx->backlight = devm_of_find_backlight(&dsi->dev);
-       if (IS_ERR(ctx->backlight))
-               return PTR_ERR(ctx->backlight);
+       ret = drm_panel_of_backlight(&ctx->panel);
+       if (ret)
+               return ret;
 
        ret = drm_panel_add(&ctx->panel);
        if (ret < 0)