static void rk30_pm_power_off(void)
{
printk(KERN_ERR "rk30_pm_power_off start...\n");
+ #if defined(CONFIG_MFD_WM831X)
+ if(pmic_is_wm8326()){
+ wm831x_set_bits(Wm831x,WM831X_GPIO_LEVEL,0x0001,0x0000); //set sys_pwr 0
+ wm831x_device_shutdown(Wm831x);//wm8326 shutdown
+ }
+ #endif
+
+ #if defined(CONFIG_REGULATOR_ACT8846)
+ if(pmic_is_act8846())
+ {
+ act8846_device_shutdown();
+ }
+ #endif
+
+ #if defined(CONFIG_MFD_TPS65910)
+ if(pmic_is_tps65910())
+ {
+ tps65910_device_shutdown();//tps65910 shutdown
+ }
+ #endif
+
gpio_direction_output(POWER_ON_PIN, GPIO_LOW);
-#if defined(CONFIG_MFD_WM831X)
- wm831x_set_bits(Wm831x,WM831X_GPIO_LEVEL,0x0001,0x0000); //set sys_pwr 0
- wm831x_device_shutdown(Wm831x);//wm8326 shutdown
-#endif
while (1);
}
#include <linux/delay.h>
#include <mach/iomux.h>
#include <linux/slab.h>
+#ifdef CONFIG_HAS_EARLYSUSPEND
+#include <linux/earlysuspend.h>
+#endif
+
#if 0
#define DBG(x...) printk(KERN_INFO x)
struct i2c_client *i2c;
int num_regulators;
struct regulator_dev **rdev;
+ struct early_suspend act8846_suspend;
};
+struct act8846 *g_act8846;
+
static u8 act8846_reg_read(struct act8846 *act8846, u8 reg);
static int act8846_set_bits(struct act8846 *act8846, u8 reg, u16 mask, u16 val);
return err;
}
+
+int act8846_device_shutdown(void)
+{
+ int ret;
+ int err = -1;
+ struct act8846 *act8846 = g_act8846;
+
+ printk("%s\n",__func__);
+
+ ret = act8846_reg_read(act8846,0xc3);
+ ret = act8846_set_bits(act8846, 0xc3,(0x1<<3),(0x1<<3));
+ ret = act8846_set_bits(act8846, 0xc3,(0x1<<4),(0x1<<4));
+ if (ret < 0) {
+ printk("act8846 set 0xc3 error!\n");
+ return err;
+ }
+ return 0;
+}
+EXPORT_SYMBOL_GPL(act8846_device_shutdown);
+
+#ifdef CONFIG_HAS_EARLYSUSPEND
+__weak void act8846_early_suspend(struct early_suspend *h) {}
+__weak void act8846_late_resume(struct early_suspend *h) {}
+#endif
+
static int __devinit act8846_i2c_probe(struct i2c_client *i2c, const struct i2c_device_id *id)
{
struct act8846 *act8846;
goto err;
} else
dev_warn(act8846->dev, "No platform init data supplied\n");
-
+
+ g_act8846 = act8846;
pdata->set_init(act8846);
+ #ifdef CONFIG_HAS_EARLYSUSPEND
+ act8846->act8846_suspend.suspend = act8846_early_suspend,
+ act8846->act8846_suspend.resume = act8846_late_resume,
+ act8846->act8846_suspend.level = EARLY_SUSPEND_LEVEL_DISABLE_FB + 1,
+ register_early_suspend(&act8846->act8846_suspend);
+ #endif
+
return 0;
err: