EXPERIMENTAL: Initial (Alpha) support for extended battery in the new driver. USE AT YOUR OWN RISK! http://bit.ly/eDLk0g
This commit is contained in:
parent
325979c74c
commit
37af65e44e
@ -87,7 +87,7 @@ static struct poweralg_config_type debug_config = {0};
|
||||
#define CHARGE_FAST 2
|
||||
|
||||
#define BATTERY_ID_UNKNOWN 0
|
||||
#define HTC_BATTERY_DS2746_DEBUG_ENABLE 0
|
||||
#define HTC_BATTERY_DS2746_DEBUG_ENABLE 1
|
||||
|
||||
/* DS2746 I2C BUS*/
|
||||
#define DS2746_I2C_BUS_ID 0
|
||||
|
@ -52,7 +52,7 @@ build flags
|
||||
|
||||
========================================================================================*/
|
||||
|
||||
#define HTC_ENABLE_POWER_DEBUG 0
|
||||
#define HTC_ENABLE_POWER_DEBUG 1
|
||||
#define HTC_ENABLE_DUMMY_BATTERY 0
|
||||
|
||||
/*========================================================================================
|
||||
@ -661,6 +661,8 @@ static BOOL __battery_param_udpate(struct battery_type *battery)
|
||||
battery->discharge_mA = (battery->discharge_adc * discharge_adc_to_mv_coef / discharge_adc_to_mv_resl);
|
||||
battery->charge_counter_mAh = (battery->charge_counter_adc * acr_adc_to_mv_coef / acr_adc_to_mv_resl) - charge_counter_zero_base_mAh;
|
||||
battery->current_mA = battery->current_mA - battery->discharge_mA;
|
||||
printk(DRIVER_ZONE " battery.id_adc pre clip: %d\n", battery->id_adc);
|
||||
printk(DRIVER_ZONE " battery.temp_adc pre clip: %d\n", battery->temp_adc);
|
||||
/* prevent from adc out of range*/
|
||||
if (battery->id_adc >= id_adc_resl) {
|
||||
battery->id_adc = id_adc_resl - 1;
|
||||
@ -678,11 +680,11 @@ static BOOL __battery_param_udpate(struct battery_type *battery)
|
||||
/* battery ID shall be ready first for temp/kadc calculation*/
|
||||
// if ( id_conversion ) battery->id_ohm = ((float)id_R_kohm / ((float)id_adc_resl/battery->id_adc - 1)) * 1000; // kohm -> ohm
|
||||
// else battery->id_ohm = battery->id_adc;
|
||||
battery->id_ohm = battery->id_adc;
|
||||
battery->id_ohm = battery->temp_adc;
|
||||
#if HTC_ENABLE_POWER_DEBUG
|
||||
printk(DRIVER_ZONE " battery.id_ohm pre calibrate: %d\n", battery->id_ohm);
|
||||
#endif /* HTC_ENABLE_POWER_DEBUG*/
|
||||
calibrate_id_ohm(battery);
|
||||
//calibrate_id_ohm(battery);
|
||||
#if HTC_ENABLE_POWER_DEBUG
|
||||
printk(DRIVER_ZONE " battery.id_ohm post calibrate: %d\n", battery->id_ohm);
|
||||
#endif /* HTC_ENABLE_POWER_DEBUG*/
|
||||
@ -716,6 +718,10 @@ static BOOL __battery_param_udpate(struct battery_type *battery)
|
||||
}
|
||||
}
|
||||
|
||||
if (batt_id_index == 5)
|
||||
{
|
||||
battery->temp_adc = battery->temp_adc * 7;
|
||||
}
|
||||
/* calculate temperature*/
|
||||
// battery->temp_01c = get_temp_c((float)temp_R_kohm / ((float)temp_adc_resl/battery->temp_adc - 1))*10;
|
||||
temp_01c = get_temp_01c(battery);
|
||||
|
@ -36,6 +36,7 @@ enum BATTERY_ID_ENUM {
|
||||
BATTERY_ID_SONY_1300MAH_HTE,
|
||||
BATTERY_ID_SANYO_1300MAH_HTE,
|
||||
BATTERY_ID_SANYO_1300MAH_TWS,
|
||||
BATTERY_ID_HTC_EXTENDED_2300MAH_FORMOSA,
|
||||
BATTERY_ID_NUM /* include unknown battery*/
|
||||
};
|
||||
|
||||
@ -45,7 +46,8 @@ UINT32 ID_RANGE[] =
|
||||
7150, 15500, /* Sony 1300mAh (Formosa) */ /* 7.1k~15k */
|
||||
27500, 49500, /* Sony 1300mAh (HTE) */ /* 28k~49.5k */
|
||||
15500, 27500, /* Sanyo 1300mAh (HTE) */ /* 16k~27k */
|
||||
0, 7150, /* Samsung 1230mAh */ /* 0k~7k */
|
||||
100, 7150, /* Samsung 1230mAh */ /* 1k~7k */
|
||||
0, 100, /* HTC Extended 2300mAh */ /* 0k~1k */
|
||||
};
|
||||
|
||||
/*This table is calculated according to temp formula for temp mapping.
|
||||
@ -105,6 +107,7 @@ UINT32 FL_25[] =
|
||||
1280, /* Sony 1300mAh (HTE) */
|
||||
1250, /* Sanyo 1300mAh (HTE) */
|
||||
1230, /* Samsung 1230mAh */
|
||||
2350, /* HTC Extended 2300mAh */
|
||||
};
|
||||
|
||||
UINT32 PD_M_COEF[] =
|
||||
@ -115,6 +118,7 @@ UINT32 PD_M_COEF[] =
|
||||
24, /* Sony 1300mAh (HTE) */
|
||||
27, /* Sanyo 1300mAh (HTE) */
|
||||
30, /* Samsung 1230mAh */
|
||||
30, /* HTC Extended 2300mAh */
|
||||
};
|
||||
|
||||
UINT32 PD_M_RESL[] =
|
||||
@ -125,6 +129,7 @@ UINT32 PD_M_RESL[] =
|
||||
100, /* Sony 1300mAh (HTE) */
|
||||
100, /* Sanyo 1300mAh (HTE) */
|
||||
100, /* Samsung 1230mAh */
|
||||
100, /* HTC Extended 2300mAh */
|
||||
};
|
||||
|
||||
UINT32 PD_T_COEF[] =
|
||||
@ -135,6 +140,7 @@ UINT32 PD_T_COEF[] =
|
||||
140, /* Sony 1300mAh (HTE) */
|
||||
156, /* Sanyo 1300mAh (HTE) */
|
||||
250, /* Samsung 1230mAh */
|
||||
250, /* HTC Extended 2300mAh */
|
||||
};
|
||||
|
||||
/*! star_lee 20100426 - update KADC discharge parameter */
|
||||
@ -150,6 +156,13 @@ UINT32 M_PARAMETER_Samsung_1230MAH_FORMOSA[] =
|
||||
10000, 4135, 7500, 3960, 4700, 3800, 1700, 3727, 900, 3674, 300, 3640, 0, 3420,
|
||||
};
|
||||
|
||||
UINT32 M_PARAMETER_HTC_2300MAH_FORMOSA[] =
|
||||
{
|
||||
/* capacity (in 0.01%) -> voltage (in mV)*/
|
||||
10000, 4196, 7500, 4165, 4700, 3986, 1700, 3879, 900, 3833, 300, 3740, 0, 3420,
|
||||
};
|
||||
|
||||
|
||||
UINT32 *M_PARAMTER_TABLE[] =
|
||||
{
|
||||
/* Unknown battery */
|
||||
@ -165,7 +178,8 @@ UINT32 *M_PARAMTER_TABLE[] =
|
||||
/* same as Sony 1300mAh (Formosa) currently... */
|
||||
/* Samsung 1230mAh */
|
||||
(UINT32 *) (M_PARAMETER_Samsung_1230MAH_FORMOSA),
|
||||
/* same as Sony 1300mAh (Formosa) currently... */
|
||||
/* HTC Extended 2300mAh */
|
||||
(UINT32 *) (M_PARAMETER_HTC_2300MAH_FORMOSA),
|
||||
};
|
||||
|
||||
INT32 TEMP_RANGE[] =
|
||||
|
Loading…
Reference in New Issue
Block a user