Merge "hwmon: qpnp-adc: add battery thermistor mapping table for 8909 skue"
diff --git a/drivers/hwmon/qpnp-adc-common.c b/drivers/hwmon/qpnp-adc-common.c
index 87b5d40..211e417 100644
--- a/drivers/hwmon/qpnp-adc-common.c
+++ b/drivers/hwmon/qpnp-adc-common.c
@@ -439,6 +439,60 @@
{800, 477},
};
+static const struct qpnp_vadc_map_pt adcmap_qrd_skue_btm_threshold[] = {
+ {-200, 1385},
+ {-180, 1353},
+ {-160, 1320},
+ {-140, 1287},
+ {-120, 1253},
+ {-100, 1218},
+ {-80, 1184},
+ {-60, 1149},
+ {-40, 1115},
+ {-20, 1080},
+ {0, 1046},
+ {20, 1013},
+ {40, 980},
+ {60, 948},
+ {80, 917},
+ {100, 887},
+ {120, 858},
+ {140, 830},
+ {160, 803},
+ {180, 777},
+ {200, 752},
+ {220, 729},
+ {240, 706},
+ {260, 685},
+ {280, 664},
+ {300, 645},
+ {320, 626},
+ {340, 609},
+ {360, 593},
+ {380, 577},
+ {400, 563},
+ {420, 549},
+ {440, 536},
+ {460, 524},
+ {480, 512},
+ {500, 501},
+ {520, 491},
+ {540, 481},
+ {560, 472},
+ {580, 464},
+ {600, 456},
+ {620, 448},
+ {640, 441},
+ {660, 435},
+ {680, 428},
+ {700, 423},
+ {720, 417},
+ {740, 412},
+ {760, 407},
+ {780, 402},
+ {800, 398},
+};
+
/* Voltage to temperature */
static const struct qpnp_vadc_map_pt adcmap_100k_104ef_104fb[] = {
{1758, -40},
@@ -1069,6 +1123,25 @@
}
EXPORT_SYMBOL(qpnp_adc_scale_qrd_skuc_batt_therm);
+int32_t qpnp_adc_scale_qrd_skue_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;
+
+ qpnp_adc_scale_with_calib_param(adc_code,
+ adc_properties, chan_properties, &bat_voltage);
+
+ return qpnp_adc_map_temp_voltage(
+ adcmap_qrd_skue_btm_threshold,
+ ARRAY_SIZE(adcmap_qrd_skue_btm_threshold),
+ bat_voltage,
+ &adc_chan_result->physical);
+}
+EXPORT_SYMBOL(qpnp_adc_scale_qrd_skue_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 33ec4e1..5cac1ba 100644
--- a/drivers/hwmon/qpnp-adc-voltage.c
+++ b/drivers/hwmon/qpnp-adc-voltage.c
@@ -220,6 +220,7 @@
[SCALE_NCP_03WF683_THERM] = {qpnp_adc_scale_therm_ncp03},
[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_PMI_CHG_TEMP] = {qpnp_adc_scale_pmi_chg_temp},
};
diff --git a/include/linux/qpnp/qpnp-adc.h b/include/linux/qpnp/qpnp-adc.h
index 35a06ee..c43c78a 100644
--- a/include/linux/qpnp/qpnp-adc.h
+++ b/include/linux/qpnp/qpnp-adc.h
@@ -380,6 +380,8 @@
* btm parameters for SKUT1
* %SCALE_QRD_SKUC_BATT_THERM: Conversion to temperature(decidegC) based on
* btm parameters for SKUC
+ * %SCALE_QRD_SKUE_BATT_THERM: Conversion to temperature(decidegC) based on
+ * btm parameters for SKUE
* %SCALE_PMI_CHG_TEMP: Conversion for PMI CHG temp
* %SCALE_NONE: Do not use this scaling type.
*/
@@ -398,6 +400,7 @@
SCALE_NCP_03WF683_THERM,
SCALE_QRD_SKUT1_BATT_THERM,
SCALE_QRD_SKUC_BATT_THERM,
+ SCALE_QRD_SKUE_BATT_THERM,
SCALE_PMI_CHG_TEMP = 16,
SCALE_NONE,
};
@@ -1495,6 +1498,23 @@
const struct qpnp_vadc_chan_properties *chan_prop,
struct qpnp_vadc_result *chan_rslt);
/**
+ * qpnp_adc_scale_qrd_skue_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 output 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_skue_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
* gain and offset. Returns the temperature in decidegC.
@@ -1963,6 +1983,12 @@
const struct qpnp_vadc_chan_properties *chan_prop,
struct qpnp_vadc_result *chan_rslt)
{ return -ENXIO; }
+static inline int32_t qpnp_adc_scale_qrd_skue_batt_therm(
+ struct qpnp_vadc_chip *vdev, 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)
+{ return -ENXIO; }
static inline int32_t qpnp_adc_scale_smb_batt_therm(struct qpnp_vadc_chip *vadc,
int32_t adc_code,
const struct qpnp_adc_properties *adc_prop,