static int mhl_i2c_remove(struct i2c_client *client) { pr_debug("%s\n", __func__); mhl_sii_gpio_setup(0); kfree(mhl_msm_state->mhl_data); return 0; }
/* * I2C probe */ static int mhl_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id) { int ret = -ENODEV; mhl_msm_state->mhl_data = kzalloc(sizeof(struct msm_mhl_platform_data), GFP_KERNEL); if (!(mhl_msm_state->mhl_data)) { ret = -ENOMEM; pr_err("MHL I2C Probe failed - no mem\n"); goto probe_exit; } mhl_msm_state->i2c_client = client; spin_lock_init(&mhl_state_lock); i2c_set_clientdata(client, mhl_msm_state); mhl_msm_state->mhl_data = client->dev.platform_data; pr_debug("MHL: mhl_msm_state->mhl_data->irq=[%d]\n", mhl_msm_state->mhl_data->irq); /* Init GPIO stuff here */ ret = mhl_sii_gpio_setup(1); if (ret == -1) { pr_err("MHL: mhl_gpio_init has failed\n"); ret = -ENODEV; goto probe_exit; } mhl_sii_power_on(); pr_debug("I2C PROBE successful\n"); return 0; probe_exit: if (mhl_msm_state->mhl_data) { /* free the gpios */ mhl_sii_gpio_setup(0); kfree(mhl_msm_state->mhl_data); mhl_msm_state->mhl_data = NULL; } return ret; }
/* * I2C probe */ static int mhl_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id) { int ret; struct msm_mhl_platform_data *tmp = client->dev.platform_data; if (!tmp->mhl_enabled) { ret = -ENODEV; pr_warn("MHL feautre left disabled\n"); goto probe_early_exit; } mhl_msm_state->mhl_data = kzalloc(sizeof(struct msm_mhl_platform_data), GFP_KERNEL); if (!(mhl_msm_state->mhl_data)) { ret = -ENOMEM; pr_err("MHL I2C Probe failed - no mem\n"); goto probe_early_exit; } mhl_msm_state->i2c_client = client; spin_lock_init(&mhl_state_lock); i2c_set_clientdata(client, mhl_msm_state); mhl_msm_state->mhl_data = client->dev.platform_data; pr_debug("MHL: mhl_msm_state->mhl_data->irq=[%d]\n", mhl_msm_state->mhl_data->irq); msc_send_workqueue = create_workqueue("mhl_msc_cmd_queue"); mhl_msm_state->cur_state = POWER_STATE_D0_MHL; /* Init GPIO stuff here */ ret = mhl_sii_gpio_setup(1); if (ret) { pr_err("MHL: mhl_gpio_init has failed\n"); ret = -ENODEV; goto probe_early_exit; } mhl_sii_power_on(); /* MHL SII 8334 chip specific init */ mhl_chip_init(); init_completion(&mhl_msm_state->rgnd_done); /* Request IRQ stuff here */ pr_debug("MHL: mhl_msm_state->mhl_data->irq=[%d]\n", mhl_msm_state->mhl_data->irq); ret = request_threaded_irq(mhl_msm_state->mhl_data->irq, NULL, &mhl_tx_isr, IRQF_TRIGGER_LOW | IRQF_ONESHOT, "mhl_tx_isr", mhl_msm_state); if (ret) { pr_err("request_threaded_irq failed, status: %d\n", ret); goto probe_exit; } else { pr_debug("request_threaded_irq succeeded\n"); } INIT_WORK(&mhl_msm_state->mhl_msc_send_work, mhl_msc_send_work); INIT_LIST_HEAD(&mhl_msm_state->list_cmd); mhl_msm_state->msc_command_put_work = list_cmd_put; mhl_msm_state->msc_command_get_work = list_cmd_get; init_completion(&mhl_msm_state->msc_cmd_done); pr_debug("i2c probe successful\n"); return 0; probe_exit: if (mhl_msm_state->mhl_data) { /* free the gpios */ mhl_sii_gpio_setup(0); kfree(mhl_msm_state->mhl_data); mhl_msm_state->mhl_data = NULL; } probe_early_exit: return ret; }