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 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; 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 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; }