static ssize_t gio_write(struct file *file, const char *buf, size_t count, \ loff_t *x) { int appType; int time_mics = 30; if (count != sizeof(int)) return -EINVAL; get_user(appType, (int *)buf); switch (appType) { case 3: { preempt_gpio1 = appType; printk(KERN_INFO "Request for GPIO = %d\n", \ preempt_gpio1); /* mdelay(time_mics); */ if (twl4030_request_gpio(preempt_gpio1) < 0) { printk(KERN_ERR "can't get GPIO\n"); return -EINVAL; } twl4030_set_gpio_direction(preempt_gpio1, 1); twl4030_set_gpio_debounce(preempt_gpio1, 1); twl4030_set_gpio_dataout(preempt_gpio1, 0); twl4030_set_gpio_dataout(preempt_gpio1, 1); twl4030_free_gpio(preempt_gpio1); break; } case 4: { preempt_gpio2 = appType; printk(KERN_INFO"Request for GPIO = %d\n", \ preempt_gpio2); if (omap_request_gpio(preempt_gpio2) < 0) { printk(KERN_ERR "can't get GPIO\n"); return -EINVAL; } twl4030_set_gpio_direction(preempt_gpio2, 1); twl4030_set_gpio_debounce(preempt_gpio2, 1); twl4030_set_gpio_dataout(preempt_gpio2, 0); twl4030_set_gpio_dataout(preempt_gpio2, 1); omap_free_gpio(preempt_gpio2); break; } default: printk(KERN_INFO "Entered default\n"); return -EINVAL; } return sizeof(int); }
/* * MMC Slot Initialization. */ static int hsmmc_late_init(struct device *dev) { int ret = 0; /* * Configure TWL4030 GPIO parameters for MMC hotplug irq */ ret = gpio_request(mmc1_cd_gpio, "mmc0_cd"); if (ret) goto err; ret = twl4030_set_gpio_debounce(0, true); if (ret) goto err; return ret; err: dev_err(dev, "Failed to configure TWL4030 GPIO IRQ\n"); return ret; }