Subject: [PATCH 0/5] MT8195 Acer Tomato - devicetrees Part 3

This series adds support for the WiFi card on PCI-Express,
eDP (internal) and DP (external) displays and adds thermal
configuration for the "extra" thermistors present on Cherry boards.

All Cherry Chromebooks now have working display and wireless
connectivity!

At this point, the only missing component is vcodec decoders, but
that's to be done in mt8195.dtsi, globally, not machine specific.
Please note that in this series the eDP panel was put on aux-bus,
hence this depends on the series introducing support for it [1]
in the mtk-dp driver.

[1]: https://lore.kernel.org/lkml/[email protected]/

AngeloGioacchino Del Regno (5):
arm64: dts: mediatek: cherry: Add platform thermal configuration
arm64: dts: mediatek: cherry: Assign dp-intf aliases
arm64: dts: mediatek: cherry: Configure eDP and internal display
arm64: dts: mediatek: cherry: Enable PCI-Express ports for WiFi
arm64: dts: mediatek: cherry-tomato-r1: Enable NVMe PCI-Express port

.../dts/mediatek/mt8195-cherry-tomato-r1.dts | 7 +
.../boot/dts/mediatek/mt8195-cherry.dtsi | 164 ++++++++++++++++++
2 files changed, 171 insertions(+)

--
2.40.0


Subject: [PATCH 2/5] arm64: dts: mediatek: cherry: Assign dp-intf aliases

On Cherry boards, the IP at 0x1c015000 (dp_intf0) is used as primary
dp-intf, while the other at 0x1c113000 (dp_intf1) is used as secondary:
assign them to dp-intf{0,1} aliases respectively.

Signed-off-by: AngeloGioacchino Del Regno <[email protected]>
---
arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi | 2 ++
1 file changed, 2 insertions(+)

diff --git a/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi b/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi
index 0820e9ba3829..918380697a9a 100644
--- a/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi
@@ -10,6 +10,8 @@

/ {
aliases {
+ dp-intf0 = &dp_intf0;
+ dp-intf1 = &dp_intf1;
i2c0 = &i2c0;
i2c1 = &i2c1;
i2c2 = &i2c2;
--
2.40.0

Subject: [PATCH 1/5] arm64: dts: mediatek: cherry: Add platform thermal configuration

This platform has three auxiliary NTC thermistors, connected to the
SoC's ADC pins. Enable the auxadc in order to be able to read the
ADC values, add a generic-adc-thermal LUT for each and finally assign
them to the SoC's thermal zones.

Signed-off-by: AngeloGioacchino Del Regno <[email protected]>
---
.../boot/dts/mediatek/mt8195-cherry.dtsi | 105 ++++++++++++++++++
1 file changed, 105 insertions(+)

diff --git a/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi b/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi
index 8ac80a136c37..0820e9ba3829 100644
--- a/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi
@@ -114,6 +114,77 @@ ppvar_sys: regulator-ppvar-sys {
regulator-boot-on;
};

+ /* Murata NCP03WF104F05RL */
+ tboard_thermistor1: thermal-sensor-t1 {
+ compatible = "generic-adc-thermal";
+ #thermal-sensor-cells = <0>;
+ io-channels = <&auxadc 0>;
+ io-channel-names = "sensor-channel";
+ temperature-lookup-table = < (-10000) 1553
+ (-5000) 1485
+ 0 1406
+ 5000 1317
+ 10000 1219
+ 15000 1115
+ 20000 1007
+ 25000 900
+ 30000 796
+ 35000 697
+ 40000 605
+ 45000 523
+ 50000 449
+ 55000 384
+ 60000 327
+ 65000 279
+ 70000 237
+ 75000 202
+ 80000 172
+ 85000 147
+ 90000 125
+ 95000 107
+ 100000 92
+ 105000 79
+ 110000 68
+ 115000 59
+ 120000 51
+ 125000 44>;
+ };
+
+ tboard_thermistor2: thermal-sensor-t2 {
+ compatible = "generic-adc-thermal";
+ #thermal-sensor-cells = <0>;
+ io-channels = <&auxadc 1>;
+ io-channel-names = "sensor-channel";
+ temperature-lookup-table = < (-10000) 1553
+ (-5000) 1485
+ 0 1406
+ 5000 1317
+ 10000 1219
+ 15000 1115
+ 20000 1007
+ 25000 900
+ 30000 796
+ 35000 697
+ 40000 605
+ 45000 523
+ 50000 449
+ 55000 384
+ 60000 327
+ 65000 279
+ 70000 237
+ 75000 202
+ 80000 172
+ 85000 147
+ 90000 125
+ 95000 107
+ 100000 92
+ 105000 79
+ 110000 68
+ 115000 59
+ 120000 51
+ 125000 44>;
+ };
+
usb_vbus: regulator-5v0-usb-vbus {
compatible = "regulator-fixed";
regulator-name = "usb-vbus";
@@ -260,6 +331,10 @@ &gpu {
mali-supply = <&mt6315_7_vbuck1>;
};

+&auxadc {
+ status = "okay";
+};
+
&i2c0 {
status = "okay";

@@ -1098,6 +1173,36 @@ mt6315_7_vbuck1: vbuck1 {
};
};

+&thermal_zones {
+ soc_area_ntc {
+ polling-delay = <1000>;
+ polling-delay-passive = <250>;
+ thermal-sensors = <&tboard_thermistor1>;
+
+ trips {
+ trip-crit {
+ temperature = <95000>;
+ hysteresis = <2000>;
+ type = "critical";
+ };
+ };
+ };
+
+ pmic_area_ntc {
+ polling-delay = <1000>;
+ polling-delay-passive = <0>;
+ thermal-sensors = <&tboard_thermistor2>;
+
+ trips {
+ trip-crit {
+ temperature = <95000>;
+ hysteresis = <2000>;
+ type = "critical";
+ };
+ };
+ };
+};
+
&u3phy0 {
status = "okay";
};
--
2.40.0

Subject: [PATCH 4/5] arm64: dts: mediatek: cherry: Enable PCI-Express ports for WiFi

On the Cherry platform, a MT7621 WiFi+Bluetooth combo is connected
over PCI-Express (for WiFi) and USB (for BT): enable the PCIe ports
to enable enumerating this chip.

Signed-off-by: AngeloGioacchino Del Regno <[email protected]>
---
.../boot/dts/mediatek/mt8195-cherry.dtsi | 25 +++++++++++++++++++
1 file changed, 25 insertions(+)

diff --git a/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi b/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi
index 46f1c8091498..9e2bc363c9cd 100644
--- a/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi
@@ -567,6 +567,13 @@ flash@0 {
};
};

+&pcie1 {
+ status = "okay";
+
+ pinctrl-names = "default";
+ pinctrl-0 = <&pcie1_pins_default>;
+};
+
&pio {
mediatek,rsel-resistance-in-si-unit;
pinctrl-names = "default";
@@ -961,6 +968,24 @@ pins-vreg-en {
};
};

+ pcie0_pins_default: pcie0-default-pins {
+ pins-bus {
+ pinmux = <PINMUX_GPIO19__FUNC_WAKEN>,
+ <PINMUX_GPIO20__FUNC_PERSTN>,
+ <PINMUX_GPIO21__FUNC_CLKREQN>;
+ bias-pull-up;
+ };
+ };
+
+ pcie1_pins_default: pcie1-default-pins {
+ pins-bus {
+ pinmux = <PINMUX_GPIO22__FUNC_PERSTN_1>,
+ <PINMUX_GPIO23__FUNC_CLKREQN_1>,
+ <PINMUX_GPIO24__FUNC_WAKEN_1>;
+ bias-pull-up;
+ };
+ };
+
pio_default: pio-default-pins {
pins-wifi-enable {
pinmux = <PINMUX_GPIO58__FUNC_GPIO58>;
--
2.40.0

Subject: [PATCH 5/5] arm64: dts: mediatek: cherry-tomato-r1: Enable NVMe PCI-Express port

On Tomato rev1 the PCIe0 controller is used for NVMe storage.

Signed-off-by: AngeloGioacchino Del Regno <[email protected]>
---
arch/arm64/boot/dts/mediatek/mt8195-cherry-tomato-r1.dts | 7 +++++++
1 file changed, 7 insertions(+)

diff --git a/arch/arm64/boot/dts/mediatek/mt8195-cherry-tomato-r1.dts b/arch/arm64/boot/dts/mediatek/mt8195-cherry-tomato-r1.dts
index 2d5e8f371b6d..11fc83ddf236 100644
--- a/arch/arm64/boot/dts/mediatek/mt8195-cherry-tomato-r1.dts
+++ b/arch/arm64/boot/dts/mediatek/mt8195-cherry-tomato-r1.dts
@@ -20,6 +20,13 @@ &sound {
model = "mt8195_r1019_5682";
};

+&pcie0 {
+ status = "okay";
+
+ pinctrl-names = "default";
+ pinctrl-0 = <&pcie0_pins_default>;
+};
+
&ts_10 {
status = "okay";
};
--
2.40.0

Subject: [PATCH 3/5] arm64: dts: mediatek: cherry: Configure eDP and internal display

Add the required nodes to enable the DisplayPort interface, connected
to the Embedded DisplayPort port, where we have an internal display.

Signed-off-by: AngeloGioacchino Del Regno <[email protected]>
---
.../boot/dts/mediatek/mt8195-cherry.dtsi | 32 +++++++++++++++++++
1 file changed, 32 insertions(+)

diff --git a/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi b/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi
index 918380697a9a..46f1c8091498 100644
--- a/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi
@@ -49,6 +49,18 @@ memory@40000000 {
reg = <0 0x40000000 0 0x80000000>;
};

+ pp3300_disp_x: regulator-pp3300-disp-x {
+ compatible = "regulator-fixed";
+ regulator-name = "pp3300_disp_x";
+ regulator-min-microvolt = <3300000>;
+ regulator-max-microvolt = <3300000>;
+ enable-active-high;
+ gpio = <&pio 55 GPIO_ACTIVE_HIGH>;
+ pinctrl-names = "default";
+ pinctrl-0 = <&panel_fixed_pins>;
+ regulator-always-on;
+ };
+
/* system wide LDO 3.3V power rail */
pp3300_z5: regulator-pp3300-ldo-z5 {
compatible = "regulator-fixed";
@@ -290,6 +302,20 @@ port@1 {
reg = <1>;
edp_out: endpoint {
data-lanes = <0 1 2 3>;
+ remote-endpoint = <&panel_in>;
+ };
+ };
+ };
+
+ aux-bus {
+ panel {
+ compatible = "edp-panel";
+ power-supply = <&pp3300_disp_x>;
+ backlight = <&backlight_lcd0>;
+ port {
+ panel_in: endpoint {
+ remote-endpoint = <&edp_out>;
+ };
};
};
};
@@ -929,6 +955,12 @@ pins-cs {
};
};

+ panel_fixed_pins: panel-pwr-default-pins {
+ pins-vreg-en {
+ pinmux = <PINMUX_GPIO55__FUNC_GPIO55>;
+ };
+ };
+
pio_default: pio-default-pins {
pins-wifi-enable {
pinmux = <PINMUX_GPIO58__FUNC_GPIO58>;
--
2.40.0

2023-04-21 06:58:29

by Chen-Yu Tsai

[permalink] [raw]
Subject: Re: [PATCH 2/5] arm64: dts: mediatek: cherry: Assign dp-intf aliases

On Thu, Apr 20, 2023 at 5:45 PM AngeloGioacchino Del Regno
<[email protected]> wrote:
>
> On Cherry boards, the IP at 0x1c015000 (dp_intf0) is used as primary
> dp-intf, while the other at 0x1c113000 (dp_intf1) is used as secondary:
> assign them to dp-intf{0,1} aliases respectively.
>
> Signed-off-by: AngeloGioacchino Del Regno <[email protected]>
> ---
> arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi | 2 ++

This should be applied at the SoC level. The display pipeline is fixed in
MMSYS, so it applies to all MT8195 devices.

> 1 file changed, 2 insertions(+)
>
> diff --git a/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi b/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi
> index 0820e9ba3829..918380697a9a 100644
> --- a/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi
> +++ b/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi
> @@ -10,6 +10,8 @@
>
> / {
> aliases {
> + dp-intf0 = &dp_intf0;
> + dp-intf1 = &dp_intf1;
> i2c0 = &i2c0;
> i2c1 = &i2c1;
> i2c2 = &i2c2;
> --
> 2.40.0
>
>

2023-04-21 07:01:57

by Chen-Yu Tsai

[permalink] [raw]
Subject: Re: [PATCH 3/5] arm64: dts: mediatek: cherry: Configure eDP and internal display

On Thu, Apr 20, 2023 at 5:45 PM AngeloGioacchino Del Regno
<[email protected]> wrote:
>
> Add the required nodes to enable the DisplayPort interface, connected
> to the Embedded DisplayPort port, where we have an internal display.
>
> Signed-off-by: AngeloGioacchino Del Regno <[email protected]>
> ---
> .../boot/dts/mediatek/mt8195-cherry.dtsi | 32 +++++++++++++++++++
> 1 file changed, 32 insertions(+)
>
> diff --git a/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi b/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi
> index 918380697a9a..46f1c8091498 100644
> --- a/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi
> +++ b/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi
> @@ -49,6 +49,18 @@ memory@40000000 {
> reg = <0 0x40000000 0 0x80000000>;
> };
>
> + pp3300_disp_x: regulator-pp3300-disp-x {
> + compatible = "regulator-fixed";
> + regulator-name = "pp3300_disp_x";
> + regulator-min-microvolt = <3300000>;
> + regulator-max-microvolt = <3300000>;

From the schematics:
vin-supply = <&pp3300_z2>;

Also, this is an RT9742. The datasheet says the typical enable time is
2.1ms. For a bit of margin, I'd say we could model it as 2.5ms? So:

regulator-enable-ramp-delay = <2500>;

ChenYu

> + enable-active-high;
> + gpio = <&pio 55 GPIO_ACTIVE_HIGH>;
> + pinctrl-names = "default";
> + pinctrl-0 = <&panel_fixed_pins>;
> + regulator-always-on;
> + };
> +
> /* system wide LDO 3.3V power rail */
> pp3300_z5: regulator-pp3300-ldo-z5 {
> compatible = "regulator-fixed";
> @@ -290,6 +302,20 @@ port@1 {
> reg = <1>;
> edp_out: endpoint {
> data-lanes = <0 1 2 3>;
> + remote-endpoint = <&panel_in>;
> + };
> + };
> + };
> +
> + aux-bus {
> + panel {
> + compatible = "edp-panel";
> + power-supply = <&pp3300_disp_x>;
> + backlight = <&backlight_lcd0>;
> + port {
> + panel_in: endpoint {
> + remote-endpoint = <&edp_out>;
> + };
> };
> };
> };
> @@ -929,6 +955,12 @@ pins-cs {
> };
> };
>
> + panel_fixed_pins: panel-pwr-default-pins {
> + pins-vreg-en {
> + pinmux = <PINMUX_GPIO55__FUNC_GPIO55>;
> + };
> + };
> +
> pio_default: pio-default-pins {
> pins-wifi-enable {
> pinmux = <PINMUX_GPIO58__FUNC_GPIO58>;
> --
> 2.40.0
>
>

2023-04-21 07:12:21

by Chen-Yu Tsai

[permalink] [raw]
Subject: Re: [PATCH 4/5] arm64: dts: mediatek: cherry: Enable PCI-Express ports for WiFi

On Thu, Apr 20, 2023 at 5:45 PM AngeloGioacchino Del Regno
<[email protected]> wrote:
>
> On the Cherry platform, a MT7621 WiFi+Bluetooth combo is connected
> over PCI-Express (for WiFi) and USB (for BT): enable the PCIe ports
> to enable enumerating this chip.
>
> Signed-off-by: AngeloGioacchino Del Regno <[email protected]>

Tested-by: Chen-Yu Tsai <[email protected]>

2023-04-21 07:48:09

by Chen-Yu Tsai

[permalink] [raw]
Subject: Re: [PATCH 1/5] arm64: dts: mediatek: cherry: Add platform thermal configuration

On Thu, Apr 20, 2023 at 5:45 PM AngeloGioacchino Del Regno
<[email protected]> wrote:
>
> This platform has three auxiliary NTC thermistors, connected to the
> SoC's ADC pins. Enable the auxadc in order to be able to read the
> ADC values, add a generic-adc-thermal LUT for each and finally assign
> them to the SoC's thermal zones.
>
> Signed-off-by: AngeloGioacchino Del Regno <[email protected]>
> ---
> .../boot/dts/mediatek/mt8195-cherry.dtsi | 105 ++++++++++++++++++
> 1 file changed, 105 insertions(+)
>
> diff --git a/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi b/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi
> index 8ac80a136c37..0820e9ba3829 100644
> --- a/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi
> +++ b/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi
> @@ -114,6 +114,77 @@ ppvar_sys: regulator-ppvar-sys {
> regulator-boot-on;
> };
>
> + /* Murata NCP03WF104F05RL */
> + tboard_thermistor1: thermal-sensor-t1 {
> + compatible = "generic-adc-thermal";
> + #thermal-sensor-cells = <0>;
> + io-channels = <&auxadc 0>;
> + io-channel-names = "sensor-channel";
> + temperature-lookup-table = < (-10000) 1553
> + (-5000) 1485
> + 0 1406
> + 5000 1317
> + 10000 1219
> + 15000 1115
> + 20000 1007
> + 25000 900
> + 30000 796
> + 35000 697
> + 40000 605
> + 45000 523
> + 50000 449
> + 55000 384
> + 60000 327
> + 65000 279
> + 70000 237
> + 75000 202
> + 80000 172
> + 85000 147
> + 90000 125
> + 95000 107
> + 100000 92
> + 105000 79
> + 110000 68
> + 115000 59
> + 120000 51
> + 125000 44>;
> + };
> +
> + tboard_thermistor2: thermal-sensor-t2 {
> + compatible = "generic-adc-thermal";
> + #thermal-sensor-cells = <0>;
> + io-channels = <&auxadc 1>;
> + io-channel-names = "sensor-channel";
> + temperature-lookup-table = < (-10000) 1553
> + (-5000) 1485
> + 0 1406
> + 5000 1317
> + 10000 1219
> + 15000 1115
> + 20000 1007
> + 25000 900
> + 30000 796
> + 35000 697
> + 40000 605
> + 45000 523
> + 50000 449
> + 55000 384
> + 60000 327
> + 65000 279
> + 70000 237
> + 75000 202
> + 80000 172
> + 85000 147
> + 90000 125
> + 95000 107
> + 100000 92
> + 105000 79
> + 110000 68
> + 115000 59
> + 120000 51
> + 125000 44>;
> + };
> +
> usb_vbus: regulator-5v0-usb-vbus {
> compatible = "regulator-fixed";
> regulator-name = "usb-vbus";
> @@ -260,6 +331,10 @@ &gpu {
> mali-supply = <&mt6315_7_vbuck1>;
> };
>
> +&auxadc {
> + status = "okay";
> +};
> +
> &i2c0 {
> status = "okay";
>
> @@ -1098,6 +1173,36 @@ mt6315_7_vbuck1: vbuck1 {
> };
> };
>
> +&thermal_zones {
> + soc_area_ntc {
> + polling-delay = <1000>;
> + polling-delay-passive = <250>;
> + thermal-sensors = <&tboard_thermistor1>;
> +
> + trips {
> + trip-crit {
> + temperature = <95000>;
> + hysteresis = <2000>;
> + type = "critical";
> + };
> + };
> + };
> +
> + pmic_area_ntc {
> + polling-delay = <1000>;
> + polling-delay-passive = <0>;
> + thermal-sensors = <&tboard_thermistor2>;
> +
> + trips {
> + trip-crit {
> + temperature = <95000>;
> + hysteresis = <2000>;
> + type = "critical";
> + };
> + };
> + };

I'm still getting:

thermal_sys: Failed to find 'trips' node
thermal_sys: Failed to find trip points for thermal-sensor-t1 id=0
generic-adc-thermal thermal-sensor-t1: Thermal zone sensor register failed: -22
generic-adc-thermal: probe of thermal-sensor-t1 failed with error -22
thermal_sys: Failed to find 'trips' node
thermal_sys: Failed to find trip points for thermal-sensor-t2 id=0
generic-adc-thermal thermal-sensor-t2: Thermal zone sensor register failed: -22
generic-adc-thermal: probe of thermal-sensor-t2 failed with error -22
thermal_sys: Failed to find 'trips' node
thermal_sys: Failed to find trip points for thermal-sensor-t3 id=0
generic-adc-thermal thermal-sensor-t3: Thermal zone sensor register failed: -22
generic-adc-thermal: probe of thermal-sensor-t3 failed with error -22



> +};
> +
> &u3phy0 {
> status = "okay";
> };
> --
> 2.40.0
>
>

2023-04-21 08:09:21

by Chen-Yu Tsai

[permalink] [raw]
Subject: Re: [PATCH 5/5] arm64: dts: mediatek: cherry-tomato-r1: Enable NVMe PCI-Express port

On Thu, Apr 20, 2023 at 5:45 PM AngeloGioacchino Del Regno
<[email protected]> wrote:
>
> On Tomato rev1 the PCIe0 controller is used for NVMe storage.

This was slightly confusing for me. AFAIK rev1 is not an actual Tomato
device. It should be the prototype board, which is the original Cherry
reference design by Google [1].

There is an actual Cherry derived device that has NVMe, though it's under
another brand and another name.

ChenYu

[1] Much like Kukui & Jacuzzi (MT8183), and Asurada (MT8192) are the
reference designs. I don't think we ever upstream the reference
boards because they don't really end up in the hands of people
outside of the project, and the ones we do have tend to be quite
beaten up or no longer working due to extensive testing.

> Signed-off-by: AngeloGioacchino Del Regno <[email protected]>
> ---
> arch/arm64/boot/dts/mediatek/mt8195-cherry-tomato-r1.dts | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/arch/arm64/boot/dts/mediatek/mt8195-cherry-tomato-r1.dts b/arch/arm64/boot/dts/mediatek/mt8195-cherry-tomato-r1.dts
> index 2d5e8f371b6d..11fc83ddf236 100644
> --- a/arch/arm64/boot/dts/mediatek/mt8195-cherry-tomato-r1.dts
> +++ b/arch/arm64/boot/dts/mediatek/mt8195-cherry-tomato-r1.dts
> @@ -20,6 +20,13 @@ &sound {
> model = "mt8195_r1019_5682";
> };
>
> +&pcie0 {
> + status = "okay";
> +
> + pinctrl-names = "default";
> + pinctrl-0 = <&pcie0_pins_default>;
> +};
> +
> &ts_10 {
> status = "okay";
> };
> --
> 2.40.0
>
>

2023-04-21 20:54:36

by Nícolas F. R. A. Prado

[permalink] [raw]
Subject: Re: [PATCH 1/5] arm64: dts: mediatek: cherry: Add platform thermal configuration

On Fri, Apr 21, 2023 at 03:37:52PM +0800, Chen-Yu Tsai wrote:
> On Thu, Apr 20, 2023 at 5:45 PM AngeloGioacchino Del Regno
> <[email protected]> wrote:
> >
> > This platform has three auxiliary NTC thermistors, connected to the
> > SoC's ADC pins. Enable the auxadc in order to be able to read the
> > ADC values, add a generic-adc-thermal LUT for each and finally assign
> > them to the SoC's thermal zones.
> >
> > Signed-off-by: AngeloGioacchino Del Regno <[email protected]>
> > ---
> > .../boot/dts/mediatek/mt8195-cherry.dtsi | 105 ++++++++++++++++++
> > 1 file changed, 105 insertions(+)
> >
> > diff --git a/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi b/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi
> > index 8ac80a136c37..0820e9ba3829 100644
> > --- a/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi
> > +++ b/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi
> > @@ -114,6 +114,77 @@ ppvar_sys: regulator-ppvar-sys {
> > regulator-boot-on;
> > };
> >
> > + /* Murata NCP03WF104F05RL */
> > + tboard_thermistor1: thermal-sensor-t1 {
> > + compatible = "generic-adc-thermal";
> > + #thermal-sensor-cells = <0>;
> > + io-channels = <&auxadc 0>;
> > + io-channel-names = "sensor-channel";
> > + temperature-lookup-table = < (-10000) 1553
> > + (-5000) 1485
> > + 0 1406
> > + 5000 1317
> > + 10000 1219
> > + 15000 1115
> > + 20000 1007
> > + 25000 900
> > + 30000 796
> > + 35000 697
> > + 40000 605
> > + 45000 523
> > + 50000 449
> > + 55000 384
> > + 60000 327
> > + 65000 279
> > + 70000 237
> > + 75000 202
> > + 80000 172
> > + 85000 147
> > + 90000 125
> > + 95000 107
> > + 100000 92
> > + 105000 79
> > + 110000 68
> > + 115000 59
> > + 120000 51
> > + 125000 44>;
> > + };
> > +
> > + tboard_thermistor2: thermal-sensor-t2 {
> > + compatible = "generic-adc-thermal";
> > + #thermal-sensor-cells = <0>;
> > + io-channels = <&auxadc 1>;
> > + io-channel-names = "sensor-channel";
> > + temperature-lookup-table = < (-10000) 1553
> > + (-5000) 1485
> > + 0 1406
> > + 5000 1317
> > + 10000 1219
> > + 15000 1115
> > + 20000 1007
> > + 25000 900
> > + 30000 796
> > + 35000 697
> > + 40000 605
> > + 45000 523
> > + 50000 449
> > + 55000 384
> > + 60000 327
> > + 65000 279
> > + 70000 237
> > + 75000 202
> > + 80000 172
> > + 85000 147
> > + 90000 125
> > + 95000 107
> > + 100000 92
> > + 105000 79
> > + 110000 68
> > + 115000 59
> > + 120000 51
> > + 125000 44>;
> > + };
> > +
> > usb_vbus: regulator-5v0-usb-vbus {
> > compatible = "regulator-fixed";
> > regulator-name = "usb-vbus";
> > @@ -260,6 +331,10 @@ &gpu {
> > mali-supply = <&mt6315_7_vbuck1>;
> > };
> >
> > +&auxadc {
> > + status = "okay";
> > +};
> > +
> > &i2c0 {
> > status = "okay";
> >
> > @@ -1098,6 +1173,36 @@ mt6315_7_vbuck1: vbuck1 {
> > };
> > };
> >
> > +&thermal_zones {
> > + soc_area_ntc {

Not sure if that's what's causing the issue, but the thermal zone name should
end with -thermal as per the binding. Also note that it needs to be under 20
characters otherwise it will fail to be registered with -22 like below.
(Also, node names shouldn't contain underscore)

Thanks,
Nícolas

> > + polling-delay = <1000>;
> > + polling-delay-passive = <250>;
> > + thermal-sensors = <&tboard_thermistor1>;
> > +
> > + trips {
> > + trip-crit {
> > + temperature = <95000>;
> > + hysteresis = <2000>;
> > + type = "critical";
> > + };
> > + };
> > + };
> > +
> > + pmic_area_ntc {
> > + polling-delay = <1000>;
> > + polling-delay-passive = <0>;
> > + thermal-sensors = <&tboard_thermistor2>;
> > +
> > + trips {
> > + trip-crit {
> > + temperature = <95000>;
> > + hysteresis = <2000>;
> > + type = "critical";
> > + };
> > + };
> > + };
>
> I'm still getting:
>
> thermal_sys: Failed to find 'trips' node
> thermal_sys: Failed to find trip points for thermal-sensor-t1 id=0
> generic-adc-thermal thermal-sensor-t1: Thermal zone sensor register failed: -22
> generic-adc-thermal: probe of thermal-sensor-t1 failed with error -22
> thermal_sys: Failed to find 'trips' node
> thermal_sys: Failed to find trip points for thermal-sensor-t2 id=0
> generic-adc-thermal thermal-sensor-t2: Thermal zone sensor register failed: -22
> generic-adc-thermal: probe of thermal-sensor-t2 failed with error -22
> thermal_sys: Failed to find 'trips' node
> thermal_sys: Failed to find trip points for thermal-sensor-t3 id=0
> generic-adc-thermal thermal-sensor-t3: Thermal zone sensor register failed: -22
> generic-adc-thermal: probe of thermal-sensor-t3 failed with error -22
>
>
>
> > +};
> > +
> > &u3phy0 {
> > status = "okay";
> > };
> > --
> > 2.40.0
> >
> >

Subject: Re: [PATCH 1/5] arm64: dts: mediatek: cherry: Add platform thermal configuration

Il 21/04/23 22:53, Nícolas F. R. A. Prado ha scritto:
> On Fri, Apr 21, 2023 at 03:37:52PM +0800, Chen-Yu Tsai wrote:
>> On Thu, Apr 20, 2023 at 5:45 PM AngeloGioacchino Del Regno
>> <[email protected]> wrote:
>>>
>>> This platform has three auxiliary NTC thermistors, connected to the
>>> SoC's ADC pins. Enable the auxadc in order to be able to read the
>>> ADC values, add a generic-adc-thermal LUT for each and finally assign
>>> them to the SoC's thermal zones.
>>>
>>> Signed-off-by: AngeloGioacchino Del Regno <[email protected]>
>>> ---
>>> .../boot/dts/mediatek/mt8195-cherry.dtsi | 105 ++++++++++++++++++
>>> 1 file changed, 105 insertions(+)
>>>
>>> diff --git a/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi b/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi
>>> index 8ac80a136c37..0820e9ba3829 100644
>>> --- a/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi
>>> +++ b/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi
>>> @@ -114,6 +114,77 @@ ppvar_sys: regulator-ppvar-sys {
>>> regulator-boot-on;
>>> };
>>>
>>> + /* Murata NCP03WF104F05RL */
>>> + tboard_thermistor1: thermal-sensor-t1 {
>>> + compatible = "generic-adc-thermal";
>>> + #thermal-sensor-cells = <0>;
>>> + io-channels = <&auxadc 0>;
>>> + io-channel-names = "sensor-channel";
>>> + temperature-lookup-table = < (-10000) 1553
>>> + (-5000) 1485
>>> + 0 1406
>>> + 5000 1317
>>> + 10000 1219
>>> + 15000 1115
>>> + 20000 1007
>>> + 25000 900
>>> + 30000 796
>>> + 35000 697
>>> + 40000 605
>>> + 45000 523
>>> + 50000 449
>>> + 55000 384
>>> + 60000 327
>>> + 65000 279
>>> + 70000 237
>>> + 75000 202
>>> + 80000 172
>>> + 85000 147
>>> + 90000 125
>>> + 95000 107
>>> + 100000 92
>>> + 105000 79
>>> + 110000 68
>>> + 115000 59
>>> + 120000 51
>>> + 125000 44>;
>>> + };
>>> +
>>> + tboard_thermistor2: thermal-sensor-t2 {
>>> + compatible = "generic-adc-thermal";
>>> + #thermal-sensor-cells = <0>;
>>> + io-channels = <&auxadc 1>;
>>> + io-channel-names = "sensor-channel";
>>> + temperature-lookup-table = < (-10000) 1553
>>> + (-5000) 1485
>>> + 0 1406
>>> + 5000 1317
>>> + 10000 1219
>>> + 15000 1115
>>> + 20000 1007
>>> + 25000 900
>>> + 30000 796
>>> + 35000 697
>>> + 40000 605
>>> + 45000 523
>>> + 50000 449
>>> + 55000 384
>>> + 60000 327
>>> + 65000 279
>>> + 70000 237
>>> + 75000 202
>>> + 80000 172
>>> + 85000 147
>>> + 90000 125
>>> + 95000 107
>>> + 100000 92
>>> + 105000 79
>>> + 110000 68
>>> + 115000 59
>>> + 120000 51
>>> + 125000 44>;
>>> + };
>>> +
>>> usb_vbus: regulator-5v0-usb-vbus {
>>> compatible = "regulator-fixed";
>>> regulator-name = "usb-vbus";
>>> @@ -260,6 +331,10 @@ &gpu {
>>> mali-supply = <&mt6315_7_vbuck1>;
>>> };
>>>
>>> +&auxadc {
>>> + status = "okay";
>>> +};
>>> +
>>> &i2c0 {
>>> status = "okay";
>>>
>>> @@ -1098,6 +1173,36 @@ mt6315_7_vbuck1: vbuck1 {
>>> };
>>> };
>>>
>>> +&thermal_zones {
>>> + soc_area_ntc {
>
> Not sure if that's what's causing the issue, but the thermal zone name should
> end with -thermal as per the binding. Also note that it needs to be under 20
> characters otherwise it will fail to be registered with -22 like below.
> (Also, node names shouldn't contain underscore)
>
> Thanks,
> Nícolas
>
>>> + polling-delay = <1000>;
>>> + polling-delay-passive = <250>;
>>> + thermal-sensors = <&tboard_thermistor1>;
>>> +
>>> + trips {
>>> + trip-crit {
>>> + temperature = <95000>;
>>> + hysteresis = <2000>;
>>> + type = "critical";
>>> + };
>>> + };
>>> + };
>>> +
>>> + pmic_area_ntc {
>>> + polling-delay = <1000>;
>>> + polling-delay-passive = <0>;
>>> + thermal-sensors = <&tboard_thermistor2>;
>>> +
>>> + trips {
>>> + trip-crit {
>>> + temperature = <95000>;
>>> + hysteresis = <2000>;
>>> + type = "critical";
>>> + };
>>> + };
>>> + };
>>
>> I'm still getting:
>>
>> thermal_sys: Failed to find 'trips' node
>> thermal_sys: Failed to find trip points for thermal-sensor-t1 id=0
>> generic-adc-thermal thermal-sensor-t1: Thermal zone sensor register failed: -22
>> generic-adc-thermal: probe of thermal-sensor-t1 failed with error -22
>> thermal_sys: Failed to find 'trips' node
>> thermal_sys: Failed to find trip points for thermal-sensor-t2 id=0
>> generic-adc-thermal thermal-sensor-t2: Thermal zone sensor register failed: -22
>> generic-adc-thermal: probe of thermal-sensor-t2 failed with error -22
>> thermal_sys: Failed to find 'trips' node
>> thermal_sys: Failed to find trip points for thermal-sensor-t3 id=0
>> generic-adc-thermal thermal-sensor-t3: Thermal zone sensor register failed: -22
>> generic-adc-thermal: probe of thermal-sensor-t3 failed with error -22
>>

I think you have something wrong locally - there's no thermal-sensor-t3 in this
devicetree...

Cheers,
Angelo

Subject: Re: [PATCH 2/5] arm64: dts: mediatek: cherry: Assign dp-intf aliases

Il 21/04/23 08:46, Chen-Yu Tsai ha scritto:
> On Thu, Apr 20, 2023 at 5:45 PM AngeloGioacchino Del Regno
> <[email protected]> wrote:
>>
>> On Cherry boards, the IP at 0x1c015000 (dp_intf0) is used as primary
>> dp-intf, while the other at 0x1c113000 (dp_intf1) is used as secondary:
>> assign them to dp-intf{0,1} aliases respectively.
>>
>> Signed-off-by: AngeloGioacchino Del Regno <[email protected]>
>> ---
>> arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi | 2 ++
>
> This should be applied at the SoC level. The display pipeline is fixed in
> MMSYS, so it applies to all MT8195 devices.
>

It's fixed in the MMSYS configuration/driver but - as far as I remember (I can
recheck on the datasheets) - the dp_intfX function can be inverted meaning that
the MMSYS paths can be configured such that DP_INTF0 becomes secondary and the
other becomes primary: this is why I am putting that into mt8195-cherry and not
mt8195.dtsi.

Regards,
Angelo

>> 1 file changed, 2 insertions(+)
>>
>> diff --git a/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi b/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi
>> index 0820e9ba3829..918380697a9a 100644
>> --- a/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi
>> +++ b/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi
>> @@ -10,6 +10,8 @@
>>
>> / {
>> aliases {
>> + dp-intf0 = &dp_intf0;
>> + dp-intf1 = &dp_intf1;
>> i2c0 = &i2c0;
>> i2c1 = &i2c1;
>> i2c2 = &i2c2;
>> --
>> 2.40.0
>>
>>
>

Subject: Re: [PATCH 2/5] arm64: dts: mediatek: cherry: Assign dp-intf aliases

Il 24/04/23 09:17, Chen-Yu Tsai ha scritto:
> On Mon, Apr 24, 2023 at 3:03 PM AngeloGioacchino Del Regno
> <[email protected]> wrote:
>>
>> Il 21/04/23 08:46, Chen-Yu Tsai ha scritto:
>>> On Thu, Apr 20, 2023 at 5:45 PM AngeloGioacchino Del Regno
>>> <[email protected]> wrote:
>>>>
>>>> On Cherry boards, the IP at 0x1c015000 (dp_intf0) is used as primary
>>>> dp-intf, while the other at 0x1c113000 (dp_intf1) is used as secondary:
>>>> assign them to dp-intf{0,1} aliases respectively.
>>>>
>>>> Signed-off-by: AngeloGioacchino Del Regno <[email protected]>
>>>> ---
>>>> arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi | 2 ++
>>>
>>> This should be applied at the SoC level. The display pipeline is fixed in
>>> MMSYS, so it applies to all MT8195 devices.
>>>
>>
>> It's fixed in the MMSYS configuration/driver but - as far as I remember (I can
>> recheck on the datasheets) - the dp_intfX function can be inverted meaning that
>> the MMSYS paths can be configured such that DP_INTF0 becomes secondary and the
>> other becomes primary: this is why I am putting that into mt8195-cherry and not
>> mt8195.dtsi.
>
> Maybe that's possible, but the diagram in the datasheet suggests a fixed path.
>
> Either way, it's not actually the problem. My original reply is probably
> inaccurate. AFAIK the aliases are used to identify the individual hardware
> blocks, which otherwise have the same compatible string. So the numbering
> should be the same regardless of the design and/or routing.

Ack. Will move to mt8195.dtsi!

>
> Ideally this should be described with a proper graph though.
>
> ChenYu
>
>>
>> Regards,
>> Angelo
>>
>>>> 1 file changed, 2 insertions(+)
>>>>
>>>> diff --git a/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi b/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi
>>>> index 0820e9ba3829..918380697a9a 100644
>>>> --- a/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi
>>>> +++ b/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi
>>>> @@ -10,6 +10,8 @@
>>>>
>>>> / {
>>>> aliases {
>>>> + dp-intf0 = &dp_intf0;
>>>> + dp-intf1 = &dp_intf1;
>>>> i2c0 = &i2c0;
>>>> i2c1 = &i2c1;
>>>> i2c2 = &i2c2;
>>>> --
>>>> 2.40.0
>>>>
>>>>
>>>
>>


2023-04-24 07:22:47

by Chen-Yu Tsai

[permalink] [raw]
Subject: Re: [PATCH 2/5] arm64: dts: mediatek: cherry: Assign dp-intf aliases

On Mon, Apr 24, 2023 at 3:03 PM AngeloGioacchino Del Regno
<[email protected]> wrote:
>
> Il 21/04/23 08:46, Chen-Yu Tsai ha scritto:
> > On Thu, Apr 20, 2023 at 5:45 PM AngeloGioacchino Del Regno
> > <[email protected]> wrote:
> >>
> >> On Cherry boards, the IP at 0x1c015000 (dp_intf0) is used as primary
> >> dp-intf, while the other at 0x1c113000 (dp_intf1) is used as secondary:
> >> assign them to dp-intf{0,1} aliases respectively.
> >>
> >> Signed-off-by: AngeloGioacchino Del Regno <[email protected]>
> >> ---
> >> arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi | 2 ++
> >
> > This should be applied at the SoC level. The display pipeline is fixed in
> > MMSYS, so it applies to all MT8195 devices.
> >
>
> It's fixed in the MMSYS configuration/driver but - as far as I remember (I can
> recheck on the datasheets) - the dp_intfX function can be inverted meaning that
> the MMSYS paths can be configured such that DP_INTF0 becomes secondary and the
> other becomes primary: this is why I am putting that into mt8195-cherry and not
> mt8195.dtsi.

Maybe that's possible, but the diagram in the datasheet suggests a fixed path.

Either way, it's not actually the problem. My original reply is probably
inaccurate. AFAIK the aliases are used to identify the individual hardware
blocks, which otherwise have the same compatible string. So the numbering
should be the same regardless of the design and/or routing.

Ideally this should be described with a proper graph though.

ChenYu

>
> Regards,
> Angelo
>
> >> 1 file changed, 2 insertions(+)
> >>
> >> diff --git a/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi b/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi
> >> index 0820e9ba3829..918380697a9a 100644
> >> --- a/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi
> >> +++ b/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi
> >> @@ -10,6 +10,8 @@
> >>
> >> / {
> >> aliases {
> >> + dp-intf0 = &dp_intf0;
> >> + dp-intf1 = &dp_intf1;
> >> i2c0 = &i2c0;
> >> i2c1 = &i2c1;
> >> i2c2 = &i2c2;
> >> --
> >> 2.40.0
> >>
> >>
> >
>

2023-04-24 07:41:00

by Chen-Yu Tsai

[permalink] [raw]
Subject: Re: [PATCH 1/5] arm64: dts: mediatek: cherry: Add platform thermal configuration

On Mon, Apr 24, 2023 at 2:31 PM AngeloGioacchino Del Regno
<[email protected]> wrote:
>
> Il 21/04/23 22:53, Nícolas F. R. A. Prado ha scritto:
> > On Fri, Apr 21, 2023 at 03:37:52PM +0800, Chen-Yu Tsai wrote:
> >> On Thu, Apr 20, 2023 at 5:45 PM AngeloGioacchino Del Regno
> >> <[email protected]> wrote:
> >>>
> >>> This platform has three auxiliary NTC thermistors, connected to the
> >>> SoC's ADC pins. Enable the auxadc in order to be able to read the
> >>> ADC values, add a generic-adc-thermal LUT for each and finally assign
> >>> them to the SoC's thermal zones.
> >>>
> >>> Signed-off-by: AngeloGioacchino Del Regno <[email protected]>
> >>> ---
> >>> .../boot/dts/mediatek/mt8195-cherry.dtsi | 105 ++++++++++++++++++
> >>> 1 file changed, 105 insertions(+)
> >>>
> >>> diff --git a/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi b/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi
> >>> index 8ac80a136c37..0820e9ba3829 100644
> >>> --- a/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi
> >>> +++ b/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi
> >>> @@ -114,6 +114,77 @@ ppvar_sys: regulator-ppvar-sys {
> >>> regulator-boot-on;
> >>> };
> >>>
> >>> + /* Murata NCP03WF104F05RL */
> >>> + tboard_thermistor1: thermal-sensor-t1 {
> >>> + compatible = "generic-adc-thermal";
> >>> + #thermal-sensor-cells = <0>;
> >>> + io-channels = <&auxadc 0>;
> >>> + io-channel-names = "sensor-channel";
> >>> + temperature-lookup-table = < (-10000) 1553
> >>> + (-5000) 1485
> >>> + 0 1406
> >>> + 5000 1317
> >>> + 10000 1219
> >>> + 15000 1115
> >>> + 20000 1007
> >>> + 25000 900
> >>> + 30000 796
> >>> + 35000 697
> >>> + 40000 605
> >>> + 45000 523
> >>> + 50000 449
> >>> + 55000 384
> >>> + 60000 327
> >>> + 65000 279
> >>> + 70000 237
> >>> + 75000 202
> >>> + 80000 172
> >>> + 85000 147
> >>> + 90000 125
> >>> + 95000 107
> >>> + 100000 92
> >>> + 105000 79
> >>> + 110000 68
> >>> + 115000 59
> >>> + 120000 51
> >>> + 125000 44>;
> >>> + };
> >>> +
> >>> + tboard_thermistor2: thermal-sensor-t2 {
> >>> + compatible = "generic-adc-thermal";
> >>> + #thermal-sensor-cells = <0>;
> >>> + io-channels = <&auxadc 1>;
> >>> + io-channel-names = "sensor-channel";
> >>> + temperature-lookup-table = < (-10000) 1553
> >>> + (-5000) 1485
> >>> + 0 1406
> >>> + 5000 1317
> >>> + 10000 1219
> >>> + 15000 1115
> >>> + 20000 1007
> >>> + 25000 900
> >>> + 30000 796
> >>> + 35000 697
> >>> + 40000 605
> >>> + 45000 523
> >>> + 50000 449
> >>> + 55000 384
> >>> + 60000 327
> >>> + 65000 279
> >>> + 70000 237
> >>> + 75000 202
> >>> + 80000 172
> >>> + 85000 147
> >>> + 90000 125
> >>> + 95000 107
> >>> + 100000 92
> >>> + 105000 79
> >>> + 110000 68
> >>> + 115000 59
> >>> + 120000 51
> >>> + 125000 44>;
> >>> + };
> >>> +
> >>> usb_vbus: regulator-5v0-usb-vbus {
> >>> compatible = "regulator-fixed";
> >>> regulator-name = "usb-vbus";
> >>> @@ -260,6 +331,10 @@ &gpu {
> >>> mali-supply = <&mt6315_7_vbuck1>;
> >>> };
> >>>
> >>> +&auxadc {
> >>> + status = "okay";
> >>> +};
> >>> +
> >>> &i2c0 {
> >>> status = "okay";
> >>>
> >>> @@ -1098,6 +1173,36 @@ mt6315_7_vbuck1: vbuck1 {
> >>> };
> >>> };
> >>>
> >>> +&thermal_zones {
> >>> + soc_area_ntc {
> >
> > Not sure if that's what's causing the issue, but the thermal zone name should
> > end with -thermal as per the binding. Also note that it needs to be under 20
> > characters otherwise it will fail to be registered with -22 like below.
> > (Also, node names shouldn't contain underscore)
> >
> > Thanks,
> > Nícolas
> >
> >>> + polling-delay = <1000>;
> >>> + polling-delay-passive = <250>;
> >>> + thermal-sensors = <&tboard_thermistor1>;
> >>> +
> >>> + trips {
> >>> + trip-crit {
> >>> + temperature = <95000>;
> >>> + hysteresis = <2000>;
> >>> + type = "critical";
> >>> + };
> >>> + };
> >>> + };
> >>> +
> >>> + pmic_area_ntc {
> >>> + polling-delay = <1000>;
> >>> + polling-delay-passive = <0>;
> >>> + thermal-sensors = <&tboard_thermistor2>;
> >>> +
> >>> + trips {
> >>> + trip-crit {
> >>> + temperature = <95000>;
> >>> + hysteresis = <2000>;
> >>> + type = "critical";
> >>> + };
> >>> + };
> >>> + };
> >>
> >> I'm still getting:
> >>
> >> thermal_sys: Failed to find 'trips' node
> >> thermal_sys: Failed to find trip points for thermal-sensor-t1 id=0
> >> generic-adc-thermal thermal-sensor-t1: Thermal zone sensor register failed: -22
> >> generic-adc-thermal: probe of thermal-sensor-t1 failed with error -22
> >> thermal_sys: Failed to find 'trips' node
> >> thermal_sys: Failed to find trip points for thermal-sensor-t2 id=0
> >> generic-adc-thermal thermal-sensor-t2: Thermal zone sensor register failed: -22
> >> generic-adc-thermal: probe of thermal-sensor-t2 failed with error -22
> >> thermal_sys: Failed to find 'trips' node
> >> thermal_sys: Failed to find trip points for thermal-sensor-t3 id=0
> >> generic-adc-thermal thermal-sensor-t3: Thermal zone sensor register failed: -22
> >> generic-adc-thermal: probe of thermal-sensor-t3 failed with error -22
> >>
>
> I think you have something wrong locally - there's no thermal-sensor-t3 in this
> devicetree...

I seem to have run a stale kernel image. Rebuilt the kernel and everything
seems to work OK now.

BTW, I think the design went for a lower trip point. At least the hardware
thermal protection IC on the Acer device trips at 85 degrees C, instead of
95 degrees C. Maybe that's accounting for the fact that these are external
thermal sensors and have some latency and temperature difference. The PMIC
specifies 85 degrees C maximum ambient air temperature. The SoC doesn't
specify.

Either way this is

Tested-by: Chen-Yu Tsai <[email protected]>
Reviewed-by: Chen-Yu Tsai <[email protected]>

Subject: Re: [PATCH 1/5] arm64: dts: mediatek: cherry: Add platform thermal configuration

Il 24/04/23 09:38, Chen-Yu Tsai ha scritto:
> On Mon, Apr 24, 2023 at 2:31 PM AngeloGioacchino Del Regno
> <[email protected]> wrote:
>>
>> Il 21/04/23 22:53, Nícolas F. R. A. Prado ha scritto:
>>> On Fri, Apr 21, 2023 at 03:37:52PM +0800, Chen-Yu Tsai wrote:
>>>> On Thu, Apr 20, 2023 at 5:45 PM AngeloGioacchino Del Regno
>>>> <[email protected]> wrote:
>>>>>
>>>>> This platform has three auxiliary NTC thermistors, connected to the
>>>>> SoC's ADC pins. Enable the auxadc in order to be able to read the
>>>>> ADC values, add a generic-adc-thermal LUT for each and finally assign
>>>>> them to the SoC's thermal zones.
>>>>>
>>>>> Signed-off-by: AngeloGioacchino Del Regno <[email protected]>
>>>>> ---
>>>>> .../boot/dts/mediatek/mt8195-cherry.dtsi | 105 ++++++++++++++++++
>>>>> 1 file changed, 105 insertions(+)
>>>>>
>>>>> diff --git a/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi b/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi
>>>>> index 8ac80a136c37..0820e9ba3829 100644
>>>>> --- a/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi
>>>>> +++ b/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi
>>>>> @@ -114,6 +114,77 @@ ppvar_sys: regulator-ppvar-sys {
>>>>> regulator-boot-on;
>>>>> };
>>>>>
>>>>> + /* Murata NCP03WF104F05RL */
>>>>> + tboard_thermistor1: thermal-sensor-t1 {
>>>>> + compatible = "generic-adc-thermal";
>>>>> + #thermal-sensor-cells = <0>;
>>>>> + io-channels = <&auxadc 0>;
>>>>> + io-channel-names = "sensor-channel";
>>>>> + temperature-lookup-table = < (-10000) 1553
>>>>> + (-5000) 1485
>>>>> + 0 1406
>>>>> + 5000 1317
>>>>> + 10000 1219
>>>>> + 15000 1115
>>>>> + 20000 1007
>>>>> + 25000 900
>>>>> + 30000 796
>>>>> + 35000 697
>>>>> + 40000 605
>>>>> + 45000 523
>>>>> + 50000 449
>>>>> + 55000 384
>>>>> + 60000 327
>>>>> + 65000 279
>>>>> + 70000 237
>>>>> + 75000 202
>>>>> + 80000 172
>>>>> + 85000 147
>>>>> + 90000 125
>>>>> + 95000 107
>>>>> + 100000 92
>>>>> + 105000 79
>>>>> + 110000 68
>>>>> + 115000 59
>>>>> + 120000 51
>>>>> + 125000 44>;
>>>>> + };
>>>>> +
>>>>> + tboard_thermistor2: thermal-sensor-t2 {
>>>>> + compatible = "generic-adc-thermal";
>>>>> + #thermal-sensor-cells = <0>;
>>>>> + io-channels = <&auxadc 1>;
>>>>> + io-channel-names = "sensor-channel";
>>>>> + temperature-lookup-table = < (-10000) 1553
>>>>> + (-5000) 1485
>>>>> + 0 1406
>>>>> + 5000 1317
>>>>> + 10000 1219
>>>>> + 15000 1115
>>>>> + 20000 1007
>>>>> + 25000 900
>>>>> + 30000 796
>>>>> + 35000 697
>>>>> + 40000 605
>>>>> + 45000 523
>>>>> + 50000 449
>>>>> + 55000 384
>>>>> + 60000 327
>>>>> + 65000 279
>>>>> + 70000 237
>>>>> + 75000 202
>>>>> + 80000 172
>>>>> + 85000 147
>>>>> + 90000 125
>>>>> + 95000 107
>>>>> + 100000 92
>>>>> + 105000 79
>>>>> + 110000 68
>>>>> + 115000 59
>>>>> + 120000 51
>>>>> + 125000 44>;
>>>>> + };
>>>>> +
>>>>> usb_vbus: regulator-5v0-usb-vbus {
>>>>> compatible = "regulator-fixed";
>>>>> regulator-name = "usb-vbus";
>>>>> @@ -260,6 +331,10 @@ &gpu {
>>>>> mali-supply = <&mt6315_7_vbuck1>;
>>>>> };
>>>>>
>>>>> +&auxadc {
>>>>> + status = "okay";
>>>>> +};
>>>>> +
>>>>> &i2c0 {
>>>>> status = "okay";
>>>>>
>>>>> @@ -1098,6 +1173,36 @@ mt6315_7_vbuck1: vbuck1 {
>>>>> };
>>>>> };
>>>>>
>>>>> +&thermal_zones {
>>>>> + soc_area_ntc {
>>>
>>> Not sure if that's what's causing the issue, but the thermal zone name should
>>> end with -thermal as per the binding. Also note that it needs to be under 20
>>> characters otherwise it will fail to be registered with -22 like below.
>>> (Also, node names shouldn't contain underscore)
>>>
>>> Thanks,
>>> Nícolas
>>>
>>>>> + polling-delay = <1000>;
>>>>> + polling-delay-passive = <250>;
>>>>> + thermal-sensors = <&tboard_thermistor1>;
>>>>> +
>>>>> + trips {
>>>>> + trip-crit {
>>>>> + temperature = <95000>;
>>>>> + hysteresis = <2000>;
>>>>> + type = "critical";
>>>>> + };
>>>>> + };
>>>>> + };
>>>>> +
>>>>> + pmic_area_ntc {
>>>>> + polling-delay = <1000>;
>>>>> + polling-delay-passive = <0>;
>>>>> + thermal-sensors = <&tboard_thermistor2>;
>>>>> +
>>>>> + trips {
>>>>> + trip-crit {
>>>>> + temperature = <95000>;
>>>>> + hysteresis = <2000>;
>>>>> + type = "critical";
>>>>> + };
>>>>> + };
>>>>> + };
>>>>
>>>> I'm still getting:
>>>>
>>>> thermal_sys: Failed to find 'trips' node
>>>> thermal_sys: Failed to find trip points for thermal-sensor-t1 id=0
>>>> generic-adc-thermal thermal-sensor-t1: Thermal zone sensor register failed: -22
>>>> generic-adc-thermal: probe of thermal-sensor-t1 failed with error -22
>>>> thermal_sys: Failed to find 'trips' node
>>>> thermal_sys: Failed to find trip points for thermal-sensor-t2 id=0
>>>> generic-adc-thermal thermal-sensor-t2: Thermal zone sensor register failed: -22
>>>> generic-adc-thermal: probe of thermal-sensor-t2 failed with error -22
>>>> thermal_sys: Failed to find 'trips' node
>>>> thermal_sys: Failed to find trip points for thermal-sensor-t3 id=0
>>>> generic-adc-thermal thermal-sensor-t3: Thermal zone sensor register failed: -22
>>>> generic-adc-thermal: probe of thermal-sensor-t3 failed with error -22
>>>>
>>
>> I think you have something wrong locally - there's no thermal-sensor-t3 in this
>> devicetree...
>
> I seem to have run a stale kernel image. Rebuilt the kernel and everything
> seems to work OK now.
>
> BTW, I think the design went for a lower trip point. At least the hardware
> thermal protection IC on the Acer device trips at 85 degrees C, instead of
> 95 degrees C. Maybe that's accounting for the fact that these are external
> thermal sensors and have some latency and temperature difference. The PMIC
> specifies 85 degrees C maximum ambient air temperature. The SoC doesn't
> specify.
>

Let's play safe then, I'll change that to 85 for the next version.

> Either way this is
>
> Tested-by: Chen-Yu Tsai <[email protected]>
> Reviewed-by: Chen-Yu Tsai <[email protected]>

Thanks!

Subject: Re: [PATCH 5/5] arm64: dts: mediatek: cherry-tomato-r1: Enable NVMe PCI-Express port

Il 21/04/23 09:59, Chen-Yu Tsai ha scritto:
> On Thu, Apr 20, 2023 at 5:45 PM AngeloGioacchino Del Regno
> <[email protected]> wrote:
>>
>> On Tomato rev1 the PCIe0 controller is used for NVMe storage.
>
> This was slightly confusing for me. AFAIK rev1 is not an actual Tomato
> device. It should be the prototype board, which is the original Cherry
> reference design by Google [1].
>
> There is an actual Cherry derived device that has NVMe, though it's under
> another brand and another name.
>

If revision 1 is not an actual Tomato device, and you can confirm that it is
the prototype board... I can send a commit to entirely drop R1 as having it
upstream would be of no use at all.

Cheers,
Angelo

> ChenYu
>
> [1] Much like Kukui & Jacuzzi (MT8183), and Asurada (MT8192) are the
> reference designs. I don't think we ever upstream the reference
> boards because they don't really end up in the hands of people
> outside of the project, and the ones we do have tend to be quite
> beaten up or no longer working due to extensive testing.
>
>> Signed-off-by: AngeloGioacchino Del Regno <[email protected]>
>> ---
>> arch/arm64/boot/dts/mediatek/mt8195-cherry-tomato-r1.dts | 7 +++++++
>> 1 file changed, 7 insertions(+)
>>
>> diff --git a/arch/arm64/boot/dts/mediatek/mt8195-cherry-tomato-r1.dts b/arch/arm64/boot/dts/mediatek/mt8195-cherry-tomato-r1.dts
>> index 2d5e8f371b6d..11fc83ddf236 100644
>> --- a/arch/arm64/boot/dts/mediatek/mt8195-cherry-tomato-r1.dts
>> +++ b/arch/arm64/boot/dts/mediatek/mt8195-cherry-tomato-r1.dts
>> @@ -20,6 +20,13 @@ &sound {
>> model = "mt8195_r1019_5682";
>> };
>>
>> +&pcie0 {
>> + status = "okay";
>> +
>> + pinctrl-names = "default";
>> + pinctrl-0 = <&pcie0_pins_default>;
>> +};
>> +
>> &ts_10 {
>> status = "okay";
>> };
>> --
>> 2.40.0
>>
>>

2023-04-24 09:44:04

by Chen-Yu Tsai

[permalink] [raw]
Subject: Re: [PATCH 5/5] arm64: dts: mediatek: cherry-tomato-r1: Enable NVMe PCI-Express port

On Mon, Apr 24, 2023 at 4:13 PM AngeloGioacchino Del Regno
<[email protected]> wrote:
>
> Il 21/04/23 09:59, Chen-Yu Tsai ha scritto:
> > On Thu, Apr 20, 2023 at 5:45 PM AngeloGioacchino Del Regno
> > <[email protected]> wrote:
> >>
> >> On Tomato rev1 the PCIe0 controller is used for NVMe storage.
> >
> > This was slightly confusing for me. AFAIK rev1 is not an actual Tomato
> > device. It should be the prototype board, which is the original Cherry
> > reference design by Google [1].
> >
> > There is an actual Cherry derived device that has NVMe, though it's under
> > another brand and another name.
> >
>
> If revision 1 is not an actual Tomato device, and you can confirm that it is
> the prototype board... I can send a commit to entirely drop R1 as having it
> upstream would be of no use at all.

From what I gathered from my colleagues, revision 1 was a Tomato prototype,
and also the second Cherry prototype board. There shouldn't be any of these
out in the wild.

FTR, the production version of Tomato is revision 4. Rev 2 and rev 3
engineering samples are available to partners, but otherwise limited.

ChenYu

> Cheers,
> Angelo
>
> > ChenYu
> >
> > [1] Much like Kukui & Jacuzzi (MT8183), and Asurada (MT8192) are the
> > reference designs. I don't think we ever upstream the reference
> > boards because they don't really end up in the hands of people
> > outside of the project, and the ones we do have tend to be quite
> > beaten up or no longer working due to extensive testing.
> >
> >> Signed-off-by: AngeloGioacchino Del Regno <[email protected]>
> >> ---
> >> arch/arm64/boot/dts/mediatek/mt8195-cherry-tomato-r1.dts | 7 +++++++
> >> 1 file changed, 7 insertions(+)
> >>
> >> diff --git a/arch/arm64/boot/dts/mediatek/mt8195-cherry-tomato-r1.dts b/arch/arm64/boot/dts/mediatek/mt8195-cherry-tomato-r1.dts
> >> index 2d5e8f371b6d..11fc83ddf236 100644
> >> --- a/arch/arm64/boot/dts/mediatek/mt8195-cherry-tomato-r1.dts
> >> +++ b/arch/arm64/boot/dts/mediatek/mt8195-cherry-tomato-r1.dts
> >> @@ -20,6 +20,13 @@ &sound {
> >> model = "mt8195_r1019_5682";
> >> };
> >>
> >> +&pcie0 {
> >> + status = "okay";
> >> +
> >> + pinctrl-names = "default";
> >> + pinctrl-0 = <&pcie0_pins_default>;
> >> +};
> >> +
> >> &ts_10 {
> >> status = "okay";
> >> };
> >> --
> >> 2.40.0
> >>
> >>
>

Subject: Re: [PATCH 5/5] arm64: dts: mediatek: cherry-tomato-r1: Enable NVMe PCI-Express port

Il 24/04/23 11:40, Chen-Yu Tsai ha scritto:
> On Mon, Apr 24, 2023 at 4:13 PM AngeloGioacchino Del Regno
> <[email protected]> wrote:
>>
>> Il 21/04/23 09:59, Chen-Yu Tsai ha scritto:
>>> On Thu, Apr 20, 2023 at 5:45 PM AngeloGioacchino Del Regno
>>> <[email protected]> wrote:
>>>>
>>>> On Tomato rev1 the PCIe0 controller is used for NVMe storage.
>>>
>>> This was slightly confusing for me. AFAIK rev1 is not an actual Tomato
>>> device. It should be the prototype board, which is the original Cherry
>>> reference design by Google [1].
>>>
>>> There is an actual Cherry derived device that has NVMe, though it's under
>>> another brand and another name.
>>>
>>
>> If revision 1 is not an actual Tomato device, and you can confirm that it is
>> the prototype board... I can send a commit to entirely drop R1 as having it
>> upstream would be of no use at all.
>
> From what I gathered from my colleagues, revision 1 was a Tomato prototype,
> and also the second Cherry prototype board. There shouldn't be any of these
> out in the wild.
>
> FTR, the production version of Tomato is revision 4. Rev 2 and rev 3
> engineering samples are available to partners, but otherwise limited.
>

Good! Thanks for the information.

> ChenYu
>
>> Cheers,
>> Angelo
>>
>>> ChenYu
>>>
>>> [1] Much like Kukui & Jacuzzi (MT8183), and Asurada (MT8192) are the
>>> reference designs. I don't think we ever upstream the reference
>>> boards because they don't really end up in the hands of people
>>> outside of the project, and the ones we do have tend to be quite
>>> beaten up or no longer working due to extensive testing.
>>>
>>>> Signed-off-by: AngeloGioacchino Del Regno <[email protected]>
>>>> ---
>>>> arch/arm64/boot/dts/mediatek/mt8195-cherry-tomato-r1.dts | 7 +++++++
>>>> 1 file changed, 7 insertions(+)
>>>>
>>>> diff --git a/arch/arm64/boot/dts/mediatek/mt8195-cherry-tomato-r1.dts b/arch/arm64/boot/dts/mediatek/mt8195-cherry-tomato-r1.dts
>>>> index 2d5e8f371b6d..11fc83ddf236 100644
>>>> --- a/arch/arm64/boot/dts/mediatek/mt8195-cherry-tomato-r1.dts
>>>> +++ b/arch/arm64/boot/dts/mediatek/mt8195-cherry-tomato-r1.dts
>>>> @@ -20,6 +20,13 @@ &sound {
>>>> model = "mt8195_r1019_5682";
>>>> };
>>>>
>>>> +&pcie0 {
>>>> + status = "okay";
>>>> +
>>>> + pinctrl-names = "default";
>>>> + pinctrl-0 = <&pcie0_pins_default>;
>>>> +};
>>>> +
>>>> &ts_10 {
>>>> status = "okay";
>>>> };
>>>> --
>>>> 2.40.0
>>>>
>>>>
>>

--
AngeloGioacchino Del Regno
Software Engineer

Collabora Ltd.
Platinum Building, St John's Innovation Park, Cambridge CB4 0DS, UK
Registered in England & Wales, no. 5513718