Skip to content

Commit 11f39d5

Browse files
committed
drm/panel: tpo-tpg110: 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: Linus Walleij <linus.walleij@linaro.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Cc: Linus Walleij <linus.walleij@linaro.org> Cc: Thierry Reding <thierry.reding@gmail.com> Cc: Sam Ravnborg <sam@ravnborg.org> Link: https://patchwork.freedesktop.org/patch/msgid/20191207140353.23967-26-sam@ravnborg.org
1 parent 3555339 commit 11f39d5

1 file changed

Lines changed: 6 additions & 14 deletions

File tree

‎drivers/gpu/drm/panel/panel-tpo-tpg110.c‎

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@
1414
#include <drm/drm_panel.h>
1515
#include <drm/drm_print.h>
1616

17-
#include <linux/backlight.h>
1817
#include <linux/bitops.h>
1918
#include <linux/delay.h>
2019
#include <linux/gpio/consumer.h>
2120
#include <linux/init.h>
2221
#include <linux/kernel.h>
2322
#include <linux/module.h>
23+
#include <linux/of.h>
2424
#include <linux/platform_device.h>
2525
#include <linux/spi/spi.h>
2626

@@ -76,10 +76,6 @@ struct tpg110 {
7676
* @panel: the DRM panel instance for this device
7777
*/
7878
struct drm_panel panel;
79-
/**
80-
* @backlight: backlight for this panel
81-
*/
82-
struct backlight_device *backlight;
8379
/**
8480
* @panel_type: the panel mode as detected
8581
*/
@@ -356,8 +352,6 @@ static int tpg110_disable(struct drm_panel *panel)
356352
val &= ~TPG110_CTRL2_PM;
357353
tpg110_write_reg(tpg, TPG110_CTRL2_PM, val);
358354

359-
backlight_disable(tpg->backlight);
360-
361355
return 0;
362356
}
363357

@@ -366,8 +360,6 @@ static int tpg110_enable(struct drm_panel *panel)
366360
struct tpg110 *tpg = to_tpg110(panel);
367361
u8 val;
368362

369-
backlight_enable(tpg->backlight);
370-
371363
/* Take chip out of standby */
372364
val = tpg110_read_reg(tpg, TPG110_CTRL2_PM);
373365
val |= TPG110_CTRL2_PM;
@@ -432,11 +424,6 @@ static int tpg110_probe(struct spi_device *spi)
432424
if (ret)
433425
DRM_DEV_ERROR(dev, "no panel height specified\n");
434426

435-
/* Look for some optional backlight */
436-
tpg->backlight = devm_of_find_backlight(dev);
437-
if (IS_ERR(tpg->backlight))
438-
return PTR_ERR(tpg->backlight);
439-
440427
/* This asserts the GRESTB signal, putting the display into reset */
441428
tpg->grestb = devm_gpiod_get(dev, "grestb", GPIOD_OUT_HIGH);
442429
if (IS_ERR(tpg->grestb)) {
@@ -459,6 +446,11 @@ static int tpg110_probe(struct spi_device *spi)
459446

460447
drm_panel_init(&tpg->panel, dev, &tpg110_drm_funcs,
461448
DRM_MODE_CONNECTOR_DPI);
449+
450+
ret = drm_panel_of_backlight(&tpg->panel);
451+
if (ret)
452+
return ret;
453+
462454
spi_set_drvdata(spi, tpg);
463455

464456
return drm_panel_add(&tpg->panel);

0 commit comments

Comments
 (0)