int __init archos_accel_init(struct mma7456l_pdata *pdata) { const struct archos_accel_config *accel_cfg; accel_cfg = omap_get_config( ARCHOS_TAG_ACCEL, struct archos_accel_config ); if (accel_cfg == NULL) { printk(KERN_DEBUG "archos_accel_init: no board configuration found\n"); return -ENODEV; } if ( hardware_rev >= accel_cfg->nrev ) { printk(KERN_DEBUG "archos_accel_init: hardware_rev (%i) >= nrev (%i)\n", hardware_rev, accel_cfg->nrev); return -ENODEV; } accel_gpio = accel_cfg->rev[hardware_rev]; /* irq needed by the driver */ pdata->irq1 = gpio_to_irq(GPIO_PIN( accel_gpio.accel_int1 )); pdata->irq2 = gpio_to_irq(GPIO_PIN( accel_gpio.accel_int2 )); printk("archos_accel_init: irq1 %d, irq2 %d\n",pdata->irq1,pdata->irq2); GPIO_INIT_INPUT( accel_gpio.accel_int1 ); GPIO_INIT_INPUT( accel_gpio.accel_int2 ); omap_set_gpio_debounce(GPIO_PIN( accel_gpio.accel_int1 ),1); omap_set_gpio_debounce(GPIO_PIN( accel_gpio.accel_int2 ),1); return 0; }
static int nl5550_probe(struct platform_device *pdev) { int ret; struct nl5550_struct *nl5550 = pdev->dev.platform_data; struct archos_gps_conf *conf = &nl5550->gps_conf; GPIO_INIT_OUTPUT(conf->gps_enable); GPIO_INIT_INPUT(conf->gps_int); omap_cfg_reg(AD25_34XX_UART2_RX); omap_cfg_reg(AA25_34XX_UART2_TX); INIT_WORK(&nl5550->work, nl5550_irq_worker); ret = request_irq(OMAP_GPIO_IRQ(GPIO_PIN(conf->gps_int)), nl5550_isr, IRQF_TRIGGER_RISING, "nl5550", nl5550); if (ret < 0) { dev_err(&pdev->dev, "nl5550_probe: cannot register irq %d\n", OMAP_GPIO_IRQ(GPIO_PIN(conf->gps_int))); return ret; } ret = device_create_file(&pdev->dev, &dev_attr_enable); if (ret < 0) dev_dbg(&pdev->dev, "cannot add enable attr\n"); ret = device_create_file(&pdev->dev, &dev_attr_intr); if (ret < 0) dev_dbg(&pdev->dev, "cannot add intr attr\n"); wake_lock_init(&nl5550->wake_lock, WAKE_LOCK_SUSPEND, "nl5550"); nl5550->pdev = pdev; return 0; }
int __init archos_usb2sata_init(void) { int ret; const struct archos_sata_config *sata_cfg; sata_cfg = omap_get_config( ARCHOS_TAG_SATA, struct archos_sata_config ); if (sata_cfg == NULL) { printk(KERN_DEBUG "archos_sata_init: no board configuration found\n"); return -ENODEV; } if (hardware_rev >= sata_cfg->nrev) { printk(KERN_DEBUG "archos_sata_init: hardware_rev (%i) >= nrev (%i)\n", hardware_rev, sata_cfg->nrev); return -ENODEV; } printk(KERN_DEBUG "archos_usb2sata_init\n"); clkout1 = clk_get(NULL, "sys_clkout1"); if (IS_ERR(clkout1)) { printk(KERN_ERR "clk_get(sys_clkout1) failed\n"); return PTR_ERR(clkout1); } /* sysfs setup */ ret = platform_device_register(&usb2sata_device); if (ret) return ret; /* SATA bridge */ gpio_sata_pwron = sata_cfg->rev[hardware_rev].sata_power; ret = device_create_file(&usb2sata_device.dev, &dev_attr_satavcc); if (ret == 0) { printk(KERN_DEBUG "archos_usb2sata_init: sata_pwron on GPIO%i\n", GPIO_PIN(gpio_sata_pwron)); GPIO_INIT_OUTPUT(gpio_sata_pwron); omap_set_gpio_dataout(GPIO_PIN(gpio_sata_pwron), 0); } /* HDD power switch */ gpio_hdd_pwron = sata_cfg->rev[hardware_rev].hdd_power; printk(KERN_DEBUG "archos_usb2sata_init: sata_pwron on GPIO%i\n", GPIO_PIN(gpio_hdd_pwron)); GPIO_INIT_OUTPUT(gpio_hdd_pwron); omap_set_gpio_dataout(GPIO_PIN(gpio_hdd_pwron), 0); /* SATA_RDY signal */ gpio_sata_rdy = sata_cfg->rev[hardware_rev].sata_ready; ret = device_create_file(&usb2sata_device.dev, &dev_attr_satardy); if (ret == 0) { printk(KERN_DEBUG "archos_usb2sata_init: sata_ready on GPIO%i\n", GPIO_PIN(gpio_sata_rdy)); GPIO_INIT_INPUT(gpio_sata_rdy); } clk_enable(clkout1); usbsata_power(0); return 0; }
static int archos_mmc1_setup_gpios(struct twl4030_hsmmc_info *c, struct regulator_init_data *reg_init_data) { const struct archos_sd_config *hsmmc_cfg; struct archos_gpio gpio_hsmmc_power, gpio_hsmmc_cd,gpio_hsmmc_cpd; /* sd */ hsmmc_cfg = omap_get_config( ARCHOS_TAG_SD, struct archos_sd_config ); if (hsmmc_cfg == NULL) { printk(KERN_DEBUG "%s: no board configuration found\n", __FUNCTION__); return -ENODEV; } if ( hardware_rev >= hsmmc_cfg->nrev ) { printk(KERN_DEBUG "%s: hardware_rev (%i) >= nrev (%i)\n", __FUNCTION__, hardware_rev, hsmmc_cfg->nrev); return -ENODEV; } printk(KERN_DEBUG "%s\n", __FUNCTION__); gpio_hsmmc_power = hsmmc_cfg->rev[hardware_rev].sd_power; GPIO_INIT_OUTPUT( gpio_hsmmc_power ); reg_init_data->driver_data = (void*)GPIO_PIN( gpio_hsmmc_power ); gpio_hsmmc_cd = hsmmc_cfg->rev[hardware_rev].sd_detect; gpio_hsmmc_cpd = hsmmc_cfg->rev[hardware_rev].sd_prewarn; /* card detect */ c->gpio_cd = GPIO_PIN(gpio_hsmmc_cd); /* Need to be here, before omap2_init_mmc which will correctly set the IRQ stuff */ GPIO_INIT_INPUT(gpio_hsmmc_cd); gpio_free(c->gpio_cd); return 0; }