From: zwl Date: Mon, 10 Feb 2014 14:11:43 +0000 (+0800) Subject: 1.optimize the 'hdmi' global variables 2.fix some compile error X-Git-Tag: firefly_0821_release~6342 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=2ffcdebe6d71b6d89422d7b5ac66e0823a4a65b6;p=firefly-linux-kernel-4.4.55.git 1.optimize the 'hdmi' global variables 2.fix some compile error --- diff --git a/arch/arm/boot/dts/rk616.dtsi b/arch/arm/boot/dts/rk616.dtsi index 220e3640f625..87c06c330264 100644 --- a/arch/arm/boot/dts/rk616.dtsi +++ b/arch/arm/boot/dts/rk616.dtsi @@ -4,30 +4,30 @@ compatible = "rockchip,rk616"; #address-cells = <1>; - #size-cells = <1>; + #size-cells = <1>; rk616,scl_rate = <100000>; rk616,lcd0_func = ; rk616,lcd1_func = ; rk616,lvds_ch_nr = <1>; - + hdmi: hdmi{ - compatible = "rk616,rk616-hdmi"; + compatible = "rockchip,rk616-hdmi"; reg = <0x0400,0x0400>; }; - + codec: codec{ - compatible = "rk616,rk616-code"; + compatible = "rockchip,rk616-code"; reg = <0x0800,0x0400>; }; - + mipi: mipi-pyh{ - compatible = "rk616,mipi-phy"; + compatible = "rockchip,rk616-mipi-phy"; reg = <0x0c00,0x0400>; }; - + mipi: mipi-ctrl{ - compatible = "rk616,mipi-ctrl"; + compatible = "rockchip,rk616-mipi-ctrl"; reg = <0x1000,0x0400>; }; }; diff --git a/drivers/video/rockchip/hdmi/chips/cat66121/cat66121_hdmi.c b/drivers/video/rockchip/hdmi/chips/cat66121/cat66121_hdmi.c index 2322a8d058a7..0ff54a0956f3 100755 --- a/drivers/video/rockchip/hdmi/chips/cat66121/cat66121_hdmi.c +++ b/drivers/video/rockchip/hdmi/chips/cat66121/cat66121_hdmi.c @@ -20,7 +20,7 @@ struct cat66121_hdmi_pdata *cat66121_hdmi = NULL; struct hdmi *hdmi=NULL; -extern struct rk_lcdc_device_driver * rk_get_lcdc_drv(char *name); +extern struct rk_lcdc_driver * rk_get_lcdc_drv(char *name); extern void hdmi_register_display_sysfs(struct hdmi *hdmi, struct device *parent); extern void hdmi_unregister_display_sysfs(struct hdmi *hdmi); static void cat66121_irq_work_func(struct work_struct *work); diff --git a/drivers/video/rockchip/hdmi/chips/rk2928/rk2928_hdmi.c b/drivers/video/rockchip/hdmi/chips/rk2928/rk2928_hdmi.c index 9c698e7b9ada..ac8e70b3fb74 100755 --- a/drivers/video/rockchip/hdmi/chips/rk2928/rk2928_hdmi.c +++ b/drivers/video/rockchip/hdmi/chips/rk2928/rk2928_hdmi.c @@ -23,7 +23,7 @@ struct hdmi *hdmi = NULL; extern irqreturn_t hdmi_irq(int irq, void *priv); extern void hdmi_work(struct work_struct *work); -extern struct rk_lcdc_device_driver * rk_get_lcdc_drv(char *name); +extern struct rk_lcdc_driver * rk_get_lcdc_drv(char *name); extern void hdmi_register_display_sysfs(struct hdmi *hdmi, struct device *parent); extern void hdmi_unregister_display_sysfs(struct hdmi *hdmi); diff --git a/drivers/video/rockchip/hdmi/chips/rk30/rk30_hdmi.c b/drivers/video/rockchip/hdmi/chips/rk30/rk30_hdmi.c index a33f7e65468e..85d68db20346 100755 --- a/drivers/video/rockchip/hdmi/chips/rk30/rk30_hdmi.c +++ b/drivers/video/rockchip/hdmi/chips/rk30/rk30_hdmi.c @@ -23,7 +23,7 @@ struct hdmi *hdmi = NULL; extern irqreturn_t hdmi_irq(int irq, void *priv); extern void hdmi_work(struct work_struct *work); -extern struct rk_lcdc_device_driver * rk_get_lcdc_drv(char *name); +extern struct rk_lcdc_driver * rk_get_lcdc_drv(char *name); extern void hdmi_register_display_sysfs(struct hdmi *hdmi, struct device *parent); extern void hdmi_unregister_display_sysfs(struct hdmi *hdmi); diff --git a/drivers/video/rockchip/hdmi/chips/rk610/rk610_hdmi.c b/drivers/video/rockchip/hdmi/chips/rk610/rk610_hdmi.c index d012adc54c53..8952b399216b 100755 --- a/drivers/video/rockchip/hdmi/chips/rk610/rk610_hdmi.c +++ b/drivers/video/rockchip/hdmi/chips/rk610/rk610_hdmi.c @@ -11,7 +11,7 @@ struct rk610_hdmi_pdata *rk610_hdmi = NULL; struct hdmi *hdmi=NULL; -extern struct rk_lcdc_device_driver * rk_get_lcdc_drv(char *name); +extern struct rk_lcdc_driver * rk_get_lcdc_drv(char *name); extern void hdmi_register_display_sysfs(struct hdmi *hdmi, struct device *parent); extern void hdmi_unregister_display_sysfs(struct hdmi *hdmi); diff --git a/drivers/video/rockchip/hdmi/chips/rk616/rk616_hdmi.c b/drivers/video/rockchip/hdmi/chips/rk616/rk616_hdmi.c index 5f7bda57d0d9..0ba6661d69e8 100755 --- a/drivers/video/rockchip/hdmi/chips/rk616/rk616_hdmi.c +++ b/drivers/video/rockchip/hdmi/chips/rk616/rk616_hdmi.c @@ -13,10 +13,10 @@ #include #include -#include -#include -#include -#include +//#include +//#include +#include +//#include #include #if defined(CONFIG_DEBUG_FS) @@ -145,11 +145,11 @@ static void hdmi_early_resume(struct early_suspend *h) mutex_lock(&hdmi->enable_mutex); hdmi->suspend = 0; - rk616_hdmi_initial(); + rk616_hdmi_initial(hdmi); if(hdmi->enable && hdmi->irq) { enable_irq(hdmi->irq); // hdmi_irq(); - rk616_hdmi_work(); + rk616_hdmi_work(hdmi); } if (rk616_hdmi->rk616_drv && rk616_hdmi->rk616_drv->pdata->hdmi_irq == INVALID_GPIO) queue_delayed_work(hdmi->workqueue, &rk616_hdmi->rk616_delay_work, 100); @@ -167,7 +167,7 @@ static void rk616_delay_work_func(struct work_struct *work) if(hdmi->suspend == 0) { if(hdmi->enable == 1) { //hdmi_irq(); - rk616_hdmi_work(); + rk616_hdmi_work(hdmi); } if (rk616_hdmi->rk616_drv && rk616_hdmi->rk616_drv->pdata->hdmi_irq == INVALID_GPIO) { @@ -179,7 +179,7 @@ static void rk616_delay_work_func(struct work_struct *work) static void __maybe_unused rk616_irq_work_func(struct work_struct *work) { if((hdmi->suspend == 0) && (hdmi->enable == 1)) { - rk616_hdmi_work(); + rk616_hdmi_work(hdmi); } dev_info(hdmi->dev, "func: %s, enable_irq\n", __func__); enable_irq(hdmi->irq); @@ -199,13 +199,13 @@ static irqreturn_t rk616_hdmi_irq(int irq, void *dev_id) /* 3028a hdmi */ if((hdmi->suspend == 0) && (hdmi->enable == 1)) { printk(KERN_INFO "line = %d, rk616_hdmi_irq irq triggered.\n", __LINE__); - rk616_hdmi_work(); + rk616_hdmi_work(hdmi); } } return IRQ_HANDLED; } -static int __devinit rk616_hdmi_probe (struct platform_device *pdev) +static int rk616_hdmi_probe(struct platform_device *pdev) { int ret; struct rk616_hdmi *rk616_hdmi; @@ -250,7 +250,7 @@ static int __devinit rk616_hdmi_probe (struct platform_device *pdev) hdmi->yscale = 100; - hdmi_sys_init(); + hdmi_sys_init(hdmi); hdmi->workqueue = create_singlethread_workqueue("hdmi"); INIT_DELAYED_WORK(&(hdmi->delay_work), hdmi_work); @@ -314,7 +314,7 @@ static int __devinit rk616_hdmi_probe (struct platform_device *pdev) iomux_set(HDMI_DDCSCL); iomux_set(HDMI_HOTPLUGIN); - ret = rk616_hdmi_initial(); + ret = rk616_hdmi_initial(hdmi); /* get the IRQ */ hdmi->irq = platform_get_irq(pdev, 0); if(hdmi->irq <= 0) { @@ -329,7 +329,7 @@ static int __devinit rk616_hdmi_probe (struct platform_device *pdev) } } #else - ret = rk616_hdmi_initial(); + ret = rk616_hdmi_initial(hdmi); if(rk616_hdmi->rk616_drv->pdata->hdmi_irq != INVALID_GPIO) { INIT_WORK(&rk616_hdmi->rk616_irq_work_struct, rk616_irq_work_func); ret = gpio_request(rk616_hdmi->rk616_drv->pdata->hdmi_irq,"rk616_hdmi_irq"); @@ -389,7 +389,7 @@ err0: return ret; } -static int __devexit rk616_hdmi_remove(struct platform_device *pdev) +static int rk616_hdmi_remove(struct platform_device *pdev) { if(hdmi) { mutex_lock(&hdmi->enable_mutex); @@ -455,7 +455,7 @@ MODULE_DEVICE_TABLE(of, rk616_hdmi_of_match); static struct platform_driver rk616_hdmi_driver = { .probe = rk616_hdmi_probe, - .remove = __devexit_p(rk616_hdmi_remove), + .remove = rk616_hdmi_remove, .driver = { #ifdef CONFIG_ARCH_RK3026 .name = "rk3026-hdmi", diff --git a/drivers/video/rockchip/hdmi/chips/rk616/rk616_hdmi.h b/drivers/video/rockchip/hdmi/chips/rk616/rk616_hdmi.h index 2d033fa6f330..8c4702d2ffc7 100755 --- a/drivers/video/rockchip/hdmi/chips/rk616/rk616_hdmi.h +++ b/drivers/video/rockchip/hdmi/chips/rk616/rk616_hdmi.h @@ -20,7 +20,7 @@ enum{ #define HDMI_CODEC_SOURCE_SELECT INPUT_IIS #endif -extern void rk616_hdmi_control_output(int enable); +extern void rk616_hdmi_control_output(struct hdmi *hdmi, int enable); extern int rk616_hdmi_register_hdcp_callbacks(void (*hdcp_cb)(void), void (*hdcp_irq_cb)(int status), int (*hdcp_power_on_cb)(void), diff --git a/drivers/video/rockchip/hdmi/chips/rk616/rk616_hdmi_hw.c b/drivers/video/rockchip/hdmi/chips/rk616/rk616_hdmi_hw.c index 31329551f0ef..13b973223748 100755 --- a/drivers/video/rockchip/hdmi/chips/rk616/rk616_hdmi_hw.c +++ b/drivers/video/rockchip/hdmi/chips/rk616/rk616_hdmi_hw.c @@ -1,9 +1,10 @@ #include #include -#include +//#include +#include #include "rk616_hdmi.h" #include "rk616_hdmi_hw.h" -#include +//#include // static char edid_result = 0; @@ -42,7 +43,7 @@ static int rk616_set_polarity(struct mfd_rk616 * rk616, int vic) return ret; } -static int rk616_hdmi_set_vif(rk_screen * screen,bool connect) +static int rk616_hdmi_set_vif(struct hdmi *hdmi, struct rk_screen *screen, bool connect) { struct rk616_hdmi *rk616_hdmi; rk616_hdmi = container_of(hdmi, struct rk616_hdmi, g_hdmi); @@ -91,7 +92,7 @@ static void rk616_hdmi_sys_power_down(void) } -static void rk616_hdmi_set_pwr_mode(int mode) +static void rk616_hdmi_set_pwr_mode(struct hdmi *hdmi, int mode) { if(hdmi->pwr_mode == mode) return; @@ -134,7 +135,7 @@ static void rk616_hdmi_set_pwr_mode(int mode) } -int rk616_hdmi_detect_hotplug(void) +int rk616_hdmi_detect_hotplug(struct hdmi *hdmi) { int value = 0; #if 0 @@ -156,7 +157,7 @@ int rk616_hdmi_detect_hotplug(void) } -int rk616_hdmi_read_edid(int block, u8 * buf) +int rk616_hdmi_read_edid(struct hdmi *hdmi, int block, u8 * buf) { u32 c = 0; u8 Segment = 0; @@ -274,7 +275,7 @@ static void rk616_hdmi_config_avi(unsigned char vic, unsigned char output_color) } -static int rk616_hdmi_config_video(struct hdmi_video_para *vpara) +static int rk616_hdmi_config_video(struct hdmi *hdmi, struct hdmi_video_para *vpara) { int value; struct fb_videomode *mode; @@ -289,7 +290,7 @@ static int rk616_hdmi_config_video(struct hdmi_video_para *vpara) } if(hdmi->pwr_mode == LOWER_PWR) { - rk616_hdmi_set_pwr_mode(NORMAL); + rk616_hdmi_set_pwr_mode(hdmi, NORMAL); } @@ -301,7 +302,7 @@ static int rk616_hdmi_config_video(struct hdmi_video_para *vpara) // Input video mode is SDR RGB24bit, Data enable signal from external hdmi_writel(VIDEO_CONTRL1, v_VIDEO_INPUT_FORMAT(VIDEO_INPUT_SDR_RGB444) | v_DE_EXTERNAL); - hdmi_writel(VIDEO_CONTRL2, v_VIDEO_INPUT_BITS(VIDEO_INPUT_8BITS) | (vpara->output_color & 0xFF)); + hdmi_writel(VIDEO_CONTRL2, v_VIDEO_INPUT_BITS(VIDEO_INPUT_8BITS) | v_VIDEO_OUTPUT_FORMAT(vpara->output_color & 0xFF)); // Set HDMI Mode hdmi_writel(HDCP_CTRL, v_HDMI_DVI(vpara->output_mode)); @@ -408,7 +409,7 @@ static void rk616_hdmi_config_aai(void) hdmi_writel(CONTROL_PACKET_ADDR + i, info[i]); } -static int rk616_hdmi_config_audio(struct hdmi_audio *audio) +static int rk616_hdmi_config_audio(struct hdmi *hdmi, struct hdmi_audio *audio) { int rate, N, channel, mclk_fs; @@ -484,13 +485,13 @@ static int rk616_hdmi_config_audio(struct hdmi_audio *audio) return 0; } -void rk616_hdmi_control_output(int enable) +void rk616_hdmi_control_output(struct hdmi *hdmi, int enable) { int mutestatus = 0; if(enable) { if(hdmi->pwr_mode == LOWER_PWR) - rk616_hdmi_set_pwr_mode(NORMAL); + rk616_hdmi_set_pwr_mode(hdmi, NORMAL); hdmi_readl(AV_MUTE,&mutestatus); if(mutestatus && (m_AUDIO_MUTE | m_VIDEO_BLACK)) { hdmi_writel(AV_MUTE, v_AUDIO_MUTE(0) | v_VIDEO_MUTE(0)); @@ -507,17 +508,17 @@ void rk616_hdmi_control_output(int enable) } } -int rk616_hdmi_removed(void) +int rk616_hdmi_removed(struct hdmi *hdmi) { dev_printk(KERN_INFO , hdmi->dev , "Removed.\n"); - rk616_hdmi_set_pwr_mode(LOWER_PWR); + rk616_hdmi_set_pwr_mode(hdmi, LOWER_PWR); return HDMI_ERROR_SUCESS; } -void rk616_hdmi_work(void) +void rk616_hdmi_work(struct hdmi *hdmi) { u32 interrupt = 0; // int value = 0; @@ -541,7 +542,7 @@ void rk616_hdmi_work(void) #if 0 if(hdmi->state == HDMI_SLEEP) { // hdmi_dbg(hdmi->dev, "hdmi return to sleep mode\n"); - rk616_hdmi_set_pwr_mode(LOWER_PWR); + rk616_hdmi_set_pwr_mode(hdmi, LOWER_PWR); } #endif #if 0 @@ -550,7 +551,7 @@ void rk616_hdmi_work(void) #endif } -static void rk616_hdmi_reset(void) +static void rk616_hdmi_reset(struct hdmi *hdmi) { u32 val = 0; u32 msk = 0; @@ -563,10 +564,10 @@ static void rk616_hdmi_reset(void) val = v_REG_CLK_INV | v_REG_CLK_SOURCE_SYS | v_PWR_ON |v_INT_POL_HIGH; hdmi_msk_reg(SYS_CTRL,msk,val); hdmi_writel(INTERRUPT_MASK1,m_INT_HOTPLUG); - rk616_hdmi_set_pwr_mode(LOWER_PWR); + rk616_hdmi_set_pwr_mode(hdmi, LOWER_PWR); } -int rk616_hdmi_initial(void) +int rk616_hdmi_initial(struct hdmi *hdmi) { int rc = HDMI_ERROR_SUCESS; struct rk616_hdmi *rk616_hdmi; @@ -582,10 +583,10 @@ int rk616_hdmi_initial(void) #ifdef CONFIG_ARCH_RK3026 rk3028_hdmi_reset_pclk(); - rk616_hdmi_reset(); + rk616_hdmi_reset(hdmi); #else hdmi->set_vif = rk616_hdmi_set_vif; - rk616_hdmi_reset(); + rk616_hdmi_reset(hdmi); rk616_hdmi_init_pol_set(rk616_hdmi->rk616_drv, 0); #endif diff --git a/drivers/video/rockchip/hdmi/chips/rk616/rk616_hdmi_hw.h b/drivers/video/rockchip/hdmi/chips/rk616/rk616_hdmi_hw.h index c998933c0bb3..082f92243db1 100755 --- a/drivers/video/rockchip/hdmi/chips/rk616/rk616_hdmi_hw.h +++ b/drivers/video/rockchip/hdmi/chips/rk616/rk616_hdmi_hw.h @@ -285,6 +285,7 @@ enum { #define PHY_PRE_DIV_RATIO 0xed #define v_PRE_DIV_RATIO(n) (n&1f) +extern struct hdmi *hdmi; #ifndef CONFIG_ARCH_RK3026 static inline int hdmi_readl(u16 offset, u32 *val) { @@ -347,8 +348,8 @@ static inline void rk3028_hdmi_reset_pclk(void) } #endif -extern int rk616_hdmi_initial(void); -extern void rk616_hdmi_work(void); +extern int rk616_hdmi_initial(struct hdmi *hdmi); +extern void rk616_hdmi_work(struct hdmi *hdmi); #endif diff --git a/drivers/video/rockchip/hdmi/rk_hdmi.h b/drivers/video/rockchip/hdmi/rk_hdmi.h index 5f50cdf9d3fa..6a41e550d19d 100755 --- a/drivers/video/rockchip/hdmi/rk_hdmi.h +++ b/drivers/video/rockchip/hdmi/rk_hdmi.h @@ -259,7 +259,7 @@ struct hdmi { int irq; int regbase_phy; int regsize_phy; - struct rk_lcdc_device_driver *lcdc; + struct rk_lcdc_driver *lcdc; #ifdef CONFIG_SWITCH struct switch_dev switch_hdmi; @@ -294,15 +294,15 @@ struct hdmi { int yscale; // y directoon scale value int tmdsclk; // TDMS Clock frequency - int (*insert)(void); - int (*remove)(void); - void (*control_output)(int enable); - int (*config_video)(struct hdmi_video_para *vpara); - int (*config_audio)(struct hdmi_audio *audio); - int (*detect_hotplug)(void); + int (*insert)(struct hdmi *hdmi); + int (*remove)(struct hdmi *hdmi); + void (*control_output)(struct hdmi *hdmi, int enable); + int (*config_video)(struct hdmi *hdmi, struct hdmi_video_para *vpara); + int (*config_audio)(struct hdmi *hdmi, struct hdmi_audio *audio); + int (*detect_hotplug)(struct hdmi *hdmi); // call back for edid - int (*read_edid)(int block, unsigned char *buff); - int (*set_vif)(rk_screen * screen,bool connect); + int (*read_edid)(struct hdmi *hdmi, int block, unsigned char *buff); + int (*set_vif)(struct hdmi *hdmi, struct rk_screen *screen, bool connect); // call back for hdcp operatoion void (*hdcp_cb)(void); @@ -321,11 +321,11 @@ struct hdmi { #define hdmi_dbg(dev, format, arg...) #endif -extern struct hdmi *hdmi; +//extern struct hdmi *hdmi; extern int hdmi_get_hotplug(void); -extern int hdmi_set_info(struct rk29fb_screen *screen, unsigned int vic); -extern void hdmi_init_lcdc(struct rk29fb_screen *screen, struct rk29lcd_info *lcd_info); -extern int hdmi_sys_init(void); +extern int hdmi_set_info(struct rk_screen *screen, unsigned int vic); +extern void hdmi_init_lcdc(struct rk_screen *screen, struct rk29lcd_info *lcd_info); +extern int hdmi_sys_init(struct hdmi *hdmi); extern int hdmi_sys_parse_edid(struct hdmi* hdmi); extern const char *hdmi_get_video_mode_name(unsigned char vic); extern int hdmi_videomode_to_vic(struct fb_videomode *vmode); diff --git a/drivers/video/rockchip/hdmi/rk_hdmi_edid.c b/drivers/video/rockchip/hdmi/rk_hdmi_edid.c index 2ffc745aefbd..31ca48b7bbab 100755 --- a/drivers/video/rockchip/hdmi/rk_hdmi_edid.c +++ b/drivers/video/rockchip/hdmi/rk_hdmi_edid.c @@ -374,7 +374,7 @@ int hdmi_sys_parse_edid(struct hdmi* hdmi) } // Read base block edid. memset(buff, 0 , HDMI_EDID_BLOCK_SIZE); - rc = hdmi->read_edid(0, buff); + rc = hdmi->read_edid(hdmi, 0, buff); if(rc) { dev_err(hdmi->dev, "[HDMI] read edid base block error\n"); @@ -389,7 +389,7 @@ int hdmi_sys_parse_edid(struct hdmi* hdmi) for(i = 1; i < extendblock + 1; i++) { memset(buff, 0 , HDMI_EDID_BLOCK_SIZE); - rc = hdmi->read_edid(i, buff); + rc = hdmi->read_edid(hdmi, i, buff); if(rc) { printk("[HDMI] read edid block %d error\n", i); diff --git a/drivers/video/rockchip/hdmi/rk_hdmi_lcdc.c b/drivers/video/rockchip/hdmi/rk_hdmi_lcdc.c index a9c09bcdf664..7fe7787bccb0 100755 --- a/drivers/video/rockchip/hdmi/rk_hdmi_lcdc.c +++ b/drivers/video/rockchip/hdmi/rk_hdmi_lcdc.c @@ -61,12 +61,12 @@ static const struct fb_videomode hdmi_mode [] = { }; -void hdmi_init_lcdc(struct rk29fb_screen *screen, struct rk29lcd_info *lcd_info) +void hdmi_init_lcdc(struct rk_screen *screen, struct rk29lcd_info *lcd_info) { hdmi_set_info(screen, HDMI_VIDEO_DEFAULT_MODE); } -int hdmi_set_info(struct rk29fb_screen *screen, unsigned int vic) +int hdmi_set_info(struct rk_screen *screen, unsigned int vic) { int i; @@ -84,26 +84,26 @@ int hdmi_set_info(struct rk29fb_screen *screen, unsigned int vic) if(i == ARRAY_SIZE(hdmi_mode)) return -1; - memset(screen, 0, sizeof(struct rk29fb_screen)); + memset(screen, 0, sizeof(struct rk_screen)); /* screen type & face */ screen->type = OUT_TYPE; screen->face = OUT_FACE; /* Screen size */ - screen->x_res = hdmi_mode[i].xres; - screen->y_res = hdmi_mode[i].yres; + screen->mode.xres = hdmi_mode[i].xres; + screen->mode.yres = hdmi_mode[i].yres; /* Timing */ - screen->pixclock = hdmi_mode[i].pixclock; - screen->fps = hdmi_mode[i].refresh; - screen->lcdc_aclk = LCD_ACLK; - screen->left_margin = hdmi_mode[i].left_margin; - screen->right_margin = hdmi_mode[i].right_margin; - screen->hsync_len = hdmi_mode[i].hsync_len; - screen->upper_margin = hdmi_mode[i].upper_margin; - screen->lower_margin = hdmi_mode[i].lower_margin; - screen->vsync_len = hdmi_mode[i].vsync_len; + screen->mode.pixclock = hdmi_mode[i].pixclock; + screen->mode.refresh = hdmi_mode[i].refresh; + //screen->lcdc_aclk = LCD_ACLK; + screen->mode.left_margin = hdmi_mode[i].left_margin; + screen->mode.right_margin = hdmi_mode[i].right_margin; + screen->mode.hsync_len = hdmi_mode[i].hsync_len; + screen->mode.upper_margin = hdmi_mode[i].upper_margin; + screen->mode.lower_margin = hdmi_mode[i].lower_margin; + screen->mode.vsync_len = hdmi_mode[i].vsync_len; screen->hdmi_resolution = hdmi_mode[i].flag; /* Pin polarity */ @@ -503,10 +503,10 @@ const char *hdmi_get_video_mode_name(unsigned char vic) int hdmi_switch_fb(struct hdmi *hdmi, int vic) { int rc = 0; - rk_screen *screen; + struct rk_screen *screen; - screen = kzalloc(sizeof(struct rk29fb_screen), GFP_KERNEL); + screen = kzalloc(sizeof(struct rk_screen), GFP_KERNEL); if(screen == NULL) return -1; @@ -518,11 +518,11 @@ int hdmi_switch_fb(struct hdmi *hdmi, int vic) if(rc == 0) { if(hdmi->set_vif) - hdmi->set_vif(screen,0); //turn off vif for jettab + hdmi->set_vif(hdmi,screen,0); //turn off vif for jettab rk_fb_switch_screen(screen, 1, hdmi->lcdc->id); rk_fb_disp_scale(hdmi->xscale, hdmi->yscale, hdmi->lcdc->id); if(hdmi->set_vif) - hdmi->set_vif(screen,1); + hdmi->set_vif(hdmi,screen,1); } @@ -537,6 +537,7 @@ int hdmi_switch_fb(struct hdmi *hdmi, int vic) * NOTES: * */ +extern struct hdmi *hdmi; int hdmi_get_hotplug(void) { if(hdmi) diff --git a/drivers/video/rockchip/hdmi/rk_hdmi_task.c b/drivers/video/rockchip/hdmi/rk_hdmi_task.c index 34b0f1179202..6b4bb599146e 100755 --- a/drivers/video/rockchip/hdmi/rk_hdmi_task.c +++ b/drivers/video/rockchip/hdmi/rk_hdmi_task.c @@ -1,5 +1,6 @@ #include #include +#include #include "rk_hdmi.h" #ifdef CONFIG_RK_HDMI_CTL_CODEC @@ -23,9 +24,9 @@ static char *envp[] = {"INTERFACE=HDMI", NULL}; -static void hdmi_sys_show_state(int state) +static void hdmi_sys_show_state(struct hdmi *hdmi) { - switch(state) + switch(hdmi->state) { case HDMI_SLEEP: hdmi_dbg(hdmi->dev, "HDMI_SLEEP\n"); @@ -60,7 +61,7 @@ static void hdmi_sys_show_state(int state) } } -int hdmi_sys_init(void) +int hdmi_sys_init(struct hdmi *hdmi) { hdmi->hotplug = HDMI_HPD_REMOVED; hdmi->state = HDMI_SLEEP; @@ -78,7 +79,7 @@ int hdmi_sys_init(void) return 0; } -void hdmi_sys_remove(void) +void hdmi_sys_remove(struct hdmi *hdmi) { int audio_need; @@ -97,7 +98,7 @@ void hdmi_sys_remove(void) INIT_LIST_HEAD(&hdmi->edid.modelist); hdmi->display = HDMI_DISABLE; if(hdmi->set_vif) - hdmi->set_vif(hdmi->lcdc->screen1,0); + hdmi->set_vif(hdmi,hdmi->lcdc->screen1,0); rk_fb_switch_screen(hdmi->lcdc->screen1, 0, hdmi->lcdc->id); kobject_uevent_env(&hdmi->dev->kobj, KOBJ_REMOVE, envp); @@ -122,19 +123,19 @@ void hdmi_sys_remove(void) #endif } -static void hdmi_sys_sleep(void) +static void hdmi_sys_sleep(struct hdmi *hdmi) { mutex_lock(&hdmi->enable_mutex); if(hdmi->enable && hdmi->irq) disable_irq(hdmi->irq); hdmi->state = HDMI_SLEEP; - hdmi->remove(); + hdmi->remove(hdmi); if(hdmi->enable && hdmi->irq) enable_irq(hdmi->irq); mutex_unlock(&hdmi->enable_mutex); } -static int hdmi_process_command(void) +static int hdmi_process_command(struct hdmi *hdmi) { int change, state = hdmi->state; @@ -150,10 +151,10 @@ static int hdmi_process_command(void) if(!hdmi->enable || hdmi->suspend) { if(hdmi->hotplug == HDMI_HPD_ACTIVED) - hdmi_sys_remove(); + hdmi_sys_remove(hdmi); hdmi->state = HDMI_SLEEP; hdmi->hotplug = HDMI_HPD_REMOVED; - hdmi->remove(); + hdmi->remove(hdmi); state = HDMI_SLEEP; } mutex_unlock(&hdmi->enable_mutex); @@ -200,33 +201,35 @@ void hdmi_work(struct work_struct *work) int hotplug, state_last; int rc = HDMI_ERROR_SUCESS, trytimes = 0; struct hdmi_video_para video; + struct delayed_work *delay_work = container_of(work, struct delayed_work, work); + struct hdmi *hdmi = container_of(delay_work, struct hdmi, delay_work); mutex_lock(&work_mutex); /* Process hdmi command */ - hdmi->state = hdmi_process_command(); + hdmi->state = hdmi_process_command(hdmi); if(!hdmi->enable || hdmi->suspend) { mutex_unlock(&work_mutex); return; } - hotplug = hdmi->detect_hotplug(); + hotplug = hdmi->detect_hotplug(hdmi); hdmi_dbg(hdmi->dev, "[%s] hotplug %02x curvalue %d\n", __FUNCTION__, hotplug, hdmi->hotplug); if(hotplug != hdmi->hotplug) { if(hotplug == HDMI_HPD_ACTIVED){ if(hdmi->insert) - hdmi->insert(); + hdmi->insert(hdmi); hdmi->state = READ_PARSE_EDID; } else if(hdmi->hotplug == HDMI_HPD_ACTIVED) { - hdmi_sys_remove(); + hdmi_sys_remove(hdmi); hdmi->hotplug = hotplug; if(hotplug == HDMI_HPD_REMOVED) - hdmi_sys_sleep(); + hdmi_sys_sleep(hdmi); else { hdmi->state = WAIT_HOTPLUG; - hdmi->remove(); + hdmi->remove(hdmi); } if(hdmi->wait == 1) { complete(&hdmi->complete); @@ -237,15 +240,15 @@ void hdmi_work(struct work_struct *work) } else if(hotplug == HDMI_HPD_REMOVED) { hdmi->state = HDMI_SLEEP; - hdmi->remove(); + hdmi->remove(hdmi); } hdmi->hotplug = hotplug; } else if(hotplug == HDMI_HPD_REMOVED) - hdmi_sys_sleep(); + hdmi_sys_sleep(hdmi); do { - hdmi_sys_show_state(hdmi->state); + hdmi_sys_show_state(hdmi); state_last = hdmi->state; switch(hdmi->state) { @@ -279,7 +282,7 @@ void hdmi_work(struct work_struct *work) break; case SYSTEM_CONFIG: #ifdef CONFIG_HDMI_RK616 - hdmi->remove(); + hdmi->remove(hdmi); #endif if(hdmi->autoconfig) hdmi->vic = hdmi_find_best_mode(hdmi, 0); @@ -306,7 +309,7 @@ void hdmi_work(struct work_struct *work) if(hdmi->edid.sink_hdmi == 0) video.output_color = VIDEO_OUTPUT_RGB444; - rc = hdmi->config_video(&video); + rc = hdmi->config_video(hdmi, &video); if(rc == HDMI_ERROR_SUCESS) { if(hdmi->edid.sink_hdmi) @@ -316,14 +319,14 @@ void hdmi_work(struct work_struct *work) } break; case CONFIG_AUDIO: - rc = hdmi->config_audio(&(hdmi->audio)); + rc = hdmi->config_audio(hdmi, &(hdmi->audio)); if(rc == HDMI_ERROR_SUCESS) hdmi->state = PLAY_BACK; break; case PLAY_BACK: if(hdmi->display != HDMI_ENABLE) { - hdmi->control_output(HDMI_ENABLE); + hdmi->control_output(hdmi, HDMI_ENABLE); hdmi->display = HDMI_ENABLE; if(hdmi->hdcp_cb) { hdmi->hdcp_cb(); diff --git a/drivers/video/rockchip/rk_fb.c b/drivers/video/rockchip/rk_fb.c index 08743b8ff2c4..b80e6a376e54 100755 --- a/drivers/video/rockchip/rk_fb.c +++ b/drivers/video/rockchip/rk_fb.c @@ -764,6 +764,7 @@ static int rk_fb_blank(int blank_mode, struct fb_info *info) struct rk_lcdc_driver *dev_drv = (struct rk_lcdc_driver *)info->par; struct fb_fix_screeninfo *fix = &info->fix; int win_id; + struct rk_fb *rk_fb = dev_get_drvdata(info->device); win_id = dev_drv->ops->fb_get_win_id(dev_drv, fix->id); if (win_id < 0) diff --git a/drivers/video/rockchip/screen/rk_screen.c b/drivers/video/rockchip/screen/rk_screen.c index c92339c5e5d9..277af32403b7 100644 --- a/drivers/video/rockchip/screen/rk_screen.c +++ b/drivers/video/rockchip/screen/rk_screen.c @@ -1,9 +1,6 @@ #include #include "lcd.h" -#if defined(CONFIG_RK_HDMI) -#include "../hdmi/rk_hdmi.h" -#endif #if defined(CONFIG_MACH_RK_FAC) #include extern uint lcd_param[LCD_PARAM_MAX]; @@ -14,7 +11,7 @@ extern uint lcd_param[LCD_PARAM_MAX]; // if we use one lcdc with jetta for dual display,we need these configration #if defined(CONFIG_ONE_LCDC_DUAL_OUTPUT_INF) && defined(CONFIG_RK_HDMI) -static int set_scaler_info(struct rk29fb_screen *screen, u8 hdmi_resolution) +static int set_scaler_info(struct rk_screen *screen, u8 hdmi_resolution) { #if defined(CONFIG_RK610_LVDS) screen->s_clk_inv = S_DCLK_POL; @@ -190,7 +187,7 @@ static int set_scaler_info(struct rk29fb_screen *screen, u8 hdmi_resolution) #define set_scaler_info NULL #endif -void set_lcd_info(struct rk29fb_screen *screen, struct rk29lcd_info *lcd_info ) +void set_lcd_info(struct rk_screen *screen, struct rk29lcd_info *lcd_info ) { #if defined(RK_USE_SCREEN_ID) diff --git a/drivers/video/rockchip/transmitter/rk610_lcd.c b/drivers/video/rockchip/transmitter/rk610_lcd.c index 97df3ffcf0d0..3b842915ccea 100644 --- a/drivers/video/rockchip/transmitter/rk610_lcd.c +++ b/drivers/video/rockchip/transmitter/rk610_lcd.c @@ -72,7 +72,7 @@ static void rk610_scaler_disable(struct i2c_client *client) rk610_scaler_write_p0_reg(client, SCL_CON0, &c); } -static int rk610_output_config(struct i2c_client *client,struct rk29fb_screen *screen,int mode) +static int rk610_output_config(struct i2c_client *client,struct rk_screen *screen,int mode) { char c=0; RK610_DBG(&client->dev,"%s \n",__FUNCTION__); @@ -121,7 +121,7 @@ static int rk610_output_config(struct i2c_client *client,struct rk29fb_screen *s return 0; } #if defined(CONFIG_HDMI_DUAL_DISP) || defined(CONFIG_ONE_LCDC_DUAL_OUTPUT_INF) -static int rk610_scaler_pll_set(struct i2c_client *client,struct rk29fb_screen *screen,u32 clkin ) +static int rk610_scaler_pll_set(struct i2c_client *client,struct rk_screen *screen,u32 clkin ) { char c=0; char M=0,N=0,OD=0; @@ -188,7 +188,7 @@ static int scale_hv_factor(struct i2c_client *client ,u32 Hin_act, u32 Hout_act return 0; } -static int rk610_scaler_fator_config(struct i2c_client *client ,struct rk29fb_screen *screen) +static int rk610_scaler_fator_config(struct i2c_client *client ,struct rk_screen *screen) { switch(screen->hdmi_resolution){ case HDMI_1920x1080p_60Hz: @@ -222,7 +222,7 @@ static int rk610_scaler_fator_config(struct i2c_client *client ,struct rk29fb_sc } return 0; } -static int rk610_scaler_output_timing_config(struct i2c_client *client,struct rk29fb_screen *screen) +static int rk610_scaler_output_timing_config(struct i2c_client *client,struct rk_screen *screen) { char c; int h_st = screen->s_hsync_st; @@ -304,7 +304,7 @@ static int rk610_scaler_output_timing_config(struct i2c_client *client,struct rk return 0; } -static int rk610_scaler_chg(struct i2c_client *client ,struct rk29fb_screen *screen) +static int rk610_scaler_chg(struct i2c_client *client ,struct rk_screen *screen) { RK610_DBG(&client->dev,"%s screen->hdmi_resolution=%d\n",__FUNCTION__,screen->hdmi_resolution); @@ -365,7 +365,7 @@ static void rk610_lcd_early_resume(struct early_suspend *h) } } #endif -int rk610_lcd_scaler_set_param(struct rk29fb_screen *screen,bool enable )//enable:0 bypass 1: scale +int rk610_lcd_scaler_set_param(struct rk_screen *screen,bool enable )//enable:0 bypass 1: scale { int ret=0; struct i2c_client *client = g_lcd_inf->client; diff --git a/drivers/video/rockchip/transmitter/rk610_lcd.h b/drivers/video/rockchip/transmitter/rk610_lcd.h index 7b3376c69955..33a4957b72cf 100644 --- a/drivers/video/rockchip/transmitter/rk610_lcd.h +++ b/drivers/video/rockchip/transmitter/rk610_lcd.h @@ -217,7 +217,7 @@ struct scl_info{ struct rk610_lcd_info{ int disp_mode; - struct rk29fb_screen *screen; + struct rk_screen *screen; struct scl_info scl_inf; struct i2c_client *client; @@ -226,5 +226,5 @@ struct rk610_lcd_info{ #endif }; extern int rk610_lcd_init(struct rk610_core_info *rk610_core_info); -extern int rk610_lcd_scaler_set_param(struct rk29fb_screen *screen,bool enable ); +extern int rk610_lcd_scaler_set_param(struct rk_screen *screen,bool enable ); #endif diff --git a/drivers/video/rockchip/transmitter/rk616_mipi_dsi.c b/drivers/video/rockchip/transmitter/rk616_mipi_dsi.c index db2542c712d3..cad95cec1439 100644 --- a/drivers/video/rockchip/transmitter/rk616_mipi_dsi.c +++ b/drivers/video/rockchip/transmitter/rk616_mipi_dsi.c @@ -90,7 +90,7 @@ #ifdef CONFIG_MFD_RK616 static struct mfd_rk616 *dsi_rk616; -static struct rk29fb_screen *g_rk29fd_screen = NULL; +static struct rk_screen *g_rk29fd_screen = NULL; #endif static struct dsi gDsi; static struct mipi_dsi_ops rk_mipi_dsi_ops; diff --git a/drivers/video/rockchip/tve/rk610_tv.c b/drivers/video/rockchip/tve/rk610_tv.c index 03237ce4a410..83a6cec97665 100644 --- a/drivers/video/rockchip/tve/rk610_tv.c +++ b/drivers/video/rockchip/tve/rk610_tv.c @@ -42,15 +42,15 @@ int rk610_tv_wirte_reg(u8 reg, u8 data) int rk610_switch_fb(const struct fb_videomode *modedb, int tv_mode) { - struct rk29fb_screen *screen; + struct rk_screen *screen; if(modedb == NULL) return -1; - screen = kzalloc(sizeof(struct rk29fb_screen), GFP_KERNEL); + screen = kzalloc(sizeof(struct rk_screen), GFP_KERNEL); if(screen == NULL) return -1; - memset(screen, 0, sizeof(struct rk29fb_screen)); + memset(screen, 0, sizeof(struct rk_screen)); /* screen type & face */ screen->type = SCREEN_HDMI; screen->mode = modedb->vmode; diff --git a/drivers/video/rockchip/tve/rk610_tv.h b/drivers/video/rockchip/tve/rk610_tv.h index 422e8f25c83a..ead23a8a06a1 100644 --- a/drivers/video/rockchip/tve/rk610_tv.h +++ b/drivers/video/rockchip/tve/rk610_tv.h @@ -108,7 +108,7 @@ enum { extern volatile int rk610_tv_output_status; extern struct rk_display_ops rk610_display_ops; -extern int FB_Switch_Screen( struct rk29fb_screen *screen, u32 enable ); +extern int FB_Switch_Screen( struct rk_screen *screen, u32 enable ); extern int rk610_tv_wirte_reg(u8 reg, u8 data); extern int rk610_tv_standby(int type); diff --git a/include/linux/mfd/rk616.h b/include/linux/mfd/rk616.h index 03b2d6e2e54e..1f05fef8853d 100755 --- a/include/linux/mfd/rk616.h +++ b/include/linux/mfd/rk616.h @@ -290,8 +290,8 @@ struct mfd_rk616 { int (*write_bulk)(struct mfd_rk616 *rk616,u16 reg,int count,u32 *pval); }; -extern int rk616_set_vif(struct mfd_rk616 * rk616,rk_screen * screen,bool connect); -extern int rk616_display_router_cfg(struct mfd_rk616 *rk616,rk_screen *screen,bool enable); +extern int rk616_set_vif(struct mfd_rk616 * rk616,struct rk_screen * screen,bool connect); +extern int rk616_display_router_cfg(struct mfd_rk616 *rk616,struct rk_screen *screen,bool enable); extern void rk616_mclk_set_rate(struct clk *mclk,unsigned long rate);