Skip to contentSkip to conversation

ARM: EXYNOS4: Change clock name for FIMD

PATCH JinGoo Han 4 participants 6 messages Jun 20, 2011 – Jun 21, 2011 Arm Samsung Exynos

lore
Share & tools
lore

JinGoo Han

author
#0 lore raw

Hi, Sylwester Nawrocki.
I appreciate your review and suggestion.

Please, refer to the LCD contoller clock table as follows:
- s3c2440 uses 's3c2410fb.c', not 's3c-fb.c' since LCD controller IP is different. However, s3c2443 uses 's3c-fb.c'. So I add s3c2443 to table instead of s3c2440.
- s3c6410 has SCLK_LCD, but, clock name is not defined.
- Exynos4 does not use name "HCLK".

          | LCD controller    |                            |
          | (IP core) clock   | LCD pixel clock            |

----------+------------------------+-----------------------+
s3c2443 | HCLK (lcd) | x | DISPCLK (display-if) |
----------+------------------------+-----------------------+
s3c6410 | HCLK (lcd) | x | SCLK_LCD (N/A) |
----------+------------------------+-----------------------+
s5pc100 | HCLK (lcd) | x | SCLK_LCD (sclk_lcd) |
----------+------------------------+-----------------------+
s5pv210 | HCLK_DSYS (lcd) | x | SCLK_FIMD (sclk_fimd)|
----------+-----------------------+------------------------+
exynos4 | ACLK_160 (fimd) | O | SCLK_FIMD (sclk_fimd)|
----------+------------------------+-----------------------+

s3c2443, s3c6410, s5pc100 and s5pv210 don't use 'sclk_lcd' or 'sclk_fimd'. 'lcd' clock is also used to generate the LCD pixel clock.

My point is that LCD contoroller clock should be named "lcd" for consistence. If there is not mux for lcd pixel clock in case of exynos4, "sclk_fimd" will be set in machine directory.

As you mentioned, I also think that we need to create two clock connection ids such as "bus_ck", "pix_ck" in order to use SCLK_LCD or SCLK_FIMD. Moreover, 'lcd' in s5pv210 should be changed to 'fimd' according to s5pv210 datasheet. However, it requres many works to convert.

So, I think that 'two clock connection ids' patch would be submitted later, after committing the patches that I submitted on last Friday.

Quoted 66 lines · Sylwester Nawrocki

Hi Jingoo,

Quoted 12 lines · Jingoo Han

This patch changes clock name for FIMD from "fimd" to "lcd".

---
  arch/arm/mach-exynos4/clock.c |    4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)
(quoted diff) +0 -0

b/arch/arm/mach-exynos4/clock.c index 871f9d5..12e6853 100644

arch/arm/mach-exynos4/clock.c static struct clk init_clocks_off[] = { · line 438

Quoted 7 lines
arch/arm/mach-exynos4/clock.c +1 -1
@@ -433,12 +433,12 @@ static struct clk init_clocks_off[] = {
    .enable  = exynos4_clk_ip_cam_ctrl,
    .ctrlbit = (1<<  3),
   }, {
-  .name  = "fimd",
+  .name  = "lcd",
    .id  = 0,
    .enable  = exynos4_clk_ip_lcd0_ctrl,

I think we're inevitably heading to disaster with this kind of implicit clocks mapping across various SoCs. It is getting harder to figure out what's going on with every new SoC support added.
The "fimd" clock in this case (exynos4) is not really a HCLK clock, like, for instance, in case of s5pv210. But after this patch they would both be named "lcd". You cannot set frequency on "fimd" clock, it is only for gating the bus clock to the LCD controller, right ? Whereas "lcd" indicates HCLK on s5pv210 and can also be used to generate the LCD pixel clock.
I know you are not going to use "lcd" clock in the driver for setting up the pixel clock frequency on exynos4 but it's all confusing this way.

I dug in the datasheets and it looks like the LCD controller's IP main (bus) clock is named HCLK there and "lcd" throughout the code.

          | LCD controller    |                            |
          | (IP core) clock   | LCD pixel clock            |

----------+------------------------+-----------------------+
s3c2440 | HCLK (lcd) | x | N/A ? |
----------+------------------------+-----------------------+
s3c6410 | HCLK (lcd) | x | LCD |
----------+------------------------+-----------------------+
s5pc100 | HCLK (lcd) | x | SCLK_LCD (sclk_lcd) |
----------+------------------------+-----------------------+
s5pv210 | HCLK(_DSYS) (lcd)| x | SCLK_FIMD (sclk_fimd)|
----------+-----------------------+-----------------------+
exynos4 | ? | - | SCLK_FIMD?(sclk_fimd)|
----------+------------------------+-----------------------+

I think we could try to create two clock connection ids to the framebuffer device in the first place, e.g. "bus_ck", "pix_ck".
And then think about how handle that in the driver.

But this requires conversion to the omap-style clock registration method, something like in the attached patch. The patch is only for s5pv210 and and compile tested only as I didn't have any board to test it here. It's based on for-next branch at http://tinyurl.com/6yzravy I think there might be more issues to convert the old s3c24xx platforms, nevertheless the attached patch should not affect them.

--
Regards,
Sylwester

#1 lore raw

Hi JinGoo,

Quoted 4 lines · JinGoo Han

Hi, Sylwester Nawrocki.
I appreciate your review and suggestion.

Please, refer to the LCD contoller clock table as follows:

ok, thanks for the update.

Quoted 2 lines

- s3c2440 uses 's3c2410fb.c', not 's3c-fb.c' since LCD controller IP is different. However, s3c2443 uses 's3c-fb.c'. So I add s3c2443 to table instead of s3c2440.

Yes, I was aware of that. My bad to put s3c2440 in the table.

Quoted 5 lines

- s3c6410 has SCLK_LCD, but, clock name is not defined.
- Exynos4 does not use name "HCLK".

          | LCD controller    |                            |
          | (IP core) clock   | LCD pixel clock            |
Quoted 11 lines

----------+------------------------+-----------------------+
s3c2443 | HCLK (lcd) | x | DISPCLK (display-if) |
----------+------------------------+-----------------------+
s3c6410 | HCLK (lcd) | x | SCLK_LCD (N/A) |
----------+------------------------+-----------------------+
s5pc100 | HCLK (lcd) | x | SCLK_LCD (sclk_lcd) |
----------+------------------------+-----------------------+
s5pv210 | HCLK_DSYS (lcd) | x | SCLK_FIMD (sclk_fimd)|
----------+-----------------------+------------------------+
exynos4 | ACLK_160 (fimd) | O | SCLK_FIMD (sclk_fimd)|
----------+------------------------+-----------------------+

             ^^^^^^^^^^^^^^^^^^^    

In mach-exynos4/clock.c this clock is described as ACLK_133 (lcd)

Quoted 5 lines

s3c2443, s3c6410, s5pc100 and s5pv210 don't use 'sclk_lcd' or 'sclk_fimd'. 'lcd' clock is also used to generate the LCD pixel clock.

My point is that LCD controller clock should be named "lcd" for consistence.

Yes, I agree. After thinking about it a bit more I was going to propose that too.

Quoted 2 lines

If there is not mux for lcd pixel clock in case of exynos4, "sclk_fimd" will be set in machine directory.

OK, you patch for s3c-fb driver looks like a significant improvement comparing to the original one. But I think we should remove the callback into machine code.
The driver could just directly be doing clk_get(dev, "sclk_fimd"); If this succeeds and clksel option is not set in the IP variant then the driver should treat "sclk_fimd" as pixel clock, i.e. it will set its frequency and enable it. It should not care about setting the parent for "sclk_fimd", this should be done before s3c-fb probe is called.

The problem is that I don't know what to do it the bootloader does not set a parent clock for sclk_fimd..
The board code could just get sclk_fimd and set mout_mpll as its parent, like it's done in your patch:
[PATCH v2 3/5] ARM: EXYNOS4: Add platform device and helper functions for FIMD (except passing a pointer to the driver).

However there have been objections to put such things in the board code in the past.
In case of camera clocks we used to have internally a function in the machine file setting the parent clocks, until bootloader was modified to configure them.

Quoted 4 lines

As you mentioned, I also think that we need to create two clock connection ids such as "bus_ck", "pix_ck" in order to use SCLK_LCD or SCLK_FIMD. Moreover, 'lcd' in s5pv210 should be changed to 'fimd' according to s5pv210 datasheet.

Yeah, that makes sense.

Quoted 1 line

However, it requires many works to convert.

It's a bit laborious. But it's doable.

Quoted 3 lines

So, I think that 'two clock connection ids' patch would be submitted later, after committing the patches that I submitted on last Friday.

I agree with that, given that the callback is removed from the platform data structure.
We need to get ourselves onto path of migration to the device tree and IMHO adding more callbacks to board code is a step in opposite direction.

Thanks,
S.

#2 lore raw
In reply to JinGoo Han

Hi, Mr. Han and Sylwester.
below is my opinion.

JinGoo Han 쓴 글:

Quoted 35 lines

Hi, Sylwester Nawrocki.
I appreciate your review and suggestion.

Please, refer to the LCD contoller clock table as follows:
- s3c2440 uses 's3c2410fb.c', not 's3c-fb.c' since LCD controller IP is different. However, s3c2443 uses 's3c-fb.c'. So I add s3c2443 to table instead of s3c2440.
- s3c6410 has SCLK_LCD, but, clock name is not defined.
- Exynos4 does not use name "HCLK".

          | LCD controller    |                            |
          | (IP core) clock   | LCD pixel clock            |

----------+------------------------+-----------------------+
s3c2443 | HCLK (lcd) | x | DISPCLK (display-if) |
----------+------------------------+-----------------------+
s3c6410 | HCLK (lcd) | x | SCLK_LCD (N/A) |
----------+------------------------+-----------------------+
s5pc100 | HCLK (lcd) | x | SCLK_LCD (sclk_lcd) |
----------+------------------------+-----------------------+
s5pv210 | HCLK_DSYS (lcd) | x | SCLK_FIMD (sclk_fimd)|
----------+-----------------------+------------------------+
exynos4 | ACLK_160 (fimd) | O | SCLK_FIMD (sclk_fimd)|
----------+------------------------+-----------------------+

s3c2443, s3c6410, s5pc100 and s5pv210 don't use 'sclk_lcd' or 'sclk_fimd'. 'lcd' clock is also used to generate the LCD pixel clock.

My point is that LCD contoroller clock should be named "lcd" for consistence. If there is not mux for lcd pixel clock in case of exynos4, "sclk_fimd" will be set in machine directory.

As you mentioned, I also think that we need to create two clock connection ids such as "bus_ck", "pix_ck" in order to use SCLK_LCD or SCLK_FIMD. Moreover, 'lcd' in s5pv210 should be changed to 'fimd' according to s5pv210 datasheet. However, it requres many works to convert.

Quoted 70 lines

So, I think that 'two clock connection ids' patch would be submitted later, after committing the patches that I submitted on last Friday.

Quoted 65 lines · Sylwester Nawrocki

Hi Jingoo,

Quoted 12 lines · Jingoo Han

This patch changes clock name for FIMD from "fimd" to "lcd".

---
  arch/arm/mach-exynos4/clock.c |    4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)
(quoted diff) +0 -0

b/arch/arm/mach-exynos4/clock.c index 871f9d5..12e6853 100644

arch/arm/mach-exynos4/clock.c static struct clk init_clocks_off[] = { · line 438

Quoted 7 lines
arch/arm/mach-exynos4/clock.c +1 -1
@@ -433,12 +433,12 @@ static struct clk init_clocks_off[] = {
    .enable  = exynos4_clk_ip_cam_ctrl,
    .ctrlbit = (1<<  3),
   }, {
-  .name  = "fimd",
+  .name  = "lcd",
    .id  = 0,
    .enable  = exynos4_clk_ip_lcd0_ctrl,

I think we're inevitably heading to disaster with this kind of implicit clocks mapping across various SoCs. It is getting harder to figure out what's going on with every new SoC support added.
The "fimd" clock in this case (exynos4) is not really a HCLK clock, like, for instance, in case of s5pv210. But after this patch they would both be named "lcd". You cannot set frequency on "fimd" clock, it is only for gating the bus clock to the LCD controller, right ? Whereas "lcd" indicates HCLK on s5pv210 and can also be used to generate the LCD pixel clock.
I know you are not going to use "lcd" clock in the driver for setting up the pixel clock frequency on exynos4 but it's all confusing this way.

I dug in the datasheets and it looks like the LCD controller's IP main (bus) clock is named HCLK there and "lcd" throughout the code.

          | LCD controller    |                            |
          | (IP core) clock   | LCD pixel clock            |

----------+------------------------+-----------------------+
s3c2440 | HCLK (lcd) | x | N/A ? |
----------+------------------------+-----------------------+
s3c6410 | HCLK (lcd) | x | LCD |
----------+------------------------+-----------------------+
s5pc100 | HCLK (lcd) | x | SCLK_LCD (sclk_lcd) |
----------+------------------------+-----------------------+
s5pv210 | HCLK(_DSYS) (lcd)| x | SCLK_FIMD (sclk_fimd)|
----------+-----------------------+-----------------------+
exynos4 | ? | - | SCLK_FIMD?(sclk_fimd)|
----------+------------------------+-----------------------+

I think we could try to create two clock connection ids to the framebuffer device in the first place, e.g. "bus_ck", "pix_ck".
And then think about how handle that in the driver.

But this requires conversion to the omap-style clock registration method, something like in the attached patch. The patch is only for s5pv210 and and compile tested only as I didn't have any board to test it here. It's based on for-next branch at http://tinyurl.com/6yzravy I think there might be more issues to convert the old s3c24xx platforms, nevertheless the attached patch should not affect them.

--
Regards,
Sylwester

when someone adds new board file with new SoC, he doesn't need to know this SoC chip has hclk and sclk_fimd or only sclk_fimd(such as exynos4). using implicit clock means it should know that this SoC chip has both clocks(bus clock, sclk_fimd) or only sclk_fimd.

for example, if any driver needs fimd clock frequency then this driver should know that this SoC chip is exynos4 or not and has both clock source(bus clock, soure clock fimd) or not(only source clock fimd) so I think we shoule see only a clock "lcd" regardless of which clock is used and if exynos4 then sclk_fimd would be set by machine code.

and Sylwester,
it appears that your patch has one issue about clk_get function call. your patch adds "bus_ck" to list head "clocks" of plat-samsung/clock.c and "pix_ck" to list head "clocks" of drivers/clk/clkdev.c and I am afraid that if some machine(such as s3c24xx, s3c64xx and s5pc1xx) has CLKDEV_LOOKUP configuration then clk_get() would fail to get clock object because in this case, clock lookup could be done through list head "clocks" of driver/clk/clkdev.c.(it's right from plat-samsung/clock.c) so I think it needs more patch for resolving this issue also and do you think it's a good way to use only one clock name "lcd"?... in fact, this might be so.... much slight issue. :)

#3 lore raw

Hi Inki

Quoted 4 lines · daeinki

Hi, Mr. Han and Sylwester.
below is my opinion.

JinGoo Han 쓴 글:

...

Quoted 19 lines
Quoted 19 lines

Please, refer to the LCD contoller clock table as follows:
- s3c2440 uses 's3c2410fb.c', not 's3c-fb.c' since LCD controller IP is different.

    However, s3c2443 uses 's3c-fb.c'. So I add s3c2443 to table instead of s3c2440.

- s3c6410 has SCLK_LCD, but, clock name is not defined.
- Exynos4 does not use name "HCLK".

           | LCD controller    |                            |
           | (IP core) clock   | LCD pixel clock            |

----------+------------------------+-----------------------+
s3c2443 | HCLK (lcd) | x | DISPCLK (display-if) |
----------+------------------------+-----------------------+
s3c6410 | HCLK (lcd) | x | SCLK_LCD (N/A) |
----------+------------------------+-----------------------+
s5pc100 | HCLK (lcd) | x | SCLK_LCD (sclk_lcd) |
----------+------------------------+-----------------------+
s5pv210 | HCLK_DSYS (lcd) | x | SCLK_FIMD (sclk_fimd)|
----------+-----------------------+------------------------+
exynos4 | ACLK_160 (fimd) | O | SCLK_FIMD (sclk_fimd)|
----------+------------------------+-----------------------+

...

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

I think we could try to create two clock connection ids to the framebuffer device in the first place, e.g. "bus_ck", "pix_ck".
And then think about how handle that in the driver.

But this requires conversion to the omap-style clock registration method, something like in the attached patch. The patch is only for s5pv210 and and compile tested only as I didn't have any board to test it here. It's based on for-next branch at http://tinyurl.com/6yzravy I think there might be more issues to convert the old s3c24xx platforms, nevertheless the attached patch should not affect them.

...

Quoted 11 lines

when someone adds new board file with new SoC, he doesn't need to know this SoC chip has hclk and sclk_fimd or only sclk_fimd(such as exynos4). using implicit clock means it should know that this SoC chip has both clocks(bus clock, sclk_fimd) or only sclk_fimd.

for example, if any driver needs fimd clock frequency then this driver should know that this SoC chip is exynos4 or not and has both clock source(bus clock, soure clock fimd) or not(only source clock fimd) so I think we shoule see only a clock "lcd" regardless of which clock is used and if exynos4 then sclk_fimd would be set by machine code.

Quoted 3 lines

and Sylwester,
it appears that your patch has one issue about clk_get function call. your patch adds "bus_ck" to list head "clocks" of plat-samsung/clock.c

Why do you think so ? In fact the "clocks" list in plat-samsung/clock.c is not used any more, AFAIU it should have been removed altogether with clk_get/clk_put functions in Thomas' clkdev patches.
When you comment out the line declaring the list everything compiles fine there.

Quoted 6 lines

and "pix_ck" to list head "clocks" of drivers/clk/clkdev.c and I am afraid that if some machine(such as s3c24xx, s3c64xx and s5pc1xx) has CLKDEV_LOOKUP configuration then clk_get() would fail to get clock object because in this case, clock lookup could be done through list head "clocks" of driver/clk/clkdev.c.(it's right from plat-samsung/clock.c) so I think it needs more patch for resolving this

As I indicated earlier the framebuffer driver would have to be modified to support newly introduced clock _connection_ names.
We could (temporarily) name one of those clock connections "lcd", to avoid additional trouble on SoCs that still use a one-to-one platform clock name <-> clock connection id mapping.

Quoted 2 lines

issue also and do you think it's a good way to use only one clock name "lcd"?... in fact, this might be so.... much slight issue. :)

Do you mean using using one name in the code for different clock names in the datasheets ? I suppose it was because of the API limitations and hope it will change for the better. :)

Cheers,
Sylwester

#5 lore raw
In reply to daeinki
Quoted 4 lines · daeinki

when someone adds new board file with new SoC, he doesn't need to know this SoC chip has hclk and sclk_fimd or only sclk_fimd(such as exynos4). using implicit clock means it should know that this SoC chip has both clocks(bus clock, sclk_fimd) or only sclk_fimd.

AFAICS at least two clock sources are connected to LCD controller on each SoC supported by s3c-fb: a bus and dedicated video reference clock. There is a mux inside the device to switch between them for video reference clock in all but most recent SoCs. The driver is already (will be) aware that the mux control bit disappeared in some IP variant and it must split functionality between two clock sources.

Quoted 6 lines

for example, if any driver needs fimd clock frequency then this driver should know that this SoC chip is exynos4 or not and has both clock source(bus clock, soure clock fimd) or not(only source clock fimd) so I think we shoule see only a clock "lcd" regardless of which clock is used and if exynos4 then sclk_fimd would be set by machine code.

I wouldn't make the driver this dumb. It must already handle relatively large differences across the IPs.

#4 lore raw
In reply to Sylwester Nawrocki

Hi Sylwester

You are right, no problem if clkdev is used instead of plat-samsung/clock.c. I didn't aware of recently trend.(I couldn't afford to having interest in open source) and I will look over clkdev feature Thomas introduced.

Thank you.

Sylwester Nawrocki 쓴 글:

Quoted 84 lines

Hi Inki

Quoted 4 lines · daeinki

Hi, Mr. Han and Sylwester.
below is my opinion.

JinGoo Han 쓴 글:

...

Quoted 19 lines
Quoted 19 lines

Please, refer to the LCD contoller clock table as follows:
- s3c2440 uses 's3c2410fb.c', not 's3c-fb.c' since LCD controller IP is different.

    However, s3c2443 uses 's3c-fb.c'. So I add s3c2443 to table instead of s3c2440.

- s3c6410 has SCLK_LCD, but, clock name is not defined.
- Exynos4 does not use name "HCLK".

           | LCD controller    |                            |
           | (IP core) clock   | LCD pixel clock            |

----------+------------------------+-----------------------+
s3c2443 | HCLK (lcd) | x | DISPCLK (display-if) |
----------+------------------------+-----------------------+
s3c6410 | HCLK (lcd) | x | SCLK_LCD (N/A) |
----------+------------------------+-----------------------+
s5pc100 | HCLK (lcd) | x | SCLK_LCD (sclk_lcd) |
----------+------------------------+-----------------------+
s5pv210 | HCLK_DSYS (lcd) | x | SCLK_FIMD (sclk_fimd)|
----------+-----------------------+------------------------+
exynos4 | ACLK_160 (fimd) | O | SCLK_FIMD (sclk_fimd)|
----------+------------------------+-----------------------+

...

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

I think we could try to create two clock connection ids to the framebuffer device in the first place, e.g. "bus_ck", "pix_ck".
And then think about how handle that in the driver.

But this requires conversion to the omap-style clock registration method, something like in the attached patch. The patch is only for s5pv210 and and compile tested only as I didn't have any board to test it here. It's based on for-next branch at http://tinyurl.com/6yzravy I think there might be more issues to convert the old s3c24xx platforms, nevertheless the attached patch should not affect them.

...

Quoted 11 lines

when someone adds new board file with new SoC, he doesn't need to know this SoC chip has hclk and sclk_fimd or only sclk_fimd(such as exynos4). using implicit clock means it should know that this SoC chip has both clocks(bus clock, sclk_fimd) or only sclk_fimd.

for example, if any driver needs fimd clock frequency then this driver should know that this SoC chip is exynos4 or not and has both clock source(bus clock, soure clock fimd) or not(only source clock fimd) so I think we shoule see only a clock "lcd" regardless of which clock is used and if exynos4 then sclk_fimd would be set by machine code.

Quoted 3 lines

and Sylwester,
it appears that your patch has one issue about clk_get function call. your patch adds "bus_ck" to list head "clocks" of plat-samsung/clock.c

Why do you think so ? In fact the "clocks" list in plat-samsung/clock.c
is not used any more, AFAIU it should have been removed altogether with
clk_get/clk_put functions in Thomas' clkdev patches. When you comment out the line declaring the list everything compiles fine there.

Quoted 6 lines

and "pix_ck" to list head "clocks" of drivers/clk/clkdev.c and I am afraid that if some machine(such as s3c24xx, s3c64xx and s5pc1xx) has CLKDEV_LOOKUP configuration then clk_get() would fail to get clock object because in this case, clock lookup could be done through list head "clocks" of driver/clk/clkdev.c.(it's right from plat-samsung/clock.c) so I think it needs more patch for resolving this

As I indicated earlier the framebuffer driver would have to be modified to support newly introduced clock _connection_ names.
We could (temporarily) name one of those clock connections "lcd", to avoid additional trouble on SoCs that still use a one-to-one platform clock name <-> clock connection id mapping.

Quoted 2 lines

issue also and do you think it's a good way to use only one clock name "lcd"?... in fact, this might be so.... much slight issue. :)

Do you mean using using one name in the code for different clock names in the datasheets ? I suppose it was because of the API limitations and hope it will change for the better. :)

Cheers,
Sylwester