diff options
author | MyungJoo Ham <myungjoo.ham@samsung.com> | 2011-07-20 11:31:27 -0400 |
---|---|---|
committer | Kukjin Kim <kgene.kim@samsung.com> | 2011-07-20 12:46:42 -0400 |
commit | 605baf670e9b9900e169c516a650764db39f55c4 (patch) | |
tree | 13a11a33a368e0c912a7dcb8b172859a90e4dba4 | |
parent | ed9ba31f6b9fb80b07d27efa87b1f1f374db927c (diff) |
ARM: EXYNOS4: configure MAX8903 secondary charger on NURI
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
-rw-r--r-- | arch/arm/mach-exynos4/mach-nuri.c | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/arch/arm/mach-exynos4/mach-nuri.c b/arch/arm/mach-exynos4/mach-nuri.c index d0999519e9ac..002549bf5260 100644 --- a/arch/arm/mach-exynos4/mach-nuri.c +++ b/arch/arm/mach-exynos4/mach-nuri.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/i2c-gpio.h> | 16 | #include <linux/i2c-gpio.h> |
17 | #include <linux/gpio_keys.h> | 17 | #include <linux/gpio_keys.h> |
18 | #include <linux/gpio.h> | 18 | #include <linux/gpio.h> |
19 | #include <linux/power/max8903_charger.h> | ||
19 | #include <linux/power/max17042_battery.h> | 20 | #include <linux/power/max17042_battery.h> |
20 | #include <linux/regulator/machine.h> | 21 | #include <linux/regulator/machine.h> |
21 | #include <linux/regulator/fixed.h> | 22 | #include <linux/regulator/fixed.h> |
@@ -59,6 +60,7 @@ | |||
59 | 60 | ||
60 | enum fixed_regulator_id { | 61 | enum fixed_regulator_id { |
61 | FIXED_REG_ID_MMC = 0, | 62 | FIXED_REG_ID_MMC = 0, |
63 | FIXED_REG_ID_MAX8903, | ||
62 | }; | 64 | }; |
63 | 65 | ||
64 | static struct s3c2410_uartcfg nuri_uartcfgs[] __initdata = { | 66 | static struct s3c2410_uartcfg nuri_uartcfgs[] __initdata = { |
@@ -981,10 +983,70 @@ static struct i2c_board_info i2c9_devs[] __initdata = { | |||
981 | }, | 983 | }, |
982 | }; | 984 | }; |
983 | 985 | ||
986 | /* MAX8903 Secondary Charger */ | ||
987 | static struct regulator_consumer_supply supplies_max8903[] = { | ||
988 | REGULATOR_SUPPLY("vinchg2", "charger-manager.0"), | ||
989 | }; | ||
990 | |||
991 | static struct regulator_init_data max8903_charger_en_data = { | ||
992 | .constraints = { | ||
993 | .name = "VOUT_CHARGER", | ||
994 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
995 | .boot_on = 1, | ||
996 | }, | ||
997 | .num_consumer_supplies = ARRAY_SIZE(supplies_max8903), | ||
998 | .consumer_supplies = supplies_max8903, | ||
999 | }; | ||
1000 | |||
1001 | static struct fixed_voltage_config max8903_charger_en = { | ||
1002 | .supply_name = "VOUT_CHARGER", | ||
1003 | .microvolts = 5000000, /* Assume 5VDC */ | ||
1004 | .gpio = EXYNOS4_GPY4(5), /* TA_EN negaged */ | ||
1005 | .enable_high = 0, /* Enable = Low */ | ||
1006 | .enabled_at_boot = 1, | ||
1007 | .init_data = &max8903_charger_en_data, | ||
1008 | }; | ||
1009 | |||
1010 | static struct platform_device max8903_fixed_reg_dev = { | ||
1011 | .name = "reg-fixed-voltage", | ||
1012 | .id = FIXED_REG_ID_MAX8903, | ||
1013 | .dev = { .platform_data = &max8903_charger_en }, | ||
1014 | }; | ||
1015 | |||
1016 | static struct max8903_pdata nuri_max8903 = { | ||
1017 | /* | ||
1018 | * cen: don't control with the driver, let it be | ||
1019 | * controlled by regulator above | ||
1020 | */ | ||
1021 | .dok = EXYNOS4_GPX1(4), /* TA_nCONNECTED */ | ||
1022 | /* uok, usus: not connected */ | ||
1023 | .chg = EXYNOS4_GPE2(0), /* TA_nCHG */ | ||
1024 | /* flt: vcc_1.8V_pda */ | ||
1025 | .dcm = EXYNOS4_GPL0(1), /* CURR_ADJ */ | ||
1026 | |||
1027 | .dc_valid = true, | ||
1028 | .usb_valid = false, /* USB is not wired to MAX8903 */ | ||
1029 | }; | ||
1030 | |||
1031 | static struct platform_device nuri_max8903_device = { | ||
1032 | .name = "max8903-charger", | ||
1033 | .dev = { | ||
1034 | .platform_data = &nuri_max8903, | ||
1035 | }, | ||
1036 | }; | ||
1037 | |||
1038 | static struct device *nuri_cm_devices[] = { | ||
1039 | &s3c_device_i2c5.dev, | ||
1040 | &s3c_device_adc.dev, | ||
1041 | NULL, /* Reserved for UART */ | ||
1042 | NULL, | ||
1043 | }; | ||
1044 | |||
984 | static void __init nuri_power_init(void) | 1045 | static void __init nuri_power_init(void) |
985 | { | 1046 | { |
986 | int gpio; | 1047 | int gpio; |
987 | int irq_base = IRQ_GPIO_END + 1; | 1048 | int irq_base = IRQ_GPIO_END + 1; |
1049 | int ta_en = 0; | ||
988 | 1050 | ||
989 | nuri_max8997_pdata.irq_base = irq_base; | 1051 | nuri_max8997_pdata.irq_base = irq_base; |
990 | irq_base += MAX8997_IRQ_NR; | 1052 | irq_base += MAX8997_IRQ_NR; |
@@ -998,6 +1060,20 @@ static void __init nuri_power_init(void) | |||
998 | gpio_request(gpio, "FUEL_ALERT"); | 1060 | gpio_request(gpio, "FUEL_ALERT"); |
999 | s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf)); | 1061 | s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf)); |
1000 | s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE); | 1062 | s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE); |
1063 | |||
1064 | gpio = nuri_max8903.dok; | ||
1065 | gpio_request(gpio, "TA_nCONNECTED"); | ||
1066 | s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf)); | ||
1067 | s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE); | ||
1068 | ta_en = gpio_get_value(gpio) ? 0 : 1; | ||
1069 | |||
1070 | gpio = nuri_max8903.chg; | ||
1071 | gpio_request(gpio, "TA_nCHG"); | ||
1072 | gpio_direction_input(gpio); | ||
1073 | |||
1074 | gpio = nuri_max8903.dcm; | ||
1075 | gpio_request(gpio, "CURR_ADJ"); | ||
1076 | gpio_direction_output(gpio, ta_en); | ||
1001 | } | 1077 | } |
1002 | 1078 | ||
1003 | /* USB EHCI */ | 1079 | /* USB EHCI */ |
@@ -1028,6 +1104,8 @@ static struct platform_device *nuri_devices[] __initdata = { | |||
1028 | &nuri_gpio_keys, | 1104 | &nuri_gpio_keys, |
1029 | &nuri_lcd_device, | 1105 | &nuri_lcd_device, |
1030 | &nuri_backlight_device, | 1106 | &nuri_backlight_device, |
1107 | &max8903_fixed_reg_dev, | ||
1108 | &nuri_max8903_device, | ||
1031 | }; | 1109 | }; |
1032 | 1110 | ||
1033 | static void __init nuri_map_io(void) | 1111 | static void __init nuri_map_io(void) |