#ifdef CONFIG_REGULATOR_ACT8931
+#define ACT8931_CHGSEL_PIN RK2928_PIN1_PA1
+#define ACT8931_CHGSEL_VALUE GPIO_LOW /* Decline to 20% current */
+
extern int platform_device_register(struct platform_device *pdev);
static int act8931_set_init(struct act8931 *act8931)
{
struct regulator *dcdc;
struct regulator *ldo;
+ int ret;
printk("%s,line=%d\n", __func__,__LINE__);
g_pmic_type = PMIC_TYPE_ACT8931;
regulator_put(dcdc);
udelay(100);
+ ret = gpio_request(ACT8931_CHGSEL_PIN, "ACT8931_CHGSEL");
+ if (ret != 0)
+ gpio_free(ACT8931_CHGSEL_PIN);
+ gpio_direction_output(ACT8931_CHGSEL_PIN, ACT8931_CHGSEL_VALUE);
printk("%s,line=%d END\n", __func__,__LINE__);
.set_init=act8931_set_init,
.num_regulators=7,
.regulators=act8931_regulator_subdev_id,
-
};
+#ifdef CONFIG_HAS_EARLYSUSPEND
+void act8931_early_suspend(struct early_suspend *h)
+{
+ gpio_direction_output(ACT8931_CHGSEL_PIN, ACT8931_CHGSEL_VALUE);
+}
+
+void act8931_late_resume(struct early_suspend *h)
+{
+ gpio_direction_output(ACT8931_CHGSEL_PIN, !ACT8931_CHGSEL_VALUE);
+}
+#endif
#endif
#include <linux/slab.h>
#include <linux/interrupt.h>
#include <plat/board.h>
-
+#ifdef CONFIG_HAS_EARLYSUSPEND
+#include <linux/earlysuspend.h>
+#endif
+
#if 0
#define DBG(x...) printk(KERN_INFO x)
#else
struct i2c_client *i2c;
int num_regulators;
struct regulator_dev **rdev;
+ struct early_suspend act8931_suspend;
};
static u8 act8931_reg_read(struct act8931 *act8931, u8 reg);
rk28_send_wakeup_key();
return IRQ_HANDLED;
}
+
+#ifdef CONFIG_HAS_EARLYSUSPEND
+__weak void act8931_early_suspend(struct early_suspend *h) {}
+__weak void act8931_late_resume(struct early_suspend *h) {}
+#endif
+
static int __devinit act8931_i2c_probe(struct i2c_client *i2c, const struct i2c_device_id *id)
{
struct act8931 *act8931;
}
enable_irq_wake(act8931->irq);
+
+ #ifdef CONFIG_HAS_EARLYSUSPEND
+ act8931->act8931_suspend.suspend = act8931_early_suspend,
+ act8931->act8931_suspend.resume = act8931_late_resume,
+ act8931->act8931_suspend.level = EARLY_SUSPEND_LEVEL_DISABLE_FB + 1,
+ register_early_suspend(&act8931->act8931_suspend);
+ #endif
+
return 0;
err: