diff options
-rw-r--r-- | drivers/video/backlight/pwm_bl.c | 11 | ||||
-rw-r--r-- | include/linux/pwm_backlight.h | 3 |
2 files changed, 14 insertions, 0 deletions
diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c index 2c2a2c703c14..b8f38ec6eb18 100644 --- a/drivers/video/backlight/pwm_bl.c +++ b/drivers/video/backlight/pwm_bl.c | |||
@@ -28,6 +28,7 @@ struct pwm_bl_data { | |||
28 | unsigned int lth_brightness; | 28 | unsigned int lth_brightness; |
29 | int (*notify)(struct device *, | 29 | int (*notify)(struct device *, |
30 | int brightness); | 30 | int brightness); |
31 | int (*check_fb)(struct device *, struct fb_info *); | ||
31 | }; | 32 | }; |
32 | 33 | ||
33 | static int pwm_backlight_update_status(struct backlight_device *bl) | 34 | static int pwm_backlight_update_status(struct backlight_device *bl) |
@@ -62,9 +63,18 @@ static int pwm_backlight_get_brightness(struct backlight_device *bl) | |||
62 | return bl->props.brightness; | 63 | return bl->props.brightness; |
63 | } | 64 | } |
64 | 65 | ||
66 | static int pwm_backlight_check_fb(struct backlight_device *bl, | ||
67 | struct fb_info *info) | ||
68 | { | ||
69 | struct pwm_bl_data *pb = dev_get_drvdata(&bl->dev); | ||
70 | |||
71 | return !pb->check_fb || pb->check_fb(pb->dev, info); | ||
72 | } | ||
73 | |||
65 | static const struct backlight_ops pwm_backlight_ops = { | 74 | static const struct backlight_ops pwm_backlight_ops = { |
66 | .update_status = pwm_backlight_update_status, | 75 | .update_status = pwm_backlight_update_status, |
67 | .get_brightness = pwm_backlight_get_brightness, | 76 | .get_brightness = pwm_backlight_get_brightness, |
77 | .check_fb = pwm_backlight_check_fb, | ||
68 | }; | 78 | }; |
69 | 79 | ||
70 | static int pwm_backlight_probe(struct platform_device *pdev) | 80 | static int pwm_backlight_probe(struct platform_device *pdev) |
@@ -95,6 +105,7 @@ static int pwm_backlight_probe(struct platform_device *pdev) | |||
95 | 105 | ||
96 | pb->period = data->pwm_period_ns; | 106 | pb->period = data->pwm_period_ns; |
97 | pb->notify = data->notify; | 107 | pb->notify = data->notify; |
108 | pb->check_fb = data->check_fb; | ||
98 | pb->lth_brightness = data->lth_brightness * | 109 | pb->lth_brightness = data->lth_brightness * |
99 | (data->pwm_period_ns / data->max_brightness); | 110 | (data->pwm_period_ns / data->max_brightness); |
100 | pb->dev = &pdev->dev; | 111 | pb->dev = &pdev->dev; |
diff --git a/include/linux/pwm_backlight.h b/include/linux/pwm_backlight.h index e031e1a486d9..5e3e25a3c9c3 100644 --- a/include/linux/pwm_backlight.h +++ b/include/linux/pwm_backlight.h | |||
@@ -4,6 +4,8 @@ | |||
4 | #ifndef __LINUX_PWM_BACKLIGHT_H | 4 | #ifndef __LINUX_PWM_BACKLIGHT_H |
5 | #define __LINUX_PWM_BACKLIGHT_H | 5 | #define __LINUX_PWM_BACKLIGHT_H |
6 | 6 | ||
7 | #include <linux/backlight.h> | ||
8 | |||
7 | struct platform_pwm_backlight_data { | 9 | struct platform_pwm_backlight_data { |
8 | int pwm_id; | 10 | int pwm_id; |
9 | unsigned int max_brightness; | 11 | unsigned int max_brightness; |
@@ -13,6 +15,7 @@ struct platform_pwm_backlight_data { | |||
13 | int (*init)(struct device *dev); | 15 | int (*init)(struct device *dev); |
14 | int (*notify)(struct device *dev, int brightness); | 16 | int (*notify)(struct device *dev, int brightness); |
15 | void (*exit)(struct device *dev); | 17 | void (*exit)(struct device *dev); |
18 | int (*check_fb)(struct device *dev, struct fb_info *info); | ||
16 | }; | 19 | }; |
17 | 20 | ||
18 | #endif | 21 | #endif |