[v3,11/18] arm64: dts: mediatek: mt8192-asurada: Couple VGPU and VSRAM_OTHER regulators

Message ID 20230228104741.717819-12-angelogioacchino.delregno@collabora.com
State New
Headers
Series Enable GPU with DVFS support on MediaTek SoCs |

Commit Message

AngeloGioacchino Del Regno Feb. 28, 2023, 10:47 a.m. UTC
  Add coupling for these regulators, as VSRAM_OTHER is used to power the
GPU SRAM, and they have a strict voltage output relation to satisfy in
order to ensure GPU stable operation.
While at it, also add voltage constraint overrides for the GPU SRAM
regulator "mt6359_vsram_others", but don't touch mt6315's vbuck1 as
its constraints are fine.

Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 arch/arm64/boot/dts/mediatek/mt8192-asurada.dtsi | 9 +++++++++
 1 file changed, 9 insertions(+)
  

Comments

Chen-Yu Tsai March 1, 2023, 4:53 a.m. UTC | #1
On Tue, Feb 28, 2023 at 6:47 PM AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com> wrote:
>
> Add coupling for these regulators, as VSRAM_OTHER is used to power the
> GPU SRAM, and they have a strict voltage output relation to satisfy in
> order to ensure GPU stable operation.
> While at it, also add voltage constraint overrides for the GPU SRAM
> regulator "mt6359_vsram_others", but don't touch mt6315's vbuck1 as
> its constraints are fine.

The minimum voltage on vbuck1 matches the lowest OPP. However the maximum
voltage is set to the maximum of the regulator itself. The MT8192 datasheet
says the absolute maximum for the GPU is 0.8V, and the recommended range
for 0.8V is 0.72V ~ 0.88V. The highest OPP we have is 0.8V, so I would
just set the maximum voltage to that?

ChenYu

> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> ---
>  arch/arm64/boot/dts/mediatek/mt8192-asurada.dtsi | 9 +++++++++
>  1 file changed, 9 insertions(+)
>
> diff --git a/arch/arm64/boot/dts/mediatek/mt8192-asurada.dtsi b/arch/arm64/boot/dts/mediatek/mt8192-asurada.dtsi
> index df477eb89f21..c8b6e1a9605b 100644
> --- a/arch/arm64/boot/dts/mediatek/mt8192-asurada.dtsi
> +++ b/arch/arm64/boot/dts/mediatek/mt8192-asurada.dtsi
> @@ -447,6 +447,13 @@ &mt6359_vrf12_ldo_reg {
>         regulator-always-on;
>  };
>
> +&mt6359_vsram_others_ldo_reg {
> +       regulator-min-microvolt = <750000>;
> +       regulator-max-microvolt = <850000>;
> +       regulator-coupled-with = <&mt6315_7_vbuck1>;
> +       regulator-coupled-max-spread = <10000>;
> +};
> +
>  &mt6359_vufs_ldo_reg {
>         regulator-always-on;
>  };
> @@ -1411,6 +1418,8 @@ mt6315_7_vbuck1: vbuck1 {
>                                 regulator-max-microvolt = <1193750>;
>                                 regulator-enable-ramp-delay = <256>;
>                                 regulator-allowed-modes = <0 1 2>;
> +                               regulator-coupled-with = <&mt6359_vsram_others_ldo_reg>;
> +                               regulator-coupled-max-spread = <10000>;
>                         };
>                 };
>         };
> --
> 2.39.2
>
  
AngeloGioacchino Del Regno March 1, 2023, 9:30 a.m. UTC | #2
Il 01/03/23 05:53, Chen-Yu Tsai ha scritto:
> On Tue, Feb 28, 2023 at 6:47 PM AngeloGioacchino Del Regno
> <angelogioacchino.delregno@collabora.com> wrote:
>>
>> Add coupling for these regulators, as VSRAM_OTHER is used to power the
>> GPU SRAM, and they have a strict voltage output relation to satisfy in
>> order to ensure GPU stable operation.
>> While at it, also add voltage constraint overrides for the GPU SRAM
>> regulator "mt6359_vsram_others", but don't touch mt6315's vbuck1 as
>> its constraints are fine.
> 
> The minimum voltage on vbuck1 matches the lowest OPP. However the maximum
> voltage is set to the maximum of the regulator itself. The MT8192 datasheet
> says the absolute maximum for the GPU is 0.8V, and the recommended range
> for 0.8V is 0.72V ~ 0.88V. The highest OPP we have is 0.8V, so I would
> just set the maximum voltage to that?
> 

The point was that we'd never get vbuck1 at more than vsram+10mV because
of the constraints that are set with regulator-coupled-max-spread, but
thinking about it again, relying on that is *highly* suboptimal.

Yes, you're right, let's change the constraints on vbuck1 to 800mV: that's
going to be for v4.

Thanks!
Angelo

> ChenYu
> 
>> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
>> ---
>>   arch/arm64/boot/dts/mediatek/mt8192-asurada.dtsi | 9 +++++++++
>>   1 file changed, 9 insertions(+)
>>
>> diff --git a/arch/arm64/boot/dts/mediatek/mt8192-asurada.dtsi b/arch/arm64/boot/dts/mediatek/mt8192-asurada.dtsi
>> index df477eb89f21..c8b6e1a9605b 100644
>> --- a/arch/arm64/boot/dts/mediatek/mt8192-asurada.dtsi
>> +++ b/arch/arm64/boot/dts/mediatek/mt8192-asurada.dtsi
>> @@ -447,6 +447,13 @@ &mt6359_vrf12_ldo_reg {
>>          regulator-always-on;
>>   };
>>
>> +&mt6359_vsram_others_ldo_reg {
>> +       regulator-min-microvolt = <750000>;
>> +       regulator-max-microvolt = <850000>;
>> +       regulator-coupled-with = <&mt6315_7_vbuck1>;
>> +       regulator-coupled-max-spread = <10000>;
>> +};
>> +
>>   &mt6359_vufs_ldo_reg {
>>          regulator-always-on;
>>   };
>> @@ -1411,6 +1418,8 @@ mt6315_7_vbuck1: vbuck1 {
>>                                  regulator-max-microvolt = <1193750>;
>>                                  regulator-enable-ramp-delay = <256>;
>>                                  regulator-allowed-modes = <0 1 2>;
>> +                               regulator-coupled-with = <&mt6359_vsram_others_ldo_reg>;
>> +                               regulator-coupled-max-spread = <10000>;
>>                          };
>>                  };
>>          };
>> --
>> 2.39.2
>>
  

Patch

diff --git a/arch/arm64/boot/dts/mediatek/mt8192-asurada.dtsi b/arch/arm64/boot/dts/mediatek/mt8192-asurada.dtsi
index df477eb89f21..c8b6e1a9605b 100644
--- a/arch/arm64/boot/dts/mediatek/mt8192-asurada.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt8192-asurada.dtsi
@@ -447,6 +447,13 @@  &mt6359_vrf12_ldo_reg {
 	regulator-always-on;
 };
 
+&mt6359_vsram_others_ldo_reg {
+	regulator-min-microvolt = <750000>;
+	regulator-max-microvolt = <850000>;
+	regulator-coupled-with = <&mt6315_7_vbuck1>;
+	regulator-coupled-max-spread = <10000>;
+};
+
 &mt6359_vufs_ldo_reg {
 	regulator-always-on;
 };
@@ -1411,6 +1418,8 @@  mt6315_7_vbuck1: vbuck1 {
 				regulator-max-microvolt = <1193750>;
 				regulator-enable-ramp-delay = <256>;
 				regulator-allowed-modes = <0 1 2>;
+				regulator-coupled-with = <&mt6359_vsram_others_ldo_reg>;
+				regulator-coupled-max-spread = <10000>;
 			};
 		};
 	};