Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5a5d12e0 authored by Ram Chandrasekar's avatar Ram Chandrasekar
Browse files

power: bcl_peripheral: Fix the Ibat to ADC value calculation



Fix the Ibat to ADC value calculation formula. The formula
was setting wrong threshold value triggering frequent
mitigation in the device.

CRs-Fixed: 780598
Change-Id: I7fbb7f92c59bafecff17b948e1acacb639f6ccec
Signed-off-by: default avatarRam Chandrasekar <rkumbako@codeaurora.org>
parent 028b35cc
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
/*
 * Copyright (c) 2014, The Linux Foundation. All rights reserved.
 * Copyright (c) 2014-2015, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -178,7 +178,7 @@ static void convert_ibat_to_adc_val(int *val)
	if (!bcl_perph)
		return;
	perph_data = &bcl_perph->param[BCL_PARAM_CURRENT];
	*val /= (*val * 100 / (100 + perph_data->gain_factor_num
	*val = (*val * 100 / (100 + perph_data->gain_factor_num
		* BCL_CONSTANT_NUM / perph_data->gain_factor_den)
		- perph_data->offset_factor_num
		/ perph_data->offset_factor_den)