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

Commit 5ffa033b authored by Chunmei Cai's avatar Chunmei Cai Committed by Gerrit - the friendly Code Review server
Browse files

hwmon: qpnp-adc: add battery thermistor mapping table for 8909 skue



Tcold = -20 DegC and Thot = 60 DegC are used for 8909 SKUE device.
Update battery thermistor mapping table for it.

Change-Id: Id07a66fc343c8375dd6e8ae466ff6c0e700f58cc
Signed-off-by: default avatarChunmei Cai <ccai@codeaurora.org>
parent 35b060cd
Loading
Loading
Loading
Loading
+73 −0
Original line number Diff line number Diff line
@@ -436,6 +436,60 @@ static const struct qpnp_vadc_map_pt adcmap_qrd_skuc_btm_threshold[] = {
	{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},
@@ -1019,6 +1073,25 @@ int32_t qpnp_adc_scale_qrd_skuc_batt_therm(struct qpnp_vadc_chip *chip,
}
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;

	bat_voltage = qpnp_adc_scale_ratiometric_calib(adc_code,
			adc_properties, chan_properties);

	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,
+1 −0
Original line number Diff line number Diff line
@@ -163,6 +163,7 @@ static struct qpnp_vadc_scale_fn vadc_scale_fn[] = {
	[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},
};

static struct qpnp_vadc_rscale_fn adc_vadc_rscale_fn[] = {
+26 −0
Original line number Diff line number Diff line
@@ -255,6 +255,8 @@ enum qpnp_adc_channel_scaling_param {
 *          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_NONE: Do not use this scaling type.
 */
enum qpnp_adc_scale_fn_type {
@@ -272,6 +274,7 @@ enum qpnp_adc_scale_fn_type {
	SCALE_NCP_03WF683_THERM,
	SCALE_QRD_SKUT1_BATT_THERM,
	SCALE_QRD_SKUC_BATT_THERM,
	SCALE_QRD_SKUE_BATT_THERM,
	SCALE_NONE,
};

@@ -1294,6 +1297,23 @@ int32_t qpnp_adc_scale_qrd_skuc_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_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 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_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
@@ -1734,6 +1754,12 @@ static inline int32_t qpnp_adc_scale_qrd_skuc_batt_therm(
			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,