Merge "thermal: adc-tm: Fix ADC_TM channel mapping"

This commit is contained in:
qctecmdr 2020-02-25 22:31:33 -08:00 • committed by Gerrit - the friendly Code Review server
commit 60cf4cdf62
2 changed files with 14 additions and 2 deletions

View file

@ -942,6 +942,7 @@ static int adc5_get_dt_data(struct adc5_chip *adc, struct device_node *node)
adc_chan = &data->adc_chans[prop.channel];
iio_chan->channel = prop.channel;
iio_chan->channel2 = prop.sid;
iio_chan->datasheet_name = prop.datasheet_name;
iio_chan->extend_name = prop.datasheet_name;
iio_chan->info_mask_separate = adc_chan->info_mask;

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");