diff options
author | Robert Morell <rmorell@nvidia.com> | 2011-03-03 19:33:42 -0800 |
---|---|---|
committer | Varun Colbert <vcolbert@nvidia.com> | 2011-03-22 16:34:50 -0800 |
commit | b334e8443ed875a89854f9f8639f1f17f030cb5c (patch) | |
tree | 9e54a24da1b7268be4fc0165e9c524f47719df37 /drivers | |
parent | 503bdb0afcc819d79b18d6786127bd8c988cfae4 (diff) |
video: pwm_backlight: Add check_fb hook
In systems with multiple framebuffer devices, one of the devices might
be blanked while another is unblanked. In order for the backlight
blanking logic to know whether to turn off the backlight for a
particular framebuffer's blanking notification, it needs to be able to
check if a given framebuffer device corresponds to the backlight.
This plumbs the check_fb hook from core backlight through the
pwm_backlight helper to allow platform code to plug in a check_fb hook.
Originally reviewed on http://git-master/r/21716
Reviewed-on: http://git-master/r/23100
(cherry picked from commit c7831cb27fc6a2701b020676a6daf9c76e9470d9)
Change-Id: I32895d6f2c5988b09680a350e169f1f3c9b56da6
Reviewed-on: http://git-master/r/23725
Reviewed-by: Robert Morell <rmorell@nvidia.com>
Tested-by: Gaurav Sarode <gsarode@nvidia.com>
Reviewed-by: Mayuresh Kulkarni <mkulkarni@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/video/backlight/pwm_bl.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c index 21866ec69656..0f2c131e86af 100644 --- a/drivers/video/backlight/pwm_bl.c +++ b/drivers/video/backlight/pwm_bl.c @@ -28,6 +28,7 @@ struct pwm_bl_data { unsigned int lth_brightness; int (*notify)(struct device *, int brightness); + int (*check_fb)(struct device *, struct fb_info *); }; static int pwm_backlight_update_status(struct backlight_device *bl) @@ -62,9 +63,18 @@ static int pwm_backlight_get_brightness(struct backlight_device *bl) return bl->props.brightness; } +static int pwm_backlight_check_fb(struct backlight_device *bl, + struct fb_info *info) +{ + struct pwm_bl_data *pb = dev_get_drvdata(&bl->dev); + + return !pb->check_fb || pb->check_fb(pb->dev, info); +} + static const struct backlight_ops pwm_backlight_ops = { .update_status = pwm_backlight_update_status, .get_brightness = pwm_backlight_get_brightness, + .check_fb = pwm_backlight_check_fb, }; static int pwm_backlight_probe(struct platform_device *pdev) @@ -95,6 +105,7 @@ static int pwm_backlight_probe(struct platform_device *pdev) pb->period = data->pwm_period_ns; pb->notify = data->notify; + pb->check_fb = data->check_fb; pb->lth_brightness = data->lth_brightness * (data->pwm_period_ns / data->max_brightness); pb->dev = &pdev->dev; |