From 378314b243c5a24260d89c89d29a472ab5a8b0ca Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E5=BC=A0=E6=99=B4?= Date: Thu, 27 Mar 2014 11:28:44 +0800 Subject: [PATCH] rk3288:rk808:support rk808 power off --- arch/arm/boot/dts/rk3288-tb.dts | 1 + drivers/mfd/rk808.c | 7 ++++++- include/linux/mfd/rk808.h | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/arch/arm/boot/dts/rk3288-tb.dts b/arch/arm/boot/dts/rk3288-tb.dts index c65b0143f7e8..109e24170a40 100755 --- a/arch/arm/boot/dts/rk3288-tb.dts +++ b/arch/arm/boot/dts/rk3288-tb.dts @@ -595,6 +595,7 @@ rockchip,power_type = ; /include/ "rk808.dtsi" &rk808 { gpios =<&gpio0 GPIO_A4 GPIO_ACTIVE_HIGH>,<&gpio0 GPIO_B3 GPIO_ACTIVE_LOW>; + rk808,system-power-controller; regulators { diff --git a/drivers/mfd/rk808.c b/drivers/mfd/rk808.c index 0ba09d08553f..87691a6df99d 100755 --- a/drivers/mfd/rk808.c +++ b/drivers/mfd/rk808.c @@ -1053,6 +1053,8 @@ static struct rk808_board *rk808_parse_dt(struct rk808 *rk808) printk("invalid gpio: %d\n", pdata->pmic_sleep_gpio); } pdata->pmic_sleep = true; + + pdata->pm_off = of_property_read_bool(rk808_pmic_np,"rk808,system-power-controller"); return pdata; } @@ -1065,7 +1067,7 @@ static struct rk808_board *rk808_parse_dt(struct i2c_client *i2c) #endif -int rk808_device_shutdown(void) +static int rk808_device_shutdown(void) { int ret; int err = -1; @@ -1372,6 +1374,9 @@ static int rk808_i2c_probe(struct i2c_client *i2c, const struct i2c_device_id *i /*********************************************/ g_rk808 = rk808; + if (pdev->pm_off && !pm_power_off) { + pm_power_off = rk808_device_shutdown; + } #ifdef CONFIG_HAS_EARLYSUSPEND rk808->rk808_suspend.suspend = rk808_early_suspend, diff --git a/include/linux/mfd/rk808.h b/include/linux/mfd/rk808.h index f69a64e05e77..b79b7f5b2250 100755 --- a/include/linux/mfd/rk808.h +++ b/include/linux/mfd/rk808.h @@ -132,6 +132,7 @@ struct rk808_board { unsigned int dcdc_slp_voltage[3]; /* buckx_voltage in uV */ bool pmic_sleep; unsigned int ldo_slp_voltage[7]; + bool pm_off; }; struct rk808_regulator_subdev { @@ -185,7 +186,6 @@ int rk808_bulk_read(struct rk808 *rk808, u8 reg, int count, u8 *buf); int rk808_bulk_write(struct rk808 *rk808, u8 reg, int count, u8 *buf); -int rk808_device_shutdown(void); #endif -- 2.34.1