hwmon: qpnp-adc: add battery thermistor mapping table for 8929 SKUL

Update battery thermistor mapping table for SKUL.

Change-Id: I83143693af83ca2ae0af481878eba1ec16003ee8
Signed-off-by: Zhenhua Huang <zhenhuah@codeaurora.org>
This commit is contained in:
Zhenhua Huang 2015-03-09 19:09:35 +08:00
parent 660309ee81
commit 61ae5f5423
3 changed files with 94 additions and 0 deletions

View File

@ -494,6 +494,60 @@ static const struct qpnp_vadc_map_pt adcmap_qrd_skue_btm_threshold[] = {
{800, 398},
};
static const struct qpnp_vadc_map_pt adcmap_qrd_skul_btm_threshold[] = {
{-200, 1515},
{-180, 1492},
{-160, 1467},
{-140, 1441},
{-120, 1413},
{-100, 1386},
{-80, 1357},
{-60, 1327},
{-40, 1296},
{-20, 1264},
{0, 1232},
{20, 1200},
{40, 1167},
{60, 1134},
{80, 1100},
{100, 1050},
{120, 1034},
{140, 1000},
{160, 967},
{180, 935},
{200, 903},
{220, 871},
{240, 840},
{260, 810},
{280, 780},
{300, 751},
{320, 723},
{340, 696},
{360, 670},
{380, 645},
{400, 620},
{420, 597},
{440, 574},
{460, 552},
{480, 531},
{500, 512},
{520, 492},
{540, 474},
{560, 457},
{580, 440},
{600, 425},
{620, 410},
{640, 396},
{660, 383},
{680, 370},
{700, 358},
{720, 347},
{740, 336},
{760, 326},
{780, 311},
{800, 307},
};
/* Voltage to temperature */
static const struct qpnp_vadc_map_pt adcmap_100k_104ef_104fb[] = {
{1758, -40},
@ -1096,6 +1150,25 @@ int32_t qpnp_adc_scale_qrd_skue_batt_therm(struct qpnp_vadc_chip *chip,
}
EXPORT_SYMBOL(qpnp_adc_scale_qrd_skue_batt_therm);
int32_t qpnp_adc_scale_qrd_skul_batt_therm(struct qpnp_vadc_chip *chip,
int32_t adc_code,
const struct qpnp_adc_properties *adc_properties,
const struct qpnp_vadc_chan_properties *chan_properties,
struct qpnp_vadc_result *adc_chan_result)
{
int64_t bat_voltage = 0;
bat_voltage = qpnp_adc_scale_ratiometric_calib(adc_code,
adc_properties, chan_properties);
return qpnp_adc_map_temp_voltage(
adcmap_qrd_skul_btm_threshold,
ARRAY_SIZE(adcmap_qrd_skul_btm_threshold),
bat_voltage,
&adc_chan_result->physical);
}
EXPORT_SYMBOL(qpnp_adc_scale_qrd_skul_batt_therm);
int32_t qpnp_adc_scale_smb_batt_therm(struct qpnp_vadc_chip *chip,
int32_t adc_code,
const struct qpnp_adc_properties *adc_properties,

View File

@ -174,6 +174,7 @@ static struct qpnp_vadc_scale_fn vadc_scale_fn[] = {
[SCALE_QRD_SKUT1_BATT_THERM] = {qpnp_adc_scale_qrd_skut1_batt_therm},
[SCALE_QRD_SKUC_BATT_THERM] = {qpnp_adc_scale_qrd_skuc_batt_therm},
[SCALE_QRD_SKUE_BATT_THERM] = {qpnp_adc_scale_qrd_skue_batt_therm},
[SCALE_QRD_SKUL_BATT_THERM] = {qpnp_adc_scale_qrd_skul_batt_therm},
};
static struct qpnp_vadc_rscale_fn adc_vadc_rscale_fn[] = {

View File

@ -259,6 +259,8 @@ enum qpnp_adc_channel_scaling_param {
* btm parameters for SKUC
* %SCALE_QRD_SKUE_BATT_THERM: Conversion to temperature(decidegC) based on
* btm parameters for SKUE
* %SCALE_QRD_SKUL_BATT_THERM: Conversion to temperature(decidegC) based on
* btm parameters for SKUL
* %SCALE_NONE: Do not use this scaling type.
*/
enum qpnp_adc_scale_fn_type {
@ -277,6 +279,7 @@ enum qpnp_adc_scale_fn_type {
SCALE_QRD_SKUT1_BATT_THERM,
SCALE_QRD_SKUC_BATT_THERM,
SCALE_QRD_SKUE_BATT_THERM,
SCALE_QRD_SKUL_BATT_THERM,
SCALE_NONE,
};
@ -1318,6 +1321,23 @@ int32_t qpnp_adc_scale_qrd_skue_batt_therm(struct qpnp_vadc_chip *dev,
const struct qpnp_adc_properties *adc_prop,
const struct qpnp_vadc_chan_properties *chan_prop,
struct qpnp_vadc_result *chan_rslt);
/**
* qpnp_adc_scale_qrd_skul_batt_therm() - Scales the pre-calibrated digital output
* of an ADC to the ADC reference and compensates for the
* gain and offset. Returns the temperature in decidegC.
* @dev: Structure device for qpnp vadc
* @adc_code: pre-calibrated digital ouput of the ADC.
* @adc_prop: adc properties of the pm8xxx adc such as bit resolution,
* reference voltage.
* @chan_prop: individual channel properties to compensate the i/p scaling,
* slope and offset.
* @chan_rslt: physical result to be stored.
*/
int32_t qpnp_adc_scale_qrd_skul_batt_therm(struct qpnp_vadc_chip *dev,
int32_t adc_code,
const struct qpnp_adc_properties *adc_prop,
const struct qpnp_vadc_chan_properties *chan_prop,
struct qpnp_vadc_result *chan_rslt);
/**
* qpnp_adc_scale_smb_batt_therm() - Scales the pre-calibrated digital output
* of an ADC to the ADC reference and compensates for the