clk: mxs: source LCD clock from PLL instead of from ref_xtal
Subsystems (2)
PATCH 1/1 clk: mxs: source LCD clock from PLL instead of from ref_xtal
The lcd clock hierarchy is as follows:
ref_clk (24MHz)-----\
+--+ lcdif_sel (MUX type)
frac1_clk (480Mhz)--/ |
\--+ lcdif_div (DIV type)
|
\-- lcdif (GATE type)The mxsfb driver retrieves the 'lcdif_div' clock from the DT, but the 'lcdif_sel' is by default sourced from 'ref_clk' which is a fixed 24MHz. This means the pixel clock can only be 24MHz or a power-of-two divisor of that frequency (12, 6, 3...) which is a very poor divisor granularity.
Since the driver doesn't know about the different clocks that can source its clk parent from, we must select the PLL (480MHz) to be the parent during the general clocks initialization. This allows for much better divisor granularity and for more accurate frequencies for LCD displays.
--- drivers/clk/mxs/clk-imx28.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/clk/mxs/clk-imx28.c +6 -0
@@ -246,6 +246,12 @@ int __init mx28_clocks_init(void) clk_data.clk_num =ARRAY_SIZE (clks);of_clk_add_provider (np, of_clk_src_onecell_get, &clk_data); +/* +* Select PLL as the parent source of lcdif_sel clk to have a finer +* granularity when calculating the LCD pixelclock +*/ +clk_set_parent (clks[lcdif_sel], clks[ref_pix]); +clk_register_clkdev (clks[enet_out],NULL ,"enet_out" );for (i =0 ; i <ARRAY_SIZE (clks_init_on); i++)
Fabio Estevam
reviewerPATCH 1/1 clk: mxs: source LCD clock from PLL instead of from ref_xtal
Quoted 20 lines · Hector Palacios
The lcd clock hierarchy is as follows:
ref_clk (24MHz)-----\ +--+ lcdif_sel (MUX type) frac1_clk (480Mhz)--/ | \--+ lcdif_div (DIV type) | \-- lcdif (GATE type)The mxsfb driver retrieves the '
lcdif_div' clock from the DT, but the 'lcdif_sel' is by default sourced from 'ref_clk' which is a fixed 24MHz. This means the pixel clock can only be 24MHz or a power-of-two divisor of that frequency (12, 6, 3...) which is a very poor divisor granularity.Since the driver doesn't know about the different clocks that can source its clk parent from, we must select the PLL (480MHz) to be the parent during the general clocks initialization. This allows for much better divisor granularity and for more accurate frequencies for LCD displays.
Quoted 6 lines
Signed-off-by Hector Palacios <[email protected]>Tested-by Fabio Estevam <[email protected]>CC Maxime Rippard <[email protected]>CC Marek Vasut <[email protected]>CC Alexandre Belloni <[email protected]>CC Gwenhael Goavec-Merou <[email protected]>
You added a lot of people on Cc, but you missed the clk maintaner (Mike Turquette) :-)
PATCH 1/1 clk: mxs: source LCD clock from PLL instead of from ref_xtal
In reply to Hector PalaciosCopy Mike who will help apply the patch.
Quoted 20 lines · Hector Palacios
The lcd clock hierarchy is as follows:
ref_clk (24MHz)-----\ +--+ lcdif_sel (MUX type) frac1_clk (480Mhz)--/ | \--+ lcdif_div (DIV type) | \-- lcdif (GATE type)The mxsfb driver retrieves the '
lcdif_div' clock from the DT, but the 'lcdif_sel' is by default sourced from 'ref_clk' which is a fixed 24MHz. This means the pixel clock can only be 24MHz or a power-of-two divisor of that frequency (12, 6, 3...) which is a very poor divisor granularity.Since the driver doesn't know about the different clocks that can source its clk parent from, we must select the PLL (480MHz) to be the parent during the general clocks initialization. This allows for much better divisor granularity and for more accurate frequencies for LCD displays.
Quoted 6 lines
Signed-off-by Hector Palacios <[email protected]>Tested-by Fabio Estevam <[email protected]>CC Maxime Rippard <[email protected]>CC Marek Vasut <[email protected]>CC Alexandre Belloni <[email protected]>CC Gwenhael Goavec-Merou <[email protected]>
Quoted 21 lines
--- drivers/clk/mxs/clk-imx28.c | 6 ++++++ 1 file changed, 6 insertions(+)drivers/clk/mxs/clk-imx28.c +6
-0@@ -246,6 +246,12 @@ int __init mx28_clocks_init(void) clk_data.clk_num =ARRAY_SIZE (clks);of_clk_add_provider (np, of_clk_src_onecell_get, &clk_data); +/* +* Select PLL as the parent source of lcdif_sel clk to have a finer +* granularity when calculating the LCD pixelclock +*/ +clk_set_parent (clks[lcdif_sel], clks[ref_pix]); +clk_register_clkdev (clks[enet_out],NULL ,"enet_out" );for (i =0 ; i <ARRAY_SIZE (clks_init_on); i++)
PATCH 1/1 clk: mxs: source LCD clock from PLL instead of from ref_xtal
In reply to Hector PalaciosDear Hector Palacios,
Quoted 37 lines
The lcd clock hierarchy is as follows:
ref_clk (24MHz)-----\ +--+ lcdif_sel (MUX type) frac1_clk (480Mhz)--/ | \--+ lcdif_div (DIV type) \-- lcdif (GATE type)The mxsfb driver retrieves the '
lcdif_div' clock from the DT, but the 'lcdif_sel' is by default sourced from 'ref_clk' which is a fixed 24MHz. This means the pixel clock can only be 24MHz or a power-of-two divisor of that frequency (12, 6, 3...) which is a very poor divisor granularity.Since the driver doesn't know about the different clocks that can source its clk parent from, we must select the PLL (480MHz) to be the parent during the general clocks initialization. This allows for much better divisor granularity and for more accurate frequencies for LCD displays.
Signed-off-by Hector Palacios <[email protected]>Tested-by Fabio Estevam <[email protected]>CC Maxime Rippard <[email protected]>CC Marek Vasut <[email protected]>CC Alexandre Belloni <[email protected]>CC Gwenhael Goavec-Merou <[email protected]>--- drivers/clk/mxs/clk-imx28.c | 6 ++++++ 1 file changed, 6 insertions(+)drivers/clk/mxs/clk-imx28.c +0
-0@@ -246,6 +246,12 @@ int __init mx28_clocks_init(void) clk_data.clk_num =ARRAY_SIZE (clks);of_clk_add_provider (np, of_clk_src_onecell_get, &clk_data);
drivers/clk/mxs/clk-imx28.c int __init mx28_clocks_init(void) · line 257
Quoted 10 lines
drivers/clk/mxs/clk-imx28.c +6
-0+/* +* Select PLL as the parent source of lcdif_sel clk to have a finer +* granularity when calculating the LCD pixelclock +*/ +clk_set_parent (clks[lcdif_sel], clks[ref_pix]); +clk_register_clkdev (clks[enet_out],NULL ,"enet_out" );for (i =0 ; i <ARRAY_SIZE (clks_init_on); i++)
On M28EVK:
Best regards,
Marek Vasut