diff options
author | Alexander Shiyan <shc_work@mail.ru> | 2012-11-17 08:57:20 -0500 |
---|---|---|
committer | Olof Johansson <olof@lixom.net> | 2012-11-21 12:57:45 -0500 |
commit | 94760bf2523b4b5d3938e85ea0964ca7cd59a42b (patch) | |
tree | 93643ae945d3a3fc6e37325f268cda2fe3e7ddc4 /drivers/video/clps711xfb.c | |
parent | e377ca1e32f66378cc6d0562851bfc51126865ea (diff) |
ARM: clps711x: Moving backlight controls of framebuffer driver to the board
This patch moves the backlight controls for clps711x-framebuffer driver
to the board code. To control we use "generic-bl" driver.
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
[olof: fixed space/tab whitespace in drivers/video/clps711xfb.c]
Signed-off-by: Olof Johansson <olof@lixom.net>
Diffstat (limited to 'drivers/video/clps711xfb.c')
-rw-r--r-- | drivers/video/clps711xfb.c | 107 |
1 files changed, 6 insertions, 101 deletions
diff --git a/drivers/video/clps711xfb.c b/drivers/video/clps711xfb.c index 1902551f6e45..63ecdf8f7baf 100644 --- a/drivers/video/clps711xfb.c +++ b/drivers/video/clps711xfb.c | |||
@@ -22,19 +22,15 @@ | |||
22 | #include <linux/mm.h> | 22 | #include <linux/mm.h> |
23 | #include <linux/module.h> | 23 | #include <linux/module.h> |
24 | #include <linux/kernel.h> | 24 | #include <linux/kernel.h> |
25 | #include <linux/seq_file.h> | ||
26 | #include <linux/slab.h> | 25 | #include <linux/slab.h> |
27 | #include <linux/fb.h> | 26 | #include <linux/fb.h> |
28 | #include <linux/init.h> | 27 | #include <linux/init.h> |
29 | #include <linux/proc_fs.h> | ||
30 | #include <linux/delay.h> | 28 | #include <linux/delay.h> |
31 | 29 | ||
32 | #include <mach/hardware.h> | 30 | #include <mach/hardware.h> |
33 | #include <asm/mach-types.h> | 31 | #include <asm/mach-types.h> |
34 | #include <linux/uaccess.h> | 32 | #include <linux/uaccess.h> |
35 | 33 | ||
36 | #include <mach/syspld.h> | ||
37 | |||
38 | struct fb_info *cfb; | 34 | struct fb_info *cfb; |
39 | 35 | ||
40 | #define CMAP_MAX_SIZE 16 | 36 | #define CMAP_MAX_SIZE 16 |
@@ -162,25 +158,12 @@ clps7111fb_set_par(struct fb_info *info) | |||
162 | 158 | ||
163 | static int clps7111fb_blank(int blank, struct fb_info *info) | 159 | static int clps7111fb_blank(int blank, struct fb_info *info) |
164 | { | 160 | { |
165 | if (blank) { | 161 | /* Enable/Disable LCD controller. */ |
166 | if (machine_is_edb7211()) { | 162 | if (blank) |
167 | /* Turn off the LCD backlight. */ | 163 | clps_writel(clps_readl(SYSCON1) & ~SYSCON1_LCDEN, SYSCON1); |
168 | clps_writeb(clps_readb(PDDR) & ~EDB_PD3_LCDBL, PDDR); | 164 | else |
169 | 165 | clps_writel(clps_readl(SYSCON1) | SYSCON1_LCDEN, SYSCON1); | |
170 | /* Disable LCD controller. */ | 166 | |
171 | clps_writel(clps_readl(SYSCON1) & ~SYSCON1_LCDEN, | ||
172 | SYSCON1); | ||
173 | } | ||
174 | } else { | ||
175 | if (machine_is_edb7211()) { | ||
176 | /* Enable LCD controller. */ | ||
177 | clps_writel(clps_readl(SYSCON1) | SYSCON1_LCDEN, | ||
178 | SYSCON1); | ||
179 | |||
180 | /* Turn on the LCD backlight. */ | ||
181 | clps_writeb(clps_readb(PDDR) | EDB_PD3_LCDBL, PDDR); | ||
182 | } | ||
183 | } | ||
184 | return 0; | 167 | return 0; |
185 | } | 168 | } |
186 | 169 | ||
@@ -195,62 +178,6 @@ static struct fb_ops clps7111fb_ops = { | |||
195 | .fb_imageblit = cfb_imageblit, | 178 | .fb_imageblit = cfb_imageblit, |
196 | }; | 179 | }; |
197 | 180 | ||
198 | static int backlight_proc_show(struct seq_file *m, void *v) | ||
199 | { | ||
200 | if (machine_is_edb7211()) { | ||
201 | seq_printf(m, "%d\n", | ||
202 | (clps_readb(PDDR) & EDB_PD3_LCDBL) ? 1 : 0); | ||
203 | } | ||
204 | |||
205 | return 0; | ||
206 | } | ||
207 | |||
208 | static int backlight_proc_open(struct inode *inode, struct file *file) | ||
209 | { | ||
210 | return single_open(file, backlight_proc_show, NULL); | ||
211 | } | ||
212 | |||
213 | static ssize_t backlight_proc_write(struct file *file, const char *buffer, | ||
214 | size_t count, loff_t *pos) | ||
215 | { | ||
216 | unsigned char char_value; | ||
217 | int value; | ||
218 | |||
219 | if (count < 1) { | ||
220 | return -EINVAL; | ||
221 | } | ||
222 | |||
223 | if (copy_from_user(&char_value, buffer, 1)) | ||
224 | return -EFAULT; | ||
225 | |||
226 | value = char_value - '0'; | ||
227 | |||
228 | if (machine_is_edb7211()) { | ||
229 | unsigned char port_d; | ||
230 | |||
231 | port_d = clps_readb(PDDR); | ||
232 | |||
233 | if (value) { | ||
234 | port_d |= EDB_PD3_LCDBL; | ||
235 | } else { | ||
236 | port_d &= ~EDB_PD3_LCDBL; | ||
237 | } | ||
238 | |||
239 | clps_writeb(port_d, PDDR); | ||
240 | } | ||
241 | |||
242 | return count; | ||
243 | } | ||
244 | |||
245 | static const struct file_operations backlight_proc_fops = { | ||
246 | .owner = THIS_MODULE, | ||
247 | .open = backlight_proc_open, | ||
248 | .read = seq_read, | ||
249 | .llseek = seq_lseek, | ||
250 | .release = single_release, | ||
251 | .write = backlight_proc_write, | ||
252 | }; | ||
253 | |||
254 | static void __devinit clps711x_guess_lcd_params(struct fb_info *info) | 181 | static void __devinit clps711x_guess_lcd_params(struct fb_info *info) |
255 | { | 182 | { |
256 | unsigned int lcdcon, syscon, size; | 183 | unsigned int lcdcon, syscon, size; |
@@ -359,22 +286,6 @@ static int __devinit clps711x_fb_probe(struct platform_device *pdev) | |||
359 | 286 | ||
360 | fb_alloc_cmap(&cfb->cmap, CMAP_MAX_SIZE, 0); | 287 | fb_alloc_cmap(&cfb->cmap, CMAP_MAX_SIZE, 0); |
361 | 288 | ||
362 | if (!proc_create("backlight", 0444, NULL, &backlight_proc_fops)) { | ||
363 | printk("Couldn't create the /proc entry for the backlight.\n"); | ||
364 | return -EINVAL; | ||
365 | } | ||
366 | |||
367 | /* | ||
368 | * Power up the LCD | ||
369 | */ | ||
370 | if (machine_is_p720t()) | ||
371 | PLD_PWR |= PLD_S3_ON; | ||
372 | |||
373 | if (machine_is_edb7211()) { | ||
374 | /* Turn on the LCD backlight. */ | ||
375 | clps_writeb(clps_readb(PDDR) | EDB_PD3_LCDBL, PDDR); | ||
376 | } | ||
377 | |||
378 | err = register_framebuffer(cfb); | 289 | err = register_framebuffer(cfb); |
379 | 290 | ||
380 | out: return err; | 291 | out: return err; |
@@ -385,12 +296,6 @@ static int __devexit clps711x_fb_remove(struct platform_device *pdev) | |||
385 | unregister_framebuffer(cfb); | 296 | unregister_framebuffer(cfb); |
386 | kfree(cfb); | 297 | kfree(cfb); |
387 | 298 | ||
388 | /* | ||
389 | * Power down the LCD | ||
390 | */ | ||
391 | if (machine_is_p720t()) | ||
392 | PLD_PWR &= ~PLD_S3_ON; | ||
393 | |||
394 | return 0; | 299 | return 0; |
395 | } | 300 | } |
396 | 301 | ||