1#include <linux/i2c.h>
2#include <linux/input-polldev.h>
3#include <linux/kthread.h>
4#include <linux/mutex.h>
5#include <linux/spinlock.h>
6#include <linux/types.h>
7#include <asm/of_device.h>
8
9enum ams_irq {
10 AMS_IRQ_FREEFALL = 0x01,
11 AMS_IRQ_SHOCK = 0x02,
12 AMS_IRQ_GLOBAL = 0x04,
13 AMS_IRQ_ALL =
14 AMS_IRQ_FREEFALL |
15 AMS_IRQ_SHOCK |
16 AMS_IRQ_GLOBAL,
17};
18
19struct ams {
20
21 spinlock_t irq_lock;
22 struct mutex lock;
23
24
25 struct device_node *of_node;
26 struct of_device *of_dev;
27 char has_device;
28 char vflag;
29 u32 orient1;
30 u32 orient2;
31
32
33 struct work_struct worker;
34 u8 worker_irqs;
35
36
37
38
39
40 void (*exit)(void);
41
42 void (*get_xyz)(s8 *x, s8 *y, s8 *z);
43 u8 (*get_vendor)(void);
44
45 void (*clear_irq)(enum ams_irq reg);
46
47#ifdef CONFIG_SENSORS_AMS_I2C
48
49 int i2c_bus;
50 int i2c_address;
51 struct i2c_client i2c_client;
52#endif
53
54
55 struct input_polled_dev *idev;
56 __u16 bustype;
57
58
59 int xcalib, ycalib, zcalib;
60};
61
62extern struct ams ams_info;
63
64extern void ams_sensors(s8 *x, s8 *y, s8 *z);
65extern int ams_sensor_attach(void);
66
67extern int ams_pmu_init(struct device_node *np);
68extern int ams_i2c_init(struct device_node *np);
69
70extern int ams_input_init(void);
71extern void ams_input_exit(void);
72