]> git.sur5r.net Git - u-boot/commitdiff
video:mipidsim:fdt: Add DT support for mipi dsim driver
authorPiotr Wilczek <p.wilczek@samsung.com>
Fri, 7 Mar 2014 13:59:39 +0000 (14:59 +0100)
committerMinkyu Kang <mk7.kang@samsung.com>
Wed, 12 Mar 2014 10:54:59 +0000 (19:54 +0900)
This patch enables parsing mipi data from device tree.
Non device tree case is still supported.

Signed-off-by: Piotr Wilczek <p.wilczek@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
arch/arm/include/asm/arch-exynos/mipi_dsim.h
doc/device-tree-bindings/video/exynos_mipi_dsi.txt [new file with mode: 0644]
drivers/video/exynos_mipi_dsi.c
include/fdtdec.h
lib/fdtdec.c

index 40aca716789ca1f97a0730027878e83e9f10c5c1..50e5c258a930997d9a975238bbeb1cfb49f6d392 100644 (file)
@@ -12,6 +12,7 @@
 
 #include <linux/list.h>
 #include <linux/fb.h>
+#include <lcd.h>
 
 #define PANEL_NAME_SIZE                (32)
 
@@ -368,8 +369,12 @@ int exynos_mipi_dsi_register_lcd_device(struct mipi_dsim_lcd_device
                                                *lcd_dev);
 
 void exynos_set_dsim_platform_data(struct exynos_platform_mipi_dsim *pd);
+void exynos_init_dsim_platform_data(vidinfo_t *vid);
 
 /* panel driver init based on mipi dsi interface */
 void s6e8ax0_init(void);
 
+#ifdef CONFIG_OF_CONTROL
+extern int mipi_power(void);
+#endif
 #endif /* _DSIM_H */
diff --git a/doc/device-tree-bindings/video/exynos_mipi_dsi.txt b/doc/device-tree-bindings/video/exynos_mipi_dsi.txt
new file mode 100644 (file)
index 0000000..4938ea0
--- /dev/null
@@ -0,0 +1,82 @@
+Exynos MIPI-DSIM Controller
+=========================
+
+Required properties:
+SOC specific:
+       compatible: should be "samsung,exynos-mipi-dsi"
+       reg: Base address of MIPI-DSIM IP.
+
+Board specific:
+       samsung,dsim-config-e-interface: interface to be used (RGB interface
+               for main display or CPU interface for main or sub display).
+       samsung,dsim-config-e-virtual-ch: virtual channel number that main
+               or sub display uses.
+       samsung,dsim-config-e-pixel-format: pixel stream format for main
+               or sub display.
+       samsung,dsim-config-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.
+       samsung,dsim-config-e-no-data-lane: data lane count used by Master.
+       samsung,dsim-config-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.
+       samsung,dsim-config-hfp: HFP disable mode.
+               If set, DSI master ignores HFP area in VIDEO mode.
+               In command mode, this variable is ignored.
+       samsung,dsim-config-p: P value for PMS setting.
+       samsung,dsim-config-m: M value for PMS setting.
+       samsung,dsim-config-s: S value for PMS setting.
+       samsung,dsim-config-pll-stable-time: the PLL Timer for stability
+               of the ganerated clock.
+       samsung,dsim-config-esc-clk: escape clock frequency for getting
+               the escape clock prescaler value.
+       samsung,dsim-config-stop-holding-cnt: 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.
+       samsung,dsim-config-bta-timeout: the timer for BTA. This register
+               specifies time out from BTA request to change the direction
+               with respect to Tx escape clock.
+       samsung,dsim-config-rx-timeout: 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.
+       samsung,dsim-device-name: name of the device.
+       samsung,dsim-device-id: unique device id.
+       samsung,dsim-device-bus_id: bus id for identifing connected bus
+               and this bus id should be same as id of mipi_dsim_device.
+
+Optional properties:
+       samsung,dsim-device-reverse-panel: reverse panel.
+
+Example:
+       mipidsi@11c80000 {
+               compatible = "samsung,exynos-mipi-dsi";
+               reg = <0x11c80000 0x5c>;
+
+               samsung,dsim-config-e-interface = <1>;
+               samsung,dsim-config-e-virtual-ch = <0>;
+               samsung,dsim-config-e-pixel-format = <7>;
+               samsung,dsim-config-e-burst-mode = <1>;
+               samsung,dsim-config-e-no-data-lane = <3>;
+               samsung,dsim-config-e-byte-clk = <0>;
+               samsung,dsim-config-hfp = <1>;
+
+               samsung,dsim-config-p = <3>;
+               samsung,dsim-config-m = <120>;
+               samsung,dsim-config-s = <1>;
+
+               samsung,dsim-config-pll-stable-time = <500>;
+               samsung,dsim-config-esc-clk = <20000000>;
+               samsung,dsim-config-stop-holding-cnt = <0x7ff>;
+               samsung,dsim-config-bta-timeout = <0xff>;
+               samsung,dsim-config-rx-timeout = <0xffff>;
+
+               samsung,dsim-device-id = <0xffffffff>;
+               samsung,dsim-device-bus-id = <0>;
+
+               samsung,dsim-device-reverse-panel = <1>;
+       };
index 8bb8feaa9cb23584a20eb60ddc711802f7be3c21..7dd46529311acf3a1ded42702ccbd94137e49d4a 100644 (file)
@@ -9,6 +9,8 @@
 
 #include <common.h>
 #include <malloc.h>
+#include <fdtdec.h>
+#include <libfdt.h>
 #include <linux/err.h>
 #include <asm/arch/dsim.h>
 #include <asm/arch/mipi_dsim.h>
 #define master_to_driver(a)    (a->dsim_lcd_drv)
 #define master_to_device(a)    (a->dsim_lcd_dev)
 
+DECLARE_GLOBAL_DATA_PTR;
+
 static struct exynos_platform_mipi_dsim *dsim_pd;
+#ifdef CONFIG_OF_CONTROL
+static struct mipi_dsim_config dsim_config_dt;
+static struct exynos_platform_mipi_dsim dsim_platform_data_dt;
+static struct mipi_dsim_lcd_device mipi_lcd_device_dt;
+#endif
 
 struct mipi_dsim_ddi {
        int                             bus_id;
@@ -238,3 +247,90 @@ void exynos_set_dsim_platform_data(struct exynos_platform_mipi_dsim *pd)
 
        dsim_pd = pd;
 }
+
+#ifdef CONFIG_OF_CONTROL
+int exynos_dsim_config_parse_dt(const void *blob)
+{
+       int node;
+
+       node = fdtdec_next_compatible(blob, 0, COMPAT_SAMSUNG_EXYNOS_MIPI_DSI);
+       if (node <= 0) {
+               printf("exynos_mipi_dsi: Can't get device node for mipi dsi\n");
+               return -ENODEV;
+       }
+
+       dsim_config_dt.e_interface = fdtdec_get_int(blob, node,
+                               "samsung,dsim-config-e-interface", 0);
+
+       dsim_config_dt.e_virtual_ch = fdtdec_get_int(blob, node,
+                               "samsung,dsim-config-e-virtual-ch", 0);
+
+       dsim_config_dt.e_pixel_format = fdtdec_get_int(blob, node,
+                               "samsung,dsim-config-e-pixel-format", 0);
+
+       dsim_config_dt.e_burst_mode = fdtdec_get_int(blob, node,
+                               "samsung,dsim-config-e-burst-mode", 0);
+
+       dsim_config_dt.e_no_data_lane = fdtdec_get_int(blob, node,
+                               "samsung,dsim-config-e-no-data-lane", 0);
+
+       dsim_config_dt.e_byte_clk = fdtdec_get_int(blob, node,
+                               "samsung,dsim-config-e-byte-clk", 0);
+
+       dsim_config_dt.hfp = fdtdec_get_int(blob, node,
+                               "samsung,dsim-config-hfp", 0);
+
+       dsim_config_dt.p = fdtdec_get_int(blob, node,
+                                         "samsung,dsim-config-p", 0);
+       dsim_config_dt.m = fdtdec_get_int(blob, node,
+                                         "samsung,dsim-config-m", 0);
+       dsim_config_dt.s = fdtdec_get_int(blob, node,
+                                         "samsung,dsim-config-s", 0);
+
+       dsim_config_dt.pll_stable_time = fdtdec_get_int(blob, node,
+                               "samsung,dsim-config-pll-stable-time", 0);
+
+       dsim_config_dt.esc_clk = fdtdec_get_int(blob, node,
+                               "samsung,dsim-config-esc-clk", 0);
+
+       dsim_config_dt.stop_holding_cnt = fdtdec_get_int(blob, node,
+                               "samsung,dsim-config-stop-holding-cnt", 0);
+
+       dsim_config_dt.bta_timeout = fdtdec_get_int(blob, node,
+                               "samsung,dsim-config-bta-timeout", 0);
+
+       dsim_config_dt.rx_timeout = fdtdec_get_int(blob, node,
+                               "samsung,dsim-config-rx-timeout", 0);
+
+       mipi_lcd_device_dt.name = fdtdec_get_config_string(blob,
+                               "samsung,dsim-device-name");
+
+       mipi_lcd_device_dt.id = fdtdec_get_int(blob, node,
+                               "samsung,dsim-device-id", 0);
+
+       mipi_lcd_device_dt.bus_id = fdtdec_get_int(blob, node,
+                               "samsung,dsim-device-bus_id", 0);
+
+       mipi_lcd_device_dt.reverse_panel = fdtdec_get_int(blob, node,
+                               "samsung,dsim-device-reverse-panel", 0);
+
+       return 0;
+}
+
+void exynos_init_dsim_platform_data(vidinfo_t *vid)
+{
+       if (exynos_dsim_config_parse_dt(gd->fdt_blob))
+               debug("Can't get proper dsim config.\n");
+
+       strcpy(dsim_platform_data_dt.lcd_panel_name, mipi_lcd_device_dt.name);
+       dsim_platform_data_dt.dsim_config = &dsim_config_dt;
+       dsim_platform_data_dt.mipi_power = mipi_power;
+       dsim_platform_data_dt.phy_enable = set_mipi_phy_ctrl;
+       dsim_platform_data_dt.lcd_panel_info = (void *)vid;
+
+       mipi_lcd_device_dt.platform_data = (void *)&dsim_platform_data_dt;
+       exynos_mipi_dsi_register_lcd_device(&mipi_lcd_device_dt);
+
+       dsim_pd = &dsim_platform_data_dt;
+}
+#endif
index 19bab7944817bfb382a0423126f2eaf9bcde8fe7..bd84c832a0b006037c6c881847a49e9604c4bcdf 100644 (file)
@@ -79,6 +79,7 @@ enum fdt_compat_id {
        COMPAT_SAMSUNG_EXYNOS5_USB3_PHY,/* Exynos phy controller for usb3.0 */
        COMPAT_SAMSUNG_EXYNOS_TMU,      /* Exynos TMU */
        COMPAT_SAMSUNG_EXYNOS_FIMD,     /* Exynos Display controller */
+       COMPAT_SAMSUNG_EXYNOS_MIPI_DSI, /* Exynos mipi dsi */
        COMPAT_SAMSUNG_EXYNOS5_DP,      /* Exynos Display port controller */
        COMPAT_SAMSUNG_EXYNOS5_DWMMC,   /* Exynos5 DWMMC controller */
        COMPAT_SAMSUNG_EXYNOS_SERIAL,   /* Exynos UART */
index 1fecab3fbc3090717db105c5e7415fd235327ab4..c97fad3076c52e89fd32d39073b4a80536aa534b 100644 (file)
@@ -52,6 +52,7 @@ static const char * const compat_names[COMPAT_COUNT] = {
        COMPAT(SAMSUNG_EXYNOS5_USB3_PHY, "samsung,exynos5250-usb3-phy"),
        COMPAT(SAMSUNG_EXYNOS_TMU, "samsung,exynos-tmu"),
        COMPAT(SAMSUNG_EXYNOS_FIMD, "samsung,exynos-fimd"),
+       COMPAT(SAMSUNG_EXYNOS_MIPI_DSI, "samsung,exynos-mipi-dsi"),
        COMPAT(SAMSUNG_EXYNOS5_DP, "samsung,exynos5-dp"),
        COMPAT(SAMSUNG_EXYNOS5_DWMMC, "samsung,exynos5250-dwmmc"),
        COMPAT(SAMSUNG_EXYNOS_SERIAL, "samsung,exynos4210-uart"),