1 /* SPDX-License-Identifier: GPL-2.0 */
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>
14 AMS_IRQ_FREEFALL
= 0x01,
16 AMS_IRQ_GLOBAL
= 0x04,
28 /* General properties */
29 struct device_node
*of_node
;
30 struct platform_device
*of_dev
;
36 /* Interrupt worker */
37 struct work_struct worker
;
42 * Only call these functions with the main lock held.
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
53 struct i2c_client
*i2c_client
;
56 /* Joystick emulation */
57 struct input_dev
*idev
;
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);