aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMike Lockwood <lockwood@android.com>2011-12-02 13:59:35 +0800
committerJohn Stultz <john.stultz@linaro.org>2012-02-14 14:28:18 -0800
commitccdf5e0ad69e480443a869019ed07c9383643bd1 (patch)
tree07a7a4a1754b87c7080efb55eaed169f6fad1dc9 /include
parent20df980331b3d1ee9527093ff635bd7faf20caa5 (diff)
switch: switch class and GPIO drivers.
MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit switch: Export symbol switch_set_state. Signed-off-by: Mike Lockwood <lockwood@android.com> switch: gpio: Don't call request_irq with interrupts disabled Signed-off-by: Arve Hjønnevåg <arve@android.com> switch: Use device_create instead of device_create_drvdata. device_create_drvdata is obsolete. Signed-off-by: Arve Hjønnevåg <arve@android.com> switch_gpio: Add missing #include <linux/interrupt.h> Change-Id: I6c397e41bbe1457162cc69e31a29db5d9f76fccb Signed-off-by: Mike Lockwood <lockwood@android.com>
Diffstat (limited to 'include')
-rw-r--r--include/linux/switch.h53
1 files changed, 53 insertions, 0 deletions
diff --git a/include/linux/switch.h b/include/linux/switch.h
new file mode 100644
index 00000000000..3e4c748e343
--- /dev/null
+++ b/include/linux/switch.h
@@ -0,0 +1,53 @@
+/*
+ * Switch class driver
+ *
+ * Copyright (C) 2008 Google, Inc.
+ * Author: Mike Lockwood <lockwood@android.com>
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+*/
+
+#ifndef __LINUX_SWITCH_H__
+#define __LINUX_SWITCH_H__
+
+struct switch_dev {
+ const char *name;
+ struct device *dev;
+ int index;
+ int state;
+
+ ssize_t (*print_name)(struct switch_dev *sdev, char *buf);
+ ssize_t (*print_state)(struct switch_dev *sdev, char *buf);
+};
+
+struct gpio_switch_platform_data {
+ const char *name;
+ unsigned gpio;
+
+ /* if NULL, switch_dev.name will be printed */
+ const char *name_on;
+ const char *name_off;
+ /* if NULL, "0" or "1" will be printed */
+ const char *state_on;
+ const char *state_off;
+};
+
+extern int switch_dev_register(struct switch_dev *sdev);
+extern void switch_dev_unregister(struct switch_dev *sdev);
+
+static inline int switch_get_state(struct switch_dev *sdev)
+{
+ return sdev->state;
+}
+
+extern void switch_set_state(struct switch_dev *sdev, int state);
+
+#endif /* __LINUX_SWITCH_H__ */