Advertisement
Guest User

pwm backlight for nexus 7

a guest
Nov 7th, 2012
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.59 KB | None | 0 0
  1. diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c
  2. index 342b7d7..67bee2e 100644
  3. --- a/drivers/video/backlight/pwm_bl.c
  4. +++ b/drivers/video/backlight/pwm_bl.c
  5. @@ -38,17 +38,18 @@ static int pwm_backlight_update_status(struct backlight_device *bl)
  6.         struct pwm_bl_data *pb = dev_get_drvdata(&bl->dev);
  7.         int brightness = bl->props.brightness;
  8.         int max = bl->props.max_brightness;
  9. +       int poweroff = false;
  10.  
  11.         if (bl->props.power != FB_BLANK_UNBLANK)
  12. -               brightness = 0;
  13. +               poweroff = true;
  14.  
  15.         if (bl->props.fb_blank != FB_BLANK_UNBLANK)
  16. -               brightness = 0;
  17. +               poweroff = true;
  18.  
  19.         if (pb->notify)
  20.                 brightness = pb->notify(pb->dev, brightness);
  21.  
  22. -       if (brightness == 0) {
  23. +       if (poweroff) {
  24.                 pwm_config(pb->pwm, 0, pb->period);
  25.                 pwm_disable(pb->pwm);
  26.         } else {
  27. @@ -58,6 +59,7 @@ static int pwm_backlight_update_status(struct backlight_device *bl)
  28.                 pwm_enable(pb->pwm);
  29.         }
  30.  
  31. +       /* maybe this needs to send back 0 if power is off? */
  32.         if (pb->notify_after)
  33.                 pb->notify_after(pb->dev, brightness);
  34.  
  35. @@ -66,6 +68,11 @@ static int pwm_backlight_update_status(struct backlight_device *bl)
  36.  
  37.  static int pwm_backlight_get_brightness(struct backlight_device *bl)
  38.  {
  39. +       if ((bl->props.power != FB_BLANK_UNBLANK) ||
  40. +           (bl->props.fb_blank != FB_BLANK_UNBLANK) ) {
  41. +               return 0;
  42. +       }
  43. +
  44.         return bl->props.brightness;
  45.  }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement