diff mbox series

thermal/drivers/mediatek/lvts_thermal: Remove redundant code in lvts_ctrl_configure

Message ID 20240410000730.628043-1-treapking@chromium.org (mailing list archive)
State New, archived
Headers show
Series thermal/drivers/mediatek/lvts_thermal: Remove redundant code in lvts_ctrl_configure | expand

Commit Message

Pin-yen Lin April 10, 2024, 12:07 a.m. UTC
The removed variable assignment is never written to the register, so it
has no effect on the device behavior.  Mediatek has confirmed that it
is not required to initialize this register for current platforms, so
remove this segment to avoid confusion.

Signed-off-by: Pin-yen Lin <treapking@chromium.org>

---

 drivers/thermal/mediatek/lvts_thermal.c | 6 ------
 1 file changed, 6 deletions(-)

Comments

Chen-Yu Tsai April 10, 2024, 4:38 a.m. UTC | #1
On Wed, Apr 10, 2024 at 8:07 AM Pin-yen Lin <treapking@chromium.org> wrote:
>
> The removed variable assignment is never written to the register, so it
> has no effect on the device behavior.  Mediatek has confirmed that it
> is not required to initialize this register for current platforms, so
> remove this segment to avoid confusion.
>
> Signed-off-by: Pin-yen Lin <treapking@chromium.org>

Reviewed-by: Chen-Yu Tsai <wenst@chromium.org>
AngeloGioacchino Del Regno April 10, 2024, 9:55 a.m. UTC | #2
Il 10/04/24 02:07, Pin-yen Lin ha scritto:
> The removed variable assignment is never written to the register, so it
> has no effect on the device behavior.  Mediatek has confirmed that it
> is not required to initialize this register for current platforms, so
> remove this segment to avoid confusion.
> 
> Signed-off-by: Pin-yen Lin <treapking@chromium.org>
> 

Added Nicolas Pitre to the loop;

Nicolas, since you're pushing support for those, can you please check if CALSCALE
is used/useful/necessary on MT8186/88 before I give a R-b to this commit?

P.S.: Can anyone from MediaTek please confirm if the 0x300 value is right for this
       register? I'd still like Linux to properly initialize the registers, even if
       this could technically be a default value.


> ---
> 
>   drivers/thermal/mediatek/lvts_thermal.c | 6 ------
>   1 file changed, 6 deletions(-)
> 
> diff --git a/drivers/thermal/mediatek/lvts_thermal.c b/drivers/thermal/mediatek/lvts_thermal.c
> index fd4bd650c77a..48d2f8ba3f18 100644
> --- a/drivers/thermal/mediatek/lvts_thermal.c
> +++ b/drivers/thermal/mediatek/lvts_thermal.c
> @@ -985,12 +985,6 @@ static int lvts_ctrl_configure(struct device *dev, struct lvts_ctrl *lvts_ctrl)
>   	value = LVTS_TSSEL_CONF;
>   	writel(value, LVTS_TSSEL(lvts_ctrl->base));
>   
> -	/*
> -	 * LVTS_CALSCALE : ADC voltage round
> -	 */
> -	value = 0x300;
> -	value = LVTS_CALSCALE_CONF;

As a side note, I believe that the original author wanted to write, instead...

	value = LVTS_CALSCALE_CONF;
	writel(value, LVTS_CALSCALE(lvts_ctrl->base);

Cheers,
Angelo

> -
>   	/*
>   	 * LVTS_MSRCTL0 : Sensor filtering strategy
>   	 *
diff mbox series

Patch

diff --git a/drivers/thermal/mediatek/lvts_thermal.c b/drivers/thermal/mediatek/lvts_thermal.c
index fd4bd650c77a..48d2f8ba3f18 100644
--- a/drivers/thermal/mediatek/lvts_thermal.c
+++ b/drivers/thermal/mediatek/lvts_thermal.c
@@ -985,12 +985,6 @@  static int lvts_ctrl_configure(struct device *dev, struct lvts_ctrl *lvts_ctrl)
 	value = LVTS_TSSEL_CONF;
 	writel(value, LVTS_TSSEL(lvts_ctrl->base));
 
-	/*
-	 * LVTS_CALSCALE : ADC voltage round
-	 */
-	value = 0x300;
-	value = LVTS_CALSCALE_CONF;
-
 	/*
 	 * LVTS_MSRCTL0 : Sensor filtering strategy
 	 *