diff options
Diffstat (limited to 'arch/arm/mach-sa1100/collie.c')
-rw-r--r-- | arch/arm/mach-sa1100/collie.c | 55 |
1 files changed, 7 insertions, 48 deletions
diff --git a/arch/arm/mach-sa1100/collie.c b/arch/arm/mach-sa1100/collie.c index 108939f8d053..b90c7d828391 100644 --- a/arch/arm/mach-sa1100/collie.c +++ b/arch/arm/mach-sa1100/collie.c | |||
@@ -30,7 +30,7 @@ | |||
30 | #include <linux/gpio_keys.h> | 30 | #include <linux/gpio_keys.h> |
31 | #include <linux/input.h> | 31 | #include <linux/input.h> |
32 | #include <linux/gpio.h> | 32 | #include <linux/gpio.h> |
33 | #include <linux/pda_power.h> | 33 | #include <linux/power/gpio-charger.h> |
34 | 34 | ||
35 | #include <video/sa1100fb.h> | 35 | #include <video/sa1100fb.h> |
36 | 36 | ||
@@ -131,62 +131,24 @@ static struct irda_platform_data collie_ir_data = { | |||
131 | /* | 131 | /* |
132 | * Collie AC IN | 132 | * Collie AC IN |
133 | */ | 133 | */ |
134 | static int collie_power_init(struct device *dev) | ||
135 | { | ||
136 | int ret = gpio_request(COLLIE_GPIO_AC_IN, "ac in"); | ||
137 | if (ret) | ||
138 | goto err_gpio_req; | ||
139 | |||
140 | ret = gpio_direction_input(COLLIE_GPIO_AC_IN); | ||
141 | if (ret) | ||
142 | goto err_gpio_in; | ||
143 | |||
144 | return 0; | ||
145 | |||
146 | err_gpio_in: | ||
147 | gpio_free(COLLIE_GPIO_AC_IN); | ||
148 | err_gpio_req: | ||
149 | return ret; | ||
150 | } | ||
151 | |||
152 | static void collie_power_exit(struct device *dev) | ||
153 | { | ||
154 | gpio_free(COLLIE_GPIO_AC_IN); | ||
155 | } | ||
156 | |||
157 | static int collie_power_ac_online(void) | ||
158 | { | ||
159 | return gpio_get_value(COLLIE_GPIO_AC_IN) == 2; | ||
160 | } | ||
161 | |||
162 | static char *collie_ac_supplied_to[] = { | 134 | static char *collie_ac_supplied_to[] = { |
163 | "main-battery", | 135 | "main-battery", |
164 | "backup-battery", | 136 | "backup-battery", |
165 | }; | 137 | }; |
166 | 138 | ||
167 | static struct pda_power_pdata collie_power_data = { | 139 | |
168 | .init = collie_power_init, | 140 | static struct gpio_charger_platform_data collie_power_data = { |
169 | .is_ac_online = collie_power_ac_online, | 141 | .name = "charger", |
170 | .exit = collie_power_exit, | 142 | .type = POWER_SUPPLY_TYPE_MAINS, |
143 | .gpio = COLLIE_GPIO_AC_IN, | ||
171 | .supplied_to = collie_ac_supplied_to, | 144 | .supplied_to = collie_ac_supplied_to, |
172 | .num_supplicants = ARRAY_SIZE(collie_ac_supplied_to), | 145 | .num_supplicants = ARRAY_SIZE(collie_ac_supplied_to), |
173 | }; | 146 | }; |
174 | 147 | ||
175 | static struct resource collie_power_resource[] = { | ||
176 | { | ||
177 | .name = "ac", | ||
178 | .flags = IORESOURCE_IRQ | | ||
179 | IORESOURCE_IRQ_HIGHEDGE | | ||
180 | IORESOURCE_IRQ_LOWEDGE, | ||
181 | }, | ||
182 | }; | ||
183 | |||
184 | static struct platform_device collie_power_device = { | 148 | static struct platform_device collie_power_device = { |
185 | .name = "pda-power", | 149 | .name = "gpio-charger", |
186 | .id = -1, | 150 | .id = -1, |
187 | .dev.platform_data = &collie_power_data, | 151 | .dev.platform_data = &collie_power_data, |
188 | .resource = collie_power_resource, | ||
189 | .num_resources = ARRAY_SIZE(collie_power_resource), | ||
190 | }; | 152 | }; |
191 | 153 | ||
192 | #ifdef CONFIG_SHARP_LOCOMO | 154 | #ifdef CONFIG_SHARP_LOCOMO |
@@ -420,9 +382,6 @@ static void __init collie_init(void) | |||
420 | 382 | ||
421 | GPSR |= _COLLIE_GPIO_UCB1x00_RESET; | 383 | GPSR |= _COLLIE_GPIO_UCB1x00_RESET; |
422 | 384 | ||
423 | collie_power_resource[0].start = gpio_to_irq(COLLIE_GPIO_AC_IN); | ||
424 | collie_power_resource[0].end = gpio_to_irq(COLLIE_GPIO_AC_IN); | ||
425 | |||
426 | sa11x0_ppc_configure_mcp(); | 385 | sa11x0_ppc_configure_mcp(); |
427 | 386 | ||
428 | 387 | ||