diff options
Diffstat (limited to 'include/linux/rfkill.h')
-rw-r--r-- | include/linux/rfkill.h | 40 |
1 files changed, 31 insertions, 9 deletions
diff --git a/include/linux/rfkill.h b/include/linux/rfkill.h index a8a6ea809da0..0ce5e0b52dbd 100644 --- a/include/linux/rfkill.h +++ b/include/linux/rfkill.h | |||
@@ -2,7 +2,7 @@ | |||
2 | #define __RFKILL_H | 2 | #define __RFKILL_H |
3 | 3 | ||
4 | /* | 4 | /* |
5 | * Copyright (C) 2006 Ivo van Doorn | 5 | * Copyright (C) 2006 - 2007 Ivo van Doorn |
6 | * Copyright (C) 2007 Dmitry Torokhov | 6 | * Copyright (C) 2007 Dmitry Torokhov |
7 | * | 7 | * |
8 | * This program is free software; you can redistribute it and/or modify | 8 | * This program is free software; you can redistribute it and/or modify |
@@ -26,18 +26,19 @@ | |||
26 | #include <linux/list.h> | 26 | #include <linux/list.h> |
27 | #include <linux/mutex.h> | 27 | #include <linux/mutex.h> |
28 | #include <linux/device.h> | 28 | #include <linux/device.h> |
29 | #include <linux/leds.h> | ||
29 | 30 | ||
30 | /** | 31 | /** |
31 | * enum rfkill_type - type of rfkill switch. | 32 | * enum rfkill_type - type of rfkill switch. |
32 | * RFKILL_TYPE_WLAN: switch is no a Wireless network devices. | 33 | * RFKILL_TYPE_WLAN: switch is on a 802.11 wireless network device. |
33 | * RFKILL_TYPE_BlUETOOTH: switch is on a bluetooth device. | 34 | * RFKILL_TYPE_BLUETOOTH: switch is on a bluetooth device. |
34 | * RFKILL_TYPE_IRDA: switch is on an infrared devices. | 35 | * RFKILL_TYPE_UWB: switch is on a ultra wideband device. |
35 | */ | 36 | */ |
36 | enum rfkill_type { | 37 | enum rfkill_type { |
37 | RFKILL_TYPE_WLAN = 0, | 38 | RFKILL_TYPE_WLAN , |
38 | RFKILL_TYPE_BLUETOOTH = 1, | 39 | RFKILL_TYPE_BLUETOOTH, |
39 | RFKILL_TYPE_IRDA = 2, | 40 | RFKILL_TYPE_UWB, |
40 | RFKILL_TYPE_MAX = 3, | 41 | RFKILL_TYPE_MAX, |
41 | }; | 42 | }; |
42 | 43 | ||
43 | enum rfkill_state { | 44 | enum rfkill_state { |
@@ -51,11 +52,14 @@ enum rfkill_state { | |||
51 | * @type: Radio type which the button controls, the value stored | 52 | * @type: Radio type which the button controls, the value stored |
52 | * here should be a value from enum rfkill_type. | 53 | * here should be a value from enum rfkill_type. |
53 | * @state: State of the switch (on/off). | 54 | * @state: State of the switch (on/off). |
55 | * @user_claim_unsupported: Whether the hardware supports exclusive | ||
56 | * RF-kill control by userspace. Set this before registering. | ||
54 | * @user_claim: Set when the switch is controlled exlusively by userspace. | 57 | * @user_claim: Set when the switch is controlled exlusively by userspace. |
55 | * @mutex: Guards switch state transitions | 58 | * @mutex: Guards switch state transitions |
56 | * @data: Pointer to the RF button drivers private data which will be | 59 | * @data: Pointer to the RF button drivers private data which will be |
57 | * passed along when toggling radio state. | 60 | * passed along when toggling radio state. |
58 | * @toggle_radio(): Mandatory handler to control state of the radio. | 61 | * @toggle_radio(): Mandatory handler to control state of the radio. |
62 | * @led_trigger: A LED trigger for this button's LED. | ||
59 | * @dev: Device structure integrating the switch into device tree. | 63 | * @dev: Device structure integrating the switch into device tree. |
60 | * @node: Used to place switch into list of all switches known to the | 64 | * @node: Used to place switch into list of all switches known to the |
61 | * the system. | 65 | * the system. |
@@ -67,6 +71,7 @@ struct rfkill { | |||
67 | enum rfkill_type type; | 71 | enum rfkill_type type; |
68 | 72 | ||
69 | enum rfkill_state state; | 73 | enum rfkill_state state; |
74 | bool user_claim_unsupported; | ||
70 | bool user_claim; | 75 | bool user_claim; |
71 | 76 | ||
72 | struct mutex mutex; | 77 | struct mutex mutex; |
@@ -74,6 +79,10 @@ struct rfkill { | |||
74 | void *data; | 79 | void *data; |
75 | int (*toggle_radio)(void *data, enum rfkill_state state); | 80 | int (*toggle_radio)(void *data, enum rfkill_state state); |
76 | 81 | ||
82 | #ifdef CONFIG_RFKILL_LEDS | ||
83 | struct led_trigger led_trigger; | ||
84 | #endif | ||
85 | |||
77 | struct device dev; | 86 | struct device dev; |
78 | struct list_head node; | 87 | struct list_head node; |
79 | }; | 88 | }; |
@@ -84,6 +93,19 @@ void rfkill_free(struct rfkill *rfkill); | |||
84 | int rfkill_register(struct rfkill *rfkill); | 93 | int rfkill_register(struct rfkill *rfkill); |
85 | void rfkill_unregister(struct rfkill *rfkill); | 94 | void rfkill_unregister(struct rfkill *rfkill); |
86 | 95 | ||
87 | void rfkill_switch_all(enum rfkill_type type, enum rfkill_state state); | 96 | /** |
97 | * rfkill_get_led_name - Get the LED trigger name for the button's LED. | ||
98 | * This function might return a NULL pointer if registering of the | ||
99 | * LED trigger failed. | ||
100 | * Use this as "default_trigger" for the LED. | ||
101 | */ | ||
102 | static inline char *rfkill_get_led_name(struct rfkill *rfkill) | ||
103 | { | ||
104 | #ifdef CONFIG_RFKILL_LEDS | ||
105 | return (char *)(rfkill->led_trigger.name); | ||
106 | #else | ||
107 | return NULL; | ||
108 | #endif | ||
109 | } | ||
88 | 110 | ||
89 | #endif /* RFKILL_H */ | 111 | #endif /* RFKILL_H */ |