mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 19:21:31 -04:00
backlight: add a callback 'notify_after' for backlight control
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]>
This commit is contained in:
parent
23751be009
commit
cc7993f643
2 changed files with 10 additions and 0 deletions
|
|
@ -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 *);
|
||||
};
|
||||
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
@ -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);
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue