#include <linux/mfd/core.h>
#include <linux/slab.h>
#include <linux/mfd/rk616.h>
-#include <mach/iomux.h>
+//#include <mach/iomux.h>
#include <linux/err.h>
#include <linux/uaccess.h>
+#include <linux/interrupt.h>
+#include <linux/of_gpio.h>
+#include <linux/of_device.h>
#if defined(CONFIG_DEBUG_FS)
#include <linux/fs.h>
#include <linux/debugfs.h>
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);
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);
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);
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);
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;
}
}
#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)
{
#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);
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;
}
}
-#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 },
{ }
-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;
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);
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);
val = (0xc1) | (0x01 <<16);
}
- else if((screen->x_res == 720))
+ else if((screen->mode.xres == 720))
{
if(pll_use_mclk12m )
{
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)
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;
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;
#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;
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 ;
}
-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;
}
-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;
}
-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;
}
-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;
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;
}
-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;
}
-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;
}
-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)
// 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);
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);
}
}
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");
}
#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) {