diff options
author | Philipp Zabel <philipp.zabel@gmail.com> | 2008-04-09 14:25:56 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2008-04-19 06:29:07 -0400 |
commit | 350d115d1eaa29e64324847badf27c93159ba8e0 (patch) | |
tree | 044fdd6f3ef6a40d3b0dfc8c684f9228b675c9f9 /arch/arm | |
parent | bdb0c16acb51b7bf15d626848f287691ef39dbe8 (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')
-rw-r--r-- | arch/arm/configs/magician_defconfig | 6 | ||||
-rw-r--r-- | arch/arm/mach-pxa/magician.c | 54 |
2 files changed, 59 insertions, 1 deletions
diff --git a/arch/arm/configs/magician_defconfig b/arch/arm/configs/magician_defconfig index b35958b50c65..69ac0e4f1fe8 100644 --- a/arch/arm/configs/magician_defconfig +++ b/arch/arm/configs/magician_defconfig | |||
@@ -695,7 +695,11 @@ CONFIG_I2C_PXA=m | |||
695 | # CONFIG_SPI is not set | 695 | # CONFIG_SPI is not set |
696 | # CONFIG_SPI_MASTER is not set | 696 | # CONFIG_SPI_MASTER is not set |
697 | # CONFIG_W1 is not set | 697 | # CONFIG_W1 is not set |
698 | # CONFIG_POWER_SUPPLY is not set | 698 | CONFIG_POWER_SUPPLY=y |
699 | # CONFIG_POWER_SUPPLY_DEBUG is not set | ||
700 | CONFIG_PDA_POWER=y | ||
701 | # CONFIG_APM_POWER is not set | ||
702 | # CONFIG_BATTERY_DS2760 is not set | ||
699 | # CONFIG_HWMON is not set | 703 | # CONFIG_HWMON is not set |
700 | # CONFIG_WATCHDOG is not set | 704 | # CONFIG_WATCHDOG is not set |
701 | 705 | ||
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 | |||
210 | static int magician_is_ac_online(void) | ||
211 | { | ||
212 | return gpio_get_value(EGPIO_MAGICIAN_CABLE_STATE_AC); | ||
213 | } | ||
214 | |||
215 | static int magician_is_usb_online(void) | ||
216 | { | ||
217 | return gpio_get_value(EGPIO_MAGICIAN_CABLE_STATE_USB); | ||
218 | } | ||
219 | |||
220 | static 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 | |||
226 | static 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 | |||
232 | static 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 | |||
247 | static 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 | ||