- Use get/set methods for backlight_properties - Use macro for backlight initialization Signed-off-by: Sam Ravnborg <sam@xxxxxxxxxxxx> Cc: Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx> Cc: Kieran Bingham <kieran.bingham+renesas@xxxxxxxxxxxxxxxx> Cc: linux-renesas-soc@xxxxxxxxxxxxxxx --- .../gpu/drm/shmobile/shmob_drm_backlight.c | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/shmobile/shmob_drm_backlight.c b/drivers/gpu/drm/shmobile/shmob_drm_backlight.c index f6628a5ee95f..407028df0212 100644 --- a/drivers/gpu/drm/shmobile/shmob_drm_backlight.c +++ b/drivers/gpu/drm/shmobile/shmob_drm_backlight.c @@ -18,13 +18,8 @@ static int shmob_drm_backlight_update(struct backlight_device *bdev) struct shmob_drm_connector *scon = bl_get_data(bdev); struct shmob_drm_device *sdev = scon->connector.dev->dev_private; const struct shmob_drm_backlight_data *bdata = &sdev->pdata->backlight; - int brightness = bdev->props.brightness; - if (bdev->props.power != FB_BLANK_UNBLANK || - bdev->props.state & BL_CORE_SUSPENDED) - brightness = 0; - - return bdata->set_brightness(brightness); + return bdata->set_brightness(backlight_get_brightness(bdev)); } static int shmob_drm_backlight_get_brightness(struct backlight_device *bdev) @@ -47,8 +42,11 @@ void shmob_drm_backlight_dpms(struct shmob_drm_connector *scon, int mode) if (scon->backlight == NULL) return; - scon->backlight->props.power = mode == DRM_MODE_DPMS_ON - ? FB_BLANK_UNBLANK : FB_BLANK_POWERDOWN; + if (mode == DRM_MODE_DPMS_ON) + backlight_set_power_on(scon->backlight); + else + backlight_set_power_off(scon->backlight); + backlight_update_status(scon->backlight); } @@ -59,21 +57,19 @@ int shmob_drm_backlight_init(struct shmob_drm_connector *scon) struct drm_connector *connector = &scon->connector; struct drm_device *dev = connector->dev; struct backlight_device *backlight; + DECLARE_BACKLIGHT_INIT_RAW(props, bdata->max_brightness, bdata->max_brightness); if (!bdata->max_brightness) return 0; backlight = backlight_device_register(bdata->name, dev->dev, scon, - &shmob_drm_backlight_ops, NULL); + &shmob_drm_backlight_ops, &props); if (IS_ERR(backlight)) { dev_err(dev->dev, "unable to register backlight device: %ld\n", PTR_ERR(backlight)); return PTR_ERR(backlight); } - backlight->props.max_brightness = bdata->max_brightness; - backlight->props.brightness = bdata->max_brightness; - backlight->props.power = FB_BLANK_POWERDOWN; backlight_update_status(backlight); scon->backlight = backlight; -- 2.25.1 _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/dri-devel