fbdev: mxsfb: Add support for mx6sl and mx6sx
Quoted 10 lines · Fabio Estevam
mx6sl and mx6sx share the same LCD controller as mx23 and mx28.
Add support for it.
The basic difference is the number of clocks that are required:
- mx23/mx28: only one clock
- mx6sl: two clocks
- mx6sx: three clocks
Quoted 7 lines
Tested on a mx28evk and mx6slevk.
Signed-off-by Fabio Estevam <[email protected]>---
I am sending it as RFC because the scrolling is showing some artifacts when I boot with console=tty0. The kernel messages are displayed correctly, but when it scrolls I see some garbage.
Is the garbage on the framebuffer memory? If so, I don't think this patch can cause it.
Quoted 44 lines
Appreciate any comment/suggestion to improve this.
drivers/video/fbdev/Kconfig | 2 +- drivers/video/fbdev/mxsfb.c | 47 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 1 deletion(-)drivers/video/fbdev/Kconfig +1
-1@@ -2420,7 +2420,7 @@ config FB_JZ4740 config FB_MXS tristate "MXS LCD framebuffer support" - depends on FB && ARCH_MXS + depends on FB && (ARCH_MXS || ARCH_MXC) select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLITdrivers/video/fbdev/mxsfb.c +10
-0@@ -172,6 +172,10 @@ struct mxsfb_info {struct fb_info fb_info;struct platform_device *pdev;struct clk *clk; +struct clk *clk_axi; +struct clk *clk_disp_axi; +bool clk_axi_enabled; +bool clk_disp_axi_enabled;void __iomem *base;/* registers */ unsigned allocated_size;int enabled;@@ -185,6 +189,42 @@ struct mxsfb_info {#define mxsfb_is_v3 (host) (host->devdata->ipversion == 3)#define mxsfb_is_v4 (host) (host->devdata->ipversion == 4) +/* Enable lcdif axi clock */ +static inline void clk_enable_axi (struct mxsfb_info *host) +{ +if (!host->clk_axi_enabled && (!IS_ERR (host->clk_axi))) { +clk_prepare_enable (host->clk_axi); + host->clk_axi_enabled = true;
drivers/video/fbdev/mxsfb.c struct mxsfb_info { · line 207
Quoted 10 lines
drivers/video/fbdev/mxsfb.c +10
-0+ } +} + +/* Disable lcdif axi clock */ +static inline void clk_disable_axi (struct mxsfb_info *host) +{ +if (host->clk_axi_enabled && (!IS_ERR (host->clk_axi))) { +clk_disable_unprepare (host->clk_axi); + host->clk_axi_enabled = false; + }
I think you could do the IS_ERR(clk_axi) check when getting the clock, and if there's an error, do host->clk_axi = NULL. Then above you can do just:
if (host->clk_axi)
clk_disable_unprepare(host->clk_axi);
And no need to clk_axi_enabled. And probably the helper functions can be left out and have the code inline.
And similarly for clk_disp_axi, of course.
Tomi