Ian Molton | ac25361 | 2008-07-10 20:17:27 +0100 | [diff] [blame^] | 1 | /* e750_lcd.c |
| 2 | * |
| 3 | * This file contains the definitions for the LCD timings and functions |
| 4 | * to control the LCD power / frontlighting via the w100fb driver. |
| 5 | * |
| 6 | * (c) 2005 Ian Molton <spyro@f2s.com> |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify |
| 9 | * it under the terms of the GNU General Public License version 2 as |
| 10 | * published by the Free Software Foundation. |
| 11 | * |
| 12 | */ |
| 13 | |
| 14 | #include <linux/module.h> |
| 15 | #include <linux/device.h> |
| 16 | #include <linux/fb.h> |
| 17 | #include <linux/err.h> |
| 18 | #include <linux/platform_device.h> |
| 19 | |
| 20 | #include <asm/mach-types.h> |
| 21 | |
| 22 | #include <video/w100fb.h> |
| 23 | |
| 24 | static struct w100_gen_regs e750_lcd_regs = { |
| 25 | .lcd_format = 0x00008003, |
| 26 | .lcdd_cntl1 = 0x00000000, |
| 27 | .lcdd_cntl2 = 0x0003ffff, |
| 28 | .genlcd_cntl1 = 0x00fff003, |
| 29 | .genlcd_cntl2 = 0x003c0f03, |
| 30 | .genlcd_cntl3 = 0x000143aa, |
| 31 | }; |
| 32 | |
| 33 | static struct w100_mode e750_lcd_mode = { |
| 34 | .xres = 240, |
| 35 | .yres = 320, |
| 36 | .left_margin = 21, |
| 37 | .right_margin = 22, |
| 38 | .upper_margin = 5, |
| 39 | .lower_margin = 4, |
| 40 | .crtc_ss = 0x80150014, |
| 41 | .crtc_ls = 0x8014000d, |
| 42 | .crtc_gs = 0xc1000005, |
| 43 | .crtc_vpos_gs = 0x00020147, |
| 44 | .crtc_rev = 0x0040010a, |
| 45 | .crtc_dclk = 0xa1700030, |
| 46 | .crtc_gclk = 0x80cc0015, |
| 47 | .crtc_goe = 0x80cc0015, |
| 48 | .crtc_ps1_active = 0x61060017, |
| 49 | .pll_freq = 57, |
| 50 | .pixclk_divider = 4, |
| 51 | .pixclk_divider_rotated = 4, |
| 52 | .pixclk_src = CLK_SRC_XTAL, |
| 53 | .sysclk_divider = 1, |
| 54 | .sysclk_src = CLK_SRC_PLL, |
| 55 | }; |
| 56 | |
| 57 | |
| 58 | static struct w100_gpio_regs e750_w100_gpio_info = { |
| 59 | .init_data1 = 0x01192f1b, |
| 60 | .gpio_dir1 = 0xd5ffdeff, |
| 61 | .gpio_oe1 = 0x000020bf, |
| 62 | .init_data2 = 0x010f010f, |
| 63 | .gpio_dir2 = 0xffffffff, |
| 64 | .gpio_oe2 = 0x000001cf, |
| 65 | }; |
| 66 | |
| 67 | static struct w100fb_mach_info e750_fb_info = { |
| 68 | .modelist = &e750_lcd_mode, |
| 69 | .num_modes = 1, |
| 70 | .regs = &e750_lcd_regs, |
| 71 | .gpio = &e750_w100_gpio_info, |
| 72 | .xtal_freq = 14318000, |
| 73 | .xtal_dbl = 1, |
| 74 | }; |
| 75 | |
| 76 | static struct resource e750_fb_resources[] = { |
| 77 | [0] = { |
| 78 | .start = 0x0c000000, |
| 79 | .end = 0x0cffffff, |
| 80 | .flags = IORESOURCE_MEM, |
| 81 | }, |
| 82 | }; |
| 83 | |
| 84 | /* ----------------------- device declarations -------------------------- */ |
| 85 | |
| 86 | |
| 87 | static struct platform_device e750_fb_device = { |
| 88 | .name = "w100fb", |
| 89 | .id = -1, |
| 90 | .dev = { |
| 91 | .platform_data = &e750_fb_info, |
| 92 | }, |
| 93 | .num_resources = ARRAY_SIZE(e750_fb_resources), |
| 94 | .resource = e750_fb_resources, |
| 95 | }; |
| 96 | |
| 97 | static int e750_lcd_init(void) |
| 98 | { |
| 99 | if (!machine_is_e750()) |
| 100 | return -ENODEV; |
| 101 | |
| 102 | return platform_device_register(&e750_fb_device); |
| 103 | } |
| 104 | |
| 105 | module_init(e750_lcd_init); |
| 106 | |
| 107 | MODULE_AUTHOR("Ian Molton <spyro@f2s.com>"); |
| 108 | MODULE_DESCRIPTION("e750 lcd driver"); |
| 109 | MODULE_LICENSE("GPLv2"); |