]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
exynos: video: change mipi dsi write function parameters correctly
authorDonghwa Lee <dh09.lee@samsung.com>
Mon, 5 Aug 2013 04:34:32 +0000 (13:34 +0900)
committerAnatolij Gustschin <agust@denx.de>
Mon, 12 Aug 2013 20:39:07 +0000 (22:39 +0200)
This patch have changed mipi dsi write functions' parameters correctly
so that type cast operations were removed. And mipi dsi payload is
composed with array of panel commands to improve readability.

Signed-off-by: Donghwa Lee <dh09.lee@samsung.com>
arch/arm/include/asm/arch-exynos/mipi_dsim.h
drivers/video/exynos_mipi_dsi_common.c
drivers/video/exynos_mipi_dsi_common.h
drivers/video/exynos_mipi_dsi_lowlevel.c
drivers/video/exynos_mipi_dsi_lowlevel.h
drivers/video/s6e8ax0.c

index 8916d9d16bc005e590eca90a62f9074030f062a7..498a9ffc049aaa2b04c71c5243bff82e21b32664 100644 (file)
@@ -291,7 +291,7 @@ struct exynos_platform_mipi_dsim {
  */
 struct mipi_dsim_master_ops {
        int (*cmd_write)(struct mipi_dsim_device *dsim, unsigned int data_id,
-               unsigned int data0, unsigned int data1);
+               const unsigned char *data0, unsigned int data1);
        int (*cmd_read)(struct mipi_dsim_device *dsim, unsigned int data_id,
                unsigned int data0, unsigned int data1);
        int (*get_dsim_frame_done)(struct mipi_dsim_device *dsim);
index 2cc847f6e12869e3e270e3f3765e07baaafb56ac..97e12484fd126d473f0774dbf9b8ff31c81af839 100644 (file)
@@ -50,7 +50,7 @@ static unsigned int dpll_table[15] = {
 };
 
 static void exynos_mipi_dsi_long_data_wr(struct mipi_dsim_device *dsim,
-               unsigned int data0, unsigned int data1)
+               const unsigned char *data0, unsigned int data1)
 {
        unsigned int data_cnt = 0, payload = 0;
 
@@ -62,42 +62,40 @@ static void exynos_mipi_dsi_long_data_wr(struct mipi_dsim_device *dsim,
                 */
                if ((data1 - data_cnt) < 4) {
                        if ((data1 - data_cnt) == 3) {
-                               payload = *(u8 *)(data0 + data_cnt) |
-                                       (*(u8 *)(data0 + (data_cnt + 1))) << 8 |
-                                       (*(u8 *)(data0 + (data_cnt + 2))) << 16;
+                               payload = data0[data_cnt] |
+                                       data0[data_cnt + 1] << 8 |
+                                       data0[data_cnt + 2] << 16;
                        debug("count = 3 payload = %x, %x %x %x\n",
-                               payload, *(u8 *)(data0 + data_cnt),
-                               *(u8 *)(data0 + (data_cnt + 1)),
-                               *(u8 *)(data0 + (data_cnt + 2)));
+                               payload, data0[data_cnt],
+                               data0[data_cnt + 1],
+                               data0[data_cnt + 2]);
                        } else if ((data1 - data_cnt) == 2) {
-                               payload = *(u8 *)(data0 + data_cnt) |
-                                       (*(u8 *)(data0 + (data_cnt + 1))) << 8;
+                               payload = data0[data_cnt] |
+                                       data0[data_cnt + 1] << 8;
                        debug("count = 2 payload = %x, %x %x\n", payload,
-                               *(u8 *)(data0 + data_cnt),
-                               *(u8 *)(data0 + (data_cnt + 1)));
+                               data0[data_cnt], data0[data_cnt + 1]);
                        } else if ((data1 - data_cnt) == 1) {
-                               payload = *(u8 *)(data0 + data_cnt);
+                               payload = data0[data_cnt];
                        }
                } else {
                        /* send 4bytes per one time. */
-                       payload = *(u8 *)(data0 + data_cnt) |
-                               (*(u8 *)(data0 + (data_cnt + 1))) << 8 |
-                               (*(u8 *)(data0 + (data_cnt + 2))) << 16 |
-                               (*(u8 *)(data0 + (data_cnt + 3))) << 24;
+                       payload = data0[data_cnt] |
+                               data0[data_cnt + 1] << 8 |
+                               data0[data_cnt + 2] << 16 |
+                               data0[data_cnt + 3] << 24;
 
                        debug("count = 4 payload = %x, %x %x %x %x\n",
                                payload, *(u8 *)(data0 + data_cnt),
-                               *(u8 *)(data0 + (data_cnt + 1)),
-                               *(u8 *)(data0 + (data_cnt + 2)),
-                               *(u8 *)(data0 + (data_cnt + 3)));
-
+                               data0[data_cnt + 1],
+                               data0[data_cnt + 2],
+                               data0[data_cnt + 3]);
                }
                exynos_mipi_dsi_wr_tx_data(dsim, payload);
        }
 }
 
 int exynos_mipi_dsi_wr_data(struct mipi_dsim_device *dsim, unsigned int data_id,
-       unsigned int data0, unsigned int data1)
+       const unsigned char *data0, unsigned int data1)
 {
        unsigned int timeout = TRY_GET_FIFO_TIMEOUT;
        unsigned long delay_val, delay;
@@ -136,8 +134,8 @@ int exynos_mipi_dsi_wr_data(struct mipi_dsim_device *dsim, unsigned int data_id,
        case MIPI_DSI_DCS_SHORT_WRITE_PARAM:
        case MIPI_DSI_SET_MAXIMUM_RETURN_PACKET_SIZE:
                debug("data0 = %x data1 = %x\n",
-                               data0, data1);
-               exynos_mipi_dsi_wr_tx_header(dsim, data_id, data0, data1);
+                               data0[0], data0[1]);
+               exynos_mipi_dsi_wr_tx_header(dsim, data_id, data0[0], data0[1]);
                if (check_rx_ack) {
                        /* process response func should be implemented */
                        return 0;
@@ -150,7 +148,7 @@ int exynos_mipi_dsi_wr_data(struct mipi_dsim_device *dsim, unsigned int data_id,
        case MIPI_DSI_COLOR_MODE_ON:
        case MIPI_DSI_SHUTDOWN_PERIPHERAL:
        case MIPI_DSI_TURN_ON_PERIPHERAL:
-               exynos_mipi_dsi_wr_tx_header(dsim, data_id, data0, data1);
+               exynos_mipi_dsi_wr_tx_header(dsim, data_id, data0[0], data0[1]);
                if (check_rx_ack) {
                        /* process response func should be implemented. */
                        return 0;
@@ -172,7 +170,7 @@ int exynos_mipi_dsi_wr_data(struct mipi_dsim_device *dsim, unsigned int data_id,
        case MIPI_DSI_GENERIC_READ_REQUEST_2_PARAM:
        case MIPI_DSI_DCS_READ:
                exynos_mipi_dsi_clear_all_interrupt(dsim);
-               exynos_mipi_dsi_wr_tx_header(dsim, data_id, data0, data1);
+               exynos_mipi_dsi_wr_tx_header(dsim, data_id, data0[0], data0[1]);
                /* process response func should be implemented. */
                return 0;
 
@@ -183,21 +181,19 @@ int exynos_mipi_dsi_wr_data(struct mipi_dsim_device *dsim, unsigned int data_id,
        case MIPI_DSI_GENERIC_LONG_WRITE:
        case MIPI_DSI_DCS_LONG_WRITE:
        {
-               unsigned int data_cnt = 0, payload = 0;
+               unsigned int payload = 0;
 
                /* if data count is less then 4, then send 3bytes data.  */
                if (data1 < 4) {
-                       payload = *(u8 *)(data0) |
-                               *(u8 *)(data0 + 1) << 8 |
-                               *(u8 *)(data0 + 2) << 16;
+                       payload = data0[0] |
+                               data0[1] << 8 |
+                               data0[2] << 16;
 
                        exynos_mipi_dsi_wr_tx_data(dsim, payload);
 
                        debug("count = %d payload = %x,%x %x %x\n",
-                               data1, payload,
-                               *(u8 *)(data0 + data_cnt),
-                               *(u8 *)(data0 + (data_cnt + 1)),
-                               *(u8 *)(data0 + (data_cnt + 2)));
+                               data1, payload, data0[0],
+                               data0[1], data0[2]);
                } else {
                        /* in case that data count is more then 4 */
                        exynos_mipi_dsi_long_data_wr(dsim, data0, data1);
index 318c7ecec331b3893169ca2048996cb17cb49495..ef6510abdd8997484015447a2ff6f9d5fc721e78 100644 (file)
@@ -13,7 +13,7 @@
 #define _EXYNOS_MIPI_DSI_COMMON_H
 
 int exynos_mipi_dsi_wr_data(struct mipi_dsim_device *dsim, unsigned int data_id,
-       unsigned int data0, unsigned int data1);
+       const unsigned char *data0, unsigned int data1);
 int exynos_mipi_dsi_pll_on(struct mipi_dsim_device *dsim, unsigned int enable);
 unsigned long exynos_mipi_dsi_change_pll(struct mipi_dsim_device *dsim,
        unsigned int pre_divider, unsigned int main_divider,
index b47eee45defc7ededb639df607f00ba92edb7fc9..1313bcea4cfe88a7625ec978c0e77bee2426cff5 100644 (file)
@@ -600,7 +600,7 @@ unsigned int exynos_mipi_dsi_get_fifo_state(struct mipi_dsim_device *dsim)
 }
 
 void exynos_mipi_dsi_wr_tx_header(struct mipi_dsim_device *dsim,
-       unsigned int di, unsigned int data0, unsigned int data1)
+       unsigned int di, const unsigned char data0, const unsigned char data1)
 {
        struct exynos_mipi_dsim *mipi_dsim =
                (struct exynos_mipi_dsim *)samsung_get_base_mipi_dsim();
index 8a45954e9eee078189b19afeacfb2dfe63f9f031..59f6ce09e40ce51dafebbe74a215ba343c883ae9 100644 (file)
@@ -91,7 +91,7 @@ unsigned int _exynos_mipi_dsi_get_frame_done_status(struct mipi_dsim_device
                                                *dsim);
 void _exynos_mipi_dsi_clear_frame_done(struct mipi_dsim_device *dsim);
 void exynos_mipi_dsi_wr_tx_header(struct mipi_dsim_device *dsim,
-               unsigned int di, unsigned int data0, unsigned int data1);
+               unsigned int di, const unsigned char data0, const unsigned char data1);
 void exynos_mipi_dsi_wr_tx_data(struct mipi_dsim_device *dsim,
                unsigned int tx_data);
 
index fc092522b261c39f7062ee1d419e28a782c83bdb..0e97f511fdcfa4de21af43e88ff8e44d30e546e7 100644 (file)
@@ -34,11 +34,11 @@ static void s6e8ax0_panel_cond(struct mipi_dsim_device *dsim_dev)
 
        if (reverse) {
                ops->cmd_write(dsim_dev, MIPI_DSI_DCS_LONG_WRITE,
-                       (unsigned int)data_to_send_reverse,
+                       data_to_send_reverse,
                        ARRAY_SIZE(data_to_send_reverse));
        } else {
                ops->cmd_write(dsim_dev, MIPI_DSI_DCS_LONG_WRITE,
-                       (unsigned int)data_to_send, ARRAY_SIZE(data_to_send));
+                       data_to_send, ARRAY_SIZE(data_to_send));
        }
 }
 
@@ -50,8 +50,7 @@ static void s6e8ax0_display_cond(struct mipi_dsim_device *dsim_dev)
        };
 
        ops->cmd_write(dsim_dev, MIPI_DSI_DCS_LONG_WRITE,
-                       (unsigned int)data_to_send,
-                       ARRAY_SIZE(data_to_send));
+                       data_to_send, ARRAY_SIZE(data_to_send));
 }
 
 static void s6e8ax0_gamma_cond(struct mipi_dsim_device *dsim_dev)
@@ -65,15 +64,18 @@ static void s6e8ax0_gamma_cond(struct mipi_dsim_device *dsim_dev)
        };
 
        ops->cmd_write(dsim_dev, MIPI_DSI_DCS_LONG_WRITE,
-                       (unsigned int)data_to_send,
-                       ARRAY_SIZE(data_to_send));
+                       data_to_send, ARRAY_SIZE(data_to_send));
 }
 
 static void s6e8ax0_gamma_update(struct mipi_dsim_device *dsim_dev)
 {
        struct mipi_dsim_master_ops *ops = dsim_dev->master_ops;
+       static const unsigned char data_to_send[] = {
+               0xf7, 0x03
+       };
 
-       ops->cmd_write(dsim_dev, MIPI_DSI_DCS_SHORT_WRITE_PARAM, 0xf7, 0x3);
+       ops->cmd_write(dsim_dev, MIPI_DSI_DCS_SHORT_WRITE_PARAM, data_to_send,
+                       ARRAY_SIZE(data_to_send));
 }
 
 static void s6e8ax0_etc_source_control(struct mipi_dsim_device *dsim_dev)
@@ -84,8 +86,7 @@ static void s6e8ax0_etc_source_control(struct mipi_dsim_device *dsim_dev)
        };
 
        ops->cmd_write(dsim_dev, MIPI_DSI_DCS_LONG_WRITE,
-                       (unsigned int)data_to_send,
-                       ARRAY_SIZE(data_to_send));
+                       data_to_send, ARRAY_SIZE(data_to_send));
 }
 
 static void s6e8ax0_etc_pentile_control(struct mipi_dsim_device *dsim_dev)
@@ -97,8 +98,7 @@ static void s6e8ax0_etc_pentile_control(struct mipi_dsim_device *dsim_dev)
        };
 
        ops->cmd_write(dsim_dev, MIPI_DSI_DCS_LONG_WRITE,
-                       (unsigned int)data_to_send,
-                       ARRAY_SIZE(data_to_send));
+                       data_to_send, ARRAY_SIZE(data_to_send));
 }
 
 static void s6e8ax0_etc_mipi_control1(struct mipi_dsim_device *dsim_dev)
@@ -109,8 +109,7 @@ static void s6e8ax0_etc_mipi_control1(struct mipi_dsim_device *dsim_dev)
        };
 
        ops->cmd_write(dsim_dev, MIPI_DSI_DCS_LONG_WRITE,
-                       (unsigned int)data_to_send,
-                       ARRAY_SIZE(data_to_send));
+                       data_to_send, ARRAY_SIZE(data_to_send));
 }
 
 static void s6e8ax0_etc_mipi_control2(struct mipi_dsim_device *dsim_dev)
@@ -121,8 +120,7 @@ static void s6e8ax0_etc_mipi_control2(struct mipi_dsim_device *dsim_dev)
        };
 
        ops->cmd_write(dsim_dev, MIPI_DSI_DCS_LONG_WRITE,
-                       (unsigned int)data_to_send,
-                       ARRAY_SIZE(data_to_send));
+                       data_to_send, ARRAY_SIZE(data_to_send));
 }
 
 static void s6e8ax0_etc_power_control(struct mipi_dsim_device *dsim_dev)
@@ -133,14 +131,18 @@ static void s6e8ax0_etc_power_control(struct mipi_dsim_device *dsim_dev)
        };
 
        ops->cmd_write(dsim_dev, MIPI_DSI_DCS_LONG_WRITE,
-               (unsigned int)data_to_send, ARRAY_SIZE(data_to_send));
+               data_to_send, ARRAY_SIZE(data_to_send));
 }
 
 static void s6e8ax0_etc_mipi_control3(struct mipi_dsim_device *dsim_dev)
 {
        struct mipi_dsim_master_ops *ops = dsim_dev->master_ops;
+       static const unsigned char data_to_send[] = {
+               0xe3, 0x40
+       };
 
-       ops->cmd_write(dsim_dev, MIPI_DSI_DCS_SHORT_WRITE_PARAM, 0xe3, 0x40);
+       ops->cmd_write(dsim_dev, MIPI_DSI_DCS_SHORT_WRITE_PARAM, data_to_send,
+                      ARRAY_SIZE(data_to_send));
 }
 
 static void s6e8ax0_etc_mipi_control4(struct mipi_dsim_device *dsim_dev)
@@ -151,7 +153,7 @@ static void s6e8ax0_etc_mipi_control4(struct mipi_dsim_device *dsim_dev)
        };
 
        ops->cmd_write(dsim_dev, MIPI_DSI_DCS_LONG_WRITE,
-               (unsigned int)data_to_send, ARRAY_SIZE(data_to_send));
+               data_to_send, ARRAY_SIZE(data_to_send));
 }
 
 static void s6e8ax0_elvss_set(struct mipi_dsim_device *dsim_dev)
@@ -162,24 +164,29 @@ static void s6e8ax0_elvss_set(struct mipi_dsim_device *dsim_dev)
        };
 
        ops->cmd_write(dsim_dev, MIPI_DSI_DCS_LONG_WRITE,
-                       (unsigned int)data_to_send,
-                       ARRAY_SIZE(data_to_send));
+                       data_to_send, ARRAY_SIZE(data_to_send));
 }
 
 static void s6e8ax0_display_on(struct mipi_dsim_device *dsim_dev)
 {
        struct mipi_dsim_master_ops *ops = dsim_dev->master_ops;
+       static const unsigned char data_to_send[] = {
+               0x29, 0x00
+       };
 
-       ops->cmd_write(dsim_dev,
-               MIPI_DSI_DCS_SHORT_WRITE, 0x29, 0x00);
+       ops->cmd_write(dsim_dev, MIPI_DSI_DCS_SHORT_WRITE, data_to_send,
+                      ARRAY_SIZE(data_to_send));
 }
 
 static void s6e8ax0_sleep_out(struct mipi_dsim_device *dsim_dev)
 {
        struct mipi_dsim_master_ops *ops = dsim_dev->master_ops;
+       static const unsigned char data_to_send[] = {
+               0x11, 0x00
+       };
 
-       ops->cmd_write(dsim_dev,
-               MIPI_DSI_DCS_SHORT_WRITE, 0x11, 0x00);
+       ops->cmd_write(dsim_dev, MIPI_DSI_DCS_SHORT_WRITE, data_to_send,
+                      ARRAY_SIZE(data_to_send));
 }
 
 static void s6e8ax0_apply_level1_key(struct mipi_dsim_device *dsim_dev)
@@ -190,7 +197,7 @@ static void s6e8ax0_apply_level1_key(struct mipi_dsim_device *dsim_dev)
        };
 
        ops->cmd_write(dsim_dev, MIPI_DSI_DCS_LONG_WRITE,
-               (unsigned int)data_to_send, ARRAY_SIZE(data_to_send));
+               data_to_send, ARRAY_SIZE(data_to_send));
 }
 
 static void s6e8ax0_apply_mtp_key(struct mipi_dsim_device *dsim_dev)
@@ -201,7 +208,7 @@ static void s6e8ax0_apply_mtp_key(struct mipi_dsim_device *dsim_dev)
        };
 
        ops->cmd_write(dsim_dev, MIPI_DSI_DCS_LONG_WRITE,
-               (unsigned int)data_to_send, ARRAY_SIZE(data_to_send));
+               data_to_send, ARRAY_SIZE(data_to_send));
 }
 
 static void s6e8ax0_panel_init(struct mipi_dsim_device *dsim_dev)