rk2928:a720:modify lcdc standby, compat act8931 and tps65910 shutdown device
author张晴 <zhangqing@rock-chips.com>
Wed, 19 Sep 2012 07:22:06 +0000 (15:22 +0800)
committer张晴 <zhangqing@rock-chips.com>
Wed, 19 Sep 2012 07:22:06 +0000 (15:22 +0800)
arch/arm/mach-rk2928/board-rk2928-a720-tps65910.c
arch/arm/mach-rk2928/board-rk2928-a720.c
arch/arm/mach-rk2928/board-rk2928-sdk-act8931.c
drivers/regulator/act8931.c

index 6e9598fefc05c4fac6bd69f6d847aa13a4771876..2ba0ed047506f08fe467bc113519f39b286f5a04 100755 (executable)
@@ -252,6 +252,9 @@ int tps65910_post_init(struct tps65910 *tps65910)
        struct regulator *ldo;
        printk("%s,line=%d\n", __func__,__LINE__);
 
+       g_pmic_type = PMIC_TYPE_TPS65910;
+       printk("%s:g_pmic_type=%d\n",__func__,g_pmic_type);
+
        #ifdef CONFIG_RK30_PWM_REGULATOR
        platform_device_register(&pwm_regulator_device[0]);
        #endif
index c5f0284fab63d95a9b57f221e579e442a3b82309..b726b228026b3f3a6c9c9f0ecee0b4219cd8c362 100755 (executable)
@@ -45,6 +45,7 @@
 #include <linux/rfkill-rk.h>
 #include <linux/sensor-dev.h>
 #include <linux/mfd/tps65910.h>
+#include <linux/regulator/act8931.h>
 #include <linux/regulator/rk29-pwm-regulator.h>
 #if defined(CONFIG_HDMI_RK30)
        #include "../../../drivers/video/rockchip/hdmi/rk_hdmi.h"
 #include "board-rk2928-a720-camera.c" 
 #include "board-rk2928-a720-key.c"
 
+int __sramdata g_pmic_type =  0;
+#define PMIC_TYPE_TPS65910     2
+#define PMIC_TYPE_ACT8931      3
+
 #ifdef  CONFIG_THREE_FB_BUFFER
 #define RK30_FB0_MEM_SIZE 12*SZ_1M
 #else
@@ -121,7 +126,18 @@ static int rk29_backlight_pwm_suspend(void)
                printk("func %s, line %d: request gpio fail\n", __FUNCTION__, __LINE__);
                return -1;
        }
-       gpio_direction_output(PWM_GPIO, GPIO_LOW);
+       #if defined(CONFIG_MFD_TPS65910)        
+       if(g_pmic_type == PMIC_TYPE_TPS65910)
+       {
+               gpio_direction_output(PWM_GPIO, GPIO_LOW);
+       }
+       #endif
+       #if defined(CONFIG_REGULATOR_ACT8931)
+       if(g_pmic_type == PMIC_TYPE_ACT8931)
+       {
+               gpio_direction_output(PWM_GPIO, GPIO_HIGH);
+       }
+       #endif
 #ifdef  LCD_DISP_ON_PIN
        gpio_direction_output(BL_EN_PIN, 0);
        gpio_set_value(BL_EN_PIN, !BL_EN_VALUE);
@@ -191,11 +207,34 @@ static int rk_fb_io_init(struct rk29_fb_setting_info *fb_setting)
 }
 static int rk_fb_io_disable(void)
 {
+
+       #if defined(CONFIG_REGULATOR_ACT8931)
+       if(g_pmic_type == PMIC_TYPE_ACT8931)
+       {
+               struct regulator *ldo;
+               ldo = regulator_get(NULL, "act_ldo4");   //vcc_lcd
+               regulator_disable(ldo);
+               regulator_put(ldo);
+               udelay(100);
+       }
+       #endif
         gpio_set_value(LCD_EN, !LCD_EN_VALUE);
        return 0;
 }
 static int rk_fb_io_enable(void)
 {
+       #if defined(CONFIG_REGULATOR_ACT8931)
+       if(g_pmic_type == PMIC_TYPE_ACT8931)
+       {
+               struct regulator *ldo;
+               ldo = regulator_get(NULL, "act_ldo4");   //vcc_lcd
+               regulator_enable(ldo);
+               regulator_put(ldo);
+               udelay(100);
+               msleep(300);    // wait for powering on LED circuit
+       }
+       #endif
+
         gpio_set_value(LCD_EN, LCD_EN_VALUE);
        return 0;
 }
@@ -661,8 +700,11 @@ static void rk2928_pm_power_off(void)
 {
        printk(KERN_ERR "rk2928_pm_power_off start...\n");
        
-       #if defined(CONFIG_MFD_TPS65910)
+       #if defined(CONFIG_MFD_TPS65910)        
+       if(g_pmic_type == PMIC_TYPE_TPS65910)
+       {
                tps65910_device_shutdown();//tps65910 shutdown
+       }
        #endif
        gpio_direction_output(POWER_ON_PIN, GPIO_LOW);
        
@@ -672,8 +714,7 @@ static void __init rk2928_board_init(void)
 {
        gpio_request(POWER_ON_PIN, "poweronpin");
        gpio_direction_output(POWER_ON_PIN, GPIO_HIGH);
-        gpio_free(POWER_ON_PIN);
-       
        pm_power_off = rk2928_pm_power_off;
        
        rk30_i2c_register_board_info();
index 9eec5f9eb93041b18b37ece655558257e6e2d1cc..1b2ae491c15d1ab55271a64643e03ad0629f6aa6 100755 (executable)
@@ -6,25 +6,11 @@
 #include <mach/gpio.h>
 #include <mach/iomux.h>
 
-#define gpio_readl(offset)     readl_relaxed(RK2928_GPIO3_BASE + offset)
-#define gpio_writel(v, offset) do { writel_relaxed(v, RK2928_GPIO3_BASE + offset); dsb(); } while (0)
-
-#define GPIO_SWPORTA_DR  0x0000
-#define GPIO_SWPORTA_DDR 0x0004
-
-#define GPIO3_D2_OUTPUT  (1<<26)
-#define GPIO3_D2_OUTPUT_HIGH  (1<<26)
-#define GPIO3_D2_OUTPUT_LOW  (~(1<<26))
-
 #ifdef CONFIG_REGULATOR_ACT8931
-#define PMU_POWER_SLEEP RK2928_PIN3_PD2        
+
 extern int platform_device_register(struct platform_device *pdev);
 
 int act8931_pre_init(struct act8931 *act8931){
-
-       int val = 0;
-       int i   = 0;
-       int err = -1;
                
        printk("%s,line=%d\n", __func__,__LINE__);      
        
@@ -36,6 +22,9 @@ int act8931_set_init(struct act8931 *act8931)
        struct regulator *ldo;
        printk("%s,line=%d\n", __func__,__LINE__);
 
+       g_pmic_type = PMIC_TYPE_ACT8931;
+       printk("%s:g_pmic_type=%d\n",__func__,g_pmic_type);
+
        #ifdef CONFIG_RK30_PWM_REGULATOR
        platform_device_register(&pwm_regulator_device[0]);
        #endif
index e35f17d463070e09b4a6ecc9718ec57baf3881a4..72ac5386f699fcda795aed041bd47ccb46da22ad 100755 (executable)
@@ -144,7 +144,7 @@ static int act8931_ldo_enable(struct regulator_dev *dev)
        struct act8931 *act8931 = rdev_get_drvdata(dev);
        int ldo= rdev_get_id(dev) -ACT8931_LDO1;
        u16 mask=0x80;  
-       int ret;
+
        return act8931_set_bits(act8931, act8931_LDO_CONTR_REG(ldo), mask, 0x80);
        
 }
@@ -153,7 +153,7 @@ static int act8931_ldo_disable(struct regulator_dev *dev)
        struct act8931 *act8931 = rdev_get_drvdata(dev);
        int ldo= rdev_get_id(dev) -ACT8931_LDO1;
        u16 mask=0x80;
-       int ret;
+       
        return act8931_set_bits(act8931, act8931_LDO_CONTR_REG(ldo), mask, 0);
 
 }