static int __init wlan_device_init(void) { int ret; wlan_host_get(); init_wifi_mem(); wlan_ldo_enable(); wlan_clk_init(); gpio_request(GPIO_WIFI_IRQ, "oob_irq"); gpio_direction_input(GPIO_WIFI_IRQ); wlan_resources[1].start = gpio_to_irq(GPIO_WIFI_IRQ); wlan_resources[1].end = gpio_to_irq(GPIO_WIFI_IRQ); gpio_request(GPIO_WIFI_SHUTDOWN,"wifi_pwd"); gpio_direction_output(GPIO_WIFI_SHUTDOWN, 0); ret = platform_device_register(&sprd_wlan_device); return ret; }
static int __init ssg_sdi_init(void) { ssg_sdi2_data.card_sleep_on_suspend = true; db8500_add_sdi2(&ssg_sdi2_data); janice_sdi2_init(); if ((sec_debug_settings & SEC_DBG_STM_VIA_SD_OPTS) == 0) { /* not tracing via SDI0 pins, so can enable SDI0 */ sdi0_configure(); db8500_add_sdi0(&ssg_sdi0_data); } db8500_add_sdi1(&ssg_sdi1_data); /* BCM */ janice_wifi_init(); #ifdef WLAN_STATIC_BUF init_wifi_mem(); #endif /* WLAN_STATIC_BUF */ return 0; }
static int __init k3v2_wifi_init(void) { int ret = 0; ret = init_wifi_mem(); if (ret) { pr_err("%s: init_wifi_mem failed.\n", __func__); goto err_malloc_wifi_host; } wifi_host = kzalloc(sizeof(struct wifi_host_s), GFP_KERNEL); if (!wifi_host) { pr_err("%s: malloc wifi_host failed.\n", __func__); ret = -ENOMEM; goto err_malloc_wifi_host; } #if defined CONFIG_MACH_K3V2OEM1 wifi_host->bEnable = false; /* get 32kb clock */ wifi_host->clk = clk_get(NULL, "clk_pmu32kb"); if (IS_ERR(wifi_host->clk)) { pr_err("%s: clk_get failed\n", __func__); ret = -ENXIO; goto err_clk_get; } /* get wifiio vdd */ wifi_host->vdd = regulator_get(NULL, "wifiio-vcc"); if (IS_ERR(wifi_host->vdd)) { pr_err("%s: regulator_get failed.\n", __func__); ret = -ENXIO; goto err_regulator_get; } ret = regulator_set_voltage(wifi_host->vdd, K3V2_WIFI_VDD_VOLTAGE, K3V2_WIFI_VDD_VOLTAGE); if (ret < 0) { pr_err("%s: regulator_set_voltage failed, ret:%d.\n", __func__, ret); ret = -ENXIO; goto err_regulator_set_voltage; } /* set io mux*/ wifi_host->block = iomux_get_block("block_wifi"); if (!wifi_host->block) { pr_err("%s: iomux_lookup_block failed.\n", __func__); ret = -ENXIO; goto err_iomux_get_block; } wifi_host->config = iomux_get_blockconfig("block_wifi"); if (!wifi_host->config) { pr_err("%s: iomux_get_blockconfig failed.\n", __func__); ret = -ENXIO; goto err_iomux_get_blockconfig; } ret = blockmux_set(wifi_host->block, wifi_host->config, LOWPOWER); if (ret < 0) { pr_err("%s: blockmux_set failed, ret.\n", __func__); goto err_blockmux_set; } #else /* fpga VDD open forver,if can not request other driver maybe has open*/ ret = gpio_request(K3V2_WIFI_VDD_GPIO, NULL); if (ret < 0) { pr_err("%s: gpio_request failed, ret:%d.\n", __func__, K3V2_WIFI_VDD_GPIO); } else gpio_direction_output(K3V2_WIFI_VDD_GPIO, 1); #endif /* set power gpio */ ret = gpio_request(K3V2_WIFI_POWER_GPIO, NULL); if (ret < 0) { pr_err("%s: gpio_request failed, ret:%d.\n", __func__, K3V2_WIFI_POWER_GPIO); goto err_power_gpio_request; } gpio_direction_output(K3V2_WIFI_POWER_GPIO, 0); /* set apwake gpio */ ret = gpio_request(K3V2_WIFI_IRQ_GPIO, NULL); if (ret < 0) { pr_err("%s: gpio_request failed, ret:%d.\n", __func__, K3V2_WIFI_IRQ_GPIO); goto err_irq_gpio_request; } gpio_direction_input(K3V2_WIFI_IRQ_GPIO); #ifdef CONFIG_WIFI_CONTROL_FUNC ret = platform_device_register(&k3v2_wifi_device); if (ret) { pr_err("%s: platform_device_register failed, ret:%d.\n", __func__, ret); goto err_platform_device_register; } #endif return 0; err_platform_device_register: gpio_free(K3V2_WIFI_IRQ_GPIO); err_irq_gpio_request: gpio_free(K3V2_WIFI_POWER_GPIO); err_power_gpio_request: #if defined(CONFIG_MACH_K3V2OEM1) err_blockmux_set: err_iomux_get_blockconfig: err_iomux_get_block: err_regulator_set_voltage: regulator_put(wifi_host->vdd); err_regulator_get: clk_put(wifi_host->clk); err_clk_get: kfree(wifi_host); wifi_host = NULL; #else gpio_free(K3V2_WIFI_VDD_GPIO); #endif err_malloc_wifi_host: deinit_wifi_mem(); return ret; }