diff options
Diffstat (limited to 'arch/arm/mach-pxa/palmt5.c')
-rw-r--r-- | arch/arm/mach-pxa/palmt5.c | 283 |
1 files changed, 31 insertions, 252 deletions
diff --git a/arch/arm/mach-pxa/palmt5.c b/arch/arm/mach-pxa/palmt5.c index 5e92d84fe50d..1c281995f658 100644 --- a/arch/arm/mach-pxa/palmt5.c +++ b/arch/arm/mach-pxa/palmt5.c | |||
@@ -25,7 +25,7 @@ | |||
25 | #include <linux/pda_power.h> | 25 | #include <linux/pda_power.h> |
26 | #include <linux/pwm_backlight.h> | 26 | #include <linux/pwm_backlight.h> |
27 | #include <linux/gpio.h> | 27 | #include <linux/gpio.h> |
28 | #include <linux/wm97xx_batt.h> | 28 | #include <linux/wm97xx.h> |
29 | #include <linux/power_supply.h> | 29 | #include <linux/power_supply.h> |
30 | #include <linux/usb/gpio_vbus.h> | 30 | #include <linux/usb/gpio_vbus.h> |
31 | 31 | ||
@@ -42,6 +42,7 @@ | |||
42 | #include <mach/pxa27x_keypad.h> | 42 | #include <mach/pxa27x_keypad.h> |
43 | #include <mach/udc.h> | 43 | #include <mach/udc.h> |
44 | #include <mach/palmasoc.h> | 44 | #include <mach/palmasoc.h> |
45 | #include <mach/palm27x.h> | ||
45 | 46 | ||
46 | #include "generic.h" | 47 | #include "generic.h" |
47 | #include "devices.h" | 48 | #include "devices.h" |
@@ -104,19 +105,9 @@ static unsigned long palmt5_pin_config[] __initdata = { | |||
104 | }; | 105 | }; |
105 | 106 | ||
106 | /****************************************************************************** | 107 | /****************************************************************************** |
107 | * SD/MMC card controller | ||
108 | ******************************************************************************/ | ||
109 | static struct pxamci_platform_data palmt5_mci_platform_data = { | ||
110 | .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, | ||
111 | .gpio_card_detect = GPIO_NR_PALMT5_SD_DETECT_N, | ||
112 | .gpio_card_ro = GPIO_NR_PALMT5_SD_READONLY, | ||
113 | .gpio_power = GPIO_NR_PALMT5_SD_POWER, | ||
114 | .detect_delay_ms = 200, | ||
115 | }; | ||
116 | |||
117 | /****************************************************************************** | ||
118 | * GPIO keyboard | 108 | * GPIO keyboard |
119 | ******************************************************************************/ | 109 | ******************************************************************************/ |
110 | #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE) | ||
120 | static unsigned int palmt5_matrix_keys[] = { | 111 | static unsigned int palmt5_matrix_keys[] = { |
121 | KEY(0, 0, KEY_POWER), | 112 | KEY(0, 0, KEY_POWER), |
122 | KEY(0, 1, KEY_F1), | 113 | KEY(0, 1, KEY_F1), |
@@ -142,9 +133,18 @@ static struct pxa27x_keypad_platform_data palmt5_keypad_platform_data = { | |||
142 | .debounce_interval = 30, | 133 | .debounce_interval = 30, |
143 | }; | 134 | }; |
144 | 135 | ||
136 | static void __init palmt5_kpc_init(void) | ||
137 | { | ||
138 | pxa_set_keypad_info(&palmt5_keypad_platform_data); | ||
139 | } | ||
140 | #else | ||
141 | static inline void palmt5_kpc_init(void) {} | ||
142 | #endif | ||
143 | |||
145 | /****************************************************************************** | 144 | /****************************************************************************** |
146 | * GPIO keys | 145 | * GPIO keys |
147 | ******************************************************************************/ | 146 | ******************************************************************************/ |
147 | #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) | ||
148 | static struct gpio_keys_button palmt5_pxa_buttons[] = { | 148 | static struct gpio_keys_button palmt5_pxa_buttons[] = { |
149 | {KEY_F8, GPIO_NR_PALMT5_HOTSYNC_BUTTON_N, 1, "HotSync Button" }, | 149 | {KEY_F8, GPIO_NR_PALMT5_HOTSYNC_BUTTON_N, 1, "HotSync Button" }, |
150 | }; | 150 | }; |
@@ -162,241 +162,17 @@ static struct platform_device palmt5_pxa_keys = { | |||
162 | }, | 162 | }, |
163 | }; | 163 | }; |
164 | 164 | ||
165 | /****************************************************************************** | 165 | static void __init palmt5_keys_init(void) |
166 | * Backlight | ||
167 | ******************************************************************************/ | ||
168 | static int palmt5_backlight_init(struct device *dev) | ||
169 | { | ||
170 | int ret; | ||
171 | |||
172 | ret = gpio_request(GPIO_NR_PALMT5_BL_POWER, "BL POWER"); | ||
173 | if (ret) | ||
174 | goto err; | ||
175 | ret = gpio_direction_output(GPIO_NR_PALMT5_BL_POWER, 0); | ||
176 | if (ret) | ||
177 | goto err2; | ||
178 | ret = gpio_request(GPIO_NR_PALMT5_LCD_POWER, "LCD POWER"); | ||
179 | if (ret) | ||
180 | goto err2; | ||
181 | ret = gpio_direction_output(GPIO_NR_PALMT5_LCD_POWER, 0); | ||
182 | if (ret) | ||
183 | goto err3; | ||
184 | |||
185 | return 0; | ||
186 | err3: | ||
187 | gpio_free(GPIO_NR_PALMT5_LCD_POWER); | ||
188 | err2: | ||
189 | gpio_free(GPIO_NR_PALMT5_BL_POWER); | ||
190 | err: | ||
191 | return ret; | ||
192 | } | ||
193 | |||
194 | static int palmt5_backlight_notify(struct device *dev, int brightness) | ||
195 | { | ||
196 | gpio_set_value(GPIO_NR_PALMT5_BL_POWER, brightness); | ||
197 | gpio_set_value(GPIO_NR_PALMT5_LCD_POWER, brightness); | ||
198 | return brightness; | ||
199 | } | ||
200 | |||
201 | static void palmt5_backlight_exit(struct device *dev) | ||
202 | { | ||
203 | gpio_free(GPIO_NR_PALMT5_BL_POWER); | ||
204 | gpio_free(GPIO_NR_PALMT5_LCD_POWER); | ||
205 | } | ||
206 | |||
207 | static struct platform_pwm_backlight_data palmt5_backlight_data = { | ||
208 | .pwm_id = 0, | ||
209 | .max_brightness = PALMT5_MAX_INTENSITY, | ||
210 | .dft_brightness = PALMT5_MAX_INTENSITY, | ||
211 | .pwm_period_ns = PALMT5_PERIOD_NS, | ||
212 | .init = palmt5_backlight_init, | ||
213 | .notify = palmt5_backlight_notify, | ||
214 | .exit = palmt5_backlight_exit, | ||
215 | }; | ||
216 | |||
217 | static struct platform_device palmt5_backlight = { | ||
218 | .name = "pwm-backlight", | ||
219 | .dev = { | ||
220 | .parent = &pxa27x_device_pwm0.dev, | ||
221 | .platform_data = &palmt5_backlight_data, | ||
222 | }, | ||
223 | }; | ||
224 | |||
225 | /****************************************************************************** | ||
226 | * IrDA | ||
227 | ******************************************************************************/ | ||
228 | static struct pxaficp_platform_data palmt5_ficp_platform_data = { | ||
229 | .gpio_pwdown = GPIO_NR_PALMT5_IR_DISABLE, | ||
230 | .transceiver_cap = IR_SIRMODE | IR_OFF, | ||
231 | }; | ||
232 | |||
233 | /****************************************************************************** | ||
234 | * UDC | ||
235 | ******************************************************************************/ | ||
236 | static struct gpio_vbus_mach_info palmt5_udc_info = { | ||
237 | .gpio_vbus = GPIO_NR_PALMT5_USB_DETECT_N, | ||
238 | .gpio_vbus_inverted = 1, | ||
239 | .gpio_pullup = GPIO_NR_PALMT5_USB_PULLUP, | ||
240 | }; | ||
241 | |||
242 | static struct platform_device palmt5_gpio_vbus = { | ||
243 | .name = "gpio-vbus", | ||
244 | .id = -1, | ||
245 | .dev = { | ||
246 | .platform_data = &palmt5_udc_info, | ||
247 | }, | ||
248 | }; | ||
249 | |||
250 | /****************************************************************************** | ||
251 | * Power supply | ||
252 | ******************************************************************************/ | ||
253 | static int power_supply_init(struct device *dev) | ||
254 | { | ||
255 | int ret; | ||
256 | |||
257 | ret = gpio_request(GPIO_NR_PALMT5_POWER_DETECT, "CABLE_STATE_AC"); | ||
258 | if (ret) | ||
259 | goto err1; | ||
260 | ret = gpio_direction_input(GPIO_NR_PALMT5_POWER_DETECT); | ||
261 | if (ret) | ||
262 | goto err2; | ||
263 | |||
264 | return 0; | ||
265 | err2: | ||
266 | gpio_free(GPIO_NR_PALMT5_POWER_DETECT); | ||
267 | err1: | ||
268 | return ret; | ||
269 | } | ||
270 | |||
271 | static int palmt5_is_ac_online(void) | ||
272 | { | ||
273 | return gpio_get_value(GPIO_NR_PALMT5_POWER_DETECT); | ||
274 | } | ||
275 | |||
276 | static void power_supply_exit(struct device *dev) | ||
277 | { | ||
278 | gpio_free(GPIO_NR_PALMT5_POWER_DETECT); | ||
279 | } | ||
280 | |||
281 | static char *palmt5_supplicants[] = { | ||
282 | "main-battery", | ||
283 | }; | ||
284 | |||
285 | static struct pda_power_pdata power_supply_info = { | ||
286 | .init = power_supply_init, | ||
287 | .is_ac_online = palmt5_is_ac_online, | ||
288 | .exit = power_supply_exit, | ||
289 | .supplied_to = palmt5_supplicants, | ||
290 | .num_supplicants = ARRAY_SIZE(palmt5_supplicants), | ||
291 | }; | ||
292 | |||
293 | static struct platform_device power_supply = { | ||
294 | .name = "pda-power", | ||
295 | .id = -1, | ||
296 | .dev = { | ||
297 | .platform_data = &power_supply_info, | ||
298 | }, | ||
299 | }; | ||
300 | |||
301 | /****************************************************************************** | ||
302 | * WM97xx battery | ||
303 | ******************************************************************************/ | ||
304 | static struct wm97xx_batt_info wm97xx_batt_pdata = { | ||
305 | .batt_aux = WM97XX_AUX_ID3, | ||
306 | .temp_aux = WM97XX_AUX_ID2, | ||
307 | .charge_gpio = -1, | ||
308 | .max_voltage = PALMT5_BAT_MAX_VOLTAGE, | ||
309 | .min_voltage = PALMT5_BAT_MIN_VOLTAGE, | ||
310 | .batt_mult = 1000, | ||
311 | .batt_div = 414, | ||
312 | .temp_mult = 1, | ||
313 | .temp_div = 1, | ||
314 | .batt_tech = POWER_SUPPLY_TECHNOLOGY_LIPO, | ||
315 | .batt_name = "main-batt", | ||
316 | }; | ||
317 | |||
318 | /****************************************************************************** | ||
319 | * aSoC audio | ||
320 | ******************************************************************************/ | ||
321 | static struct palm27x_asoc_info palmt5_asoc_pdata = { | ||
322 | .jack_gpio = GPIO_NR_PALMT5_EARPHONE_DETECT, | ||
323 | }; | ||
324 | |||
325 | static pxa2xx_audio_ops_t palmt5_ac97_pdata = { | ||
326 | .reset_gpio = 95, | ||
327 | }; | ||
328 | |||
329 | static struct platform_device palmt5_asoc = { | ||
330 | .name = "palm27x-asoc", | ||
331 | .id = -1, | ||
332 | .dev = { | ||
333 | .platform_data = &palmt5_asoc_pdata, | ||
334 | }, | ||
335 | }; | ||
336 | |||
337 | /****************************************************************************** | ||
338 | * Framebuffer | ||
339 | ******************************************************************************/ | ||
340 | static struct pxafb_mode_info palmt5_lcd_modes[] = { | ||
341 | { | ||
342 | .pixclock = 57692, | ||
343 | .xres = 320, | ||
344 | .yres = 480, | ||
345 | .bpp = 16, | ||
346 | |||
347 | .left_margin = 32, | ||
348 | .right_margin = 1, | ||
349 | .upper_margin = 7, | ||
350 | .lower_margin = 1, | ||
351 | |||
352 | .hsync_len = 4, | ||
353 | .vsync_len = 1, | ||
354 | }, | ||
355 | }; | ||
356 | |||
357 | static struct pxafb_mach_info palmt5_lcd_screen = { | ||
358 | .modes = palmt5_lcd_modes, | ||
359 | .num_modes = ARRAY_SIZE(palmt5_lcd_modes), | ||
360 | .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL, | ||
361 | }; | ||
362 | |||
363 | /****************************************************************************** | ||
364 | * Power management - standby | ||
365 | ******************************************************************************/ | ||
366 | static void __init palmt5_pm_init(void) | ||
367 | { | 166 | { |
368 | static u32 resume[] = { | 167 | platform_device_register(&palmt5_pxa_keys); |
369 | 0xe3a00101, /* mov r0, #0x40000000 */ | ||
370 | 0xe380060f, /* orr r0, r0, #0x00f00000 */ | ||
371 | 0xe590f008, /* ldr pc, [r0, #0x08] */ | ||
372 | }; | ||
373 | |||
374 | /* copy the bootloader */ | ||
375 | memcpy(phys_to_virt(PALMT5_STR_BASE), resume, sizeof(resume)); | ||
376 | } | 168 | } |
169 | #else | ||
170 | static inline void palmt5_keys_init(void) {} | ||
171 | #endif | ||
377 | 172 | ||
378 | /****************************************************************************** | 173 | /****************************************************************************** |
379 | * Machine init | 174 | * Machine init |
380 | ******************************************************************************/ | 175 | ******************************************************************************/ |
381 | static struct platform_device *devices[] __initdata = { | ||
382 | #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) | ||
383 | &palmt5_pxa_keys, | ||
384 | #endif | ||
385 | &palmt5_backlight, | ||
386 | &power_supply, | ||
387 | &palmt5_asoc, | ||
388 | &palmt5_gpio_vbus, | ||
389 | }; | ||
390 | |||
391 | /* setup udc GPIOs initial state */ | ||
392 | static void __init palmt5_udc_init(void) | ||
393 | { | ||
394 | if (!gpio_request(GPIO_NR_PALMT5_USB_PULLUP, "UDC Vbus")) { | ||
395 | gpio_direction_output(GPIO_NR_PALMT5_USB_PULLUP, 1); | ||
396 | gpio_free(GPIO_NR_PALMT5_USB_PULLUP); | ||
397 | } | ||
398 | } | ||
399 | |||
400 | static void __init palmt5_reserve(void) | 176 | static void __init palmt5_reserve(void) |
401 | { | 177 | { |
402 | memblock_reserve(0xa0200000, 0x1000); | 178 | memblock_reserve(0xa0200000, 0x1000); |
@@ -405,21 +181,24 @@ static void __init palmt5_reserve(void) | |||
405 | static void __init palmt5_init(void) | 181 | static void __init palmt5_init(void) |
406 | { | 182 | { |
407 | pxa2xx_mfp_config(ARRAY_AND_SIZE(palmt5_pin_config)); | 183 | pxa2xx_mfp_config(ARRAY_AND_SIZE(palmt5_pin_config)); |
408 | |||
409 | pxa_set_ffuart_info(NULL); | 184 | pxa_set_ffuart_info(NULL); |
410 | pxa_set_btuart_info(NULL); | 185 | pxa_set_btuart_info(NULL); |
411 | pxa_set_stuart_info(NULL); | 186 | pxa_set_stuart_info(NULL); |
412 | 187 | ||
413 | palmt5_pm_init(); | 188 | palm27x_mmc_init(GPIO_NR_PALMT5_SD_DETECT_N, GPIO_NR_PALMT5_SD_READONLY, |
414 | set_pxa_fb_info(&palmt5_lcd_screen); | 189 | GPIO_NR_PALMT5_SD_POWER, 0); |
415 | pxa_set_mci_info(&palmt5_mci_platform_data); | 190 | palm27x_pm_init(PALMT5_STR_BASE); |
416 | palmt5_udc_init(); | 191 | palm27x_lcd_init(-1, &palm_320x480_lcd_mode); |
417 | pxa_set_ac97_info(&palmt5_ac97_pdata); | 192 | palm27x_udc_init(GPIO_NR_PALMT5_USB_DETECT_N, |
418 | pxa_set_ficp_info(&palmt5_ficp_platform_data); | 193 | GPIO_NR_PALMT5_USB_PULLUP, 1); |
419 | pxa_set_keypad_info(&palmt5_keypad_platform_data); | 194 | palm27x_irda_init(GPIO_NR_PALMT5_IR_DISABLE); |
420 | wm97xx_bat_set_pdata(&wm97xx_batt_pdata); | 195 | palm27x_ac97_init(PALMT5_BAT_MIN_VOLTAGE, PALMT5_BAT_MAX_VOLTAGE, |
421 | 196 | GPIO_NR_PALMT5_EARPHONE_DETECT, 95); | |
422 | platform_add_devices(devices, ARRAY_SIZE(devices)); | 197 | palm27x_pwm_init(GPIO_NR_PALMT5_BL_POWER, GPIO_NR_PALMT5_LCD_POWER); |
198 | palm27x_power_init(GPIO_NR_PALMT5_POWER_DETECT, -1); | ||
199 | palm27x_pmic_init(); | ||
200 | palmt5_kpc_init(); | ||
201 | palmt5_keys_init(); | ||
423 | } | 202 | } |
424 | 203 | ||
425 | MACHINE_START(PALMT5, "Palm Tungsten|T5") | 204 | MACHINE_START(PALMT5, "Palm Tungsten|T5") |