[Galaxy 3 Android Development] Dharam_Maniar:
yes, and the place where 1% gets calculated is this

if (bat_vol > batt_full)
{
int temp = (batt_max - batt_full);
if (bat_vol > (batt_full + temp) ||
s3c_bat_info.bat_info.batt_is_full)
bat_level = 100;
else
{
bat_level = 90 + (((bat_vol - batt_full) *10) / temp);
}

#ifdef __CHECK_CHG_CURRENT__
if (s3c_bat_info.bat_info.charging_enabled) {
check_chg_current(bat_ps);
if (!s3c_bat_info.bat_info.batt_is_full)
bat_level = 90;
}
#endif /* __CHECK_CHG_CURRENT__ */
dev_dbg(dev, "%s: (full)level = %d\n", __func__, bat_level );
}
else if (batt_full >= bat_vol && bat_vol > batt_almost)
{
int temp = (batt_full - batt_almost) / 2;
bat_level = 70 + (((bat_vol - batt_almost) *10) / temp);

dev_dbg(dev, "%s: (almost)level = %d\n", __func__, bat_level);
}
else if (batt_almost >= bat_vol && bat_vol > batt_high)
{
int temp = (batt_almost - batt_high) / 2;
bat_level = 50 + (((bat_vol - batt_high) *10) / temp);
dev_dbg(dev, "%s: (high)level = %d\n", __func__, bat_level );
}
else if (batt_high >= bat_vol && bat_vol > batt_medium)
{
int temp = (batt_high - batt_medium) / 2;
bat_level = 30 + (((bat_vol - batt_medium) *10) / temp);
dev_dbg(dev, "%s: (med)level = %d\n", __func__, bat_level);
}
else if (batt_medium >= bat_vol && bat_vol > batt_low)
{
int temp = (batt_medium - batt_low) / 2;
bat_level = 15 + ((( bat_vol - batt_low) *5) / temp);
dev_dbg(dev, "%s: (low)level = %d\n", __func__, bat_level);
}
else if (batt_low >= bat_vol && bat_vol > batt_critical)
{
bat_level = 5;
dev_dbg(dev, "%s: (cri)level = %d, vol = %d\n", __func__,
bat_level, bat_vol);
}
else if (batt_critical >= bat_vol && bat_vol > batt_min)
{
bat_level = 3;
dev_info(dev, "%s: (min)level = %d, vol = %d\n", __func__,
bat_level, bat_vol);
}
else if (batt_min >= bat_vol && bat_vol > batt_off)
{
bat_level = 1;
dev_info(dev, "%s: (off)level = %d, vol = %d\n", __func__,
bat_level, bat_vol);
}
else if (batt_off >= bat_vol)
{
bat_level = 0;
dev_info(dev, "%s: (off)level = %d, vol = %d", __func__,
bat_level, bat_vol);
}

// If current status is full or recharging, then it should be 100% regardless of current real battery level.
if (s3c_bat_info.bat_info.batt_is_full || s3c_bat_info.bat_info.batt_is_recharging)
bat_level = 100;

if( (++p_count % 150) == 0) { // Print debug message every 5 minutes.
p_count = 1;
printk("[BATT] level(%d), is_full(%d), is_recharging(%d), charging_enabled(%d), batt_vol(%d)\n",
bat_level, s3c_bat_info.bat_info.batt_is_full, s3c_bat_info.bat_info.batt_is_recharging,
s3c_bat_info.bat_info.charging_enabled, bat_vol);
}

// If current status is full because of absolute timer, then it should be recharging.
if (s3c_bat_info.bat_info.batt_is_full &&
!s3c_bat_info.bat_info.charging_enabled &&
bat_vol < (batt_max + 45)) { // under 4.15V
dev_info(dev, "%s: recharging(under full)\n", __func__);
s3c_bat_info.bat_info.batt_is_recharging = 1;
s3c_set_chg_en(1);
bat_level = 100;
}

dev_dbg(dev, "%s: level = %d\n", __func__, bat_level);

//bat_level = tmpcal;

__end__:
dev_dbg(dev, "%s: bat_vol = %d, level = %d, is_full = %d\n",
__func__, bat_vol, bat_level,
s3c_bat_info.bat_info.batt_is_full);
#ifdef __TEMP_ADC_VALUE__
return 80;
#else
return bat_level;
#endif /* __TEMP_ADC_VALUE__ */
}