• Enric Balletbo i Serra's avatar
    backlight: pwm_bl: Linear interpolation between brightness-levels · 573fe6d1
    Enric Balletbo i Serra authored
    Setting num-interpolated-steps in the dts will allow you to have linear
    interpolation between values of brightness-levels. This way a high
    resolution pwm duty cycle can be used without having to list out every
    possible value in the dts. This system also allows for gamma corrected
    values.
    
    The most simple example is interpolate between two brightness values a
    number of steps, this can be done setting the following in the dts:
    
      brightness-levels = <0 65535>;
      num-interpolated-steps = <1024>;
      default-brightness-level = <512>;
    
    This will create a brightness-level table with the following values:
    
      <0 63 126 189 252 315 378 441 ... 64260 64323 64386 64449 65535>
    
    Another use case can be describe a gamma corrected curve, as we have
    better sensitivity at low luminance than high luminance we probably
    want have smaller steps for low brightness levels values and bigger
    steps for high brightness levels values. This can be achieved with
    the following in the dts:
    
      brightness-levels = <0 4096 65535>;
      num-interpolated-steps = <1024>;
      default-brightness-level = <512>;
    
    This will create a brightness-levels table with the following values:
    
      <0 4 8 12 16 20 ... 4096 4156 4216 4276 ... 65535>
    Signed-off-by: default avatarEnric Balletbo i Serra <enric.balletbo@collabora.com>
    Acked-by: default avatarDaniel Thompson <daniel.thompson@linaro.org>
    Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
    573fe6d1
pwm_bl.c 14 KB