Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Support for HTC Magician PDA phones: |
| 3 | * i-mate JAM, O2 Xda mini, Orange SPV M500, Qtek s100, Qtek s110 |
| 4 | * and T-Mobile MDA Compact. |
| 5 | * |
| 6 | * Copyright (c) 2006-2007 Philipp Zabel |
| 7 | * |
| 8 | * Based on hx4700.c, spitz.c and others. |
| 9 | * |
| 10 | * This program is free software; you can redistribute it and/or modify |
| 11 | * it under the terms of the GNU General Public License version 2 as |
| 12 | * published by the Free Software Foundation. |
| 13 | * |
| 14 | */ |
| 15 | |
| 16 | #include <linux/kernel.h> |
| 17 | #include <linux/init.h> |
| 18 | #include <linux/platform_device.h> |
Philipp Zabel | e07ff8d8 | 2008-04-09 19:27:10 +0100 | [diff] [blame] | 19 | #include <linux/delay.h> |
Philipp Zabel | e181191 | 2008-06-22 13:00:55 +0100 | [diff] [blame] | 20 | #include <linux/gpio.h> |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 21 | #include <linux/gpio_keys.h> |
| 22 | #include <linux/input.h> |
Philipp Zabel | 70e357f | 2008-04-09 19:22:57 +0100 | [diff] [blame] | 23 | #include <linux/mfd/htc-egpio.h> |
Philipp Zabel | 81447b2 | 2008-04-12 13:28:02 +0100 | [diff] [blame] | 24 | #include <linux/mfd/htc-pasic3.h> |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 25 | #include <linux/mtd/physmap.h> |
Philipp Zabel | 350d115 | 2008-04-09 19:25:56 +0100 | [diff] [blame] | 26 | #include <linux/pda_power.h> |
Philipp Zabel | 85847a3 | 2008-05-22 14:20:01 +0100 | [diff] [blame] | 27 | #include <linux/pwm_backlight.h> |
Philipp Zabel | eb650b9 | 2009-01-31 12:13:57 +0100 | [diff] [blame] | 28 | #include <linux/regulator/bq24022.h> |
| 29 | #include <linux/regulator/machine.h> |
Philipp Zabel | 6489c61 | 2009-02-01 11:20:30 +0100 | [diff] [blame] | 30 | #include <linux/usb/gpio_vbus.h> |
Sebastian Andrzej Siewior | b459396 | 2011-02-23 12:38:16 +0100 | [diff] [blame] | 31 | #include <linux/i2c/pxa-i2c.h> |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 32 | |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 33 | #include <mach/hardware.h> |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 34 | #include <asm/mach-types.h> |
| 35 | #include <asm/mach/arch.h> |
Eric Miao | 51c6298 | 2009-01-02 23:17:22 +0800 | [diff] [blame] | 36 | |
| 37 | #include <mach/pxa27x.h> |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 38 | #include <mach/magician.h> |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 39 | #include <mach/pxafb.h> |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 40 | #include <mach/mmc.h> |
| 41 | #include <mach/irda.h> |
| 42 | #include <mach/ohci.h> |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 43 | |
Philipp Zabel | 85847a3 | 2008-05-22 14:20:01 +0100 | [diff] [blame] | 44 | #include "devices.h" |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 45 | #include "generic.h" |
| 46 | |
Philipp Zabel | 7a97010 | 2008-06-26 21:03:54 +0100 | [diff] [blame] | 47 | static unsigned long magician_pin_config[] __initdata = { |
Philipp Zabel | b168281 | 2008-04-12 13:29:22 +0100 | [diff] [blame] | 48 | |
| 49 | /* SDRAM and Static Memory I/O Signals */ |
| 50 | GPIO20_nSDCS_2, |
| 51 | GPIO21_nSDCS_3, |
| 52 | GPIO15_nCS_1, |
| 53 | GPIO78_nCS_2, /* PASIC3 */ |
| 54 | GPIO79_nCS_3, /* EGPIO CPLD */ |
| 55 | GPIO80_nCS_4, |
| 56 | GPIO33_nCS_5, |
| 57 | |
| 58 | /* I2C */ |
| 59 | GPIO117_I2C_SCL, |
| 60 | GPIO118_I2C_SDA, |
| 61 | |
| 62 | /* PWM 0 */ |
| 63 | GPIO16_PWM0_OUT, |
| 64 | |
| 65 | /* I2S */ |
| 66 | GPIO28_I2S_BITCLK_OUT, |
| 67 | GPIO29_I2S_SDATA_IN, |
| 68 | GPIO31_I2S_SYNC, |
| 69 | GPIO113_I2S_SYSCLK, |
| 70 | |
Philipp Zabel | 16c3ea4 | 2009-01-17 18:45:41 +0100 | [diff] [blame] | 71 | /* SSP 1 */ |
| 72 | GPIO23_SSP1_SCLK, |
| 73 | GPIO24_SSP1_SFRM, |
| 74 | GPIO25_SSP1_TXD, |
| 75 | |
Philipp Zabel | b168281 | 2008-04-12 13:29:22 +0100 | [diff] [blame] | 76 | /* SSP 2 */ |
| 77 | GPIO19_SSP2_SCLK, |
| 78 | GPIO14_SSP2_SFRM, |
| 79 | GPIO89_SSP2_TXD, |
| 80 | GPIO88_SSP2_RXD, |
| 81 | |
| 82 | /* MMC */ |
| 83 | GPIO32_MMC_CLK, |
| 84 | GPIO92_MMC_DAT_0, |
| 85 | GPIO109_MMC_DAT_1, |
| 86 | GPIO110_MMC_DAT_2, |
| 87 | GPIO111_MMC_DAT_3, |
| 88 | GPIO112_MMC_CMD, |
| 89 | |
| 90 | /* LCD */ |
Eric Miao | bedbda9 | 2010-01-04 11:37:14 +0800 | [diff] [blame] | 91 | GPIOxx_LCD_TFT_16BPP, |
Philipp Zabel | b168281 | 2008-04-12 13:29:22 +0100 | [diff] [blame] | 92 | |
| 93 | /* QCI */ |
| 94 | GPIO12_CIF_DD_7, |
| 95 | GPIO17_CIF_DD_6, |
| 96 | GPIO50_CIF_DD_3, |
| 97 | GPIO51_CIF_DD_2, |
| 98 | GPIO52_CIF_DD_4, |
| 99 | GPIO53_CIF_MCLK, |
| 100 | GPIO54_CIF_PCLK, |
| 101 | GPIO55_CIF_DD_1, |
| 102 | GPIO81_CIF_DD_0, |
| 103 | GPIO82_CIF_DD_5, |
| 104 | GPIO84_CIF_FV, |
| 105 | GPIO85_CIF_LV, |
Philipp Zabel | 2f13195 | 2008-04-20 17:40:11 +0100 | [diff] [blame] | 106 | |
| 107 | /* Magician specific input GPIOs */ |
| 108 | GPIO9_GPIO, /* unknown */ |
| 109 | GPIO10_GPIO, /* GSM_IRQ */ |
| 110 | GPIO13_GPIO, /* CPLD_IRQ */ |
| 111 | GPIO107_GPIO, /* DS1WM_IRQ */ |
| 112 | GPIO108_GPIO, /* GSM_READY */ |
| 113 | GPIO115_GPIO, /* nPEN_IRQ */ |
Eric Miao | 6f584cf | 2008-11-28 16:00:24 +0800 | [diff] [blame] | 114 | |
| 115 | /* I2C */ |
| 116 | GPIO117_I2C_SCL, |
| 117 | GPIO118_I2C_SDA, |
Philipp Zabel | b168281 | 2008-04-12 13:29:22 +0100 | [diff] [blame] | 118 | }; |
| 119 | |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 120 | /* |
| 121 | * IRDA |
| 122 | */ |
| 123 | |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 124 | static struct pxaficp_platform_data magician_ficp_info = { |
Marek Vasut | c4bd017 | 2009-07-17 12:50:43 +0200 | [diff] [blame] | 125 | .gpio_pwdown = GPIO83_MAGICIAN_nIR_EN, |
| 126 | .transceiver_cap = IR_SIRMODE | IR_OFF, |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 127 | }; |
| 128 | |
| 129 | /* |
| 130 | * GPIO Keys |
| 131 | */ |
| 132 | |
Philipp Zabel | 51c10bb | 2009-01-17 18:45:44 +0100 | [diff] [blame] | 133 | #define INIT_KEY(_code, _gpio, _desc) \ |
| 134 | { \ |
| 135 | .code = KEY_##_code, \ |
| 136 | .gpio = _gpio, \ |
| 137 | .desc = _desc, \ |
| 138 | .type = EV_KEY, \ |
| 139 | .wakeup = 1, \ |
| 140 | } |
| 141 | |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 142 | static struct gpio_keys_button magician_button_table[] = { |
Philipp Zabel | 51c10bb | 2009-01-17 18:45:44 +0100 | [diff] [blame] | 143 | INIT_KEY(POWER, GPIO0_MAGICIAN_KEY_POWER, "Power button"), |
| 144 | INIT_KEY(ESC, GPIO37_MAGICIAN_KEY_HANGUP, "Hangup button"), |
| 145 | INIT_KEY(F10, GPIO38_MAGICIAN_KEY_CONTACTS, "Contacts button"), |
| 146 | INIT_KEY(CALENDAR, GPIO90_MAGICIAN_KEY_CALENDAR, "Calendar button"), |
| 147 | INIT_KEY(CAMERA, GPIO91_MAGICIAN_KEY_CAMERA, "Camera button"), |
| 148 | INIT_KEY(UP, GPIO93_MAGICIAN_KEY_UP, "Up button"), |
| 149 | INIT_KEY(DOWN, GPIO94_MAGICIAN_KEY_DOWN, "Down button"), |
| 150 | INIT_KEY(LEFT, GPIO95_MAGICIAN_KEY_LEFT, "Left button"), |
| 151 | INIT_KEY(RIGHT, GPIO96_MAGICIAN_KEY_RIGHT, "Right button"), |
| 152 | INIT_KEY(KPENTER, GPIO97_MAGICIAN_KEY_ENTER, "Action button"), |
| 153 | INIT_KEY(RECORD, GPIO98_MAGICIAN_KEY_RECORD, "Record button"), |
| 154 | INIT_KEY(VOLUMEUP, GPIO100_MAGICIAN_KEY_VOL_UP, "Volume up"), |
| 155 | INIT_KEY(VOLUMEDOWN, GPIO101_MAGICIAN_KEY_VOL_DOWN, "Volume down"), |
| 156 | INIT_KEY(PHONE, GPIO102_MAGICIAN_KEY_PHONE, "Phone button"), |
| 157 | INIT_KEY(PLAY, GPIO99_MAGICIAN_HEADPHONE_IN, "Headset button"), |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 158 | }; |
| 159 | |
| 160 | static struct gpio_keys_platform_data gpio_keys_data = { |
| 161 | .buttons = magician_button_table, |
| 162 | .nbuttons = ARRAY_SIZE(magician_button_table), |
| 163 | }; |
| 164 | |
| 165 | static struct platform_device gpio_keys = { |
| 166 | .name = "gpio-keys", |
| 167 | .dev = { |
| 168 | .platform_data = &gpio_keys_data, |
| 169 | }, |
| 170 | .id = -1, |
| 171 | }; |
| 172 | |
Philipp Zabel | 70e357f | 2008-04-09 19:22:57 +0100 | [diff] [blame] | 173 | |
| 174 | /* |
| 175 | * EGPIO (Xilinx CPLD) |
| 176 | * |
| 177 | * 7 32-bit aligned 8-bit registers: 3x output, 1x irq, 3x input |
| 178 | */ |
| 179 | |
| 180 | static struct resource egpio_resources[] = { |
| 181 | [0] = { |
| 182 | .start = PXA_CS3_PHYS, |
Philipp Zabel | 2380461 | 2009-02-09 17:34:05 +0100 | [diff] [blame] | 183 | .end = PXA_CS3_PHYS + 0x20 - 1, |
Philipp Zabel | 70e357f | 2008-04-09 19:22:57 +0100 | [diff] [blame] | 184 | .flags = IORESOURCE_MEM, |
| 185 | }, |
| 186 | [1] = { |
| 187 | .start = gpio_to_irq(GPIO13_MAGICIAN_CPLD_IRQ), |
| 188 | .end = gpio_to_irq(GPIO13_MAGICIAN_CPLD_IRQ), |
| 189 | .flags = IORESOURCE_IRQ, |
| 190 | }, |
| 191 | }; |
| 192 | |
| 193 | static struct htc_egpio_chip egpio_chips[] = { |
| 194 | [0] = { |
| 195 | .reg_start = 0, |
| 196 | .gpio_base = MAGICIAN_EGPIO(0, 0), |
| 197 | .num_gpios = 24, |
| 198 | .direction = HTC_EGPIO_OUTPUT, |
| 199 | .initial_values = 0x40, /* EGPIO_MAGICIAN_GSM_RESET */ |
| 200 | }, |
| 201 | [1] = { |
| 202 | .reg_start = 4, |
| 203 | .gpio_base = MAGICIAN_EGPIO(4, 0), |
| 204 | .num_gpios = 24, |
| 205 | .direction = HTC_EGPIO_INPUT, |
| 206 | }, |
| 207 | }; |
| 208 | |
| 209 | static struct htc_egpio_platform_data egpio_info = { |
| 210 | .reg_width = 8, |
| 211 | .bus_width = 32, |
| 212 | .irq_base = IRQ_BOARD_START, |
| 213 | .num_irqs = 4, |
| 214 | .ack_register = 3, |
| 215 | .chip = egpio_chips, |
| 216 | .num_chips = ARRAY_SIZE(egpio_chips), |
| 217 | }; |
| 218 | |
| 219 | static struct platform_device egpio = { |
| 220 | .name = "htc-egpio", |
| 221 | .id = -1, |
| 222 | .resource = egpio_resources, |
| 223 | .num_resources = ARRAY_SIZE(egpio_resources), |
| 224 | .dev = { |
| 225 | .platform_data = &egpio_info, |
| 226 | }, |
| 227 | }; |
| 228 | |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 229 | /* |
Philipp Zabel | e07ff8d8 | 2008-04-09 19:27:10 +0100 | [diff] [blame] | 230 | * LCD - Toppoly TD028STEB1 or Samsung LTP280QV |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 231 | */ |
| 232 | |
| 233 | static struct pxafb_mode_info toppoly_modes[] = { |
| 234 | { |
| 235 | .pixclock = 96153, |
| 236 | .bpp = 16, |
| 237 | .xres = 240, |
| 238 | .yres = 320, |
| 239 | .hsync_len = 11, |
| 240 | .vsync_len = 3, |
| 241 | .left_margin = 19, |
| 242 | .upper_margin = 2, |
| 243 | .right_margin = 10, |
| 244 | .lower_margin = 2, |
| 245 | .sync = 0, |
| 246 | }, |
| 247 | }; |
| 248 | |
Philipp Zabel | e07ff8d8 | 2008-04-09 19:27:10 +0100 | [diff] [blame] | 249 | static struct pxafb_mode_info samsung_modes[] = { |
| 250 | { |
| 251 | .pixclock = 96153, |
| 252 | .bpp = 16, |
| 253 | .xres = 240, |
| 254 | .yres = 320, |
| 255 | .hsync_len = 8, |
| 256 | .vsync_len = 4, |
| 257 | .left_margin = 9, |
| 258 | .upper_margin = 4, |
| 259 | .right_margin = 9, |
| 260 | .lower_margin = 4, |
| 261 | .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, |
| 262 | }, |
| 263 | }; |
| 264 | |
| 265 | static void toppoly_lcd_power(int on, struct fb_var_screeninfo *si) |
| 266 | { |
| 267 | pr_debug("Toppoly LCD power\n"); |
| 268 | |
| 269 | if (on) { |
| 270 | pr_debug("on\n"); |
| 271 | gpio_set_value(EGPIO_MAGICIAN_TOPPOLY_POWER, 1); |
| 272 | gpio_set_value(GPIO106_MAGICIAN_LCD_POWER_3, 1); |
| 273 | udelay(2000); |
| 274 | gpio_set_value(EGPIO_MAGICIAN_LCD_POWER, 1); |
| 275 | udelay(2000); |
| 276 | /* FIXME: enable LCDC here */ |
| 277 | udelay(2000); |
| 278 | gpio_set_value(GPIO104_MAGICIAN_LCD_POWER_1, 1); |
| 279 | udelay(2000); |
| 280 | gpio_set_value(GPIO105_MAGICIAN_LCD_POWER_2, 1); |
| 281 | } else { |
| 282 | pr_debug("off\n"); |
| 283 | msleep(15); |
| 284 | gpio_set_value(GPIO105_MAGICIAN_LCD_POWER_2, 0); |
| 285 | udelay(500); |
| 286 | gpio_set_value(GPIO104_MAGICIAN_LCD_POWER_1, 0); |
| 287 | udelay(1000); |
| 288 | gpio_set_value(GPIO106_MAGICIAN_LCD_POWER_3, 0); |
| 289 | gpio_set_value(EGPIO_MAGICIAN_LCD_POWER, 0); |
| 290 | } |
| 291 | } |
| 292 | |
| 293 | static void samsung_lcd_power(int on, struct fb_var_screeninfo *si) |
| 294 | { |
| 295 | pr_debug("Samsung LCD power\n"); |
| 296 | |
| 297 | if (on) { |
| 298 | pr_debug("on\n"); |
| 299 | if (system_rev < 3) |
| 300 | gpio_set_value(GPIO75_MAGICIAN_SAMSUNG_POWER, 1); |
| 301 | else |
| 302 | gpio_set_value(EGPIO_MAGICIAN_LCD_POWER, 1); |
| 303 | mdelay(10); |
| 304 | gpio_set_value(GPIO106_MAGICIAN_LCD_POWER_3, 1); |
| 305 | mdelay(10); |
| 306 | gpio_set_value(GPIO104_MAGICIAN_LCD_POWER_1, 1); |
| 307 | mdelay(30); |
| 308 | gpio_set_value(GPIO105_MAGICIAN_LCD_POWER_2, 1); |
| 309 | mdelay(10); |
| 310 | } else { |
| 311 | pr_debug("off\n"); |
| 312 | mdelay(10); |
| 313 | gpio_set_value(GPIO105_MAGICIAN_LCD_POWER_2, 0); |
| 314 | mdelay(30); |
| 315 | gpio_set_value(GPIO104_MAGICIAN_LCD_POWER_1, 0); |
| 316 | mdelay(10); |
| 317 | gpio_set_value(GPIO106_MAGICIAN_LCD_POWER_3, 0); |
| 318 | mdelay(10); |
| 319 | if (system_rev < 3) |
| 320 | gpio_set_value(GPIO75_MAGICIAN_SAMSUNG_POWER, 0); |
| 321 | else |
| 322 | gpio_set_value(EGPIO_MAGICIAN_LCD_POWER, 0); |
| 323 | } |
| 324 | } |
| 325 | |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 326 | static struct pxafb_mach_info toppoly_info = { |
Philipp Zabel | e07ff8d8 | 2008-04-09 19:27:10 +0100 | [diff] [blame] | 327 | .modes = toppoly_modes, |
| 328 | .num_modes = 1, |
| 329 | .fixed_modes = 1, |
Eric Miao | 9587319 | 2008-12-07 17:49:01 +0800 | [diff] [blame] | 330 | .lcd_conn = LCD_COLOR_TFT_16BPP, |
Philipp Zabel | e07ff8d8 | 2008-04-09 19:27:10 +0100 | [diff] [blame] | 331 | .pxafb_lcd_power = toppoly_lcd_power, |
| 332 | }; |
| 333 | |
| 334 | static struct pxafb_mach_info samsung_info = { |
| 335 | .modes = samsung_modes, |
| 336 | .num_modes = 1, |
| 337 | .fixed_modes = 1, |
Eric Miao | 9587319 | 2008-12-07 17:49:01 +0800 | [diff] [blame] | 338 | .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL |\ |
| 339 | LCD_ALTERNATE_MAPPING, |
Philipp Zabel | e07ff8d8 | 2008-04-09 19:27:10 +0100 | [diff] [blame] | 340 | .pxafb_lcd_power = samsung_lcd_power, |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 341 | }; |
| 342 | |
| 343 | /* |
| 344 | * Backlight |
| 345 | */ |
| 346 | |
Philipp Zabel | 85847a3 | 2008-05-22 14:20:01 +0100 | [diff] [blame] | 347 | static int magician_backlight_init(struct device *dev) |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 348 | { |
Philipp Zabel | 85847a3 | 2008-05-22 14:20:01 +0100 | [diff] [blame] | 349 | int ret; |
| 350 | |
| 351 | ret = gpio_request(EGPIO_MAGICIAN_BL_POWER, "BL_POWER"); |
| 352 | if (ret) |
| 353 | goto err; |
| 354 | ret = gpio_request(EGPIO_MAGICIAN_BL_POWER2, "BL_POWER2"); |
| 355 | if (ret) |
| 356 | goto err2; |
| 357 | return 0; |
| 358 | |
| 359 | err2: |
| 360 | gpio_free(EGPIO_MAGICIAN_BL_POWER); |
| 361 | err: |
| 362 | return ret; |
| 363 | } |
| 364 | |
Eric Miao | 2d51a52 | 2010-01-04 11:42:01 +0800 | [diff] [blame] | 365 | static int magician_backlight_notify(struct device *dev, int brightness) |
Philipp Zabel | 85847a3 | 2008-05-22 14:20:01 +0100 | [diff] [blame] | 366 | { |
| 367 | gpio_set_value(EGPIO_MAGICIAN_BL_POWER, brightness); |
| 368 | if (brightness >= 200) { |
| 369 | gpio_set_value(EGPIO_MAGICIAN_BL_POWER2, 1); |
| 370 | return brightness - 72; |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 371 | } else { |
Philipp Zabel | 85847a3 | 2008-05-22 14:20:01 +0100 | [diff] [blame] | 372 | gpio_set_value(EGPIO_MAGICIAN_BL_POWER2, 0); |
| 373 | return brightness; |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 374 | } |
| 375 | } |
| 376 | |
Philipp Zabel | 85847a3 | 2008-05-22 14:20:01 +0100 | [diff] [blame] | 377 | static void magician_backlight_exit(struct device *dev) |
| 378 | { |
| 379 | gpio_free(EGPIO_MAGICIAN_BL_POWER); |
| 380 | gpio_free(EGPIO_MAGICIAN_BL_POWER2); |
| 381 | } |
| 382 | |
| 383 | static struct platform_pwm_backlight_data backlight_data = { |
| 384 | .pwm_id = 0, |
| 385 | .max_brightness = 272, |
| 386 | .dft_brightness = 100, |
| 387 | .pwm_period_ns = 30923, |
| 388 | .init = magician_backlight_init, |
| 389 | .notify = magician_backlight_notify, |
| 390 | .exit = magician_backlight_exit, |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 391 | }; |
| 392 | |
| 393 | static struct platform_device backlight = { |
Philipp Zabel | 85847a3 | 2008-05-22 14:20:01 +0100 | [diff] [blame] | 394 | .name = "pwm-backlight", |
Philipp Zabel | 14d1012 | 2008-06-30 18:11:55 +0100 | [diff] [blame] | 395 | .id = -1, |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 396 | .dev = { |
Philipp Zabel | 85847a3 | 2008-05-22 14:20:01 +0100 | [diff] [blame] | 397 | .parent = &pxa27x_device_pwm0.dev, |
| 398 | .platform_data = &backlight_data, |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 399 | }, |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 400 | }; |
| 401 | |
Philipp Zabel | 81447b2 | 2008-04-12 13:28:02 +0100 | [diff] [blame] | 402 | /* |
| 403 | * LEDs |
| 404 | */ |
| 405 | |
Russell King | a55faca | 2008-09-25 14:35:48 +0100 | [diff] [blame] | 406 | static struct gpio_led gpio_leds[] = { |
Philipp Zabel | 81447b2 | 2008-04-12 13:28:02 +0100 | [diff] [blame] | 407 | { |
| 408 | .name = "magician::vibra", |
| 409 | .default_trigger = "none", |
| 410 | .gpio = GPIO22_MAGICIAN_VIBRA_EN, |
| 411 | }, |
| 412 | { |
| 413 | .name = "magician::phone_bl", |
Philipp Zabel | 05199ec | 2009-02-09 17:34:08 +0100 | [diff] [blame] | 414 | .default_trigger = "backlight", |
Philipp Zabel | 81447b2 | 2008-04-12 13:28:02 +0100 | [diff] [blame] | 415 | .gpio = GPIO103_MAGICIAN_LED_KP, |
| 416 | }, |
| 417 | }; |
| 418 | |
| 419 | static struct gpio_led_platform_data gpio_led_info = { |
| 420 | .leds = gpio_leds, |
| 421 | .num_leds = ARRAY_SIZE(gpio_leds), |
| 422 | }; |
| 423 | |
| 424 | static struct platform_device leds_gpio = { |
| 425 | .name = "leds-gpio", |
| 426 | .id = -1, |
| 427 | .dev = { |
| 428 | .platform_data = &gpio_led_info, |
| 429 | }, |
| 430 | }; |
| 431 | |
| 432 | static struct pasic3_led pasic3_leds[] = { |
| 433 | { |
| 434 | .led = { |
| 435 | .name = "magician:red", |
| 436 | .default_trigger = "ds2760-battery.0-charging", |
| 437 | }, |
| 438 | .hw_num = 0, |
| 439 | .bit2 = PASIC3_BIT2_LED0, |
| 440 | .mask = PASIC3_MASK_LED0, |
| 441 | }, |
| 442 | { |
| 443 | .led = { |
| 444 | .name = "magician:green", |
| 445 | .default_trigger = "ds2760-battery.0-charging-or-full", |
| 446 | }, |
| 447 | .hw_num = 1, |
| 448 | .bit2 = PASIC3_BIT2_LED1, |
| 449 | .mask = PASIC3_MASK_LED1, |
| 450 | }, |
| 451 | { |
| 452 | .led = { |
| 453 | .name = "magician:blue", |
| 454 | .default_trigger = "bluetooth", |
| 455 | }, |
| 456 | .hw_num = 2, |
| 457 | .bit2 = PASIC3_BIT2_LED2, |
| 458 | .mask = PASIC3_MASK_LED2, |
| 459 | }, |
| 460 | }; |
| 461 | |
Philipp Zabel | e03e059 | 2008-04-24 18:10:46 +0100 | [diff] [blame] | 462 | static struct pasic3_leds_machinfo pasic3_leds_info = { |
Philipp Zabel | 81447b2 | 2008-04-12 13:28:02 +0100 | [diff] [blame] | 463 | .num_leds = ARRAY_SIZE(pasic3_leds), |
| 464 | .power_gpio = EGPIO_MAGICIAN_LED_POWER, |
| 465 | .leds = pasic3_leds, |
| 466 | }; |
| 467 | |
| 468 | /* |
| 469 | * PASIC3 with DS1WM |
| 470 | */ |
| 471 | |
| 472 | static struct resource pasic3_resources[] = { |
| 473 | [0] = { |
| 474 | .start = PXA_CS2_PHYS, |
| 475 | .end = PXA_CS2_PHYS + 0x1b, |
| 476 | .flags = IORESOURCE_MEM, |
| 477 | }, |
| 478 | /* No IRQ handler in the PASIC3, DS1WM needs an external IRQ */ |
| 479 | [1] = { |
| 480 | .start = gpio_to_irq(GPIO107_MAGICIAN_DS1WM_IRQ), |
| 481 | .end = gpio_to_irq(GPIO107_MAGICIAN_DS1WM_IRQ), |
| 482 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE, |
| 483 | } |
| 484 | }; |
| 485 | |
| 486 | static struct pasic3_platform_data pasic3_platform_data = { |
Philipp Zabel | 81447b2 | 2008-04-12 13:28:02 +0100 | [diff] [blame] | 487 | .led_pdata = &pasic3_leds_info, |
| 488 | .clock_rate = 4000000, |
| 489 | }; |
| 490 | |
| 491 | static struct platform_device pasic3 = { |
| 492 | .name = "pasic3", |
| 493 | .id = -1, |
| 494 | .num_resources = ARRAY_SIZE(pasic3_resources), |
| 495 | .resource = pasic3_resources, |
| 496 | .dev = { |
| 497 | .platform_data = &pasic3_platform_data, |
| 498 | }, |
| 499 | }; |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 500 | |
| 501 | /* |
Philipp Zabel | 6489c61 | 2009-02-01 11:20:30 +0100 | [diff] [blame] | 502 | * USB "Transceiver" |
| 503 | */ |
| 504 | |
| 505 | static struct resource gpio_vbus_resource = { |
| 506 | .flags = IORESOURCE_IRQ, |
| 507 | .start = IRQ_MAGICIAN_VBUS, |
| 508 | .end = IRQ_MAGICIAN_VBUS, |
| 509 | }; |
| 510 | |
| 511 | static struct gpio_vbus_mach_info gpio_vbus_info = { |
| 512 | .gpio_pullup = GPIO27_MAGICIAN_USBC_PUEN, |
| 513 | .gpio_vbus = EGPIO_MAGICIAN_CABLE_STATE_USB, |
| 514 | }; |
| 515 | |
| 516 | static struct platform_device gpio_vbus = { |
| 517 | .name = "gpio-vbus", |
| 518 | .id = -1, |
| 519 | .num_resources = 1, |
| 520 | .resource = &gpio_vbus_resource, |
| 521 | .dev = { |
| 522 | .platform_data = &gpio_vbus_info, |
| 523 | }, |
| 524 | }; |
| 525 | |
| 526 | /* |
Philipp Zabel | 350d115 | 2008-04-09 19:25:56 +0100 | [diff] [blame] | 527 | * External power |
| 528 | */ |
| 529 | |
Philipp Zabel | ff27920 | 2008-05-22 10:14:21 +0100 | [diff] [blame] | 530 | static int power_supply_init(struct device *dev) |
| 531 | { |
Philipp Zabel | eb650b9 | 2009-01-31 12:13:57 +0100 | [diff] [blame] | 532 | return gpio_request(EGPIO_MAGICIAN_CABLE_STATE_AC, "CABLE_STATE_AC"); |
Philipp Zabel | ff27920 | 2008-05-22 10:14:21 +0100 | [diff] [blame] | 533 | } |
| 534 | |
Philipp Zabel | 350d115 | 2008-04-09 19:25:56 +0100 | [diff] [blame] | 535 | static int magician_is_ac_online(void) |
| 536 | { |
| 537 | return gpio_get_value(EGPIO_MAGICIAN_CABLE_STATE_AC); |
| 538 | } |
| 539 | |
Philipp Zabel | ff27920 | 2008-05-22 10:14:21 +0100 | [diff] [blame] | 540 | static void power_supply_exit(struct device *dev) |
| 541 | { |
Philipp Zabel | ff27920 | 2008-05-22 10:14:21 +0100 | [diff] [blame] | 542 | gpio_free(EGPIO_MAGICIAN_CABLE_STATE_AC); |
| 543 | } |
| 544 | |
Philipp Zabel | 81447b2 | 2008-04-12 13:28:02 +0100 | [diff] [blame] | 545 | static char *magician_supplicants[] = { |
| 546 | "ds2760-battery.0", "backup-battery" |
| 547 | }; |
| 548 | |
Philipp Zabel | 350d115 | 2008-04-09 19:25:56 +0100 | [diff] [blame] | 549 | static struct pda_power_pdata power_supply_info = { |
Philipp Zabel | ff27920 | 2008-05-22 10:14:21 +0100 | [diff] [blame] | 550 | .init = power_supply_init, |
Philipp Zabel | 81447b2 | 2008-04-12 13:28:02 +0100 | [diff] [blame] | 551 | .is_ac_online = magician_is_ac_online, |
Philipp Zabel | ff27920 | 2008-05-22 10:14:21 +0100 | [diff] [blame] | 552 | .exit = power_supply_exit, |
Philipp Zabel | 81447b2 | 2008-04-12 13:28:02 +0100 | [diff] [blame] | 553 | .supplied_to = magician_supplicants, |
| 554 | .num_supplicants = ARRAY_SIZE(magician_supplicants), |
Philipp Zabel | 350d115 | 2008-04-09 19:25:56 +0100 | [diff] [blame] | 555 | }; |
| 556 | |
| 557 | static struct resource power_supply_resources[] = { |
| 558 | [0] = { |
| 559 | .name = "ac", |
Philipp Zabel | d942d77 | 2009-02-09 17:34:07 +0100 | [diff] [blame] | 560 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE | |
| 561 | IORESOURCE_IRQ_LOWEDGE, |
Philipp Zabel | 6489c61 | 2009-02-01 11:20:30 +0100 | [diff] [blame] | 562 | .start = IRQ_MAGICIAN_VBUS, |
| 563 | .end = IRQ_MAGICIAN_VBUS, |
Philipp Zabel | 350d115 | 2008-04-09 19:25:56 +0100 | [diff] [blame] | 564 | }, |
| 565 | [1] = { |
| 566 | .name = "usb", |
Philipp Zabel | d942d77 | 2009-02-09 17:34:07 +0100 | [diff] [blame] | 567 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE | |
| 568 | IORESOURCE_IRQ_LOWEDGE, |
Philipp Zabel | 6489c61 | 2009-02-01 11:20:30 +0100 | [diff] [blame] | 569 | .start = IRQ_MAGICIAN_VBUS, |
| 570 | .end = IRQ_MAGICIAN_VBUS, |
Philipp Zabel | 350d115 | 2008-04-09 19:25:56 +0100 | [diff] [blame] | 571 | }, |
| 572 | }; |
| 573 | |
| 574 | static struct platform_device power_supply = { |
| 575 | .name = "pda-power", |
| 576 | .id = -1, |
| 577 | .dev = { |
| 578 | .platform_data = &power_supply_info, |
| 579 | }, |
| 580 | .resource = power_supply_resources, |
| 581 | .num_resources = ARRAY_SIZE(power_supply_resources), |
| 582 | }; |
| 583 | |
Philipp Zabel | eb650b9 | 2009-01-31 12:13:57 +0100 | [diff] [blame] | 584 | /* |
| 585 | * Battery charger |
| 586 | */ |
| 587 | |
| 588 | static struct regulator_consumer_supply bq24022_consumers[] = { |
| 589 | { |
| 590 | .dev = &gpio_vbus.dev, |
| 591 | .supply = "vbus_draw", |
| 592 | }, |
| 593 | { |
| 594 | .dev = &power_supply.dev, |
| 595 | .supply = "ac_draw", |
| 596 | }, |
| 597 | }; |
| 598 | |
| 599 | static struct regulator_init_data bq24022_init_data = { |
| 600 | .constraints = { |
| 601 | .max_uA = 500000, |
Philipp Zabel | e454d16 | 2011-04-20 15:41:29 +0200 | [diff] [blame] | 602 | .valid_ops_mask = REGULATOR_CHANGE_CURRENT | REGULATOR_CHANGE_STATUS, |
Philipp Zabel | eb650b9 | 2009-01-31 12:13:57 +0100 | [diff] [blame] | 603 | }, |
| 604 | .num_consumer_supplies = ARRAY_SIZE(bq24022_consumers), |
| 605 | .consumer_supplies = bq24022_consumers, |
| 606 | }; |
| 607 | |
| 608 | static struct bq24022_mach_info bq24022_info = { |
| 609 | .gpio_nce = GPIO30_MAGICIAN_BQ24022_nCHARGE_EN, |
| 610 | .gpio_iset2 = EGPIO_MAGICIAN_BQ24022_ISET2, |
| 611 | .init_data = &bq24022_init_data, |
| 612 | }; |
| 613 | |
| 614 | static struct platform_device bq24022 = { |
| 615 | .name = "bq24022", |
| 616 | .id = -1, |
| 617 | .dev = { |
| 618 | .platform_data = &bq24022_info, |
| 619 | }, |
| 620 | }; |
Philipp Zabel | 350d115 | 2008-04-09 19:25:56 +0100 | [diff] [blame] | 621 | |
| 622 | /* |
Philipp Zabel | bdb0c16 | 2008-04-09 19:24:55 +0100 | [diff] [blame] | 623 | * MMC/SD |
| 624 | */ |
| 625 | |
| 626 | static int magician_mci_init(struct device *dev, |
| 627 | irq_handler_t detect_irq, void *data) |
| 628 | { |
Robert Jarzmik | 7a64825 | 2009-07-06 22:16:42 +0200 | [diff] [blame] | 629 | return request_irq(IRQ_MAGICIAN_SD, detect_irq, |
Philipp Zabel | bdb0c16 | 2008-04-09 19:24:55 +0100 | [diff] [blame] | 630 | IRQF_DISABLED | IRQF_SAMPLE_RANDOM, |
Robert Jarzmik | 7a64825 | 2009-07-06 22:16:42 +0200 | [diff] [blame] | 631 | "mmc card detect", data); |
Philipp Zabel | bdb0c16 | 2008-04-09 19:24:55 +0100 | [diff] [blame] | 632 | } |
| 633 | |
| 634 | static void magician_mci_exit(struct device *dev, void *data) |
| 635 | { |
| 636 | free_irq(IRQ_MAGICIAN_SD, data); |
| 637 | } |
| 638 | |
| 639 | static struct pxamci_platform_data magician_mci_info = { |
Robert Jarzmik | 7a64825 | 2009-07-06 22:16:42 +0200 | [diff] [blame] | 640 | .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, |
| 641 | .init = magician_mci_init, |
| 642 | .exit = magician_mci_exit, |
| 643 | .gpio_card_detect = -1, |
| 644 | .gpio_card_ro = EGPIO_MAGICIAN_nSD_READONLY, |
| 645 | .gpio_card_ro_invert = 1, |
| 646 | .gpio_power = EGPIO_MAGICIAN_SD_POWER, |
Philipp Zabel | bdb0c16 | 2008-04-09 19:24:55 +0100 | [diff] [blame] | 647 | }; |
| 648 | |
| 649 | |
| 650 | /* |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 651 | * USB OHCI |
| 652 | */ |
| 653 | |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 654 | static struct pxaohci_platform_data magician_ohci_info = { |
Eric Miao | 097b533 | 2008-09-27 15:49:57 +0800 | [diff] [blame] | 655 | .port_mode = PMM_PERPORT_MODE, |
| 656 | .flags = ENABLE_PORT1 | ENABLE_PORT3 | POWER_CONTROL_LOW, |
| 657 | .power_budget = 0, |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 658 | }; |
| 659 | |
| 660 | |
| 661 | /* |
| 662 | * StrataFlash |
| 663 | */ |
| 664 | |
Marc Zyngier | 667f390 | 2011-05-18 10:51:55 +0100 | [diff] [blame] | 665 | static void magician_set_vpp(struct platform_device *pdev, int vpp) |
Philipp Zabel | aa79759 | 2008-04-09 19:24:05 +0100 | [diff] [blame] | 666 | { |
| 667 | gpio_set_value(EGPIO_MAGICIAN_FLASH_VPP, vpp); |
| 668 | } |
| 669 | |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 670 | static struct resource strataflash_resource = { |
| 671 | .start = PXA_CS0_PHYS, |
Philipp Zabel | fcb78d1 | 2009-01-17 18:45:43 +0100 | [diff] [blame] | 672 | .end = PXA_CS0_PHYS + SZ_64M - 1, |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 673 | .flags = IORESOURCE_MEM, |
| 674 | }; |
| 675 | |
| 676 | static struct physmap_flash_data strataflash_data = { |
| 677 | .width = 4, |
Philipp Zabel | aa79759 | 2008-04-09 19:24:05 +0100 | [diff] [blame] | 678 | .set_vpp = magician_set_vpp, |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 679 | }; |
| 680 | |
| 681 | static struct platform_device strataflash = { |
| 682 | .name = "physmap-flash", |
| 683 | .id = -1, |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 684 | .resource = &strataflash_resource, |
Philipp Zabel | 70e357f | 2008-04-09 19:22:57 +0100 | [diff] [blame] | 685 | .num_resources = 1, |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 686 | .dev = { |
| 687 | .platform_data = &strataflash_data, |
| 688 | }, |
| 689 | }; |
| 690 | |
| 691 | /* |
Philipp Zabel | f8f9d5e | 2009-04-17 11:38:23 +0200 | [diff] [blame] | 692 | * I2C |
| 693 | */ |
| 694 | |
| 695 | static struct i2c_pxa_platform_data i2c_info = { |
| 696 | .fast_mode = 1, |
| 697 | }; |
| 698 | |
| 699 | /* |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 700 | * Platform devices |
| 701 | */ |
| 702 | |
| 703 | static struct platform_device *devices[] __initdata = { |
| 704 | &gpio_keys, |
Philipp Zabel | 70e357f | 2008-04-09 19:22:57 +0100 | [diff] [blame] | 705 | &egpio, |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 706 | &backlight, |
Philipp Zabel | 81447b2 | 2008-04-12 13:28:02 +0100 | [diff] [blame] | 707 | &pasic3, |
Philipp Zabel | eb650b9 | 2009-01-31 12:13:57 +0100 | [diff] [blame] | 708 | &bq24022, |
Philipp Zabel | 6489c61 | 2009-02-01 11:20:30 +0100 | [diff] [blame] | 709 | &gpio_vbus, |
Philipp Zabel | 350d115 | 2008-04-09 19:25:56 +0100 | [diff] [blame] | 710 | &power_supply, |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 711 | &strataflash, |
Philipp Zabel | 81447b2 | 2008-04-12 13:28:02 +0100 | [diff] [blame] | 712 | &leds_gpio, |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 713 | }; |
| 714 | |
| 715 | static void __init magician_init(void) |
| 716 | { |
Philipp Zabel | e07ff8d8 | 2008-04-09 19:27:10 +0100 | [diff] [blame] | 717 | void __iomem *cpld; |
| 718 | int lcd_select; |
Philipp Zabel | a1999cd | 2008-04-20 17:39:12 +0100 | [diff] [blame] | 719 | int err; |
| 720 | |
| 721 | gpio_request(GPIO13_MAGICIAN_CPLD_IRQ, "CPLD_IRQ"); |
| 722 | gpio_request(GPIO107_MAGICIAN_DS1WM_IRQ, "DS1WM_IRQ"); |
Philipp Zabel | e07ff8d8 | 2008-04-09 19:27:10 +0100 | [diff] [blame] | 723 | |
Philipp Zabel | b168281 | 2008-04-12 13:29:22 +0100 | [diff] [blame] | 724 | pxa2xx_mfp_config(ARRAY_AND_SIZE(magician_pin_config)); |
| 725 | |
Russell King | cc155c6 | 2009-11-09 13:34:08 +0800 | [diff] [blame] | 726 | pxa_set_ffuart_info(NULL); |
| 727 | pxa_set_btuart_info(NULL); |
| 728 | pxa_set_stuart_info(NULL); |
| 729 | |
Philipp Zabel | 2f1a5bf | 2009-04-28 13:31:08 +0200 | [diff] [blame] | 730 | platform_add_devices(ARRAY_AND_SIZE(devices)); |
Philipp Zabel | a1999cd | 2008-04-20 17:39:12 +0100 | [diff] [blame] | 731 | |
| 732 | err = gpio_request(GPIO83_MAGICIAN_nIR_EN, "nIR_EN"); |
| 733 | if (!err) { |
| 734 | gpio_direction_output(GPIO83_MAGICIAN_nIR_EN, 1); |
| 735 | pxa_set_ficp_info(&magician_ficp_info); |
| 736 | } |
Philipp Zabel | dee6316 | 2009-01-17 18:45:42 +0100 | [diff] [blame] | 737 | pxa27x_set_i2c_power_info(NULL); |
Philipp Zabel | f8f9d5e | 2009-04-17 11:38:23 +0200 | [diff] [blame] | 738 | pxa_set_i2c_info(&i2c_info); |
Philipp Zabel | bdb0c16 | 2008-04-09 19:24:55 +0100 | [diff] [blame] | 739 | pxa_set_mci_info(&magician_mci_info); |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 740 | pxa_set_ohci_info(&magician_ohci_info); |
Philipp Zabel | e07ff8d8 | 2008-04-09 19:27:10 +0100 | [diff] [blame] | 741 | |
| 742 | /* Check LCD type we have */ |
| 743 | cpld = ioremap_nocache(PXA_CS3_PHYS, 0x1000); |
| 744 | if (cpld) { |
| 745 | u8 board_id = __raw_readb(cpld+0x14); |
Philipp Zabel | a1999cd | 2008-04-20 17:39:12 +0100 | [diff] [blame] | 746 | iounmap(cpld); |
Philipp Zabel | e07ff8d8 | 2008-04-09 19:27:10 +0100 | [diff] [blame] | 747 | system_rev = board_id & 0x7; |
| 748 | lcd_select = board_id & 0x8; |
Philipp Zabel | e07ff8d8 | 2008-04-09 19:27:10 +0100 | [diff] [blame] | 749 | pr_info("LCD type: %s\n", lcd_select ? "Samsung" : "Toppoly"); |
Philipp Zabel | a1999cd | 2008-04-20 17:39:12 +0100 | [diff] [blame] | 750 | if (lcd_select && (system_rev < 3)) { |
| 751 | gpio_request(GPIO75_MAGICIAN_SAMSUNG_POWER, "SAMSUNG_POWER"); |
| 752 | gpio_direction_output(GPIO75_MAGICIAN_SAMSUNG_POWER, 0); |
| 753 | } |
| 754 | gpio_request(GPIO104_MAGICIAN_LCD_POWER_1, "LCD_POWER_1"); |
| 755 | gpio_request(GPIO105_MAGICIAN_LCD_POWER_2, "LCD_POWER_2"); |
| 756 | gpio_request(GPIO106_MAGICIAN_LCD_POWER_3, "LCD_POWER_3"); |
| 757 | gpio_direction_output(GPIO104_MAGICIAN_LCD_POWER_1, 0); |
| 758 | gpio_direction_output(GPIO105_MAGICIAN_LCD_POWER_2, 0); |
| 759 | gpio_direction_output(GPIO106_MAGICIAN_LCD_POWER_3, 0); |
Russell King - ARM Linux | 4321e1a | 2011-02-15 15:37:30 +0800 | [diff] [blame] | 760 | pxa_set_fb_info(NULL, lcd_select ? &samsung_info : &toppoly_info); |
Philipp Zabel | e07ff8d8 | 2008-04-09 19:27:10 +0100 | [diff] [blame] | 761 | } else |
| 762 | pr_err("LCD detection: CPLD mapping failed\n"); |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 763 | } |
| 764 | |
| 765 | |
| 766 | MACHINE_START(MAGICIAN, "HTC Magician") |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 767 | .boot_params = 0xa0000100, |
Marek Vasut | 851982c | 2010-10-11 02:20:19 +0200 | [diff] [blame] | 768 | .map_io = pxa27x_map_io, |
Haojian Zhuang | 6ac6b81 | 2010-08-20 15:23:59 +0800 | [diff] [blame] | 769 | .nr_irqs = MAGICIAN_NR_IRQS, |
Philipp Zabel | e5c271e | 2007-11-22 17:59:11 +0100 | [diff] [blame] | 770 | .init_irq = pxa27x_init_irq, |
| 771 | .init_machine = magician_init, |
| 772 | .timer = &pxa_timer, |
| 773 | MACHINE_END |