drm/panel: sitronix-st7701: 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: 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-23-sam@ravnborg.org
This commit is contained in:
parent
8cc8517721
commit
e46eb37a2d
@ -9,7 +9,6 @@
|
|||||||
#include <drm/drm_panel.h>
|
#include <drm/drm_panel.h>
|
||||||
#include <drm/drm_print.h>
|
#include <drm/drm_print.h>
|
||||||
|
|
||||||
#include <linux/backlight.h>
|
|
||||||
#include <linux/gpio/consumer.h>
|
#include <linux/gpio/consumer.h>
|
||||||
#include <linux/delay.h>
|
#include <linux/delay.h>
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
@ -103,7 +102,6 @@ struct st7701 {
|
|||||||
struct mipi_dsi_device *dsi;
|
struct mipi_dsi_device *dsi;
|
||||||
const struct st7701_panel_desc *desc;
|
const struct st7701_panel_desc *desc;
|
||||||
|
|
||||||
struct backlight_device *backlight;
|
|
||||||
struct regulator_bulk_data *supplies;
|
struct regulator_bulk_data *supplies;
|
||||||
struct gpio_desc *reset;
|
struct gpio_desc *reset;
|
||||||
unsigned int sleep_delay;
|
unsigned int sleep_delay;
|
||||||
@ -223,7 +221,6 @@ static int st7701_enable(struct drm_panel *panel)
|
|||||||
struct st7701 *st7701 = panel_to_st7701(panel);
|
struct st7701 *st7701 = panel_to_st7701(panel);
|
||||||
|
|
||||||
ST7701_DSI(st7701, MIPI_DCS_SET_DISPLAY_ON, 0x00);
|
ST7701_DSI(st7701, MIPI_DCS_SET_DISPLAY_ON, 0x00);
|
||||||
backlight_enable(st7701->backlight);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -232,7 +229,6 @@ static int st7701_disable(struct drm_panel *panel)
|
|||||||
{
|
{
|
||||||
struct st7701 *st7701 = panel_to_st7701(panel);
|
struct st7701 *st7701 = panel_to_st7701(panel);
|
||||||
|
|
||||||
backlight_disable(st7701->backlight);
|
|
||||||
ST7701_DSI(st7701, MIPI_DCS_SET_DISPLAY_OFF, 0x00);
|
ST7701_DSI(st7701, MIPI_DCS_SET_DISPLAY_OFF, 0x00);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -366,10 +362,6 @@ static int st7701_dsi_probe(struct mipi_dsi_device *dsi)
|
|||||||
return PTR_ERR(st7701->reset);
|
return PTR_ERR(st7701->reset);
|
||||||
}
|
}
|
||||||
|
|
||||||
st7701->backlight = devm_of_find_backlight(&dsi->dev);
|
|
||||||
if (IS_ERR(st7701->backlight))
|
|
||||||
return PTR_ERR(st7701->backlight);
|
|
||||||
|
|
||||||
drm_panel_init(&st7701->panel, &dsi->dev, &st7701_funcs,
|
drm_panel_init(&st7701->panel, &dsi->dev, &st7701_funcs,
|
||||||
DRM_MODE_CONNECTOR_DSI);
|
DRM_MODE_CONNECTOR_DSI);
|
||||||
|
|
||||||
@ -384,6 +376,10 @@ static int st7701_dsi_probe(struct mipi_dsi_device *dsi)
|
|||||||
*/
|
*/
|
||||||
st7701->sleep_delay = 120 + desc->panel_sleep_delay;
|
st7701->sleep_delay = 120 + desc->panel_sleep_delay;
|
||||||
|
|
||||||
|
ret = drm_panel_of_backlight(&st7701->panel);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
ret = drm_panel_add(&st7701->panel);
|
ret = drm_panel_add(&st7701->panel);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user