static int Colorado_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id) { int err = 0; struct hdmi *hdmi = NULL; struct anx7805_pdata *anx = NULL; D("##########Colorado_i2c_probe##############\n"); memcpy(&g_client, &client, sizeof(client)); Colorado_init_gpio(); if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C/*I2C_FUNC_SMBUS_I2C_BLOCK*/)) { dev_err(&client->dev, "i2c bus does not support the Colorado\n"); err = -ENODEV; goto exit_kfree; } anx = kzalloc(sizeof(struct anx7805_pdata), GFP_KERNEL); if(!anx) { dev_err(&client->dev, "no memory for state\n"); goto err_kzalloc_anx; } anx->client = client; anx->dev.detect = 0; // Register HDMI device hdmi = hdmi_register(&client->dev, &anx7805_ops); if(hdmi == NULL) { dev_err(&client->dev, "fail to register hdmi\n"); goto err_hdmi_register; } hdmi_set_privdata(hdmi, anx); anx->dev.hdmi = hdmi; i2c_set_clientdata(client, anx); err = Colorado_System_Init(); if (err) goto exit_kfree; HDMI_task(hdmi); queue_delayed_work(hdmi->workqueue, &hdmi->delay_work, 1); hdmi_enable(hdmi); dev_info(&client->dev, "anx7150 probe ok\n"); return 0; exit_kfree: hdmi_unregister(hdmi); err_hdmi_register: kfree(anx); anx = NULL; err_kzalloc_anx: hdmi = NULL; dev_err(&client->dev, "anx7805 probe error\n"); return err; }
static int __devexit rk610_hdmi_i2c_remove(struct i2c_client *client) { struct rk610_hdmi_inf *rk610_hdmi = (struct rk610_hdmi_inf *)i2c_get_clientdata(client); struct hdmi *hdmi = rk610_hdmi->hdmi; gpio_free(client->irq); hdmi_unregister(hdmi); rk610_hdmi = NULL; return 0; }
static int __devexit anx7150_i2c_remove(struct i2c_client *client) { struct anx7150_pdata *anx = (struct anx7150_pdata *)i2c_get_clientdata(client); struct hdmi *hdmi = anx->dev.hdmi; free_irq(anx->irq, NULL); gpio_free(client->irq); hdmi_unregister(hdmi); destroy_workqueue(anx->dev.workqueue); kfree(anx); anx = NULL; kfree(hdmi); hdmi = NULL; hdmi_dbg(hdmi->dev, "%s\n", __func__); return 0; }
static int __devexit rk610_hdmi_i2c_remove(struct i2c_client *client) { struct rk610_hdmi_pdata *rk610_hdmi = (struct rk610_hdmi_pdata *)i2c_get_clientdata(client); struct hdmi *hdmi = rk610_hdmi->hdmi; #ifdef HDMI_USE_IRG free_irq(rk610_hdmi->irq, NULL); gpio_free(client->irq); #endif hdmi_unregister(hdmi); kfree(rk610_hdmi); rk610_hdmi = NULL; kfree(hdmi); hdmi = NULL; hdmi_dbg(hdmi->dev, "%s\n", __func__); return 0; }
static int __devexit anx7150_i2c_remove(struct i2c_client *client) { struct anx7150_pdata *anx = (struct anx7150_pdata *)i2c_get_clientdata(client); struct hdmi *hdmi = anx->dev.hdmi; #ifdef HDMI_USE_IRG free_irq(anx->irq, NULL); gpio_free(client->irq); #endif hdmi_unregister(hdmi); kfree(anx); anx = NULL; kfree(hdmi); hdmi = NULL; hdmi_dbg(hdmi->dev, "%s\n", __func__); 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; }
static int __devinit rk30_hdmi_probe (struct platform_device *pdev) { int ret; struct resource *res; struct resource *mem; rk30_hdmi = kmalloc(sizeof(struct rk30_hdmi), GFP_KERNEL); if(!rk30_hdmi) { dev_err(&pdev->dev, ">>rk30 hdmi kmalloc fail!"); return -ENOMEM; } memset(rk30_hdmi, 0, sizeof(struct hdmi)); platform_set_drvdata(pdev, rk30_hdmi); rk30_hdmi->pwr_mode = PWR_SAVE_MODE_A; /* get the IRQ */ rk30_hdmi->irq = platform_get_irq(pdev, 0); if(rk30_hdmi->irq <= 0) { dev_err(&pdev->dev, "failed to get hdmi irq resource (%d).\n", rk30_hdmi->irq); ret = -ENXIO; goto err0; } rk30_hdmi->hclk = clk_get(NULL,"hclk_hdmi"); if(IS_ERR(rk30_hdmi->hclk)) { dev_err(&pdev->dev, "Unable to get hdmi hclk\n"); ret = -ENXIO; goto err0; } clk_enable(rk30_hdmi->hclk); res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!res) { dev_err(&pdev->dev, "Unable to get register resource\n"); ret = -ENXIO; goto err0; } rk30_hdmi->regbase_phy = res->start; rk30_hdmi->regsize_phy = (res->end - res->start) + 1; mem = request_mem_region(res->start, (res->end - res->start) + 1, pdev->name); if (!mem) { dev_err(&pdev->dev, "failed to request mem region for hdmi\n"); ret = -ENOENT; goto err0; } rk30_hdmi->regbase = (int)ioremap(res->start, (res->end - res->start) + 1); if (!rk30_hdmi->regbase) { dev_err(&pdev->dev, "cannot ioremap registers\n"); ret = -ENXIO; goto err1; } #ifdef CONFIG_HAS_EARLYSUSPEND rk30_hdmi->early_suspend.suspend = rk30_hdmi_early_suspend; rk30_hdmi->early_suspend.resume = rk30_hdmi_early_resume; rk30_hdmi->early_suspend.level = EARLY_SUSPEND_LEVEL_DISABLE_FB - 10; register_early_suspend(&rk30_hdmi->early_suspend); #endif rk30_hdmi_property.name = (char*)pdev->name; rk30_hdmi_property.priv = rk30_hdmi; rk30_hdmi->hdmi = hdmi_register(&rk30_hdmi_property, &rk30_hdmi_ops); if(rk30_hdmi->hdmi == NULL) { dev_err(&pdev->dev, "register hdmi device failed\n"); ret = -ENOMEM; goto err2; } rk30_hdmi->hdmi->dev = &pdev->dev; rk30_hdmi->hdmi->xscale = 95; rk30_hdmi->hdmi->yscale = 95; hdmi_io_remap(); spin_lock_init(&rk30_hdmi->irq_lock); /* request the IRQ */ ret = request_irq(rk30_hdmi->irq, hdmi_irq, 0, dev_name(&pdev->dev), rk30_hdmi); if (ret) { dev_err(&pdev->dev, "rk30 hdmi request_irq failed (%d).\n", ret); goto err3; } #ifdef CONFIG_RK_HDMI_GPIO_CEC GPIO_CecInit(RK30_PIN2_PA0); #endif dev_info(&pdev->dev, "rk30 hdmi probe sucess.\n"); return 0; err3: hdmi_unregister(rk30_hdmi->hdmi); err2: #ifdef CONFIG_HAS_EARLYSUSPEND unregister_early_suspend(&rk30_hdmi->early_suspend); #endif iounmap((void*)rk30_hdmi->regbase); err1: release_mem_region(res->start,(res->end - res->start) + 1); clk_disable(rk30_hdmi->hclk); err0: kfree(rk30_hdmi); rk30_hdmi = NULL; dev_err(&pdev->dev, "rk30 hdmi probe error.\n"); return ret; }
static int anx7150_i2c_probe(struct i2c_client *client,const struct i2c_device_id *id) { int rc = 0; struct hdmi *hdmi = NULL; struct anx7150_pdata *anx = NULL; hdmi = kzalloc(sizeof(struct hdmi), GFP_KERNEL); if (!hdmi) { dev_err(&client->dev, "no memory for state\n"); return -ENOMEM; } anx = kzalloc(sizeof(struct anx7150_pdata), GFP_KERNEL); if(!anx) { dev_err(&client->dev, "no memory for state\n"); goto err_kzalloc_anx; } anx->client = client; anx->dev.anx7150_detect = 0; anx->dev.resolution_set = HDMI_DEFAULT_RESOLUTION; anx->dev.i2s_Fs = HDMI_I2S_DEFAULT_Fs; anx->dev.hdmi_enable = HDMI_ENABLE; anx->dev.hdmi_auto_switch = HDMI_AUTO_SWITCH; anx->dev.reciver_status = HDMI_RECIVER_INACTIVE; anx->dev.HPD_status = HDMI_RECIVER_UNPLUG; anx->dev.HPD_change_cnt = 0; anx->dev.rk29_output_status = RK29_OUTPUT_STATUS_LCD; anx->dev.hdcp_enable = ANX7150_HDCP_EN; anx->dev.rate = 100; anx->init = 1; anx->dev.workqueue = create_singlethread_workqueue("ANX7150_WORKQUEUE"); INIT_DELAYED_WORK(&anx->dev.delay_work, anx7150_work_func); hdmi->display_on = anx->dev.hdmi_enable; hdmi->auto_switch = anx->dev.hdmi_auto_switch; hdmi->hdcp_on = anx->dev.hdcp_enable; hdmi->audio_fs = anx->dev.i2s_Fs; hdmi->resolution = anx->dev.resolution_set; hdmi->dev = &client->dev; hdmi->hdmi_display_on = anx7150_display_on; hdmi->hdmi_display_off = anx7150_display_off; hdmi->hdmi_set_param = anx7150_set_param; hdmi->hdmi_core_init = anx7150_core_init; if((rc = hdmi_register(&client->dev, hdmi)) < 0) { dev_err(&client->dev, "fail to register hdmi\n"); goto err_hdmi_register; } if((rc = gpio_request(client->irq, "hdmi gpio")) < 0) { dev_err(&client->dev, "fail to request gpio %d\n", client->irq); goto err_request_gpio; } anx->irq = gpio_to_irq(client->irq); anx->gpio = client->irq; anx->dev.hdmi = hdmi; hdmi_set_privdata(hdmi, anx); i2c_set_clientdata(client, anx); gpio_pull_updown(client->irq,GPIOPullUp); if((rc = request_irq(anx->irq, anx7150_detect_irq,IRQF_TRIGGER_FALLING,NULL,hdmi)) <0) { dev_err(&client->dev, "fail to request hdmi irq\n"); goto err_request_irq; } anx->dev.anx7150_detect = anx7150_detect_device(anx); if(anx->dev.anx7150_detect) { ANX7150_API_Initial(client); queue_delayed_work(anx->dev.workqueue, &anx->dev.delay_work, 200); } dev_info(&client->dev, "anx7150 i2c probe ok\n"); return 0; err_request_irq: gpio_free(client->irq); err_request_gpio: hdmi_unregister(hdmi); err_hdmi_register: destroy_workqueue(anx->dev.workqueue); kfree(anx); anx = NULL; err_kzalloc_anx: kfree(hdmi); hdmi = NULL; return rc; }
static int it66121_i2c_probe(struct i2c_client *client,const struct i2c_device_id *id) { int rc = 0; struct hdmi *hdmi = NULL; struct rkdisplay_platform_data *hdmi_data = client->dev.platform_data; it66121 = kzalloc(sizeof(struct it66121), GFP_KERNEL); if(!it66121) { dev_err(&client->dev, "no memory for state\n"); goto err_kzalloc_it66121; } it66121->client = client; it66121->io_irq_pin = client->irq; it66121->enable = 1; i2c_set_clientdata(client, it66121); it66121_property.name = (char*)client->name; it66121_property.priv = it66121; // Register HDMI device if(hdmi_data) { it66121->io_pwr_pin = hdmi_data->io_pwr_pin; it66121->io_rst_pin = hdmi_data->io_reset_pin; it66121_property.videosrc = hdmi_data->video_source; it66121_property.display = hdmi_data->property; } else { it66121->io_pwr_pin = INVALID_GPIO; it66121->io_rst_pin = INVALID_GPIO; it66121_property.videosrc = DISPLAY_SOURCE_LCDC0; it66121_property.display = DISPLAY_MAIN; } it66121->hdmi = hdmi_register(&it66121_property, &it66121_ops); if(it66121->hdmi == NULL) { dev_err(&client->dev, "fail to register hdmi\n"); goto err_hdmi_register; } #ifdef CONFIG_HAS_EARLYSUSPEND it66121->early_suspend.suspend = it66121_early_suspend; it66121->early_suspend.resume = it66121_early_resume; it66121->early_suspend.level = EARLY_SUSPEND_LEVEL_DISABLE_FB - 10; register_early_suspend(&it66121->early_suspend); #endif //Power on it66121 if(it66121->io_pwr_pin != INVALID_GPIO) { rc = gpio_request(it66121->io_pwr_pin, NULL); if(rc) { gpio_free(it66121->io_pwr_pin); printk(KERN_ERR "request it66121 power control gpio error\n "); goto err_hdmi_register; } else gpio_direction_output(it66121->io_pwr_pin, GPIO_HIGH); } // Reset it66121 if(it66121->io_rst_pin != INVALID_GPIO) { rc = gpio_request(it66121->io_rst_pin, NULL); if(rc) { gpio_free(it66121->io_rst_pin); printk(KERN_ERR "request it66121 reset control gpio error\n "); goto err_hdmi_register; } else gpio_direction_output(it66121->io_rst_pin, GPIO_HIGH); } if(it66121_initial()) goto err_request_gpio; // hdmi_enable(hdmi); #if 0 if((rc = gpio_request(it66121->io_irq_pin, "hdmi gpio")) < 0) { dev_err(&client->dev, "fail to request gpio %d\n", client->irq); goto err_request_gpio; } gpio_pull_updown(it66121->io_irq_pin, PullDisable); gpio_direction_input(it66121->io_irq_pin); INIT_WORK(&it66121->irq_work, it66121_irq_work_func); it66121->irq = gpio_to_irq(it66121->io_irq_pin); if((rc = request_irq(it66121->irq, it66121_detect_irq,IRQF_TRIGGER_FALLING,NULL,it66121)) <0) { dev_err(&client->dev, "fail to request hdmi irq\n"); goto err_request_irq; } #endif { it66121->workqueue = create_singlethread_workqueue("it66121 irq"); INIT_DELAYED_WORK(&(it66121->delay_work), it66121_irq_work_func); it66121_irq_work_func(NULL); // queue_delayed_work(sii902x->workqueue, &sii902x->delay_work, 0); } printk(KERN_INFO "IT66121 probe success."); return 0; err_request_irq: gpio_free(client->irq); err_request_gpio: hdmi_unregister(it66121->hdmi); err_hdmi_register: kfree(it66121); it66121 = NULL; err_kzalloc_it66121: dev_err(&client->dev, "it66121 probe error\n"); return rc; }
static int rk610_hdmi_i2c_probe(struct i2c_client *client,const struct i2c_device_id *id) { int rc = 0; struct hdmi *hdmi = NULL; struct rkdisplay_platform_data *hdmi_data = client->dev.platform_data; rk610_hdmi = kzalloc(sizeof(struct rk610_hdmi_pdata), GFP_KERNEL); if(!rk610_hdmi) { dev_err(&client->dev, "no memory for state\n"); goto err_kzalloc_rk610_hdmi; } rk610_hdmi->client = client; if(hdmi_data) hdmi = hdmi_register(&client->dev, &rk610_hdmi_ops, hdmi_data->video_source, hdmi_data->property); else hdmi = hdmi_register(&client->dev, &rk610_hdmi_ops, DISPLAY_SOURCE_LCDC0, DISPLAY_MAIN); if(hdmi == NULL) { dev_err(&client->dev, "fail to register hdmi\n"); goto err_hdmi_register; } hdmi->support_r2y = 1; rk610_hdmi->hdmi = hdmi; hdmi_set_privdata(hdmi, rk610_hdmi); i2c_set_clientdata(client, rk610_hdmi); { #ifdef HDMI_USE_IRQ // hdmi_changed(hdmi, 0); INIT_WORK(&rk610_hdmi->irq_work, rk610_irq_work_func); if((rc = gpio_request(client->irq, "hdmi gpio")) < 0) { dev_err(&client->dev, "fail to request gpio %d\n", client->irq); goto err_request_gpio; } rk610_hdmi->irq = gpio_to_irq(client->irq); rk610_hdmi->gpio = client->irq; gpio_pull_updown(client->irq,GPIOPullUp); gpio_direction_input(client->irq); if((rc = request_irq(rk610_hdmi->irq, rk610_irq,IRQF_TRIGGER_RISING,NULL,hdmi)) < 0) { dev_err(&client->dev, "fail to request hdmi irq\n"); goto err_request_irq; } #else HDMI_task(hdmi); queue_delayed_work(hdmi->workqueue, &hdmi->delay_work, 200); #endif hdmi_enable(hdmi); dev_info(&client->dev, "rk610 hdmi i2c probe ok\n"); } return 0; err_request_irq: gpio_free(client->irq); err_request_gpio: hdmi_unregister(hdmi); err_hdmi_register: kfree(rk610_hdmi); rk610_hdmi = NULL; err_kzalloc_rk610_hdmi: hdmi = NULL; dev_err(&client->dev, "rk610 hdmi probe error\n"); return rc; }
static int anx7150_i2c_probe(struct i2c_client *client,const struct i2c_device_id *id) { int rc = 0; struct hdmi *hdmi = NULL; struct anx7150_pdata *anx = NULL; struct rkdisplay_platform_data *hdmi_data = client->dev.platform_data; anx = kzalloc(sizeof(struct anx7150_pdata), GFP_KERNEL); if(!anx) { dev_err(&client->dev, "no memory for state\n"); goto err_kzalloc_anx; } anx->client = client; anx->dev.anx7150_detect = 0; anx->init = 1; // Register HDMI device if(hdmi_data) { anx->io_pwr_pin = hdmi_data->io_pwr_pin; anx->io_rst_pin = hdmi_data->io_reset_pin; hdmi = hdmi_register(&client->dev, &anx7150_ops, hdmi_data->video_source, hdmi_data->property); } else { anx->io_pwr_pin = INVALID_GPIO; anx->io_rst_pin = INVALID_GPIO; hdmi = hdmi_register(&client->dev, &anx7150_ops, DISPLAY_SOURCE_LCDC0, DISPLAY_MAIN); } if(hdmi == NULL) { dev_err(&client->dev, "fail to register hdmi\n"); goto err_hdmi_register; } // Set HDMI private data hdmi_set_privdata(hdmi, anx); anx->dev.hdmi = hdmi; i2c_set_clientdata(client, anx); //Power on anx7150 if(anx->io_pwr_pin != INVALID_GPIO) { rc = gpio_request(anx->io_pwr_pin, NULL); if(rc) { gpio_free(anx->io_pwr_pin); printk(KERN_ERR "request anx7150 power control gpio error\n "); goto err_hdmi_register; } else gpio_direction_output(anx->io_pwr_pin, GPIO_HIGH); } anx->dev.anx7150_detect = ANX7150_hw_detect_device(anx->client); if(anx->dev.anx7150_detect) { HDMI_task(hdmi); #ifdef HDMI_USE_IRQ hdmi_changed(hdmi, 1); if((rc = gpio_request(client->irq, "hdmi gpio")) < 0) { dev_err(&client->dev, "fail to request gpio %d\n", client->irq); goto err_request_gpio; } anx->irq = gpio_to_irq(client->irq); anx->io_irq_pin = client->irq; gpio_pull_updown(client->irq,GPIOPullDown); gpio_direction_input(client->irq); #ifndef CONFIG_ANX7150_IRQ_USE_CHIP anx->init = IRQF_TRIGGER_RISING; if((rc = request_irq(anx->irq, anx7150_detect_irq,IRQF_TRIGGER_RISING,NULL,hdmi)) <0) #else if((rc = request_irq(anx->irq, anx7150_detect_irq,IRQF_TRIGGER_FALLING,NULL,hdmi)) <0) #endif { dev_err(&client->dev, "fail to request hdmi irq\n"); goto err_request_irq; } #else queue_delayed_work(hdmi->workqueue, &hdmi->delay_work, 1); #endif hdmi_enable(hdmi); dev_info(&client->dev, "anx7150 probe ok\n"); } else goto err_request_irq; return 0; err_request_irq: gpio_free(client->irq); err_request_gpio: hdmi_unregister(hdmi); err_hdmi_register: kfree(anx); anx = NULL; err_kzalloc_anx: hdmi = NULL; dev_err(&client->dev, "anx7150 probe error\n"); return rc; }