diff mbox series

[1/7] thermal: mediatek: fix register index error

Message ID 1549006693-11659-2-git-send-email-michael.kao@mediatek.com (mailing list archive)
State New, archived
Headers show
Series Add Mediatek thermal dirver for mt8183 | expand

Commit Message

Michael Kao Feb. 1, 2019, 7:38 a.m. UTC
From: Michael Kao <michael.kao@mediatek.com>

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

Signed-off-by: Michael Kao <michael.kao@mediatek.com>
---
 drivers/thermal/mtk_thermal.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Matthias Brugger Feb. 4, 2019, 5:24 p.m. UTC | #1
On 01/02/2019 08:38, michael.kao@mediatek.com wrote:
> From: Michael Kao <michael.kao@mediatek.com>
> 
> The index of msr and adcpnp should match the sensor
> which belongs to the selected bank in the for loop.
> 

If I get that right, this fixes
b7cf0053738c ("thermal: Add Mediatek thermal driver for mt2701.")

So please add a fixes tag to the commit.

Thanks,
Matthias

> Signed-off-by: Michael Kao <michael.kao@mediatek.com>
> ---
>  drivers/thermal/mtk_thermal.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/thermal/mtk_thermal.c b/drivers/thermal/mtk_thermal.c
> index 0691f26..f646436 100644
> --- a/drivers/thermal/mtk_thermal.c
> +++ b/drivers/thermal/mtk_thermal.c
> @@ -431,7 +431,8 @@ static int mtk_thermal_bank_temperature(struct mtk_thermal_bank *bank)
>  	u32 raw;
>  
>  	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,
>  				       conf->bank_data[bank->id].sensors[i],
> @@ -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++)
>  		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,
>  	       mt->thermal_base + TEMP_MONCTL0);
>
Michael Kao Feb. 12, 2019, 8:20 a.m. UTC | #2
On Mon, 2019-02-04 at 18:24 +0100, Matthias Brugger wrote:
> 
> On 01/02/2019 08:38, michael.kao@mediatek.com wrote:
> > From: Michael Kao <michael.kao@mediatek.com>
> > 
> > The index of msr and adcpnp should match the sensor
> > which belongs to the selected bank in the for loop.
> > 
> 
> If I get that right, this fixes
> b7cf0053738c ("thermal: Add Mediatek thermal driver for mt2701.")
> 
> So please add a fixes tag to the commit.

It is true that the patch is fix b7cf0053738c.
I will add 
Fixes: b7cf0053738c ("thermal: Add Mediatek thermal driver for mt2701.")
to the commit message of next version.

> Thanks,
> Matthias
> 
> > Signed-off-by: Michael Kao <michael.kao@mediatek.com>
> > ---
> >  drivers/thermal/mtk_thermal.c | 6 ++++--
> >  1 file changed, 4 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/thermal/mtk_thermal.c b/drivers/thermal/mtk_thermal.c
> > index 0691f26..f646436 100644
> > --- a/drivers/thermal/mtk_thermal.c
> > +++ b/drivers/thermal/mtk_thermal.c
> > @@ -431,7 +431,8 @@ static int mtk_thermal_bank_temperature(struct mtk_thermal_bank *bank)
> >  	u32 raw;
> >  
> >  	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,
> >  				       conf->bank_data[bank->id].sensors[i],
> > @@ -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++)
> >  		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,
> >  	       mt->thermal_base + TEMP_MONCTL0);
> >
diff mbox series

Patch

diff --git a/drivers/thermal/mtk_thermal.c b/drivers/thermal/mtk_thermal.c
index 0691f26..f646436 100644
--- a/drivers/thermal/mtk_thermal.c
+++ b/drivers/thermal/mtk_thermal.c
@@ -431,7 +431,8 @@  static int mtk_thermal_bank_temperature(struct mtk_thermal_bank *bank)
 	u32 raw;
 
 	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,
 				       conf->bank_data[bank->id].sensors[i],
@@ -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++)
 		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,
 	       mt->thermal_base + TEMP_MONCTL0);