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

Commit aec312fa authored by Siddartha Mohanadoss's avatar Siddartha Mohanadoss
Browse files

iio: rradc: Update thermistor scaling



Scale the result with scaling coefficient before performing
an integer division to retain the resolution.

Change-Id: I11480099996e16e90736c667691ff0f057c02261
Signed-off-by: default avatarSiddartha Mohanadoss <smohanad@codeaurora.org>
parent 6da25f22
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -331,8 +331,8 @@ static int rradc_post_process_therm(struct rradc_chip *chip,
	int64_t temp;

	/* K = code/4 */
	temp = div64_s64(adc_code, FG_ADC_RR_BATT_THERM_LSB_K);
	temp *= FG_ADC_SCALE_MILLI_FACTOR;
	temp = ((int64_t)adc_code * FG_ADC_SCALE_MILLI_FACTOR);
	temp = div64_s64(temp, FG_ADC_RR_BATT_THERM_LSB_K);
	*result_millidegc = temp - FG_ADC_KELVINMIL_CELSIUSMIL;

	return 0;