diff options
Diffstat (limited to 'include/linux/rfkill.h')
| -rw-r--r-- | include/linux/rfkill.h | 46 |
1 files changed, 43 insertions, 3 deletions
diff --git a/include/linux/rfkill.h b/include/linux/rfkill.h index e3ab21d7fc7f..c5f6e54ec6ae 100644 --- a/include/linux/rfkill.h +++ b/include/linux/rfkill.h | |||
| @@ -34,26 +34,37 @@ | |||
| 34 | * RFKILL_TYPE_BLUETOOTH: switch is on a bluetooth device. | 34 | * RFKILL_TYPE_BLUETOOTH: switch is on a bluetooth device. |
| 35 | * RFKILL_TYPE_UWB: switch is on a ultra wideband device. | 35 | * RFKILL_TYPE_UWB: switch is on a ultra wideband device. |
| 36 | * RFKILL_TYPE_WIMAX: switch is on a WiMAX device. | 36 | * RFKILL_TYPE_WIMAX: switch is on a WiMAX device. |
| 37 | * RFKILL_TYPE_WWAN: switch is on a wireless WAN device. | ||
| 37 | */ | 38 | */ |
| 38 | enum rfkill_type { | 39 | enum rfkill_type { |
| 39 | RFKILL_TYPE_WLAN , | 40 | RFKILL_TYPE_WLAN , |
| 40 | RFKILL_TYPE_BLUETOOTH, | 41 | RFKILL_TYPE_BLUETOOTH, |
| 41 | RFKILL_TYPE_UWB, | 42 | RFKILL_TYPE_UWB, |
| 42 | RFKILL_TYPE_WIMAX, | 43 | RFKILL_TYPE_WIMAX, |
| 44 | RFKILL_TYPE_WWAN, | ||
| 43 | RFKILL_TYPE_MAX, | 45 | RFKILL_TYPE_MAX, |
| 44 | }; | 46 | }; |
| 45 | 47 | ||
| 46 | enum rfkill_state { | 48 | enum rfkill_state { |
| 47 | RFKILL_STATE_OFF = 0, | 49 | RFKILL_STATE_SOFT_BLOCKED = 0, /* Radio output blocked */ |
| 48 | RFKILL_STATE_ON = 1, | 50 | RFKILL_STATE_UNBLOCKED = 1, /* Radio output allowed */ |
| 51 | RFKILL_STATE_HARD_BLOCKED = 2, /* Output blocked, non-overrideable */ | ||
| 49 | }; | 52 | }; |
| 50 | 53 | ||
| 54 | /* | ||
| 55 | * These are DEPRECATED, drivers using them should be verified to | ||
| 56 | * comply with the rfkill usage guidelines in Documentation/rfkill.txt | ||
| 57 | * and then converted to use the new names for rfkill_state | ||
| 58 | */ | ||
| 59 | #define RFKILL_STATE_OFF RFKILL_STATE_SOFT_BLOCKED | ||
| 60 | #define RFKILL_STATE_ON RFKILL_STATE_UNBLOCKED | ||
| 61 | |||
| 51 | /** | 62 | /** |
| 52 | * struct rfkill - rfkill control structure. | 63 | * struct rfkill - rfkill control structure. |
| 53 | * @name: Name of the switch. | 64 | * @name: Name of the switch. |
| 54 | * @type: Radio type which the button controls, the value stored | 65 | * @type: Radio type which the button controls, the value stored |
| 55 | * here should be a value from enum rfkill_type. | 66 | * here should be a value from enum rfkill_type. |
| 56 | * @state: State of the switch (on/off). | 67 | * @state: State of the switch, "UNBLOCKED" means radio can operate. |
| 57 | * @user_claim_unsupported: Whether the hardware supports exclusive | 68 | * @user_claim_unsupported: Whether the hardware supports exclusive |
| 58 | * RF-kill control by userspace. Set this before registering. | 69 | * RF-kill control by userspace. Set this before registering. |
| 59 | * @user_claim: Set when the switch is controlled exlusively by userspace. | 70 | * @user_claim: Set when the switch is controlled exlusively by userspace. |
| @@ -61,6 +72,12 @@ enum rfkill_state { | |||
| 61 | * @data: Pointer to the RF button drivers private data which will be | 72 | * @data: Pointer to the RF button drivers private data which will be |
| 62 | * passed along when toggling radio state. | 73 | * passed along when toggling radio state. |
| 63 | * @toggle_radio(): Mandatory handler to control state of the radio. | 74 | * @toggle_radio(): Mandatory handler to control state of the radio. |
| 75 | * only RFKILL_STATE_SOFT_BLOCKED and RFKILL_STATE_UNBLOCKED are | ||
| 76 | * valid parameters. | ||
| 77 | * @get_state(): handler to read current radio state from hardware, | ||
| 78 | * may be called from atomic context, should return 0 on success. | ||
| 79 | * Either this handler OR judicious use of rfkill_force_state() is | ||
| 80 | * MANDATORY for any driver capable of RFKILL_STATE_HARD_BLOCKED. | ||
| 64 | * @led_trigger: A LED trigger for this button's LED. | 81 | * @led_trigger: A LED trigger for this button's LED. |
| 65 | * @dev: Device structure integrating the switch into device tree. | 82 | * @dev: Device structure integrating the switch into device tree. |
| 66 | * @node: Used to place switch into list of all switches known to the | 83 | * @node: Used to place switch into list of all switches known to the |
| @@ -80,6 +97,7 @@ struct rfkill { | |||
| 80 | 97 | ||
| 81 | void *data; | 98 | void *data; |
| 82 | int (*toggle_radio)(void *data, enum rfkill_state state); | 99 | int (*toggle_radio)(void *data, enum rfkill_state state); |
| 100 | int (*get_state)(void *data, enum rfkill_state *state); | ||
| 83 | 101 | ||
| 84 | #ifdef CONFIG_RFKILL_LEDS | 102 | #ifdef CONFIG_RFKILL_LEDS |
| 85 | struct led_trigger led_trigger; | 103 | struct led_trigger led_trigger; |
| @@ -95,6 +113,21 @@ void rfkill_free(struct rfkill *rfkill); | |||
| 95 | int rfkill_register(struct rfkill *rfkill); | 113 | int rfkill_register(struct rfkill *rfkill); |
| 96 | void rfkill_unregister(struct rfkill *rfkill); | 114 | void rfkill_unregister(struct rfkill *rfkill); |
| 97 | 115 | ||
| 116 | int rfkill_force_state(struct rfkill *rfkill, enum rfkill_state state); | ||
| 117 | |||
| 118 | /** | ||
| 119 | * rfkill_state_complement - return complementar state | ||
| 120 | * @state: state to return the complement of | ||
| 121 | * | ||
| 122 | * Returns RFKILL_STATE_SOFT_BLOCKED if @state is RFKILL_STATE_UNBLOCKED, | ||
| 123 | * returns RFKILL_STATE_UNBLOCKED otherwise. | ||
| 124 | */ | ||
| 125 | static inline enum rfkill_state rfkill_state_complement(enum rfkill_state state) | ||
| 126 | { | ||
| 127 | return (state == RFKILL_STATE_UNBLOCKED) ? | ||
| 128 | RFKILL_STATE_SOFT_BLOCKED : RFKILL_STATE_UNBLOCKED; | ||
| 129 | } | ||
| 130 | |||
| 98 | /** | 131 | /** |
| 99 | * rfkill_get_led_name - Get the LED trigger name for the button's LED. | 132 | * rfkill_get_led_name - Get the LED trigger name for the button's LED. |
| 100 | * This function might return a NULL pointer if registering of the | 133 | * This function might return a NULL pointer if registering of the |
| @@ -110,4 +143,11 @@ static inline char *rfkill_get_led_name(struct rfkill *rfkill) | |||
| 110 | #endif | 143 | #endif |
| 111 | } | 144 | } |
| 112 | 145 | ||
| 146 | /* rfkill notification chain */ | ||
| 147 | #define RFKILL_STATE_CHANGED 0x0001 /* state of a normal rfkill | ||
| 148 | switch has changed */ | ||
| 149 | |||
| 150 | int register_rfkill_notifier(struct notifier_block *nb); | ||
| 151 | int unregister_rfkill_notifier(struct notifier_block *nb); | ||
| 152 | |||
| 113 | #endif /* RFKILL_H */ | 153 | #endif /* RFKILL_H */ |
