Skip to content

Commit

Permalink
backlight: add a callback 'notify_after' for backlight control
Browse files Browse the repository at this point in the history
We need a callback to do some things after pwm_enable, pwm_disable
and pwm_config.

Signed-off-by: Dilan Lee <[email protected]>
Reviewed-by: Robert Morell <[email protected]>
Reviewed-by: Arun Murthy <[email protected]>
Cc: Richard Purdie <[email protected]>
Cc: Paul Mundt <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Dilan Lee authored and torvalds committed Aug 25, 2011
1 parent 23751be commit cc7993f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions drivers/video/backlight/pwm_bl.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ struct pwm_bl_data {
unsigned int lth_brightness;
int (*notify)(struct device *,
int brightness);
void (*notify_after)(struct device *,
int brightness);
int (*check_fb)(struct device *, struct fb_info *);
};

Expand Down Expand Up @@ -55,6 +57,10 @@ static int pwm_backlight_update_status(struct backlight_device *bl)
pwm_config(pb->pwm, brightness, pb->period);
pwm_enable(pb->pwm);
}

if (pb->notify_after)
pb->notify_after(pb->dev, brightness);

return 0;
}

Expand Down Expand Up @@ -105,6 +111,7 @@ static int pwm_backlight_probe(struct platform_device *pdev)

pb->period = data->pwm_period_ns;
pb->notify = data->notify;
pb->notify_after = data->notify_after;
pb->check_fb = data->check_fb;
pb->lth_brightness = data->lth_brightness *
(data->pwm_period_ns / data->max_brightness);
Expand Down Expand Up @@ -172,6 +179,8 @@ static int pwm_backlight_suspend(struct platform_device *pdev,
pb->notify(pb->dev, 0);
pwm_config(pb->pwm, 0, pb->period);
pwm_disable(pb->pwm);
if (pb->notify_after)
pb->notify_after(pb->dev, 0);
return 0;
}

Expand Down
1 change: 1 addition & 0 deletions include/linux/pwm_backlight.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ struct platform_pwm_backlight_data {
unsigned int pwm_period_ns;
int (*init)(struct device *dev);
int (*notify)(struct device *dev, int brightness);
void (*notify_after)(struct device *dev, int brightness);
void (*exit)(struct device *dev);
int (*check_fb)(struct device *dev, struct fb_info *info);
};
Expand Down

0 comments on commit cc7993f

Please sign in to comment.