e9c09604c26b6a43d67cbfc089a1dc9e2acbd115
[firefly-linux-kernel-4.4.55.git] / drivers / net / wireless / rockchip_wlan / rkwifi / bcmdhd / dhd_gpio.c
1 /*
2 * Customer code to add GPIO control during WLAN start/stop
3 * Copyright (C) 1999-2011, Broadcom Corporation
4
5 *         Unless you and Broadcom execute a separate written software license
6 * agreement governing use of this software, this software is licensed to you
7 * under the terms of the GNU General Public License version 2 (the "GPL"),
8 * available at http://www.broadcom.com/licenses/GPLv2.php, with the
9 * following added to such license:
10
11 *      As a special exception, the copyright holders of this software give you
12 * permission to link this software with independent modules, and to copy and
13 * distribute the resulting executable under terms of your choice, provided that
14 * you also meet, for each linked independent module, the terms and conditions of
15 * the license of that module.  An independent module is a module which is not
16 * derived from this software.  The special exception does not apply to any
17 * modifications of the software.
18
19 *      Notwithstanding the above, under no circumstances may you combine this
20 * software in any way with any other Broadcom software provided under a license
21 * other than the GPL, without Broadcom's express prior written consent.
22 *
23 * $Id: dhd_custom_gpio.c,v 1.2.42.1 2010-10-19 00:41:09 Exp $
24 */
25
26 #include <linux/kernel.h>
27 #include <linux/platform_device.h>
28 #include <linux/module.h>
29 #include <linux/rfkill.h>
30 #include <linux/init.h>
31 #include <linux/slab.h>
32 #include <linux/delay.h>
33 #include <linux/interrupt.h>
34 #include <linux/rfkill-wlan.h>
35
36 #ifdef CUSTOMER_HW
37 #ifdef CUSTOMER_OOB
38 int bcm_wlan_get_oob_irq(void)
39 {
40     return rockchip_wifi_get_oob_irq();
41 }
42 #endif
43
44 void bcm_wlan_power_on(int flag)
45 {
46         if (flag == 1) {
47                 printk("======== PULL WL_REG_ON HIGH! ========\n");
48                 rockchip_wifi_power(1);
49         msleep(100);
50         rockchip_wifi_set_carddetect();
51         } else {
52                 printk("======== PULL WL_REG_ON HIGH! (flag = %d) ========\n", flag);
53                 rockchip_wifi_power(1);
54         msleep(100);
55         }
56 }
57
58 void bcm_wlan_power_off(int flag)
59 {
60         if (flag == 1) {
61                 printk("======== Card detection to remove SDIO card! ========\n");
62                 rockchip_wifi_power(0);
63         } else {
64                 printk("======== PULL WL_REG_ON LOW! (flag = %d) ========\n", flag);
65                 rockchip_wifi_power(0);
66         }
67 }
68
69 #endif /* CUSTOMER_HW */