aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCory Maccarrone <darkstar6262@gmail.com>2009-11-22 13:11:34 -0500
committerTony Lindgren <tony@atomide.com>2009-11-22 13:24:33 -0500
commit9c2816f7bd445c5eb152babff4d6fb3f8f556610 (patch)
treead5e9f3fd72c9471c22bb0f9cff05812db10a5e0
parent1ced4532c0fc8cba1776e237b8c7fda6edc19330 (diff)
omap1: Add board support and LCD for HTC Herald
This patch introduces support for the HTC Herald (T-Mobile Wing, etc.) series of smart phones -- board support and LCD panel settings. Signed-off-by: Cory Maccarrone <darkstar6262@gmail.com> Signed-off-by: Tony Lindgren <tony@atomide.com>
-rw-r--r--arch/arm/mach-omap1/Kconfig6
-rw-r--r--arch/arm/mach-omap1/Makefile1
-rw-r--r--arch/arm/mach-omap1/board-htcherald.c247
-rw-r--r--drivers/video/omap/Makefile1
-rw-r--r--drivers/video/omap/lcd_htcherald.c130
5 files changed, 385 insertions, 0 deletions
diff --git a/arch/arm/mach-omap1/Kconfig b/arch/arm/mach-omap1/Kconfig
index 323272651933..27f489747bbd 100644
--- a/arch/arm/mach-omap1/Kconfig
+++ b/arch/arm/mach-omap1/Kconfig
@@ -57,6 +57,12 @@ config MACH_OMAP_HTCWIZARD
57 help 57 help
58 HTC Wizard smartphone support (AKA QTEK 9100, ...) 58 HTC Wizard smartphone support (AKA QTEK 9100, ...)
59 59
60config MACH_HERALD
61 bool "HTC Herald"
62 depends on ARCH_OMAP850
63 help
64 HTC Herald smartphone support (AKA T-Mobile Wing, ...)
65
60config MACH_OMAP_OSK 66config MACH_OMAP_OSK
61 bool "TI OSK Support" 67 bool "TI OSK Support"
62 depends on ARCH_OMAP1 && ARCH_OMAP16XX 68 depends on ARCH_OMAP1 && ARCH_OMAP16XX
diff --git a/arch/arm/mach-omap1/Makefile b/arch/arm/mach-omap1/Makefile
index 6867cd3ad0b4..87e539aa8ad9 100644
--- a/arch/arm/mach-omap1/Makefile
+++ b/arch/arm/mach-omap1/Makefile
@@ -34,6 +34,7 @@ obj-$(CONFIG_MACH_OMAP_PALMTT) += board-palmtt.o
34obj-$(CONFIG_MACH_NOKIA770) += board-nokia770.o 34obj-$(CONFIG_MACH_NOKIA770) += board-nokia770.o
35obj-$(CONFIG_MACH_AMS_DELTA) += board-ams-delta.o 35obj-$(CONFIG_MACH_AMS_DELTA) += board-ams-delta.o
36obj-$(CONFIG_MACH_SX1) += board-sx1.o board-sx1-mmc.o 36obj-$(CONFIG_MACH_SX1) += board-sx1.o board-sx1-mmc.o
37obj-$(CONFIG_MACH_HERALD) += board-htcherald.o
37 38
38ifeq ($(CONFIG_ARCH_OMAP15XX),y) 39ifeq ($(CONFIG_ARCH_OMAP15XX),y)
39# Innovator-1510 FPGA 40# Innovator-1510 FPGA
diff --git a/arch/arm/mach-omap1/board-htcherald.c b/arch/arm/mach-omap1/board-htcherald.c
new file mode 100644
index 000000000000..5f28a5ceacac
--- /dev/null
+++ b/arch/arm/mach-omap1/board-htcherald.c
@@ -0,0 +1,247 @@
1/*
2 * HTC Herald board configuration
3 * Copyright (C) 2009 Cory Maccarrone <darkstar6262@gmail.com>
4 * Copyright (C) 2009 Wing Linux
5 *
6 * Based on the board-htcwizard.c file from the linwizard project:
7 * Copyright (C) 2006 Unai Uribarri
8 * Copyright (C) 2008 linwizard.sourceforge.net
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License as
12 * published by the Free Software Foundation; either version 2 of the
13 * License, or (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
23 * 02110-1301, USA.
24 *
25 */
26
27#include <linux/kernel.h>
28#include <linux/init.h>
29#include <linux/platform_device.h>
30#include <linux/input.h>
31#include <linux/bootmem.h>
32#include <linux/io.h>
33#include <linux/gpio.h>
34
35#include <asm/mach-types.h>
36#include <asm/mach/arch.h>
37
38#include <plat/omap7xx.h>
39#include <plat/common.h>
40#include <plat/board.h>
41#include <plat/keypad.h>
42
43#include <mach/irqs.h>
44
45#include <linux/delay.h>
46
47/* LCD register definition */
48#define OMAP_LCDC_CONTROL (0xfffec000 + 0x00)
49#define OMAP_LCDC_STATUS (0xfffec000 + 0x10)
50#define OMAP_DMA_LCD_CCR (0xfffee300 + 0xc2)
51#define OMAP_DMA_LCD_CTRL (0xfffee300 + 0xc4)
52#define OMAP_LCDC_CTRL_LCD_EN (1 << 0)
53#define OMAP_LCDC_STAT_DONE (1 << 0)
54
55static struct omap_lcd_config htcherald_lcd_config __initdata = {
56 .ctrl_name = "internal",
57};
58
59static struct omap_board_config_kernel htcherald_config[] __initdata = {
60 { OMAP_TAG_LCD, &htcherald_lcd_config },
61};
62
63/* Keyboard definition */
64
65static int htc_herald_keymap[] = {
66 KEY(0, 0, KEY_RECORD), /* Mail button */
67 KEY(0, 1, KEY_CAMERA), /* Camera */
68 KEY(0, 2, KEY_PHONE), /* Send key */
69 KEY(0, 3, KEY_VOLUMEUP), /* Volume up */
70 KEY(0, 4, KEY_F2), /* Right bar (landscape) */
71 KEY(0, 5, KEY_MAIL), /* Win key (portrait) */
72 KEY(0, 6, KEY_DIRECTORY), /* Right bar (protrait) */
73 KEY(1, 0, KEY_LEFTCTRL), /* Windows key */
74 KEY(1, 1, KEY_COMMA),
75 KEY(1, 2, KEY_M),
76 KEY(1, 3, KEY_K),
77 KEY(1, 4, KEY_SLASH), /* OK key */
78 KEY(1, 5, KEY_I),
79 KEY(1, 6, KEY_U),
80 KEY(2, 0, KEY_LEFTALT),
81 KEY(2, 1, KEY_TAB),
82 KEY(2, 2, KEY_N),
83 KEY(2, 3, KEY_J),
84 KEY(2, 4, KEY_ENTER),
85 KEY(2, 5, KEY_H),
86 KEY(2, 6, KEY_Y),
87 KEY(3, 0, KEY_SPACE),
88 KEY(3, 1, KEY_L),
89 KEY(3, 2, KEY_B),
90 KEY(3, 3, KEY_V),
91 KEY(3, 4, KEY_BACKSPACE),
92 KEY(3, 5, KEY_G),
93 KEY(3, 6, KEY_T),
94 KEY(4, 0, KEY_CAPSLOCK), /* Shift */
95 KEY(4, 1, KEY_C),
96 KEY(4, 2, KEY_F),
97 KEY(4, 3, KEY_R),
98 KEY(4, 4, KEY_O),
99 KEY(4, 5, KEY_E),
100 KEY(4, 6, KEY_D),
101 KEY(5, 0, KEY_X),
102 KEY(5, 1, KEY_Z),
103 KEY(5, 2, KEY_S),
104 KEY(5, 3, KEY_W),
105 KEY(5, 4, KEY_P),
106 KEY(5, 5, KEY_Q),
107 KEY(5, 6, KEY_A),
108 KEY(6, 0, KEY_CONNECT), /* Voice button */
109 KEY(6, 2, KEY_CANCEL), /* End key */
110 KEY(6, 3, KEY_VOLUMEDOWN), /* Volume down */
111 KEY(6, 4, KEY_F1), /* Left bar (landscape) */
112 KEY(6, 5, KEY_WWW), /* OK button (portrait) */
113 KEY(6, 6, KEY_CALENDAR), /* Left bar (portrait) */
114 0
115};
116
117struct omap_kp_platform_data htcherald_kp_data = {
118 .rows = 7,
119 .cols = 7,
120 .delay = 20,
121 .rep = 1,
122 .keymap = htc_herald_keymap,
123};
124
125static struct resource kp_resources[] = {
126 [0] = {
127 .start = INT_7XX_MPUIO_KEYPAD,
128 .end = INT_7XX_MPUIO_KEYPAD,
129 .flags = IORESOURCE_IRQ,
130 },
131};
132
133static struct platform_device kp_device = {
134 .name = "omap-keypad",
135 .id = -1,
136 .dev = {
137 .platform_data = &htcherald_kp_data,
138 },
139 .num_resources = ARRAY_SIZE(kp_resources),
140 .resource = kp_resources,
141};
142
143/* LCD Device resources */
144static struct platform_device lcd_device = {
145 .name = "lcd_htcherald",
146 .id = -1,
147};
148
149static struct platform_device *devices[] __initdata = {
150 &kp_device,
151 &lcd_device,
152};
153
154/*
155 * Init functions from here on
156 */
157
158static void __init htcherald_lcd_init(void)
159{
160 u32 reg;
161 unsigned int tries = 200;
162
163 /* disable controller if active */
164 reg = omap_readl(OMAP_LCDC_CONTROL);
165 if (reg & OMAP_LCDC_CTRL_LCD_EN) {
166 reg &= ~OMAP_LCDC_CTRL_LCD_EN;
167 omap_writel(reg, OMAP_LCDC_CONTROL);
168
169 /* wait for end of frame */
170 while (!(omap_readl(OMAP_LCDC_STATUS) & OMAP_LCDC_STAT_DONE)) {
171 tries--;
172 if (!tries)
173 break;
174 }
175 if (!tries)
176 printk(KERN_WARNING "Timeout waiting for end of frame "
177 "-- LCD may not be available\n");
178
179 /* turn off DMA */
180 reg = omap_readw(OMAP_DMA_LCD_CCR);
181 reg &= ~(1 << 7);
182 omap_writew(reg, OMAP_DMA_LCD_CCR);
183
184 reg = omap_readw(OMAP_DMA_LCD_CTRL);
185 reg &= ~(1 << 8);
186 omap_writew(reg, OMAP_DMA_LCD_CTRL);
187 }
188}
189
190static void __init htcherald_map_io(void)
191{
192 omap1_map_common_io();
193
194 /*
195 * The LCD panel must be disabled and DMA turned off here, as doing
196 * it later causes the LCD never to reinitialize.
197 */
198 htcherald_lcd_init();
199
200 printk(KERN_INFO "htcherald_map_io done.\n");
201}
202
203static void __init htcherald_disable_watchdog(void)
204{
205 /* Disable watchdog if running */
206 if (omap_readl(OMAP_WDT_TIMER_MODE) & 0x8000) {
207 /*
208 * disable a potentially running watchdog timer before
209 * it kills us.
210 */
211 printk(KERN_WARNING "OMAP850 Watchdog seems to be activated, disabling it for now.\n");
212 omap_writel(0xF5, OMAP_WDT_TIMER_MODE);
213 omap_writel(0xA0, OMAP_WDT_TIMER_MODE);
214 }
215}
216
217static void __init htcherald_init(void)
218{
219 printk(KERN_INFO "HTC Herald init.\n");
220
221 omap_gpio_init();
222
223 omap_board_config = htcherald_config;
224 omap_board_config_size = ARRAY_SIZE(htcherald_config);
225 platform_add_devices(devices, ARRAY_SIZE(devices));
226
227 htcherald_disable_watchdog();
228}
229
230static void __init htcherald_init_irq(void)
231{
232 printk(KERN_INFO "htcherald_init_irq.\n");
233 omap1_init_common_hw();
234 omap_init_irq();
235}
236
237MACHINE_START(HERALD, "HTC Herald")
238 /* Maintainer: Cory Maccarrone <darkstar6262@gmail.com> */
239 /* Maintainer: wing-linux.sourceforge.net */
240 .phys_io = 0xfff00000,
241 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc,
242 .boot_params = 0x10000100,
243 .map_io = htcherald_map_io,
244 .init_irq = htcherald_init_irq,
245 .init_machine = htcherald_init,
246 .timer = &omap_timer,
247MACHINE_END
diff --git a/drivers/video/omap/Makefile b/drivers/video/omap/Makefile
index b63b198d1f03..49226a1b909e 100644
--- a/drivers/video/omap/Makefile
+++ b/drivers/video/omap/Makefile
@@ -35,6 +35,7 @@ objs-y$(CONFIG_MACH_OMAP3EVM) += lcd_omap3evm.o
35objs-y$(CONFIG_MACH_OMAP3_BEAGLE) += lcd_omap3beagle.o 35objs-y$(CONFIG_MACH_OMAP3_BEAGLE) += lcd_omap3beagle.o
36objs-y$(CONFIG_FB_OMAP_LCD_MIPID) += lcd_mipid.o 36objs-y$(CONFIG_FB_OMAP_LCD_MIPID) += lcd_mipid.o
37objs-y$(CONFIG_MACH_OVERO) += lcd_overo.o 37objs-y$(CONFIG_MACH_OVERO) += lcd_overo.o
38objs-y$(CONFIG_MACH_HERALD) += lcd_htcherald.o
38 39
39omapfb-objs := $(objs-yy) 40omapfb-objs := $(objs-yy)
40 41
diff --git a/drivers/video/omap/lcd_htcherald.c b/drivers/video/omap/lcd_htcherald.c
new file mode 100644
index 000000000000..2e0c81ea7483
--- /dev/null
+++ b/drivers/video/omap/lcd_htcherald.c
@@ -0,0 +1,130 @@
1/*
2 * File: drivers/video/omap/lcd-htcherald.c
3 *
4 * LCD panel support for the HTC Herald
5 *
6 * Copyright (C) 2009 Cory Maccarrone <darkstar6262@gmail.com>
7 * Copyright (C) 2009 Wing Linux
8 *
9 * Based on the lcd_htcwizard.c file from the linwizard project:
10 * Copyright (C) linwizard.sourceforge.net
11 * Author: Angelo Arrifano <miknix@gmail.com>
12 * Based on lcd_h4 by Imre Deak <imre.deak@nokia.com>
13 *
14 * This program is free software; you can redistribute it and/or modify it
15 * under the terms of the GNU General Public License as published by the
16 * Free Software Foundation; either version 2 of the License, or (at your
17 * option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful, but
20 * WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 * General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License along
25 * with this program; if not, write to the Free Software Foundation, Inc.,
26 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27 */
28
29#include <linux/module.h>
30#include <linux/platform_device.h>
31
32#include <plat/omapfb.h>
33
34static int htcherald_panel_init(struct lcd_panel *panel,
35 struct omapfb_device *fbdev)
36{
37 return 0;
38}
39
40static void htcherald_panel_cleanup(struct lcd_panel *panel)
41{
42}
43
44static int htcherald_panel_enable(struct lcd_panel *panel)
45{
46 return 0;
47}
48
49static void htcherald_panel_disable(struct lcd_panel *panel)
50{
51}
52
53static unsigned long htcherald_panel_get_caps(struct lcd_panel *panel)
54{
55 return 0;
56}
57
58/* Found on WIZ200 (miknix) and some HERA110 models (darkstar62) */
59struct lcd_panel htcherald_panel_1 = {
60 .name = "lcd_herald",
61 .config = OMAP_LCDC_PANEL_TFT |
62 OMAP_LCDC_INV_HSYNC |
63 OMAP_LCDC_INV_VSYNC |
64 OMAP_LCDC_INV_PIX_CLOCK,
65 .bpp = 16,
66 .data_lines = 16,
67 .x_res = 240,
68 .y_res = 320,
69 .pixel_clock = 6093,
70 .pcd = 0, /* 15 */
71 .hsw = 10,
72 .hfp = 10,
73 .hbp = 20,
74 .vsw = 3,
75 .vfp = 2,
76 .vbp = 2,
77
78 .init = htcherald_panel_init,
79 .cleanup = htcherald_panel_cleanup,
80 .enable = htcherald_panel_enable,
81 .disable = htcherald_panel_disable,
82 .get_caps = htcherald_panel_get_caps,
83};
84
85static int htcherald_panel_probe(struct platform_device *pdev)
86{
87 omapfb_register_panel(&htcherald_panel_1);
88 return 0;
89}
90
91static int htcherald_panel_remove(struct platform_device *pdev)
92{
93 return 0;
94}
95
96static int htcherald_panel_suspend(struct platform_device *pdev,
97 pm_message_t mesg)
98{
99 return 0;
100}
101
102static int htcherald_panel_resume(struct platform_device *pdev)
103{
104 return 0;
105}
106
107struct platform_driver htcherald_panel_driver = {
108 .probe = htcherald_panel_probe,
109 .remove = htcherald_panel_remove,
110 .suspend = htcherald_panel_suspend,
111 .resume = htcherald_panel_resume,
112 .driver = {
113 .name = "lcd_htcherald",
114 .owner = THIS_MODULE,
115 },
116};
117
118static int htcherald_panel_drv_init(void)
119{
120 return platform_driver_register(&htcherald_panel_driver);
121}
122
123static void htcherald_panel_drv_cleanup(void)
124{
125 platform_driver_unregister(&htcherald_panel_driver);
126}
127
128module_init(htcherald_panel_drv_init);
129module_exit(htcherald_panel_drv_cleanup);
130