]>
Commit | Line | Data |
---|---|---|
a2f7bffa MC |
1 | /* |
2 | * linux/arch/arm/mach-s3c64xx/mach-smartq5.c | |
3 | * | |
4 | * Copyright (C) 2010 Maurus Cuelenaere | |
5 | * | |
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. | |
9 | * | |
10 | */ | |
11 | ||
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> | |
20 | ||
21 | #include <asm/mach-types.h> | |
22 | #include <asm/mach/arch.h> | |
23 | ||
24 | #include <mach/map.h> | |
25 | #include <mach/regs-fb.h> | |
26 | #include <mach/regs-gpio.h> | |
27 | #include <mach/s3c6410.h> | |
28 | ||
29 | #include <plat/cpu.h> | |
30 | #include <plat/devs.h> | |
31 | #include <plat/fb.h> | |
32 | #include <plat/gpio-cfg.h> | |
33 | ||
34 | #include "mach-smartq.h" | |
35 | ||
36 | static void __init smartq5_lcd_setup_gpio(void) | |
37 | { | |
38 | gpio_request(S3C64XX_GPM(0), "LCD SCEN pin"); | |
39 | gpio_request(S3C64XX_GPM(1), "LCD SCL pin"); | |
40 | gpio_request(S3C64XX_GPM(2), "LCD SDA pin"); | |
41 | gpio_request(S3C64XX_GPM(3), "LCD power"); | |
42 | ||
43 | /* turn power off */ | |
44 | gpio_direction_output(S3C64XX_GPM(0), 1); | |
45 | gpio_direction_input(S3C64XX_GPM(1)); | |
46 | gpio_direction_input(S3C64XX_GPM(2)); | |
47 | gpio_direction_output(S3C64XX_GPM(3), 0); | |
48 | } | |
49 | ||
50 | static struct i2c_gpio_platform_data smartq5_lcd_control = { | |
51 | .sda_pin = S3C64XX_GPM(2), | |
52 | .scl_pin = S3C64XX_GPM(1), | |
53 | }; | |
54 | ||
55 | static struct platform_device smartq5_lcd_control_device = { | |
56 | .name = "i2c-gpio", | |
57 | .id = 1, | |
58 | .dev.platform_data = &smartq5_lcd_control, | |
59 | }; | |
60 | ||
61 | static struct gpio_led smartq5_leds[] __initdata = { | |
62 | { | |
63 | .name = "smartq5:green", | |
64 | .active_low = 1, | |
65 | .gpio = S3C64XX_GPN(8), | |
66 | }, | |
67 | { | |
68 | .name = "smartq5:red", | |
69 | .active_low = 1, | |
70 | .gpio = S3C64XX_GPN(9), | |
71 | }, | |
72 | }; | |
73 | ||
74 | static struct gpio_led_platform_data smartq5_led_data = { | |
75 | .num_leds = ARRAY_SIZE(smartq5_leds), | |
76 | .leds = smartq5_leds, | |
77 | }; | |
78 | ||
79 | static struct platform_device smartq5_leds_device = { | |
80 | .name = "leds-gpio", | |
81 | .id = -1, | |
82 | .dev.platform_data = &smartq5_led_data, | |
83 | }; | |
84 | ||
85 | /* Labels according to the SmartQ manual */ | |
86 | static struct gpio_keys_button smartq5_buttons[] = { | |
87 | { | |
88 | .gpio = S3C64XX_GPL(14), | |
89 | .code = KEY_POWER, | |
90 | .desc = "Power", | |
91 | .active_low = 1, | |
92 | .debounce_interval = 5, | |
93 | .type = EV_KEY, | |
94 | }, | |
95 | { | |
96 | .gpio = S3C64XX_GPN(2), | |
97 | .code = KEY_KPMINUS, | |
98 | .desc = "Minus", | |
99 | .active_low = 1, | |
100 | .debounce_interval = 5, | |
101 | .type = EV_KEY, | |
102 | }, | |
103 | { | |
104 | .gpio = S3C64XX_GPN(12), | |
105 | .code = KEY_KPPLUS, | |
106 | .desc = "Plus", | |
107 | .active_low = 1, | |
108 | .debounce_interval = 5, | |
109 | .type = EV_KEY, | |
110 | }, | |
111 | { | |
112 | .gpio = S3C64XX_GPN(15), | |
113 | .code = KEY_ENTER, | |
114 | .desc = "Move", | |
115 | .active_low = 1, | |
116 | .debounce_interval = 5, | |
117 | .type = EV_KEY, | |
118 | }, | |
119 | }; | |
120 | ||
121 | static struct gpio_keys_platform_data smartq5_buttons_data = { | |
122 | .buttons = smartq5_buttons, | |
123 | .nbuttons = ARRAY_SIZE(smartq5_buttons), | |
124 | }; | |
125 | ||
126 | static struct platform_device smartq5_buttons_device = { | |
127 | .name = "gpio-keys", | |
128 | .id = 0, | |
129 | .num_resources = 0, | |
130 | .dev = { | |
131 | .platform_data = &smartq5_buttons_data, | |
132 | } | |
133 | }; | |
134 | ||
135 | static struct s3c_fb_pd_win smartq5_fb_win0 = { | |
136 | .win_mode = { | |
a2f7bffa MC |
137 | .left_margin = 40, |
138 | .right_margin = 216, | |
139 | .upper_margin = 10, | |
140 | .lower_margin = 35, | |
141 | .hsync_len = 1, | |
142 | .vsync_len = 1, | |
143 | .xres = 800, | |
144 | .yres = 480, | |
daf695fc | 145 | .refresh = 80, |
a2f7bffa MC |
146 | }, |
147 | .max_bpp = 32, | |
148 | .default_bpp = 16, | |
149 | }; | |
150 | ||
151 | static struct s3c_fb_platdata smartq5_lcd_pdata __initdata = { | |
152 | .setup_gpio = s3c64xx_fb_gpio_setup_24bpp, | |
153 | .win[0] = &smartq5_fb_win0, | |
154 | .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB, | |
155 | .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC | | |
156 | VIDCON1_INV_VDEN, | |
157 | }; | |
158 | ||
159 | static struct platform_device *smartq5_devices[] __initdata = { | |
160 | &smartq5_leds_device, | |
161 | &smartq5_buttons_device, | |
162 | &smartq5_lcd_control_device, | |
163 | }; | |
164 | ||
165 | static void __init smartq5_machine_init(void) | |
166 | { | |
167 | s3c_fb_set_platdata(&smartq5_lcd_pdata); | |
168 | ||
169 | smartq_machine_init(); | |
170 | smartq5_lcd_setup_gpio(); | |
171 | ||
172 | platform_add_devices(smartq5_devices, ARRAY_SIZE(smartq5_devices)); | |
173 | } | |
174 | ||
175 | MACHINE_START(SMARTQ5, "SmartQ 5") | |
176 | /* Maintainer: Maurus Cuelenaere <mcuelenaere AT gmail DOT com> */ | |
177 | .phys_io = S3C_PA_UART & 0xfff00000, | |
178 | .io_pg_offst = (((u32)S3C_VA_UART) >> 18) & 0xfffc, | |
179 | .boot_params = S3C64XX_PA_SDRAM + 0x100, | |
180 | .init_irq = s3c6410_init_irq, | |
181 | .map_io = smartq_map_io, | |
182 | .init_machine = smartq5_machine_init, | |
183 | .timer = &s3c24xx_timer, | |
184 | MACHINE_END |