rk3168:act8846:support act8846 pmic reset
author张晴 <zhangqing@rock-chips.com>
Wed, 16 Jan 2013 03:21:21 +0000 (11:21 +0800)
committer张晴 <zhangqing@rock-chips.com>
Wed, 16 Jan 2013 03:21:21 +0000 (11:21 +0800)
arch/arm/mach-rk30/board-pmu-act8846.c
arch/arm/mach-rk30/board-rk3168-tb.c
arch/arm/plat-rk/include/plat/sram.h
arch/arm/plat-rk/sram.c
drivers/regulator/Kconfig
drivers/regulator/act8846.c

index 42a78d2b9b752a64aaea62c5b4d3b0340ae141cc..6c7f416e8853050b807709ba97c326a28780ada5 100755 (executable)
@@ -16,26 +16,6 @@ static int act8846_set_init(struct act8846 *act8846)
        int i = 0;
        printk("%s,line=%d\n", __func__,__LINE__);
 
-       #ifdef CONFIG_RK_CONFIG
-       if(sram_gpio_init(get_port_config(pmic_slp).gpio, &pmic_sleep) < 0){
-               printk(KERN_ERR "sram_gpio_init failed\n");
-               return -EINVAL;
-       }
-       if(port_output_init(pmic_slp, 0, "pmic_slp") < 0){
-               printk(KERN_ERR "port_output_init failed\n");
-               return -EINVAL;
-       }
-       #else
-       if(sram_gpio_init(PMU_POWER_SLEEP, &pmic_sleep) < 0){
-               printk(KERN_ERR "sram_gpio_init failed\n");
-               return -EINVAL;
-       }
-
-       gpio_request(PMU_POWER_SLEEP, "NULL");
-       gpio_direction_output(PMU_POWER_SLEEP, GPIO_LOW);
-       #endif
-
-
        #ifndef CONFIG_RK_CONFIG
        g_pmic_type = PMIC_TYPE_ACT8846;
        #endif
@@ -66,8 +46,38 @@ static int act8846_set_init(struct act8846 *act8846)
                regulator_put(ldo);
        }
 
+       #ifdef CONFIG_RK_CONFIG
+       if(sram_gpio_init(get_port_config(pmic_slp).gpio, &pmic_sleep) < 0){
+               printk(KERN_ERR "sram_gpio_init failed\n");
+               return -EINVAL;
+       }
+       if(port_output_init(pmic_slp, 0, "pmic_slp") < 0){
+               printk(KERN_ERR "port_output_init failed\n");
+               return -EINVAL;
+       }
+       #else
+       if(sram_gpio_init(PMU_POWER_SLEEP, &pmic_sleep) < 0){
+               printk(KERN_ERR "sram_gpio_init failed\n");
+               return -EINVAL;
+       }
+       gpio_request(PMU_POWER_SLEEP, "NULL");
+       gpio_direction_output(PMU_POWER_SLEEP, GPIO_LOW);
+       
+       #ifdef CONFIG_ACT8846_SUPPORT_RESET
+       if(sram_gpio_init(PMU_VSEL, &pmic_vsel) < 0){
+               printk(KERN_ERR "sram_gpio_init failed\n");
+               return -EINVAL;
+       }
+       rk30_mux_api_set(GPIO3D3_PWM0_NAME,GPIO3D_GPIO3D3);
+       gpio_request(PMU_VSEL, "NULL");
+       gpio_direction_output(PMU_VSEL, GPIO_HIGH);
+       #endif
+       
+       #endif
+
        printk("%s,line=%d END\n", __func__,__LINE__);
        
+       
        return 0;
 }
 
@@ -432,9 +442,6 @@ void act8846_late_resume(struct early_suspend *h)
 {
 }
 #endif
-
-#endif
-
 void __sramfunc board_pmu_act8846_suspend(void)
 {      
        #ifdef CONFIG_CLK_SWITCH_TO_32K
@@ -449,4 +456,8 @@ void __sramfunc board_pmu_act8846_resume(void)
        #endif
 }
 
+#endif
+
+
+
 
index 8b1fa831c427eb884614f45c437625203ce68892..02c32d676ca77b19a3f3e3b0b40c5e210698e0ea 100755 (executable)
@@ -1561,7 +1561,7 @@ static  struct pmu_info  tps65910_ldo_info[] = {
 
 #ifdef CONFIG_REGULATOR_ACT8846
 #define PMU_POWER_SLEEP RK30_PIN0_PA1
-
+#define PMU_VSEL RK30_PIN3_PD3
 static struct pmu_info  act8846_dcdc_info[] = {
        {
                .name          = "act_dcdc1",   //ddr
@@ -1573,19 +1573,19 @@ static struct pmu_info  act8846_dcdc_info[] = {
                .name          = "vdd_core",    //logic
                .min_uv          = 1000000,
                .max_uv         = 1000000,
-               .suspend_vol  =  900000,
+               .suspend_vol  =  1000000,
        },
        {
                .name          = "vdd_cpu",   //arm
                .min_uv          = 1000000,
                .max_uv         = 1000000,
-               .suspend_vol  =  900000,
+               .suspend_vol  =  1000000,
        },
        {
                .name          = "act_dcdc4",   //vccio
                .min_uv          = 3000000,
                .max_uv         = 3000000,
-               .suspend_vol  =  2800000,
+               .suspend_vol  =  3000000,
        },
        
 };
index 51c520cb207642451eaf38b80d22cdcae888e776..3702b787e973079b6b60ae82e350e4ec576debe9 100755 (executable)
@@ -22,7 +22,7 @@ struct sram_gpio_data {
        uint offset;
 };
 
-extern struct sram_gpio_data __sramdata pmic_sleep;
+extern struct sram_gpio_data __sramdata pmic_sleep,pmic_vsel;
 int sram_gpio_init(int gpio, struct sram_gpio_data *data);
 void __sramfunc sram_gpio_set_value(struct sram_gpio_data data, uint value);
 
index f7455c55c4d3c304e060d6be9d1915bbfc587970..ec1cbadf93888e7d94d4197ba995792775c8b9bf 100755 (executable)
@@ -178,7 +178,7 @@ void __sramfunc sram_printhex(unsigned int hex)
        }
 }
 
-struct sram_gpio_data __sramdata pmic_sleep;
+struct sram_gpio_data __sramdata pmic_sleep,pmic_vsel;
 #if defined(CONFIG_ARCH_RK2928)
 static void __iomem *gpio_base[] = {RK2928_GPIO0_BASE, RK2928_GPIO1_BASE, RK2928_GPIO2_BASE, RK2928_GPIO3_BASE};
 #elif defined(CONFIG_ARCH_RK3066B) || defined(CONFIG_ARCH_RK3188)
index 8468f4f9ccd619f8cac455d810a98b41d1503359..e01f5afcb377335cf4f422cefd06b58963a4f0ca 100755 (executable)
@@ -288,6 +288,13 @@ config REGULATOR_ACT8846
        help
          Support the voltage and current regulators of the ACT8846 series of PMIC devices.
 
+config ACT8846_SUPPORT_RESET
+       tristate "ACT8846 PMIC SUPPORT RESET"
+       depends on REGULATOR_ACT8846=y
+       help
+         Support short press key to restart.
+
+
 config RK29_PWM_REGULATOR
        tristate "rk2918 pwm voltage regulator"
        help
index 9dbab96a36099ea2e17a97746a7474aa1185f7a3..181a9b502ab928922c44f782f01625f51391002a 100755 (executable)
@@ -323,7 +323,11 @@ static int act8846_dcdc_get_voltage(struct regulator_dev *dev)
        int buck = rdev_get_id(dev) - ACT8846_DCDC1;
        u16 reg = 0;
        int val;
+       #ifdef CONFIG_ACT8846_SUPPORT_RESET
+       reg = act8846_reg_read(act8846,(act8846_BUCK_SET_VOL_REG(buck)+0x1));
+       #else
        reg = act8846_reg_read(act8846,act8846_BUCK_SET_VOL_REG(buck));
+       #endif
        reg &= BUCK_VOL_MASK;
         DBG("%d\n", reg);
        val = 1000 * buck_voltage_map[reg];     
@@ -352,8 +356,13 @@ static int act8846_dcdc_set_voltage(struct regulator_dev *dev,
 
        if (vol_map[val] > max_vol)
                printk("WARNING:this voltage is not support!voltage set is %d mv\n",vol_map[val]);
-       ret = act8846_set_bits(act8846, act8846_BUCK_SET_VOL_REG(buck),
-               BUCK_VOL_MASK, val);
+
+       #ifdef CONFIG_ACT8846_SUPPORT_RESET
+       ret = act8846_set_bits(act8846, (act8846_BUCK_SET_VOL_REG(buck) +0x1),BUCK_VOL_MASK, val);
+       #else
+       ret = act8846_set_bits(act8846, act8846_BUCK_SET_VOL_REG(buck) ,BUCK_VOL_MASK, val);
+       #endif
+       
        return ret;
 }
 static int act8846_dcdc_set_sleep_voltage(struct regulator_dev *dev,
@@ -378,8 +387,12 @@ static int act8846_dcdc_set_sleep_voltage(struct regulator_dev *dev,
 
        if (vol_map[val] > max_vol)
                printk("WARNING:this voltage is not support!voltage set is %d mv\n",vol_map[val]);
-          ret = act8846_set_bits(act8846, (act8846_BUCK_SET_VOL_REG(buck) + 0x01),
-                                BUCK_VOL_MASK, val);
+       #ifdef CONFIG_ACT8846_SUPPORT_RESET
+        ret = act8846_set_bits(act8846, (act8846_BUCK_SET_VOL_REG(buck) ),BUCK_VOL_MASK, val);
+       #else
+       ret = act8846_set_bits(act8846, (act8846_BUCK_SET_VOL_REG(buck) +0x01),BUCK_VOL_MASK, val);
+       #endif
+       
        return ret;
 }
 static unsigned int act8846_dcdc_get_mode(struct regulator_dev *dev)