thermal: adc-tm: Fix ADC_TM channel mapping

Correct channel mapping from VADC's io-channel nodes for
PMIC7 ADC.
Add compatible property for ADC_TM_IIO node
of type PMIC7, as it cannot use the same property as ADC_TM_IIO
node of type PMIC5, as channel numbers are computed differently.

Change-Id: Ib171e2139b1f4c83e78a5fe7a8d73345f75debf2
Signed-off-by: Jishnu Prakash <jprakash@codeaurora.org>
This commit is contained in:
Jishnu Prakash 2020-02-17 23:43:18 +05:30
commit 380a45aae0

View file

@ -189,6 +189,10 @@ static const struct of_device_id adc_tm_match_table[] = {
.compatible = "qcom,adc-tm5-iio",
.data = &data_adc_tm5,
},
{
.compatible = "qcom,adc-tm7-iio",
.data = &data_adc_tm7,
},
{
.compatible = "qcom,adc-tm7",
.data = &data_adc_tm7,
@ -353,8 +357,14 @@ static int adc_tm_get_dt_data(struct platform_device *pdev,
while (i < dt_chan_num) {
chan_adc = &chan[i];
if (chan_adc->channel->channel == channel_num)
if (chan_adc->channel->channel == channel_num) {
if ((adc_tm->data == &data_adc_tm7) &&
(chan_adc->channel->channel2 != sid)) {
i++;
continue;
}
adc_tm->sensor[idx].adc = chan_adc;
}
i++;
}
idx++;
@ -432,7 +442,8 @@ static int adc_tm_probe(struct platform_device *pdev)
return ret;
}
if (of_device_is_compatible(node, "qcom,adc-tm5-iio")) {
if (of_device_is_compatible(node, "qcom,adc-tm5-iio") ||
of_device_is_compatible(node, "qcom,adc-tm7-iio")) {
ret = adc_tm_register_tzd(adc_tm, dt_chan_num, false);
if (ret) {
dev_err(dev, "adc-tm failed to register with of thermal\n");