From d66be0ba67a104bded781295a9c191d93edbcab3 Mon Sep 17 00:00:00 2001 From: hhb Date: Fri, 15 Mar 2013 18:05:16 +0800 Subject: [PATCH] rgb to mipi: update mipi driver --- drivers/video/display/transmitter/Kconfig | 22 +++++++------- drivers/video/display/transmitter/Makefile | 5 ++-- drivers/video/display/transmitter/mipi_dsi.c | 5 ++-- drivers/video/display/transmitter/mipi_dsi.h | 6 ++++ drivers/video/display/transmitter/ssd2828.c | 31 +++++++++++++++----- drivers/video/display/transmitter/tc358768.c | 19 ++++++++---- 6 files changed, 58 insertions(+), 30 deletions(-) diff --git a/drivers/video/display/transmitter/Kconfig b/drivers/video/display/transmitter/Kconfig index 2b875c41135e..7d8b93478814 100644 --- a/drivers/video/display/transmitter/Kconfig +++ b/drivers/video/display/transmitter/Kconfig @@ -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" diff --git a/drivers/video/display/transmitter/Makefile b/drivers/video/display/transmitter/Makefile index ed8fb564c78e..9188597200a0 100644 --- a/drivers/video/display/transmitter/Makefile +++ b/drivers/video/display/transmitter/Makefile @@ -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 diff --git a/drivers/video/display/transmitter/mipi_dsi.c b/drivers/video/display/transmitter/mipi_dsi.c index 5a648d7ff89e..cc9d538d8a19 100644 --- a/drivers/video/display/transmitter/mipi_dsi.c +++ b/drivers/video/display/transmitter/mipi_dsi.c @@ -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]; diff --git a/drivers/video/display/transmitter/mipi_dsi.h b/drivers/video/display/transmitter/mipi_dsi.h index 5ceda86163f9..831427af94ad 100644 --- a/drivers/video/display/transmitter/mipi_dsi.h +++ b/drivers/video/display/transmitter/mipi_dsi.h @@ -1,4 +1,6 @@ +//drivers/video/display/transmitter/mipi_dsi.h + #ifndef MIPI_DSI_H_ #define MIPI_DSI_H_ @@ -18,6 +20,10 @@ #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; diff --git a/drivers/video/display/transmitter/ssd2828.c b/drivers/video/display/transmitter/ssd2828.c index bc7faddc28a2..77518bddd47e 100644 --- a/drivers/video/display/transmitter/ssd2828.c +++ b/drivers/video/display/transmitter/ssd2828.c @@ -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; } diff --git a/drivers/video/display/transmitter/tc358768.c b/drivers/video/display/transmitter/tc358768.c index d8e2811a2eb2..5f573b3dce8e 100644 --- a/drivers/video/display/transmitter/tc358768.c +++ b/drivers/video/display/transmitter/tc358768.c @@ -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; -- 2.34.1