All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] clk: sunxi-ng: Call divider_round_rate if we only have a single parent
@ 2017-01-24  9:41 ` Maxime Ripard
  0 siblings, 0 replies; 14+ messages in thread
From: Maxime Ripard @ 2017-01-24  9:41 UTC (permalink / raw)
  To: Mike Turquette, Stephen Boyd, Chen-Yu Tsai
  Cc: linux-clk, linux-arm-kernel, Maxime Ripard

The divider_get_val function that is used in our determine_rate callback
doesn't try to change the parent rate at all, while clk_divider_bestdiv,
used in divider_round_rate, does.

If we have a single parent, call divider_round_rate.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
---
 drivers/clk/sunxi-ng/ccu_div.c | 12 ++++++++++++
 1 file changed, 12 insertions(+), 0 deletions(-)

diff --git a/drivers/clk/sunxi-ng/ccu_div.c b/drivers/clk/sunxi-ng/ccu_div.c
index 8659b4cb6c20..4057e6021aa9 100644
--- a/drivers/clk/sunxi-ng/ccu_div.c
+++ b/drivers/clk/sunxi-ng/ccu_div.c
@@ -77,6 +77,18 @@ static int ccu_div_determine_rate(struct clk_hw *hw,
 {
 	struct ccu_div *cd = hw_to_ccu_div(hw);
 
+	if (clk_hw_get_num_parents(hw) == 1) {
+		req->rate = divider_round_rate(hw, req->rate,
+					       &req->best_parent_rate,
+					       cd->div.table,
+					       cd->div.width,
+					       cd->div.flags);
+
+		req->best_parent_hw = clk_hw_get_parent(hw);
+
+		return 0;
+	}
+
 	return ccu_mux_helper_determine_rate(&cd->common, &cd->mux,
 					     req, ccu_div_round_rate, cd);
 }

base-commit: 9181f40cede22bff9bc7f26830a4562373f30d73
-- 
git-series 0.8.11

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 1/2] clk: sunxi-ng: Call divider_round_rate if we only have a single parent
@ 2017-01-24  9:41 ` Maxime Ripard
  0 siblings, 0 replies; 14+ messages in thread
From: Maxime Ripard @ 2017-01-24  9:41 UTC (permalink / raw)
  To: linux-arm-kernel

The divider_get_val function that is used in our determine_rate callback
doesn't try to change the parent rate at all, while clk_divider_bestdiv,
used in divider_round_rate, does.

If we have a single parent, call divider_round_rate.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
---
 drivers/clk/sunxi-ng/ccu_div.c | 12 ++++++++++++
 1 file changed, 12 insertions(+), 0 deletions(-)

diff --git a/drivers/clk/sunxi-ng/ccu_div.c b/drivers/clk/sunxi-ng/ccu_div.c
index 8659b4cb6c20..4057e6021aa9 100644
--- a/drivers/clk/sunxi-ng/ccu_div.c
+++ b/drivers/clk/sunxi-ng/ccu_div.c
@@ -77,6 +77,18 @@ static int ccu_div_determine_rate(struct clk_hw *hw,
 {
 	struct ccu_div *cd = hw_to_ccu_div(hw);
 
+	if (clk_hw_get_num_parents(hw) == 1) {
+		req->rate = divider_round_rate(hw, req->rate,
+					       &req->best_parent_rate,
+					       cd->div.table,
+					       cd->div.width,
+					       cd->div.flags);
+
+		req->best_parent_hw = clk_hw_get_parent(hw);
+
+		return 0;
+	}
+
 	return ccu_mux_helper_determine_rate(&cd->common, &cd->mux,
 					     req, ccu_div_round_rate, cd);
 }

base-commit: 9181f40cede22bff9bc7f26830a4562373f30d73
-- 
git-series 0.8.11

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 2/2] clk: sunxi-ng: a33: Set CLK_SET_RATE_PARENT for the GPU
  2017-01-24  9:41 ` Maxime Ripard
@ 2017-01-24  9:41   ` Maxime Ripard
  -1 siblings, 0 replies; 14+ messages in thread
From: Maxime Ripard @ 2017-01-24  9:41 UTC (permalink / raw)
  To: Mike Turquette, Stephen Boyd, Chen-Yu Tsai
  Cc: linux-clk, linux-arm-kernel, Maxime Ripard

In order to achieve all the rates asked by the GPU, we might need to change
the parent frequency.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
---
 drivers/clk/sunxi-ng/ccu-sun8i-a33.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-a33.c b/drivers/clk/sunxi-ng/ccu-sun8i-a33.c
index 0d513d2674cb..a7b3c08ed0e2 100644
--- a/drivers/clk/sunxi-ng/ccu-sun8i-a33.c
+++ b/drivers/clk/sunxi-ng/ccu-sun8i-a33.c
@@ -468,7 +468,7 @@ static SUNXI_CCU_M_WITH_MUX_TABLE_GATE(drc_clk, "drc",
 				       0x180, 0, 4, 24, 3, BIT(31), 0);
 
 static SUNXI_CCU_M_WITH_GATE(gpu_clk, "gpu", "pll-gpu",
-			     0x1a0, 0, 3, BIT(31), 0);
+			     0x1a0, 0, 3, BIT(31), CLK_SET_RATE_PARENT);
 
 static const char * const ats_parents[] = { "osc24M", "pll-periph" };
 static SUNXI_CCU_M_WITH_MUX_GATE(ats_clk, "ats", ats_parents,
-- 
git-series 0.8.11

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 2/2] clk: sunxi-ng: a33: Set CLK_SET_RATE_PARENT for the GPU
@ 2017-01-24  9:41   ` Maxime Ripard
  0 siblings, 0 replies; 14+ messages in thread
From: Maxime Ripard @ 2017-01-24  9:41 UTC (permalink / raw)
  To: linux-arm-kernel

In order to achieve all the rates asked by the GPU, we might need to change
the parent frequency.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
---
 drivers/clk/sunxi-ng/ccu-sun8i-a33.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-a33.c b/drivers/clk/sunxi-ng/ccu-sun8i-a33.c
index 0d513d2674cb..a7b3c08ed0e2 100644
--- a/drivers/clk/sunxi-ng/ccu-sun8i-a33.c
+++ b/drivers/clk/sunxi-ng/ccu-sun8i-a33.c
@@ -468,7 +468,7 @@ static SUNXI_CCU_M_WITH_MUX_TABLE_GATE(drc_clk, "drc",
 				       0x180, 0, 4, 24, 3, BIT(31), 0);
 
 static SUNXI_CCU_M_WITH_GATE(gpu_clk, "gpu", "pll-gpu",
-			     0x1a0, 0, 3, BIT(31), 0);
+			     0x1a0, 0, 3, BIT(31), CLK_SET_RATE_PARENT);
 
 static const char * const ats_parents[] = { "osc24M", "pll-periph" };
 static SUNXI_CCU_M_WITH_MUX_GATE(ats_clk, "ats", ats_parents,
-- 
git-series 0.8.11

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/2] clk: sunxi-ng: Call divider_round_rate if we only have a single parent
  2017-01-24  9:41 ` Maxime Ripard
@ 2017-01-27  0:12   ` Stephen Boyd
  -1 siblings, 0 replies; 14+ messages in thread
From: Stephen Boyd @ 2017-01-27  0:12 UTC (permalink / raw)
  To: Maxime Ripard; +Cc: Mike Turquette, Chen-Yu Tsai, linux-clk, linux-arm-kernel

On 01/24, Maxime Ripard wrote:
> The divider_get_val function that is used in our determine_rate callback
> doesn't try to change the parent rate at all, while clk_divider_bestdiv,
> used in divider_round_rate, does.
> 
> If we have a single parent, call divider_round_rate.
> 
> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> ---

Acked-by: Stephen Boyd <sboyd@codeaurora.org>

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 1/2] clk: sunxi-ng: Call divider_round_rate if we only have a single parent
@ 2017-01-27  0:12   ` Stephen Boyd
  0 siblings, 0 replies; 14+ messages in thread
From: Stephen Boyd @ 2017-01-27  0:12 UTC (permalink / raw)
  To: linux-arm-kernel

On 01/24, Maxime Ripard wrote:
> The divider_get_val function that is used in our determine_rate callback
> doesn't try to change the parent rate at all, while clk_divider_bestdiv,
> used in divider_round_rate, does.
> 
> If we have a single parent, call divider_round_rate.
> 
> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> ---

Acked-by: Stephen Boyd <sboyd@codeaurora.org>

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/2] clk: sunxi-ng: a33: Set CLK_SET_RATE_PARENT for the GPU
  2017-01-24  9:41   ` Maxime Ripard
@ 2017-01-27  0:12     ` Stephen Boyd
  -1 siblings, 0 replies; 14+ messages in thread
From: Stephen Boyd @ 2017-01-27  0:12 UTC (permalink / raw)
  To: Maxime Ripard; +Cc: Mike Turquette, Chen-Yu Tsai, linux-clk, linux-arm-kernel

On 01/24, Maxime Ripard wrote:
> In order to achieve all the rates asked by the GPU, we might need to change
> the parent frequency.
> 
> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> ---

Acked-by: Stephen Boyd <sboyd@codeaurora.org>

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 2/2] clk: sunxi-ng: a33: Set CLK_SET_RATE_PARENT for the GPU
@ 2017-01-27  0:12     ` Stephen Boyd
  0 siblings, 0 replies; 14+ messages in thread
From: Stephen Boyd @ 2017-01-27  0:12 UTC (permalink / raw)
  To: linux-arm-kernel

On 01/24, Maxime Ripard wrote:
> In order to achieve all the rates asked by the GPU, we might need to change
> the parent frequency.
> 
> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> ---

Acked-by: Stephen Boyd <sboyd@codeaurora.org>

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/2] clk: sunxi-ng: a33: Set CLK_SET_RATE_PARENT for the GPU
  2017-01-27  0:12     ` Stephen Boyd
@ 2017-01-27  3:01       ` Chen-Yu Tsai
  -1 siblings, 0 replies; 14+ messages in thread
From: Chen-Yu Tsai @ 2017-01-27  3:01 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Maxime Ripard, Mike Turquette, Chen-Yu Tsai, linux-clk, linux-arm-kernel

On Fri, Jan 27, 2017 at 8:12 AM, Stephen Boyd <sboyd@codeaurora.org> wrote:
> On 01/24, Maxime Ripard wrote:
>> In order to achieve all the rates asked by the GPU, we might need to change
>> the parent frequency.
>>
>> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
>> ---
>
> Acked-by: Stephen Boyd <sboyd@codeaurora.org>

Acked-by: Chen-Yu Tsai <wens@csie.org>

> --
> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
> a Linux Foundation Collaborative Project

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 2/2] clk: sunxi-ng: a33: Set CLK_SET_RATE_PARENT for the GPU
@ 2017-01-27  3:01       ` Chen-Yu Tsai
  0 siblings, 0 replies; 14+ messages in thread
From: Chen-Yu Tsai @ 2017-01-27  3:01 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Jan 27, 2017 at 8:12 AM, Stephen Boyd <sboyd@codeaurora.org> wrote:
> On 01/24, Maxime Ripard wrote:
>> In order to achieve all the rates asked by the GPU, we might need to change
>> the parent frequency.
>>
>> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
>> ---
>
> Acked-by: Stephen Boyd <sboyd@codeaurora.org>

Acked-by: Chen-Yu Tsai <wens@csie.org>

> --
> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
> a Linux Foundation Collaborative Project

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/2] clk: sunxi-ng: Call divider_round_rate if we only have a single parent
  2017-01-27  0:12   ` Stephen Boyd
@ 2017-01-27  3:30     ` Chen-Yu Tsai
  -1 siblings, 0 replies; 14+ messages in thread
From: Chen-Yu Tsai @ 2017-01-27  3:30 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Mike Turquette, Chen-Yu Tsai, linux-clk, linux-arm-kernel, Stephen Boyd

On Fri, Jan 27, 2017 at 8:12 AM, Stephen Boyd <sboyd@codeaurora.org> wrote:
> On 01/24, Maxime Ripard wrote:
>> The divider_get_val function that is used in our determine_rate callback
>> doesn't try to change the parent rate at all, while clk_divider_bestdiv,
>> used in divider_round_rate, does.
>>
>> If we have a single parent, call divider_round_rate.

I guess my "clk: sunxi-ng: mux: Get closest parent rate possible with
CLK_SET_RATE_PARENT" patch somewhat takes care of the multi-parent
case? Still, the underlying clock type doesn't get to specify what
is considers to be the best parent rate.

>> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
>> ---
>
> Acked-by: Stephen Boyd <sboyd@codeaurora.org>

Acked-by: Chen-Yu Tsai <wens@csie.org>

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 1/2] clk: sunxi-ng: Call divider_round_rate if we only have a single parent
@ 2017-01-27  3:30     ` Chen-Yu Tsai
  0 siblings, 0 replies; 14+ messages in thread
From: Chen-Yu Tsai @ 2017-01-27  3:30 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Jan 27, 2017 at 8:12 AM, Stephen Boyd <sboyd@codeaurora.org> wrote:
> On 01/24, Maxime Ripard wrote:
>> The divider_get_val function that is used in our determine_rate callback
>> doesn't try to change the parent rate at all, while clk_divider_bestdiv,
>> used in divider_round_rate, does.
>>
>> If we have a single parent, call divider_round_rate.

I guess my "clk: sunxi-ng: mux: Get closest parent rate possible with
CLK_SET_RATE_PARENT" patch somewhat takes care of the multi-parent
case? Still, the underlying clock type doesn't get to specify what
is considers to be the best parent rate.

>> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
>> ---
>
> Acked-by: Stephen Boyd <sboyd@codeaurora.org>

Acked-by: Chen-Yu Tsai <wens@csie.org>

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/2] clk: sunxi-ng: Call divider_round_rate if we only have a single parent
  2017-01-27  3:30     ` Chen-Yu Tsai
@ 2017-01-27 10:03       ` Maxime Ripard
  -1 siblings, 0 replies; 14+ messages in thread
From: Maxime Ripard @ 2017-01-27 10:03 UTC (permalink / raw)
  To: Chen-Yu Tsai; +Cc: Mike Turquette, linux-clk, linux-arm-kernel, Stephen Boyd

[-- Attachment #1: Type: text/plain, Size: 1106 bytes --]

On Fri, Jan 27, 2017 at 11:30:05AM +0800, Chen-Yu Tsai wrote:
> On Fri, Jan 27, 2017 at 8:12 AM, Stephen Boyd <sboyd@codeaurora.org> wrote:
> > On 01/24, Maxime Ripard wrote:
> >> The divider_get_val function that is used in our determine_rate callback
> >> doesn't try to change the parent rate at all, while clk_divider_bestdiv,
> >> used in divider_round_rate, does.
> >>
> >> If we have a single parent, call divider_round_rate.
> 
> I guess my "clk: sunxi-ng: mux: Get closest parent rate possible with
> CLK_SET_RATE_PARENT" patch somewhat takes care of the multi-parent
> case?

It looks like it does yes :)

> Still, the underlying clock type doesn't get to specify what
> is considers to be the best parent rate.
> 
> >> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> >> ---
> >
> > Acked-by: Stephen Boyd <sboyd@codeaurora.org>
> 
> Acked-by: Chen-Yu Tsai <wens@csie.org>

Merged the two patches with Stephen and your Acked-bY.

Thanks!
Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 1/2] clk: sunxi-ng: Call divider_round_rate if we only have a single parent
@ 2017-01-27 10:03       ` Maxime Ripard
  0 siblings, 0 replies; 14+ messages in thread
From: Maxime Ripard @ 2017-01-27 10:03 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Jan 27, 2017 at 11:30:05AM +0800, Chen-Yu Tsai wrote:
> On Fri, Jan 27, 2017 at 8:12 AM, Stephen Boyd <sboyd@codeaurora.org> wrote:
> > On 01/24, Maxime Ripard wrote:
> >> The divider_get_val function that is used in our determine_rate callback
> >> doesn't try to change the parent rate at all, while clk_divider_bestdiv,
> >> used in divider_round_rate, does.
> >>
> >> If we have a single parent, call divider_round_rate.
> 
> I guess my "clk: sunxi-ng: mux: Get closest parent rate possible with
> CLK_SET_RATE_PARENT" patch somewhat takes care of the multi-parent
> case?

It looks like it does yes :)

> Still, the underlying clock type doesn't get to specify what
> is considers to be the best parent rate.
> 
> >> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> >> ---
> >
> > Acked-by: Stephen Boyd <sboyd@codeaurora.org>
> 
> Acked-by: Chen-Yu Tsai <wens@csie.org>

Merged the two patches with Stephen and your Acked-bY.

Thanks!
Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20170127/706e077e/attachment.sig>

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2017-01-27 10:03 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-24  9:41 [PATCH 1/2] clk: sunxi-ng: Call divider_round_rate if we only have a single parent Maxime Ripard
2017-01-24  9:41 ` Maxime Ripard
2017-01-24  9:41 ` [PATCH 2/2] clk: sunxi-ng: a33: Set CLK_SET_RATE_PARENT for the GPU Maxime Ripard
2017-01-24  9:41   ` Maxime Ripard
2017-01-27  0:12   ` Stephen Boyd
2017-01-27  0:12     ` Stephen Boyd
2017-01-27  3:01     ` Chen-Yu Tsai
2017-01-27  3:01       ` Chen-Yu Tsai
2017-01-27  0:12 ` [PATCH 1/2] clk: sunxi-ng: Call divider_round_rate if we only have a single parent Stephen Boyd
2017-01-27  0:12   ` Stephen Boyd
2017-01-27  3:30   ` Chen-Yu Tsai
2017-01-27  3:30     ` Chen-Yu Tsai
2017-01-27 10:03     ` Maxime Ripard
2017-01-27 10:03       ` Maxime Ripard

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.