diff options
| -rw-r--r-- | arch/arm/mach-clps711x/edb7211.c | 18 | ||||
| -rw-r--r-- | arch/arm/mach-clps711x/include/mach/hardware.h | 6 | ||||
| -rw-r--r-- | arch/arm/mach-clps711x/p720t.c | 21 | ||||
| -rw-r--r-- | drivers/video/clps711xfb.c | 107 |
4 files changed, 44 insertions, 108 deletions
diff --git a/arch/arm/mach-clps711x/edb7211.c b/arch/arm/mach-clps711x/edb7211.c index 81cc6835d7a5..d5832b3557a1 100644 --- a/arch/arm/mach-clps711x/edb7211.c +++ b/arch/arm/mach-clps711x/edb7211.c | |||
| @@ -13,6 +13,7 @@ | |||
| 13 | #include <linux/memblock.h> | 13 | #include <linux/memblock.h> |
| 14 | #include <linux/types.h> | 14 | #include <linux/types.h> |
| 15 | #include <linux/interrupt.h> | 15 | #include <linux/interrupt.h> |
| 16 | #include <linux/backlight.h> | ||
| 16 | #include <linux/platform_device.h> | 17 | #include <linux/platform_device.h> |
| 17 | 18 | ||
| 18 | #include <asm/setup.h> | 19 | #include <asm/setup.h> |
| @@ -30,6 +31,7 @@ | |||
| 30 | 31 | ||
| 31 | #define EDB7211_LCD_DC_DC_EN CLPS711X_GPIO(3, 1) | 32 | #define EDB7211_LCD_DC_DC_EN CLPS711X_GPIO(3, 1) |
| 32 | #define EDB7211_LCDEN CLPS711X_GPIO(3, 2) | 33 | #define EDB7211_LCDEN CLPS711X_GPIO(3, 2) |
| 34 | #define EDB7211_LCDBL CLPS711X_GPIO(3, 3) | ||
| 33 | 35 | ||
| 34 | #define EDB7211_CS8900_BASE (CS2_PHYS_BASE + 0x300) | 36 | #define EDB7211_CS8900_BASE (CS2_PHYS_BASE + 0x300) |
| 35 | #define EDB7211_CS8900_IRQ (IRQ_EINT3) | 37 | #define EDB7211_CS8900_IRQ (IRQ_EINT3) |
| @@ -56,9 +58,22 @@ static struct plat_lcd_data edb7211_lcd_power_pdata = { | |||
| 56 | .set_power = edb7211_lcd_power_set, | 58 | .set_power = edb7211_lcd_power_set, |
| 57 | }; | 59 | }; |
| 58 | 60 | ||
| 61 | static void edb7211_lcd_backlight_set_intensity(int intensity) | ||
| 62 | { | ||
| 63 | gpio_set_value(EDB7211_LCDBL, intensity); | ||
| 64 | } | ||
| 65 | |||
| 66 | static struct generic_bl_info edb7211_lcd_backlight_pdata = { | ||
| 67 | .name = "lcd-backlight.0", | ||
| 68 | .default_intensity = 0x01, | ||
| 69 | .max_intensity = 0x01, | ||
| 70 | .set_bl_intensity = edb7211_lcd_backlight_set_intensity, | ||
| 71 | }; | ||
| 72 | |||
| 59 | static struct gpio edb7211_gpios[] __initconst = { | 73 | static struct gpio edb7211_gpios[] __initconst = { |
| 60 | { EDB7211_LCD_DC_DC_EN, GPIOF_OUT_INIT_LOW, "LCD DC-DC" }, | 74 | { EDB7211_LCD_DC_DC_EN, GPIOF_OUT_INIT_LOW, "LCD DC-DC" }, |
| 61 | { EDB7211_LCDEN, GPIOF_OUT_INIT_LOW, "LCD POWER" }, | 75 | { EDB7211_LCDEN, GPIOF_OUT_INIT_LOW, "LCD POWER" }, |
| 76 | { EDB7211_LCDBL, GPIOF_OUT_INIT_LOW, "LCD BACKLIGHT" }, | ||
| 62 | }; | 77 | }; |
| 63 | 78 | ||
| 64 | static struct map_desc edb7211_io_desc[] __initdata = { | 79 | static struct map_desc edb7211_io_desc[] __initdata = { |
| @@ -117,6 +132,9 @@ static void __init edb7211_init(void) | |||
| 117 | platform_device_register_data(&platform_bus, "platform-lcd", 0, | 132 | platform_device_register_data(&platform_bus, "platform-lcd", 0, |
| 118 | &edb7211_lcd_power_pdata, | 133 | &edb7211_lcd_power_pdata, |
| 119 | sizeof(edb7211_lcd_power_pdata)); | 134 | sizeof(edb7211_lcd_power_pdata)); |
| 135 | platform_device_register_data(&platform_bus, "generic-bl", 0, | ||
| 136 | &edb7211_lcd_backlight_pdata, | ||
| 137 | sizeof(edb7211_lcd_backlight_pdata)); | ||
| 120 | platform_device_register_simple("video-clps711x", 0, NULL, 0); | 138 | platform_device_register_simple("video-clps711x", 0, NULL, 0); |
| 121 | platform_device_register_simple("cs89x0", 0, edb7211_cs8900_resource, | 139 | platform_device_register_simple("cs89x0", 0, edb7211_cs8900_resource, |
| 122 | ARRAY_SIZE(edb7211_cs8900_resource)); | 140 | ARRAY_SIZE(edb7211_cs8900_resource)); |
diff --git a/arch/arm/mach-clps711x/include/mach/hardware.h b/arch/arm/mach-clps711x/include/mach/hardware.h index 6acf714031e2..1ebf7b9e69fc 100644 --- a/arch/arm/mach-clps711x/include/mach/hardware.h +++ b/arch/arm/mach-clps711x/include/mach/hardware.h | |||
| @@ -81,10 +81,4 @@ | |||
| 81 | 81 | ||
| 82 | #endif /* CONFIG_ARCH_EDB7211 */ | 82 | #endif /* CONFIG_ARCH_EDB7211 */ |
| 83 | 83 | ||
| 84 | /* | ||
| 85 | * Relevant bits in port D, which controls power to the various parts of | ||
| 86 | * the LCD on the EDB7211. | ||
| 87 | */ | ||
| 88 | #define EDB_PD3_LCDBL (1<<3) | ||
| 89 | |||
| 90 | #endif | 84 | #endif |
diff --git a/arch/arm/mach-clps711x/p720t.c b/arch/arm/mach-clps711x/p720t.c index e25f10ed5606..1518fc83babd 100644 --- a/arch/arm/mach-clps711x/p720t.c +++ b/arch/arm/mach-clps711x/p720t.c | |||
| @@ -25,6 +25,8 @@ | |||
| 25 | #include <linux/io.h> | 25 | #include <linux/io.h> |
| 26 | #include <linux/slab.h> | 26 | #include <linux/slab.h> |
| 27 | #include <linux/leds.h> | 27 | #include <linux/leds.h> |
| 28 | #include <linux/sizes.h> | ||
| 29 | #include <linux/backlight.h> | ||
| 28 | #include <linux/platform_device.h> | 30 | #include <linux/platform_device.h> |
| 29 | #include <linux/mtd/partitions.h> | 31 | #include <linux/mtd/partitions.h> |
| 30 | #include <linux/mtd/nand-gpio.h> | 32 | #include <linux/mtd/nand-gpio.h> |
| @@ -33,7 +35,6 @@ | |||
| 33 | #include <asm/pgtable.h> | 35 | #include <asm/pgtable.h> |
| 34 | #include <asm/page.h> | 36 | #include <asm/page.h> |
| 35 | #include <asm/setup.h> | 37 | #include <asm/setup.h> |
| 36 | #include <asm/sizes.h> | ||
| 37 | #include <asm/mach-types.h> | 38 | #include <asm/mach-types.h> |
| 38 | #include <asm/mach/arch.h> | 39 | #include <asm/mach/arch.h> |
| 39 | #include <asm/mach/map.h> | 40 | #include <asm/mach/map.h> |
| @@ -103,6 +104,21 @@ static struct plat_lcd_data p720t_lcd_power_pdata = { | |||
| 103 | .set_power = p720t_lcd_power_set, | 104 | .set_power = p720t_lcd_power_set, |
| 104 | }; | 105 | }; |
| 105 | 106 | ||
| 107 | static void p720t_lcd_backlight_set_intensity(int intensity) | ||
| 108 | { | ||
| 109 | if (intensity) | ||
| 110 | PLD_PWR |= PLD_S3_ON; | ||
| 111 | else | ||
| 112 | PLD_PWR = 0; | ||
| 113 | } | ||
| 114 | |||
| 115 | static struct generic_bl_info p720t_lcd_backlight_pdata = { | ||
| 116 | .name = "lcd-backlight.0", | ||
| 117 | .default_intensity = 0x01, | ||
| 118 | .max_intensity = 0x01, | ||
| 119 | .set_bl_intensity = p720t_lcd_backlight_set_intensity, | ||
| 120 | }; | ||
| 121 | |||
| 106 | /* | 122 | /* |
| 107 | * Map the P720T system PLD. It occupies two address spaces: | 123 | * Map the P720T system PLD. It occupies two address spaces: |
| 108 | * 0x10000000 and 0x10400000. We map both regions as one. | 124 | * 0x10000000 and 0x10400000. We map both regions as one. |
| @@ -187,6 +203,9 @@ static void __init p720t_init(void) | |||
| 187 | platform_device_register_data(&platform_bus, "platform-lcd", 0, | 203 | platform_device_register_data(&platform_bus, "platform-lcd", 0, |
| 188 | &p720t_lcd_power_pdata, | 204 | &p720t_lcd_power_pdata, |
| 189 | sizeof(p720t_lcd_power_pdata)); | 205 | sizeof(p720t_lcd_power_pdata)); |
| 206 | platform_device_register_data(&platform_bus, "generic-bl", 0, | ||
| 207 | &p720t_lcd_backlight_pdata, | ||
| 208 | sizeof(p720t_lcd_backlight_pdata)); | ||
| 190 | platform_device_register_simple("video-clps711x", 0, NULL, 0); | 209 | platform_device_register_simple("video-clps711x", 0, NULL, 0); |
| 191 | } | 210 | } |
| 192 | 211 | ||
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 | ||
