From 49be4e5d1c0abf610c362a681a5d4cb5ee9aa195 Mon Sep 17 00:00:00 2001 From: zwl Date: Mon, 17 Feb 2014 18:03:48 +0800 Subject: [PATCH] RK616: add dts property and fix some compile error --- arch/arm/boot/dts/rk616.dtsi | 22 +----- drivers/mfd/Kconfig | 22 ++++++ drivers/mfd/Makefile | 1 + drivers/mfd/rk616-core.c | 40 ++++++----- drivers/mfd/rk616-vif.c | 72 +++++++++---------- .../rockchip/hdmi/chips/rk616/rk616_hdmi.c | 8 +-- .../rockchip/hdmi/chips/rk616/rk616_hdmi.h | 2 +- .../rockchip/hdmi/chips/rk616/rk616_hdmi_hw.c | 1 + 8 files changed, 89 insertions(+), 79 deletions(-) diff --git a/arch/arm/boot/dts/rk616.dtsi b/arch/arm/boot/dts/rk616.dtsi index 87c06c330264..6c3e66f0ebc2 100644 --- a/arch/arm/boot/dts/rk616.dtsi +++ b/arch/arm/boot/dts/rk616.dtsi @@ -10,24 +10,8 @@ rk616,lcd0_func = ; rk616,lcd1_func = ; rk616,lvds_ch_nr = <1>; + pinctrl-names = "default", "gpio"; + pinctrl-0 = <&lcdc1_lcdc>; + pinctrl-1 = <&lcdc1_gpio>; - hdmi: hdmi{ - compatible = "rockchip,rk616-hdmi"; - reg = <0x0400,0x0400>; - }; - - codec: codec{ - compatible = "rockchip,rk616-code"; - reg = <0x0800,0x0400>; - }; - - mipi: mipi-pyh{ - compatible = "rockchip,rk616-mipi-phy"; - reg = <0x0c00,0x0400>; - }; - - mipi: mipi-ctrl{ - compatible = "rockchip,rk616-mipi-ctrl"; - reg = <0x1000,0x0400>; - }; }; diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index 53ba537bf47c..b3a837b9ab08 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig @@ -1125,6 +1125,28 @@ config MFD_WM8994 core support for the WM8994, in order to use the actual functionaltiy of the device other drivers must be enabled. +config MFD_RK616 + bool "RK616(Jetta B) Multifunction device support" + depends on I2C=y + select MFD_CORE + help + if you say yes here you get support for the RK616, with func as + HDMI、LCD、LVDS、CODEC、MIPI. + +config RK616_USE_MCLK_12M + bool "Enable 12M clock for timing reconstruction" + depends on MFD_RK616 + select RK_HDMI_CTL_CODEC + default y + help + if you say y here ,it will enable 12M clock for timing reconstruction + +config RK616_DEBUG + bool "RK616(JettaB) debug enable" + depends on MFD_RK616 + help + if you say y here ,it will enable rk616 debug function + endmenu endif diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile index 72f479c0971d..b9e5d93f19ae 100644 --- a/drivers/mfd/Makefile +++ b/drivers/mfd/Makefile @@ -157,3 +157,4 @@ obj-$(CONFIG_VEXPRESS_CONFIG) += vexpress-config.o vexpress-sysreg.o obj-$(CONFIG_VEXPRESS_SPC) += vexpress-spc.o obj-$(CONFIG_MFD_RETU) += retu-mfd.o obj-$(CONFIG_MFD_AS3711) += as3711.o +obj-$(CONFIG_MFD_RK616) += rk616-core.o rk616-vif.o diff --git a/drivers/mfd/rk616-core.c b/drivers/mfd/rk616-core.c index 1f542f60226f..b659432013a9 100755 --- a/drivers/mfd/rk616-core.c +++ b/drivers/mfd/rk616-core.c @@ -4,9 +4,12 @@ #include #include #include -#include +//#include #include #include +#include +#include +#include #if defined(CONFIG_DEBUG_FS) #include #include @@ -61,14 +64,14 @@ static int rk616_i2c_read_reg(struct mfd_rk616 *rk616, u16 reg,u32 *pval) msgs[0].len = 2; msgs[0].buf = reg_buf; msgs[0].scl_rate = rk616->pdata->scl_rate; - msgs[0].udelay = client->udelay; + //msgs[0].udelay = client->udelay; msgs[1].addr = client->addr; msgs[1].flags = client->flags | I2C_M_RD; msgs[1].len = 4; msgs[1].buf = (char *)pval; msgs[1].scl_rate = rk616->pdata->scl_rate; - msgs[1].udelay = client->udelay; + //msgs[1].udelay = client->udelay; ret = i2c_transfer(adap, msgs, 2); @@ -95,7 +98,7 @@ static int rk616_i2c_write_reg(struct mfd_rk616 *rk616, u16 reg,u32 *pval) msg.len = 6; msg.buf = (char *)tx_buf; msg.scl_rate = rk616->pdata->scl_rate; - msg.udelay = client->udelay; + //msg.udelay = client->udelay; ret = i2c_transfer(adap, &msg, 1); kfree(tx_buf); @@ -132,7 +135,7 @@ static int rk616_i2c_write_bits(struct mfd_rk616 *rk616, u16 reg,u32 mask,u32 *p msg.len = 6; msg.buf = (char *)tx_buf; msg.scl_rate = rk616->pdata->scl_rate; - msg.udelay = client->udelay; + //msg.udelay = client->udelay; ret = i2c_transfer(adap, &msg, 1); kfree(tx_buf); @@ -162,7 +165,7 @@ static int rk616_i2c_bulk_write(struct mfd_rk616 *rk616, u16 reg,int count,u32 * msg.len = (count<<2) + 2; msg.buf = (char *)tx_buf; msg.scl_rate = rk616->pdata->scl_rate; - msg.udelay = client->udelay; + //msg.udelay = client->udelay; ret = i2c_transfer(adap, &msg, 1); kfree(tx_buf); @@ -486,7 +489,7 @@ static struct rk616_platform_data *rk616_parse_dt(struct mfd_rk616 *rk616) pdata = devm_kzalloc(rk616->dev, sizeof(struct rk616_platform_data), GFP_KERNEL); if (!pdata) { - dev_err(&rk616->dev, "rk616_platform_data kmalloc fail!"); + dev_err(rk616->dev, "rk616_platform_data kmalloc fail!"); return NULL; } @@ -522,6 +525,14 @@ static struct rk616_platform_data *rk616_parse_dt(struct mfd_rk616 *rk616) } #endif +#if defined(CONFIG_OF) +static const struct of_device_id rk616_dt_ids[] = { + {.compatible = "rockchip,rk616",}, + {} +}; +MODULE_DEVICE_TABLE(of, rk616_dt_ids); +#endif + static int rk616_i2c_probe(struct i2c_client *client,const struct i2c_device_id *id) { @@ -573,7 +584,7 @@ static int rk616_i2c_probe(struct i2c_client *client,const struct i2c_device_id #if defined(CONFIG_ARCH_RK29) rk29_mux_api_set(GPIO2D0_I2S0CLK_MIIRXCLKIN_NAME, GPIO2H_I2S0_CLK); #else - iomux_set(I2S0_MCLK); + //iomux_set(I2S0_MCLK); //set at i2s driver #endif clk_enable(iis_clk); //clk_set_rate(iis_clk, 11289600); @@ -603,13 +614,13 @@ static int rk616_i2c_probe(struct i2c_client *client,const struct i2c_device_id rk616_clk_common_init(rk616); ret = mfd_add_devices(rk616->dev, -1, rk616_devs, ARRAY_SIZE(rk616_devs), - NULL, rk616->irq_base); + NULL, rk616->irq_base, NULL); dev_info(&client->dev,"rk616 core probe success!\n"); return 0; } -static int __devexit rk616_i2c_remove(struct i2c_client *client) +static int rk616_i2c_remove(struct i2c_client *client) { return 0; } @@ -622,15 +633,6 @@ static void rk616_core_shutdown(struct i2c_client *client) } -#if defined(CONFIG_OF) -static const struct of_device_id rk616_dt_ids[] = { - {.compatible = "rockchip,rk616",}, - {} -}; -MODULE_DEVICE_TABLE(of, rk616_dt_ids); -#endif - - static const struct i2c_device_id id_table[] = { {"rk616", 0 }, { } diff --git a/drivers/mfd/rk616-vif.c b/drivers/mfd/rk616-vif.c index 848606c6d467..9ecaef7d728a 100755 --- a/drivers/mfd/rk616-vif.c +++ b/drivers/mfd/rk616-vif.c @@ -123,7 +123,7 @@ static bool pll_sel_mclk12m(struct mfd_rk616 *rk616,int pll_id) -int rk616_vif_cfg(struct mfd_rk616 *rk616,rk_screen *screen,int id) +int rk616_vif_cfg(struct mfd_rk616 *rk616,struct rk_screen *screen,int id) { int ret = 0; u32 val = 0; @@ -170,7 +170,7 @@ int rk616_vif_cfg(struct mfd_rk616 *rk616,rk_screen *screen,int id) rk616_vif_disable(rk616,id); - if( (screen->x_res == 1920) && (screen->y_res == 1080)) + if( (screen->mode.xres == 1920) && (screen->mode.yres == 1080)) { if(pll_use_mclk12m) //rk616_pll_set_rate(rk616,pll_id,0xc11025,0x200000); @@ -180,7 +180,7 @@ int rk616_vif_cfg(struct mfd_rk616 *rk616,rk_screen *screen,int id) val = (0xc1) | (0x01 <<16); } - else if((screen->x_res == 1280) && (screen->y_res == 720)) + else if((screen->mode.xres == 1280) && (screen->mode.yres == 720)) { if(pll_use_mclk12m) //rk616_pll_set_rate(rk616,pll_id,0x01811025,0x200000); @@ -191,7 +191,7 @@ int rk616_vif_cfg(struct mfd_rk616 *rk616,rk_screen *screen,int id) val = (0xc1) | (0x01 <<16); } - else if((screen->x_res == 720)) + else if((screen->mode.xres == 720)) { if(pll_use_mclk12m ) { @@ -207,22 +207,22 @@ int rk616_vif_cfg(struct mfd_rk616 *rk616,rk_screen *screen,int id) ret = rk616->write_dev(rk616,VIF0_REG1 + offset,&val); - val = (screen->hsync_len << 16) | (screen->hsync_len + screen->left_margin + - screen->right_margin + screen->x_res); + val = (screen->mode.hsync_len << 16) | (screen->mode.hsync_len + screen->mode.left_margin + + screen->mode.right_margin + screen->mode.xres); ret = rk616->write_dev(rk616,VIF0_REG2 + offset,&val); - val = ((screen->hsync_len + screen->left_margin + screen->x_res)<<16) | - (screen->hsync_len + screen->left_margin); + val = ((screen->mode.hsync_len + screen->mode.left_margin + screen->mode.xres)<<16) | + (screen->mode.hsync_len + screen->mode.left_margin); ret = rk616->write_dev(rk616,VIF0_REG3 + offset,&val); - val = (screen->vsync_len << 16) | (screen->vsync_len + screen->upper_margin + - screen->lower_margin + screen->y_res); + val = (screen->mode.vsync_len << 16) | (screen->mode.vsync_len + screen->mode.upper_margin + + screen->mode.lower_margin + screen->mode.yres); ret = rk616->write_dev(rk616,VIF0_REG4 + offset,&val); - val = ((screen->vsync_len + screen->upper_margin + screen->y_res)<<16) | - (screen->vsync_len + screen->upper_margin); + val = ((screen->mode.vsync_len + screen->mode.upper_margin + screen->mode.yres)<<16) | + (screen->mode.vsync_len + screen->mode.upper_margin); ret = rk616->write_dev(rk616,VIF0_REG5 + offset,&val); if(id == 0) @@ -253,7 +253,7 @@ static int rk616_scaler_disable(struct mfd_rk616 *rk616) return 0; } -int rk616_scaler_cfg(struct mfd_rk616 *rk616,rk_screen *screen) +int rk616_scaler_cfg(struct mfd_rk616 *rk616,struct rk_screen *screen) { u32 scl_hor_mode,scl_ver_mode; u32 scl_v_factor,scl_h_factor; @@ -274,8 +274,8 @@ int rk616_scaler_cfg(struct mfd_rk616 *rk616,rk_screen *screen) u8 hor_down_mode = 0; //1:average,0:bilinear u8 ver_down_mode = 0; u8 bic_coe_sel = 2; - rk_screen *src; - rk_screen *dst; + struct rk_screen *src; + struct rk_screen *dst; int pll_id; struct rk616_route *route = &rk616->route; @@ -317,19 +317,19 @@ int rk616_scaler_cfg(struct mfd_rk616 *rk616,rk_screen *screen) #if 1 - src_htotal = src->hsync_len + src->left_margin + src->x_res + src->right_margin; - src_vact_st = src->vsync_len + src->upper_margin ; - dst_vact_st = dst->vsync_len + dst->upper_margin; + src_htotal = src->mode.hsync_len + src->mode.left_margin + src->mode.xres + src->mode.right_margin; + src_vact_st = src->mode.vsync_len + src->mode.upper_margin ; + dst_vact_st = dst->mode.vsync_len + dst->mode.upper_margin; - dsp_htotal = dst->hsync_len + dst->left_margin + dst->x_res + dst->right_margin; //dst_htotal ; - dsp_hs_end = dst->hsync_len; + dsp_htotal = dst->mode.hsync_len + dst->mode.left_margin + dst->mode.xres + dst->mode.right_margin; //dst_htotal ; + dsp_hs_end = dst->mode.hsync_len; - dsp_vtotal = dst->vsync_len + dst->upper_margin + dst->y_res + dst->lower_margin; - dsp_vs_end = dst->vsync_len; + dsp_vtotal = dst->mode.vsync_len + dst->mode.upper_margin + dst->mode.yres + dst->mode.lower_margin; + dsp_vs_end = dst->mode.vsync_len; - dsp_hbor_end = dst->hsync_len + dst->left_margin + dst->x_res; - dsp_hbor_st = dst->hsync_len + dst->left_margin ; - dsp_vbor_end = dst->vsync_len + dst->upper_margin + dst->y_res; //dst_vact_end ; + dsp_hbor_end = dst->mode.hsync_len + dst->mode.left_margin + dst->mode.xres; + dsp_hbor_st = dst->mode.hsync_len + dst->mode.left_margin ; + dsp_vbor_end = dst->mode.vsync_len + dst->mode.upper_margin + dst->mode.yres; //dst_vact_end ; dsp_vbor_st = dst_vact_st ; dsp_hact_st = dsp_hbor_st + bor_left; @@ -337,8 +337,8 @@ int rk616_scaler_cfg(struct mfd_rk616 *rk616,rk_screen *screen) dsp_vact_st = dsp_vbor_st + bor_up; dsp_vact_end = dsp_vbor_end - bor_down; - src_w = src->x_res; - src_h = src->y_res; + src_w = src->mode.xres; + src_h = src->mode.yres; dst_w = dsp_hact_end - dsp_hact_st ; dst_h = dsp_vact_end - dsp_vact_st ; @@ -436,7 +436,7 @@ int rk616_scaler_cfg(struct mfd_rk616 *rk616,rk_screen *screen) } -static int rk616_dual_input_cfg(struct mfd_rk616 *rk616,rk_screen *screen, +static int rk616_dual_input_cfg(struct mfd_rk616 *rk616,struct rk_screen *screen, bool enable) { struct rk616_platform_data *pdata = rk616->pdata; @@ -495,7 +495,7 @@ static int rk616_dual_input_cfg(struct mfd_rk616 *rk616,rk_screen *screen, } -static int rk616_lcd0_input_lcd1_unused_cfg(struct mfd_rk616 *rk616,rk_screen *screen, +static int rk616_lcd0_input_lcd1_unused_cfg(struct mfd_rk616 *rk616,struct rk_screen *screen, bool enable) { struct rk616_platform_data *pdata = rk616->pdata; @@ -555,7 +555,7 @@ static int rk616_lcd0_input_lcd1_unused_cfg(struct mfd_rk616 *rk616,rk_screen *s } -static int rk616_lcd0_input_lcd1_output_cfg(struct mfd_rk616 *rk616,rk_screen *screen, +static int rk616_lcd0_input_lcd1_output_cfg(struct mfd_rk616 *rk616,struct rk_screen *screen, bool enable) { struct rk616_route *route = &rk616->route; @@ -603,7 +603,7 @@ static int rk616_lcd0_input_lcd1_output_cfg(struct mfd_rk616 *rk616,rk_screen *s } -static int rk616_lcd0_unused_lcd1_input_cfg(struct mfd_rk616 *rk616,rk_screen *screen, +static int rk616_lcd0_unused_lcd1_input_cfg(struct mfd_rk616 *rk616,struct rk_screen *screen, bool enable) { struct rk616_platform_data *pdata = rk616->pdata; @@ -659,7 +659,7 @@ static int rk616_lcd0_unused_lcd1_input_cfg(struct mfd_rk616 *rk616,rk_screen *s return 0; } -int rk616_set_router(struct mfd_rk616 *rk616,rk_screen *screen,bool enable) +int rk616_set_router(struct mfd_rk616 *rk616,struct rk_screen *screen,bool enable) { struct rk616_platform_data *pdata = rk616->pdata; int ret; @@ -733,7 +733,7 @@ static int rk616_router_cfg(struct mfd_rk616 *rk616) } -static int rk616_dither_cfg(struct mfd_rk616 *rk616,rk_screen *screen,bool enable) +static int rk616_dither_cfg(struct mfd_rk616 *rk616,struct rk_screen *screen,bool enable) { u32 val = 0; int ret = 0; @@ -752,10 +752,10 @@ static int rk616_dither_cfg(struct mfd_rk616 *rk616,rk_screen *screen,bool enabl } -int rk616_display_router_cfg(struct mfd_rk616 *rk616,rk_screen *screen,bool enable) +int rk616_display_router_cfg(struct mfd_rk616 *rk616,struct rk_screen *screen,bool enable) { int ret; - rk_screen *hdmi_screen = screen->ext_screen; + struct rk_screen *hdmi_screen = screen->ext_screen; ret = rk616_set_router(rk616,screen,enable); if(ret < 0) return ret; @@ -775,7 +775,7 @@ int rk616_display_router_cfg(struct mfd_rk616 *rk616,rk_screen *screen,bool enab } -int rk616_set_vif(struct mfd_rk616 *rk616,rk_screen *screen,bool connect) +int rk616_set_vif(struct mfd_rk616 *rk616,struct rk_screen *screen,bool connect) { struct rk616_platform_data *pdata; if(!rk616) diff --git a/drivers/video/rockchip/hdmi/chips/rk616/rk616_hdmi.c b/drivers/video/rockchip/hdmi/chips/rk616/rk616_hdmi.c index 0ba6661d69e8..6cee14244053 100755 --- a/drivers/video/rockchip/hdmi/chips/rk616/rk616_hdmi.c +++ b/drivers/video/rockchip/hdmi/chips/rk616/rk616_hdmi.c @@ -151,7 +151,7 @@ static void hdmi_early_resume(struct early_suspend *h) // hdmi_irq(); rk616_hdmi_work(hdmi); } - if (rk616_hdmi->rk616_drv && rk616_hdmi->rk616_drv->pdata->hdmi_irq == INVALID_GPIO) + if (rk616_hdmi->rk616_drv && !gpio_is_valid(rk616_hdmi->rk616_drv->pdata->hdmi_irq)) queue_delayed_work(hdmi->workqueue, &rk616_hdmi->rk616_delay_work, 100); queue_delayed_work(hdmi->workqueue, &hdmi->delay_work, msecs_to_jiffies(10)); mutex_unlock(&hdmi->enable_mutex); @@ -170,7 +170,7 @@ static void rk616_delay_work_func(struct work_struct *work) rk616_hdmi_work(hdmi); } - if (rk616_hdmi->rk616_drv && rk616_hdmi->rk616_drv->pdata->hdmi_irq == INVALID_GPIO) { + if (rk616_hdmi->rk616_drv && !gpio_is_valid(rk616_hdmi->rk616_drv->pdata->hdmi_irq)) { queue_delayed_work(hdmi->workqueue, &rk616_hdmi->rk616_delay_work, 100); } } @@ -299,7 +299,7 @@ static int rk616_hdmi_probe(struct platform_device *pdev) goto err0; } - printk("res->start = 0x%x\n, xhc-------res->end = 0x%x\n", res->start, res->end); + dev_info(hdmi->dev, "res->start = 0x%x\n,res->end = 0x%x\n", res->start, res->end); hdmi->regbase = (int)ioremap(res->start, (res->end - res->start) + 1); if (!hdmi->regbase) { dev_err(hdmi->dev, "cannot ioremap registers\n"); @@ -330,7 +330,7 @@ static int rk616_hdmi_probe(struct platform_device *pdev) } #else ret = rk616_hdmi_initial(hdmi); - if(rk616_hdmi->rk616_drv->pdata->hdmi_irq != INVALID_GPIO) { + if(gpio_is_valid(rk616_hdmi->rk616_drv->pdata->hdmi_irq)) { 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"); if(ret < 0) { diff --git a/drivers/video/rockchip/hdmi/chips/rk616/rk616_hdmi.h b/drivers/video/rockchip/hdmi/chips/rk616/rk616_hdmi.h index 8c4702d2ffc7..66d5f410f778 100755 --- a/drivers/video/rockchip/hdmi/chips/rk616/rk616_hdmi.h +++ b/drivers/video/rockchip/hdmi/chips/rk616/rk616_hdmi.h @@ -28,7 +28,7 @@ extern int rk616_hdmi_register_hdcp_callbacks(void (*hdcp_cb)(void), struct rk616_hdmi { struct hdmi g_hdmi; - struct early_suspend early_suspend; + //struct early_suspend early_suspend; //TODO Daisen struct delayed_work rk616_delay_work; struct work_struct rk616_irq_work_struct; struct mfd_rk616 *rk616_drv; 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 13b973223748..cb28bfd650e9 100755 --- a/drivers/video/rockchip/hdmi/chips/rk616/rk616_hdmi_hw.c +++ b/drivers/video/rockchip/hdmi/chips/rk616/rk616_hdmi_hw.c @@ -1,6 +1,7 @@ #include #include //#include +#include #include #include "rk616_hdmi.h" #include "rk616_hdmi_hw.h" -- 2.34.1