From 380a45aae0c1ceeab6c708fc6451cb60149a8fb1 Mon Sep 17 00:00:00 2001 From: Jishnu Prakash Date: Mon, 17 Feb 2020 23:43:18 +0530 Subject: [PATCH] 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 --- drivers/thermal/qcom/adc-tm.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/thermal/qcom/adc-tm.c b/drivers/thermal/qcom/adc-tm.c index 4dbbd5b7567f..d442ee3aae5e 100644 --- a/drivers/thermal/qcom/adc-tm.c +++ b/drivers/thermal/qcom/adc-tm.c @@ -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");