aboutsummaryrefslogtreecommitdiff
path: root/arch/arm/mach-pxa/magician.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-04-08 15:24:09 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2009-04-08 15:24:09 -0700
commit139ef17a464a222aadf7b543d734a4001d06b720 (patch)
treef962bb78ce87de00fc8035e29efbb1f288cc3ab2 /arch/arm/mach-pxa/magician.c
parentd2e2d7ca14f123cb1d03408c2bc6db8d402f416d (diff)
parent3d6fdf7563d0a67c6973cf421f7405524ed8bdaf (diff)
Merge master.kernel.org:/home/rmk/linux-2.6-arm
* master.kernel.org:/home/rmk/linux-2.6-arm: [ARM] 5446/1: ohci-at91: Limit vbus_pin assignment to the size of the array [ARM] 5445/1: AT91: Remove flexible array from USBH platform data [ARM] 5447/1: Add SZ_32K [ARM] omap: fix omap1 clock usecount decrement bug [ARM] pxa: register AC97 controller devices [ARM] pxa/csb701: do not register devices on non-csb726 boads [ARM] pxa/colibri: get rid of set_irq_type() [ARM] pxa/colibri: provide MAC address from ATAG_SERIAL [ARM] pxa/cm-x2xx: fix ucb1400 not being registered [ARM] pxa: Add support for suspend on PalmTX, T5 and LD [ARM] pxa: PalmTE2 support for battery, UDC, IrDA and backlight [ARM] pxa: Palm Tungsten E2 basic support [ARM] pxa/em-x270: add libertas device registration [ARM] pxa/magician: Enable bq24022 regulator for gpio_vbus and pda_power
Diffstat (limited to 'arch/arm/mach-pxa/magician.c')
-rw-r--r--arch/arm/mach-pxa/magician.c84
1 files changed, 41 insertions, 43 deletions
diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c
index deeea1c2782..c899bbd94dc 100644
--- a/arch/arm/mach-pxa/magician.c
+++ b/arch/arm/mach-pxa/magician.c
@@ -25,6 +25,8 @@
#include <linux/mtd/physmap.h>
#include <linux/pda_power.h>
#include <linux/pwm_backlight.h>
+#include <linux/regulator/bq24022.h>
+#include <linux/regulator/machine.h>
#include <linux/usb/gpio_vbus.h>
#include <mach/hardware.h>
@@ -552,33 +554,7 @@ static struct platform_device gpio_vbus = {
static int power_supply_init(struct device *dev)
{
- int ret;
-
- ret = gpio_request(EGPIO_MAGICIAN_CABLE_STATE_AC, "CABLE_STATE_AC");
- if (ret)
- goto err_cs_ac;
- ret = gpio_request(EGPIO_MAGICIAN_CABLE_STATE_USB, "CABLE_STATE_USB");
- if (ret)
- goto err_cs_usb;
- ret = gpio_request(EGPIO_MAGICIAN_CHARGE_EN, "CHARGE_EN");
- if (ret)
- goto err_chg_en;
- ret = gpio_request(GPIO30_MAGICIAN_nCHARGE_EN, "nCHARGE_EN");
- if (!ret)
- ret = gpio_direction_output(GPIO30_MAGICIAN_nCHARGE_EN, 0);
- if (ret)
- goto err_nchg_en;
-
- return 0;
-
-err_nchg_en:
- gpio_free(EGPIO_MAGICIAN_CHARGE_EN);
-err_chg_en:
- gpio_free(EGPIO_MAGICIAN_CABLE_STATE_USB);
-err_cs_usb:
- gpio_free(EGPIO_MAGICIAN_CABLE_STATE_AC);
-err_cs_ac:
- return ret;
+ return gpio_request(EGPIO_MAGICIAN_CABLE_STATE_AC, "CABLE_STATE_AC");
}
static int magician_is_ac_online(void)
@@ -586,22 +562,8 @@ static int magician_is_ac_online(void)
return gpio_get_value(EGPIO_MAGICIAN_CABLE_STATE_AC);
}
-static int magician_is_usb_online(void)
-{
- return gpio_get_value(EGPIO_MAGICIAN_CABLE_STATE_USB);
-}
-
-static void magician_set_charge(int flags)
-{
- gpio_set_value(GPIO30_MAGICIAN_nCHARGE_EN, !flags);
- gpio_set_value(EGPIO_MAGICIAN_CHARGE_EN, flags);
-}
-
static void power_supply_exit(struct device *dev)
{
- gpio_free(GPIO30_MAGICIAN_nCHARGE_EN);
- gpio_free(EGPIO_MAGICIAN_CHARGE_EN);
- gpio_free(EGPIO_MAGICIAN_CABLE_STATE_USB);
gpio_free(EGPIO_MAGICIAN_CABLE_STATE_AC);
}
@@ -612,8 +574,6 @@ static char *magician_supplicants[] = {
static struct pda_power_pdata power_supply_info = {
.init = power_supply_init,
.is_ac_online = magician_is_ac_online,
- .is_usb_online = magician_is_usb_online,
- .set_charge = magician_set_charge,
.exit = power_supply_exit,
.supplied_to = magician_supplicants,
.num_supplicants = ARRAY_SIZE(magician_supplicants),
@@ -646,6 +606,43 @@ static struct platform_device power_supply = {
.num_resources = ARRAY_SIZE(power_supply_resources),
};
+/*
+ * Battery charger
+ */
+
+static struct regulator_consumer_supply bq24022_consumers[] = {
+ {
+ .dev = &gpio_vbus.dev,
+ .supply = "vbus_draw",
+ },
+ {
+ .dev = &power_supply.dev,
+ .supply = "ac_draw",
+ },
+};
+
+static struct regulator_init_data bq24022_init_data = {
+ .constraints = {
+ .max_uA = 500000,
+ .valid_ops_mask = REGULATOR_CHANGE_CURRENT,
+ },
+ .num_consumer_supplies = ARRAY_SIZE(bq24022_consumers),
+ .consumer_supplies = bq24022_consumers,
+};
+
+static struct bq24022_mach_info bq24022_info = {
+ .gpio_nce = GPIO30_MAGICIAN_BQ24022_nCHARGE_EN,
+ .gpio_iset2 = EGPIO_MAGICIAN_BQ24022_ISET2,
+ .init_data = &bq24022_init_data,
+};
+
+static struct platform_device bq24022 = {
+ .name = "bq24022",
+ .id = -1,
+ .dev = {
+ .platform_data = &bq24022_info,
+ },
+};
/*
* MMC/SD
@@ -756,6 +753,7 @@ static struct platform_device *devices[] __initdata = {
&egpio,
&backlight,
&pasic3,
+ &bq24022,
&gpio_vbus,
&power_supply,
&strataflash,