]> git.karo-electronics.de Git - linux-beck.git/commitdiff
pwm_backlight: add check_fb() hook
authorRobert Morell <rmorell@nvidia.com>
Tue, 22 Mar 2011 23:30:31 +0000 (16:30 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 23 Mar 2011 00:44:00 +0000 (17:44 -0700)
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.

Signed-off-by: Robert Morell <rmorell@nvidia.com>
Cc: Richard Purdie <rpurdie@rpsys.net>
Cc: Arun Murthy <arun.murthy@stericsson.com>
Cc: Linus Walleij <linus.walleij@stericsson.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/video/backlight/pwm_bl.c
include/linux/pwm_backlight.h

index 2c2a2c703c1465e3e98978d0bf7d6307ba494ac9..b8f38ec6eb1898ab0b60d606ec1f3998e11fe339 100644 (file)
@@ -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;
index e031e1a486d9fc8e7d7d6539c75d39df1235d2c2..5e3e25a3c9c38d3c3c5be63d2b40cd740f62cfd7 100644 (file)
@@ -4,6 +4,8 @@
 #ifndef __LINUX_PWM_BACKLIGHT_H
 #define __LINUX_PWM_BACKLIGHT_H
 
+#include <linux/backlight.h>
+
 struct platform_pwm_backlight_data {
        int pwm_id;
        unsigned int max_brightness;
@@ -13,6 +15,7 @@ struct platform_pwm_backlight_data {
        int (*init)(struct device *dev);
        int (*notify)(struct device *dev, int brightness);
        void (*exit)(struct device *dev);
+       int (*check_fb)(struct device *dev, struct fb_info *info);
 };
 
 #endif