static int hsic_get_gpio_num(struct pci_dev *pdev) { #ifdef CONFIG_ACPI struct ush_hsic_pdata *pdata; acpi_handle handle; acpi_status status; pdata = pdev->dev.platform_data; status = acpi_get_handle(NULL, "\\_SB.PCI0.XHC1.RHUB.HSC1", &handle); if (ACPI_FAILURE(status)) { dev_err(&pdev->dev, "HSIC: cannot get HSC1 acpi handle\n"); /* Try to get GPIO pin number from fixed value */ pdata->aux_gpio = acpi_get_gpio("\\_SB.GPO2", 6); pdata->wakeup_gpio = acpi_get_gpio("\\_SB.GPO2", 22); if (gpio_is_valid(pdata->aux_gpio) && gpio_is_valid(pdata->wakeup_gpio)) { dev_info(&pdev->dev, "HSIC GPO2 aux %d wakeup %d\n", pdata->aux_gpio, pdata->wakeup_gpio); return 0; } else { dev_err(&pdev->dev, "HSIC: no GPO2 entry for GPIO\n"); return -ENODEV; } } /* Get the GPIO value from ACPI table */ pdata->aux_gpio = acpi_get_gpio_by_index(&pdev->dev, 0, NULL); if (pdata->aux_gpio < 0) { dev_err(&pdev->dev, "HSIC: fail to get AUX1 from acpi %d\n", pdata->aux_gpio); pdata->aux_gpio = acpi_get_gpio("\\_SB.GPO2", 6); if (!gpio_is_valid(pdata->aux_gpio)) { dev_err(&pdev->dev, "HSIC: no GPO2 entry for GPIO\n"); return -ENODEV; } } pdata->wakeup_gpio = acpi_get_gpio_by_index(&pdev->dev, 1, NULL); if (pdata->wakeup_gpio < 0) { dev_err(&pdev->dev, "HSIC: fail to get WAKEUP from acpi %d\n", pdata->wakeup_gpio); pdata->wakeup_gpio = acpi_get_gpio("\\_SB.GPO2", 22); if (!gpio_is_valid(pdata->wakeup_gpio)) { dev_err(&pdev->dev, "HSIC: no GPO2 entry for GPIO\n"); return -ENODEV; } } dev_info(&pdev->dev, "USH HSIC GPIO AUX %d WAKEUP %d\n", pdata->aux_gpio, pdata->wakeup_gpio); #endif return 0; }
static int smsc375x_irq_init(struct smsc375x_chip *chip) { struct i2c_client *client = chip->client; int ret, gpio_num; struct acpi_gpio_info gpio_info; /* get kernel GPIO number */ gpio_num = acpi_get_gpio_by_index(&client->dev, 0, &gpio_info); if (gpio_num < 0) { gpio_num = acpi_get_gpio("\\_SB.GPO2", 0x1); if (gpio_num < 0) dev_err(&client->dev, "failed to get GPIO\n"); } /* get irq number */ chip->client->irq = gpio_to_irq(gpio_num); if (client->irq) { ret = request_threaded_irq(client->irq, NULL, smsc375x_irq_handler, IRQF_TRIGGER_FALLING | IRQF_ONESHOT, "smsc375x", chip); if (ret) { dev_err(&client->dev, "failed to reqeust IRQ\n"); return ret; } enable_irq_wake(client->irq); } else { dev_err(&client->dev, "IRQ not set\n"); return -EINVAL; } return 0; }
static int wifi_plat_dev_drv_probe_acpi(struct platform_device *pdev) { wifi_adapter_info_t *adapter; acpi_handle handle; struct acpi_device *adev; int irq_num; /* Android style wifi platform data device ("bcmdhd_wlan" or "bcm4329_wlan") * is kept for backward compatibility and supports only 1 adapter */ ASSERT(dhd_wifi_platdata != NULL); ASSERT(dhd_wifi_platdata->num_adapters == 1); adapter = &dhd_wifi_platdata->adapters[0]; adapter->wifi_plat_data = (void *)&dhd_wlan_control; if (ACPI_HANDLE(&pdev->dev)) { handle = ACPI_HANDLE(&pdev->dev); /* Dont try to do acpi pm for the wifi module */ if (!handle || acpi_bus_get_device(handle, &adev)) DHD_ERROR(("%s: could not get acpi pointer!\n", __FUNCTION__)); else adev->flags.power_manageable = 0; irq_num = acpi_get_gpio_by_index(&pdev->dev, 0, NULL); DHD_INFO(("%s: Using ACPI table to get IRQ number: %d\n", __FUNCTION__, irq_num)); if (irq_num < 0) { if (INTEL_MID_BOARD(2, TABLET, BYT, BLB, PRO) || INTEL_MID_BOARD(2, TABLET, BYT, BLB, ENG)) { DHD_INFO(("%s: BYT-M hardcoding\n", __FUNCTION__)); irq_num = acpi_get_gpio("\\_SB.GPO2", 17); } else { DHD_INFO(("%s: BYT-T hardcoding\n", __FUNCTION__)); irq_num = acpi_get_gpio("\\_SB.GPO2", 15); } } } else { DHD_ERROR(("%s: Null ACPI_HANDLE, try legacy probe\n", __FUNCTION__)); return wifi_plat_dev_drv_probe(pdev); } adapter->irq_num = irq_num; adapter->intr_flags = IRQF_TRIGGER_FALLING; wifi_plat_dev_probe_ret = dhd_wifi_platform_load(); return wifi_plat_dev_probe_ret; }
/* * Ext-ISP m10mo platform data */ static int m10mo_gpio_ctrl(struct v4l2_subdev *sd, int flag) { int ret; if (camera_reset < 0) { #ifndef CONFIG_ACPI ret = camera_sensor_gpio(9, "RSTX", GPIOF_DIR_OUT, 0); if (ret < 0) return ret; camera_reset = ret; #else camera_reset = acpi_get_gpio("\\_SB.GPO1", 52); pr_info("%s: camera_reset is %d\n", __func__, camera_reset); ret = gpio_request(camera_reset, GP_CAMERA_0_RESET); if (ret) { pr_err("%s: failed to request reset pin\n", __func__); return -EINVAL; } ret = gpio_direction_output(camera_reset, 1); if (ret) { pr_err("%s: failed to set direction for reset pin\n", __func__); gpio_free(camera_reset); } #endif } if (flag) { /* reset = 0 is requied in case of ESD failure */ gpio_set_value(camera_reset, 0); usleep_range(100, 200); printk("@%s %d, project zx550ml pull up GPIO%d\n", __func__, __LINE__, camera_reset); gpio_set_value(camera_reset, 1); usleep_range(1000, 1500); } else { gpio_set_value(camera_reset, 0); } return 0; }
void __init *wm5102_platform_data(void *info) { int gpio; struct i2c_board_info *i2c_info = (struct i2c_board_info *)info; #if 1 /*TODO: Add BYT Specific flag*/ gpio=acpi_get_gpio("\\_SB.GPO2", 4); //i2c_info->irq = gpio_to_irq(gpio); printk("wm5102_platform_data =%d\n",gpio); #else gpio = get_gpio_by_name("gpio_codec_int"); i2c_info->irq = gpio + INTEL_MID_IRQ_OFFSET; #endif //wm5102_pdata.reset = acpi_get_gpio("\\_SB.I2C7.PMIC", 3); wm5102_pdata.reset = 203; wm5102_pdata.ldoena = 125; return &wm5102_pdata; }
static int m10mo_platform_init(void) { int ret; static const char gpio_name[] = "xenon_ready"; if (intr_gpio == -1) { #ifndef CONFIG_ACPI #if 0 intr_gpio = get_gpio_by_name(gpio_name); #else intr_gpio = 48; #endif if (intr_gpio == -1) { pr_err("Failed to get interrupt gpio\n"); return -EINVAL; } #else intr_gpio = acpi_get_gpio("\\_SB.GPO1", 54); #endif pr_info("camera interrupt gpio: %d\n", intr_gpio); } ret = gpio_request(intr_gpio, gpio_name); if (ret) { pr_err("Failed to request interrupt gpio(pin %d)\n", intr_gpio); return -EINVAL; } ret = gpio_direction_input(intr_gpio); if (ret) { pr_err("failed to set interrupt gpio %d direction\n", intr_gpio); gpio_free(intr_gpio); intr_gpio = -1; } return 0; }
static void *get_platform_data(void) { /* Redridge all */ if (INTEL_MID_BOARD(2, TABLET, MFLD, RR, ENG) || INTEL_MID_BOARD(2, TABLET, MFLD, RR, PRO)) return &smb347_rr_pdata; else if (INTEL_MID_BOARD(2, TABLET, MFLD, SLP, ENG) || INTEL_MID_BOARD(2, TABLET, MFLD, SLP, PRO)) { /* Salitpa */ /* EV 0.5 */ if (SPID_HARDWARE_ID(MFLD, TABLET, SLP, EV05)) return &smb347_ev05_pdata; /* EV 1.0 and later */ else return &smb347_ev10_pdata; } else if (intel_mid_identify_cpu() == INTEL_MID_CPU_CHIP_VALLEYVIEW2) { byt_t_ffrd8_pdata.irq_gpio = acpi_get_gpio("\\_SB_GPO2", 2); byt_t_ffrd8_pdata.irq_gpio = 132; /* sus0_2 */ return &byt_t_ffrd8_pdata; /* WA till the config data */ } return NULL; }