示例#1
0
static int max17048_get_capacity_from_soc(void)
{
	u8 buf[2];
	long batt_soc = 0;

	if (ref == NULL)
		return 100;

	buf[0] = (ref->soc & 0x0000FF00) >> 8;
	buf[1] = (ref->soc & 0x000000FF);

	/* The unit of bit[0] is 1/512 %, Change it to 1% */
	batt_soc = ((buf[0]*256)+buf[1])*19531;

	pr_debug("[max17048]%s : MAXIM Raw Capacity : %d , *100 is %d \n"
			, __func__, (int)(batt_soc/10000000)
			, (int)(batt_soc/100000));

	/* SOC scaling for stable max SOC and changed Cut-off */
	/*Adj SOC = (FG SOC-Emply)/(Full-Empty)*100*/
	batt_soc = (batt_soc-((ref->model_data->empty)*100000))
		/(9400-(ref->model_data->empty))*10000;
	batt_soc /= 10000000;

	batt_soc = max17048_capacity_evaluator((int)batt_soc);
#ifdef CONFIG_LGE_UPSCALING_LOW_SOC
#ifdef CONFIG_LGE_BATT_DUALISATION
	/* Report 0.42%(0x300) ~ 1% to 1% */
	/* If Full and Emplty is changed, need to modify the value, 3 */
	else if (batt_soc == 0 && buf[0] >= 3) {
static int max17048_get_capacity_from_soc(void)
{
	u8 buf[2];
	long batt_soc = 0;

	if (ref == NULL)
		return 100;

	buf[0] = (ref->soc & 0x0000FF00) >> 8;
	buf[1] = (ref->soc & 0x000000FF);

	/*                                                */
	batt_soc = ((buf[0]*256)+buf[1])*19531;

	pr_debug("[max17048]%s : MAXIM Raw Capacity : %d , *100 is %d \n"
			, __func__, (int)(batt_soc/10000000)
			, (int)(batt_soc/100000));

	/*                                                    */
	/*                                         */
	batt_soc = (batt_soc-((ref->model_data->empty)*100000))
		/(9400-(ref->model_data->empty))*10000;
	batt_soc /= 10000000;

	batt_soc = max17048_capacity_evaluator((int)batt_soc);
#ifdef CONFIG_LGE_UPSCALING_LOW_SOC
#ifdef CONFIG_LGE_BATT_DUALISATION
	/*                                */
	/*                                                            */
	else if (batt_soc == 0 && buf[0] >= 3) {