diff options
Diffstat (limited to 'arch/arm/mach-pxa/magician.c')
-rw-r--r-- | arch/arm/mach-pxa/magician.c | 49 |
1 files changed, 45 insertions, 4 deletions
diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c index 01b2fa790217..c9d274f0048f 100644 --- a/arch/arm/mach-pxa/magician.c +++ b/arch/arm/mach-pxa/magician.c | |||
@@ -17,17 +17,15 @@ | |||
17 | #include <linux/init.h> | 17 | #include <linux/init.h> |
18 | #include <linux/platform_device.h> | 18 | #include <linux/platform_device.h> |
19 | #include <linux/delay.h> | 19 | #include <linux/delay.h> |
20 | #include <linux/gpio.h> | ||
20 | #include <linux/gpio_keys.h> | 21 | #include <linux/gpio_keys.h> |
21 | #include <linux/input.h> | 22 | #include <linux/input.h> |
22 | #include <linux/mfd/htc-egpio.h> | 23 | #include <linux/mfd/htc-egpio.h> |
23 | #include <linux/mfd/htc-pasic3.h> | 24 | #include <linux/mfd/htc-pasic3.h> |
24 | #include <linux/mtd/mtd.h> | ||
25 | #include <linux/mtd/map.h> | ||
26 | #include <linux/mtd/physmap.h> | 25 | #include <linux/mtd/physmap.h> |
27 | #include <linux/pda_power.h> | 26 | #include <linux/pda_power.h> |
28 | #include <linux/pwm_backlight.h> | 27 | #include <linux/pwm_backlight.h> |
29 | 28 | ||
30 | #include <asm/gpio.h> | ||
31 | #include <asm/hardware.h> | 29 | #include <asm/hardware.h> |
32 | #include <asm/mach-types.h> | 30 | #include <asm/mach-types.h> |
33 | #include <asm/mach/arch.h> | 31 | #include <asm/mach/arch.h> |
@@ -44,7 +42,7 @@ | |||
44 | #include "devices.h" | 42 | #include "devices.h" |
45 | #include "generic.h" | 43 | #include "generic.h" |
46 | 44 | ||
47 | static unsigned long magician_pin_config[] = { | 45 | static unsigned long magician_pin_config[] __initdata = { |
48 | 46 | ||
49 | /* SDRAM and Static Memory I/O Signals */ | 47 | /* SDRAM and Static Memory I/O Signals */ |
50 | GPIO20_nSDCS_2, | 48 | GPIO20_nSDCS_2, |
@@ -134,6 +132,7 @@ static unsigned long magician_pin_config[] = { | |||
134 | static void magician_irda_transceiver_mode(struct device *dev, int mode) | 132 | static void magician_irda_transceiver_mode(struct device *dev, int mode) |
135 | { | 133 | { |
136 | gpio_set_value(GPIO83_MAGICIAN_nIR_EN, mode & IR_OFF); | 134 | gpio_set_value(GPIO83_MAGICIAN_nIR_EN, mode & IR_OFF); |
135 | pxa2xx_transceiver_mode(dev, mode); | ||
137 | } | 136 | } |
138 | 137 | ||
139 | static struct pxaficp_platform_data magician_ficp_info = { | 138 | static struct pxaficp_platform_data magician_ficp_info = { |
@@ -399,6 +398,7 @@ static struct platform_pwm_backlight_data backlight_data = { | |||
399 | 398 | ||
400 | static struct platform_device backlight = { | 399 | static struct platform_device backlight = { |
401 | .name = "pwm-backlight", | 400 | .name = "pwm-backlight", |
401 | .id = -1, | ||
402 | .dev = { | 402 | .dev = { |
403 | .parent = &pxa27x_device_pwm0.dev, | 403 | .parent = &pxa27x_device_pwm0.dev, |
404 | .platform_data = &backlight_data, | 404 | .platform_data = &backlight_data, |
@@ -511,6 +511,37 @@ static struct platform_device pasic3 = { | |||
511 | * External power | 511 | * External power |
512 | */ | 512 | */ |
513 | 513 | ||
514 | static int power_supply_init(struct device *dev) | ||
515 | { | ||
516 | int ret; | ||
517 | |||
518 | ret = gpio_request(EGPIO_MAGICIAN_CABLE_STATE_AC, "CABLE_STATE_AC"); | ||
519 | if (ret) | ||
520 | goto err_cs_ac; | ||
521 | ret = gpio_request(EGPIO_MAGICIAN_CABLE_STATE_USB, "CABLE_STATE_USB"); | ||
522 | if (ret) | ||
523 | goto err_cs_usb; | ||
524 | ret = gpio_request(EGPIO_MAGICIAN_CHARGE_EN, "CHARGE_EN"); | ||
525 | if (ret) | ||
526 | goto err_chg_en; | ||
527 | ret = gpio_request(GPIO30_MAGICIAN_nCHARGE_EN, "nCHARGE_EN"); | ||
528 | if (!ret) | ||
529 | ret = gpio_direction_output(GPIO30_MAGICIAN_nCHARGE_EN, 0); | ||
530 | if (ret) | ||
531 | goto err_nchg_en; | ||
532 | |||
533 | return 0; | ||
534 | |||
535 | err_nchg_en: | ||
536 | gpio_free(EGPIO_MAGICIAN_CHARGE_EN); | ||
537 | err_chg_en: | ||
538 | gpio_free(EGPIO_MAGICIAN_CABLE_STATE_USB); | ||
539 | err_cs_usb: | ||
540 | gpio_free(EGPIO_MAGICIAN_CABLE_STATE_AC); | ||
541 | err_cs_ac: | ||
542 | return ret; | ||
543 | } | ||
544 | |||
514 | static int magician_is_ac_online(void) | 545 | static int magician_is_ac_online(void) |
515 | { | 546 | { |
516 | return gpio_get_value(EGPIO_MAGICIAN_CABLE_STATE_AC); | 547 | return gpio_get_value(EGPIO_MAGICIAN_CABLE_STATE_AC); |
@@ -527,14 +558,24 @@ static void magician_set_charge(int flags) | |||
527 | gpio_set_value(EGPIO_MAGICIAN_CHARGE_EN, flags); | 558 | gpio_set_value(EGPIO_MAGICIAN_CHARGE_EN, flags); |
528 | } | 559 | } |
529 | 560 | ||
561 | static void power_supply_exit(struct device *dev) | ||
562 | { | ||
563 | gpio_free(GPIO30_MAGICIAN_nCHARGE_EN); | ||
564 | gpio_free(EGPIO_MAGICIAN_CHARGE_EN); | ||
565 | gpio_free(EGPIO_MAGICIAN_CABLE_STATE_USB); | ||
566 | gpio_free(EGPIO_MAGICIAN_CABLE_STATE_AC); | ||
567 | } | ||
568 | |||
530 | static char *magician_supplicants[] = { | 569 | static char *magician_supplicants[] = { |
531 | "ds2760-battery.0", "backup-battery" | 570 | "ds2760-battery.0", "backup-battery" |
532 | }; | 571 | }; |
533 | 572 | ||
534 | static struct pda_power_pdata power_supply_info = { | 573 | static struct pda_power_pdata power_supply_info = { |
574 | .init = power_supply_init, | ||
535 | .is_ac_online = magician_is_ac_online, | 575 | .is_ac_online = magician_is_ac_online, |
536 | .is_usb_online = magician_is_usb_online, | 576 | .is_usb_online = magician_is_usb_online, |
537 | .set_charge = magician_set_charge, | 577 | .set_charge = magician_set_charge, |
578 | .exit = power_supply_exit, | ||
538 | .supplied_to = magician_supplicants, | 579 | .supplied_to = magician_supplicants, |
539 | .num_supplicants = ARRAY_SIZE(magician_supplicants), | 580 | .num_supplicants = ARRAY_SIZE(magician_supplicants), |
540 | }; | 581 | }; |