aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-sa1100/collie.c
diff options
context:
space:
mode:
authorDmitry Eremin-Solenikov <dbaryshkov@gmail.com>2014-11-21 10:26:29 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2014-11-27 11:15:32 -0500
commit119acbd24c54d73c8941f43f16817c3417237413 (patch)
tree125c8321663f376fcd2d9bb6e80d8fb28397cb1c /arch/arm/mach-sa1100/collie.c
parent279f487e0b471577e2b3c134e2ff9af939129d0f (diff)
ARM: 8217/1: sa1100 collie: use gpio-charger instead of pda-power
Use gpio-charger driver instead of pda-power: it automatically cares about used gpio and since collie does not differentiate between usb and ac chargers, pda-power is an overkill for it. As a bonus this allows us to remove gpio_to_irq calls from machine init call - it is fragile. These gpio_to_irq calls will fail if gpios are registered later, via device driver mechanisms. Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-sa1100/collie.c')
-rw-r--r--arch/arm/mach-sa1100/collie.c55
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 */
134static 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
146err_gpio_in:
147 gpio_free(COLLIE_GPIO_AC_IN);
148err_gpio_req:
149 return ret;
150}
151
152static void collie_power_exit(struct device *dev)
153{
154 gpio_free(COLLIE_GPIO_AC_IN);
155}
156
157static int collie_power_ac_online(void)
158{
159 return gpio_get_value(COLLIE_GPIO_AC_IN) == 2;
160}
161
162static char *collie_ac_supplied_to[] = { 134static char *collie_ac_supplied_to[] = {
163 "main-battery", 135 "main-battery",
164 "backup-battery", 136 "backup-battery",
165}; 137};
166 138
167static struct pda_power_pdata collie_power_data = { 139
168 .init = collie_power_init, 140static 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
175static struct resource collie_power_resource[] = {
176 {
177 .name = "ac",
178 .flags = IORESOURCE_IRQ |
179 IORESOURCE_IRQ_HIGHEDGE |
180 IORESOURCE_IRQ_LOWEDGE,
181 },
182};
183
184static struct platform_device collie_power_device = { 148static 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