rk3288-hdmi: add support read edid
authorzwl <zwl@rock-chips.com>
Tue, 22 Apr 2014 10:20:48 +0000 (18:20 +0800)
committerzwl <zwl@rock-chips.com>
Tue, 22 Apr 2014 10:21:05 +0000 (18:21 +0800)
arch/arm/boot/dts/rk3288-pinctrl.dtsi
arch/arm/boot/dts/rk3288.dtsi
drivers/video/rockchip/hdmi/chips/rk3288/rk3288_hdmi_hw.c

index 0ade875c6a9213a8f19c8dc58519b2637981fe07..3816ea611b78f689ff992963334a6b69e2280d91 100755 (executable)
 
                gpio7_i2c5 {
                        i2c5_sda:i2c5-sda {
-                               rockchip,pins = <I2C5HDMI_SDA>;
+                               rockchip,pins = <EDPHDMII2C_SDA>;
                                rockchip,pull = <VALUE_PULL_DISABLE>;
                                rockchip,drive = <VALUE_DRV_DEFAULT>;
                                //rockchip,tristate = <VALUE_TRI_DEFAULT>;
                        };
 
                        i2c5_scl:i2c5-scl {
-                               rockchip,pins = <I2C5HDMI_SCL>;
+                               rockchip,pins = <EDPHDMII2C_SCL>;
                                rockchip,pull = <VALUE_PULL_DISABLE>;
                                rockchip,drive = <VALUE_DRV_DEFAULT>;
                                //rockchip,tristate = <VALUE_TRI_DEFAULT>;
                        };
 
                        i2c5_gpio: i2c5-gpio {
-                               rockchip,pins = <FUNC_TO_GPIO(I2C5HDMI_SDA)>, <FUNC_TO_GPIO(I2C5HDMI_SCL)>;
+                               rockchip,pins = <FUNC_TO_GPIO(EDPHDMII2C_SDA)>, <FUNC_TO_GPIO(EDPHDMII2C_SCL)>;
                                rockchip,drive = <VALUE_DRV_DEFAULT>;
                        };
                };
index 545c5af90eaaf608b417f7f0916214dc08bb462f..6f79218d9fd72999fd91a9f48b19d4742dbcaae8 100755 (executable)
                                <&clk_gates15 12>,/*aclk_vio1_niu*/
 
                                /*HDMI*/
-                               <&clk_gates5 12>,/*hdmi_hdcp_clk*/
+                               //<&clk_gates5 12>,/*hdmi_hdcp_clk*/
 
                                /*UART*/
                                <&clk_gates11 9>,/*pclk_uart2*/
index c323161eab608a41cb8474e2862fe437817ebe79..0f56d390582d7191813b4eb15163af083c095754 100644 (file)
@@ -111,12 +111,12 @@ int rk3288_hdmi_detect_hotplug(struct hdmi *hdmi_drv)
 
 int rk3288_hdmi_read_edid(struct hdmi *hdmi_drv, int block, unsigned char *buff)
 {
-       int i = 0, n = 0, index = 0, interrupt = 0, ret = -1, trytime = 2;
-       int offset = (block%2)*0x80;
-       unsigned long flags;
+       int i = 0, n = 0, index = 0, ret = -1, trytime = 2;
+       int offset = (block % 2) * 0x80;
+       //int interrupt = 0;
+       //unsigned long flags;
        struct rk3288_hdmi_device *hdmi_dev = container_of(hdmi_drv, struct rk3288_hdmi_device, driver);
 
-       return -1;
        hdmi_dbg(hdmi_drv->dev, "[%s] block %d\n", __FUNCTION__, block);
        //spin_lock_irqsave(&hdmi_drv->irq_lock, flags);
        hdmi_dev->i2cm_int = 0;
@@ -134,14 +134,16 @@ int rk3288_hdmi_read_edid(struct hdmi *hdmi_drv, int block, unsigned char *buff)
 
        hdmi_writel(hdmi_dev, I2CM_SLAVE, DDC_I2C_EDID_ADDR);
        hdmi_writel(hdmi_dev, I2CM_SEGADDR, DDC_I2C_SEG_ADDR);
+       hdmi_writel(hdmi_dev, I2CM_SEGPTR, block / 2);
        while(trytime--) {
-               for(n = 0; n < HDMI_EDID_BLOCK_SIZE/8; n++) {
-                       // Config EDID block and segment addr
-                       hdmi_writel(hdmi_dev, I2CM_SEGPTR, block/2);
-                       hdmi_writel(hdmi_dev, I2CM_ADDRESS, offset + 8*n);
+               for(n = 0; n < HDMI_EDID_BLOCK_SIZE / 8; n++) {
+                       hdmi_writel(hdmi_dev, I2CM_ADDRESS, offset + 8 * n);
                        //enable extend sequential read operation
-                       hdmi_msk_reg(hdmi_dev, I2CM_OPERATION, m_I2CM_RD8_EXT, v_I2CM_RD8_EXT(1));
-
+                       if(block == 0)
+                               hdmi_msk_reg(hdmi_dev, I2CM_OPERATION, m_I2CM_RD8, v_I2CM_RD8(1));
+                       else
+                               hdmi_msk_reg(hdmi_dev, I2CM_OPERATION, m_I2CM_RD8_EXT, v_I2CM_RD8_EXT(1));
+#if 0
                        i = 200;
                        while(i--)
                        {
@@ -159,18 +161,19 @@ int rk3288_hdmi_read_edid(struct hdmi *hdmi_drv, int block, unsigned char *buff)
                                rk3288_hdmi_i2cm_reset(hdmi_dev);
                                break;
                        }
-
-                       if(interrupt & m_I2CM_DONE) {
+#endif
+                       //if(interrupt & m_I2CM_DONE)
+                       {
+                               msleep(1);
                                for(index = 0; index < 8; index++) {
-                                       buff[8*n + index] = hdmi_readl(hdmi_dev, I2CM_READ_BUFF0 + index);
+                                       buff[8 * n + index] = hdmi_readl(hdmi_dev, I2CM_READ_BUFF0 + index);
                                }
-                               continue;
 
-                               if(n == HDMI_EDID_BLOCK_SIZE/8 - 1) {
+                               if(n == HDMI_EDID_BLOCK_SIZE / 8 - 1) {
                                        ret = 0;
                                        hdmi_dbg(hdmi_drv->dev, "[%s] edid read sucess\n", __FUNCTION__);
 
-                               #ifdef HDMI_DEBUG
+                               #if 1//def HDMI_DEBUG
                                        for(i = 0; i < 128; i++) {
                                                printk("%02x ,", buff[i]);
                                                if( (i + 1) % 16 == 0)