• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * drivers/misc/sunxi-rf/sunxi-rfkill.h
3  *
4  * Copyright (c) 2014 softwinner.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  */
17 
18 #ifndef __SUNXI_RFKILL_H
19 #define __SUNXI_RFKILL_H
20 
21 #include <linux/regulator/consumer.h>
22 #include <linux/platform_device.h>
23 #include <linux/clk.h>
24 #include <linux/rfkill.h>
25 
26 #define WL_DEV_WIFI            0  /* bit0 */
27 #define WL_DEV_BLUETOOTH       1  /* bit1 */
28 
29 #define CLK_MAX                5
30 #define PWR_MAX                5
31 
32 struct sunxi_rfkill_platdata {
33 	struct pinctrl *pctrl;
34 	int gpio_power_en;
35 	bool gpio_power_en_assert;
36 	int gpio_chip_en;
37 	bool gpio_chip_en_assert;
38 };
39 
40 struct sunxi_modem_platdata {
41 	struct regulator *power[PWR_MAX];
42 	char  *power_name[PWR_MAX];
43 	u32    power_vol[PWR_MAX];
44 
45 	int gpio_modem_rst;
46 	bool gpio_modem_rst_assert;
47 
48 	bool power_state;
49 	struct rfkill *rfkill;
50 	struct platform_device *pdev;
51 };
52 
53 struct sunxi_bt_platdata {
54 	struct regulator *power[PWR_MAX];
55 	char  *power_name[PWR_MAX];
56 	u32    power_vol[PWR_MAX];
57 
58 	struct clk *clk[CLK_MAX];
59 	char  *clk_name[CLK_MAX];
60 
61 	int gpio_bt_rst;
62 	bool gpio_bt_rst_assert;
63 
64 	int power_state;
65 	struct rfkill *rfkill;
66 	struct platform_device *pdev;
67 };
68 
69 struct sunxi_wlan_platdata {
70 	unsigned int wakeup_enable;
71 	int bus_index;
72 
73 	struct regulator *power[PWR_MAX];
74 	char  *power_name[PWR_MAX];
75 	u32    power_vol[PWR_MAX];
76 
77 	struct clk *clk[CLK_MAX];
78 	char  *clk_name[CLK_MAX];
79 
80 	int gpio_wlan_regon;
81 	bool gpio_wlan_regon_assert;
82 	int gpio_wlan_hostwake;
83 	bool gpio_wlan_hostwake_assert;
84 
85 	int power_state;
86 	struct platform_device *pdev;
87 };
88 
89 void sunxi_wlan_set_power(bool on_off);
90 int  sunxi_wlan_get_bus_index(void);
91 int  sunxi_wlan_get_oob_irq(int *irq_flags, int *wakeup_enable);
92 void sunxi_bluetooth_set_power(bool on_off);
93 void sunxi_modem_set_power(bool on_off);
94 
95 #endif /* SUNXI_RFKILL_H */
96