static int rk610_hdmi_set_param(struct hdmi *hdmi) { struct rk610_hdmi_inf *rk610_hdmi = hdmi_priv(hdmi); RK610_DBG(&rk610_hdmi->client->dev,"%s \n",__FUNCTION__); if(rk610_hdmi->init == 1) return 0; rk610_hdmi_param_chg(rk610_hdmi); return 0; }
static int rk610_hdmi_remove(struct hdmi *hdmi) { struct rk610_hdmi_inf *rk610_hdmi = hdmi_priv(hdmi); RK610_DBG(&rk610_hdmi->client->dev,"%s \n",__FUNCTION__); if(rk610_hdmi->init == 1) return -1; hdmi_set_spk(HDMI_ENABLE); hdmi_switch_fb(hdmi, HDMI_DISABLE); Rk610_hdmi_unplug(rk610_hdmi->client); printk("rk610_hdmi_remove hdmi->display_on=%d\n",hdmi->display_on); return 0; }
static int rk610_hdmi_insert(struct hdmi *hdmi) { struct rk610_hdmi_inf *rk610_hdmi = hdmi_priv(hdmi); RK610_DBG(&rk610_hdmi->client->dev,"%s \n",__FUNCTION__); if(rk610_hdmi->init == 1) return -1; Rk610_hdmi_plug(rk610_hdmi->client); rk610_hdmi_param_chg(rk610_hdmi); hdmi_set_spk(HDMI_DISABLE); printk("rk610_hdmi_insert hdmi->display_on=%d\n",hdmi->display_on); hdmi->scale = hdmi->scale_set; return 0; }
static int rk610_hdmi_init(struct hdmi *hdmi) { struct rk610_hdmi_inf *rk610_hdmi = hdmi_priv(hdmi); #ifdef CONFIG_HDMI_SAVE_DATA int hdmi_data = hdmi_get_data(); if(hdmi_data<0){ hdmi_set_data((hdmi->resolution&0x7)|((hdmi->scale&0x1f)<<3)); } else{ hdmi->resolution = hdmi_data&0x7; hdmi->scale_set= ((hdmi_data>>3)&0x1f) + MIN_SCALE; hdmi->scale = hdmi->scale_set; } #endif RK610_DBG(&rk610_hdmi->client->dev,"%s \n",__FUNCTION__); rk610_hdmi->init =0; Rk610_hdmi_init(rk610_hdmi->client); hdmi_changed(hdmi,1); Rk610_hdmi_Set_Video(hdmi->resolution); Rk610_hdmi_Set_Audio(hdmi->audio_fs); Rk610_hdmi_Config_Done(rk610_hdmi->client); return 0; }
static int rk610_hdmi_i2c_probe(struct i2c_client *client,const struct i2c_device_id *id) { int ret = 0; struct hdmi *hdmi = NULL; struct rk610_hdmi_inf *rk610_hdmi = NULL; struct hdmi_platform_data *pdata = client->dev.platform_data; rk610_g_hdmi_client = client; if(pdata && pdata->io_init) { printk("rk610_hdmi_i2c_probe io_init \n"); pdata->io_init(); } hdmi = hdmi_register(sizeof(struct rk610_hdmi_inf), &client->dev); if (!hdmi) { dev_err(&client->dev, "fail to register hdmi\n"); return -ENOMEM; } if(HDMI_SOURCE_DEFAULT == HDMI_SOURCE_LCDC0) hdmi->lcdc = rk_get_lcdc_drv("lcdc0"); else hdmi->lcdc = rk_get_lcdc_drv("lcdc1"); if(hdmi->lcdc == NULL) { dev_err(hdmi->dev, "can not connect to video source lcdc\n"); ret = -ENXIO; } hdmi->ops = &rk610_hdmi_ops; hdmi->display_on = HDMI_DEFAULT_MODE; hdmi->hdcp_on = HDMI_DISABLE; hdmi->audio_fs = HDMI_I2S_DEFAULT_Fs; hdmi->resolution = HDMI_DEFAULT_RESOLUTION; hdmi->dual_disp = DUAL_DISP_CAP; hdmi->mode = DISP_ON_LCD; hdmi->scale = 100; hdmi->scale_set = 100; rk610_hdmi = hdmi_priv(hdmi); rk610_hdmi->init = 1; rk610_hdmi->hdmi = hdmi; i2c_set_clientdata(client, rk610_hdmi); rk610_hdmi->client = client; if((gpio_request(client->irq, "hdmi gpio")) < 0) { dev_err(&client->dev, "fail to request gpio %d\n", client->irq); goto err_gpio_free; } rk610_hdmi->irq = gpio_to_irq(client->irq); rk610_hdmi->gpio = client->irq; gpio_direction_input(client->irq); #if 0 if((ret = request_irq(rk610_hdmi->irq, rk610_hdmi_interrupt, IRQ_TYPE_EDGE_RISING,client->name, hdmi))<0){ RK610_ERR(&client->dev, "fail to request gpio %d\n", client->irq); goto err_gpio_free; } #endif #ifdef CONFIG_HAS_EARLYSUSPEND rk610_hdmi->early_suspend.suspend = rk610_hdmi_early_suspend; rk610_hdmi->early_suspend.resume = rk610_hdmi_early_resume; rk610_hdmi->early_suspend.level = EARLY_SUSPEND_LEVEL_BLANK_SCREEN - 1; register_early_suspend(&rk610_hdmi->early_suspend); #endif #ifdef RK610_DEBUG device_create_file(&(client->dev), &rk610_attrs[0]); #endif rk610_hdmi_init(rk610_hdmi->hdmi); dev_info(&client->dev, "rk610_hdmi i2c probe ok\n"); return 0; err_gpio_free: gpio_free(client->irq); err_hdmi_unregister: hdmi_unregister(hdmi); rk610_hdmi = NULL; return ret; }