mirror of
https://github.com/team-infusion-developers/android_kernel_samsung_msm8976.git
synced 2024-09-21 03:43:03 +00:00
hwmon: qpnp-adc Add support for fsm9900 target
Add support for thermistor design and mapping table used on fsm9900 target. Change-Id: I1c22e6a55ddb5dfcb75b69ec6f807f8c2d6b2eb8 Acked-by: Jim Granitzki <jamesg@qti.qualcomm.com> Signed-off-by: Venkatesh Yadav Abbarapu <quicvenkat@codeaurora.org>
This commit is contained in:
parent
60d7547987
commit
0f45ef107f
|
@ -512,6 +512,44 @@ static const struct qpnp_vadc_map_pt adcmap_smb_batt_therm[] = {
|
|||
{790, 186}
|
||||
};
|
||||
|
||||
/* Voltage to temperature */
|
||||
static const struct qpnp_vadc_map_pt adcmap_ncp03wf683[] = {
|
||||
{1742, -40},
|
||||
{1718, -35},
|
||||
{1687, -30},
|
||||
{1647, -25},
|
||||
{1596, -20},
|
||||
{1534, -15},
|
||||
{1459, -10},
|
||||
{1372, -5},
|
||||
{1275, 0},
|
||||
{1169, 5},
|
||||
{1058, 10},
|
||||
{945, 15},
|
||||
{834, 20},
|
||||
{729, 25},
|
||||
{630, 30},
|
||||
{541, 35},
|
||||
{461, 40},
|
||||
{392, 45},
|
||||
{332, 50},
|
||||
{280, 55},
|
||||
{236, 60},
|
||||
{199, 65},
|
||||
{169, 70},
|
||||
{142, 75},
|
||||
{121, 80},
|
||||
{102, 85},
|
||||
{87, 90},
|
||||
{74, 95},
|
||||
{64, 100},
|
||||
{55, 105},
|
||||
{47, 110},
|
||||
{40, 115},
|
||||
{35, 120},
|
||||
{30, 125}
|
||||
};
|
||||
|
||||
static int32_t qpnp_adc_map_voltage_temp(const struct qpnp_vadc_map_pt *pts,
|
||||
uint32_t tablesize, int32_t input, int64_t *output)
|
||||
{
|
||||
|
@ -965,6 +1003,25 @@ int32_t qpnp_adc_tm_scale_therm_voltage_pu2(struct qpnp_vadc_chip *chip,
|
|||
}
|
||||
EXPORT_SYMBOL(qpnp_adc_tm_scale_therm_voltage_pu2);
|
||||
|
||||
int32_t qpnp_adc_scale_therm_ncp03(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 therm_voltage = 0;
|
||||
|
||||
therm_voltage = qpnp_adc_scale_ratiometric_calib(adc_code,
|
||||
adc_properties, chan_properties);
|
||||
|
||||
qpnp_adc_map_voltage_temp(adcmap_ncp03wf683,
|
||||
ARRAY_SIZE(adcmap_ncp03wf683),
|
||||
therm_voltage, &adc_chan_result->physical);
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(qpnp_adc_scale_therm_ncp03);
|
||||
|
||||
int32_t qpnp_adc_scale_batt_id(struct qpnp_vadc_chip *chip,
|
||||
int32_t adc_code,
|
||||
const struct qpnp_adc_properties *adc_properties,
|
||||
|
|
|
@ -132,6 +132,7 @@ static struct qpnp_vadc_scale_fn vadc_scale_fn[] = {
|
|||
[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},
|
||||
[SCALE_NCP_03WF683_THERM] = {qpnp_adc_scale_therm_ncp03},
|
||||
};
|
||||
|
||||
static int32_t qpnp_vadc_read_reg(struct qpnp_vadc_chip *vadc, int16_t reg,
|
||||
|
|
|
@ -247,6 +247,7 @@ enum qpnp_adc_scale_fn_type {
|
|||
SCALE_SMB_BATT_THERM,
|
||||
SCALE_QRD_SKUG_BATT_THERM,
|
||||
SCALE_QRD_SKUH_BATT_THERM,
|
||||
SCALE_NCP_03WF683_THERM,
|
||||
SCALE_NONE,
|
||||
};
|
||||
|
||||
|
@ -1292,6 +1293,23 @@ int32_t qpnp_adc_scale_therm_pu2(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_therm_ncp03() - Scales the pre-calibrated digital output
|
||||
* of an ADC to the ADC reference and compensates for the
|
||||
* gain and offset. Returns the temperature of the therm in degC.
|
||||
* It uses a mapping table computed for a NCP03WF683.
|
||||
* @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_therm_ncp03(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_get_vadc() - Clients need to register with the vadc using the
|
||||
* corresponding device instance it wants to read the channels
|
||||
|
@ -1575,6 +1593,12 @@ static inline int32_t qpnp_adc_scale_therm_pu2(struct qpnp_vadc_chip *vadc,
|
|||
const struct qpnp_vadc_chan_properties *chan_prop,
|
||||
struct qpnp_vadc_result *chan_rslt)
|
||||
{ return -ENXIO; }
|
||||
static inline int32_t qpnp_adc_scale_therm_ncp03(struct qpnp_vadc_chip *vadc,
|
||||
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 struct qpnp_vadc_chip *qpnp_get_vadc(struct device *dev,
|
||||
const char *name)
|
||||
{ return ERR_PTR(-ENXIO); }
|
||||
|
|
Loading…
Reference in a new issue