aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-pxa/magician.c
diff options
context:
space:
mode:
authorPhilipp Zabel <philipp.zabel@gmail.com>2008-04-09 14:25:56 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2008-04-19 06:29:07 -0400
commit350d115d1eaa29e64324847badf27c93159ba8e0 (patch)
tree044fdd6f3ef6a40d3b0dfc8c684f9228b675c9f9 /arch/arm/mach-pxa/magician.c
parentbdb0c16acb51b7bf15d626848f287691ef39dbe8 (diff)
[ARM] 4951/1: magician: enable external power supply (pda_power) driver
Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-pxa/magician.c')
-rw-r--r--arch/arm/mach-pxa/magician.c54
1 files changed, 54 insertions, 0 deletions
diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c
index a931c384d49d..d152a086e734 100644
--- a/arch/arm/mach-pxa/magician.c
+++ b/arch/arm/mach-pxa/magician.c
@@ -22,6 +22,7 @@
22#include <linux/mtd/mtd.h> 22#include <linux/mtd/mtd.h>
23#include <linux/mtd/map.h> 23#include <linux/mtd/map.h>
24#include <linux/mtd/physmap.h> 24#include <linux/mtd/physmap.h>
25#include <linux/pda_power.h>
25 26
26#include <asm/gpio.h> 27#include <asm/gpio.h>
27#include <asm/hardware.h> 28#include <asm/hardware.h>
@@ -203,6 +204,58 @@ static struct platform_device backlight = {
203 204
204 205
205/* 206/*
207 * External power
208 */
209
210static int magician_is_ac_online(void)
211{
212 return gpio_get_value(EGPIO_MAGICIAN_CABLE_STATE_AC);
213}
214
215static int magician_is_usb_online(void)
216{
217 return gpio_get_value(EGPIO_MAGICIAN_CABLE_STATE_USB);
218}
219
220static void magician_set_charge(int flags)
221{
222 gpio_set_value(GPIO30_MAGICIAN_nCHARGE_EN, !flags);
223 gpio_set_value(EGPIO_MAGICIAN_CHARGE_EN, flags);
224}
225
226static struct pda_power_pdata power_supply_info = {
227 .is_ac_online = magician_is_ac_online,
228 .is_usb_online = magician_is_usb_online,
229 .set_charge = magician_set_charge,
230};
231
232static struct resource power_supply_resources[] = {
233 [0] = {
234 .name = "ac",
235 .flags = IORESOURCE_IRQ,
236 .start = IRQ_MAGICIAN_AC,
237 .end = IRQ_MAGICIAN_AC,
238 },
239 [1] = {
240 .name = "usb",
241 .flags = IORESOURCE_IRQ,
242 .start = IRQ_MAGICIAN_AC,
243 .end = IRQ_MAGICIAN_AC,
244 },
245};
246
247static struct platform_device power_supply = {
248 .name = "pda-power",
249 .id = -1,
250 .dev = {
251 .platform_data = &power_supply_info,
252 },
253 .resource = power_supply_resources,
254 .num_resources = ARRAY_SIZE(power_supply_resources),
255};
256
257
258/*
206 * MMC/SD 259 * MMC/SD
207 */ 260 */
208 261
@@ -299,6 +352,7 @@ static struct platform_device *devices[] __initdata = {
299 &gpio_keys, 352 &gpio_keys,
300 &egpio, 353 &egpio,
301 &backlight, 354 &backlight,
355 &power_supply,
302 &strataflash, 356 &strataflash,
303}; 357};
304 358