MLK-12054-1 media: video: fix multiple definition error in MIPI DSI driver
authorRobby Cai <robby.cai@nxp.com>
Mon, 4 Jan 2016 11:19:59 +0000 (19:19 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 19:49:38 +0000 (14:49 -0500)
When enable CONFIG_FB_MXC_MIPI_DSI, meet following compiling error.

drivers/video/fbdev/mxc/mipi_dsi_samsung.o: In function `mipi_dsi_pkt_write':
mipi_dsi_samsung.c:(.text+0x818): multiple definition of `mipi_dsi_pkt_write'
drivers/video/fbdev/mxc/mipi_dsi.o:mipi_dsi.c:(.text+0xa74): first defined here
drivers/video/fbdev/mxc/mipi_dsi_samsung.o: In function `mipi_dsi_pkt_read':
mipi_dsi_samsung.c:(.text+0x9d8): multiple definition of `mipi_dsi_pkt_read'
drivers/video/fbdev/mxc/mipi_dsi.o:mipi_dsi.c:(.text+0xc5c): first defined here
drivers/video/fbdev/mxc/mipi_dsi_samsung.o: In function `mipi_dsi_dcs_cmd':
mipi_dsi_samsung.c:(.text+0xa88): multiple definition of `mipi_dsi_dcs_cmd'
drivers/video/fbdev/mxc/mipi_dsi.o:mipi_dsi.c:(.text+0xdb0): first defined here
make[4]: *** [drivers/video/fbdev/mxc/built-in.o] Error 1
make[3]: *** [drivers/video/fbdev/mxc] Error 2
make[2]: *** [drivers/video/fbdev] Error 2
make[1]: *** [drivers/video] Error 2

move three dsi packet related functions to mipi_dsi_info
structure. This will avoid the multiple definition compiling
issue. This is what the commit f54c7527895575a2e474b17a4752724977b898ea does
in 3.14.y

Signed-off-by: Robby Cai <robby.cai@nxp.com>
drivers/video/fbdev/mxc/mipi_dsi.c
drivers/video/fbdev/mxc/mipi_dsi.h
drivers/video/fbdev/mxc/mipi_dsi_samsung.c
drivers/video/fbdev/mxc/mxcfb_hx8369_wvga.c

index c2af054..a62e6ba 100644 (file)
@@ -120,7 +120,7 @@ static inline void mipi_dsi_write_register(struct mipi_dsi_info *mipi_dsi,
                        reg, val);
 }
 
-int mipi_dsi_pkt_write(struct mipi_dsi_info *mipi_dsi,
+static int mipi_dsi_pkt_write(struct mipi_dsi_info *mipi_dsi,
                                u8 data_type, const u32 *buf, int len)
 {
        u32 val;
@@ -198,7 +198,7 @@ int mipi_dsi_pkt_write(struct mipi_dsi_info *mipi_dsi,
        return 0;
 }
 
-int mipi_dsi_pkt_read(struct mipi_dsi_info *mipi_dsi,
+static int mipi_dsi_pkt_read(struct mipi_dsi_info *mipi_dsi,
                                u8 data_type, u32 *buf, int len)
 {
        u32             val;
@@ -259,7 +259,7 @@ int mipi_dsi_pkt_read(struct mipi_dsi_info *mipi_dsi,
        }
 }
 
-int mipi_dsi_dcs_cmd(struct mipi_dsi_info *mipi_dsi,
+static int mipi_dsi_dcs_cmd(struct mipi_dsi_info *mipi_dsi,
                                u8 cmd, const u32 *param, int num)
 {
        int err = 0;
@@ -908,6 +908,10 @@ static int mipi_dsi_probe(struct platform_device *pdev)
                goto dispdrv_reg_fail;
        }
 
+       mipi_dsi->mipi_dsi_pkt_read  = mipi_dsi_pkt_read;
+       mipi_dsi->mipi_dsi_pkt_write = mipi_dsi_pkt_write;
+       mipi_dsi->mipi_dsi_dcs_cmd   = mipi_dsi_dcs_cmd;
+
        mxc_dispdrv_setdata(mipi_dsi->disp_mipi, mipi_dsi);
        dev_set_drvdata(&pdev->dev, mipi_dsi);
 
index 146dd92..722ac6c 100644 (file)
@@ -85,14 +85,14 @@ struct mipi_dsi_info {
        struct backlight_device         *bl;
        /* callback for lcd panel operation */
        struct mipi_dsi_lcd_callback    *lcd_callback;
-};
 
-int mipi_dsi_pkt_write(struct mipi_dsi_info *mipi,
-                               u8 data_type, const u32 *buf, int len);
-int mipi_dsi_pkt_read(struct mipi_dsi_info *mipi,
-                               u8 data_type, u32 *buf, int len);
-int mipi_dsi_dcs_cmd(struct mipi_dsi_info *mipi,
-                               u8 cmd, const u32 *param, int num);
+       int (*mipi_dsi_pkt_read)(struct mipi_dsi_info *mipi,
+                       u8 data_type, u32 *buf, int len);
+       int (*mipi_dsi_pkt_write)(struct mipi_dsi_info *mipi_dsi,
+                       u8 data_type, const u32 *buf, int len);
+       int (*mipi_dsi_dcs_cmd)(struct mipi_dsi_info *mipi,
+                       u8 cmd, const u32 *param, int num);
+};
 
 #ifdef CONFIG_FB_MXC_TRULY_WVGA_SYNC_PANEL
 void mipid_hx8369_get_lcd_videomode(struct fb_videomode **mode, int *size,
index 6e4be5b..553c0e8 100644 (file)
@@ -191,7 +191,7 @@ static void mipi_dsi_long_data_wr(struct mipi_dsi_info *mipi_dsi,
         }
 }
 
-int mipi_dsi_pkt_write(struct mipi_dsi_info *mipi_dsi,
+static int mipi_dsi_pkt_write(struct mipi_dsi_info *mipi_dsi,
                       u8 data_type, const u32 *buf, int len)
 {
        int ret = 0;
@@ -231,7 +231,7 @@ static unsigned int mipi_dsi_rd_rx_fifo(struct mipi_dsi_info *mipi_dsi)
        return readl(mipi_dsi->mmio_base + MIPI_DSI_RXFIFO);
 }
 
-int mipi_dsi_pkt_read(struct mipi_dsi_info *mipi_dsi,
+static int mipi_dsi_pkt_read(struct mipi_dsi_info *mipi_dsi,
                                u8 data_type, u32 *buf, int len)
 {
        int ret;
@@ -795,6 +795,10 @@ static int mipi_dsi_probe(struct platform_device *pdev)
                goto dispdrv_reg_fail;
        }
 
+        mipi_dsi->mipi_dsi_pkt_read  = mipi_dsi_pkt_read;
+        mipi_dsi->mipi_dsi_pkt_write = mipi_dsi_pkt_write;
+        mipi_dsi->mipi_dsi_dcs_cmd   = mipi_dsi_dcs_cmd;
+
        pm_runtime_enable(&pdev->dev);
 
        mxc_dispdrv_setdata(mipi_dsi->disp_mipi, mipi_dsi);
index 285f7e7..581ecca 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2011-2013 Freescale Semiconductor, Inc. All Rights Reserved.
+ * Copyright (C) 2011-2015 Freescale Semiconductor, Inc. All Rights Reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -26,6 +26,7 @@
 #include <linux/io.h>
 #include <linux/bitops.h>
 #include <linux/spinlock.h>
+#include <linux/mipi_dsi.h>
 #include <linux/mxcfb.h>
 #include <linux/backlight.h>
 #include <video/mipi_display.h>
@@ -192,16 +193,16 @@ int mipid_hx8369_lcd_setup(struct mipi_dsi_info *mipi_dsi)
 
        dev_dbg(&mipi_dsi->pdev->dev, "MIPI DSI LCD setup.\n");
        buf[0] = HX8369_CMD_SETEXTC | (HX8369_CMD_SETEXTC_PARAM_1 << 8);
-       err = mipi_dsi_pkt_write(mipi_dsi, MIPI_DSI_GENERIC_LONG_WRITE,
+       err = mipi_dsi->mipi_dsi_pkt_write(mipi_dsi, MIPI_DSI_GENERIC_LONG_WRITE,
                                        buf, HX8369_CMD_SETEXTC_LEN);
        CHECK_RETCODE(err);
        buf[0] = MIPI_DSI_MAX_RET_PACK_SIZE;
-       err = mipi_dsi_pkt_write(mipi_dsi,
+       err = mipi_dsi->mipi_dsi_pkt_write(mipi_dsi,
                                MIPI_DSI_SET_MAXIMUM_RETURN_PACKET_SIZE,
                                buf, 0);
        CHECK_RETCODE(err);
        buf[0] = HX8369_CMD_GETHXID;
-       err =  mipi_dsi_pkt_read(mipi_dsi,
+       err =  mipi_dsi->mipi_dsi_pkt_read(mipi_dsi,
                        MIPI_DSI_GENERIC_READ_REQUEST_2_PARAM,
                        buf, HX8369_CMD_GETHXID_LEN);
        if (!err && ((buf[0] & HX8369_ID_MASK) == HX8369_ID)) {
@@ -232,14 +233,14 @@ int mipid_hx8369_lcd_setup(struct mipi_dsi_info *mipi_dsi)
                        (HX8369_CMD_SETDISP_13_FP_PE << 8) |
                         (HX8369_CMD_SETDISP_14_RTN_PE << 16) |
                         (HX8369_CMD_SETDISP_15_GON << 24);
-       err = mipi_dsi_pkt_write(mipi_dsi, MIPI_DSI_GENERIC_LONG_WRITE,
+       err = mipi_dsi->mipi_dsi_pkt_write(mipi_dsi, MIPI_DSI_GENERIC_LONG_WRITE,
                                                buf, HX8369_CMD_SETDISP_LEN);
        CHECK_RETCODE(err);
 
        /* Set display waveform cycle */
        buf[0] = HX8369_CMD_SETCYC | (HX8369_CMD_SETCYC_PARAM_1 << 8);
        buf[1] = HX8369_CMD_SETCYC_PARAM_2;
-       err = mipi_dsi_pkt_write(mipi_dsi, MIPI_DSI_GENERIC_LONG_WRITE,
+       err = mipi_dsi->mipi_dsi_pkt_write(mipi_dsi, MIPI_DSI_GENERIC_LONG_WRITE,
                                                buf, HX8369_CMD_SETCYC_LEN);
        CHECK_RETCODE(err);
 
@@ -251,7 +252,7 @@ int mipid_hx8369_lcd_setup(struct mipi_dsi_info *mipi_dsi)
        buf[4] = HX8369_CMD_SETGIP_PARAM_5;
        buf[5] = HX8369_CMD_SETGIP_PARAM_6;
        buf[6] = HX8369_CMD_SETGIP_PARAM_7;
-       err = mipi_dsi_pkt_write(mipi_dsi, MIPI_DSI_GENERIC_LONG_WRITE, buf,
+       err = mipi_dsi->mipi_dsi_pkt_write(mipi_dsi, MIPI_DSI_GENERIC_LONG_WRITE, buf,
                                HX8369_CMD_SETGIP_LEN);
        CHECK_RETCODE(err);
 
@@ -261,19 +262,19 @@ int mipid_hx8369_lcd_setup(struct mipi_dsi_info *mipi_dsi)
        buf[2] = HX8369_CMD_SETPOWER_PARAM_3;
        buf[3] = HX8369_CMD_SETPOWER_PARAM_4;
        buf[4] = HX8369_CMD_SETPOWER_PARAM_5;
-       err = mipi_dsi_pkt_write(mipi_dsi, MIPI_DSI_GENERIC_LONG_WRITE, buf,
+       err = mipi_dsi->mipi_dsi_pkt_write(mipi_dsi, MIPI_DSI_GENERIC_LONG_WRITE, buf,
                                HX8369_CMD_SETPOWER_LEN);
        CHECK_RETCODE(err);
 
        /* Set VCOM voltage. */
        buf[0] = HX8369_CMD_SETVCOM | (HX8369_CMD_SETVCOM_PARAM_1 << 8);
-       err = mipi_dsi_pkt_write(mipi_dsi, MIPI_DSI_GENERIC_LONG_WRITE, buf,
+       err = mipi_dsi->mipi_dsi_pkt_write(mipi_dsi, MIPI_DSI_GENERIC_LONG_WRITE, buf,
                                HX8369_CMD_SETVCOM_LEN);
        CHECK_RETCODE(err);
 
        /* Set Panel: BGR/RGB or Inversion. */
        buf[0] = HX8369_CMD_SETPANEL | (HX8369_CMD_SETPANEL_PARAM_1 << 8);
-       err = mipi_dsi_pkt_write(mipi_dsi,
+       err = mipi_dsi->mipi_dsi_pkt_write(mipi_dsi,
                MIPI_DSI_GENERIC_SHORT_WRITE_2_PARAM, buf, 0);
        CHECK_RETCODE(err);
 
@@ -287,7 +288,7 @@ int mipid_hx8369_lcd_setup(struct mipi_dsi_info *mipi_dsi)
        buf[6] = HX8369_CMD_SETGAMMA_PARAM_7;
        buf[7] = HX8369_CMD_SETGAMMA_PARAM_8;
        buf[8] = HX8369_CMD_SETGAMMA_PARAM_9;
-       err = mipi_dsi_pkt_write(mipi_dsi, MIPI_DSI_GENERIC_LONG_WRITE, buf,
+       err = mipi_dsi->mipi_dsi_pkt_write(mipi_dsi, MIPI_DSI_GENERIC_LONG_WRITE, buf,
                                HX8369_CMD_SETGAMMA_LEN);
        CHECK_RETCODE(err);
 
@@ -300,7 +301,7 @@ int mipid_hx8369_lcd_setup(struct mipi_dsi_info *mipi_dsi)
        else
                buf[2] |= HX8369_CMD_SETMIPI_TWOLANE;
        buf[3] = HX8369_CMD_SETMIPI_PARAM_4;
-       err = mipi_dsi_pkt_write(mipi_dsi, MIPI_DSI_GENERIC_LONG_WRITE, buf,
+       err = mipi_dsi->mipi_dsi_pkt_write(mipi_dsi, MIPI_DSI_GENERIC_LONG_WRITE, buf,
                                HX8369_CMD_SETMIPI_LEN);
        CHECK_RETCODE(err);
 
@@ -326,7 +327,7 @@ int mipid_hx8369_lcd_setup(struct mipi_dsi_info *mipi_dsi)
                buf[0] |= (HX8369_CMD_SETPIXEL_FMT_24BPP << 8);
                break;
        }
-       err = mipi_dsi_pkt_write(mipi_dsi, MIPI_DSI_GENERIC_SHORT_WRITE_2_PARAM,
+       err = mipi_dsi->mipi_dsi_pkt_write(mipi_dsi, MIPI_DSI_GENERIC_SHORT_WRITE_2_PARAM,
                        buf, 0);
        CHECK_RETCODE(err);
 
@@ -334,7 +335,7 @@ int mipid_hx8369_lcd_setup(struct mipi_dsi_info *mipi_dsi)
        buf[0] = HX8369_CMD_SETCLUMN_ADDR |
                (HX8369_CMD_SETCLUMN_ADDR_PARAM_1 << 8);
        buf[1] = HX8369_CMD_SETCLUMN_ADDR_PARAM_2;
-       err = mipi_dsi_pkt_write(mipi_dsi, MIPI_DSI_GENERIC_LONG_WRITE,
+       err = mipi_dsi->mipi_dsi_pkt_write(mipi_dsi, MIPI_DSI_GENERIC_LONG_WRITE,
                                buf, HX8369_CMD_SETCLUMN_ADDR_LEN);
        CHECK_RETCODE(err);
 
@@ -342,32 +343,32 @@ int mipid_hx8369_lcd_setup(struct mipi_dsi_info *mipi_dsi)
        buf[0] = HX8369_CMD_SETPAGE_ADDR |
                (HX8369_CMD_SETPAGE_ADDR_PARAM_1 << 8);
        buf[1] = HX8369_CMD_SETPAGE_ADDR_PARAM_2;
-       err = mipi_dsi_pkt_write(mipi_dsi, MIPI_DSI_GENERIC_LONG_WRITE,
+       err = mipi_dsi->mipi_dsi_pkt_write(mipi_dsi, MIPI_DSI_GENERIC_LONG_WRITE,
                                        buf, HX8369_CMD_SETPAGE_ADDR_LEN);
        CHECK_RETCODE(err);
 
        /* Set display brightness related */
        buf[0] = HX8369_CMD_WRT_DISP_BRIGHT |
                        (HX8369_CMD_WRT_DISP_BRIGHT_PARAM_1 << 8);
-       err = mipi_dsi_pkt_write(mipi_dsi, MIPI_DSI_GENERIC_SHORT_WRITE_2_PARAM,
+       err = mipi_dsi->mipi_dsi_pkt_write(mipi_dsi, MIPI_DSI_GENERIC_SHORT_WRITE_2_PARAM,
                buf, 0);
        CHECK_RETCODE(err);
 
        buf[0] = HX8369_CMD_WRT_CABC_CTRL |
                (HX8369_CMD_WRT_CABC_CTRL_PARAM_1 << 8);
-       err = mipi_dsi_pkt_write(mipi_dsi, MIPI_DSI_GENERIC_SHORT_WRITE_2_PARAM,
+       err = mipi_dsi->mipi_dsi_pkt_write(mipi_dsi, MIPI_DSI_GENERIC_SHORT_WRITE_2_PARAM,
                buf, 0);
        CHECK_RETCODE(err);
 
        buf[0] = HX8369_CMD_WRT_CTRL_DISP |
                (HX8369_CMD_WRT_CTRL_DISP_PARAM_1 << 8);
-       err = mipi_dsi_pkt_write(mipi_dsi, MIPI_DSI_GENERIC_SHORT_WRITE_2_PARAM,
+       err = mipi_dsi->mipi_dsi_pkt_write(mipi_dsi, MIPI_DSI_GENERIC_SHORT_WRITE_2_PARAM,
                buf, 0);
        CHECK_RETCODE(err);
 
        /* exit sleep mode and set display on */
        buf[0] = MIPI_DCS_EXIT_SLEEP_MODE;
-       err = mipi_dsi_pkt_write(mipi_dsi, MIPI_DSI_GENERIC_SHORT_WRITE_1_PARAM,
+       err = mipi_dsi->mipi_dsi_pkt_write(mipi_dsi, MIPI_DSI_GENERIC_SHORT_WRITE_1_PARAM,
                buf, 0);
        CHECK_RETCODE(err);
        /* To allow time for the supply voltages
@@ -375,7 +376,7 @@ int mipid_hx8369_lcd_setup(struct mipi_dsi_info *mipi_dsi)
         */
        msleep(5);
        buf[0] = MIPI_DCS_SET_DISPLAY_ON;
-       err = mipi_dsi_pkt_write(mipi_dsi, MIPI_DSI_GENERIC_SHORT_WRITE_1_PARAM,
+       err = mipi_dsi->mipi_dsi_pkt_write(mipi_dsi, MIPI_DSI_GENERIC_SHORT_WRITE_1_PARAM,
                buf, 0);
        CHECK_RETCODE(err);
 
@@ -396,7 +397,7 @@ static int mipid_bl_update_status(struct backlight_device *bl)
 
        buf = HX8369_CMD_WRT_DISP_BRIGHT |
                        ((brightness & HX8369BL_MAX_BRIGHT) << 8);
-       err = mipi_dsi_pkt_write(mipi_dsi, MIPI_DSI_GENERIC_SHORT_WRITE_2_PARAM,
+       err = mipi_dsi->mipi_dsi_pkt_write(mipi_dsi, MIPI_DSI_GENERIC_SHORT_WRITE_2_PARAM,
                &buf, 0);
        CHECK_RETCODE(err);