drm/panel: raydium-rm68200: use drm_panel backlight support
authorSam Ravnborg <sam@ravnborg.org>
Sat, 7 Dec 2019 14:03:44 +0000 (15:03 +0100)
committerSam Ravnborg <sam@ravnborg.org>
Mon, 9 Dec 2019 21:57:27 +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: 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
drivers/gpu/drm/panel/panel-raydium-rm68200.c

index d6a03328e5949adafcb41d8ad066795e0c137f49..e8982948e0ea61c6536e3489c0d946d74a8aa40c 100644 (file)
@@ -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);