struct i2c_client *i2c;
int num_regulators;
struct regulator_dev **rdev;
-// struct early_suspend act8846_suspend;
+#ifdef CONFIG_HAS_EARLYSUSPEND
+ struct early_suspend act8846_suspend;
+#endif
int irq_base;
int chip_irq;
int pmic_sleep_gpio; /* */
static int act8846_dcdc_set_voltage_time_sel(struct regulator_dev *dev, unsigned int old_selector,
unsigned int new_selector)
{
- struct act8846 *act8846 = rdev_get_drvdata(dev);
- int ret =0,old_volt, new_volt;
+ int old_volt, new_volt;
old_volt = act8846_dcdc_list_voltage(dev, old_selector);
if (old_volt < 0)
#endif
-int act8846_device_shutdown(void)
+void act8846_device_shutdown(void)
{
- int ret;
- int err = -1;
struct act8846 *act8846 = g_act8846;
printk("%s\n",__func__);
#if 1
if (act8846->pmic_hold_gpio) {
gpio_direction_output(act8846->pmic_hold_gpio,0);
+ mdelay(100);
arm_pm_restart('h', "charge");
}
return err;
}
#endif
- return 0;
}
EXPORT_SYMBOL_GPL(act8846_device_shutdown);
if (pdev) {
act8846->num_regulators = act8846_NUM_REGULATORS;
- act8846->rdev = kcalloc(act8846_NUM_REGULATORS,sizeof(struct regulator_dev *), GFP_KERNEL);
+ act8846->rdev = devm_kcalloc(act8846->dev,
+ act8846_NUM_REGULATORS,
+ sizeof(struct regulator_dev *),
+ GFP_KERNEL);
if (!act8846->rdev) {
return -ENOMEM;
}
for (i = 0; i < act8846->num_regulators; i++)
if (act8846->rdev[i])
regulator_unregister(act8846->rdev[i]);
- kfree(act8846->rdev);
i2c_set_clientdata(i2c, NULL);
- kfree(act8846);
return 0;
}