diff options
| author | Siddartha Mohanadoss <smohanad@codeaurora.org> | 2016-09-13 14:26:07 -0700 |
|---|---|---|
| committer | Siddartha Mohanadoss <smohanad@codeaurora.org> | 2016-09-22 11:30:54 -0700 |
| commit | e1424860a53d22be47bb6372c0cbab86f5070b00 (patch) | |
| tree | 7b48f85862956fe5dd62ad54c0d34cb8341dec3a | |
| parent | 42d4a124b21b75029df4eec72b856917662925e9 (diff) | |
thermal: adc_tm: Initialize ADC parameters
Initialize ADC parameters for decimation rate and
LDO enable. Common ADC decimation settings is
used across the battery thermistor threshold
channels.
Change-Id: I99ce1e5940506a5e65debfe822460c210a276b00
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
| -rw-r--r-- | drivers/hwmon/qpnp-adc-common.c | 30 | ||||
| -rw-r--r-- | drivers/thermal/qpnp-adc-tm.c | 2 |
2 files changed, 14 insertions, 18 deletions
diff --git a/drivers/hwmon/qpnp-adc-common.c b/drivers/hwmon/qpnp-adc-common.c index 3776e748647e..787a9e5a15c8 100644 --- a/drivers/hwmon/qpnp-adc-common.c +++ b/drivers/hwmon/qpnp-adc-common.c @@ -1820,7 +1820,7 @@ int32_t qpnp_adc_get_devicetree_data(struct platform_device *pdev, struct qpnp_adc_amux *adc_channel_list; struct qpnp_adc_properties *adc_prop; struct qpnp_adc_amux_properties *amux_prop; - int count_adc_channel_list = 0, decimation, rc = 0, i = 0; + int count_adc_channel_list = 0, decimation = 0, rc = 0, i = 0; int decimation_tm_hc = 0, fast_avg_setup_tm_hc = 0, cal_val_hc = 0; bool adc_hc; @@ -1927,22 +1927,6 @@ int32_t qpnp_adc_get_devicetree_data(struct platform_device *pdev, return -EINVAL; } - /* - * ADC_TM_HC decimation setting is common across - * channels. - */ - if (!of_device_is_compatible(node, - "qcom,qpnp-adc-tm-hc")) { - rc = of_property_read_u32(child, - "qcom,decimation", &decimation); - if (rc) { - pr_err("Invalid decimation\n"); - return -EINVAL; - } - } else { - decimation = decimation_tm_hc; - } - if (!strcmp(calibration_param, "absolute")) { if (adc_hc) calib_type = ADC_HC_ABS_CAL; @@ -1980,6 +1964,18 @@ int32_t qpnp_adc_get_devicetree_data(struct platform_device *pdev, fast_avg_setup = fast_avg_setup_tm_hc; } + /* ADC_TM_HC decimation setting is common across channels */ + if (!of_device_is_compatible(node, "qcom,qpnp-adc-tm-hc")) { + rc = of_property_read_u32(child, + "qcom,decimation", &decimation); + if (rc) { + pr_err("Invalid decimation\n"); + return -EINVAL; + } + } else { + decimation = decimation_tm_hc; + } + if (of_device_is_compatible(node, "qcom,qpnp-vadc-hc")) { rc = of_property_read_u32(child, "qcom,cal-val", &cal_val_hc); diff --git a/drivers/thermal/qpnp-adc-tm.c b/drivers/thermal/qpnp-adc-tm.c index 84ab45fde4ae..c78406cb3325 100644 --- a/drivers/thermal/qpnp-adc-tm.c +++ b/drivers/thermal/qpnp-adc-tm.c @@ -492,7 +492,7 @@ static int32_t qpnp_adc_tm_rc_check_channel_en(struct qpnp_adc_tm_chip *chip) { u8 adc_tm_ctl = 0, status_low = 0, status_high = 0; int rc = 0, i = 0; - bool ldo_en; + bool ldo_en = false; for (i = 0; i < chip->max_channels_available; i++) { rc = qpnp_adc_tm_read_reg(chip, QPNP_BTM_Mn_CTL(i), |
