Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1699570 > unrolled thread

[PATCH 0/4] clk: sunxi-ng: Fix issues with fractional mode

Started byJernej Skrabec <jernej.skrabec@siol.net>
First post2017-07-30 18:50 +0200
Last post2017-08-01 04:20 +0200
Articles 6 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/4] clk: sunxi-ng: Fix issues with fractional mode Jernej Skrabec <jernej.skrabec@siol.net> - 2017-07-30 18:50 +0200
    [PATCH 3/4] clk: sunxi-ng: Make fractional helper less chatty Jernej Skrabec <jernej.skrabec@siol.net> - 2017-07-30 18:50 +0200
      Re: [PATCH 3/4] clk: sunxi-ng: Make fractional helper less chatty Chen-Yu Tsai <wens@csie.org> - 2017-07-31 09:20 +0200
    Re: [PATCH 0/4] clk: sunxi-ng: Fix issues with fractional mode Chen-Yu Tsai <wens@csie.org> - 2017-07-31 07:20 +0200
      Re: [linux-sunxi] Re: [PATCH 0/4] clk: sunxi-ng: Fix issues with fractional mode Jernej Škrabec <jernej.skrabec@siol.net> - 2017-07-31 19:00 +0200
        Re: [linux-sunxi] Re: [PATCH 0/4] clk: sunxi-ng: Fix issues with  fractional mode Chen-Yu Tsai <wens@csie.org> - 2017-08-01 04:20 +0200

#1699570 — [PATCH 0/4] clk: sunxi-ng: Fix issues with fractional mode

FromJernej Skrabec <jernej.skrabec@siol.net>
Date2017-07-30 18:50 +0200
Subject[PATCH 0/4] clk: sunxi-ng: Fix issues with fractional mode
Message-ID<u8ZzH-2LG-3@gated-at.bofh.it>
During development of H3 HDMI driver, I found some issues with
setting video clock rate. It turned out that clock driver decided
to use fractional mode and selected right frequency, but it didn't
enable it. Additionally, fractional helpers don't wait on lock.

Patch 1 adds a call to N-M clock driver which enables fractional mode.
It also clears M factor before that as required by most SoCs.

Patch 2 adds a call to N clock driver which enables fractional mode.

Patch 3 makes fractional helpers less chatty.

Patch 4 adds a wait for lock to fractional helpers.

Jernej Skrabec (4):
  clk: sunxi-ng: Fix fractional mode for N-M clocks
  clk: sunxi-ng: multiplier: Fix fractional mode
  clk: sunxi-ng: Make fractional helper less chatty
  clk: sunxi-ng: Wait for lock when using fractional mode

 drivers/clk/sunxi-ng/ccu_frac.c | 14 ++++++++------
 drivers/clk/sunxi-ng/ccu_frac.h |  2 +-
 drivers/clk/sunxi-ng/ccu_mult.c | 10 +++++++---
 drivers/clk/sunxi-ng/ccu_nm.c   | 19 ++++++++++++++++---
 4 files changed, 32 insertions(+), 13 deletions(-)

-- 
2.13.3

[toc] | [next] | [standalone]


#1699573 — [PATCH 3/4] clk: sunxi-ng: Make fractional helper less chatty

FromJernej Skrabec <jernej.skrabec@siol.net>
Date2017-07-30 18:50 +0200
Subject[PATCH 3/4] clk: sunxi-ng: Make fractional helper less chatty
Message-ID<u8ZzI-2LG-21@gated-at.bofh.it>
In reply to#1699570
ccu_frac_helper_read_rate() prints some info which is not really
helpful except during debugging.

Replace printk() with pr_debug().

Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
---
 drivers/clk/sunxi-ng/ccu_frac.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/clk/sunxi-ng/ccu_frac.c b/drivers/clk/sunxi-ng/ccu_frac.c
index 8b5eb7756bf7..ff9e72dc5337 100644
--- a/drivers/clk/sunxi-ng/ccu_frac.c
+++ b/drivers/clk/sunxi-ng/ccu_frac.c
@@ -67,18 +67,18 @@ unsigned long ccu_frac_helper_read_rate(struct ccu_common *common,
 {
 	u32 reg;
 
-	printk("%s: Read fractional\n", clk_hw_get_name(&common->hw));
+	pr_debug("%s: Read fractional\n", clk_hw_get_name(&common->hw));
 
 	if (!(common->features & CCU_FEATURE_FRACTIONAL))
 		return 0;
 
-	printk("%s: clock is fractional (rates %lu and %lu)\n",
-	       clk_hw_get_name(&common->hw), cf->rates[0], cf->rates[1]);
+	pr_debug("%s: clock is fractional (rates %lu and %lu)\n",
+		 clk_hw_get_name(&common->hw), cf->rates[0], cf->rates[1]);
 
 	reg = readl(common->base + common->reg);
 
-	printk("%s: clock reg is 0x%x (select is 0x%x)\n",
-	       clk_hw_get_name(&common->hw), reg, cf->select);
+	pr_debug("%s: clock reg is 0x%x (select is 0x%x)\n",
+		 clk_hw_get_name(&common->hw), reg, cf->select);
 
 	return (reg & cf->select) ? cf->rates[1] : cf->rates[0];
 }
-- 
2.13.3

[toc] | [prev] | [next] | [standalone]


#1699755 — Re: [PATCH 3/4] clk: sunxi-ng: Make fractional helper less chatty

FromChen-Yu Tsai <wens@csie.org>
Date2017-07-31 09:20 +0200
SubjectRe: [PATCH 3/4] clk: sunxi-ng: Make fractional helper less chatty
Message-ID<u9d9D-3ia-9@gated-at.bofh.it>
In reply to#1699573
()On Mon, Jul 31, 2017 at 12:41 AM, Jernej Skrabec
<jernej.skrabec@siol.net> wrote:
> ccu_frac_helper_read_rate() prints some info which is not really
> helpful except during debugging.
>
> Replace printk() with pr_debug().
>
> Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>

Queued as a fix for 4.13 with the following tag:

Fixes: 89a3dfb78707 ("clk: sunxi-ng: Add fractional lib")

The rationale being the previous two patches actually enable
the ccu_frac_helper_read_rate() code path, and we don't want
the users to be annoyed by all the noise.

ChenYu

[toc] | [prev] | [next] | [standalone]


#1699692

FromChen-Yu Tsai <wens@csie.org>
Date2017-07-31 07:20 +0200
Message-ID<u9bhv-269-5@gated-at.bofh.it>
In reply to#1699570
Hi Jernej,

On Mon, Jul 31, 2017 at 12:41 AM, Jernej Skrabec
<jernej.skrabec@siol.net> wrote:
> During development of H3 HDMI driver, I found some issues with
> setting video clock rate. It turned out that clock driver decided
> to use fractional mode and selected right frequency, but it didn't
> enable it. Additionally, fractional helpers don't wait on lock.

What kind of resolution were you testing to actually hit this?

AFAIK the fractional mode is either 297 or 270 MHz. Even Full HD
1080p60 dot clocks aren't that high. And the clk drivers should
try to request a matching parent clk rate. So the PLL wouldn't
go that high. Are you testing 4k @ 30fps?

As it stands, I don't think any of the existing display support
can go that high, so I think we're safe as far as old kernels
go, i.e. we don't need to Cc stable for these.

Regards
ChenYu

> Patch 1 adds a call to N-M clock driver which enables fractional mode.
> It also clears M factor before that as required by most SoCs.
>
> Patch 2 adds a call to N clock driver which enables fractional mode.
>
> Patch 3 makes fractional helpers less chatty.
>
> Patch 4 adds a wait for lock to fractional helpers.
>
> Jernej Skrabec (4):
>   clk: sunxi-ng: Fix fractional mode for N-M clocks
>   clk: sunxi-ng: multiplier: Fix fractional mode
>   clk: sunxi-ng: Make fractional helper less chatty
>   clk: sunxi-ng: Wait for lock when using fractional mode
>
>  drivers/clk/sunxi-ng/ccu_frac.c | 14 ++++++++------
>  drivers/clk/sunxi-ng/ccu_frac.h |  2 +-
>  drivers/clk/sunxi-ng/ccu_mult.c | 10 +++++++---
>  drivers/clk/sunxi-ng/ccu_nm.c   | 19 ++++++++++++++++---
>  4 files changed, 32 insertions(+), 13 deletions(-)
>
> --
> 2.13.3
>

[toc] | [prev] | [next] | [standalone]


#1700202 — Re: [linux-sunxi] Re: [PATCH 0/4] clk: sunxi-ng: Fix issues with fractional mode

FromJernej Škrabec <jernej.skrabec@siol.net>
Date2017-07-31 19:00 +0200
SubjectRe: [linux-sunxi] Re: [PATCH 0/4] clk: sunxi-ng: Fix issues with fractional mode
Message-ID<u9mcW-eA-7@gated-at.bofh.it>
In reply to#1699692
Hi Chen-Yu,

Dne ponedeljek, 31. julij 2017 ob 07:13:34 CEST je Chen-Yu Tsai napisal(a):
> Hi Jernej,
> 
> On Mon, Jul 31, 2017 at 12:41 AM, Jernej Skrabec
> 
> <jernej.skrabec@siol.net> wrote:
> > During development of H3 HDMI driver, I found some issues with
> > setting video clock rate. It turned out that clock driver decided
> > to use fractional mode and selected right frequency, but it didn't
> > enable it. Additionally, fractional helpers don't wait on lock.
> 
> What kind of resolution were you testing to actually hit this?

1920x1080p @ 60Hz

> 
> AFAIK the fractional mode is either 297 or 270 MHz. Even Full HD
> 1080p60 dot clocks aren't that high. And the clk drivers should
> try to request a matching parent clk rate. So the PLL wouldn't
> go that high. Are you testing 4k @ 30fps?

No, it is a bit more complicated than that. H3's HDMI PHY is proprietary and 
register meanings are not known well. Because of that, I'm using values found 
in BSP driver. Those values include pixel clock divider. BSP driver always use 
297 MHz as a base and uses dividers in PHY to prepare right pixel clock. So 
the case for 1080p is 297 MHz / 2 = 148.5 MHz.

> 
> As it stands, I don't think any of the existing display support
> can go that high, so I think we're safe as far as old kernels
> go, i.e. we don't need to Cc stable for these.

Ok.

Regards,
Jernej

[toc] | [prev] | [next] | [standalone]


#1700583 — Re: [linux-sunxi] Re: [PATCH 0/4] clk: sunxi-ng: Fix issues with fractional mode

FromChen-Yu Tsai <wens@csie.org>
Date2017-08-01 04:20 +0200
SubjectRe: [linux-sunxi] Re: [PATCH 0/4] clk: sunxi-ng: Fix issues with fractional mode
Message-ID<u9uWS-5OL-1@gated-at.bofh.it>
In reply to#1700202
On Tue, Aug 1, 2017 at 12:50 AM, Jernej Škrabec <jernej.skrabec@siol.net> wrote:
> Hi Chen-Yu,
>
> Dne ponedeljek, 31. julij 2017 ob 07:13:34 CEST je Chen-Yu Tsai napisal(a):
>> Hi Jernej,
>>
>> On Mon, Jul 31, 2017 at 12:41 AM, Jernej Skrabec
>>
>> <jernej.skrabec@siol.net> wrote:
>> > During development of H3 HDMI driver, I found some issues with
>> > setting video clock rate. It turned out that clock driver decided
>> > to use fractional mode and selected right frequency, but it didn't
>> > enable it. Additionally, fractional helpers don't wait on lock.
>>
>> What kind of resolution were you testing to actually hit this?
>
> 1920x1080p @ 60Hz
>
>>
>> AFAIK the fractional mode is either 297 or 270 MHz. Even Full HD
>> 1080p60 dot clocks aren't that high. And the clk drivers should
>> try to request a matching parent clk rate. So the PLL wouldn't
>> go that high. Are you testing 4k @ 30fps?
>
> No, it is a bit more complicated than that. H3's HDMI PHY is proprietary and
> register meanings are not known well. Because of that, I'm using values found
> in BSP driver. Those values include pixel clock divider. BSP driver always use
> 297 MHz as a base and uses dividers in PHY to prepare right pixel clock. So
> the case for 1080p is 297 MHz / 2 = 148.5 MHz.

I see. So for the current in kernel users, none would be able to
hit the fractional mode clock rates. HDMI on sun5i is limited to
1080p60, and we don't support pixel doubling. LCD dotclocks have
a minimal /6 divider, though it doesn't seem likely they will hit
this either, or we would have seen someone complain. And these
drivers were introduced well before 4.13-rc1. The clk maintainers
really like to have just critical fixes, and fixes for stuff
added in the current release. So I'm re-queuing these 4 patches
for 4.14.

Thanks
ChenYu

>
>>
>> As it stands, I don't think any of the existing display support
>> can go that high, so I think we're safe as far as old kernels
>> go, i.e. we don't need to Cc stable for these.
>
> Ok.
>
> Regards,
> Jernej
>
> --
> You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web