From 5898a6421c8ba36b0d2f12f911ec719978b1f05f Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E5=BC=A0=E6=99=B4?= Date: Wed, 19 Sep 2012 15:22:06 +0800 Subject: [PATCH] rk2928:a720:modify lcdc standby, compat act8931 and tps65910 shutdown device --- .../mach-rk2928/board-rk2928-a720-tps65910.c | 3 ++ arch/arm/mach-rk2928/board-rk2928-a720.c | 49 +++++++++++++++++-- .../mach-rk2928/board-rk2928-sdk-act8931.c | 19 ++----- drivers/regulator/act8931.c | 4 +- 4 files changed, 54 insertions(+), 21 deletions(-) diff --git a/arch/arm/mach-rk2928/board-rk2928-a720-tps65910.c b/arch/arm/mach-rk2928/board-rk2928-a720-tps65910.c index 6e9598fefc05..2ba0ed047506 100755 --- a/arch/arm/mach-rk2928/board-rk2928-a720-tps65910.c +++ b/arch/arm/mach-rk2928/board-rk2928-a720-tps65910.c @@ -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 diff --git a/arch/arm/mach-rk2928/board-rk2928-a720.c b/arch/arm/mach-rk2928/board-rk2928-a720.c index c5f0284fab63..b726b228026b 100755 --- a/arch/arm/mach-rk2928/board-rk2928-a720.c +++ b/arch/arm/mach-rk2928/board-rk2928-a720.c @@ -45,6 +45,7 @@ #include #include #include +#include #include #if defined(CONFIG_HDMI_RK30) #include "../../../drivers/video/rockchip/hdmi/rk_hdmi.h" @@ -57,6 +58,10 @@ #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(); diff --git a/arch/arm/mach-rk2928/board-rk2928-sdk-act8931.c b/arch/arm/mach-rk2928/board-rk2928-sdk-act8931.c index 9eec5f9eb930..1b2ae491c15d 100755 --- a/arch/arm/mach-rk2928/board-rk2928-sdk-act8931.c +++ b/arch/arm/mach-rk2928/board-rk2928-sdk-act8931.c @@ -6,25 +6,11 @@ #include #include -#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 diff --git a/drivers/regulator/act8931.c b/drivers/regulator/act8931.c index e35f17d46307..72ac5386f699 100755 --- a/drivers/regulator/act8931.c +++ b/drivers/regulator/act8931.c @@ -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); } -- 2.34.1