ARM: S5PV210: Add MIPI-DSI support.
Subsystems (5)
v2 cover ARM: S5PV210: Add MIPI-DSI support.
Hello all,
This patch is for MIPI-DSI controller based on S5PV210 (or S5PC110).
this version corrects some problems Ben pointed out.
v1 patch includes below contents.
- set callbacks to MIPI Client driver at mipi_ddi_platform_data declaration.
- use MIPI regulator names set at s5p_platform_dsim declaration to get regulators for them.
- use a table to get freq_band value.
- code clean and fix minor bugs.
v2 patch includes below contents.
- use generic header(include/video/mipi_display.h) for MIPI-DSI commands.
- remove lcd panel specific definitions from dsim.h.
LCD Panel can use following interfaces,
- RGB or CPU Interface.
- RGB or CPU Interface based on MIPI-DSI.
in case of cell phone device, small size lcd panel(less then 480x800) was ok only rgb or cpu interface not using mipi controller. but big size panel(bigger then 480x800) needs MIPI-DSI Interface or other hardwares like LVDS to transfer image data to lcd panel fine.
I tested this patch on cpu interface based on MIPI-DSI and also considered RGB interface.
This patch set consists of the following patches,
[PATCH v2 1/2] S5PV210: FB: Add MIPI-DSI and CPU Interface features. [PATCH v2 2/2] S5PV210: Add MIPI-DSI Driver.
Best regards,
InKi Dae
PATCH v2 1/2 S5PV210: FB: Add MIPI-DSI and CPU Interface features.
this patch adds features for supportting MIPI Interface and CPU mode to s3c-fb.c
for this, I added following features.
. add struct fb_cmdmode
- this structure would be used for cpu interface.
. add interface_mode to struct s3c_fb_platdata.
- this variable would be used to distinguishe whether CPU or RGB mode. . add two functions for cpu interface.
- s3c_fb_set_trigger would be used for to send trigger signal to FIMD.
- s3c_fb_is_i80_frame_done would be used to check framedone status. . add a function for setting timing.
- I added this function because it have to distinguishe interfaces. (CPU or RGB mode)
. add register definitions for using MIPI-DSI mode.
---
arch/arm/plat-samsung/include/plat/fb.h +26 -0
@@ -22,6 +22,23 @@*/ #define S3C_FB_MAX_WIN (5) +enum { +FIMD_VIDEO_MODE =0 , +FIMD_COMMAND_MODE +}; + +struct fb_cmdmode { +const char *name;/* optional */ +u32 refresh;/* optional */ +u32 xres; +u32 yres; +u32 pixclock; +u32 cs_setup; +u32 wr_setup; +u32 wr_act; +u32 wr_hold; +}; +/** * struct s3c_fb_pd_win - per window setup data * @win_mode: The display parameters to initialise (not for window 0)
@@ -30,6 +47,7 @@*/ struct s3c_fb_pd_win {struct fb_videomode win_mode; +struct fb_cmdmode cmd_mode;unsigned short default_bpp;unsigned short max_bpp;
@@ -42,6 +60,7 @@ struct s3c_fb_pd_win {* @setup_gpio: Setup the external GPIO pins to the right state to transfer * the data from the display system to the connected display * device. +* @interface_mode: cpu mode or rgb mode. * @vidcon0: The base vidcon0 values to control the panel data format. * @vidcon1: The base vidcon1 values to control the panel data output. * @win: The setup data for each hardware window, or NULL for unused.
@@ -57,6 +76,7 @@ struct s3c_fb_platdata {void (*setup_gpio)(void );struct s3c_fb_pd_win *win[S3C_FB_MAX_WIN ]; +u32 interface_mode;u32 vidcon0;u32 vidcon1;
@@ -91,4 +111,10 @@ extern void s5pc100_fb_gpio_setup_24bpp(void);*/ extern void s5pv210_fb_gpio_setup_24bpp (void ); +struct fb_info ; + +extern void s3c_fb_set_trigger (struct fb_info *info); + +extern int s3c_fb_is_i80_frame_done (struct fb_info *info); +#endif /* __PLAT_S3C_FB_H */
arch/arm/plat-samsung/include/plat/regs-fb-v4.h +16 -0
@@ -135,6 +135,22 @@#define WPALCON (0x1A0) +/* For CPU interface. */ +#define TRIGCON (0x1a4) +#define TRGMODE_I80_ENABLE (1 << 0) +#define SWTRGCMD_I80_TRIGGER (1 << 1) +#define SWFRSTATUS_I80 (1 << 2) + +#define I80IFCONA0 (0x1b0) +#define I80IFEN_ENABLE (1 << 0) +#define RSPOL_HIGH (1 << 2) +#define LCD_WR_HOLD (x) (((x) & 0xf) << 4) +#define LCD_WR_ACT (x) (((x) & 0xf) << 8) +#define LCD_WR_SETUP (x) (((x) & 0xf) << 12) +#define LCD_CS_SETUP (x) (((x) & 0xf) << 16) + +#define I80IFCONB0 (0x1b8) +/* Palette control */ /* Note for S5PC100: you can still use those macros on WPALCON (aka WPALCON_L), * but make sure that WPALCON_H W2PAL-W4PAL entries are zeroed out */
arch/arm/plat-samsung/include/plat/regs-fb.h +1 -0
@@ -38,6 +38,7 @@#define VIDCON0_VIDOUT_TV (0x1 << 26)#define VIDCON0_VIDOUT_I80_LDI0 (0x2 << 26)#define VIDCON0_VIDOUT_I80_LDI1 (0x3 << 26) +#define VIDCON0_DSI_EN_ENABLE (1 << 30)#define VIDCON0_L1_DATA_MASK (0x7 << 23)#define VIDCON0_L1_DATA_SHIFT (23)
drivers/video/s3c-fb.c +102 -25
167 lines not on this page · raw message
PATCH v2 2/2 S5PV210: Add MIPI-DSI Driver.
In reply to InKi Daethis patch addes MIPI-DSI Driver.
to use this driver, some structures below should be added to machine specific file.
struct dsim_config
- define clock info, data lane count and video mode info for MIPI-DSI Controller.
struct dsim_lcd_config
- define interface mode, channel ID, Pixel format and so on.
struct s5p_platform_dsim
- define callbacks for initializing D-PHY, MIPI reset and trigger releated interfaces of s3c-fb.c file.
struct mipi_ddi_platform_data
- define following callbacks.
- a function for transferring and receiving command data to mipi based lcd panel.
- a function for getting framedone status of mipi-dsi controller.
- a function for clearing framedone interrupt of mipi-dsi controller.
- a function for checking i80 framedone status of display controller.(fimd)
- a function for triggering to display controller.(fimd)
---
arch/arm/mach-s5pv210/include/mach/regs-clock.h +1 -0
@@ -162,6 +162,7 @@/* MIPI */ #define S5P_MIPI_DPHY_EN (3) +#define S5P_MIPI_M_RESETN (1 << 1)/* S5P_DAC_CONTROL */ #define S5P_DAC_ENABLE (1)
arch/arm/plat-samsung/Makefile +3 -0
@@ -50,6 +50,9 @@ obj-$(CONFIG_S3C_DEV_RTC) += dev-rtc.o obj-$(CONFIG_SAMSUNG_DEV_ADC) += dev-adc.o obj-$(CONFIG_SAMSUNG_DEV_TS) += dev-ts.o +# Device setup - MIPI-DSI +obj-$(CONFIG_S5P_MIPI_DSI) += setup-dsim.o + # DMA support obj-$(CONFIG_S3C_DMA) += dma.o
arch/arm/plat-samsung/include/plat/dsim.h new file +447 -0
447 lines not on this page · raw message
arch/arm/plat-samsung/include/plat/mipi_ddi.h new file +98 -0
98 lines not on this page · raw message
arch/arm/plat-samsung/include/plat/regs-dsim.h new file +281 -0
281 lines not on this page · raw message
arch/arm/plat-samsung/setup-dsim.c new file +144 -0
144 lines not on this page · raw message
drivers/video/Kconfig +8 -1
@@ -1938,7 +1938,7 @@ config FB_TMIO_ACCELL config FB_S3C tristate "Samsung S3C framebuffer support" - depends on FB && ARCH_S3C64XX + depends on FB && (ARCH_S3C64XX || ARCH_S5PV210) select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT
@@ -1983,6 +1983,13 @@ config FB_S3C2410_DEBUG Turn on debugging messages. Note that you can set/unset at run time through sysfs +config S5P_MIPI_DSI + tristate "Samsung SoC MIPI-DSI support." + depends on FB_S3C && ARCH_S5PV210 + default n + ---help--- + This enables support for MIPI-DSI device. + config FB_NUC900 bool "NUC900 LCD framebuffer support" depends on FB && ARCH_W90X900
drivers/video/Makefile +2 -0
@@ -115,6 +115,8 @@ obj-$(CONFIG_FB_SH7760) += sh7760fb.o obj-$(CONFIG_FB_IMX) += imxfb.o obj-$(CONFIG_FB_S3C) += s3c-fb.o obj-$(CONFIG_FB_S3C2410) += s3c2410fb.o +obj-$(CONFIG_S5P_MIPI_DSI) += s5p-dsim.o s5p_dsim_common.o \ + s5p_dsim_lowlevel.o obj-$(CONFIG_FB_FSL_DIU) += fsl-diu-fb.o obj-$(CONFIG_FB_COBALT) += cobalt_lcdfb.o obj-$(CONFIG_FB_PNX4008_DUM) += pnx4008/
drivers/video/s5p-dsim.c new file +471 -0
471 lines not on this page · raw message
drivers/video/s5p_dsim_common.c new file +691 -0
691 lines not on this page · raw message
drivers/video/s5p_dsim_common.h new file +35 -0
@@ -0,0 +1,35 @@ +/* linux/drivers/video/samsung/s5p_dsim_common.h +* +* Header file for Samsung MIPI-DSI common driver. +* +* Copyright (c) 2009 Samsung Electronics +* InKi Dae <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ + +#ifndef _S5P_DSIM_COMMON_H +#define _S5P_DSIM_COMMON_H + +extern int s5p_dsim_init_header_fifo (struct dsim_global *dsim); +extern int s5p_dsim_pll_on (struct dsim_global *dsim,unsigned int enable); +extern unsigned long s5p_dsim_change_pll (struct dsim_global *dsim, +unsigned int pre_divider,unsigned int main_divider, +unsigned int scaler); +extern int s5p_dsim_set_clock (struct dsim_global *dsim, +unsigned int byte_clk_sel,unsigned int enable); +extern int s5p_dsim_init_dsim (struct dsim_global *dsim); +extern int s5p_dsim_set_display_mode (struct dsim_global *dsim, +struct dsim_lcd_config *main_lcd,struct dsim_lcd_config *sub_lcd); +extern int s5p_dsim_init_link (struct dsim_global *dsim); +extern int s5p_dsim_set_hs_enable (struct dsim_global *dsim); +extern int s5p_dsim_set_data_transfer_mode (struct dsim_global *dsim, +unsigned int data_path,unsigned int hs_enable); +extern int s5p_dsim_enable_frame_done_int (struct dsim_global *dsim, +unsigned int enable); + +extern struct fb_info *registered_fb[FB_MAX ]__read_mostly ; + +#endif /* _S5P_DSIM_COMMON_H */
drivers/video/s5p_dsim_lowlevel.c new file +569 -0
569 lines not on this page · raw message
drivers/video/s5p_dsim_lowlevel.h new file +101 -0
101 lines not on this page · raw message
PATCH v2 1/2 S5PV210: FB: Add MIPI-DSI and CPU Interface features.
In reply to InKi DaeQuoted 16 lines · On Wed, 07 Jul 2010 15:39:35 +0900 InKi Dae wrote:
this patch adds features for supportting MIPI Interface and CPU mode to
s3c-fb.cfor this, I added following features.
. add structfb_cmdmode
- this structure would be used for cpu interface.
. addinterface_modeto structs3c_fb_platdata.
- this variable would be used to distinguishe whether CPU or RGB mode. . add two functions for cpu interface.
-s3c_fb_set_triggerwould be used for to send trigger signal to FIMD.
-s3c_fb_is_i80_frame_donewould be used to check framedone status. . add a function for setting timing.
- I added this function because it have to distinguishe interfaces. (CPU or RGB mode)
. add register definitions for using MIPI-DSI mode.
Quoted 2 lines
Signed-off-by InKi Dae <[email protected]>Signed-off-by Kyungmin Park <[email protected]>
Please include a diffstat summary so that reviewers can see what files are being changed/added/removed and how large the changes are.
See Documentation/SubmittingPatches for info.
drivers/video/s3c-fb.c static int s3c_fb_align_word(unsigned int bpp, unsigned int pix) · line 258
Quoted 9 lines
drivers/video/s3c-fb.c +1
-0@@ -255,6 +255,73 @@ static int s3c_fb_align_word(unsigned int bpp, unsigned int pix) }/** +* s3c_fb_set_trigger - fimd trigger based on cpu interface.
kernel-doc notation is missing the function argument line:
* @info: <description>
Quoted 7 lines
drivers/video/s3c-fb.c +7
-0+*/ +void s3c_fb_set_trigger (struct fb_info *info) +{ +struct s3c_fb_win *win = info->par; +struct s3c_fb *sfb = win->parent; +void __iomem *regs = sfb->regs; +u32 reg =0 ;
drivers/video/s3c-fb.c static int s3c_fb_align_word(unsigned int bpp, unsigned int pix) · line 275
Quoted 10 lines
drivers/video/s3c-fb.c +10
-0+ + reg =readl (regs +TRIGCON ); + + reg |=TRGMODE_I80_ENABLE |SWTRGCMD_I80_TRIGGER ; + +writel (reg, regs +TRIGCON ); +} + +/** +* s3c_fb_is_i80_frame_done - get i80 frame done status.
Ditto.
Quoted 5 lines
drivers/video/s3c-fb.c +5
-0+*/ +int s3c_fb_is_i80_frame_done (struct fb_info *info) +{ +struct s3c_fb_win *win = info->par; +struct s3c_fb *sfb = win->parent;
drivers/video/s3c-fb.c static int s3c_fb_align_word(unsigned int bpp, unsigned int pix) · line 290
Quoted 10 lines
drivers/video/s3c-fb.c +10
-0+void __iomem *regs = sfb->regs; +u32 reg =0 ; + + reg =readl (regs +TRIGCON ); + +return (((reg &SWFRSTATUS_I80 ) ==SWFRSTATUS_I80 ) ?1 :0 ); +} + +/** +* s3c_fb_set_cpu_timing - set cpu timing.
Ditto.
Quoted 27 lines
drivers/video/s3c-fb.c +27
-0+*/ +static void s3c_fb_set_timing (struct s3c_fb *sfb,struct fb_info *info) +{ +struct s3c_fb_win *win = info->par; +struct s3c_fb_pd_win *windata = win->windata; +struct fb_var_screeninfo *var = &info->var; +void __iomem *regs = sfb->regs; +u32 reg =0 ; + +if (sfb->pdata->interface_mode ==FIMD_VIDEO_MODE ) { + reg =VIDTCON0_VBPD (var->upper_margin -1 ) | +VIDTCON0_VFPD (var->lower_margin -1 ) | +VIDTCON0_VSPW (var->vsync_len -1 ); + +writel (reg, regs +VIDTCON0 ); + + reg =VIDTCON1_HBPD (var->left_margin -1 ) | +VIDTCON1_HFPD (var->right_margin -1 ) | +VIDTCON1_HSPW (var->hsync_len -1 ); + +writel (reg, regs +VIDTCON1 ); + }else if (sfb->pdata->interface_mode ==FIMD_COMMAND_MODE ) { + reg =LCD_CS_SETUP (windata->cmd_mode.cs_setup) | +LCD_WR_SETUP (windata->cmd_mode.wr_setup) | +LCD_WR_ACT (windata->cmd_mode.wr_act) | +LCD_WR_HOLD (windata->cmd_mode.wr_hold) | +I80IFEN_ENABLE ;
drivers/video/s3c-fb.c static int s3c_fb_align_word(unsigned int bpp, unsigned int pix) · line 327
Quoted 10 lines
drivers/video/s3c-fb.c +7
-0+ +writel (reg, regs +I80IFCONA0 ); + }else +dev_warn (sfb->dev,"wrong interface type.\n" ); +} + +/** * s3c_fb_set_par() - framebuffer request to set new framebuffer state. * @info: The framebuffer to change. *
---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***