| Sergey Lapin | c49e1e6 | 2008-08-29 15:47:52 +0100 | [diff] [blame] | 1 | /* | 
 | 2 |  * Hardware definitions for Palm Zire72 | 
 | 3 |  * | 
 | 4 |  * Authors: | 
 | 5 |  *	Vladimir "Farcaller" Pouzanov <farcaller@gmail.com> | 
 | 6 |  *	Sergey Lapin <slapin@ossfans.org> | 
 | 7 |  *	Alex Osborne <bobofdoom@gmail.com> | 
 | 8 |  *	Jan Herman <2hp@seznam.cz> | 
 | 9 |  * | 
 | 10 |  * Rewrite for mainline: | 
 | 11 |  *	Marek Vasut <marek.vasut@gmail.com> | 
 | 12 |  * | 
 | 13 |  * This program is free software; you can redistribute it and/or modify | 
 | 14 |  * it under the terms of the GNU General Public License version 2 as | 
 | 15 |  * published by the Free Software Foundation. | 
 | 16 |  * | 
 | 17 |  * (find more info at www.hackndev.com) | 
 | 18 |  * | 
 | 19 |  */ | 
 | 20 |  | 
 | 21 | #include <linux/platform_device.h> | 
| Rafael J. Wysocki | 2eaa03b | 2011-04-22 22:03:11 +0200 | [diff] [blame] | 22 | #include <linux/syscore_ops.h> | 
| Sergey Lapin | c49e1e6 | 2008-08-29 15:47:52 +0100 | [diff] [blame] | 23 | #include <linux/delay.h> | 
 | 24 | #include <linux/irq.h> | 
 | 25 | #include <linux/gpio_keys.h> | 
 | 26 | #include <linux/input.h> | 
 | 27 | #include <linux/pda_power.h> | 
 | 28 | #include <linux/pwm_backlight.h> | 
 | 29 | #include <linux/gpio.h> | 
| Marek Vasut | 241cf47 | 2010-06-04 03:07:33 +0200 | [diff] [blame] | 30 | #include <linux/wm97xx.h> | 
| Sergey Lapin | c49e1e6 | 2008-08-29 15:47:52 +0100 | [diff] [blame] | 31 | #include <linux/power_supply.h> | 
| Marek Vasut | eb73e62 | 2009-06-01 22:34:14 +0200 | [diff] [blame] | 32 | #include <linux/usb/gpio_vbus.h> | 
| Marek Vasut | 54a93b6 | 2011-01-13 11:45:30 +0100 | [diff] [blame] | 33 | #include <linux/i2c-gpio.h> | 
| Sergey Lapin | c49e1e6 | 2008-08-29 15:47:52 +0100 | [diff] [blame] | 34 |  | 
 | 35 | #include <asm/mach-types.h> | 
 | 36 | #include <asm/mach/arch.h> | 
 | 37 | #include <asm/mach/map.h> | 
 | 38 |  | 
| Eric Miao | 51c6298 | 2009-01-02 23:17:22 +0800 | [diff] [blame] | 39 | #include <mach/pxa27x.h> | 
| Sergey Lapin | c49e1e6 | 2008-08-29 15:47:52 +0100 | [diff] [blame] | 40 | #include <mach/audio.h> | 
 | 41 | #include <mach/palmz72.h> | 
 | 42 | #include <mach/mmc.h> | 
 | 43 | #include <mach/pxafb.h> | 
| Sergey Lapin | c49e1e6 | 2008-08-29 15:47:52 +0100 | [diff] [blame] | 44 | #include <mach/irda.h> | 
| Mark F. Brown | 4a2490e | 2010-09-03 18:28:06 -0400 | [diff] [blame] | 45 | #include <plat/pxa27x_keypad.h> | 
| Sergey Lapin | c49e1e6 | 2008-08-29 15:47:52 +0100 | [diff] [blame] | 46 | #include <mach/udc.h> | 
| Marek Vasut | eb73e62 | 2009-06-01 22:34:14 +0200 | [diff] [blame] | 47 | #include <mach/palmasoc.h> | 
| Marek Vasut | 31620e2 | 2010-07-13 08:16:45 +0200 | [diff] [blame] | 48 | #include <mach/palm27x.h> | 
| Marek Vasut | eb73e62 | 2009-06-01 22:34:14 +0200 | [diff] [blame] | 49 |  | 
| Sergey Lapin | c49e1e6 | 2008-08-29 15:47:52 +0100 | [diff] [blame] | 50 | #include <mach/pm.h> | 
| Marek Vasut | 54a93b6 | 2011-01-13 11:45:30 +0100 | [diff] [blame] | 51 | #include <mach/camera.h> | 
 | 52 |  | 
 | 53 | #include <media/soc_camera.h> | 
| Sergey Lapin | c49e1e6 | 2008-08-29 15:47:52 +0100 | [diff] [blame] | 54 |  | 
 | 55 | #include "generic.h" | 
 | 56 | #include "devices.h" | 
 | 57 |  | 
 | 58 | /****************************************************************************** | 
 | 59 |  * Pin configuration | 
 | 60 |  ******************************************************************************/ | 
 | 61 | static unsigned long palmz72_pin_config[] __initdata = { | 
 | 62 | 	/* MMC */ | 
 | 63 | 	GPIO32_MMC_CLK, | 
 | 64 | 	GPIO92_MMC_DAT_0, | 
 | 65 | 	GPIO109_MMC_DAT_1, | 
 | 66 | 	GPIO110_MMC_DAT_2, | 
 | 67 | 	GPIO111_MMC_DAT_3, | 
 | 68 | 	GPIO112_MMC_CMD, | 
 | 69 | 	GPIO14_GPIO,	/* SD detect */ | 
 | 70 | 	GPIO115_GPIO,	/* SD RO */ | 
 | 71 | 	GPIO98_GPIO,	/* SD power */ | 
 | 72 |  | 
 | 73 | 	/* AC97 */ | 
 | 74 | 	GPIO28_AC97_BITCLK, | 
 | 75 | 	GPIO29_AC97_SDATA_IN_0, | 
 | 76 | 	GPIO30_AC97_SDATA_OUT, | 
 | 77 | 	GPIO31_AC97_SYNC, | 
| Marek Vasut | eb73e62 | 2009-06-01 22:34:14 +0200 | [diff] [blame] | 78 | 	GPIO89_AC97_SYSCLK, | 
 | 79 | 	GPIO113_AC97_nRESET, | 
| Sergey Lapin | c49e1e6 | 2008-08-29 15:47:52 +0100 | [diff] [blame] | 80 |  | 
 | 81 | 	/* IrDA */ | 
 | 82 | 	GPIO49_GPIO,	/* ir disable */ | 
 | 83 | 	GPIO46_FICP_RXD, | 
 | 84 | 	GPIO47_FICP_TXD, | 
 | 85 |  | 
 | 86 | 	/* PWM */ | 
 | 87 | 	GPIO16_PWM0_OUT, | 
 | 88 |  | 
 | 89 | 	/* USB */ | 
 | 90 | 	GPIO15_GPIO,	/* usb detect */ | 
| Marek Vasut | eb73e62 | 2009-06-01 22:34:14 +0200 | [diff] [blame] | 91 | 	GPIO95_GPIO,	/* usb pullup */ | 
| Sergey Lapin | c49e1e6 | 2008-08-29 15:47:52 +0100 | [diff] [blame] | 92 |  | 
 | 93 | 	/* Matrix keypad */ | 
 | 94 | 	GPIO100_KP_MKIN_0	| WAKEUP_ON_LEVEL_HIGH, | 
 | 95 | 	GPIO101_KP_MKIN_1	| WAKEUP_ON_LEVEL_HIGH, | 
 | 96 | 	GPIO102_KP_MKIN_2	| WAKEUP_ON_LEVEL_HIGH, | 
 | 97 | 	GPIO97_KP_MKIN_3	| WAKEUP_ON_LEVEL_HIGH, | 
 | 98 | 	GPIO103_KP_MKOUT_0, | 
 | 99 | 	GPIO104_KP_MKOUT_1, | 
 | 100 | 	GPIO105_KP_MKOUT_2, | 
 | 101 |  | 
 | 102 | 	/* LCD */ | 
| Eric Miao | bedbda9 | 2010-01-04 11:37:14 +0800 | [diff] [blame] | 103 | 	GPIOxx_LCD_TFT_16BPP, | 
 | 104 |  | 
| Sergey Lapin | c49e1e6 | 2008-08-29 15:47:52 +0100 | [diff] [blame] | 105 | 	GPIO20_GPIO,	/* bl power */ | 
 | 106 | 	GPIO21_GPIO,	/* LCD border switch */ | 
 | 107 | 	GPIO22_GPIO,	/* LCD border color */ | 
 | 108 | 	GPIO96_GPIO,	/* lcd power */ | 
 | 109 |  | 
| Marek Vasut | 54a93b6 | 2011-01-13 11:45:30 +0100 | [diff] [blame] | 110 | 	/* PXA Camera */ | 
 | 111 | 	GPIO81_CIF_DD_0, | 
 | 112 | 	GPIO48_CIF_DD_5, | 
 | 113 | 	GPIO50_CIF_DD_3, | 
 | 114 | 	GPIO51_CIF_DD_2, | 
 | 115 | 	GPIO52_CIF_DD_4, | 
 | 116 | 	GPIO53_CIF_MCLK, | 
 | 117 | 	GPIO54_CIF_PCLK, | 
 | 118 | 	GPIO55_CIF_DD_1, | 
 | 119 | 	GPIO84_CIF_FV, | 
 | 120 | 	GPIO85_CIF_LV, | 
 | 121 | 	GPIO93_CIF_DD_6, | 
 | 122 | 	GPIO108_CIF_DD_7, | 
 | 123 |  | 
 | 124 | 	GPIO56_GPIO,	/* OV9640 Powerdown */ | 
 | 125 | 	GPIO57_GPIO,	/* OV9640 Reset */ | 
 | 126 | 	GPIO91_GPIO,	/* OV9640 Power */ | 
 | 127 |  | 
 | 128 | 	/* I2C */ | 
 | 129 | 	GPIO117_GPIO,	/* I2C_SCL */ | 
 | 130 | 	GPIO118_GPIO,	/* I2C_SDA */ | 
 | 131 |  | 
| Sergey Lapin | c49e1e6 | 2008-08-29 15:47:52 +0100 | [diff] [blame] | 132 | 	/* Misc. */ | 
 | 133 | 	GPIO0_GPIO	| WAKEUP_ON_LEVEL_HIGH,	/* power detect */ | 
 | 134 | 	GPIO88_GPIO,				/* green led */ | 
 | 135 | 	GPIO27_GPIO,				/* WM9712 IRQ */ | 
 | 136 | }; | 
 | 137 |  | 
 | 138 | /****************************************************************************** | 
| Sergey Lapin | c49e1e6 | 2008-08-29 15:47:52 +0100 | [diff] [blame] | 139 |  * GPIO keyboard | 
 | 140 |  ******************************************************************************/ | 
| Marek Vasut | 31620e2 | 2010-07-13 08:16:45 +0200 | [diff] [blame] | 141 | #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE) | 
| Sergey Lapin | c49e1e6 | 2008-08-29 15:47:52 +0100 | [diff] [blame] | 142 | static unsigned int palmz72_matrix_keys[] = { | 
 | 143 | 	KEY(0, 0, KEY_POWER), | 
 | 144 | 	KEY(0, 1, KEY_F1), | 
 | 145 | 	KEY(0, 2, KEY_ENTER), | 
 | 146 |  | 
 | 147 | 	KEY(1, 0, KEY_F2), | 
 | 148 | 	KEY(1, 1, KEY_F3), | 
 | 149 | 	KEY(1, 2, KEY_F4), | 
 | 150 |  | 
 | 151 | 	KEY(2, 0, KEY_UP), | 
 | 152 | 	KEY(2, 2, KEY_DOWN), | 
 | 153 |  | 
 | 154 | 	KEY(3, 0, KEY_RIGHT), | 
 | 155 | 	KEY(3, 2, KEY_LEFT), | 
 | 156 | }; | 
 | 157 |  | 
 | 158 | static struct pxa27x_keypad_platform_data palmz72_keypad_platform_data = { | 
 | 159 | 	.matrix_key_rows	= 4, | 
 | 160 | 	.matrix_key_cols	= 3, | 
 | 161 | 	.matrix_key_map		= palmz72_matrix_keys, | 
 | 162 | 	.matrix_key_map_size	= ARRAY_SIZE(palmz72_matrix_keys), | 
 | 163 |  | 
 | 164 | 	.debounce_interval	= 30, | 
 | 165 | }; | 
 | 166 |  | 
| Marek Vasut | 31620e2 | 2010-07-13 08:16:45 +0200 | [diff] [blame] | 167 | static void __init palmz72_kpc_init(void) | 
| Sergey Lapin | c49e1e6 | 2008-08-29 15:47:52 +0100 | [diff] [blame] | 168 | { | 
| Marek Vasut | 31620e2 | 2010-07-13 08:16:45 +0200 | [diff] [blame] | 169 | 	pxa_set_keypad_info(&palmz72_keypad_platform_data); | 
| Sergey Lapin | c49e1e6 | 2008-08-29 15:47:52 +0100 | [diff] [blame] | 170 | } | 
| Marek Vasut | 31620e2 | 2010-07-13 08:16:45 +0200 | [diff] [blame] | 171 | #else | 
 | 172 | static inline void palmz72_kpc_init(void) {} | 
 | 173 | #endif | 
| Sergey Lapin | c49e1e6 | 2008-08-29 15:47:52 +0100 | [diff] [blame] | 174 |  | 
 | 175 | /****************************************************************************** | 
 | 176 |  * LEDs | 
 | 177 |  ******************************************************************************/ | 
| Marek Vasut | 31620e2 | 2010-07-13 08:16:45 +0200 | [diff] [blame] | 178 | #if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE) | 
| Sergey Lapin | c49e1e6 | 2008-08-29 15:47:52 +0100 | [diff] [blame] | 179 | static struct gpio_led gpio_leds[] = { | 
 | 180 | 	{ | 
 | 181 | 		.name			= "palmz72:green:led", | 
 | 182 | 		.default_trigger	= "none", | 
 | 183 | 		.gpio			= GPIO_NR_PALMZ72_LED_GREEN, | 
 | 184 | 	}, | 
 | 185 | }; | 
 | 186 |  | 
 | 187 | static struct gpio_led_platform_data gpio_led_info = { | 
 | 188 | 	.leds		= gpio_leds, | 
 | 189 | 	.num_leds	= ARRAY_SIZE(gpio_leds), | 
 | 190 | }; | 
 | 191 |  | 
 | 192 | static struct platform_device palmz72_leds = { | 
 | 193 | 	.name	= "leds-gpio", | 
 | 194 | 	.id	= -1, | 
 | 195 | 	.dev	= { | 
 | 196 | 		.platform_data	= &gpio_led_info, | 
 | 197 | 	} | 
 | 198 | }; | 
 | 199 |  | 
| Marek Vasut | 31620e2 | 2010-07-13 08:16:45 +0200 | [diff] [blame] | 200 | static void __init palmz72_leds_init(void) | 
| Sergey Lapin | c49e1e6 | 2008-08-29 15:47:52 +0100 | [diff] [blame] | 201 | { | 
| Marek Vasut | 31620e2 | 2010-07-13 08:16:45 +0200 | [diff] [blame] | 202 | 	platform_device_register(&palmz72_leds); | 
| Sergey Lapin | c49e1e6 | 2008-08-29 15:47:52 +0100 | [diff] [blame] | 203 | } | 
| Marek Vasut | 31620e2 | 2010-07-13 08:16:45 +0200 | [diff] [blame] | 204 | #else | 
 | 205 | static inline void palmz72_leds_init(void) {} | 
 | 206 | #endif | 
| Sergey Lapin | c49e1e6 | 2008-08-29 15:47:52 +0100 | [diff] [blame] | 207 |  | 
| Sergey Lapin | fda50a1 | 2008-08-29 15:53:24 +0100 | [diff] [blame] | 208 | #ifdef CONFIG_PM | 
 | 209 |  | 
 | 210 | /* We have some black magic here | 
 | 211 |  * PalmOS ROM on recover expects special struct physical address | 
 | 212 |  * to be transferred via PSPR. Using this struct PalmOS restores | 
 | 213 |  * its state after sleep. As for Linux, we need to setup it the | 
 | 214 |  * same way. More than that, PalmOS ROM changes some values in memory. | 
 | 215 |  * For now only one location is found, which needs special treatment. | 
 | 216 |  * Thanks to Alex Osborne, Andrzej Zaborowski, and lots of other people | 
 | 217 |  * for reading backtraces for me :) | 
 | 218 |  */ | 
 | 219 |  | 
 | 220 | #define PALMZ72_SAVE_DWORD ((unsigned long *)0xc0000050) | 
 | 221 |  | 
 | 222 | static struct palmz72_resume_info palmz72_resume_info = { | 
 | 223 | 	.magic0 = 0xb4e6, | 
 | 224 | 	.magic1 = 1, | 
 | 225 |  | 
 | 226 | 	/* reset state, MMU off etc */ | 
 | 227 | 	.arm_control = 0, | 
 | 228 | 	.aux_control = 0, | 
 | 229 | 	.ttb = 0, | 
 | 230 | 	.domain_access = 0, | 
 | 231 | 	.process_id = 0, | 
 | 232 | }; | 
 | 233 |  | 
 | 234 | static unsigned long store_ptr; | 
 | 235 |  | 
| Rafael J. Wysocki | 2eaa03b | 2011-04-22 22:03:11 +0200 | [diff] [blame] | 236 | /* syscore_ops for Palm Zire 72 PM */ | 
| Sergey Lapin | fda50a1 | 2008-08-29 15:53:24 +0100 | [diff] [blame] | 237 |  | 
| Rafael J. Wysocki | 2eaa03b | 2011-04-22 22:03:11 +0200 | [diff] [blame] | 238 | static int palmz72_pm_suspend(void) | 
| Sergey Lapin | fda50a1 | 2008-08-29 15:53:24 +0100 | [diff] [blame] | 239 | { | 
 | 240 | 	/* setup the resume_info struct for the original bootloader */ | 
| Russell King | 4f5ad99 | 2011-02-06 17:41:26 +0000 | [diff] [blame] | 241 | 	palmz72_resume_info.resume_addr = (u32) cpu_resume; | 
| Sergey Lapin | fda50a1 | 2008-08-29 15:53:24 +0100 | [diff] [blame] | 242 |  | 
 | 243 | 	/* Storing memory touched by ROM */ | 
 | 244 | 	store_ptr = *PALMZ72_SAVE_DWORD; | 
 | 245 |  | 
 | 246 | 	/* Setting PSPR to a proper value */ | 
 | 247 | 	PSPR = virt_to_phys(&palmz72_resume_info); | 
 | 248 |  | 
 | 249 | 	return 0; | 
 | 250 | } | 
 | 251 |  | 
| Rafael J. Wysocki | 2eaa03b | 2011-04-22 22:03:11 +0200 | [diff] [blame] | 252 | static void palmz72_pm_resume(void) | 
| Sergey Lapin | fda50a1 | 2008-08-29 15:53:24 +0100 | [diff] [blame] | 253 | { | 
 | 254 | 	*PALMZ72_SAVE_DWORD = store_ptr; | 
| Sergey Lapin | fda50a1 | 2008-08-29 15:53:24 +0100 | [diff] [blame] | 255 | } | 
 | 256 |  | 
| Rafael J. Wysocki | 2eaa03b | 2011-04-22 22:03:11 +0200 | [diff] [blame] | 257 | static struct syscore_ops palmz72_pm_syscore_ops = { | 
| Sergey Lapin | fda50a1 | 2008-08-29 15:53:24 +0100 | [diff] [blame] | 258 | 	.suspend = palmz72_pm_suspend, | 
 | 259 | 	.resume = palmz72_pm_resume, | 
 | 260 | }; | 
 | 261 |  | 
| Sergey Lapin | fda50a1 | 2008-08-29 15:53:24 +0100 | [diff] [blame] | 262 | static int __init palmz72_pm_init(void) | 
 | 263 | { | 
| Sergey Lapin | fda50a1 | 2008-08-29 15:53:24 +0100 | [diff] [blame] | 264 | 	if (machine_is_palmz72()) { | 
| Rafael J. Wysocki | 2eaa03b | 2011-04-22 22:03:11 +0200 | [diff] [blame] | 265 | 		register_syscore_ops(&palmz72_pm_syscore_ops); | 
 | 266 | 		return 0; | 
| Sergey Lapin | fda50a1 | 2008-08-29 15:53:24 +0100 | [diff] [blame] | 267 | 	} | 
| Rafael J. Wysocki | 2eaa03b | 2011-04-22 22:03:11 +0200 | [diff] [blame] | 268 | 	return -ENODEV; | 
| Sergey Lapin | fda50a1 | 2008-08-29 15:53:24 +0100 | [diff] [blame] | 269 | } | 
 | 270 |  | 
 | 271 | device_initcall(palmz72_pm_init); | 
 | 272 | #endif | 
 | 273 |  | 
| Sergey Lapin | c49e1e6 | 2008-08-29 15:47:52 +0100 | [diff] [blame] | 274 | /****************************************************************************** | 
| Marek Vasut | 54a93b6 | 2011-01-13 11:45:30 +0100 | [diff] [blame] | 275 |  * SoC Camera | 
 | 276 |  ******************************************************************************/ | 
 | 277 | #if defined(CONFIG_SOC_CAMERA_OV9640) || \ | 
 | 278 | 	defined(CONFIG_SOC_CAMERA_OV9640_MODULE) | 
 | 279 | static struct pxacamera_platform_data palmz72_pxacamera_platform_data = { | 
 | 280 | 	.flags		= PXA_CAMERA_MASTER | PXA_CAMERA_DATAWIDTH_8 | | 
 | 281 | 			PXA_CAMERA_PCLK_EN | PXA_CAMERA_MCLK_EN, | 
 | 282 | 	.mclk_10khz	= 2600, | 
 | 283 | }; | 
 | 284 |  | 
 | 285 | /* Board I2C devices. */ | 
 | 286 | static struct i2c_board_info palmz72_i2c_device[] = { | 
 | 287 | 	{ | 
 | 288 | 		I2C_BOARD_INFO("ov9640", 0x30), | 
 | 289 | 	} | 
 | 290 | }; | 
 | 291 |  | 
 | 292 | static int palmz72_camera_power(struct device *dev, int power) | 
 | 293 | { | 
 | 294 | 	gpio_set_value(GPIO_NR_PALMZ72_CAM_PWDN, !power); | 
 | 295 | 	mdelay(50); | 
 | 296 | 	return 0; | 
 | 297 | } | 
 | 298 |  | 
 | 299 | static int palmz72_camera_reset(struct device *dev) | 
 | 300 | { | 
 | 301 | 	gpio_set_value(GPIO_NR_PALMZ72_CAM_RESET, 1); | 
 | 302 | 	mdelay(50); | 
 | 303 | 	gpio_set_value(GPIO_NR_PALMZ72_CAM_RESET, 0); | 
 | 304 | 	mdelay(50); | 
 | 305 | 	return 0; | 
 | 306 | } | 
 | 307 |  | 
 | 308 | static struct soc_camera_link palmz72_iclink = { | 
 | 309 | 	.bus_id		= 0, /* Match id in pxa27x_device_camera in device.c */ | 
 | 310 | 	.board_info	= &palmz72_i2c_device[0], | 
 | 311 | 	.i2c_adapter_id	= 0, | 
 | 312 | 	.module_name	= "ov96xx", | 
 | 313 | 	.power		= &palmz72_camera_power, | 
 | 314 | 	.reset		= &palmz72_camera_reset, | 
 | 315 | 	.flags		= SOCAM_DATAWIDTH_8, | 
 | 316 | }; | 
 | 317 |  | 
 | 318 | static struct i2c_gpio_platform_data palmz72_i2c_bus_data = { | 
 | 319 | 	.sda_pin	= 118, | 
 | 320 | 	.scl_pin	= 117, | 
 | 321 | 	.udelay		= 10, | 
 | 322 | 	.timeout	= 100, | 
 | 323 | }; | 
 | 324 |  | 
 | 325 | static struct platform_device palmz72_i2c_bus_device = { | 
 | 326 | 	.name		= "i2c-gpio", | 
 | 327 | 	.id		= 0, /* we use this as a replacement for i2c-pxa */ | 
 | 328 | 	.dev		= { | 
 | 329 | 		.platform_data	= &palmz72_i2c_bus_data, | 
 | 330 | 	} | 
 | 331 | }; | 
 | 332 |  | 
 | 333 | static struct platform_device palmz72_camera = { | 
 | 334 | 	.name	= "soc-camera-pdrv", | 
 | 335 | 	.id	= -1, | 
 | 336 | 	.dev	= { | 
 | 337 | 		.platform_data	= &palmz72_iclink, | 
 | 338 | 	}, | 
 | 339 | }; | 
 | 340 |  | 
 | 341 | /* Here we request the camera GPIOs and configure them. We power up the camera | 
 | 342 |  * module, deassert the reset pin, but put it into powerdown (low to no power | 
 | 343 |  * consumption) mode. This allows us to later bring the module up fast. */ | 
 | 344 | static struct gpio palmz72_camera_gpios[] = { | 
 | 345 | 	{ GPIO_NR_PALMZ72_CAM_POWER,	GPIOF_INIT_HIGH,"Camera DVDD" }, | 
 | 346 | 	{ GPIO_NR_PALMZ72_CAM_RESET,	GPIOF_INIT_LOW,	"Camera RESET" }, | 
 | 347 | 	{ GPIO_NR_PALMZ72_CAM_PWDN,	GPIOF_INIT_LOW,	"Camera PWDN" }, | 
 | 348 | }; | 
 | 349 |  | 
 | 350 | static inline void __init palmz72_cam_gpio_init(void) | 
 | 351 | { | 
 | 352 | 	int ret; | 
 | 353 |  | 
 | 354 | 	ret = gpio_request_array(ARRAY_AND_SIZE(palmz72_camera_gpios)); | 
 | 355 | 	if (!ret) | 
 | 356 | 		gpio_free_array(ARRAY_AND_SIZE(palmz72_camera_gpios)); | 
 | 357 | 	else | 
 | 358 | 		printk(KERN_ERR "Camera GPIO init failed!\n"); | 
 | 359 |  | 
 | 360 | 	return; | 
 | 361 | } | 
 | 362 |  | 
 | 363 | static void __init palmz72_camera_init(void) | 
 | 364 | { | 
 | 365 | 	palmz72_cam_gpio_init(); | 
 | 366 | 	pxa_set_camera_info(&palmz72_pxacamera_platform_data); | 
 | 367 | 	platform_device_register(&palmz72_i2c_bus_device); | 
 | 368 | 	platform_device_register(&palmz72_camera); | 
 | 369 | } | 
 | 370 | #else | 
 | 371 | static inline void palmz72_camera_init(void) {} | 
 | 372 | #endif | 
 | 373 |  | 
 | 374 | /****************************************************************************** | 
| Sergey Lapin | c49e1e6 | 2008-08-29 15:47:52 +0100 | [diff] [blame] | 375 |  * Machine init | 
 | 376 |  ******************************************************************************/ | 
| Sergey Lapin | c49e1e6 | 2008-08-29 15:47:52 +0100 | [diff] [blame] | 377 | static void __init palmz72_init(void) | 
 | 378 | { | 
 | 379 | 	pxa2xx_mfp_config(ARRAY_AND_SIZE(palmz72_pin_config)); | 
| Russell King | cc155c6 | 2009-11-09 13:34:08 +0800 | [diff] [blame] | 380 | 	pxa_set_ffuart_info(NULL); | 
 | 381 | 	pxa_set_btuart_info(NULL); | 
 | 382 | 	pxa_set_stuart_info(NULL); | 
 | 383 |  | 
| Marek Vasut | 31620e2 | 2010-07-13 08:16:45 +0200 | [diff] [blame] | 384 | 	palm27x_mmc_init(GPIO_NR_PALMZ72_SD_DETECT_N, GPIO_NR_PALMZ72_SD_RO, | 
 | 385 | 			GPIO_NR_PALMZ72_SD_POWER_N, 1); | 
 | 386 | 	palm27x_lcd_init(-1, &palm_320x320_lcd_mode); | 
 | 387 | 	palm27x_udc_init(GPIO_NR_PALMZ72_USB_DETECT_N, | 
 | 388 | 			GPIO_NR_PALMZ72_USB_PULLUP, 0); | 
 | 389 | 	palm27x_irda_init(GPIO_NR_PALMZ72_IR_DISABLE); | 
 | 390 | 	palm27x_ac97_init(PALMZ72_BAT_MIN_VOLTAGE, PALMZ72_BAT_MAX_VOLTAGE, | 
 | 391 | 			-1, 113); | 
 | 392 | 	palm27x_pwm_init(-1, -1); | 
 | 393 | 	palm27x_power_init(-1, -1); | 
 | 394 | 	palm27x_pmic_init(); | 
 | 395 | 	palmz72_kpc_init(); | 
 | 396 | 	palmz72_leds_init(); | 
| Marek Vasut | 54a93b6 | 2011-01-13 11:45:30 +0100 | [diff] [blame] | 397 | 	palmz72_camera_init(); | 
| Sergey Lapin | c49e1e6 | 2008-08-29 15:47:52 +0100 | [diff] [blame] | 398 | } | 
 | 399 |  | 
 | 400 | MACHINE_START(PALMZ72, "Palm Zire72") | 
| Sergey Lapin | c49e1e6 | 2008-08-29 15:47:52 +0100 | [diff] [blame] | 401 | 	.boot_params	= 0xa0000100, | 
| Marek Vasut | 851982c | 2010-10-11 02:20:19 +0200 | [diff] [blame] | 402 | 	.map_io		= pxa27x_map_io, | 
| Sergey Lapin | c49e1e6 | 2008-08-29 15:47:52 +0100 | [diff] [blame] | 403 | 	.init_irq	= pxa27x_init_irq, | 
 | 404 | 	.timer		= &pxa_timer, | 
 | 405 | 	.init_machine	= palmz72_init | 
 | 406 | MACHINE_END |