iio: adc: qcom-vadc-common: Change ADC7 die_temp output unit to mC

Change ADC7 die_temp output unit from C to mC, as thermal
framework expects temperatures to be reported in mC.

Change-Id: Ie14b745f7db625f399ac5f79b3467a1654ea4a21
Signed-off-by: Jishnu Prakash <jprakash@codeaurora.org>
This commit is contained in:
Jishnu Prakash 2020-02-04 23:25:28 +05:30
commit 01152db0c3
2 changed files with 6 additions and 4 deletions

View file

@ -581,7 +581,8 @@ static int qcom_vadc7_scale_hw_calib_die_temp(
} else {
vtemp0 = adcmap7_die_temp[i-1].x;
voltage = voltage - vtemp0;
temp = voltage/(adcmap7_die_temp[i-1].y);
temp = div64_s64(voltage * DIE_TEMP_ADC7_SCALE_FACTOR,
adcmap7_die_temp[i-1].y);
temp += DIE_TEMP_ADC7_SCALE_1 + (DIE_TEMP_ADC7_SCALE_2 * (i-1));
*result_mdec = temp;
}

View file

@ -53,9 +53,10 @@
#define R_PU_100K 100000
#define RATIO_MAX_ADC7 0x4000
#define DIE_TEMP_ADC7_SCALE_1 -60
#define DIE_TEMP_ADC7_SCALE_2 20
#define DIE_TEMP_ADC7_MAX 160
#define DIE_TEMP_ADC7_SCALE_1 -60000
#define DIE_TEMP_ADC7_SCALE_2 20000
#define DIE_TEMP_ADC7_SCALE_FACTOR 1000
#define DIE_TEMP_ADC7_MAX 160000
/**
* struct vadc_map_pt - Map the graph representation for ADC channel