diff options
author | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-17 16:15:55 -0500 |
---|---|---|
committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-17 16:15:55 -0500 |
commit | 8dea78da5cee153b8af9c07a2745f6c55057fe12 (patch) | |
tree | a8f4d49d63b1ecc92f2fddceba0655b2472c5bd9 /include/linux/rfkill.h | |
parent | 406089d01562f1e2bf9f089fd7637009ebaad589 (diff) |
Patched in Tegra support.
Diffstat (limited to 'include/linux/rfkill.h')
-rw-r--r-- | include/linux/rfkill.h | 123 |
1 files changed, 89 insertions, 34 deletions
diff --git a/include/linux/rfkill.h b/include/linux/rfkill.h index d9010789b4e..c6c608482cb 100644 --- a/include/linux/rfkill.h +++ b/include/linux/rfkill.h | |||
@@ -1,3 +1,6 @@ | |||
1 | #ifndef __RFKILL_H | ||
2 | #define __RFKILL_H | ||
3 | |||
1 | /* | 4 | /* |
2 | * Copyright (C) 2006 - 2007 Ivo van Doorn | 5 | * Copyright (C) 2006 - 2007 Ivo van Doorn |
3 | * Copyright (C) 2007 Dmitry Torokhov | 6 | * Copyright (C) 2007 Dmitry Torokhov |
@@ -15,11 +18,92 @@ | |||
15 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 18 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
16 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 19 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
17 | */ | 20 | */ |
18 | #ifndef __RFKILL_H | ||
19 | #define __RFKILL_H | ||
20 | 21 | ||
21 | #include <uapi/linux/rfkill.h> | 22 | #include <linux/types.h> |
23 | |||
24 | /* define userspace visible states */ | ||
25 | #define RFKILL_STATE_SOFT_BLOCKED 0 | ||
26 | #define RFKILL_STATE_UNBLOCKED 1 | ||
27 | #define RFKILL_STATE_HARD_BLOCKED 2 | ||
28 | |||
29 | /** | ||
30 | * enum rfkill_type - type of rfkill switch. | ||
31 | * | ||
32 | * @RFKILL_TYPE_ALL: toggles all switches (requests only - not a switch type) | ||
33 | * @RFKILL_TYPE_WLAN: switch is on a 802.11 wireless network device. | ||
34 | * @RFKILL_TYPE_BLUETOOTH: switch is on a bluetooth device. | ||
35 | * @RFKILL_TYPE_UWB: switch is on a ultra wideband device. | ||
36 | * @RFKILL_TYPE_WIMAX: switch is on a WiMAX device. | ||
37 | * @RFKILL_TYPE_WWAN: switch is on a wireless WAN device. | ||
38 | * @RFKILL_TYPE_GPS: switch is on a GPS device. | ||
39 | * @RFKILL_TYPE_FM: switch is on a FM radio device. | ||
40 | * @NUM_RFKILL_TYPES: number of defined rfkill types | ||
41 | */ | ||
42 | enum rfkill_type { | ||
43 | RFKILL_TYPE_ALL = 0, | ||
44 | RFKILL_TYPE_WLAN, | ||
45 | RFKILL_TYPE_BLUETOOTH, | ||
46 | RFKILL_TYPE_UWB, | ||
47 | RFKILL_TYPE_WIMAX, | ||
48 | RFKILL_TYPE_WWAN, | ||
49 | RFKILL_TYPE_GPS, | ||
50 | RFKILL_TYPE_FM, | ||
51 | NUM_RFKILL_TYPES, | ||
52 | }; | ||
53 | |||
54 | /** | ||
55 | * enum rfkill_operation - operation types | ||
56 | * @RFKILL_OP_ADD: a device was added | ||
57 | * @RFKILL_OP_DEL: a device was removed | ||
58 | * @RFKILL_OP_CHANGE: a device's state changed -- userspace changes one device | ||
59 | * @RFKILL_OP_CHANGE_ALL: userspace changes all devices (of a type, or all) | ||
60 | */ | ||
61 | enum rfkill_operation { | ||
62 | RFKILL_OP_ADD = 0, | ||
63 | RFKILL_OP_DEL, | ||
64 | RFKILL_OP_CHANGE, | ||
65 | RFKILL_OP_CHANGE_ALL, | ||
66 | }; | ||
67 | |||
68 | /** | ||
69 | * struct rfkill_event - events for userspace on /dev/rfkill | ||
70 | * @idx: index of dev rfkill | ||
71 | * @type: type of the rfkill struct | ||
72 | * @op: operation code | ||
73 | * @hard: hard state (0/1) | ||
74 | * @soft: soft state (0/1) | ||
75 | * | ||
76 | * Structure used for userspace communication on /dev/rfkill, | ||
77 | * used for events from the kernel and control to the kernel. | ||
78 | */ | ||
79 | struct rfkill_event { | ||
80 | __u32 idx; | ||
81 | __u8 type; | ||
82 | __u8 op; | ||
83 | __u8 soft, hard; | ||
84 | } __attribute__((packed)); | ||
85 | |||
86 | /* | ||
87 | * We are planning to be backward and forward compatible with changes | ||
88 | * to the event struct, by adding new, optional, members at the end. | ||
89 | * When reading an event (whether the kernel from userspace or vice | ||
90 | * versa) we need to accept anything that's at least as large as the | ||
91 | * version 1 event size, but might be able to accept other sizes in | ||
92 | * the future. | ||
93 | * | ||
94 | * One exception is the kernel -- we already have two event sizes in | ||
95 | * that we've made the 'hard' member optional since our only option | ||
96 | * is to ignore it anyway. | ||
97 | */ | ||
98 | #define RFKILL_EVENT_SIZE_V1 8 | ||
22 | 99 | ||
100 | /* ioctl for turning off rfkill-input (if present) */ | ||
101 | #define RFKILL_IOC_MAGIC 'R' | ||
102 | #define RFKILL_IOC_NOINPUT 1 | ||
103 | #define RFKILL_IOCTL_NOINPUT _IO(RFKILL_IOC_MAGIC, RFKILL_IOC_NOINPUT) | ||
104 | |||
105 | /* and that's all userspace gets */ | ||
106 | #ifdef __KERNEL__ | ||
23 | /* don't allow anyone to use these in the kernel */ | 107 | /* don't allow anyone to use these in the kernel */ |
24 | enum rfkill_user_states { | 108 | enum rfkill_user_states { |
25 | RFKILL_USER_STATE_SOFT_BLOCKED = RFKILL_STATE_SOFT_BLOCKED, | 109 | RFKILL_USER_STATE_SOFT_BLOCKED = RFKILL_STATE_SOFT_BLOCKED, |
@@ -33,10 +117,10 @@ enum rfkill_user_states { | |||
33 | #include <linux/kernel.h> | 117 | #include <linux/kernel.h> |
34 | #include <linux/list.h> | 118 | #include <linux/list.h> |
35 | #include <linux/mutex.h> | 119 | #include <linux/mutex.h> |
120 | #include <linux/device.h> | ||
36 | #include <linux/leds.h> | 121 | #include <linux/leds.h> |
37 | #include <linux/err.h> | 122 | #include <linux/err.h> |
38 | 123 | ||
39 | struct device; | ||
40 | /* this is opaque */ | 124 | /* this is opaque */ |
41 | struct rfkill; | 125 | struct rfkill; |
42 | 126 | ||
@@ -270,35 +354,6 @@ static inline bool rfkill_blocked(struct rfkill *rfkill) | |||
270 | } | 354 | } |
271 | #endif /* RFKILL || RFKILL_MODULE */ | 355 | #endif /* RFKILL || RFKILL_MODULE */ |
272 | 356 | ||
273 | 357 | #endif /* __KERNEL__ */ | |
274 | #ifdef CONFIG_RFKILL_LEDS | ||
275 | /** | ||
276 | * rfkill_get_led_trigger_name - Get the LED trigger name for the button's LED. | ||
277 | * This function might return a NULL pointer if registering of the | ||
278 | * LED trigger failed. Use this as "default_trigger" for the LED. | ||
279 | */ | ||
280 | const char *rfkill_get_led_trigger_name(struct rfkill *rfkill); | ||
281 | |||
282 | /** | ||
283 | * rfkill_set_led_trigger_name -- set the LED trigger name | ||
284 | * @rfkill: rfkill struct | ||
285 | * @name: LED trigger name | ||
286 | * | ||
287 | * This function sets the LED trigger name of the radio LED | ||
288 | * trigger that rfkill creates. It is optional, but if called | ||
289 | * must be called before rfkill_register() to be effective. | ||
290 | */ | ||
291 | void rfkill_set_led_trigger_name(struct rfkill *rfkill, const char *name); | ||
292 | #else | ||
293 | static inline const char *rfkill_get_led_trigger_name(struct rfkill *rfkill) | ||
294 | { | ||
295 | return NULL; | ||
296 | } | ||
297 | |||
298 | static inline void | ||
299 | rfkill_set_led_trigger_name(struct rfkill *rfkill, const char *name) | ||
300 | { | ||
301 | } | ||
302 | #endif | ||
303 | 358 | ||
304 | #endif /* RFKILL_H */ | 359 | #endif /* RFKILL_H */ |