mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-10 12:57:06 +09:00
rk2928: act8931: switch charge current when suspend
This commit is contained in:
@@ -8,12 +8,16 @@
|
||||
|
||||
#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;
|
||||
@@ -73,6 +77,10 @@ static int act8931_set_init(struct act8931 *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__);
|
||||
|
||||
@@ -273,9 +281,19 @@ static struct act8931_platform_data act8931_data={
|
||||
.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
|
||||
|
||||
|
||||
@@ -22,7 +22,10 @@
|
||||
#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
|
||||
@@ -42,6 +45,7 @@ struct act8931 {
|
||||
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);
|
||||
@@ -586,6 +590,12 @@ static irqreturn_t act8931_irq_thread(unsigned int irq, void *dev_id)
|
||||
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;
|
||||
@@ -657,6 +667,14 @@ static int __devinit act8931_i2c_probe(struct i2c_client *i2c, const struct i2c_
|
||||
}
|
||||
|
||||
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:
|
||||
|
||||
Reference in New Issue
Block a user