diff options
Diffstat (limited to 'extras/recipes-kernel/linux/linux-omap-psp-2.6.32/omap3-touchbook/0014-backlight-add-PWM-support.patch')
-rw-r--r-- | extras/recipes-kernel/linux/linux-omap-psp-2.6.32/omap3-touchbook/0014-backlight-add-PWM-support.patch | 126 |
1 files changed, 126 insertions, 0 deletions
diff --git a/extras/recipes-kernel/linux/linux-omap-psp-2.6.32/omap3-touchbook/0014-backlight-add-PWM-support.patch b/extras/recipes-kernel/linux/linux-omap-psp-2.6.32/omap3-touchbook/0014-backlight-add-PWM-support.patch new file mode 100644 index 00000000..d517f072 --- /dev/null +++ b/extras/recipes-kernel/linux/linux-omap-psp-2.6.32/omap3-touchbook/0014-backlight-add-PWM-support.patch | |||
@@ -0,0 +1,126 @@ | |||
1 | From cc8cb0d0731c7a0517653e65c754051a69f34c3e Mon Sep 17 00:00:00 2001 | ||
2 | From: Gregoire Gentil <gregoire@gentil.com> | ||
3 | Date: Wed, 31 Mar 2010 11:14:04 +0200 | ||
4 | Subject: [PATCH 14/17] backlight: add PWM support | ||
5 | |||
6 | --- | ||
7 | drivers/video/backlight/backlight.c | 81 +++++++++++++++++++++++++++++++++++ | ||
8 | include/linux/backlight.h | 3 + | ||
9 | 2 files changed, 84 insertions(+), 0 deletions(-) | ||
10 | |||
11 | diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c | ||
12 | index 7898707..615f40f 100644 | ||
13 | --- a/drivers/video/backlight/backlight.c | ||
14 | +++ b/drivers/video/backlight/backlight.c | ||
15 | @@ -226,6 +226,84 @@ static void bl_device_release(struct device *dev) | ||
16 | kfree(bd); | ||
17 | } | ||
18 | |||
19 | +static ssize_t backlight_show_boost(struct device *dev, struct device_attribute *attr, char *buf) | ||
20 | +{ | ||
21 | + struct backlight_device *bd = to_backlight_device(dev); | ||
22 | + return sprintf(buf, "%u\n", bd->props.boost); | ||
23 | +} | ||
24 | + | ||
25 | +static ssize_t backlight_store_boost(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) | ||
26 | +{ | ||
27 | + unsigned long i; | ||
28 | + struct backlight_device *bd = to_backlight_device(dev); | ||
29 | + | ||
30 | + if (strict_strtoul(buf, 10, &i)) | ||
31 | + return -EINVAL; | ||
32 | + | ||
33 | + mutex_lock(&bd->ops_lock); | ||
34 | + if (bd->ops) | ||
35 | + { | ||
36 | + if (i) | ||
37 | + bd->props.boost = 1; | ||
38 | + else | ||
39 | + bd->props.boost = 0; | ||
40 | + backlight_update_status(bd); | ||
41 | + } | ||
42 | + mutex_unlock(&bd->ops_lock); | ||
43 | + | ||
44 | + return count; | ||
45 | +} | ||
46 | + | ||
47 | +static ssize_t backlight_show_pwm_fq(struct device *dev, struct device_attribute *attr, char *buf) | ||
48 | +{ | ||
49 | + struct backlight_device *bd = to_backlight_device(dev); | ||
50 | + return sprintf(buf, "%u\n", bd->props.pwm_fq); | ||
51 | +} | ||
52 | + | ||
53 | +static ssize_t backlight_store_pwm_fq(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) | ||
54 | +{ | ||
55 | + unsigned long i; | ||
56 | + struct backlight_device *bd = to_backlight_device(dev); | ||
57 | + | ||
58 | + if (strict_strtoul(buf, 10, &i)) | ||
59 | + return -EINVAL; | ||
60 | + | ||
61 | + mutex_lock(&bd->ops_lock); | ||
62 | + if (bd->ops) | ||
63 | + { | ||
64 | + bd->props.pwm_fq = i; | ||
65 | + backlight_update_status(bd); | ||
66 | + } | ||
67 | + mutex_unlock(&bd->ops_lock); | ||
68 | + | ||
69 | + return count; | ||
70 | +} | ||
71 | + | ||
72 | +static ssize_t backlight_show_min_duty(struct device *dev, struct device_attribute *attr, char *buf) | ||
73 | +{ | ||
74 | + struct backlight_device *bd = to_backlight_device(dev); | ||
75 | + return sprintf(buf, "%u\n", bd->props.min_duty); | ||
76 | +} | ||
77 | + | ||
78 | +static ssize_t backlight_store_min_duty(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) | ||
79 | +{ | ||
80 | + unsigned long i; | ||
81 | + struct backlight_device *bd = to_backlight_device(dev); | ||
82 | + | ||
83 | + if (strict_strtoul(buf, 10, &i)) | ||
84 | + return -EINVAL; | ||
85 | + | ||
86 | + mutex_lock(&bd->ops_lock); | ||
87 | + if (bd->ops) | ||
88 | + { | ||
89 | + bd->props.min_duty = i; | ||
90 | + backlight_update_status(bd); | ||
91 | + } | ||
92 | + mutex_unlock(&bd->ops_lock); | ||
93 | + | ||
94 | + return count; | ||
95 | +} | ||
96 | + | ||
97 | static struct device_attribute bl_device_attributes[] = { | ||
98 | __ATTR(bl_power, 0644, backlight_show_power, backlight_store_power), | ||
99 | __ATTR(brightness, 0666, backlight_show_brightness, | ||
100 | @@ -233,6 +311,9 @@ static struct device_attribute bl_device_attributes[] = { | ||
101 | __ATTR(actual_brightness, 0444, backlight_show_actual_brightness, | ||
102 | NULL), | ||
103 | __ATTR(max_brightness, 0444, backlight_show_max_brightness, NULL), | ||
104 | + __ATTR(boost, 0666, backlight_show_boost, backlight_store_boost), | ||
105 | + __ATTR(pwm_fq, 0666, backlight_show_pwm_fq, backlight_store_pwm_fq), | ||
106 | + __ATTR(min_duty, 0666, backlight_show_min_duty, backlight_store_min_duty), | ||
107 | __ATTR_NULL, | ||
108 | }; | ||
109 | |||
110 | diff --git a/include/linux/backlight.h b/include/linux/backlight.h | ||
111 | index 0f5f578..f3a9b9f 100644 | ||
112 | --- a/include/linux/backlight.h | ||
113 | +++ b/include/linux/backlight.h | ||
114 | @@ -64,6 +64,9 @@ struct backlight_properties { | ||
115 | int fb_blank; | ||
116 | /* Flags used to signal drivers of state changes */ | ||
117 | /* Upper 4 bits are reserved for driver internal use */ | ||
118 | + int boost; | ||
119 | + int pwm_fq; | ||
120 | + int min_duty; | ||
121 | unsigned int state; | ||
122 | |||
123 | #define BL_CORE_SUSPENDED (1 << 0) /* backlight is suspended */ | ||
124 | -- | ||
125 | 1.6.6.1 | ||
126 | |||