diff options
| author | Vovan888@gmail <Vovan888@gmail> | 2007-07-17 07:06:09 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-17 13:23:15 -0400 |
| commit | 969529021a5c3df74ea8f10d329b2427e559a90f (patch) | |
| tree | 13bbd7837830ec677d82966d905184155f78235f | |
| parent | 107cc64b7f3956e53e040307e5021abad6d4202a (diff) | |
OMAP: LCD panel support for the Siemens SX1 mobile phone
- Add support for LCD panel on Siemens sx1 mobile phone.
Signed-off-by: Trilok Soni <soni.trilok@gmail.com>
Cc: Tony Lindgren <tony@atomide.com>
Cc: "Antonino A. Daplas" <adaplas@pol.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
| -rw-r--r-- | drivers/video/omap/Makefile | 1 | ||||
| -rw-r--r-- | drivers/video/omap/lcd_sx1.c | 334 |
2 files changed, 335 insertions, 0 deletions
diff --git a/drivers/video/omap/Makefile b/drivers/video/omap/Makefile index ed13889c1162..99da8b6d2c36 100644 --- a/drivers/video/omap/Makefile +++ b/drivers/video/omap/Makefile | |||
| @@ -23,6 +23,7 @@ objs-y$(CONFIG_MACH_OMAP_PALMZ71) += lcd_palmz71.o | |||
| 23 | objs-$(CONFIG_ARCH_OMAP16XX)$(CONFIG_MACH_OMAP_INNOVATOR) += lcd_inn1610.o | 23 | objs-$(CONFIG_ARCH_OMAP16XX)$(CONFIG_MACH_OMAP_INNOVATOR) += lcd_inn1610.o |
| 24 | objs-$(CONFIG_ARCH_OMAP15XX)$(CONFIG_MACH_OMAP_INNOVATOR) += lcd_inn1510.o | 24 | objs-$(CONFIG_ARCH_OMAP15XX)$(CONFIG_MACH_OMAP_INNOVATOR) += lcd_inn1510.o |
| 25 | objs-y$(CONFIG_MACH_OMAP_OSK) += lcd_osk.o | 25 | objs-y$(CONFIG_MACH_OMAP_OSK) += lcd_osk.o |
| 26 | objs-y$(CONFIG_MACH_SX1) += lcd_sx1.o | ||
| 26 | 27 | ||
| 27 | omapfb-objs := $(objs-yy) | 28 | omapfb-objs := $(objs-yy) |
| 28 | 29 | ||
diff --git a/drivers/video/omap/lcd_sx1.c b/drivers/video/omap/lcd_sx1.c new file mode 100644 index 000000000000..c4f306a4e5c9 --- /dev/null +++ b/drivers/video/omap/lcd_sx1.c | |||
| @@ -0,0 +1,334 @@ | |||
| 1 | /* | ||
| 2 | * LCD panel support for the Siemens SX1 mobile phone | ||
| 3 | * | ||
| 4 | * Current version : Vovan888@gmail.com, great help from FCA00000 | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or modify it | ||
| 7 | * under the terms of the GNU General Public License as published by the | ||
| 8 | * Free Software Foundation; either version 2 of the License, or (at your | ||
| 9 | * option) any later version. | ||
| 10 | * | ||
| 11 | * This program is distributed in the hope that it will be useful, but | ||
| 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 14 | * General Public License for more details. | ||
| 15 | * | ||
| 16 | * You should have received a copy of the GNU General Public License along | ||
| 17 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
| 18 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
| 19 | */ | ||
| 20 | |||
| 21 | #include <linux/module.h> | ||
| 22 | #include <linux/platform_device.h> | ||
| 23 | #include <linux/delay.h> | ||
| 24 | #include <linux/io.h> | ||
| 25 | |||
| 26 | #include <asm/arch/gpio.h> | ||
| 27 | #include <asm/arch/omapfb.h> | ||
| 28 | #include <asm/arch/mcbsp.h> | ||
| 29 | #include <asm/arch/mux.h> | ||
| 30 | |||
| 31 | /* | ||
| 32 | * OMAP310 GPIO registers | ||
| 33 | */ | ||
| 34 | #define GPIO_DATA_INPUT 0xfffce000 | ||
| 35 | #define GPIO_DATA_OUTPUT 0xfffce004 | ||
| 36 | #define GPIO_DIR_CONTROL 0xfffce008 | ||
| 37 | #define GPIO_INT_CONTROL 0xfffce00c | ||
| 38 | #define GPIO_INT_MASK 0xfffce010 | ||
| 39 | #define GPIO_INT_STATUS 0xfffce014 | ||
| 40 | #define GPIO_PIN_CONTROL 0xfffce018 | ||
| 41 | |||
| 42 | |||
| 43 | #define A_LCD_SSC_RD 3 | ||
| 44 | #define A_LCD_SSC_SD 7 | ||
| 45 | #define _A_LCD_RESET 9 | ||
| 46 | #define _A_LCD_SSC_CS 12 | ||
| 47 | #define _A_LCD_SSC_A0 13 | ||
| 48 | |||
| 49 | #define DSP_REG 0xE1017024 | ||
| 50 | |||
| 51 | const unsigned char INIT_1[12] = { | ||
| 52 | 0x1C, 0x02, 0x88, 0x00, 0x1E, 0xE0, 0x00, 0xDC, 0x00, 0x02, 0x00 | ||
| 53 | }; | ||
| 54 | |||
| 55 | const unsigned char INIT_2[127] = { | ||
| 56 | 0x15, 0x00, 0x29, 0x00, 0x3E, 0x00, 0x51, 0x00, | ||
| 57 | 0x65, 0x00, 0x7A, 0x00, 0x8D, 0x00, 0xA1, 0x00, | ||
| 58 | 0xB6, 0x00, 0xC7, 0x00, 0xD8, 0x00, 0xEB, 0x00, | ||
| 59 | 0xFB, 0x00, 0x0B, 0x01, 0x1B, 0x01, 0x27, 0x01, | ||
| 60 | 0x34, 0x01, 0x41, 0x01, 0x4C, 0x01, 0x55, 0x01, | ||
| 61 | 0x5F, 0x01, 0x68, 0x01, 0x70, 0x01, 0x78, 0x01, | ||
| 62 | 0x7E, 0x01, 0x86, 0x01, 0x8C, 0x01, 0x94, 0x01, | ||
| 63 | 0x9B, 0x01, 0xA1, 0x01, 0xA4, 0x01, 0xA9, 0x01, | ||
| 64 | 0xAD, 0x01, 0xB2, 0x01, 0xB7, 0x01, 0xBC, 0x01, | ||
| 65 | 0xC0, 0x01, 0xC4, 0x01, 0xC8, 0x01, 0xCB, 0x01, | ||
| 66 | 0xCF, 0x01, 0xD2, 0x01, 0xD5, 0x01, 0xD8, 0x01, | ||
| 67 | 0xDB, 0x01, 0xE0, 0x01, 0xE3, 0x01, 0xE6, 0x01, | ||
| 68 | 0xE8, 0x01, 0xEB, 0x01, 0xEE, 0x01, 0xF1, 0x01, | ||
| 69 | 0xF3, 0x01, 0xF8, 0x01, 0xF9, 0x01, 0xFC, 0x01, | ||
| 70 | 0x00, 0x02, 0x03, 0x02, 0x07, 0x02, 0x09, 0x02, | ||
| 71 | 0x0E, 0x02, 0x13, 0x02, 0x1C, 0x02, 0x00 | ||
| 72 | }; | ||
| 73 | |||
| 74 | const unsigned char INIT_3[15] = { | ||
| 75 | 0x14, 0x26, 0x33, 0x3D, 0x45, 0x4D, 0x53, 0x59, | ||
| 76 | 0x5E, 0x63, 0x67, 0x6D, 0x71, 0x78, 0xFF | ||
| 77 | }; | ||
| 78 | |||
| 79 | static void epson_sendbyte(int flag, unsigned char byte) | ||
| 80 | { | ||
| 81 | int i, shifter = 0x80; | ||
| 82 | |||
| 83 | if (!flag) | ||
| 84 | omap_set_gpio_dataout(_A_LCD_SSC_A0, 0); | ||
| 85 | mdelay(2); | ||
| 86 | omap_set_gpio_dataout(A_LCD_SSC_RD, 1); | ||
| 87 | |||
| 88 | omap_set_gpio_dataout(A_LCD_SSC_SD, flag); | ||
| 89 | |||
| 90 | OMAP_MCBSP_WRITE(OMAP1510_MCBSP3_BASE, PCR0, 0x2200); | ||
| 91 | OMAP_MCBSP_WRITE(OMAP1510_MCBSP3_BASE, PCR0, 0x2202); | ||
| 92 | for (i = 0; i < 8; i++) { | ||
| 93 | OMAP_MCBSP_WRITE(OMAP1510_MCBSP3_BASE, PCR0, 0x2200); | ||
| 94 | omap_set_gpio_dataout(A_LCD_SSC_SD, shifter & byte); | ||
| 95 | OMAP_MCBSP_WRITE(OMAP1510_MCBSP3_BASE, PCR0, 0x2202); | ||
| 96 | shifter >>= 1; | ||
| 97 | } | ||
| 98 | omap_set_gpio_dataout(_A_LCD_SSC_A0, 1); | ||
| 99 | } | ||
| 100 | |||
| 101 | static void init_system(void) | ||
| 102 | { | ||
| 103 | omap_mcbsp_request(OMAP_MCBSP3); | ||
| 104 | omap_mcbsp_stop(OMAP_MCBSP3); | ||
| 105 | } | ||
| 106 | |||
| 107 | static void setup_GPIO(void) | ||
| 108 | { | ||
| 109 | /* new wave */ | ||
| 110 | omap_request_gpio(A_LCD_SSC_RD); | ||
| 111 | omap_request_gpio(A_LCD_SSC_SD); | ||
| 112 | omap_request_gpio(_A_LCD_RESET); | ||
| 113 | omap_request_gpio(_A_LCD_SSC_CS); | ||
| 114 | omap_request_gpio(_A_LCD_SSC_A0); | ||
| 115 | |||
| 116 | /* set all GPIOs to output */ | ||
| 117 | omap_set_gpio_direction(A_LCD_SSC_RD, 0); | ||
| 118 | omap_set_gpio_direction(A_LCD_SSC_SD, 0); | ||
| 119 | omap_set_gpio_direction(_A_LCD_RESET, 0); | ||
| 120 | omap_set_gpio_direction(_A_LCD_SSC_CS, 0); | ||
| 121 | omap_set_gpio_direction(_A_LCD_SSC_A0, 0); | ||
| 122 | |||
| 123 | /* set GPIO data */ | ||
| 124 | omap_set_gpio_dataout(A_LCD_SSC_RD, 1); | ||
| 125 | omap_set_gpio_dataout(A_LCD_SSC_SD, 0); | ||
| 126 | omap_set_gpio_dataout(_A_LCD_RESET, 0); | ||
| 127 | omap_set_gpio_dataout(_A_LCD_SSC_CS, 1); | ||
| 128 | omap_set_gpio_dataout(_A_LCD_SSC_A0, 1); | ||
| 129 | } | ||
| 130 | |||
| 131 | static void display_init(void) | ||
| 132 | { | ||
| 133 | int i; | ||
| 134 | |||
| 135 | omap_cfg_reg(MCBSP3_CLKX); | ||
| 136 | |||
| 137 | mdelay(2); | ||
| 138 | setup_GPIO(); | ||
| 139 | mdelay(2); | ||
| 140 | |||
| 141 | /* reset LCD */ | ||
| 142 | omap_set_gpio_dataout(A_LCD_SSC_SD, 1); | ||
| 143 | epson_sendbyte(0, 0x25); | ||
| 144 | |||
| 145 | omap_set_gpio_dataout(_A_LCD_RESET, 0); | ||
| 146 | mdelay(10); | ||
| 147 | omap_set_gpio_dataout(_A_LCD_RESET, 1); | ||
| 148 | |||
| 149 | omap_set_gpio_dataout(_A_LCD_SSC_CS, 1); | ||
| 150 | mdelay(2); | ||
| 151 | omap_set_gpio_dataout(_A_LCD_SSC_CS, 0); | ||
| 152 | |||
| 153 | /* init LCD, phase 1 */ | ||
| 154 | epson_sendbyte(0, 0xCA); | ||
| 155 | for (i = 0; i < 10; i++) | ||
| 156 | epson_sendbyte(1, INIT_1[i]); | ||
| 157 | omap_set_gpio_dataout(_A_LCD_SSC_CS, 1); | ||
| 158 | omap_set_gpio_dataout(_A_LCD_SSC_CS, 0); | ||
| 159 | |||
| 160 | /* init LCD phase 2 */ | ||
| 161 | epson_sendbyte(0, 0xCB); | ||
| 162 | for (i = 0; i < 125; i++) | ||
| 163 | epson_sendbyte(1, INIT_2[i]); | ||
| 164 | omap_set_gpio_dataout(_A_LCD_SSC_CS, 1); | ||
| 165 | omap_set_gpio_dataout(_A_LCD_SSC_CS, 0); | ||
| 166 | |||
| 167 | /* init LCD phase 2a */ | ||
| 168 | epson_sendbyte(0, 0xCC); | ||
| 169 | for (i = 0; i < 14; i++) | ||
| 170 | epson_sendbyte(1, INIT_3[i]); | ||
| 171 | omap_set_gpio_dataout(_A_LCD_SSC_CS, 1); | ||
| 172 | omap_set_gpio_dataout(_A_LCD_SSC_CS, 0); | ||
| 173 | |||
| 174 | /* init LCD phase 3 */ | ||
| 175 | epson_sendbyte(0, 0xBC); | ||
| 176 | epson_sendbyte(1, 0x08); | ||
| 177 | omap_set_gpio_dataout(_A_LCD_SSC_CS, 1); | ||
| 178 | omap_set_gpio_dataout(_A_LCD_SSC_CS, 0); | ||
| 179 | |||
| 180 | /* init LCD phase 4 */ | ||
| 181 | epson_sendbyte(0, 0x07); | ||
| 182 | epson_sendbyte(1, 0x05); | ||
