16 #include <linux/kernel.h>
22 #include <linux/input.h>
34 #include <mach/hardware.h>
49 static unsigned long magician_pin_config[]
__initdata = {
135 #define INIT_KEY(_code, _gpio, _desc) \
137 .code = KEY_##_code, \
163 .buttons = magician_button_table,
164 .nbuttons =
ARRAY_SIZE(magician_button_table),
170 .platform_data = &gpio_keys_data,
182 static struct resource egpio_resources[] = {
201 .initial_values = 0x40,
224 .resource = egpio_resources,
227 .platform_data = &egpio_info,
329 .modes = toppoly_modes,
333 .pxafb_lcd_power = toppoly_lcd_power,
337 .modes = samsung_modes,
341 LCD_ALTERNATE_MAPPING,
342 .pxafb_lcd_power = samsung_lcd_power,
349 static struct gpio magician_bl_gpios[] = {
354 static int magician_backlight_init(
struct device *
dev)
362 if (brightness >= 200) {
364 return brightness - 72;
371 static void magician_backlight_exit(
struct device *dev)
378 .max_brightness = 272,
379 .dft_brightness = 100,
380 .pwm_period_ns = 30923,
381 .init = magician_backlight_init,
382 .notify = magician_backlight_notify,
383 .exit = magician_backlight_exit,
387 .name =
"pwm-backlight",
391 .platform_data = &backlight_data,
399 static struct gpio_led gpio_leds[] = {
401 .name =
"magician::vibra",
402 .default_trigger =
"none",
406 .name =
"magician::phone_bl",
407 .default_trigger =
"backlight",
421 .platform_data = &gpio_led_info,
428 .name =
"magician:red",
429 .default_trigger =
"ds2760-battery.0-charging",
437 .name =
"magician:green",
438 .default_trigger =
"ds2760-battery.0-charging-or-full",
446 .name =
"magician:blue",
447 .default_trigger =
"bluetooth",
465 static struct resource pasic3_resources[] = {
481 .clock_rate = 4000000,
487 .num_resources =
ARRAY_SIZE(pasic3_resources),
488 .resource = pasic3_resources,
490 .platform_data = &pasic3_platform_data,
498 static struct resource gpio_vbus_resource = {
513 .resource = &gpio_vbus_resource,
515 .platform_data = &gpio_vbus_info,
523 static int power_supply_init(
struct device *dev)
528 static int magician_is_ac_online(
void)
533 static void power_supply_exit(
struct device *dev)
538 static char *magician_supplicants[] = {
539 "ds2760-battery.0",
"backup-battery"
543 .init = power_supply_init,
544 .is_ac_online = magician_is_ac_online,
545 .exit = power_supply_exit,
546 .supplied_to = magician_supplicants,
547 .num_supplicants =
ARRAY_SIZE(magician_supplicants),
550 static struct resource power_supply_resources[] = {
571 .platform_data = &power_supply_info,
573 .resource = power_supply_resources,
574 .num_resources =
ARRAY_SIZE(power_supply_resources),
591 .num_consumer_supplies =
ARRAY_SIZE(bq24022_consumers),
592 .consumer_supplies = bq24022_consumers,
595 static struct gpio bq24022_gpios[] = {
600 { .value = 100000, .gpios = (0 << 0) },
601 { .value = 500000, .gpios = (1 << 0) },
605 .supply_name =
"bq24022",
609 .enabled_at_boot = 0,
611 .gpios = bq24022_gpios,
614 .states = bq24022_states,
618 .init_data = &bq24022_init_data,
622 .name =
"gpio-regulator",
625 .platform_data = &bq24022_info,
633 static int magician_mci_init(
struct device *dev,
637 "mmc card detect", data);
640 static void magician_mci_exit(
struct device *dev,
void *
data)
647 .init = magician_mci_init,
648 .exit = magician_mci_exit,
649 .gpio_card_detect = -1,
651 .gpio_card_ro_invert = 1,
676 static struct resource strataflash_resource = {
684 .set_vpp = magician_set_vpp,
688 .name =
"physmap-flash",
690 .resource = &strataflash_resource,
693 .platform_data = &strataflash_data,
721 static struct gpio magician_global_gpios[] = {
730 static void __init magician_init(
void)
739 pr_err(
"magician: Failed to request GPIOs: %d\n", err);
759 lcd_select = board_id & 0x8;
760 pr_info(
"LCD type: %s\n", lcd_select ?
"Samsung" :
"Toppoly");
766 pr_err(
"LCD detection: CPLD mapping failed\n");
771 .atag_offset = 0x100,
776 .init_machine = magician_init,