diff mbox series

[v2,11/11] clk: qcom: gpucc-msm8998: Allow fabia gpupll0 rate setting

Message ID 20210114221059.483390-12-angelogioacchino.delregno@somainline.org
State Accepted
Commit 53748348a57ae67756e82292b50773d2f4479d28
Headers show
Series Clock fixes for MSM8998 GCC, MMCC, GPUCC | expand

Commit Message

AngeloGioacchino Del Regno Jan. 14, 2021, 10:10 p.m. UTC
The GPU PLL0 is not a fixed PLL and the rate can be set on it:
this is necessary especially on boards which bootloader is setting
a very low rate on this PLL before booting Linux, which would be
unsuitable for postdividing to reach the maximum allowed Adreno GPU
frequency of 710MHz (or, actually, even 670MHz..) on this SoC.

To allow setting rates on the GPU PLL0, also define VCO boundaries
and set the CLK_SET_RATE_PARENT flag to the GPU PLL0 postdivider.

With this change, the Adreno GPU is now able to scale through all
the available frequencies.

Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org>
---
 drivers/clk/qcom/gpucc-msm8998.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

Comments

Stephen Boyd Feb. 8, 2021, 6:22 p.m. UTC | #1
Quoting AngeloGioacchino Del Regno (2021-01-14 14:10:59)
> The GPU PLL0 is not a fixed PLL and the rate can be set on it:
> this is necessary especially on boards which bootloader is setting
> a very low rate on this PLL before booting Linux, which would be
> unsuitable for postdividing to reach the maximum allowed Adreno GPU
> frequency of 710MHz (or, actually, even 670MHz..) on this SoC.
> 
> To allow setting rates on the GPU PLL0, also define VCO boundaries
> and set the CLK_SET_RATE_PARENT flag to the GPU PLL0 postdivider.
> 
> With this change, the Adreno GPU is now able to scale through all
> the available frequencies.
> 
> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org>
> ---

Applied to clk-next
Stephen Boyd Feb. 8, 2021, 6:24 p.m. UTC | #2
Quoting AngeloGioacchino Del Regno (2021-01-14 14:10:59)
> The GPU PLL0 is not a fixed PLL and the rate can be set on it:

> this is necessary especially on boards which bootloader is setting

> a very low rate on this PLL before booting Linux, which would be

> unsuitable for postdividing to reach the maximum allowed Adreno GPU

> frequency of 710MHz (or, actually, even 670MHz..) on this SoC.

> 

> To allow setting rates on the GPU PLL0, also define VCO boundaries

> and set the CLK_SET_RATE_PARENT flag to the GPU PLL0 postdivider.

> 

> With this change, the Adreno GPU is now able to scale through all

> the available frequencies.


BTW, you're probably undervolting your GPU and clocking it higher
than it should be at the voltage from boot.

> 

> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org>

> ---

>  drivers/clk/qcom/gpucc-msm8998.c | 10 +++++++++-

>  1 file changed, 9 insertions(+), 1 deletion(-)

> 

> diff --git a/drivers/clk/qcom/gpucc-msm8998.c b/drivers/clk/qcom/gpucc-msm8998.c

> index 1a518c4915b4..fedfffaf0a8d 100644

> --- a/drivers/clk/qcom/gpucc-msm8998.c

> +++ b/drivers/clk/qcom/gpucc-msm8998.c

> @@ -50,6 +50,11 @@ static struct clk_branch gpucc_cxo_clk = {

>         },

>  };

>  

> +static struct pll_vco fabia_vco[] = {


Should be const.

> +       { 249600000, 2000000000, 0 },

> +       { 125000000, 1000000000, 1 },

> +};

> +

>  static const struct clk_div_table post_div_table_fabia_even[] = {

>         { 0x0, 1 },

>         { 0x1, 2 },
AngeloGioacchino Del Regno Feb. 9, 2021, 1:18 p.m. UTC | #3
Il 08/02/21 19:24, Stephen Boyd ha scritto:
> Quoting AngeloGioacchino Del Regno (2021-01-14 14:10:59)

>> The GPU PLL0 is not a fixed PLL and the rate can be set on it:

>> this is necessary especially on boards which bootloader is setting

>> a very low rate on this PLL before booting Linux, which would be

>> unsuitable for postdividing to reach the maximum allowed Adreno GPU

>> frequency of 710MHz (or, actually, even 670MHz..) on this SoC.

>>

>> To allow setting rates on the GPU PLL0, also define VCO boundaries

>> and set the CLK_SET_RATE_PARENT flag to the GPU PLL0 postdivider.

>>

>> With this change, the Adreno GPU is now able to scale through all

>> the available frequencies.

> 

> BTW, you're probably undervolting your GPU and clocking it higher

> than it should be at the voltage from boot.

> 


Thanks for the consideration, but that's not the case, locally ;)

>>

>> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org>

>> ---

>>   drivers/clk/qcom/gpucc-msm8998.c | 10 +++++++++-

>>   1 file changed, 9 insertions(+), 1 deletion(-)

>>

>> diff --git a/drivers/clk/qcom/gpucc-msm8998.c b/drivers/clk/qcom/gpucc-msm8998.c

>> index 1a518c4915b4..fedfffaf0a8d 100644

>> --- a/drivers/clk/qcom/gpucc-msm8998.c

>> +++ b/drivers/clk/qcom/gpucc-msm8998.c

>> @@ -50,6 +50,11 @@ static struct clk_branch gpucc_cxo_clk = {

>>          },

>>   };

>>   

>> +static struct pll_vco fabia_vco[] = {

> 

> Should be const.

> 


Ack!

>> +       { 249600000, 2000000000, 0 },

>> +       { 125000000, 1000000000, 1 },

>> +};

>> +

>>   static const struct clk_div_table post_div_table_fabia_even[] = {

>>          { 0x0, 1 },

>>          { 0x1, 2 },
diff mbox series

Patch

diff --git a/drivers/clk/qcom/gpucc-msm8998.c b/drivers/clk/qcom/gpucc-msm8998.c
index 1a518c4915b4..fedfffaf0a8d 100644
--- a/drivers/clk/qcom/gpucc-msm8998.c
+++ b/drivers/clk/qcom/gpucc-msm8998.c
@@ -50,6 +50,11 @@  static struct clk_branch gpucc_cxo_clk = {
 	},
 };
 
+static struct pll_vco fabia_vco[] = {
+	{ 249600000, 2000000000, 0 },
+	{ 125000000, 1000000000, 1 },
+};
+
 static const struct clk_div_table post_div_table_fabia_even[] = {
 	{ 0x0, 1 },
 	{ 0x1, 2 },
@@ -61,11 +66,13 @@  static const struct clk_div_table post_div_table_fabia_even[] = {
 static struct clk_alpha_pll gpupll0 = {
 	.offset = 0x0,
 	.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_FABIA],
+	.vco_table = fabia_vco,
+	.num_vco = ARRAY_SIZE(fabia_vco),
 	.clkr.hw.init = &(struct clk_init_data){
 		.name = "gpupll0",
 		.parent_hws = (const struct clk_hw *[]){ &gpucc_cxo_clk.clkr.hw },
 		.num_parents = 1,
-		.ops = &clk_alpha_pll_fixed_fabia_ops,
+		.ops = &clk_alpha_pll_fabia_ops,
 	},
 };
 
@@ -80,6 +87,7 @@  static struct clk_alpha_pll_postdiv gpupll0_out_even = {
 		.name = "gpupll0_out_even",
 		.parent_hws = (const struct clk_hw *[]){ &gpupll0.clkr.hw },
 		.num_parents = 1,
+		.flags = CLK_SET_RATE_PARENT,
 		.ops = &clk_alpha_pll_postdiv_fabia_ops,
 	},
 };