diff options
| author | Thomas Kunze <thommycheck@gmx.de> | 2009-02-10 07:48:32 -0500 |
|---|---|---|
| committer | Thomas Kunze <tkunze@tkunze-desktop.(none)> | 2009-11-27 15:07:24 -0500 |
| commit | 9823b2d0f9547742fc40857f9ef153d6956266f2 (patch) | |
| tree | fcabc2f0890b8667afac162d77cc0152739b57e3 | |
| parent | f1fce597e68c91f04381ad869579fd2fe6064101 (diff) | |
collie: support pda_power driver
This add the pda-power platform device to collie.
| -rw-r--r-- | arch/arm/mach-sa1100/collie.c | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/arch/arm/mach-sa1100/collie.c b/arch/arm/mach-sa1100/collie.c index 395cf09b28b4..fdab9d929e8e 100644 --- a/arch/arm/mach-sa1100/collie.c +++ b/arch/arm/mach-sa1100/collie.c | |||
| @@ -26,6 +26,7 @@ | |||
| 26 | #include <linux/mtd/partitions.h> | 26 | #include <linux/mtd/partitions.h> |
| 27 | #include <linux/timer.h> | 27 | #include <linux/timer.h> |
| 28 | #include <linux/gpio.h> | 28 | #include <linux/gpio.h> |
| 29 | #include <linux/pda_power.h> | ||
| 29 | 30 | ||
| 30 | #include <mach/hardware.h> | 31 | #include <mach/hardware.h> |
| 31 | #include <asm/mach-types.h> | 32 | #include <asm/mach-types.h> |
| @@ -89,6 +90,69 @@ static struct mcp_plat_data collie_mcp_data = { | |||
| 89 | .gpio_base = COLLIE_TC35143_GPIO_BASE, | 90 | .gpio_base = COLLIE_TC35143_GPIO_BASE, |
| 90 | }; | 91 | }; |
| 91 | 92 | ||
| 93 | /* | ||
| 94 | * Collie AC IN | ||
| 95 | */ | ||
| 96 | static int collie_power_init(struct device *dev) | ||
| 97 | { | ||
| 98 | int ret = gpio_request(COLLIE_GPIO_AC_IN, "ac in"); | ||
| 99 | if (ret) | ||
| 100 | goto err_gpio_req; | ||
| 101 | |||
| 102 | ret = gpio_direction_input(COLLIE_GPIO_AC_IN); | ||
| 103 | if (ret) | ||
| 104 | goto err_gpio_in; | ||
| 105 | |||
| 106 | return 0; | ||
| 107 | |||
| 108 | err_gpio_in: | ||
| 109 | gpio_free(COLLIE_GPIO_AC_IN); | ||
| 110 | err_gpio_req: | ||
| 111 | return ret; | ||
| 112 | } | ||
| 113 | |||
| 114 | static void collie_power_exit(struct device *dev) | ||
| 115 | { | ||
| 116 | gpio_free(COLLIE_GPIO_AC_IN); | ||
| 117 | } | ||
| 118 | |||
| 119 | static int collie_power_ac_online(void) | ||
| 120 | { | ||
| 121 | return gpio_get_value(COLLIE_GPIO_AC_IN) == 2; | ||
| 122 | } | ||
| 123 | |||
| 124 | static char *collie_ac_supplied_to[] = { | ||
| 125 | "main-battery", | ||
| 126 | "backup-battery", | ||
| 127 | }; | ||
| 128 | |||
| 129 | static struct pda_power_pdata collie_power_data = { | ||
| 130 | .init = collie_power_init, | ||
| 131 | .is_ac_online = collie_power_ac_online, | ||
| 132 | .exit = collie_power_exit, | ||
| 133 | .supplied_to = collie_ac_supplied_to, | ||
| 134 | .num_supplicants = ARRAY_SIZE(collie_ac_supplied_to), | ||
| 135 | }; | ||
| 136 | |||
| 137 | static struct resource collie_power_resource[] = { | ||
| 138 | { | ||
| 139 | .name = "ac", | ||
| 140 | .start = gpio_to_irq(COLLIE_GPIO_AC_IN), | ||
| 141 | .end = gpio_to_irq(COLLIE_GPIO_AC_IN), | ||
| 142 | .flags = IORESOURCE_IRQ | | ||
| 143 | IORESOURCE_IRQ_HIGHEDGE | | ||
| 144 | IORESOURCE_IRQ_LOWEDGE, | ||
| 145 | }, | ||
| 146 | }; | ||
| 147 | |||
| 148 | static struct platform_device collie_power_device = { | ||
| 149 | .name = "pda-power", | ||
| 150 | .id = -1, | ||
| 151 | .dev.platform_data = &collie_power_data, | ||
| 152 | .resource = collie_power_resource, | ||
| 153 | .num_resources = ARRAY_SIZE(collie_power_resource), | ||
| 154 | }; | ||
| 155 | |||
| 92 | #ifdef CONFIG_SHARP_LOCOMO | 156 | #ifdef CONFIG_SHARP_LOCOMO |
| 93 | /* | 157 | /* |
| 94 | * low-level UART features. | 158 | * low-level UART features. |
| @@ -180,6 +244,7 @@ struct platform_device collie_locomo_device = { | |||
| 180 | static struct platform_device *devices[] __initdata = { | 244 | static struct platform_device *devices[] __initdata = { |
| 181 | &collie_locomo_device, | 245 | &collie_locomo_device, |
| 182 | &colliescoop_device, | 246 | &colliescoop_device, |
| 247 | &collie_power_device, | ||
| 183 | }; | 248 | }; |
| 184 | 249 | ||
| 185 | static struct mtd_partition collie_partitions[] = { | 250 | static struct mtd_partition collie_partitions[] = { |
