summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2014-05-22 08:14:23 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2014-05-22 08:14:23 -0700
commit9a15ab7300c9854e1ab44d69a310a3c7889de142 (patch)
tree0ab5b9813e6c587e701300f50f160dfe94293c2a /drivers
parentbf56ebb0714c7d6a8e5fdc278efd2b55ef0bfcae (diff)
parentb005bbdd09aa17edfcf00e5d826954e54c7cb7cc (diff)
Merge "hwmon: qpnp-adc: add battery thermistor mapping table for skuh"
Diffstat (limited to 'drivers')
-rw-r--r--drivers/hwmon/qpnp-adc-common.c77
-rw-r--r--drivers/hwmon/qpnp-adc-voltage.c1
2 files changed, 78 insertions, 0 deletions
diff --git a/drivers/hwmon/qpnp-adc-common.c b/drivers/hwmon/qpnp-adc-common.c
index 92459dc7f3ed..49abde5d4f57 100644
--- a/drivers/hwmon/qpnp-adc-common.c
+++ b/drivers/hwmon/qpnp-adc-common.c
@@ -292,6 +292,64 @@ static const struct qpnp_vadc_map_pt adcmap_qrd_skug_btm_threshold[] = {
{800, 582},
};
+static const struct qpnp_vadc_map_pt adcmap_qrd_skuh_btm_threshold[] = {
+ {-200, 1531},
+ {-180, 1508},
+ {-160, 1483},
+ {-140, 1458},
+ {-120, 1432},
+ {-100, 1404},
+ {-80, 1377},
+ {-60, 1348},
+ {-40, 1319},
+ {-20, 1290},
+ {0, 1260},
+ {20, 1230},
+ {40, 1200},
+ {60, 1171},
+ {80, 1141},
+ {100, 1112},
+ {120, 1083},
+ {140, 1055},
+ {160, 1027},
+ {180, 1000},
+ {200, 973},
+ {220, 948},
+ {240, 923},
+ {260, 899},
+ {280, 876},
+ {300, 854},
+ {320, 832},
+ {340, 812},
+ {360, 792},
+ {380, 774},
+ {400, 756},
+ {420, 739},
+ {440, 723},
+ {460, 707},
+ {480, 692},
+ {500, 679},
+ {520, 665},
+ {540, 653},
+ {560, 641},
+ {580, 630},
+ {600, 619},
+ {620, 609},
+ {640, 600},
+ {660, 591},
+ {680, 583},
+ {700, 575},
+ {720, 567},
+ {740, 560},
+ {760, 553},
+ {780, 547},
+ {800, 541},
+ {820, 535},
+ {840, 530},
+ {860, 524},
+ {880, 520},
+};
+
/* Voltage to temperature */
static const struct qpnp_vadc_map_pt adcmap_100k_104ef_104fb[] = {
{1758, -40},
@@ -772,6 +830,25 @@ int32_t qpnp_adc_scale_qrd_skug_batt_therm(struct qpnp_vadc_chip *chip,
}
EXPORT_SYMBOL(qpnp_adc_scale_qrd_skug_batt_therm);
+int32_t qpnp_adc_scale_qrd_skuh_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_skuh_btm_threshold,
+ ARRAY_SIZE(adcmap_qrd_skuh_btm_threshold),
+ bat_voltage,
+ &adc_chan_result->physical);
+}
+EXPORT_SYMBOL(qpnp_adc_scale_qrd_skuh_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,
diff --git a/drivers/hwmon/qpnp-adc-voltage.c b/drivers/hwmon/qpnp-adc-voltage.c
index 0984b2addc6b..03d331320107 100644
--- a/drivers/hwmon/qpnp-adc-voltage.c
+++ b/drivers/hwmon/qpnp-adc-voltage.c
@@ -131,6 +131,7 @@ static struct qpnp_vadc_scale_fn vadc_scale_fn[] = {
[SCALE_QRD_SKUAA_BATT_THERM] = {qpnp_adc_scale_qrd_skuaa_batt_therm},
[SCALE_SMB_BATT_THERM] = {qpnp_adc_scale_smb_batt_therm},
[SCALE_QRD_SKUG_BATT_THERM] = {qpnp_adc_scale_qrd_skug_batt_therm},
+ [SCALE_QRD_SKUH_BATT_THERM] = {qpnp_adc_scale_qrd_skuh_batt_therm},
};
static int32_t qpnp_vadc_read_reg(struct qpnp_vadc_chip *vadc, int16_t reg,