0001
0002 #include <linux/i2c.h>
0003 #include <linux/input.h>
0004 #include <linux/kthread.h>
0005 #include <linux/mutex.h>
0006 #include <linux/spinlock.h>
0007 #include <linux/types.h>
0008 #include <linux/of_device.h>
0009
0010 enum ams_irq {
0011 AMS_IRQ_FREEFALL = 0x01,
0012 AMS_IRQ_SHOCK = 0x02,
0013 AMS_IRQ_GLOBAL = 0x04,
0014 AMS_IRQ_ALL =
0015 AMS_IRQ_FREEFALL |
0016 AMS_IRQ_SHOCK |
0017 AMS_IRQ_GLOBAL,
0018 };
0019
0020 struct ams {
0021
0022 spinlock_t irq_lock;
0023 struct mutex lock;
0024
0025
0026 struct device_node *of_node;
0027 struct platform_device *of_dev;
0028 char has_device;
0029 char vflag;
0030 u32 orient1;
0031 u32 orient2;
0032
0033
0034 struct work_struct worker;
0035 u8 worker_irqs;
0036
0037
0038
0039
0040
0041 void (*exit)(void);
0042
0043 void (*get_xyz)(s8 *x, s8 *y, s8 *z);
0044 u8 (*get_vendor)(void);
0045
0046 void (*clear_irq)(enum ams_irq reg);
0047
0048 #ifdef CONFIG_SENSORS_AMS_I2C
0049
0050 struct i2c_client *i2c_client;
0051 #endif
0052
0053
0054 struct input_dev *idev;
0055 __u16 bustype;
0056
0057
0058 int xcalib, ycalib, zcalib;
0059 };
0060
0061 extern struct ams ams_info;
0062
0063 extern void ams_sensors(s8 *x, s8 *y, s8 *z);
0064 extern int ams_sensor_attach(void);
0065 extern void ams_sensor_detach(void);
0066
0067 extern int ams_pmu_init(struct device_node *np);
0068 extern int ams_i2c_init(struct device_node *np);
0069
0070 extern int ams_input_init(void);
0071 extern void ams_input_exit(void);