add cw2015 support to board-rk3168-tb
authorxuhuicong <xhc@rock-chips.com>
Fri, 22 Mar 2013 01:56:00 +0000 (09:56 +0800)
committerxuhuicong <xhc@rock-chips.com>
Fri, 22 Mar 2013 01:56:00 +0000 (09:56 +0800)
arch/arm/mach-rk30/board-rk3168-tb.c

index 5a115778937d53aebf3b19bf6a1dde6b3f607cfe..0d86d61e5b7b2f897f22fed67d805af9bd0668f2 100755 (executable)
@@ -48,6 +48,9 @@
 #include <linux/regulator/act8846.h>
 #include <linux/regulator/rk29-pwm-regulator.h>
 
+#ifdef CONFIG_CW2015_BATTERY
+#include <linux/power/cw2015_battery.h>
+#endif
 #if defined(CONFIG_MFD_RK610)
 #include <linux/mfd/rk610_core.h>
 #endif
@@ -1054,6 +1057,41 @@ static struct platform_device rk30_device_adc_battery = {
                 .platform_data = &rk30_adc_battery_platdata,
         },
 };
+#endif
+#ifdef CONFIG_CW2015_BATTERY
+/*
+   note the follow array must set depend on the battery that you use
+   you must send the battery to cellwise-semi the contact information:
+   name: chen gan; tel:13416876079; E-mail: ben.chen@cellwise-semi.com
+ */
+static u8 config_info[SIZE_BATINFO] = {
+       0x15, 0x42, 0x60, 0x59, 0x52,
+       0x58, 0x4D, 0x48, 0x48, 0x44,
+       0x44, 0x46, 0x49, 0x48, 0x32,
+       0x24, 0x20, 0x17, 0x13, 0x0F,
+       0x19, 0x3E, 0x51, 0x45, 0x08,
+       0x76, 0x0B, 0x85, 0x0E, 0x1C,
+       0x2E, 0x3E, 0x4D, 0x52, 0x52,
+       0x57, 0x3D, 0x1B, 0x6A, 0x2D,
+       0x25, 0x43, 0x52, 0x87, 0x8F,
+       0x91, 0x94, 0x52, 0x82, 0x8C,
+       0x92, 0x96, 0xFF, 0x7B, 0xBB,
+       0xCB, 0x2F, 0x7D, 0x72, 0xA5,
+       0xB5, 0xC1, 0x46, 0xAE
+};
+
+static struct cw_bat_platform_data cw_bat_platdata = {
+       .dc_det_pin      = RK30_PIN0_PB2,
+        .bat_low_pin    = RK30_PIN0_PB1,
+        .chg_ok_pin   = RK30_PIN0_PA6,
+        .dc_det_level    = GPIO_LOW,
+        .bat_low_level  = GPIO_LOW,   
+        .chg_ok_level = GPIO_HIGH,
+
+        .cw_bat_config_info     = config_info,
+
+};
+
 #endif
 #ifdef CONFIG_RK30_PWM_REGULATOR
 static int pwm_voltage_map[] = {
@@ -1783,6 +1821,14 @@ static struct i2c_board_info __initdata i2c1_info[] = {
                .flags                  = 0,
                .irq            = RK30_PIN1_PA4,
        },
+#if defined (CONFIG_CW2015_BATTERY)
+        {
+                .type           = "cw201x",
+                .addr           = 0x62,
+                .flags          = 0,
+                .platform_data  = &cw_bat_platdata,
+        },
+#endif
 #endif
 
 };