diff mbox series

[RFC,2/2] arm64: dts: qcom: msm8953: Add GPU

Message ID 20240125-msm8953-gpu-v1-2-f6493a5951f3@z3ntu.xyz
State New
Headers show
Series Add GPU support to MSM8953 SoC | expand

Commit Message

Luca Weiss Jan. 25, 2024, 9:56 p.m. UTC
From: Vladimir Lypak <vladimir.lypak@gmail.com>

Add the GPU node for the Adreno 506 found on this family of SoCs. The
clock speeds are a bit different per SoC variant, SDM450 maxes out at
600MHz while MSM8953 (= SDM625) goes up to 650MHz and SDM632 goes up to
725MHz.

To achieve this, create a new sdm450.dtsi to hold the 600MHz OPP and
use the new dtsi for sdm450-motorola-ali.

Signed-off-by: Vladimir Lypak <vladimir.lypak@gmail.com>
Co-developed-by: Luca Weiss <luca@z3ntu.xyz>
Signed-off-by: Luca Weiss <luca@z3ntu.xyz>
---
 arch/arm64/boot/dts/qcom/msm8953.dtsi            | 115 +++++++++++++++++++++++
 arch/arm64/boot/dts/qcom/sdm450-motorola-ali.dts |   2 +-
 arch/arm64/boot/dts/qcom/sdm450.dtsi             |  14 +++
 arch/arm64/boot/dts/qcom/sdm632.dtsi             |   8 ++
 4 files changed, 138 insertions(+), 1 deletion(-)

Comments

Konrad Dybcio Jan. 25, 2024, 11:50 p.m. UTC | #1
On 1/25/24 22:56, Luca Weiss wrote:
> From: Vladimir Lypak <vladimir.lypak@gmail.com>
> 
> Add the GPU node for the Adreno 506 found on this family of SoCs. The
> clock speeds are a bit different per SoC variant, SDM450 maxes out at
> 600MHz while MSM8953 (= SDM625) goes up to 650MHz and SDM632 goes up to
> 725MHz.
> 
> To achieve this, create a new sdm450.dtsi to hold the 600MHz OPP and
> use the new dtsi for sdm450-motorola-ali.
> 
> Signed-off-by: Vladimir Lypak <vladimir.lypak@gmail.com>
> Co-developed-by: Luca Weiss <luca@z3ntu.xyz>
> Signed-off-by: Luca Weiss <luca@z3ntu.xyz>
> ---
>   arch/arm64/boot/dts/qcom/msm8953.dtsi            | 115 +++++++++++++++++++++++
>   arch/arm64/boot/dts/qcom/sdm450-motorola-ali.dts |   2 +-
>   arch/arm64/boot/dts/qcom/sdm450.dtsi             |  14 +++
>   arch/arm64/boot/dts/qcom/sdm632.dtsi             |   8 ++
>   4 files changed, 138 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm64/boot/dts/qcom/msm8953.dtsi b/arch/arm64/boot/dts/qcom/msm8953.dtsi
> index 91d083871ab0..1fe0c0c4fd15 100644
> --- a/arch/arm64/boot/dts/qcom/msm8953.dtsi
> +++ b/arch/arm64/boot/dts/qcom/msm8953.dtsi
> @@ -1046,6 +1046,94 @@ mdss_dsi1_phy: phy@1a96400 {
>   			};
>   		};
>   
> +		gpu: gpu@1c00000 {
> +			compatible = "qcom,adreno-506.0", "qcom,adreno";
> +			reg = <0x01c00000 0x40000>;
> +			reg-names = "kgsl_3d0_reg_memory";
> +			interrupts = <GIC_SPI 33 IRQ_TYPE_LEVEL_HIGH>;
> +
> +			clocks = <&gcc GCC_OXILI_GFX3D_CLK>,
> +				 <&gcc GCC_OXILI_AHB_CLK>,
> +				 <&gcc GCC_BIMC_GFX_CLK>,
> +				 <&gcc GCC_BIMC_GPU_CLK>,
> +				 <&gcc GCC_OXILI_TIMER_CLK>,
> +				 <&gcc GCC_OXILI_AON_CLK>;
> +			clock-names = "core",
> +				      "iface",
> +				      "mem_iface",
> +				      "alt_mem_iface",
> +				      "rbbmtimer",
> +				      "alwayson";
> +			power-domains = <&gcc OXILI_GX_GDSC>;
> +
> +			iommus = <&gpu_iommu 0>;
> +			operating-points-v2 = <&gpu_opp_table>;
> +
> +			#cooling-cells = <2>;
> +
> +			status = "disabled";
> +
> +			zap-shader {
> +				memory-region = <&zap_shader_region>;
> +			};
> +
> +			gpu_opp_table: opp-table {
> +				compatible = "operating-points-v2";
> +
> +				opp-19200000 {
> +					opp-hz = /bits/ 64 <19200000>;
> +					opp-supported-hw = <0xff>;
> +					required-opps = <&rpmpd_opp_min_svs>;
> +				};

If you remove all OPPs but this one, can the GPU still spit out pixels?

Konrad
Luca Weiss Jan. 27, 2024, 5:32 p.m. UTC | #2
On Freitag, 26. Jänner 2024 00:50:43 CET Konrad Dybcio wrote:
> On 1/25/24 22:56, Luca Weiss wrote:
> > From: Vladimir Lypak <vladimir.lypak@gmail.com>
> > 
> > Add the GPU node for the Adreno 506 found on this family of SoCs. The
> > clock speeds are a bit different per SoC variant, SDM450 maxes out at
> > 600MHz while MSM8953 (= SDM625) goes up to 650MHz and SDM632 goes up to
> > 725MHz.
> > 
> > To achieve this, create a new sdm450.dtsi to hold the 600MHz OPP and
> > use the new dtsi for sdm450-motorola-ali.
> > 
> > Signed-off-by: Vladimir Lypak <vladimir.lypak@gmail.com>
> > Co-developed-by: Luca Weiss <luca@z3ntu.xyz>
> > Signed-off-by: Luca Weiss <luca@z3ntu.xyz>
> > ---
> > 
> >   arch/arm64/boot/dts/qcom/msm8953.dtsi            | 115
> >   +++++++++++++++++++++++
> >   arch/arm64/boot/dts/qcom/sdm450-motorola-ali.dts |   2 +-
> >   arch/arm64/boot/dts/qcom/sdm450.dtsi             |  14 +++
> >   arch/arm64/boot/dts/qcom/sdm632.dtsi             |   8 ++
> >   4 files changed, 138 insertions(+), 1 deletion(-)
> > 
> > diff --git a/arch/arm64/boot/dts/qcom/msm8953.dtsi
> > b/arch/arm64/boot/dts/qcom/msm8953.dtsi index 91d083871ab0..1fe0c0c4fd15
> > 100644
> > --- a/arch/arm64/boot/dts/qcom/msm8953.dtsi
> > +++ b/arch/arm64/boot/dts/qcom/msm8953.dtsi
> > @@ -1046,6 +1046,94 @@ mdss_dsi1_phy: phy@1a96400 {
> > 
> >   			};
> >   		
> >   		};
> > 
> > +		gpu: gpu@1c00000 {
> > +			compatible = "qcom,adreno-506.0", "qcom,adreno";
> > +			reg = <0x01c00000 0x40000>;
> > +			reg-names = "kgsl_3d0_reg_memory";
> > +			interrupts = <GIC_SPI 33 IRQ_TYPE_LEVEL_HIGH>;
> > +
> > +			clocks = <&gcc GCC_OXILI_GFX3D_CLK>,
> > +				 <&gcc GCC_OXILI_AHB_CLK>,
> > +				 <&gcc GCC_BIMC_GFX_CLK>,
> > +				 <&gcc GCC_BIMC_GPU_CLK>,
> > +				 <&gcc GCC_OXILI_TIMER_CLK>,
> > +				 <&gcc GCC_OXILI_AON_CLK>;
> > +			clock-names = "core",
> > +				      "iface",
> > +				      "mem_iface",
> > +				      "alt_mem_iface",
> > +				      "rbbmtimer",
> > +				      "alwayson";
> > +			power-domains = <&gcc OXILI_GX_GDSC>;
> > +
> > +			iommus = <&gpu_iommu 0>;
> > +			operating-points-v2 = <&gpu_opp_table>;
> > +
> > +			#cooling-cells = <2>;
> > +
> > +			status = "disabled";
> > +
> > +			zap-shader {
> > +				memory-region = <&zap_shader_region>;
> > +			};
> > +
> > +			gpu_opp_table: opp-table {
> > +				compatible = "operating-points-v2";
> > +
> > +				opp-19200000 {
> > +					opp-hz = /bits/ 64 <19200000>;
> > +					opp-supported-hw = <0xff>;
> > +					required-opps = <&rpmpd_opp_min_svs>;
> > +				};
> 
> If you remove all OPPs but this one, can the GPU still spit out pixels?

Yep, phosh is starting and is rendering at a few fps.

fairphone-fp3:~$ cat /sys/devices/platform/soc@0/1c00000.gpu/devfreq/1c00000.gpu/min_freq
19200000
fairphone-fp3:~$ cat /sys/devices/platform/soc@0/1c00000.gpu/devfreq/1c00000.gpu/max_freq 
19200000
fairphone-fp3:~$ cat /sys/devices/platform/soc@0/1c00000.gpu/devfreq/1c00000.gpu/cur_freq 
19200000

Regards
Luca

> 
> Konrad
Konrad Dybcio Feb. 2, 2024, 12:20 p.m. UTC | #3
On 27.01.2024 18:32, Luca Weiss wrote:
> On Freitag, 26. Jänner 2024 00:50:43 CET Konrad Dybcio wrote:
>> On 1/25/24 22:56, Luca Weiss wrote:
>>> From: Vladimir Lypak <vladimir.lypak@gmail.com>
>>>
>>> Add the GPU node for the Adreno 506 found on this family of SoCs. The
>>> clock speeds are a bit different per SoC variant, SDM450 maxes out at
>>> 600MHz while MSM8953 (= SDM625) goes up to 650MHz and SDM632 goes up to
>>> 725MHz.
>>>
>>> To achieve this, create a new sdm450.dtsi to hold the 600MHz OPP and
>>> use the new dtsi for sdm450-motorola-ali.
>>>
>>> Signed-off-by: Vladimir Lypak <vladimir.lypak@gmail.com>
>>> Co-developed-by: Luca Weiss <luca@z3ntu.xyz>
>>> Signed-off-by: Luca Weiss <luca@z3ntu.xyz>
>>> ---
>>>
>>>   arch/arm64/boot/dts/qcom/msm8953.dtsi            | 115
>>>   +++++++++++++++++++++++
>>>   arch/arm64/boot/dts/qcom/sdm450-motorola-ali.dts |   2 +-
>>>   arch/arm64/boot/dts/qcom/sdm450.dtsi             |  14 +++
>>>   arch/arm64/boot/dts/qcom/sdm632.dtsi             |   8 ++
>>>   4 files changed, 138 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/arch/arm64/boot/dts/qcom/msm8953.dtsi
>>> b/arch/arm64/boot/dts/qcom/msm8953.dtsi index 91d083871ab0..1fe0c0c4fd15
>>> 100644
>>> --- a/arch/arm64/boot/dts/qcom/msm8953.dtsi
>>> +++ b/arch/arm64/boot/dts/qcom/msm8953.dtsi
>>> @@ -1046,6 +1046,94 @@ mdss_dsi1_phy: phy@1a96400 {
>>>
>>>   			};
>>>   		
>>>   		};
>>>
>>> +		gpu: gpu@1c00000 {
>>> +			compatible = "qcom,adreno-506.0", "qcom,adreno";
>>> +			reg = <0x01c00000 0x40000>;
>>> +			reg-names = "kgsl_3d0_reg_memory";
>>> +			interrupts = <GIC_SPI 33 IRQ_TYPE_LEVEL_HIGH>;
>>> +
>>> +			clocks = <&gcc GCC_OXILI_GFX3D_CLK>,
>>> +				 <&gcc GCC_OXILI_AHB_CLK>,
>>> +				 <&gcc GCC_BIMC_GFX_CLK>,
>>> +				 <&gcc GCC_BIMC_GPU_CLK>,
>>> +				 <&gcc GCC_OXILI_TIMER_CLK>,
>>> +				 <&gcc GCC_OXILI_AON_CLK>;
>>> +			clock-names = "core",
>>> +				      "iface",
>>> +				      "mem_iface",
>>> +				      "alt_mem_iface",
>>> +				      "rbbmtimer",
>>> +				      "alwayson";
>>> +			power-domains = <&gcc OXILI_GX_GDSC>;
>>> +
>>> +			iommus = <&gpu_iommu 0>;
>>> +			operating-points-v2 = <&gpu_opp_table>;
>>> +
>>> +			#cooling-cells = <2>;
>>> +
>>> +			status = "disabled";
>>> +
>>> +			zap-shader {
>>> +				memory-region = <&zap_shader_region>;
>>> +			};
>>> +
>>> +			gpu_opp_table: opp-table {
>>> +				compatible = "operating-points-v2";
>>> +
>>> +				opp-19200000 {
>>> +					opp-hz = /bits/ 64 <19200000>;
>>> +					opp-supported-hw = <0xff>;
>>> +					required-opps = <&rpmpd_opp_min_svs>;
>>> +				};
>>
>> If you remove all OPPs but this one, can the GPU still spit out pixels?
> 
> Yep, phosh is starting and is rendering at a few fps.
> 
> fairphone-fp3:~$ cat /sys/devices/platform/soc@0/1c00000.gpu/devfreq/1c00000.gpu/min_freq
> 19200000
> fairphone-fp3:~$ cat /sys/devices/platform/soc@0/1c00000.gpu/devfreq/1c00000.gpu/max_freq 
> 19200000
> fairphone-fp3:~$ cat /sys/devices/platform/soc@0/1c00000.gpu/devfreq/1c00000.gpu/cur_freq 
> 19200000

Interesting..

Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>

Konrad
diff mbox series

Patch

diff --git a/arch/arm64/boot/dts/qcom/msm8953.dtsi b/arch/arm64/boot/dts/qcom/msm8953.dtsi
index 91d083871ab0..1fe0c0c4fd15 100644
--- a/arch/arm64/boot/dts/qcom/msm8953.dtsi
+++ b/arch/arm64/boot/dts/qcom/msm8953.dtsi
@@ -1046,6 +1046,94 @@  mdss_dsi1_phy: phy@1a96400 {
 			};
 		};
 
+		gpu: gpu@1c00000 {
+			compatible = "qcom,adreno-506.0", "qcom,adreno";
+			reg = <0x01c00000 0x40000>;
+			reg-names = "kgsl_3d0_reg_memory";
+			interrupts = <GIC_SPI 33 IRQ_TYPE_LEVEL_HIGH>;
+
+			clocks = <&gcc GCC_OXILI_GFX3D_CLK>,
+				 <&gcc GCC_OXILI_AHB_CLK>,
+				 <&gcc GCC_BIMC_GFX_CLK>,
+				 <&gcc GCC_BIMC_GPU_CLK>,
+				 <&gcc GCC_OXILI_TIMER_CLK>,
+				 <&gcc GCC_OXILI_AON_CLK>;
+			clock-names = "core",
+				      "iface",
+				      "mem_iface",
+				      "alt_mem_iface",
+				      "rbbmtimer",
+				      "alwayson";
+			power-domains = <&gcc OXILI_GX_GDSC>;
+
+			iommus = <&gpu_iommu 0>;
+			operating-points-v2 = <&gpu_opp_table>;
+
+			#cooling-cells = <2>;
+
+			status = "disabled";
+
+			zap-shader {
+				memory-region = <&zap_shader_region>;
+			};
+
+			gpu_opp_table: opp-table {
+				compatible = "operating-points-v2";
+
+				opp-19200000 {
+					opp-hz = /bits/ 64 <19200000>;
+					opp-supported-hw = <0xff>;
+					required-opps = <&rpmpd_opp_min_svs>;
+				};
+
+				opp-133300000 {
+					opp-hz = /bits/ 64 <133300000>;
+					opp-supported-hw = <0xff>;
+					required-opps = <&rpmpd_opp_min_svs>;
+				};
+
+				opp-216000000 {
+					opp-hz = /bits/ 64 <216000000>;
+					opp-supported-hw = <0xff>;
+					required-opps = <&rpmpd_opp_low_svs>;
+				};
+
+				opp-320000000 {
+					opp-hz = /bits/ 64 <320000000>;
+					opp-supported-hw = <0xff>;
+					required-opps = <&rpmpd_opp_svs>;
+				};
+
+				opp-400000000 {
+					opp-hz = /bits/ 64 <400000000>;
+					opp-supported-hw = <0xff>;
+					required-opps = <&rpmpd_opp_svs_plus>;
+				};
+
+				opp-510000000 {
+					opp-hz = /bits/ 64 <510000000>;
+					opp-supported-hw = <0xff>;
+					required-opps = <&rpmpd_opp_nom>;
+				};
+
+				opp-560000000 {
+					opp-hz = /bits/ 64 <560000000>;
+					opp-supported-hw = <0xff>;
+					required-opps = <&rpmpd_opp_nom_plus>;
+				};
+
+				/*
+				 * This opp is only available on msm8953 and
+				 * sdm632, the max for sdm450 is 600MHz.
+				 */
+				opp-650000000 {
+					opp-hz = /bits/ 64 <650000000>;
+					opp-supported-hw = <0xff>;
+					required-opps = <&rpmpd_opp_turbo>;
+				};
+			};
+		};
+
 		gpu_iommu: iommu@1c48000 {
 			compatible = "qcom,msm8953-iommu", "qcom,msm-iommu-v2";
 			ranges = <0 0x01c48000 0x8000>;
@@ -2045,6 +2133,33 @@  map0 {
 				};
 			};
 		};
+
+		gpu-thermal {
+			polling-delay-passive = <250>;
+			polling-delay = <1000>;
+			thermal-sensors = <&tsens0 15>;
+
+			trips {
+				gpu_alert: trip-point0 {
+					temperature = <70000>;
+					hysteresis = <2000>;
+					type = "passive";
+				};
+
+				gpu_crit: crit {
+					temperature = <90000>;
+					hysteresis = <2000>;
+					type = "critical";
+				};
+			};
+
+			cooling-maps {
+				map0 {
+					trip = <&gpu_alert>;
+					cooling-device = <&gpu THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+				};
+			};
+		};
 	};
 
 	timer {
diff --git a/arch/arm64/boot/dts/qcom/sdm450-motorola-ali.dts b/arch/arm64/boot/dts/qcom/sdm450-motorola-ali.dts
index 362be5719dd2..e27f3c5d5bba 100644
--- a/arch/arm64/boot/dts/qcom/sdm450-motorola-ali.dts
+++ b/arch/arm64/boot/dts/qcom/sdm450-motorola-ali.dts
@@ -4,7 +4,7 @@ 
  */
 /dts-v1/;
 
-#include "msm8953.dtsi"
+#include "sdm450.dtsi"
 #include "pm8953.dtsi"
 #include "pmi8950.dtsi"
 
diff --git a/arch/arm64/boot/dts/qcom/sdm450.dtsi b/arch/arm64/boot/dts/qcom/sdm450.dtsi
new file mode 100644
index 000000000000..b222aeb459a3
--- /dev/null
+++ b/arch/arm64/boot/dts/qcom/sdm450.dtsi
@@ -0,0 +1,14 @@ 
+// SPDX-License-Identifier: BSD-3-Clause
+/* Copyright (c) 2023, Luca Weiss <luca@z3ntu.xyz> */
+
+#include "msm8953.dtsi"
+
+&gpu_opp_table {
+	/delete-node/ opp-650000000;
+
+	opp-600000000 {
+		opp-hz = /bits/ 64 <600000000>;
+		opp-supported-hw = <0xff>;
+		required-opps = <&rpmpd_opp_turbo>;
+	};
+};
diff --git a/arch/arm64/boot/dts/qcom/sdm632.dtsi b/arch/arm64/boot/dts/qcom/sdm632.dtsi
index 645b9f6a801f..95b025ea260b 100644
--- a/arch/arm64/boot/dts/qcom/sdm632.dtsi
+++ b/arch/arm64/boot/dts/qcom/sdm632.dtsi
@@ -79,3 +79,11 @@  &CPU7 {
 	compatible = "qcom,kryo250";
 	capacity-dmips-mhz = <1980>;
 };
+
+&gpu_opp_table {
+	opp-725000000 {
+		opp-hz = /bits/ 64 <725000000>;
+		opp-supported-hw = <0xff>;
+		required-opps = <&rpmpd_opp_turbo>;
+	};
+};