Ivo van Doorn | cf4328c | 2007-05-07 00:34:20 -0700 | [diff] [blame] | 1 | #ifndef __RFKILL_H |
| 2 | #define __RFKILL_H |
| 3 | |
| 4 | /* |
Ivo van Doorn | fe242cf | 2007-09-27 14:57:05 -0700 | [diff] [blame] | 5 | * Copyright (C) 2006 - 2007 Ivo van Doorn |
Ivo van Doorn | cf4328c | 2007-05-07 00:34:20 -0700 | [diff] [blame] | 6 | * Copyright (C) 2007 Dmitry Torokhov |
Johannes Berg | 19d337d | 2009-06-02 13:01:37 +0200 | [diff] [blame] | 7 | * Copyright 2009 Johannes Berg <johannes@sipsolutions.net> |
Ivo van Doorn | cf4328c | 2007-05-07 00:34:20 -0700 | [diff] [blame] | 8 | * |
Johannes Berg | 8bc11b49 | 2009-08-26 18:13:17 +0200 | [diff] [blame] | 9 | * Permission to use, copy, modify, and/or distribute this software for any |
| 10 | * purpose with or without fee is hereby granted, provided that the above |
| 11 | * copyright notice and this permission notice appear in all copies. |
Ivo van Doorn | cf4328c | 2007-05-07 00:34:20 -0700 | [diff] [blame] | 12 | * |
Johannes Berg | 8bc11b49 | 2009-08-26 18:13:17 +0200 | [diff] [blame] | 13 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
| 14 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
| 15 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
| 16 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
| 17 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
| 18 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 19 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
Ivo van Doorn | cf4328c | 2007-05-07 00:34:20 -0700 | [diff] [blame] | 20 | */ |
| 21 | |
Johannes Berg | c64fb01 | 2009-06-02 13:01:38 +0200 | [diff] [blame] | 22 | #include <linux/types.h> |
Johannes Berg | 19d337d | 2009-06-02 13:01:37 +0200 | [diff] [blame] | 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 | |
Johannes Berg | c64fb01 | 2009-06-02 13:01:38 +0200 | [diff] [blame] | 29 | /** |
| 30 | * enum rfkill_type - type of rfkill switch. |
| 31 | * |
| 32 | * @RFKILL_TYPE_ALL: toggles all switches (userspace only) |
| 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. |
Marcel Holtmann | 0878c35 | 2009-11-18 16:48:00 +0100 | [diff] [blame] | 38 | * @RFKILL_TYPE_GPS: switch is on a GPS device. |
Marcel Holtmann | 875405a | 2009-11-18 16:48:01 +0100 | [diff] [blame] | 39 | * @RFKILL_TYPE_FM: switch is on a FM radio device. |
Johannes Berg | c64fb01 | 2009-06-02 13:01:38 +0200 | [diff] [blame] | 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, |
Tomas Winkler | 3ad2014 | 2009-08-02 02:36:49 +0300 | [diff] [blame] | 49 | RFKILL_TYPE_GPS, |
Marcel Holtmann | 875405a | 2009-11-18 16:48:01 +0100 | [diff] [blame] | 50 | RFKILL_TYPE_FM, |
Johannes Berg | c64fb01 | 2009-06-02 13:01:38 +0200 | [diff] [blame] | 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 | } __packed; |
| 85 | |
Johannes Berg | 1be491f | 2009-07-05 14:51:06 +0200 | [diff] [blame] | 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 |
| 99 | |
Johannes Berg | c64fb01 | 2009-06-02 13:01:38 +0200 | [diff] [blame] | 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 | |
Johannes Berg | 19d337d | 2009-06-02 13:01:37 +0200 | [diff] [blame] | 105 | /* and that's all userspace gets */ |
| 106 | #ifdef __KERNEL__ |
| 107 | /* don't allow anyone to use these in the kernel */ |
| 108 | enum rfkill_user_states { |
| 109 | RFKILL_USER_STATE_SOFT_BLOCKED = RFKILL_STATE_SOFT_BLOCKED, |
| 110 | RFKILL_USER_STATE_UNBLOCKED = RFKILL_STATE_UNBLOCKED, |
| 111 | RFKILL_USER_STATE_HARD_BLOCKED = RFKILL_STATE_HARD_BLOCKED, |
| 112 | }; |
| 113 | #undef RFKILL_STATE_SOFT_BLOCKED |
| 114 | #undef RFKILL_STATE_UNBLOCKED |
| 115 | #undef RFKILL_STATE_HARD_BLOCKED |
| 116 | |
Ivo van Doorn | cf4328c | 2007-05-07 00:34:20 -0700 | [diff] [blame] | 117 | #include <linux/kernel.h> |
| 118 | #include <linux/list.h> |
| 119 | #include <linux/mutex.h> |
| 120 | #include <linux/device.h> |
Michael Buesch | 135900c | 2007-09-27 21:33:12 +0200 | [diff] [blame] | 121 | #include <linux/leds.h> |
Johannes Berg | 1506e30 | 2009-06-09 17:49:06 -0700 | [diff] [blame] | 122 | #include <linux/err.h> |
Ivo van Doorn | cf4328c | 2007-05-07 00:34:20 -0700 | [diff] [blame] | 123 | |
Johannes Berg | 19d337d | 2009-06-02 13:01:37 +0200 | [diff] [blame] | 124 | /* this is opaque */ |
| 125 | struct rfkill; |
Ivo van Doorn | cf4328c | 2007-05-07 00:34:20 -0700 | [diff] [blame] | 126 | |
| 127 | /** |
Johannes Berg | 19d337d | 2009-06-02 13:01:37 +0200 | [diff] [blame] | 128 | * struct rfkill_ops - rfkill driver methods |
Ivo van Doorn | cf4328c | 2007-05-07 00:34:20 -0700 | [diff] [blame] | 129 | * |
Johannes Berg | 19d337d | 2009-06-02 13:01:37 +0200 | [diff] [blame] | 130 | * @poll: poll the rfkill block state(s) -- only assign this method |
| 131 | * when you need polling. When called, simply call one of the |
| 132 | * rfkill_set{,_hw,_sw}_state family of functions. If the hw |
| 133 | * is getting unblocked you need to take into account the return |
| 134 | * value of those functions to make sure the software block is |
| 135 | * properly used. |
| 136 | * @query: query the rfkill block state(s) and call exactly one of the |
| 137 | * rfkill_set{,_hw,_sw}_state family of functions. Assign this |
| 138 | * method if input events can cause hardware state changes to make |
| 139 | * the rfkill core query your driver before setting a requested |
| 140 | * block. |
| 141 | * @set_block: turn the transmitter on (blocked == false) or off |
Johannes Berg | c64fb01 | 2009-06-02 13:01:38 +0200 | [diff] [blame] | 142 | * (blocked == true) -- ignore and return 0 when hard blocked. |
Johannes Berg | 19d337d | 2009-06-02 13:01:37 +0200 | [diff] [blame] | 143 | * This callback must be assigned. |
Ivo van Doorn | cf4328c | 2007-05-07 00:34:20 -0700 | [diff] [blame] | 144 | */ |
Johannes Berg | 19d337d | 2009-06-02 13:01:37 +0200 | [diff] [blame] | 145 | struct rfkill_ops { |
| 146 | void (*poll)(struct rfkill *rfkill, void *data); |
| 147 | void (*query)(struct rfkill *rfkill, void *data); |
| 148 | int (*set_block)(void *data, bool blocked); |
Ivo van Doorn | cf4328c | 2007-05-07 00:34:20 -0700 | [diff] [blame] | 149 | }; |
Ivo van Doorn | cf4328c | 2007-05-07 00:34:20 -0700 | [diff] [blame] | 150 | |
Johannes Berg | 19d337d | 2009-06-02 13:01:37 +0200 | [diff] [blame] | 151 | #if defined(CONFIG_RFKILL) || defined(CONFIG_RFKILL_MODULE) |
| 152 | /** |
| 153 | * rfkill_alloc - allocate rfkill structure |
| 154 | * @name: name of the struct -- the string is not copied internally |
| 155 | * @parent: device that has rf switch on it |
| 156 | * @type: type of the switch (RFKILL_TYPE_*) |
| 157 | * @ops: rfkill methods |
| 158 | * @ops_data: data passed to each method |
| 159 | * |
| 160 | * This function should be called by the transmitter driver to allocate an |
| 161 | * rfkill structure. Returns %NULL on failure. |
| 162 | */ |
| 163 | struct rfkill * __must_check rfkill_alloc(const char *name, |
| 164 | struct device *parent, |
| 165 | const enum rfkill_type type, |
| 166 | const struct rfkill_ops *ops, |
| 167 | void *ops_data); |
| 168 | |
| 169 | /** |
| 170 | * rfkill_register - Register a rfkill structure. |
| 171 | * @rfkill: rfkill structure to be registered |
| 172 | * |
| 173 | * This function should be called by the transmitter driver to register |
Alan Jenkins | b3fa132 | 2009-06-08 13:27:27 +0100 | [diff] [blame] | 174 | * the rfkill structure. Before calling this function the driver needs |
| 175 | * to be ready to service method calls from rfkill. |
| 176 | * |
Alan Jenkins | 06d5caf | 2009-06-16 15:39:51 +0100 | [diff] [blame] | 177 | * If rfkill_init_sw_state() is not called before registration, |
| 178 | * set_block() will be called to initialize the software blocked state |
| 179 | * to a default value. |
Alan Jenkins | b3fa132 | 2009-06-08 13:27:27 +0100 | [diff] [blame] | 180 | * |
| 181 | * If the hardware blocked state is not set before registration, |
| 182 | * it is assumed to be unblocked. |
Johannes Berg | 19d337d | 2009-06-02 13:01:37 +0200 | [diff] [blame] | 183 | */ |
Henrique de Moraes Holschuh | 77fba13 | 2008-08-02 15:10:59 -0300 | [diff] [blame] | 184 | int __must_check rfkill_register(struct rfkill *rfkill); |
Johannes Berg | 19d337d | 2009-06-02 13:01:37 +0200 | [diff] [blame] | 185 | |
| 186 | /** |
| 187 | * rfkill_pause_polling(struct rfkill *rfkill) |
| 188 | * |
| 189 | * Pause polling -- say transmitter is off for other reasons. |
| 190 | * NOTE: not necessary for suspend/resume -- in that case the |
| 191 | * core stops polling anyway |
| 192 | */ |
| 193 | void rfkill_pause_polling(struct rfkill *rfkill); |
| 194 | |
| 195 | /** |
| 196 | * rfkill_resume_polling(struct rfkill *rfkill) |
| 197 | * |
| 198 | * Pause polling -- say transmitter is off for other reasons. |
| 199 | * NOTE: not necessary for suspend/resume -- in that case the |
| 200 | * core stops polling anyway |
| 201 | */ |
| 202 | void rfkill_resume_polling(struct rfkill *rfkill); |
| 203 | |
| 204 | |
| 205 | /** |
| 206 | * rfkill_unregister - Unregister a rfkill structure. |
| 207 | * @rfkill: rfkill structure to be unregistered |
| 208 | * |
| 209 | * This function should be called by the network driver during device |
| 210 | * teardown to destroy rfkill structure. Until it returns, the driver |
| 211 | * needs to be able to service method calls. |
| 212 | */ |
Ivo van Doorn | cf4328c | 2007-05-07 00:34:20 -0700 | [diff] [blame] | 213 | void rfkill_unregister(struct rfkill *rfkill); |
| 214 | |
Michael Buesch | 135900c | 2007-09-27 21:33:12 +0200 | [diff] [blame] | 215 | /** |
Johannes Berg | 19d337d | 2009-06-02 13:01:37 +0200 | [diff] [blame] | 216 | * rfkill_destroy - free rfkill structure |
| 217 | * @rfkill: rfkill structure to be destroyed |
Henrique de Moraes Holschuh | 5005657 | 2008-06-23 17:46:42 -0300 | [diff] [blame] | 218 | * |
Johannes Berg | 19d337d | 2009-06-02 13:01:37 +0200 | [diff] [blame] | 219 | * Destroys the rfkill structure. |
Henrique de Moraes Holschuh | 5005657 | 2008-06-23 17:46:42 -0300 | [diff] [blame] | 220 | */ |
Johannes Berg | 19d337d | 2009-06-02 13:01:37 +0200 | [diff] [blame] | 221 | void rfkill_destroy(struct rfkill *rfkill); |
Henrique de Moraes Holschuh | 5005657 | 2008-06-23 17:46:42 -0300 | [diff] [blame] | 222 | |
| 223 | /** |
Johannes Berg | 19d337d | 2009-06-02 13:01:37 +0200 | [diff] [blame] | 224 | * rfkill_set_hw_state - Set the internal rfkill hardware block state |
| 225 | * @rfkill: pointer to the rfkill class to modify. |
| 226 | * @state: the current hardware block state to set |
| 227 | * |
| 228 | * rfkill drivers that get events when the hard-blocked state changes |
| 229 | * use this function to notify the rfkill core (and through that also |
Alan Jenkins | 908209c | 2009-06-08 13:12:23 +0100 | [diff] [blame] | 230 | * userspace) of the current state. They should also use this after |
Johannes Berg | 19d337d | 2009-06-02 13:01:37 +0200 | [diff] [blame] | 231 | * resume if the state could have changed. |
| 232 | * |
| 233 | * You need not (but may) call this function if poll_state is assigned. |
| 234 | * |
| 235 | * This function can be called in any context, even from within rfkill |
| 236 | * callbacks. |
| 237 | * |
| 238 | * The function returns the combined block state (true if transmitter |
| 239 | * should be blocked) so that drivers need not keep track of the soft |
| 240 | * block state -- which they might not be able to. |
Michael Buesch | 135900c | 2007-09-27 21:33:12 +0200 | [diff] [blame] | 241 | */ |
Alan Jenkins | e56f097 | 2009-07-18 19:20:20 +0100 | [diff] [blame] | 242 | bool rfkill_set_hw_state(struct rfkill *rfkill, bool blocked); |
Johannes Berg | 19d337d | 2009-06-02 13:01:37 +0200 | [diff] [blame] | 243 | |
| 244 | /** |
| 245 | * rfkill_set_sw_state - Set the internal rfkill software block state |
| 246 | * @rfkill: pointer to the rfkill class to modify. |
| 247 | * @state: the current software block state to set |
| 248 | * |
| 249 | * rfkill drivers that get events when the soft-blocked state changes |
| 250 | * (yes, some platforms directly act on input but allow changing again) |
| 251 | * use this function to notify the rfkill core (and through that also |
Alan Jenkins | 06d5caf | 2009-06-16 15:39:51 +0100 | [diff] [blame] | 252 | * userspace) of the current state. |
| 253 | * |
| 254 | * Drivers should also call this function after resume if the state has |
| 255 | * been changed by the user. This only makes sense for "persistent" |
| 256 | * devices (see rfkill_init_sw_state()). |
Johannes Berg | 19d337d | 2009-06-02 13:01:37 +0200 | [diff] [blame] | 257 | * |
| 258 | * This function can be called in any context, even from within rfkill |
| 259 | * callbacks. |
| 260 | * |
| 261 | * The function returns the combined block state (true if transmitter |
| 262 | * should be blocked). |
| 263 | */ |
| 264 | bool rfkill_set_sw_state(struct rfkill *rfkill, bool blocked); |
| 265 | |
| 266 | /** |
Alan Jenkins | 06d5caf | 2009-06-16 15:39:51 +0100 | [diff] [blame] | 267 | * rfkill_init_sw_state - Initialize persistent software block state |
| 268 | * @rfkill: pointer to the rfkill class to modify. |
| 269 | * @state: the current software block state to set |
| 270 | * |
| 271 | * rfkill drivers that preserve their software block state over power off |
| 272 | * use this function to notify the rfkill core (and through that also |
| 273 | * userspace) of their initial state. It should only be used before |
| 274 | * registration. |
| 275 | * |
Alan Jenkins | 464902e | 2009-06-16 14:54:04 +0100 | [diff] [blame] | 276 | * In addition, it marks the device as "persistent", an attribute which |
| 277 | * can be read by userspace. Persistent devices are expected to preserve |
| 278 | * their own state when suspended. |
Alan Jenkins | 06d5caf | 2009-06-16 15:39:51 +0100 | [diff] [blame] | 279 | */ |
| 280 | void rfkill_init_sw_state(struct rfkill *rfkill, bool blocked); |
| 281 | |
| 282 | /** |
Johannes Berg | 19d337d | 2009-06-02 13:01:37 +0200 | [diff] [blame] | 283 | * rfkill_set_states - Set the internal rfkill block states |
| 284 | * @rfkill: pointer to the rfkill class to modify. |
| 285 | * @sw: the current software block state to set |
| 286 | * @hw: the current hardware block state to set |
| 287 | * |
| 288 | * This function can be called in any context, even from within rfkill |
| 289 | * callbacks. |
| 290 | */ |
| 291 | void rfkill_set_states(struct rfkill *rfkill, bool sw, bool hw); |
| 292 | |
| 293 | /** |
Johannes Berg | 6081162 | 2009-06-02 13:01:40 +0200 | [diff] [blame] | 294 | * rfkill_blocked - query rfkill block |
| 295 | * |
| 296 | * @rfkill: rfkill struct to query |
| 297 | */ |
| 298 | bool rfkill_blocked(struct rfkill *rfkill); |
Johannes Berg | 19d337d | 2009-06-02 13:01:37 +0200 | [diff] [blame] | 299 | #else /* !RFKILL */ |
| 300 | static inline struct rfkill * __must_check |
| 301 | rfkill_alloc(const char *name, |
| 302 | struct device *parent, |
| 303 | const enum rfkill_type type, |
| 304 | const struct rfkill_ops *ops, |
| 305 | void *ops_data) |
Michael Buesch | 135900c | 2007-09-27 21:33:12 +0200 | [diff] [blame] | 306 | { |
Johannes Berg | 19d337d | 2009-06-02 13:01:37 +0200 | [diff] [blame] | 307 | return ERR_PTR(-ENODEV); |
Michael Buesch | 135900c | 2007-09-27 21:33:12 +0200 | [diff] [blame] | 308 | } |
| 309 | |
Johannes Berg | 19d337d | 2009-06-02 13:01:37 +0200 | [diff] [blame] | 310 | static inline int __must_check rfkill_register(struct rfkill *rfkill) |
| 311 | { |
| 312 | if (rfkill == ERR_PTR(-ENODEV)) |
| 313 | return 0; |
| 314 | return -EINVAL; |
| 315 | } |
| 316 | |
| 317 | static inline void rfkill_pause_polling(struct rfkill *rfkill) |
| 318 | { |
| 319 | } |
| 320 | |
| 321 | static inline void rfkill_resume_polling(struct rfkill *rfkill) |
| 322 | { |
| 323 | } |
| 324 | |
| 325 | static inline void rfkill_unregister(struct rfkill *rfkill) |
| 326 | { |
| 327 | } |
| 328 | |
| 329 | static inline void rfkill_destroy(struct rfkill *rfkill) |
| 330 | { |
| 331 | } |
| 332 | |
| 333 | static inline bool rfkill_set_hw_state(struct rfkill *rfkill, bool blocked) |
| 334 | { |
| 335 | return blocked; |
| 336 | } |
| 337 | |
| 338 | static inline bool rfkill_set_sw_state(struct rfkill *rfkill, bool blocked) |
| 339 | { |
| 340 | return blocked; |
| 341 | } |
| 342 | |
Alan Jenkins | 06d5caf | 2009-06-16 15:39:51 +0100 | [diff] [blame] | 343 | static inline void rfkill_init_sw_state(struct rfkill *rfkill, bool blocked) |
| 344 | { |
| 345 | } |
| 346 | |
Johannes Berg | 19d337d | 2009-06-02 13:01:37 +0200 | [diff] [blame] | 347 | static inline void rfkill_set_states(struct rfkill *rfkill, bool sw, bool hw) |
| 348 | { |
| 349 | } |
| 350 | |
Johannes Berg | 6081162 | 2009-06-02 13:01:40 +0200 | [diff] [blame] | 351 | static inline bool rfkill_blocked(struct rfkill *rfkill) |
| 352 | { |
| 353 | return false; |
| 354 | } |
Johannes Berg | 19d337d | 2009-06-02 13:01:37 +0200 | [diff] [blame] | 355 | #endif /* RFKILL || RFKILL_MODULE */ |
| 356 | |
| 357 | |
| 358 | #ifdef CONFIG_RFKILL_LEDS |
| 359 | /** |
| 360 | * rfkill_get_led_trigger_name - Get the LED trigger name for the button's LED. |
| 361 | * This function might return a NULL pointer if registering of the |
| 362 | * LED trigger failed. Use this as "default_trigger" for the LED. |
| 363 | */ |
| 364 | const char *rfkill_get_led_trigger_name(struct rfkill *rfkill); |
| 365 | |
| 366 | /** |
| 367 | * rfkill_set_led_trigger_name -- set the LED trigger name |
| 368 | * @rfkill: rfkill struct |
| 369 | * @name: LED trigger name |
| 370 | * |
| 371 | * This function sets the LED trigger name of the radio LED |
| 372 | * trigger that rfkill creates. It is optional, but if called |
| 373 | * must be called before rfkill_register() to be effective. |
| 374 | */ |
| 375 | void rfkill_set_led_trigger_name(struct rfkill *rfkill, const char *name); |
| 376 | #else |
| 377 | static inline const char *rfkill_get_led_trigger_name(struct rfkill *rfkill) |
| 378 | { |
| 379 | return NULL; |
| 380 | } |
| 381 | |
| 382 | static inline void |
| 383 | rfkill_set_led_trigger_name(struct rfkill *rfkill, const char *name) |
| 384 | { |
| 385 | } |
| 386 | #endif |
| 387 | |
| 388 | #endif /* __KERNEL__ */ |
| 389 | |
Ivo van Doorn | cf4328c | 2007-05-07 00:34:20 -0700 | [diff] [blame] | 390 | #endif /* RFKILL_H */ |