mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 11:50:43 +09:00
rk31:pmu:rt5025:to slove without battery can turns on system
This commit is contained in:
@@ -419,8 +419,8 @@ static struct rt5025_irq_data rt5025_irq_data = {
|
||||
|
||||
//temp unit: 'c*10 degree
|
||||
static int jeita_temp[4] = { 0, 150, 500, 600};
|
||||
//-5', 5', 15', 20', 45' 55' 55', 65'
|
||||
static u8 jeita_scalar[8] = { 0x30, 0x2B, 0x25, 0x20, 0x15, 0x10, 0x10, 0x0D };
|
||||
//-5', 5', 10', 20', 45' 55' 55', 65'
|
||||
static u8 jeita_scalar[8] = { 0x30, 0x2B, 0x28, 0x22, 0x15, 0x10, 0x10, 0x0D };
|
||||
//cc unit: xxx mA
|
||||
static int jeita_temp_cc[][5] = {{ 500, 500, 500, 500, 500}, // not plugin
|
||||
{ 0 , 500, 500, 500, 0}, // normal USB
|
||||
|
||||
@@ -38,6 +38,7 @@ struct rt5025_irq_info {
|
||||
int intr_pin;
|
||||
int irq;
|
||||
int suspend;
|
||||
int init_once;
|
||||
};
|
||||
|
||||
static void rt5025_work_func(struct work_struct *work)
|
||||
@@ -114,14 +115,17 @@ static void rt5025_work_func(struct work_struct *work)
|
||||
|
||||
if (chg_event & (CHG_EVENT_INAC_PLUGIN | CHG_EVENT_INUSB_PLUGIN))
|
||||
{
|
||||
rt5025_set_charging_buck(ii->i2c, 0);
|
||||
mdelay(50);
|
||||
rt5025_set_charging_buck(ii->i2c, 1);
|
||||
mdelay(100);
|
||||
rt5025_set_charging_buck(ii->i2c, 0);
|
||||
mdelay(50);
|
||||
rt5025_set_charging_buck(ii->i2c, 1);
|
||||
mdelay(200);
|
||||
if (!ii->init_once)
|
||||
{
|
||||
rt5025_set_charging_buck(ii->i2c, 0);
|
||||
mdelay(50);
|
||||
rt5025_set_charging_buck(ii->i2c, 1);
|
||||
mdelay(100);
|
||||
rt5025_set_charging_buck(ii->i2c, 0);
|
||||
mdelay(50);
|
||||
rt5025_set_charging_buck(ii->i2c, 1);
|
||||
mdelay(200);
|
||||
}
|
||||
}
|
||||
|
||||
if (ii->chip->power_info->chg_term <= 3)
|
||||
@@ -150,6 +154,9 @@ static void rt5025_work_func(struct work_struct *work)
|
||||
rt5025_gauge_irq_handler(ii->chip->battery_info, irq_stat[5] & RT5025_FLG_VOLT);
|
||||
#endif /* CONFIG_POWER_RT5025 */
|
||||
|
||||
if (ii->init_once)
|
||||
ii->init_once = 0;
|
||||
|
||||
/* restore all irq enable bit */
|
||||
rt5025_reg_write(ii->i2c, RT5025_REG_IRQEN1, irq_enable[0]);
|
||||
rt5025_reg_write(ii->i2c, RT5025_REG_IRQEN2, irq_enable[1]);
|
||||
@@ -258,6 +265,7 @@ static int __devinit rt5025_irq_probe(struct platform_device *pdev)
|
||||
if (pdata->cb)
|
||||
ii->event_cb = pdata->cb;
|
||||
wake_lock_init(&ii->irq_wake_lock, WAKE_LOCK_SUSPEND, "rt_irq_wake");
|
||||
ii->init_once = 1;
|
||||
|
||||
rt5025_irq_reg_init(ii, pdata->irq_data);
|
||||
rt5025_interrupt_init(ii);
|
||||
|
||||
@@ -506,7 +506,7 @@ static void rt5025_get_dchg_cc(struct rt5025_battery_info *bi)
|
||||
{
|
||||
u8 data[4];
|
||||
u32 qh_old,ql_old,qh_new,ql_new;
|
||||
u32 cc_masec,offset;
|
||||
u32 cc_masec,offset=0;
|
||||
|
||||
if (rt5025_read_reg(bi->client, RT5025_REG_QDCHGH_MSB, data, 4) < 0){
|
||||
printk(KERN_ERR "%s: Failed to read QDCHG\n", __func__);
|
||||
|
||||
@@ -327,16 +327,44 @@ static void thermal_reg_work_func(struct work_struct *work)
|
||||
{
|
||||
struct delayed_work *delayed_work = (struct delayed_work *)container_of(work, struct delayed_work, work);
|
||||
struct rt5025_swjeita_info *swji = (struct rt5025_swjeita_info *)container_of(delayed_work, struct rt5025_swjeita_info, thermal_reg_work);
|
||||
int therm_region;
|
||||
int therm_region = 0;
|
||||
|
||||
RTINFO("%s ++", __func__);
|
||||
rt5025_get_internal_temp(swji);
|
||||
|
||||
#if 1
|
||||
switch (swji->cur_therm_region)
|
||||
{
|
||||
case 0:
|
||||
if (swji->cur_inttemp >=820)
|
||||
therm_region = 1;
|
||||
else
|
||||
therm_region = 0;
|
||||
break;
|
||||
case 1:
|
||||
if (swji->cur_inttemp <= 780)
|
||||
therm_region = 0;
|
||||
else if (swji->cur_inttemp >= 1020)
|
||||
therm_region = 2;
|
||||
else
|
||||
therm_region = 1;
|
||||
break;
|
||||
case 2:
|
||||
if (swji->cur_inttemp <= 980)
|
||||
therm_region = 1;
|
||||
else
|
||||
therm_region = 2;
|
||||
break;
|
||||
|
||||
}
|
||||
#else
|
||||
if (swji->cur_inttemp < 800)
|
||||
therm_region = 0;
|
||||
else if (swji->cur_inttemp >= 800 && swji->cur_inttemp < 1000)
|
||||
therm_region = 1;
|
||||
else
|
||||
therm_region = 2;
|
||||
#endif /* #if 1*/
|
||||
|
||||
if (therm_region != swji->cur_therm_region)
|
||||
{
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#include <linux/android_alarm.h>
|
||||
|
||||
#define RT5025_DEVICE_NAME "RT5025"
|
||||
#define RT5025_DRV_VER "1.0.5_R"
|
||||
#define RT5025_DRV_VER "1.0.6_R"
|
||||
|
||||
enum {
|
||||
RT5025_RSTDELAY1_100MS,
|
||||
|
||||
Reference in New Issue
Block a user