summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMichael Buesch <mb@bu3sch.de>2007-09-27 21:33:12 +0200
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 16:54:10 -0700
commit135900c182c321a4888ec496b014e6707272faca (patch)
treed17a3e12bf2e047c7a627f61e623e40dfbad87bf /include
parent937a049dd903bd810d858d0303cf86af9eb08b6f (diff)
[RFKILL]: Add support for an rfkill LED.
This adds a LED trigger. Signed-off-by: Michael Buesch <mb@bu3sch.de> Acked-by: Ivo van Doorn <IvDoorn@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r--include/linux/rfkill.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/include/linux/rfkill.h b/include/linux/rfkill.h
index d76397ca95ad..26fddea12c25 100644
--- a/include/linux/rfkill.h
+++ b/include/linux/rfkill.h
@@ -26,6 +26,7 @@
#include <linux/list.h>
#include <linux/mutex.h>
#include <linux/device.h>
+#include <linux/leds.h>
/**
* enum rfkill_type - type of rfkill switch.
@@ -56,6 +57,7 @@ enum rfkill_state {
* @data: Pointer to the RF button drivers private data which will be
* passed along when toggling radio state.
* @toggle_radio(): Mandatory handler to control state of the radio.
+ * @led_trigger: A LED trigger for this button's LED.
* @dev: Device structure integrating the switch into device tree.
* @node: Used to place switch into list of all switches known to the
* the system.
@@ -74,6 +76,10 @@ struct rfkill {
void *data;
int (*toggle_radio)(void *data, enum rfkill_state state);
+#ifdef CONFIG_RFKILL_LEDS
+ struct led_trigger led_trigger;
+#endif
+
struct device dev;
struct list_head node;
};
@@ -84,4 +90,19 @@ void rfkill_free(struct rfkill *rfkill);
int rfkill_register(struct rfkill *rfkill);
void rfkill_unregister(struct rfkill *rfkill);
+/**
+ * rfkill_get_led_name - Get the LED trigger name for the button's LED.
+ * This function might return a NULL pointer if registering of the
+ * LED trigger failed.
+ * Use this as "default_trigger" for the LED.
+ */
+static inline char *rfkill_get_led_name(struct rfkill *rfkill)
+{
+#ifdef CONFIG_RFKILL_LEDS
+ return (char *)(rfkill->led_trigger.name);
+#else
+ return NULL;
+#endif
+}
+
#endif /* RFKILL_H */