[led-backlight] default-brightness-level issue

pgeiem pgeiem at protonmail.com
Fri Apr 23 13:04:23 UTC 2021


Dear all,

On a custom board I have a simple DPI panel. Panel's backlight is drive with an I2C led driver (PCA9632). led-backlight driver is sued to manage this as a backlight.

When using brightness-levels and default-brightness-level the backlight stay turned-off even if manually trying to set a different index value to brightness through sysfs.

I traced this issue as follow: When led_bl_update_status() is called the brightness value is returned from backlight_get_brightness() which call backlight_is_blank(). In my case backlight_is_blank() return true due to props.power = FB_BLANK_POWERDOWN which is != FB_BLANK_UNBLANK.

I traced why at startup props.power is FB_BLANK_POWERDOWN and found that in led_bl_probe() when a default brightness is set (>0) props.power is set to FB_BLANK_POWERDOWN which seems incorrect to me.

I made the small change below and default brightness is correctly used at startup.
I am not really sure this is an issue and if my change is correct or if I am doing something incorrect somewhere else. So I first would like to get your opinion on this and if correct will send a patch.

Many thanks in advance
Patrick


diff --git a/drivers/video/backlight/led_bl.c b/drivers/video/backlight/led_bl.c
--- a/drivers/video/backlight/led_bl.c
+++ b/drivers/video/backlight/led_bl.c
@@ -200,7 +200,7 @@ static int led_bl_probe(struct platform_device *pdev)
        props.type = BACKLIGHT_RAW;
        props.max_brightness = priv->max_brightness;
        props.brightness = priv->default_brightness;
-       props.power = (priv->default_brightness > 0) ? FB_BLANK_POWERDOWN :
+       props.power = (priv->default_brightness == 0) ? FB_BLANK_POWERDOWN :
                      FB_BLANK_UNBLANK;
        priv->bl_dev = backlight_device_register(dev_name(&pdev->dev),
                        &pdev->dev, priv, &led_bl_ops, &props);



More information about the dri-devel mailing list