static int bug_dock_probe(struct platform_device *pdev) { int err; bool value; struct dock_device *bug_dock; mutex_lock(&count_lock); bug_dock = kzalloc(sizeof(struct dock_device), GFP_KERNEL); bug_dock->pdev = pdev; // init usb_count usb_count = 0; // init work struct INIT_WORK(&bug_dock->irq_handler_work, irq_handler_work); // request control of USB reset err = gpio_request(USB_RESET, "usb_reset"); err |= gpio_direction_output(USB_RESET, 1); // request dock presence pin err = gpio_request(DOCK_PRESENCE, "dock_presence"); err |= gpio_direction_input(DOCK_PRESENCE); omap_set_gpio_debounce(DOCK_PRESENCE, 1); omap_set_gpio_debounce_time(DOCK_PRESENCE, 0xff); omap_cfg_reg(AH19_34XX_GPIO113); // request dock presence irq err = request_irq(gpio_to_irq(DOCK_PRESENCE), dock_irq_handler, IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING, "bug-dock", bug_dock); platform_set_drvdata(pdev, bug_dock); err = sysfs_create_file(&pdev->dev.kobj, &dev_attr_usb_enable.attr); if (err < 0) printk(KERN_ERR "Error creating SYSFS entries...\n"); // check for dock value = gpio_get_value(DOCK_PRESENCE); if (!value) { gpio_set_value (USB_RESET, 1); usb_count ++; } else { gpio_set_value (USB_RESET, 0); } if (err < 0) { printk(KERN_ERR "bug_dock: error during probe...\n"); return -EINVAL; } mutex_unlock(&count_lock); printk(KERN_INFO "bug_dock: bug_dock_probe...\n"); return 0; }
static void ads7846_dev_init(void) { if (gpio_request(OMAP3_EVM_TS_GPIO, "ADS7846 pendown") < 0) printk(KERN_ERR "can't get ads7846 pen down GPIO\n"); gpio_direction_input(OMAP3_EVM_TS_GPIO); omap_set_gpio_debounce(OMAP3_EVM_TS_GPIO, 1); omap_set_gpio_debounce_time(OMAP3_EVM_TS_GPIO, 0xa); }
static void it7260_tch_gpio_init(void) { if (gpio_request(ZOOM2_TOUCHSCREEN_IRQ_GPIO, "touch") < 0) { printk(KERN_ERR "can't get cypress touch pen(%d) down GPIO\n"); return; } gpio_direction_input(ZOOM2_TOUCHSCREEN_IRQ_GPIO); omap_set_gpio_debounce(ZOOM2_TOUCHSCREEN_IRQ_GPIO, 1); omap_set_gpio_debounce_time(ZOOM2_TOUCHSCREEN_IRQ_GPIO, 0xa); }
/** * @brief ads7846_dev_init : Requests & sets GPIO line for pen-irq * * @return - void. If request gpio fails then Flag KERN_ERR. */ static void ads7846_dev_init(void) { if (gpio_request(ts_gpio, "ads7846 irq") < 0) { printk(KERN_ERR "can't get ads746 pen down GPIO\n"); return; } gpio_direction_input(ts_gpio); omap_set_gpio_debounce(ts_gpio, 1); omap_set_gpio_debounce_time(ts_gpio, 0xa); }
static int tsc2004_init(void) { int res; res = gpio_direction_input(10); omap_set_gpio_debounce(10, 1); omap_set_gpio_debounce_time(10, 0xff); return 1; }
static void __init omap3_ads7846_init(void) { if (gpio_request(OMAP3_TS_GPIO, "ads7846_pen_down")) { printk(KERN_ERR "Failed to request GPIO %d for " "ads7846 pen down IRQ\n", OMAP3_TS_GPIO); return; } gpio_direction_input(OMAP3_TS_GPIO); omap_set_gpio_debounce(OMAP3_TS_GPIO, 1); omap_set_gpio_debounce_time(OMAP3_TS_GPIO, 0xa); }
static void synaptics_dev_init(void) { /* Set the ts_gpio pin mux */ omap_cfg_reg(H18_34XX_GPIO163); if (gpio_request(OMAP_SYNAPTICS_GPIO, "touch") < 0) { printk(KERN_ERR "can't get synaptics pen down GPIO\n"); return; } gpio_direction_input(OMAP_SYNAPTICS_GPIO); omap_set_gpio_debounce(OMAP_SYNAPTICS_GPIO, 1); omap_set_gpio_debounce_time(OMAP_SYNAPTICS_GPIO, 0xa); }
static void synaptics_dev_init(void) { /* Set the ts_gpio pin mux */ omap_mux_init_signal("gpio_163", OMAP_PIN_INPUT_PULLUP); if (gpio_request(OMAP_SYNAPTICS_GPIO, "touch") < 0) { printk(KERN_ERR "can't get synaptics pen down GPIO\n"); return; } gpio_direction_input(OMAP_SYNAPTICS_GPIO); omap_set_gpio_debounce(OMAP_SYNAPTICS_GPIO, 1); omap_set_gpio_debounce_time(OMAP_SYNAPTICS_GPIO, 0xa); }
static int omapbmi_slot_probe(struct platform_device *pdev) { struct bmi_slot *slot; struct resource *irq_pres, *irq_stat; struct omap_bmi_platform_data* slot_pdata; int ret; printk(KERN_INFO "Buglabs 2.0 BUG Slots Driver...\n"); irq_pres = platform_get_resource(pdev, IORESOURCE_IRQ, 0); if (!irq_pres) { dev_err(&pdev->dev, "No presence irq resource...\n"); return -ENODEV; } irq_stat = platform_get_resource(pdev, IORESOURCE_IRQ, 1); if (!irq_stat) { dev_err(&pdev->dev, "No status irq resource...\n"); return -ENODEV; } slot = kzalloc(sizeof(struct bmi_slot), GFP_KERNEL); if (!slot) { ret = -ENOMEM; goto err_release; } //Request slot enable gpios ret = gpio_request(225, "slot0 buf"); ret = gpio_request(226, "slot0 en"); ret = gpio_request(232, "slot1 buf"); ret = gpio_request(227, "slot1 en"); ret = gpio_request(216, "slot2 buf"); ret = gpio_request(228, "slot2 en"); ret = gpio_request(217, "slot3 buf"); ret = gpio_request(229, "slot3 en"); ret = gpio_request(irq_stat->start, "BMI SINT"); if (ret) { printk(KERN_ERR "slots_bug: GPIO %d request failed...\n",irq_stat->start); goto err_release; } ret = gpio_request(irq_pres->start, "BMI PINT"); if (ret) { printk(KERN_ERR "slots_bug: GPIO %d request failed...\n",irq_pres->start); goto err_release; } ret = gpio_direction_input(irq_pres->start); omap_set_gpio_debounce(irq_pres->start, 1); omap_set_gpio_debounce_time(irq_pres->start, 0xff); slot_pdata = pdev->dev.platform_data; omapbmi_slot_gpio_req(slot_pdata->gpios); slot->slot_data = (void*)slot_pdata->gpios; slot->present_irq = gpio_to_irq(irq_pres->start); slot->status_irq = gpio_to_irq(irq_stat->start); slot->owner = THIS_MODULE; slot->name = "omap_bug_slot"; slot->slotdev.parent = &pdev->dev; slot->adap = i2c_get_adapter(slot_pdata->i2c_bus_no); slot->actions = &bl_actions; slot->spi_bus_num = 1; slot->spi_cs = slot_pdata->spi_cs; ret = bmi_add_slot(slot); if (ret) { printk(KERN_ERR "slots_bug: Trouble instantiating slot...%d\n", ret); goto err_release; } // disable_irq_nosync(slot->present_irq); schedule_delayed_work(&slot->work, msecs_to_jiffies(1000)); return 0; err_release: kfree(slot->slot_data); kfree(slot); return ret; }
static void __init pandora_keys_gpio_init(void) { /* set debounce time for GPIO banks 4 and 6 */ omap_set_gpio_debounce_time(32 * 3, GPIO_DEBOUNCE_TIME); omap_set_gpio_debounce_time(32 * 5, GPIO_DEBOUNCE_TIME); }