1. change hdmi sysfs node permission to 0664;
authorZheng Yang <zhengyang@rock-chips.com>
Sat, 14 Apr 2012 06:30:09 +0000 (14:30 +0800)
committerZheng Yang <zhengyang@rock-chips.com>
Sat, 14 Apr 2012 06:30:09 +0000 (14:30 +0800)
2. support enable/disable hdmi;
3. modify hdmi phy parameter.
4. modify lcdc1 control according to fb commit 03f1f5649c4ee9d01ba3d1414b48a84a967d3eca.

drivers/video/display/display-sys.c [changed mode: 0644->0755]
drivers/video/rockchip/hdmi/rk30_hdmi_hw.c
drivers/video/rockchip/hdmi/rk30_hdmi_hw.h
drivers/video/rockchip/hdmi/rk30_hdmi_lcdc.c
drivers/video/rockchip/hdmi/rk30_hdmi_sysfs.c
drivers/video/rockchip/hdmi/rk30_hdmi_task.c

old mode 100644 (file)
new mode 100755 (executable)
index 3501d40..7a8c646
@@ -151,10 +151,10 @@ static ssize_t display_store_mode(struct device *dev,
 static struct device_attribute display_attrs[] = {
        __ATTR(name, S_IRUGO, display_show_name, NULL),
        __ATTR(type, S_IRUGO, display_show_type, NULL),
-       __ATTR(enable, S_IRUGO | /*S_IWUGO*/S_IWUSR, display_show_enable, display_store_enable),
+       __ATTR(enable, 0664, display_show_enable, display_store_enable),
        __ATTR(connect, S_IRUGO, display_show_connect, NULL),
        __ATTR(modes, S_IRUGO, display_show_modes, NULL),
-       __ATTR(mode, S_IRUGO | /*S_IWUGO*/S_IWUSR, display_show_mode, display_store_mode)
+       __ATTR(mode, 0664, display_show_mode, display_store_mode)
 };
 
 static int display_suspend(struct device *dev, pm_message_t state)
index bd06247ceec01a33fadcc3fe360abc56171ba4a8..6141e03bf5ddb844f149365ca7b7fb629cc59819 100755 (executable)
@@ -137,6 +137,7 @@ static void rk30_hdmi_config_phy(unsigned char vic)
        {
                case HDMI_1920x1080p_60Hz:
                case HDMI_1920x1080p_50Hz:
+               #if 0   
                        rk30_hdmi_config_phy_reg(0x158, 0x0E);
                        rk30_hdmi_config_phy_reg(0x15c, 0x00);
                        rk30_hdmi_config_phy_reg(0x160, 0x60);
@@ -144,8 +145,19 @@ static void rk30_hdmi_config_phy(unsigned char vic)
                        rk30_hdmi_config_phy_reg(0x168, 0xDA);
                        rk30_hdmi_config_phy_reg(0x16c, 0xA2);
                        rk30_hdmi_config_phy_reg(0x170, 0x0e);
-                       rk30_hdmi_config_phy_reg(0x174, 0x20);
+                       rk30_hdmi_config_phy_reg(0x174, 0x22);
+                       rk30_hdmi_config_phy_reg(0x178, 0x00);
+               #else   
+                       rk30_hdmi_config_phy_reg(0x158, 0x0E);
+                       rk30_hdmi_config_phy_reg(0x15c, 0x00);
+                       rk30_hdmi_config_phy_reg(0x160, 0x77);
+                       rk30_hdmi_config_phy_reg(0x164, 0x00);
+                       rk30_hdmi_config_phy_reg(0x168, 0xDA);
+                       rk30_hdmi_config_phy_reg(0x16c, 0xA1);
+                       rk30_hdmi_config_phy_reg(0x170, 0x06);
+                       rk30_hdmi_config_phy_reg(0x174, 0x22);
                        rk30_hdmi_config_phy_reg(0x178, 0x00);
+               #endif
                        break;
                        
                case HDMI_1920x1080i_60Hz:
@@ -366,7 +378,7 @@ int rk30_hdmi_config_audio(struct hdmi_audio *audio)
        //set_audio_if I2S
        HDMIWrReg(AUDIO_CTRL1, 0x00); //internal CTS, disable down sample, i2s input, disable MCLK
        HDMIWrReg(AUDIO_CTRL2, 0x40); 
-       HDMIWrReg(I2S_AUDIO_CTRL, v_I2S_MODE(I2S_MODE_STANDARD) | v_I2S_CHANNEL( (audio->channel + audio->channel%2)/2));       
+       HDMIWrReg(I2S_AUDIO_CTRL, v_I2S_MODE(I2S_MODE_STANDARD) | v_I2S_CHANNEL( audio->channel - ((audio->channel%2)? 0 : 1) ) );      
        HDMIWrReg(I2S_INPUT_SWAP, 0x00); //no swap
        HDMIMskReg(value, AV_CTRL1, m_AUDIO_SAMPLE_RATE, v_AUDIO_SAMPLE_RATE(rate))     
        HDMIWrReg(SRC_NUM_AUDIO_LEN, word_length);
index 1446baadfa3760f79de46c917fdff54bafb91216..df2c258f01066c20bcad46a9de35d5779ff8c78e 100755 (executable)
@@ -41,7 +41,7 @@ enum {
        I2S_CHANNEL_5_6 = 7,
        I2S_CHANNEL_7_8 = 0xf
 };
-#define v_I2S_CHANNEL(n)       ( n << 2 )
+#define v_I2S_CHANNEL(n)       ( (n) << 2 )
 
 #define I2S_INPUT_SWAP         0x40
 
@@ -203,6 +203,41 @@ enum {
 #define EXT_VIDEO_PARA_VDELAY          0xF8
 #define EXT_VIDEO_PARA_VSYNCWIDTH      0xFC
 
+#define PHY_PLL_SPEED                          0x158
+       #define v_TEST_EN(n)                    (n << 6)
+       #define v_PLLA_BYPASS(n)                (n << 4)
+       #define v_PLLB_SPEED(n)                 (n << 2)
+       #define v_PLLA_SPEED(n)                 (n)
+       enum {
+               PLL_SPEED_LOWEST = 0,
+               PLL_SPEED_MIDLOW,
+               PLL_SPEED_MIDHIGH,
+               PLL_SPEED_HIGHEST
+       };
+
+#define PHY_PLL_17                                     0x15c           // PLL A & B config bit 17
+       #define v_PLLA_BIT17(n)                 (n << 2)
+       #define v_PLLB_BIT17(n)                 (n << 1)
+       
+#define PHY_BGR                                                0x160
+       #define v_BGR_DISCONNECT(n)             (n << 7)
+       #define v_BGR_V_OFFSET(n)               (n << 4)
+       #define v_BGR_I_OFFSET(n)               (n)
+
+#define PHY_PLLA_1                                     0x164
+#define PHY_PLLA_2                                     0x168
+#define PHY_PLLB_1                                     0x16c
+#define PHY_PLLB_2                                     0x170
+
+#define PHY_DRIVER_PREEMPHASIS         0x174
+       #define v_TMDS_SWING(n)                 (n << 4)
+       #define v_PRE_EMPHASIS(n)               (n)
+       
+#define PHY_PLL_16_AML                         0x178           // PLL A & B config bit 16 and AML control
+       #define v_PLLA_BIT16(n)                 (n << 5)
+       #define v_PLLB_BIT16(n)                 (n << 4)
+       #define v_AML(n)                                (n)
+
 #define INTR_MASK1                                     0x248
 #define INTR_MASK2                                     0x24c
 #define INTR_MASK3                                     0x258
index 6ca348f50de3439b908b491225b4fb4a61c04ddb..391ee1e3994525839537715e01485bc71de91f05 100755 (executable)
@@ -505,7 +505,7 @@ int hdmi_switch_fb(struct hdmi *hdmi, int vic)
        if(rc == 0 &&  hdmi->lcdc->load_screen) {
                
                hdmi->lcdc->load_screen(hdmi->lcdc, 0);
-               par = &dev_drv->layer_par[1];
+               par = dev_drv->layer_par[1];
                par->xsize = screen->x_res;
        par->ysize = screen->y_res;
                hdmi->lcdc->set_par(hdmi->lcdc, 1);
index 7c2061bc8bf426a80e0973ae94fbb1f6fcbbbc1e..cd206320086aa915da3a6567d4072901a9155872 100755 (executable)
@@ -1,6 +1,7 @@
 #include <linux/ctype.h>
 #include <linux/string.h>
 #include <linux/display-sys.h>
+#include <linux/interrupt.h>
 #include "rk30_hdmi.h"
 
 static int hdmi_get_enable(struct rk_display_device *device)
@@ -14,11 +15,16 @@ static int hdmi_set_enable(struct rk_display_device *device, int enable)
 {
        struct hdmi *hdmi = device->priv_data;
        
-//     if(hdmi->enable == enable)
-//             return 0;
-//     hdmi->enable = enable;
-//     hdmi->command = HDMI_CONFIG_DISPLAY;
-//     queue_delayed_work(hdmi->workqueue, &hdmi->delay_work, 0);
+       if(hdmi->enable == enable)
+               return 0;
+       hdmi->enable = enable;
+       if(enable == 0) {
+               disable_irq(hdmi->irq);
+               hdmi->command = HDMI_CONFIG_ENABLE;
+               queue_delayed_work(hdmi->workqueue, &hdmi->delay_work, 0);
+       }
+       else
+               enable_irq(hdmi->irq);
        return 0;
 }
 
index d60cb586bc38c0b1d4c229b20cb57e0c3eb4f940..383935f63755d60cd4fba4e826d5c6ab2e8eae51 100755 (executable)
@@ -55,6 +55,8 @@ int hdmi_sys_init(void)
        hdmi->audio.rate                = HDMI_AUDIO_DEFAULT_RATE;
        hdmi->audio.word_length = HDMI_AUDIO_DEFAULT_WORD_LENGTH;
        
+       memset(&hdmi->edid, 0, sizeof(struct hdmi_edid));
+       INIT_LIST_HEAD(&hdmi->edid.modelist);
        return 0;
 }
 
@@ -142,19 +144,23 @@ void hdmi_work(struct work_struct *work)
        
        hotplug = rk30_hdmi_detect_hotplug();
        hdmi_dbg(hdmi->dev, "[%s] hotplug %02x curvalue %d\n", __FUNCTION__, hotplug, hdmi->hotplug);
-       if(hotplug != hdmi->hotplug)
-       {
-               hdmi->hotplug  = hotplug;
-               if(hdmi->hotplug  == HDMI_HPD_INSERT)
-                       hdmi->state = READ_PARSE_EDID;
-               else {
+       
+       if(hotplug == HDMI_HPD_REMOVED) {
                        hdmi_sys_remove();
+               if(hotplug != hdmi->hotplug) {
+                       hdmi->hotplug  = hotplug;
                        kobject_uevent_env(&hdmi->dev->kobj, KOBJ_REMOVE, envp);
+               }
+               if(hdmi->wait == 1) {   
+                       complete(&hdmi->complete);
+                       hdmi->wait = 0;                                         
+               }
                        return;
                }                       
+       else if(hotplug != hdmi->hotplug) {     
+               hdmi->hotplug  = hotplug;
+               hdmi->state = READ_PARSE_EDID;
        }
-       else if(hotplug == HDMI_HPD_REMOVED)
-               rk30_hdmi_removed();
        
        do {
                state_last = hdmi->state;