rgb to mipi: update mipi driver
authorhhb <hhb@rock-chips.com>
Fri, 15 Mar 2013 10:05:16 +0000 (18:05 +0800)
committerhhb <hhb@rock-chips.com>
Fri, 15 Mar 2013 10:05:16 +0000 (18:05 +0800)
drivers/video/display/transmitter/Kconfig
drivers/video/display/transmitter/Makefile
drivers/video/display/transmitter/mipi_dsi.c
drivers/video/display/transmitter/mipi_dsi.h
drivers/video/display/transmitter/ssd2828.c
drivers/video/display/transmitter/tc358768.c

index 2b875c41135e8383151f1f47cdd63bebb6294bc8..7d8b9347881427cdef7d9cb2a3832ba527728a2b 100644 (file)
@@ -17,19 +17,17 @@ config DP_ANX6345
 
 config DP501
        bool"RGB to Display Port transmitter dp501 support"
+
+config TC358768_RGB2MIPI
+        bool "toshiba TC358768 RGB to MIPI DSI"
+        help
+        "a chip that change RGB interface parallel signal into DSI serial signal"
+
+config SSD2828_RGB2MIPI
+        bool "solomon SSD2828 RGB to MIPI DSI"
+        help
+        "a chip that change RGB interface parallel signal into DSI serial signal"
        
 endchoice
 
-config MIPI_DSI
-       bool "RGB to MIPI DSI"
                        
-config TC358768_RGB2MIPI
-       bool "toshiba TC358768 RGB to MIPI DSI"
-       depends on MIPI_DSI
-       help
-       "a chip that change RGB interface parallel signal into DSI serial signal"
-config SSD2828_RGB2MIPI
-       bool "solomon SSD2828 RGB to MIPI DSI"
-       depends on MIPI_DSI
-       help
-       "a chip that change RGB interface parallel signal into DSI serial signal"
index ed8fb564c78e3fb73dc1bf6c97073c081c0670e6..9188597200a0136d2950c32ba39b93294b6d743c 100644 (file)
@@ -2,8 +2,7 @@
 # Makefile for display transmitter like lvds edp mipi
 #
 obj-$(CONFIG_RK610_LVDS)         += rk610_lcd.o
-obj-$(CONFIG_MIPI_DSI)   += mipi_dsi.o
-obj-$(CONFIG_TC358768_RGB2MIPI)   += tc358768.o
-obj-$(CONFIG_SSD2828_RGB2MIPI)   += ssd2828.o
+obj-$(CONFIG_TC358768_RGB2MIPI)   += mipi_dsi.o tc358768.o
+obj-$(CONFIG_SSD2828_RGB2MIPI)   += mipi_dsi.o ssd2828.o
 obj-$(CONFIG_DP_ANX6345)          += dp_anx6345.o
 obj-$(CONFIG_DP501)          += dp501.o
index 5a648d7ff89efbc764efdf5ae50b70a8554fcd94..cc9d538d8a198a17d4eb01e13f4b84f5d0f8bcf0 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2012 ROCKCHIP, Inc.
- *
+ * drivers/video/display/transmitter/mipi_dsi.c
  * author: hhb@rock-chips.com
  * create date: 2013-01-17
  * This software is licensed under the terms of the GNU General Public
@@ -63,7 +63,8 @@ int dsi_probe_current_chip(void) {
 
        int i = 0, id;
        struct mipi_dsi_ops *ops = NULL;
-
+       if(cur_dsi_ops)
+               return 0;
        for(i = 0; i < MAX_DSI_CHIPS; i++) {
                if(dsi_ops[i]) {
                        ops = dsi_ops[i];
index 5ceda86163f9b6755a618bfd53faa09319f9a2ef..831427af94ad97d192dbf0f27de85e816a034063 100644 (file)
@@ -1,4 +1,6 @@
 
+//drivers/video/display/transmitter/mipi_dsi.h
+
 #ifndef MIPI_DSI_H_
 #define MIPI_DSI_H_
 
 #define DTYPE_GEN_SWRITE_1P            0X13
 #define DTYPE_GEN_SWRITE_0P            0X03
 
+
+//iomux
+#define OLD_RK_IOMUX 0
+
 struct spi_t {
        int cs;
        char* cs_mux_name;
index bc7faddc28a265ef2ed747a811ec0ee5e5a7ac8b..77518bddd47e44fbf1b0d075f7df34e4bc3e6407 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2012 ROCKCHIP, Inc.
- *
+ * drivers/video/display/transmitter/ssd2828.c
  * author: hhb@rock-chips.com
  * create date: 2013-01-17
  * This software is licensed under the terms of the GNU General Public
@@ -55,9 +55,11 @@ int ssd2828_gpio_init(void *data) {
                        //gpio_free(reset->reset_pin);
                        printk("%s: request ssd2828_RST_PIN error\n", __func__);
                } else {
+#if OLD_RK_IOMUX
                        if(reset->mux_name)
                                rk30_mux_api_set(reset->mux_name, 0);
-                       gpio_direction_output(reset->reset_pin, reset->effect_value);
+#endif                         
+                       gpio_direction_output(reset->reset_pin, !reset->effect_value);
                }
        }
        
@@ -67,8 +69,10 @@ int ssd2828_gpio_init(void *data) {
                        //gpio_free(vdd->enable_pin);
                        printk("%s: request ssd2828_vddio_PIN error\n", __func__);
                } else {
+#if OLD_RK_IOMUX               
                        if(vdd->mux_name)
                                rk30_mux_api_set(vdd->mux_name, 0);     
+#endif                 
                        gpio_direction_output(vdd->enable_pin, !vdd->effect_value);     
                }
        }
@@ -80,8 +84,10 @@ int ssd2828_gpio_init(void *data) {
                        //gpio_free(vdd->enable_pin);
                        printk("%s: request ssd2828_vdd_mipi_PIN error\n", __func__);
                } else {
+#if OLD_RK_IOMUX               
                        if(vdd->mux_name)
                                rk30_mux_api_set(vdd->mux_name, 0);     
+#endif                 
                        gpio_direction_output(vdd->enable_pin, !vdd->effect_value);     
                }
        }
@@ -92,8 +98,10 @@ int ssd2828_gpio_init(void *data) {
                        //gpio_free(spi->cs);
                        printk("%s: request ssd2828_spi->cs_PIN error\n", __func__);
                } else {
+#if OLD_RK_IOMUX               
                        if(spi->cs_mux_name)
                                rk30_mux_api_set(spi->cs_mux_name, 0);  
+#endif                         
                        gpio_direction_output(spi->cs, GPIO_HIGH);      
                }
        }
@@ -103,8 +111,10 @@ int ssd2828_gpio_init(void *data) {
                        //gpio_free(spi->sck);
                        printk("%s: request ssd2828_spi->sck_PIN error\n", __func__);
                } else {
+#if OLD_RK_IOMUX               
                        if(spi->sck_mux_name)
                                rk30_mux_api_set(spi->sck_mux_name, 0); 
+#endif
                        gpio_direction_output(spi->sck, GPIO_HIGH);     
                }
        }       
@@ -114,8 +124,10 @@ int ssd2828_gpio_init(void *data) {
                        //gpio_free(spi->mosi);
                        printk("%s: request ssd2828_spi->mosi_PIN error\n", __func__);
                } else {
+#if OLD_RK_IOMUX               
                        if(spi->mosi_mux_name)
                                rk30_mux_api_set(spi->mosi_mux_name, 0);        
+#endif
                        gpio_direction_output(spi->mosi, GPIO_HIGH);    
                }
        }       
@@ -125,8 +137,10 @@ int ssd2828_gpio_init(void *data) {
                        //gpio_free(spi->miso);
                        printk("%s: request ssd2828_spi->miso_PIN error\n", __func__);
                } else {
+#if OLD_RK_IOMUX               
                        if(spi->miso_mux_name)
                                rk30_mux_api_set(spi->miso_mux_name, 0);        
+#endif
                        gpio_direction_input(spi->miso);        
                }
        }       
@@ -209,7 +223,6 @@ int ssd2828_power_up(void) {
        int ret = 0;
        struct ssd2828_t *ssd = (struct ssd2828_t *)ssd2828;
        
-       ssd2828_gpio_init(NULL);
        ssd->vdd_mipi.enable(&ssd->vdd_mipi);
        ssd->vddio.enable(&ssd->vddio);
        ssd->reset.do_reset(&ssd->reset);
@@ -224,7 +237,6 @@ int ssd2828_power_down(void) {
        
        ssd->vddio.disable(&ssd->vddio);
        ssd->vdd_mipi.disable(&ssd->vdd_mipi);
-       ssd2828_gpio_deinit(NULL);
        
        return ret;
 }
@@ -357,13 +369,13 @@ int ssd_set_registers(unsigned int reg_array[], int n) {
 
 int ssd_mipi_dsi_send_dcs_packet(unsigned char regs[], int n) {
        //unsigned int data = 0, i = 0;
-       ssd_set_register(0x00B70363);
+       ssd_set_register(0x00B70343);   //
        ssd_set_register(0x00B80000);
        ssd_set_register(0x00Bc0001);
        
        ssd_set_register(0x00Bf0000 | regs[0]);
        msleep(1);
-
+       ssd_set_register(0x00B7034b);
        return 0;
 }
 
@@ -457,6 +469,8 @@ static int ssd2828_probe(struct platform_device *pdev) {
        ssd2828->vdd_mipi.enable = ssd2828_vdd_enable;    
     if(!ssd2828->vdd_mipi.disable)
        ssd2828->vdd_mipi.disable = ssd2828_vdd_disable;        
+       
+       ssd2828_gpio_init(NULL);
        
        return 0;
 }
@@ -464,9 +478,10 @@ static int ssd2828_probe(struct platform_device *pdev) {
 
 static int ssd2828_remove(struct platform_device *pdev) {
 
-       if(!ssd2828)
+       if(ssd2828) {
+               ssd2828_gpio_deinit(NULL);
                ssd2828 = NULL;
-
+       }
        return 0;
 }
 
index d8e2811a2eb2457f13ad101bf4a75e3d0d35f581..5f573b3dce8e2274c3b93542dba259731cbd3f27 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2012 ROCKCHIP, Inc.
- *
+ * drivers/video/display/transmitter/tc358768.c
  * author: hhb@rock-chips.com
  * create date: 2012-10-26
  * This software is licensed under the terms of the GNU General Public
@@ -103,9 +103,11 @@ int tc358768_gpio_init(void *data) {
                        //gpio_free(reset->reset_pin);
                        printk("%s: request TC358768_RST_PIN error\n", __func__);
                } else {
+#if OLD_RK_IOMUX               
                        if(reset->mux_name)
                                rk30_mux_api_set(reset->mux_name, reset->mux_mode);
-                       gpio_direction_output(reset->reset_pin, reset->effect_value);
+#endif
+                       gpio_direction_output(reset->reset_pin, !reset->effect_value);
                }
        }
        
@@ -115,8 +117,10 @@ int tc358768_gpio_init(void *data) {
                        //gpio_free(vdd->enable_pin);
                        printk("%s: request TC358768_vddc_PIN error\n", __func__);
                } else {
+#if OLD_RK_IOMUX               
                        if(vdd->mux_name)
                                rk30_mux_api_set(vdd->mux_name, vdd->mux_mode); 
+#endif
                        gpio_direction_output(vdd->enable_pin, !vdd->effect_value);
                }
        }
@@ -128,8 +132,10 @@ int tc358768_gpio_init(void *data) {
                        //gpio_free(vdd->enable_pin);
                        printk("%s: request TC358768_vddio_PIN error\n", __func__);
                } else {
+#if OLD_RK_IOMUX               
                        if(vdd->mux_name)
                                rk30_mux_api_set(vdd->mux_name, vdd->mux_mode); 
+#endif
                        gpio_direction_output(vdd->enable_pin, !vdd->effect_value);     
                }
        }
@@ -141,8 +147,10 @@ int tc358768_gpio_init(void *data) {
                        //gpio_free(vdd->enable_pin);
                        printk("%s: request TC358768_vdd_mipi_PIN error\n", __func__);
                } else {
+#if OLD_RK_IOMUX               
                        if(vdd->mux_name)
                                rk30_mux_api_set(vdd->mux_name, vdd->mux_mode); 
+#endif
                        gpio_direction_output(vdd->enable_pin, !vdd->effect_value);     
                }
        }
@@ -217,7 +225,6 @@ int tc358768_power_up(void) {
        int ret = 0;
        struct tc358768_t *tc = (struct tc358768_t *)tc358768;
        
-       tc358768_gpio_init(NULL);
        tc->vddc.enable(&tc->vddc);
        tc->vdd_mipi.enable(&tc->vdd_mipi);
        tc->vddio.enable(&tc->vddio);
@@ -234,7 +241,6 @@ int tc358768_power_down(void) {
        tc->vddio.disable(&tc->vddio);
        tc->vdd_mipi.disable(&tc->vdd_mipi);
        tc->vddc.disable(&tc->vddc);
-       tc358768_gpio_deinit(NULL);
        
        return ret;
 }
@@ -293,11 +299,14 @@ static int tc358768_probe(struct i2c_client *client,
        tc358768->vdd_mipi.enable = tc358768_vdd_enable;    
     if(!tc358768->vdd_mipi.disable)
        tc358768->vdd_mipi.disable = tc358768_vdd_disable;
-   
+       
+    tc358768_gpio_init(NULL);
+    
     return ret;
 }
 static int tc358768_remove(struct i2c_client *client)
 {
+    tc358768_gpio_deinit(NULL);
     tc358768_client = NULL;
     tc358768 = NULL;
     return 0;