Merge tag 'trace-printf-v6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/trace...
[drm/drm-misc.git] / drivers / macintosh / ams / ams.h
blob5b295f5eef75a508decbd1704195579c85932132
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _AMS_H
3 #define _AMS_H
5 #include <linux/i2c.h>
6 #include <linux/input.h>
7 #include <linux/kthread.h>
8 #include <linux/mutex.h>
9 #include <linux/platform_device.h>
10 #include <linux/spinlock.h>
11 #include <linux/types.h>
13 enum ams_irq {
14 AMS_IRQ_FREEFALL = 0x01,
15 AMS_IRQ_SHOCK = 0x02,
16 AMS_IRQ_GLOBAL = 0x04,
17 AMS_IRQ_ALL =
18 AMS_IRQ_FREEFALL |
19 AMS_IRQ_SHOCK |
20 AMS_IRQ_GLOBAL,
23 struct ams {
24 /* Locks */
25 spinlock_t irq_lock;
26 struct mutex lock;
28 /* General properties */
29 struct device_node *of_node;
30 struct platform_device *of_dev;
31 char has_device;
32 char vflag;
33 u32 orient1;
34 u32 orient2;
36 /* Interrupt worker */
37 struct work_struct worker;
38 u8 worker_irqs;
40 /* Implementation
42 * Only call these functions with the main lock held.
44 void (*exit)(void);
46 void (*get_xyz)(s8 *x, s8 *y, s8 *z);
47 u8 (*get_vendor)(void);
49 void (*clear_irq)(enum ams_irq reg);
51 #ifdef CONFIG_SENSORS_AMS_I2C
52 /* I2C properties */
53 struct i2c_client *i2c_client;
54 #endif
56 /* Joystick emulation */
57 struct input_dev *idev;
58 __u16 bustype;
60 /* calibrated null values */
61 int xcalib, ycalib, zcalib;
64 extern struct ams ams_info;
66 extern void ams_sensors(s8 *x, s8 *y, s8 *z);
67 extern int ams_sensor_attach(void);
68 extern void ams_sensor_detach(void);
70 extern int ams_pmu_init(struct device_node *np);
71 extern int ams_i2c_init(struct device_node *np);
73 extern int ams_input_init(void);
74 extern void ams_input_exit(void);
76 #endif /* _AMS_H */