rk2926:m713:support reset to restart
author张晴 <zhangqing@rock-chips.com>
Sat, 20 Oct 2012 08:41:42 +0000 (16:41 +0800)
committer张晴 <zhangqing@rock-chips.com>
Sat, 20 Oct 2012 08:41:42 +0000 (16:41 +0800)
arch/arm/mach-rk2928/board-rk2926-sdk.c
arch/arm/mach-rk2928/board-rk2928-a720.c
arch/arm/mach-rk2928/board-rk2928-sdk.c
drivers/regulator/act8931.c
include/linux/regulator/act8931.h

index 800e4c2766a206300817bb389e8f78b290f91e83..b4c2cfa7810dfadf8aeb9d87d53bc902f395d348 100755 (executable)
@@ -830,6 +830,7 @@ static void rk2928_pm_power_off(void)
          if (pmic_is_act8931() ){
               if(act8931_charge_det)
                    arm_pm_restart(0, NULL);
+               act8931_device_shutdown();
          }
         #endif
        
index 41803c13fdababcc575ad25d5a8e0123765e0dbf..c670dafd803284c520f3d45224dabb0d05515ba7 100755 (executable)
@@ -861,6 +861,7 @@ static void rk2928_pm_power_off(void)
         {
               if(act8931_charge_det)
                    arm_pm_restart(0, NULL);
+                act8931_device_shutdown();
         }
         #endif
        
index 21665e45566ba6cd5407aaed0e2a31d9e1b13efb..09efefecd8b301b0c6b783b56121c7c6ec474227 100755 (executable)
@@ -855,8 +855,9 @@ static void rk2928_pm_power_off(void)
         {\r
                  #ifdef CONFIG_BATTERY_RK30_ADC_FAC\r
               if (gpio_get_value (rk30_adc_battery_platdata.dc_det_pin) == rk30_adc_battery_platdata.dc_det_level)//if(act8931_charge_det)\r
-                 #endif\r
-                   arm_pm_restart(0, NULL);\r
+               arm_pm_restart(0, NULL);\r
+                                #endif\r
+               act8931_device_shutdown();\r
         }\r
         #endif\r
        \r
index 5c7034c9f7178176b9f429148cfa9c7993bfbbef..71150124e7f4355253e99e2182c7985dcc1d7237 100755 (executable)
@@ -38,6 +38,8 @@
 #endif
 #define PM_CONTROL
 
+struct act8931 *g_act8931;
+
 struct act8931 {
        unsigned int irq;
        struct device *dev;
@@ -568,6 +570,25 @@ error:
        return err;
 }
 
+int act8931_device_shutdown(void)
+{
+       int ret;
+       int err = -1;
+       struct act8931 *act8931 = g_act8931;
+       
+       printk("%s\n",__func__);
+
+       ret = act8931_reg_read(act8931,0x01);
+       ret = act8931_set_bits(act8931, 0x01,(0x1<<5) |(0x3<<0),(0x1<<5) | (0x3<<0));
+       if (ret < 0) {
+               printk("act8931 set 0x00 error!\n");
+               return err;
+       }
+       return 0;       
+}
+EXPORT_SYMBOL_GPL(act8931_device_shutdown);
+
+
 static irqreturn_t act8931_irq_thread(unsigned int irq, void *dev_id)
 {
        struct act8931 *act8931 = (struct act8931 *)dev_id;
@@ -624,6 +645,17 @@ static int __devinit act8931_i2c_probe(struct i2c_client *i2c, const struct i2c_
                        goto err;
        } else
                dev_warn(act8931->dev, "No platform init data supplied\n");
+
+       ret = act8931_reg_read(act8931,0x01);
+       if (ret < 0)            
+                       goto err;
+       ret = act8931_set_bits(act8931, 0x01,(0x1<<0),(0x1<<0));
+       if (ret < 0) {
+               printk("act8931 set 0x01 error!\n");
+               goto err;
+       }
+       
+       g_act8931 = act8931;
        
        pdata->set_init(act8931);
 
index ba0259eb9a466475f119d49fc07641fef25bfa6e..ac3421fd4718ce2cd77ebceb019715e55203e508 100755 (executable)
@@ -59,6 +59,8 @@ struct act8931;
 #define VOL_MIN_IDX 0x00
 #define VOL_MAX_IDX 0x3f
 
+int act8931_device_shutdown(void);
+
 struct act8931_regulator_subdev {
        int id;
        struct regulator_init_data *initdata;