[PATCH 1/3] riscv: dts: thead: th1520: add coefficients to the PVT node

Icenowy Zheng posted 3 patches 1 month, 2 weeks ago
[PATCH 1/3] riscv: dts: thead: th1520: add coefficients to the PVT node
Posted by Icenowy Zheng 1 month, 2 weeks ago
The manual of TH1520 contains a set of coefficients a little different
to the driver default ones.

Add them to the device tree node of PVT.

Signed-off-by: Icenowy Zheng <uwu@icenowy.me>
---
 arch/riscv/boot/dts/thead/th1520.dtsi | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/riscv/boot/dts/thead/th1520.dtsi b/arch/riscv/boot/dts/thead/th1520.dtsi
index 03f1d73190499..e9c81bdabed8a 100644
--- a/arch/riscv/boot/dts/thead/th1520.dtsi
+++ b/arch/riscv/boot/dts/thead/th1520.dtsi
@@ -676,6 +676,10 @@ pvt: pvt@fffff4e000 {
 			reg-names = "common", "ts", "pd", "vm";
 			clocks = <&aonsys_clk>;
 			#thermal-sensor-cells = <1>;
+			moortec,ts-coeff-g = <42740>;
+			moortec,ts-coeff-h = <220500>;
+			moortec,ts-coeff-j = <(-160)>;
+			moortec,ts-coeff-cal5 = <4094>;
 		};
 
 		gpio@fffff52000 {
-- 
2.50.1
Re: [PATCH 1/3] riscv: dts: thead: th1520: add coefficients to the PVT node
Posted by Drew Fustini 1 month, 1 week ago
On Sat, Aug 16, 2025 at 05:32:07PM +0800, Icenowy Zheng wrote:
> The manual of TH1520 contains a set of coefficients a little different
> to the driver default ones.
> 
> Add them to the device tree node of PVT.
> 
> Signed-off-by: Icenowy Zheng <uwu@icenowy.me>
> ---
>  arch/riscv/boot/dts/thead/th1520.dtsi | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/arch/riscv/boot/dts/thead/th1520.dtsi b/arch/riscv/boot/dts/thead/th1520.dtsi
> index 03f1d73190499..e9c81bdabed8a 100644
> --- a/arch/riscv/boot/dts/thead/th1520.dtsi
> +++ b/arch/riscv/boot/dts/thead/th1520.dtsi
> @@ -676,6 +676,10 @@ pvt: pvt@fffff4e000 {
>  			reg-names = "common", "ts", "pd", "vm";
>  			clocks = <&aonsys_clk>;
>  			#thermal-sensor-cells = <1>;
> +			moortec,ts-coeff-g = <42740>;
> +			moortec,ts-coeff-h = <220500>;
> +			moortec,ts-coeff-j = <(-160)>;
> +			moortec,ts-coeff-cal5 = <4094>;
>  		};
>  
>  		gpio@fffff52000 {
> -- 
> 2.50.1
> 

I think moortec,ts-coeff-XXX will need to be rounded to nearest multiple
of 100 as dtbs_check warns that:

pvt@fffff4e000: moortec,ts-coeff-g: 42740 is not a multiple of 100
	from schema $id: http://devicetree.org/schemas/hwmon/moortec,mr75203.yaml#
pvt@fffff4e000: moortec,ts-coeff-j: -160 is not a multiple of 100
	from schema $id: http://devicetree.org/schemas/hwmon/moortec,mr75203.yaml#
pvt@fffff4e000: moortec,ts-coeff-g: 42740 is not a multiple of 100
	from schema $id: http://devicetree.org/schemas/hwmon/moortec,mr75203.yaml#
pvt@fffff4e000: moortec,ts-coeff-j: -160 is not a multiple of 100
	from schema $id: http://devicetree.org/schemas/hwmon/moortec,mr75203.yaml#

Thanks,
Drew
Re: [PATCH 1/3] riscv: dts: thead: th1520: add coefficients to the PVT node
Posted by Icenowy Zheng 1 month, 1 week ago
在 2025-08-22星期五的 14:29 -0700,Drew Fustini写道:
> On Sat, Aug 16, 2025 at 05:32:07PM +0800, Icenowy Zheng wrote:
> > The manual of TH1520 contains a set of coefficients a little
> > different
> > to the driver default ones.
> > 
> > Add them to the device tree node of PVT.
> > 
> > Signed-off-by: Icenowy Zheng <uwu@icenowy.me>
> > ---
> >  arch/riscv/boot/dts/thead/th1520.dtsi | 4 ++++
> >  1 file changed, 4 insertions(+)
> > 
> > diff --git a/arch/riscv/boot/dts/thead/th1520.dtsi
> > b/arch/riscv/boot/dts/thead/th1520.dtsi
> > index 03f1d73190499..e9c81bdabed8a 100644
> > --- a/arch/riscv/boot/dts/thead/th1520.dtsi
> > +++ b/arch/riscv/boot/dts/thead/th1520.dtsi
> > @@ -676,6 +676,10 @@ pvt: pvt@fffff4e000 {
> >                         reg-names = "common", "ts", "pd", "vm";
> >                         clocks = <&aonsys_clk>;
> >                         #thermal-sensor-cells = <1>;
> > +                       moortec,ts-coeff-g = <42740>;
> > +                       moortec,ts-coeff-h = <220500>;
> > +                       moortec,ts-coeff-j = <(-160)>;
> > +                       moortec,ts-coeff-cal5 = <4094>;
> >                 };
> >  
> >                 gpio@fffff52000 {
> > -- 
> > 2.50.1
> > 
> 
> I think moortec,ts-coeff-XXX will need to be rounded to nearest
> multiple
> of 100 as dtbs_check warns that:
> 
> pvt@fffff4e000: moortec,ts-coeff-g: 42740 is not a multiple of 100
>         from schema $id:
> http://devicetree.org/schemas/hwmon/moortec,mr75203.yaml#
> pvt@fffff4e000: moortec,ts-coeff-j: -160 is not a multiple of 100
>         from schema $id:
> http://devicetree.org/schemas/hwmon/moortec,mr75203.yaml#
> pvt@fffff4e000: moortec,ts-coeff-g: 42740 is not a multiple of 100
>         from schema $id:
> http://devicetree.org/schemas/hwmon/moortec,mr75203.yaml#
> pvt@fffff4e000: moortec,ts-coeff-j: -160 is not a multiple of 100
>         from schema $id:
> http://devicetree.org/schemas/hwmon/moortec,mr75203.yaml#

Then it looks like the binding is to be blamed for not allowing fine
tweak.

> 
> Thanks,
> Drew