Commit eb9aecd9 authored by Michael Kao's avatar Michael Kao Committed by Eduardo Valentin

thermal: mediatek: fix register index error

The index of msr and adcpnp should match the sensor
which belongs to the selected bank in the for loop.

Fixes: b7cf0053 ("thermal: Add Mediatek thermal driver for mt2701.")
Signed-off-by: default avatarMichael Kao <michael.kao@mediatek.com>
Signed-off-by: default avatarEduardo Valentin <edubezval@gmail.com>
parent 7797ff42
...@@ -431,7 +431,8 @@ static int mtk_thermal_bank_temperature(struct mtk_thermal_bank *bank) ...@@ -431,7 +431,8 @@ static int mtk_thermal_bank_temperature(struct mtk_thermal_bank *bank)
u32 raw; u32 raw;
for (i = 0; i < conf->bank_data[bank->id].num_sensors; i++) { for (i = 0; i < conf->bank_data[bank->id].num_sensors; i++) {
raw = readl(mt->thermal_base + conf->msr[i]); raw = readl(mt->thermal_base +
conf->msr[conf->bank_data[bank->id].sensors[i]]);
temp = raw_to_mcelsius(mt, temp = raw_to_mcelsius(mt,
conf->bank_data[bank->id].sensors[i], conf->bank_data[bank->id].sensors[i],
...@@ -568,7 +569,8 @@ static void mtk_thermal_init_bank(struct mtk_thermal *mt, int num, ...@@ -568,7 +569,8 @@ static void mtk_thermal_init_bank(struct mtk_thermal *mt, int num,
for (i = 0; i < conf->bank_data[num].num_sensors; i++) for (i = 0; i < conf->bank_data[num].num_sensors; i++)
writel(conf->sensor_mux_values[conf->bank_data[num].sensors[i]], writel(conf->sensor_mux_values[conf->bank_data[num].sensors[i]],
mt->thermal_base + conf->adcpnp[i]); mt->thermal_base +
conf->adcpnp[conf->bank_data[num].sensors[i]]);
writel((1 << conf->bank_data[num].num_sensors) - 1, writel((1 << conf->bank_data[num].num_sensors) - 1,
mt->thermal_base + TEMP_MONCTL0); mt->thermal_base + TEMP_MONCTL0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment