diff options
author | Igor Grinberg <grinberg@compulab.co.il> | 2010-03-09 04:43:48 -0500 |
---|---|---|
committer | Eric Miao <eric.y.miao@gmail.com> | 2010-05-11 11:25:01 -0400 |
commit | 03ba7e07f5025710470b12e18e2b9b2979d836db (patch) | |
tree | 666bc49f5b53ea44561b4dec05bd961c4991c89a /arch/arm/mach-pxa/cm-x300.c | |
parent | b1d9bf1d9836dcee235f49bb4eb5ba4450a3a678 (diff) |
[ARM] pxa/cm-x300.c: add battery charger support
Signed-off-by: Igor Grinberg <grinberg@compulab.co.il>
Signed-off-by: Eric Miao <eric.y.miao@gmail.com>
Diffstat (limited to 'arch/arm/mach-pxa/cm-x300.c')
-rw-r--r-- | arch/arm/mach-pxa/cm-x300.c | 57 |
1 files changed, 56 insertions, 1 deletions
diff --git a/arch/arm/mach-pxa/cm-x300.c b/arch/arm/mach-pxa/cm-x300.c index d37cfa132a65..0e538d8895d1 100644 --- a/arch/arm/mach-pxa/cm-x300.c +++ b/arch/arm/mach-pxa/cm-x300.c | |||
@@ -30,6 +30,8 @@ | |||
30 | #include <linux/i2c/pca953x.h> | 30 | #include <linux/i2c/pca953x.h> |
31 | 31 | ||
32 | #include <linux/mfd/da903x.h> | 32 | #include <linux/mfd/da903x.h> |
33 | #include <linux/power_supply.h> | ||
34 | #include <linux/apm-emulation.h> | ||
33 | 35 | ||
34 | #include <linux/spi/spi.h> | 36 | #include <linux/spi/spi.h> |
35 | #include <linux/spi/spi_gpio.h> | 37 | #include <linux/spi/spi_gpio.h> |
@@ -584,12 +586,65 @@ static void __init cm_x300_init_rtc(void) | |||
584 | static inline void cm_x300_init_rtc(void) {} | 586 | static inline void cm_x300_init_rtc(void) {} |
585 | #endif | 587 | #endif |
586 | 588 | ||
589 | /* Battery */ | ||
590 | struct power_supply_info cm_x300_psy_info = { | ||
591 | .name = "battery", | ||
592 | .technology = POWER_SUPPLY_TECHNOLOGY_LIPO, | ||
593 | .voltage_max_design = 4200000, | ||
594 | .voltage_min_design = 3000000, | ||
595 | .use_for_apm = 1, | ||
596 | }; | ||
597 | |||
598 | static void cm_x300_battery_low(void) | ||
599 | { | ||
600 | #if defined(CONFIG_APM_EMULATION) | ||
601 | apm_queue_event(APM_LOW_BATTERY); | ||
602 | #endif | ||
603 | } | ||
604 | |||
605 | static void cm_x300_battery_critical(void) | ||
606 | { | ||
607 | #if defined(CONFIG_APM_EMULATION) | ||
608 | apm_queue_event(APM_CRITICAL_SUSPEND); | ||
609 | #endif | ||
610 | } | ||
611 | |||
612 | struct da9030_battery_info cm_x300_battery_info = { | ||
613 | .battery_info = &cm_x300_psy_info, | ||
614 | |||
615 | .charge_milliamp = 1000, | ||
616 | .charge_millivolt = 4200, | ||
617 | |||
618 | .vbat_low = 3600, | ||
619 | .vbat_crit = 3400, | ||
620 | .vbat_charge_start = 4100, | ||
621 | .vbat_charge_stop = 4200, | ||
622 | .vbat_charge_restart = 4000, | ||
623 | |||
624 | .vcharge_min = 3200, | ||
625 | .vcharge_max = 5500, | ||
626 | |||
627 | .tbat_low = 197, | ||
628 | .tbat_high = 78, | ||
629 | .tbat_restart = 100, | ||
630 | |||
631 | .batmon_interval = 0, | ||
632 | |||
633 | .battery_low = cm_x300_battery_low, | ||
634 | .battery_critical = cm_x300_battery_critical, | ||
635 | }; | ||
636 | |||
587 | /* DA9030 */ | 637 | /* DA9030 */ |
588 | struct da903x_subdev_info cm_x300_da9030_subdevs[] = { | 638 | struct da903x_subdev_info cm_x300_da9030_subdevs[] = { |
589 | { | 639 | { |
590 | .name = "da903x-backlight", | 640 | .name = "da903x-backlight", |
591 | .id = DA9030_ID_WLED, | 641 | .id = DA9030_ID_WLED, |
592 | } | 642 | }, |
643 | { | ||
644 | .name = "da903x-battery", | ||
645 | .id = DA9030_ID_BAT, | ||
646 | .platform_data = &cm_x300_battery_info, | ||
647 | }, | ||
593 | }; | 648 | }; |
594 | 649 | ||
595 | static struct da903x_platform_data cm_x300_da9030_info = { | 650 | static struct da903x_platform_data cm_x300_da9030_info = { |