static int zeebo_bt_init(struct platform_device *pdev) { int rc; printk(KERN_DEBUG "%s\n", __func__); vreg_bt = vreg_get_by_id(0, 11); // rftx if (IS_ERR(vreg_bt)) { rc = PTR_ERR(vreg_bt); goto fail_vreg_bt; } rc = gpio_request(TOPA100_BT_RST, "BT Power"); if (rc) goto fail_power_gpio; return 0; fail_power_gpio: vreg_put(vreg_bt); fail_vreg_bt: printk(KERN_ERR "%s: failed with %d\n", __func__, rc); return rc; }
static int htckovsky_oj_probe(struct platform_device *pdev) { struct input_dev *input = NULL; struct i2c_client *client; int ret = 0; pr_info(MODULE_NAME ": Initializing MicroP Optical Joystick driver\n"); client = dev_get_drvdata(&pdev->dev); if (!client) { pr_err(MODULE_NAME ": failed to get i2c_client via drvdata\n"); ret = -EINVAL; goto fail_invalid_data; } htckovsky_oj.client = client; if (pdev->id != -1) { pr_err(MODULE_NAME ": device id != -1, aborting\n"); ret = -EINVAL; goto fail_invalid_data; } mutex_init(&htckovsky_oj.lock); INIT_WORK(&htckovsky_oj.oj_work, htckovsky_oj_work); // Initialize input device input = input_allocate_device(); if (!input) { ret = -ENODEV; goto fail_input_alloc; } input->name = MODULE_NAME; input->phys = client->adapter->name; input->id.bustype = BUS_I2C; input->id.vendor = 0x0001; input->id.product = 0x0001; input->id.version = 0x0100; __set_bit(EV_REL, input->evbit); __set_bit(EV_KEY, input->evbit); input_set_capability(input, EV_REL, REL_X); input_set_capability(input, EV_REL, REL_Y); input_set_capability(input, EV_KEY, KEY_UP); input_set_capability(input, EV_KEY, KEY_DOWN); input_set_capability(input, EV_KEY, KEY_LEFT); input_set_capability(input, EV_KEY, KEY_RIGHT); ret = input_register_device(input); if (ret) { goto fail_input_register; } htckovsky_oj.pdev = pdev; htckovsky_oj.input = input; platform_set_drvdata(pdev, &htckovsky_oj); ret = gpio_request(KOVS100_JOYSTICK_IRQ, "Joystick IRQ"); if (ret) { goto fail_gpio_request; } gpio_direction_input(KOVS100_JOYSTICK_IRQ); htckovsky_oj.vreg_pwr = vreg_get_by_id(&pdev->dev, 11); if (!htckovsky_oj.vreg_pwr) { goto fail_vreg_pwr; } htckovsky_oj.vreg_28v = vreg_get_by_id(&pdev->dev, 17); if (!htckovsky_oj.vreg_28v) { goto fail_vreg_28v; } htckovsky_oj_power(false); htckovsky_oj_power(true); ret = request_irq(gpio_to_irq(KOVS100_JOYSTICK_IRQ), htckovsky_oj_interrupt, IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING, "Joystick IRQ", NULL); if (ret) { pr_err("Couldn't request joystick IRQ error: %d\n", ret); goto fail_irq; } device_init_wakeup(&pdev->dev, 1); htckovsky_oj_start_polling(); return 0; fail_irq: vreg_put(htckovsky_oj.vreg_28v); fail_vreg_28v: vreg_put(htckovsky_oj.vreg_pwr); fail_vreg_pwr: gpio_free(KOVS100_JOYSTICK_IRQ); fail_gpio_request: input_unregister_device(input); fail_input_register: input_free_device(input); fail_input_alloc: fail_invalid_data: return ret; }
static int msm7200a_wl1251_probe(struct platform_device *pdev) { int rc; struct vreg* vreg; struct msm7200a_wl1251_pdata *pdata = pdev->dev.platform_data; if (!pdata) { pr_err("%s: no platform data\n", __func__); return -EINVAL; } if (pdata->slot_number < 1 || pdata->slot_number > 4) { pr_err("%s: invalid slot number %d\n", __func__, pdata->slot_number); return -EINVAL; } memset(&wl1251_priv, 0, sizeof(wl1251_priv)); if (pdata->gpio_irq >= 0) { rc = gpio_request(pdata->gpio_irq, "WiFi IRQ"); if (rc) { goto err_gpio_irq; } #if MSM7200A_WL1251_HACK wl1251_pdata.irq = gpio_to_irq(pdata->gpio_irq); set_irq_flags(wl1251_pdata.irq, IRQF_VALID | IRQF_NOAUTOEN); #endif } if (pdata->gpio_32k_osc >= 0) { rc = gpio_request(pdata->gpio_32k_osc, "WiFi IRQ"); if (rc) { goto err_gpio_32k_osc; } } if (pdata->gpio_enable >= 0) { rc = gpio_request(pdata->gpio_enable, "WiFi Power"); if (rc) { goto err_gpio_enable; } } if (pdata->gpio_reset >= 0) { rc = gpio_request(pdata->gpio_reset, "WiFi Reset"); if (rc) { goto err_gpio_reset; } } if (pdata->vreg_id >= 0) { vreg = vreg_get_by_id(&pdev->dev, pdata->vreg_id); if (IS_ERR(vreg)) { rc = PTR_ERR(vreg); goto err_vreg; } wl1251_priv.vreg = vreg; } msm7200a_setup_gpios(pdata->slot_number, &wl1251_priv.gpios); rc = msm_gpios_request(wl1251_priv.gpios.on, wl1251_priv.gpios.on_length); if (rc) { goto err_sdcc_gpios; } wl1251_priv.pdata = pdata; rc = msm_add_sdcc(pdata->slot_number, &msm7200a_wl1251_data, 0, 0); if (rc) { goto err_sdcc_dev; } #if MSM7200A_WL1251_HACK rc = platform_device_register(&wl1251_device); if (rc) { goto err_pdev; } #endif return 0; #if MSM7200A_WL1251_HACK err_pdev: msm_delete_sdcc(pdata->slot_number); #endif err_sdcc_dev: wl1251_priv.pdata = NULL; err_sdcc_gpios: if (wl1251_priv.vreg) { vreg_put(wl1251_priv.vreg); wl1251_priv.vreg = NULL; } err_vreg: if (pdata->gpio_reset >= 0) { gpio_free(pdata->gpio_reset); } err_gpio_reset: if (pdata->gpio_enable >= 0) { gpio_free(pdata->gpio_enable); } err_gpio_enable: if (pdata->gpio_32k_osc >= 0) { gpio_free(pdata->gpio_32k_osc); } err_gpio_32k_osc: if (pdata->gpio_irq >= 0) { gpio_free(pdata->gpio_irq); } err_gpio_irq: return rc; }
static int msm7200a_mmc_probe(struct platform_device *pdev) { int rc; struct vreg* vreg; struct msm7200a_mmc_pdata *pdata = pdev->dev.platform_data; if (!pdata) { pr_err("%s: no platform data\n", __func__); return -EINVAL; } if (pdata->slot_number < 1 || pdata->slot_number > 4) { pr_err("%s: invalid slot number %d\n", __func__, pdata->slot_number); return -EINVAL; } memset(&sdslot_priv, 0, sizeof(sdslot_priv)); if (pdata->gpio_detection >= 0) { rc = gpio_request(pdata->gpio_detection, "SD Status"); if (rc) { goto err_gpio; } } if (pdata->vreg_id >= 0) { vreg = vreg_get_by_id(&pdev->dev, pdata->vreg_id); if (IS_ERR(vreg)) { rc = PTR_ERR(vreg); goto err_vreg; } sdslot_priv.vreg = vreg; } msm7200a_setup_gpios(pdata->slot_number, &sdslot_priv.gpios); rc = msm_gpios_request(sdslot_priv.gpios.on, sdslot_priv.gpios.on_length); if (rc) { goto err_sdcc_gpios; } sdslot_priv.pdata = pdata; if (pdata->gpio_detection >= 0) { set_irq_wake(gpio_to_irq(pdata->gpio_detection), 1); rc = msm_add_sdcc(pdata->slot_number, &msm7200a_sdslot_data, gpio_to_irq(pdata->gpio_detection), IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING); } else { rc = msm_add_sdcc(pdata->slot_number, &msm7200a_sdslot_data, 0, 0); } if (rc) { goto err_sdcc_dev; } return 0; err_sdcc_dev: sdslot_priv.pdata = NULL; if (pdata->gpio_detection >= 0) { set_irq_wake(gpio_to_irq(pdata->gpio_detection), 0); } err_sdcc_gpios: if (sdslot_priv.vreg) { vreg_put(sdslot_priv.vreg); sdslot_priv.vreg = NULL; } err_vreg: if (pdata->gpio_detection >= 0) { gpio_free(pdata->gpio_detection); } err_gpio: return rc; }