[Galaxy 3 General] stubborn_d0nkey:
I think I have found the function that deals with it, I will also look into it

static int s3c_get_bat_level(struct power_supply *bat_ps)
{
int bat_level = 0;
int bat_vol = s3c_read_bat(bat_ps);
if(bat_vol < 0)
{
printk("%s: Read battery ADC failed!!\n", __func__);
return -1;
}

s3c_bat_info.bat_info.batt_vol_adc_aver = bat_vol;

if(is_over_abs_time()) {
bat_level = 100;
dev_info(dev, "%s: charging time is over\n", __func__);
s3c_set_chg_en(0);
s3c_bat_info.bat_info.batt_is_full = 1;
goto __end__;
}

if(!get_jig_cable_state() && low_batt_power_off) // Low batt interrupt occured
{
bat_level = 0; // Now, phone will be shutdown
dev_info(dev, "%s: power off by low battery\n", __func__);
goto __end__;
}

#if 0 //def __BATTERY_COMPENSATION__
if (s3c_bat_info.bat_info.charging_enabled) {
if (bat_vol > batt_almost - COMPENSATE_TA) {
s3c_bat_set_compesation(0, OFFSET_TA_ATTACHED,
COMPENSATE_TA);
}
}
#endif /* __BATTERY_COMPENSATION__ */

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;

#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;
if (bat_vol > (batt_almost + 86))
bat_level = 80;
else
bat_level = 70;

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;
if (bat_vol > (batt_high + 62))
bat_level = 60;
else
bat_level = 50;
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;
if (bat_vol > (batt_medium + 26))
bat_level = 40;
else
bat_level = 30;
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;
if (bat_vol > (batt_low + 50))
bat_level = 20;
else
bat_level = 15;
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);

__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__ */
}