From mboxrd@z Thu Jan 1 00:00:00 1970 From: Shaik Ameer Basha Date: Sat, 10 Nov 2012 11:46:45 +0000 Subject: [PATCH 2/2] video: exynos-mipi-dsi: Adding DT support to exynos mipi driver Message-Id: <1352547285-12302-3-git-send-email-shaik.ameer@samsung.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-fbdev@vger.kernel.org This patch adds the DT support for the exynos mipi-dsi driver. for DT support mipi device node should supply the following information to the mipi-dsi driver. 1] dsim_config information 2] d-phy setting information 3] lcd poweron, reset information 4] fb_videomode information Change-Id: I93005636a7825b0c5ef4832dd17a2809d0aeda1d Signed-off-by: Shaik Ameer Basha --- .../devicetree/bindings/video/exynos/mipi-dsi.txt | 185 +++++++ drivers/video/exynos/exynos_mipi_dsi.c | 573 +++++++++++++++++++- include/video/exynos_mipi_dsim.h | 27 + 3 files changed, 765 insertions(+), 20 deletions(-) create mode 100644 Documentation/devicetree/bindings/video/exynos/mipi-dsi.txt diff --git a/Documentation/devicetree/bindings/video/exynos/mipi-dsi.txt b/Documentation/devicetree/bindings/video/exynos/mipi-dsi.txt new file mode 100644 index 0000000..6445eac --- /dev/null +++ b/Documentation/devicetree/bindings/video/exynos/mipi-dsi.txt @@ -0,0 +1,185 @@ +* Samsung Exynos MIPI-DSI bindings + +Properties for MIPI-DSI node :: +===============+- compatible: should be "samsung,exynos5-mipi" + +- reg: should contain mipi-dsi physical address location and length. + +- interrupts: should contain mipi-dsi interrupt number + +- enabled: Describes whether MIPI DSI got enabled in uboot + +- mipi-lcd: phandle to lcd specific information. It can be anything + specific to lcd driver. + +- mipi-phy: phandle to D-PHY node. + +- mipi-config: subnode for mipi config information + - auto_flush: enable or disable Auto flush of MD FIFO using VSYNC pulse + - eot_disable: enable or disable EoT packet in HS mode + - auto_vertical_cnt: specifies auto vertical count mode. + In Video mode, the vertical line transition uses line counter + configured by VSA, VBP, and Vertical resolution. If this bit is + set to '1', the line counter does not use VSA and VBP registers. + In command mode, this property is ignored. + - hse: set horizontal sync event mode. + In VSYNC pulse and Vporch area, MIPI DSI master transfers only + HSYNC start packet to MIPI DSI slave at MIPI DSI spec1.1r02. + This bit transfers HSYNC end packet in VSYNC pulse and Vporch + area. In command mode, this property is ignored. + - hfp: specifies HFP disable mode. + If this property is set, DSI master ignores HFP area in + VIDEO mode. In command mode, this property is ignored. + - hbp: specifies HBP disable mode. + If this property is set, DSI master ignores HBP area in + VIDEO mode. In command mode, this property is ignored. + - hsa: specifies HSA disable mode. + If this property is set, DSI master ignores HSA area in + VIDEO mode. In command mode, this property is ignored. + - cmd_allow: specifies the number of horizontal lines, where command + packet transmission is allowed after Stable VFP period. + - e_interface: specifies interface to be used.(CPU or RGB interface) + - e_virtual_ch: specifies virtual channel number that main or + sub display uses. + - e_pixel_format: specifies pixel stream format for main or sub display. + - e_burst_mode: selects Burst mode in Video mode. + In Non-burst mode, RGB data area is filled with RGB data + and NULL packets, according to input bandwidth of RGB interface. + In Burst mode, RGB data area is filled with RGB data only. + - e_no_data_lane: specifies data lane count to be used by Master. + - e_byte_clk: select byte clock source. (it must be DSIM_PLL_OUT_DIV8) + DSIM_EXT_CLK_DIV8 and DSIM_EXT_CLK_BYPASSS are not supported. + - pll_stable_time: specifies the PLL Timer for stability of the + generated clock(System clock cycle base). If the timer value + goes to 0x00000000, the clock stable bit of status and interrupt + register is set. + - esc_clk: specifies escape clock frequency for getting the escape clock + prescaler value. + - stop_holding_cnt: specifies the interval value between transmitting + read packet(or write "set_tear_on" command) and BTA request. + after transmitting read packet or write "set_tear_on" command, + BTA requests to D-PHY automatically. this counter value + specifies the interval between them. + - bta_timeout: specifies the timer for BTA. + this register specifies time out from BTA request to change + the direction with respect to Tx escape clock. + - rx_timeout: specifies the timer for LP Rx mode timeout. + this register specifies time out on how long RxValid deasserts, + after RxLpdt asserts with respect to Tx escape clock. + - RxValid specifies Rx data valid indicator. + - RxLpdt specifies an indicator that D-PHY is under RxLpdt mode. + - RxValid and RxLpdt specifies signal from D-PHY. + +- display-mode: timing and resolution information of the panel used. As per + current exynos mipi-dsi driver need, only some fields from + struct fb_videomode are defined in this node. + - xres: horizontal resolution (active frame width) + - yres: vertical resolution (active frame height). + - left_margin: Horizontal Back Porch (Number of PIXCLK pulses between + HSYNC signal and the first valid pixel data. + - right_margin: Horizontal Front Porch (Number of PIXCLK between + last valid pixel data in the line and the next HSYNC pulse). + - upper_margin: Vertical Back Porch (Number of lines (HSYNC pulses) + from when a VSYNC signal is asserted and the first valid line). + - lower_margin: Vertical Front Porch (Number of lines (HSYNC pulses) + between last valid line of the frame and the next VSYNC Pulse). + - hsync_len: Hsync pulse width (Number of PIXCLK pulses when a HSYNC + signal is active). + - vsync_len: Vsync pulse width (Number of HSYNC pulses when a VSYNC + signal is active). + +Properties for D-PHY node :: +==============+ Instead of passing D-PHY related callbacks as part of platform data, +we can pass the phy nodes to the mipi driver. Depending on the type of PHY +settings, we can implement multiple PHY node types and corresponding +enable/disable/reset callbacks in the driver itself. Currently we support +only one type of PHY node. + +D-PHY node type1: +------------------ +- compatible: "samsung,exynos-mipi-phy-type1" +- reg_enable_dphy: should contain physical address location of + D-PHY enable register +- mask_enable_dphy: should contain the mask for D-PHY enable register +- reg_reset_dsim: should contain physical address location of + D-PHY DSIM reset register +- mask_reset_dsim: should contain the mask for D-PHY DSIM reset register + +MIPI-LCD node :: +========+ Apart from the following three properties, driver specific +properties can be sent through this node. The following example sends +some more properties for driver's use. + +- lcd-name: name of the device to use with this device +- id: id of device to be registered (default -1 in case not specified) +- bus-id: bus id for identifing connected bus and this bus id should be + same as id of mipi_dsim_device (default -1 incase not specified) + +Example: +-------- + mipi_lcd: mipi-lcd@toshiba { + lcd-name = "tc358764"; + id = <0>; + enabled = <1>; + reset-delay = <120>; + power-on-delay = <25>; + power-off-delay = <200>; + gpio-poweron = <&gpx1 5 0 0 0>; + }; + + mipi_dsim_phy: mipi-phy@exynos5250 { + compatible = "samsung-exynos,mipi-phy-type1"; + reg_enable_dphy = <0x10040714>; + mask_enable_dphy = <0x00000001>; + reg_reset_dsim = <0x10040714>; + mask_reset_dsim = <0x00000004>; + }; + + mipi { + compatible = "samsung,exynos-mipi"; + reg = <0x14500000 0x10000>; + interrupts = <0 82 0>; + + mipi-lcd = <&mipi_lcd>; + mipi-phy = <&mipi_dsim_phy>; + enabled = <0>; + + mipi-config { + e_interface = <1>; + e_pixel_format = <7>; + auto_flush = <0>; + eot_disable = <0>; + auto_vertical_cnt = <0>; + hse = <0>; + hfp = <0>; + hbp = <0>; + hsa = <0>; + e_no_data_lane = <3>; + e_byte_clk = <0>; + e_burst_mode = <3>; + p = <3>; + m = <115>; + s = <1>; + pll_stable_time = <500>; + esc_clk = <400000>; + stop_holding_cnt =<0x0f>; + bta_timeout = <0xff>; + rx_timeout = <0xffff>; + e_virtual_ch = <0>; + cmd_allow = <0xf>; + }; + + panel-info { + left_margin = <0x4>; + right_margin = <0x4>; + upper_margin = <0x4>; + lower_margin = <0x4>; + hsync_len = <0x4>; + vsync_len = <0x4>; + xres = <1280>; + yres = <800>; + }; + }; diff --git a/drivers/video/exynos/exynos_mipi_dsi.c b/drivers/video/exynos/exynos_mipi_dsi.c index ae20bc3..667857b 100755 --- a/drivers/video/exynos/exynos_mipi_dsi.c +++ b/drivers/video/exynos/exynos_mipi_dsi.c @@ -32,6 +32,7 @@ #include #include #include +#include #include