From 0ade95b87310522d071fa7374324f746b2be296b Mon Sep 17 00:00:00 2001
From: clb <clb@rock-chips.com>
Date: Fri, 29 Jul 2011 17:07:45 +0800
Subject: [PATCH] bq27541 board

---
 arch/arm/mach-rk29/board-rk29-newton.c | 27 ++++++++++++++++++++++++++
 drivers/misc/newton.c                  |  6 ++++++
 2 files changed, 33 insertions(+)

diff --git a/arch/arm/mach-rk29/board-rk29-newton.c b/arch/arm/mach-rk29/board-rk29-newton.c
index 03b2837c2a43..beaa239fbb25 100755
--- a/arch/arm/mach-rk29/board-rk29-newton.c
+++ b/arch/arm/mach-rk29/board-rk29-newton.c
@@ -838,6 +838,25 @@ struct bq27510_platform_data bq27510_info = {
 };
 #endif
 
+#if defined (CONFIG_BATTERY_BQ27541)
+#define	DC_CHECK_PIN	RK29_PIN4_PA1
+#define	LI_LION_BAT_NUM	1
+static int bq27541_init_dc_check_pin(void){	
+	if(gpio_request(DC_CHECK_PIN,"dc_check") != 0){      
+		gpio_free(DC_CHECK_PIN);      
+		printk("bq27541 init dc check pin request error\n");      
+		return -EIO;    
+	}	
+	gpio_direction_input(DC_CHECK_PIN);	
+	return 0;
+}
+
+struct bq27541_platform_data bq27541_info = {	
+	.init_dc_check_pin = bq27541_init_dc_check_pin,	
+	.dc_check_pin =  DC_CHECK_PIN,		
+	.bat_num = LI_LION_BAT_NUM,
+};
+#endif
 
 /*****************************************************************************************
  * i2c devices
@@ -1143,6 +1162,14 @@ static struct i2c_board_info __initdata board_i2c2_devices[] = {
 
 #ifdef CONFIG_I2C3_RK29
 static struct i2c_board_info __initdata board_i2c3_devices[] = {
+	#if defined (CONFIG_BATTERY_BQ27541)
+	{
+		.type    		= "bq27541",
+		.addr           = 0x55,
+		.flags			= 0,
+		.platform_data  = &bq27541_info,
+	},
+#endif
 };
 #endif
 
diff --git a/drivers/misc/newton.c b/drivers/misc/newton.c
index a04288d7173c..dcc7b7256de7 100755
--- a/drivers/misc/newton.c
+++ b/drivers/misc/newton.c
@@ -131,12 +131,15 @@ int rk29_newton_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
             if(copy_to_user(argp, &sn.UID_Data, sizeof(sn.UID_Data)))  return -EFAULT;
     	}
 		break;
+/*		
 	case NEWTON_AC_DETEC:
 		{
 			int ac_status = rk29_newton_get_ac_status();
 			if(copy_to_user(argp, &ac_status, 4))  return -EFAULT;
 		}
 		break;
+*/
+
 	case NEWTON_GPS_CTRL:
 		{
 			int value = 0;
@@ -202,11 +205,14 @@ static int rk29_newton_probe(struct platform_device *pdev)
 	  printk("gpio_request NEWTON_GPIO_GPS_PWR error\n");
 	  return -EIO;
 	}
+	
+/*
 	if(gpio_request(NEWTON_GPIO_AC_DETEC,NULL) != 0){
 	  gpio_free(NEWTON_GPIO_AC_DETEC);
 	  printk("gpio_request NEWTON_GPIO_AC_DETEC error\n");
 	  return -EIO;
 	}
+*/
 	rk29_newton_set_gps_power(GPIO_LOW);
 	DBG("%s:rk29 newton initialized\n",__FUNCTION__);
 	return ret;
-- 
2.34.1