ACPI Thinkpad: We must always call va_end() after va_start() but do not do so in...
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / arch / arm / mach-s3c64xx / mach-smartq7.c
blobe0bc78ecb156c05827f07c8cba0b5bd792131a5e
1 /*
2 * linux/arch/arm/mach-s3c64xx/mach-smartq7.c
4 * Copyright (C) 2010 Maurus Cuelenaere
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
12 #include <linux/fb.h>
13 #include <linux/gpio.h>
14 #include <linux/gpio_keys.h>
15 #include <linux/i2c-gpio.h>
16 #include <linux/init.h>
17 #include <linux/input.h>
18 #include <linux/leds.h>
19 #include <linux/platform_device.h>
21 #include <asm/mach-types.h>
22 #include <asm/mach/arch.h>
24 #include <mach/map.h>
25 #include <mach/regs-fb.h>
26 #include <mach/regs-gpio.h>
27 #include <mach/s3c6410.h>
29 #include <plat/cpu.h>
30 #include <plat/devs.h>
31 #include <plat/fb.h>
32 #include <plat/gpio-cfg.h>
34 #include "mach-smartq.h"
36 static void __init smartq7_lcd_setup_gpio(void)
38 gpio_request(S3C64XX_GPM(0), "LCD CSB pin");
39 gpio_request(S3C64XX_GPM(3), "LCD power");
40 gpio_request(S3C64XX_GPM(4), "LCD power status");
42 /* turn power off */
43 gpio_direction_output(S3C64XX_GPM(0), 1);
44 gpio_direction_output(S3C64XX_GPM(3), 0);
45 gpio_direction_input(S3C64XX_GPM(4));
48 static struct i2c_gpio_platform_data smartq7_lcd_control = {
49 .sda_pin = S3C64XX_GPM(2),
50 .scl_pin = S3C64XX_GPM(1),
51 .sda_is_open_drain = 1,
52 .scl_is_open_drain = 1,
55 static struct platform_device smartq7_lcd_control_device = {
56 .name = "i2c-gpio",
57 .id = 1,
58 .dev.platform_data = &smartq7_lcd_control,
61 static struct gpio_led smartq7_leds[] __initdata = {
63 .name = "smartq7:red",
64 .active_low = 1,
65 .gpio = S3C64XX_GPN(8),
68 .name = "smartq7:green",
69 .active_low = 1,
70 .gpio = S3C64XX_GPN(9),
74 static struct gpio_led_platform_data smartq7_led_data = {
75 .num_leds = ARRAY_SIZE(smartq7_leds),
76 .leds = smartq7_leds,
79 static struct platform_device smartq7_leds_device = {
80 .name = "leds-gpio",
81 .id = -1,
82 .dev.platform_data = &smartq7_led_data,
85 /* Labels according to the SmartQ manual */
86 static struct gpio_keys_button smartq7_buttons[] = {
88 .gpio = S3C64XX_GPL(14),
89 .code = KEY_POWER,
90 .desc = "Power",
91 .active_low = 1,
92 .debounce_interval = 5,
93 .type = EV_KEY,
96 .gpio = S3C64XX_GPN(2),
97 .code = KEY_FN,
98 .desc = "Function",
99 .active_low = 1,
100 .debounce_interval = 5,
101 .type = EV_KEY,
104 .gpio = S3C64XX_GPN(3),
105 .code = KEY_KPMINUS,
106 .desc = "Minus",
107 .active_low = 1,
108 .debounce_interval = 5,
109 .type = EV_KEY,
112 .gpio = S3C64XX_GPN(4),
113 .code = KEY_KPPLUS,
114 .desc = "Plus",
115 .active_low = 1,
116 .debounce_interval = 5,
117 .type = EV_KEY,
120 .gpio = S3C64XX_GPN(12),
121 .code = KEY_ENTER,
122 .desc = "Enter",
123 .active_low = 1,
124 .debounce_interval = 5,
125 .type = EV_KEY,
128 .gpio = S3C64XX_GPN(15),
129 .code = KEY_ESC,
130 .desc = "Cancel",
131 .active_low = 1,
132 .debounce_interval = 5,
133 .type = EV_KEY,
137 static struct gpio_keys_platform_data smartq7_buttons_data = {
138 .buttons = smartq7_buttons,
139 .nbuttons = ARRAY_SIZE(smartq7_buttons),
142 static struct platform_device smartq7_buttons_device = {
143 .name = "gpio-keys",
144 .id = 0,
145 .num_resources = 0,
146 .dev = {
147 .platform_data = &smartq7_buttons_data,
151 static struct s3c_fb_pd_win smartq7_fb_win0 = {
152 .win_mode = {
153 .pixclock = 1000000000000ULL /
154 ((3+10+5+800)*(1+3+20+480)*80),
155 .left_margin = 3,
156 .right_margin = 5,
157 .upper_margin = 1,
158 .lower_margin = 20,
159 .hsync_len = 10,
160 .vsync_len = 3,
161 .xres = 800,
162 .yres = 480,
164 .max_bpp = 32,
165 .default_bpp = 16,
168 static struct s3c_fb_platdata smartq7_lcd_pdata __initdata = {
169 .setup_gpio = s3c64xx_fb_gpio_setup_24bpp,
170 .win[0] = &smartq7_fb_win0,
171 .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
172 .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC |
173 VIDCON1_INV_VCLK,
176 static struct platform_device *smartq7_devices[] __initdata = {
177 &smartq7_leds_device,
178 &smartq7_buttons_device,
179 &smartq7_lcd_control_device,
182 static void __init smartq7_machine_init(void)
184 s3c_fb_set_platdata(&smartq7_lcd_pdata);
186 smartq_machine_init();
187 smartq7_lcd_setup_gpio();
189 platform_add_devices(smartq7_devices, ARRAY_SIZE(smartq7_devices));
192 MACHINE_START(SMARTQ7, "SmartQ 7")
193 /* Maintainer: Maurus Cuelenaere <mcuelenaere AT gmail DOT com> */
194 .phys_io = S3C_PA_UART & 0xfff00000,
195 .io_pg_offst = (((u32)S3C_VA_UART) >> 18) & 0xfffc,
196 .boot_params = S3C64XX_PA_SDRAM + 0x100,
197 .init_irq = s3c6410_init_irq,
198 .map_io = smartq_map_io,
199 .init_machine = smartq7_machine_init,
200 .timer = &s3c24xx_timer,
201 MACHINE_END