summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSiddartha Mohanadoss <smohanad@codeaurora.org>2016-04-28 14:12:44 -0700
committerJeevan Shriram <jshriram@codeaurora.org>2016-05-10 13:20:13 -0700
commit81a5895080b012100d7e7f8cda695489734ee07a (patch)
tree0ad9c0958f42ca1cd01de89c3bb476c77b13dc83 /include
parentbe6417fef9816bebe92db5d5d7288d255ccf6216 (diff)
thermal: qpnp-adc-tm: Support refreshed BTM driver
The BTM (Battery temperature module) peripheral driver on the PMIC (Power management IC) supports threshold monitoring and notifies clients when thresholds are crossed. PMCOBALT supports refreshed BTM peripheral register interface and the driver uses compatible property qpnp-adc-tm-hc to distinguish using the refreshed peripheral. The external client interface with the driver remains the same. Updates include handling the interrupt when the thresholds are crossed,programming the threholds and configuring the hardware based on the refreshed design. BTM peripheral needs the VADC_HC peripheral to compute the gain/offset that are used to reverse compute the threhold values to ADC code. Some of the reverse computation API's such as calculating thermistor thresholds require the gain and offset values before computing the ADC code to be programmed. This requires modification to the existing calibration API in the VADC_HC driver to calculate the reference calibration points and store these values for clients to use in the reverse computation Change-Id: I989cfa4f40e7f1671f04dfa9d4c3fe2ccbbc44ab Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/qpnp/qpnp-adc.h20
1 files changed, 17 insertions, 3 deletions
diff --git a/include/linux/qpnp/qpnp-adc.h b/include/linux/qpnp/qpnp-adc.h
index e143b93ce020..8d51ddcd4246 100644
--- a/include/linux/qpnp/qpnp-adc.h
+++ b/include/linux/qpnp/qpnp-adc.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2015, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -1062,7 +1062,7 @@ struct qpnp_vadc_chan_properties {
enum qpnp_adc_tm_channel_select tm_channel_select;
enum qpnp_state_request state_request;
enum qpnp_adc_calib_type calib_type;
- struct qpnp_vadc_linear_graph adc_graph[2];
+ struct qpnp_vadc_linear_graph adc_graph[ADC_HC_CAL_SEL_NONE];
};
/**
@@ -1243,6 +1243,10 @@ struct qpnp_adc_drv {
* @fast_avg_setup - Ability to provide single result from the ADC
* that is an average of multiple measurements.
* @trigger_channel - HW trigger channel for conversion sequencer.
+ * @calib_type - Used to store the calibration type for the channel
+ * absolute/ratiometric.
+ * @cal_val - Used to determine if fresh calibration value or timer
+ * updated calibration value is to be used.
* @chan_prop - Represent the channel properties of the ADC.
*/
struct qpnp_adc_amux_properties {
@@ -1252,6 +1256,8 @@ struct qpnp_adc_amux_properties {
uint32_t hw_settle_time;
uint32_t fast_avg_setup;
enum qpnp_vadc_trigger trigger_channel;
+ enum qpnp_adc_calib_type calib_type;
+ enum qpnp_adc_cal_val cal_val;
struct qpnp_vadc_chan_properties chan_prop[0];
};
@@ -1683,19 +1689,25 @@ int32_t qpnp_adc_qrd_skut1_btm_scaler(struct qpnp_vadc_chip *dev,
* and convert given temperature to voltage on supported
* thermistor channels using 100k pull-up.
* @dev: Structure device for qpnp vadc
+ * @adc_prop: adc properties of the qpnp adc such as bit resolution,
+ * reference voltage.
* @param: The input temperature values.
*/
int32_t qpnp_adc_tm_scale_therm_voltage_pu2(struct qpnp_vadc_chip *dev,
+ const struct qpnp_adc_properties *adc_properties,
struct qpnp_adc_tm_config *param);
/**
* qpnp_adc_tm_scale_therm_voltage_pu2() - Performs reverse calibration
* and converts the given ADC code to temperature for
* thermistor channels using 100k pull-up.
* @dev: Structure device for qpnp vadc
+ * @adc_prop: adc properties of the qpnp adc such as bit resolution,
+ * reference voltage.
* @reg: The input ADC code.
* @result: The physical measurement temperature on the thermistor.
*/
int32_t qpnp_adc_tm_scale_voltage_therm_pu2(struct qpnp_vadc_chip *dev,
+ const struct qpnp_adc_properties *adc_prop,
uint32_t reg, int64_t *result);
/**
* qpnp_adc_usb_scaler() - Performs reverse calibration on the low/high
@@ -2017,11 +2029,13 @@ static inline int32_t qpnp_adc_scale_millidegc_pmic_voltage_thr(
{ return -ENXIO; }
static inline int32_t qpnp_adc_tm_scale_therm_voltage_pu2(
struct qpnp_vadc_chip *dev,
+ const struct qpnp_adc_properties *adc_properties,
struct qpnp_adc_tm_config *param)
{ return -ENXIO; }
static inline int32_t qpnp_adc_tm_scale_voltage_therm_pu2(
struct qpnp_vadc_chip *dev,
- uint32_t reg, int64_t *result)
+ const struct qpnp_adc_properties *adc_prop,
+ uint32_t reg, int64_t *result)
{ return -ENXIO; }
static inline int32_t qpnp_adc_smb_btm_rscaler(struct qpnp_vadc_chip *dev,
struct qpnp_adc_tm_btm_param *param,