summaryrefslogtreecommitdiffstats
path: root/drivers/macintosh/ams/ams.h
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2010-10-28 20:31:50 +0200
committerJean Delvare <khali@endymion.delvare>2010-10-28 20:31:50 +0200
commitbd5f47ec961594b1091839333600008f8166fd00 (patch)
treeaa4296edffd81e2976d20d3ea30ea18108b2a4de /drivers/macintosh/ams/ams.h
parent6dfee85397a47063291fe199eaf950bee7944454 (diff)
downloadtalos-op-linux-bd5f47ec961594b1091839333600008f8166fd00.tar.gz
talos-op-linux-bd5f47ec961594b1091839333600008f8166fd00.zip
Move ams driver to macintosh
The ams driver isn't a hardware monitoring driver, so it shouldn't live under driver/hwmon. drivers/macintosh seems much more appropriate, as the driver is only useful on PowerBooks and iBooks. Signed-off-by: Jean Delvare <khali@linux-fr.org> Cc: Guenter Roeck <guenter.roeck@ericsson.com> Cc: Stelian Pop <stelian@popies.net> Cc: Michael Hanselmann <linux-kernel@hansmi.ch> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Grant Likely <grant.likely@secretlab.ca>
Diffstat (limited to 'drivers/macintosh/ams/ams.h')
-rw-r--r--drivers/macintosh/ams/ams.h70
1 files changed, 70 insertions, 0 deletions
diff --git a/drivers/macintosh/ams/ams.h b/drivers/macintosh/ams/ams.h
new file mode 100644
index 000000000000..90f094d45450
--- /dev/null
+++ b/drivers/macintosh/ams/ams.h
@@ -0,0 +1,70 @@
+#include <linux/i2c.h>
+#include <linux/input-polldev.h>
+#include <linux/kthread.h>
+#include <linux/mutex.h>
+#include <linux/spinlock.h>
+#include <linux/types.h>
+#include <linux/of_device.h>
+
+enum ams_irq {
+ AMS_IRQ_FREEFALL = 0x01,
+ AMS_IRQ_SHOCK = 0x02,
+ AMS_IRQ_GLOBAL = 0x04,
+ AMS_IRQ_ALL =
+ AMS_IRQ_FREEFALL |
+ AMS_IRQ_SHOCK |
+ AMS_IRQ_GLOBAL,
+};
+
+struct ams {
+ /* Locks */
+ spinlock_t irq_lock;
+ struct mutex lock;
+
+ /* General properties */
+ struct device_node *of_node;
+ struct platform_device *of_dev;
+ char has_device;
+ char vflag;
+ u32 orient1;
+ u32 orient2;
+
+ /* Interrupt worker */
+ struct work_struct worker;
+ u8 worker_irqs;
+
+ /* Implementation
+ *
+ * Only call these functions with the main lock held.
+ */
+ void (*exit)(void);
+
+ void (*get_xyz)(s8 *x, s8 *y, s8 *z);
+ u8 (*get_vendor)(void);
+
+ void (*clear_irq)(enum ams_irq reg);
+
+#ifdef CONFIG_SENSORS_AMS_I2C
+ /* I2C properties */
+ struct i2c_client *i2c_client;
+#endif
+
+ /* Joystick emulation */
+ struct input_polled_dev *idev;
+ __u16 bustype;
+
+ /* calibrated null values */
+ int xcalib, ycalib, zcalib;
+};
+
+extern struct ams ams_info;
+
+extern void ams_sensors(s8 *x, s8 *y, s8 *z);
+extern int ams_sensor_attach(void);
+extern void ams_sensor_detach(void);
+
+extern int ams_pmu_init(struct device_node *np);
+extern int ams_i2c_init(struct device_node *np);
+
+extern int ams_input_init(void);
+extern void ams_input_exit(void);
OpenPOWER on IntegriCloud