• Heiko Stuebner's avatar
    backlight: pwm_bl: Re-add driver internal enabled tracking · e4c8ae3e
    Heiko Stuebner authored
    Commit e6bcca08 ("backlight: pwm_bl: Switch to using "atomic" PWM API")
    removed the driver internal enabled tracking in favor of simply checking
    the pwm state.
    
    This can lead to issues as all of gpio-, regulator- and pwm-state are used
    to determine the initial state and the bootloader or kernel can leave them
    in an inconsistent state at boot.
    
    In my case on rk3399-kevin, the pwm backlight is build as module and the
    kernel disables the supply regulator as unused while keeping the pwm running
    thus pwm_bl calling pwm_backlight_power_off() during probe and creating an
    unmatched regulator-disable call, as it never got enabled from the pwm-bl
    before.
    
    To prevent these consistency issues, reintroduce the driver-internal
    tracking of the enabled state.
    
    Fixes: e6bcca08 ("backlight: pwm_bl: Switch to using "atomic" PWM API")
    Signed-off-by: default avatarHeiko Stuebner <heiko@sntech.de>
    Acked-by: default avatarThierry Reding <thierry.reding@gmail.com>
    Acked-by: default avatarDaniel Thompson <daniel.thompson@linaro.org>
    Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
    e4c8ae3e
pwm_bl.c 17.4 KB