rk3288:pmic:act8846:support act8846 device shutdown
author张晴 <zhangqing@rock-chips.com>
Thu, 15 May 2014 08:31:23 +0000 (16:31 +0800)
committer张晴 <zhangqing@rock-chips.com>
Thu, 15 May 2014 08:31:23 +0000 (16:31 +0800)
arch/arm/boot/dts/rk3288-tb.dts
arch/arm/configs/rockchip_defconfig
drivers/regulator/act8846.c
include/linux/regulator/act8846.h

index e9f787f4605f03027d496fd228e88ca53fc85f65..23ec27379ef23750f4a9ecb1cf12d67bff781930 100755 (executable)
@@ -726,6 +726,7 @@ rockchip,power_type = <GPIO>;
 /include/ "act8846.dtsi"
 &act8846 {
        gpios =<&gpio7 GPIO_A1 GPIO_ACTIVE_LOW>,<&gpio0 GPIO_B2 GPIO_ACTIVE_HIGH>;
+       act8846,system-power-controller;
 
        regulators {
                
index 690a64f7dca1993c948c878d452fe632479200c9..a211f5651946f03994fa4fb3f397355e3abfe9e2 100755 (executable)
@@ -333,6 +333,7 @@ CONFIG_MFD_RICOH619=y
 CONFIG_REGULATOR=y
 CONFIG_REGULATOR_FIXED_VOLTAGE=y
 CONFIG_REGULATOR_ACT8846=y
+CONFIG_ACT8846_SUPPORT_RESET=y
 CONFIG_ROCKCHIP_PWM_REGULATOR=y
 CONFIG_REGULATOR_SYR82X=y
 CONFIG_REGULATOR_RICOH619=y
index 15db2a2a71a6f507f3fcd5cf25225ad529f44957..0903b63a1e887d88a7302413417451242bf244bf 100755 (executable)
@@ -779,6 +779,7 @@ static struct act8846_board *act8846_parse_dt(struct act8846 *act8846)
                if (!gpio_is_valid(gpio)) 
                        printk("invalid gpio: %d\n",gpio);
        pdata->pmic_hold_gpio = gpio;   
+       pdata->pm_off = of_property_read_bool(act8846_pmic_np,"act8846,system-power-controller");
 
        return pdata;
 }
@@ -798,7 +799,11 @@ int act8846_device_shutdown(void)
        struct act8846 *act8846 = g_act8846;
        
        printk("%s\n",__func__);
-
+#if 1
+       if (act8846->pmic_hold_gpio) {
+                       gpio_direction_output(act8846->pmic_hold_gpio,0);
+       }
+#else
        ret = act8846_reg_read(act8846,0xc3);
        ret = act8846_set_bits(act8846, 0xc3,(0x1<<3),(0x1<<3));
        ret = act8846_set_bits(act8846, 0xc3,(0x1<<4),(0x1<<4));
@@ -806,6 +811,7 @@ int act8846_device_shutdown(void)
                printk("act8846 set 0xc3 error!\n");
                return err;
        }
+#endif
        return 0;       
 }
 EXPORT_SYMBOL_GPL(act8846_device_shutdown);
@@ -923,7 +929,7 @@ static int act8846_i2c_probe(struct i2c_client *i2c, const struct i2c_device_id
                        }
                        gpio_direction_output(act8846->pmic_hold_gpio,1);
                        ret = gpio_get_value(act8846->pmic_hold_gpio);
-                       gpio_free(act8846->pmic_hold_gpio);
+       //              gpio_free(act8846->pmic_hold_gpio);
                        printk("%s: act8846_pmic_hold=%x\n", __func__, ret);
        }
        #endif
@@ -977,6 +983,10 @@ static int act8846_i2c_probe(struct i2c_client *i2c, const struct i2c_device_id
                act8846->rdev[i] = act_rdev;
                }
        }
+
+       if (pdev->pm_off && !pm_power_off) {
+               pm_power_off = act8846_device_shutdown;
+       }
        
        #ifdef CONFIG_HAS_EARLYSUSPEND
        act8846->act8846_suspend.suspend = act8846_early_suspend,
index a2679afe25a2518fd5bb4914cf34a99d21c92001..866291fbd3bb3e486ce4f067ba9a82656adf22b7 100755 (executable)
@@ -40,6 +40,7 @@ struct act8846_board {
        unsigned int dcdc_mode[3]; /* buckx_voltage in uV */
        bool pmic_sleep;
        unsigned int ldo_slp_voltage[7];
+       bool pm_off;
 };
 
 struct act8846_regulator_subdev {