From 02c4f432f27e301345fe639bc9ff53e56c929ec3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E5=BC=A0=E6=99=B4?= Date: Sat, 20 Oct 2012 16:41:42 +0800 Subject: [PATCH] rk2926:m713:support reset to restart --- arch/arm/mach-rk2928/board-rk2926-sdk.c | 1 + arch/arm/mach-rk2928/board-rk2928-a720.c | 1 + arch/arm/mach-rk2928/board-rk2928-sdk.c | 5 ++-- drivers/regulator/act8931.c | 32 ++++++++++++++++++++++++ include/linux/regulator/act8931.h | 2 ++ 5 files changed, 39 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-rk2928/board-rk2926-sdk.c b/arch/arm/mach-rk2928/board-rk2926-sdk.c index 800e4c2766a2..b4c2cfa7810d 100755 --- a/arch/arm/mach-rk2928/board-rk2926-sdk.c +++ b/arch/arm/mach-rk2928/board-rk2926-sdk.c @@ -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 diff --git a/arch/arm/mach-rk2928/board-rk2928-a720.c b/arch/arm/mach-rk2928/board-rk2928-a720.c index 41803c13fdab..c670dafd8032 100755 --- a/arch/arm/mach-rk2928/board-rk2928-a720.c +++ b/arch/arm/mach-rk2928/board-rk2928-a720.c @@ -861,6 +861,7 @@ static void rk2928_pm_power_off(void) { if(act8931_charge_det) arm_pm_restart(0, NULL); + act8931_device_shutdown(); } #endif diff --git a/arch/arm/mach-rk2928/board-rk2928-sdk.c b/arch/arm/mach-rk2928/board-rk2928-sdk.c index 21665e45566b..09efefecd8b3 100755 --- a/arch/arm/mach-rk2928/board-rk2928-sdk.c +++ b/arch/arm/mach-rk2928/board-rk2928-sdk.c @@ -855,8 +855,9 @@ static void rk2928_pm_power_off(void) { #ifdef CONFIG_BATTERY_RK30_ADC_FAC if (gpio_get_value (rk30_adc_battery_platdata.dc_det_pin) == rk30_adc_battery_platdata.dc_det_level)//if(act8931_charge_det) - #endif - arm_pm_restart(0, NULL); + arm_pm_restart(0, NULL); + #endif + act8931_device_shutdown(); } #endif diff --git a/drivers/regulator/act8931.c b/drivers/regulator/act8931.c index 5c7034c9f717..71150124e7f4 100755 --- a/drivers/regulator/act8931.c +++ b/drivers/regulator/act8931.c @@ -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); diff --git a/include/linux/regulator/act8931.h b/include/linux/regulator/act8931.h index ba0259eb9a46..ac3421fd4718 100755 --- a/include/linux/regulator/act8931.h +++ b/include/linux/regulator/act8931.h @@ -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; -- 2.34.1