Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/panel: sony-acx565akm: Use backlight helpers

Instead of retrieving the backlight brightness in struct
backlight_properties manually, and then checking whether the backlight
should be on at all, use backlight_get_brightness() which does all
this and insulates this from future changes.

Instead of manually checking the power state in struct
backlight_properties, use backlight_is_blank().

While we're at it, drop .fb_blank from the initialisation function; it
is deprecated, and this helps make progress towards enabling its
removal. This change makes no functional difference since
FB_BLANK_UNBLANK is the default value.

Signed-off-by: Stephen Kitt <steve@sk2.org>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20220616172316.1355133-4-steve@sk2.org

authored by

Stephen Kitt and committed by
Sam Ravnborg
c974f755 d9e74da2

+2 -10
+2 -10
drivers/gpu/drm/panel/panel-sony-acx565akm.c
··· 298 298 static int acx565akm_bl_update_status_locked(struct backlight_device *dev) 299 299 { 300 300 struct acx565akm_panel *lcd = dev_get_drvdata(&dev->dev); 301 - int level; 302 - 303 - if (dev->props.fb_blank == FB_BLANK_UNBLANK && 304 - dev->props.power == FB_BLANK_UNBLANK) 305 - level = dev->props.brightness; 306 - else 307 - level = 0; 301 + int level = backlight_get_brightness(dev); 308 302 309 303 acx565akm_set_brightness(lcd, level); 310 304 ··· 324 330 325 331 mutex_lock(&lcd->mutex); 326 332 327 - if (dev->props.fb_blank == FB_BLANK_UNBLANK && 328 - dev->props.power == FB_BLANK_UNBLANK) 333 + if (!backlight_is_blank(dev)) 329 334 intensity = acx565akm_get_actual_brightness(lcd); 330 335 else 331 336 intensity = 0; ··· 342 349 static int acx565akm_backlight_init(struct acx565akm_panel *lcd) 343 350 { 344 351 struct backlight_properties props = { 345 - .fb_blank = FB_BLANK_UNBLANK, 346 352 .power = FB_BLANK_UNBLANK, 347 353 .type = BACKLIGHT_RAW, 348 354 };