Merge "hwmon: qpnp-adc-tm: Add version check for VADC_TM channel"

This commit is contained in:
Linux Build Service Account 2015-06-12 07:57:53 -07:00 committed by Gerrit - the friendly Code Review server
commit 887c77f24d
2 changed files with 24 additions and 1 deletions

View File

@ -333,6 +333,7 @@
qcom,adc-bit-resolution = <15>;
qcom,adc-vdd-reference = <1800>;
qcom,adc_tm-vadc = <&pm8950_vadc>;
qcom,pmic-revid = <&pm8950_revid>;
chan@36 {
label = "pa_therm0";
@ -346,6 +347,18 @@
qcom,btm-channel-number = <0x48>;
qcom,thermal-node;
};
chan@7 {
label = "vph_pwr";
reg = <0x7>;
qcom,decimation = <0>;
qcom,pre-div-channel-scaling = <1>;
qcom,calibration-type = "absolute";
qcom,scale-function = <0>;
qcom,hw-settle-time = <0>;
qcom,fast-avg-setup = <0>;
qcom,btm-channel-number = <0x68>;
};
};
pm8950_rtc: qcom,pm8950_rtc {

View File

@ -2021,7 +2021,7 @@ int32_t qpnp_adc_tm_channel_measure(struct qpnp_adc_tm_chip *chip,
struct qpnp_adc_tm_btm_param *param)
{
uint32_t channel, dt_index = 0, scale_type = 0;
int rc = 0, i = 0;
int rc = 0, i = 0, version = 0;
bool chan_found = false;
if (qpnp_adc_tm_is_valid(chip)) {
@ -2037,6 +2037,16 @@ int32_t qpnp_adc_tm_channel_measure(struct qpnp_adc_tm_chip *chip,
mutex_lock(&chip->adc->adc_lock);
channel = param->channel;
if (channel == VSYS) {
version = qpnp_adc_get_revid_version(chip->dev);
if (version == QPNP_REV_ID_PM8950_1_0) {
pr_debug("Channel not supported\n");
rc = -EINVAL;
goto fail_unlock;
}
}
while (i < chip->max_channels_available) {
if (chip->adc->adc_channels[i].channel_num ==
channel) {