diff options
| author | Ivo van Doorn <IvDoorn@gmail.com> | 2007-05-07 03:34:20 -0400 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2007-05-07 03:34:20 -0400 |
| commit | cf4328cd949c2086091c62c5685f1580fe9b55e4 (patch) | |
| tree | bd9d96f1c99910076b6f5f34cd5cd2da30405ef1 /include | |
| parent | 2396a22e0989df6038996506bfbf7a57f116c299 (diff) | |
[NET]: rfkill: add support for input key to control wireless radio
The RF kill patch that provides infrastructure for implementing
switches controlling radio states on various network and other cards.
[dtor@insightbb.com: address review comments]
[akpm@linux-foundation.org: cleanups, build fixes]
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/rfkill.h | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/include/linux/rfkill.h b/include/linux/rfkill.h new file mode 100644 index 000000000000..7c1ffbab7865 --- /dev/null +++ b/include/linux/rfkill.h | |||
| @@ -0,0 +1,89 @@ | |||
| 1 | #ifndef __RFKILL_H | ||
| 2 | #define __RFKILL_H | ||
| 3 | |||
| 4 | /* | ||
| 5 | * Copyright (C) 2006 Ivo van Doorn | ||
| 6 | * Copyright (C) 2007 Dmitry Torokhov | ||
| 7 | * | ||
| 8 | * This program is free software; you can redistribute it and/or modify | ||
| 9 | * it under the terms of the GNU General Public License as published by | ||
| 10 | * the Free Software Foundation; either version 2 of the License, or | ||
| 11 | * (at your option) any later version. | ||
| 12 | * | ||
| 13 | * This program is distributed in the hope that it will be useful, | ||
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 16 | * GNU General Public License for more details. | ||
| 17 | * | ||
| 18 | * You should have received a copy of the GNU General Public License | ||
| 19 | * along with this program; if not, write to the | ||
| 20 | * Free Software Foundation, Inc., | ||
| 21 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
| 22 | */ | ||
| 23 | |||
| 24 | #include <linux/types.h> | ||
| 25 | #include <linux/kernel.h> | ||
| 26 | #include <linux/list.h> | ||
| 27 | #include <linux/mutex.h> | ||
| 28 | #include <linux/device.h> | ||
| 29 | |||
| 30 | /** | ||
| 31 | * enum rfkill_type - type of rfkill switch. | ||
| 32 | * RFKILL_TYPE_WLAN: switch is no a Wireless network devices. | ||
| 33 | * RFKILL_TYPE_BlUETOOTH: switch is on a bluetooth device. | ||
| 34 | * RFKILL_TYPE_IRDA: switch is on an infrared devices. | ||
| 35 | */ | ||
| 36 | enum rfkill_type { | ||
| 37 | RFKILL_TYPE_WLAN = 0, | ||
| 38 | RFKILL_TYPE_BLUETOOTH = 1, | ||
| 39 | RFKILL_TYPE_IRDA = 2, | ||
| 40 | RFKILL_TYPE_MAX = 3, | ||
| 41 | }; | ||
| 42 | |||
| 43 | enum rfkill_state { | ||
| 44 | RFKILL_STATE_OFF = 0, | ||
| 45 | RFKILL_STATE_ON = 1, | ||
| 46 | }; | ||
| 47 | |||
| 48 | /** | ||
| 49 | * struct rfkill - rfkill control structure. | ||
| 50 | * @name: Name of the switch. | ||
| 51 | * @type: Radio type which the button controls, the value stored | ||
| 52 | * here should be a value from enum rfkill_type. | ||
| 53 | * @state: State of the switch (on/off). | ||
| 54 | * @user_claim: Set when the switch is controlled exlusively by userspace. | ||
| 55 | * @mutex: Guards switch state transitions | ||
| 56 | * @data: Pointer to the RF button drivers private data which will be | ||
| 57 | * passed along when toggling radio state. | ||
| 58 | * @toggle_radio(): Mandatory handler to control state of the radio. | ||
| 59 | * @dev: Device structure integrating the switch into device tree. | ||
| 60 | * @node: Used to place switch into list of all switches known to the | ||
| 61 | * the system. | ||
| 62 | * | ||
| 63 | * This structure represents a RF switch located on a network device. | ||
| 64 | */ | ||
| 65 | struct rfkill { | ||
| 66 | char *name; | ||
| 67 | enum rfkill_type type; | ||
| 68 | |||
| 69 | enum rfkill_state state; | ||
| 70 | bool user_claim; | ||
| 71 | |||
| 72 | struct mutex mutex; | ||
| 73 | |||
| 74 | void *data; | ||
| 75 | int (*toggle_radio)(void *data, enum rfkill_state state); | ||
| 76 | |||
| 77 | struct device dev; | ||
| 78 | struct list_head node; | ||
| 79 | }; | ||
| 80 | #define to_rfkill(d) container_of(d, struct rfkill, dev) | ||
| 81 | |||
| 82 | struct rfkill *rfkill_allocate(struct device *parent, enum rfkill_type type); | ||
| 83 | void rfkill_free(struct rfkill *rfkill); | ||
| 84 | int rfkill_register(struct rfkill *rfkill); | ||
| 85 | void rfkill_unregister(struct rfkill *rfkill); | ||
| 86 | |||
| 87 | void rfkill_switch_all(enum rfkill_type type, enum rfkill_state state); | ||
| 88 | |||
| 89 | #endif /* RFKILL_H */ | ||
