1 /* SPDX-License-Identifier: GPL-2.0 */
3 #include <linux/input-polldev.h>
4 #include <linux/kthread.h>
5 #include <linux/mutex.h>
6 #include <linux/spinlock.h>
7 #include <linux/types.h>
8 #include <linux/of_device.h>
11 AMS_IRQ_FREEFALL
= 0x01,
13 AMS_IRQ_GLOBAL
= 0x04,
25 /* General properties */
26 struct device_node
*of_node
;
27 struct platform_device
*of_dev
;
33 /* Interrupt worker */
34 struct work_struct worker
;
39 * Only call these functions with the main lock held.
43 void (*get_xyz
)(s8
*x
, s8
*y
, s8
*z
);
44 u8 (*get_vendor
)(void);
46 void (*clear_irq
)(enum ams_irq reg
);
48 #ifdef CONFIG_SENSORS_AMS_I2C
50 struct i2c_client
*i2c_client
;
53 /* Joystick emulation */
54 struct input_polled_dev
*idev
;
57 /* calibrated null values */
58 int xcalib
, ycalib
, zcalib
;
61 extern struct ams ams_info
;
63 extern void ams_sensors(s8
*x
, s8
*y
, s8
*z
);
64 extern int ams_sensor_attach(void);
65 extern void ams_sensor_detach(void);
67 extern int ams_pmu_init(struct device_node
*np
);
68 extern int ams_i2c_init(struct device_node
*np
);
70 extern int ams_input_init(void);
71 extern void ams_input_exit(void);