Blame view

drivers/macintosh/ams/ams.h 1.36 KB
dcb69dd01   Stelian Pop   hwmon: New AMS ha...
1
  #include <linux/i2c.h>
3fdbc3408   Dmitry Torokhov   HWMON: ams - conv...
2
  #include <linux/input-polldev.h>
dcb69dd01   Stelian Pop   hwmon: New AMS ha...
3
4
5
6
  #include <linux/kthread.h>
  #include <linux/mutex.h>
  #include <linux/spinlock.h>
  #include <linux/types.h>
f6f11018d   Stephen Rothwell   powerpc/drivers: ...
7
  #include <linux/of_device.h>
dcb69dd01   Stelian Pop   hwmon: New AMS ha...
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
  
  enum ams_irq {
  	AMS_IRQ_FREEFALL = 0x01,
  	AMS_IRQ_SHOCK = 0x02,
  	AMS_IRQ_GLOBAL = 0x04,
  	AMS_IRQ_ALL =
  		AMS_IRQ_FREEFALL |
  		AMS_IRQ_SHOCK |
  		AMS_IRQ_GLOBAL,
  };
  
  struct ams {
  	/* Locks */
  	spinlock_t irq_lock;
  	struct mutex lock;
  
  	/* General properties */
  	struct device_node *of_node;
2dc115813   Grant Likely   of/device: Replac...
26
  	struct platform_device *of_dev;
dcb69dd01   Stelian Pop   hwmon: New AMS ha...
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
  	char has_device;
  	char vflag;
  	u32 orient1;
  	u32 orient2;
  
  	/* Interrupt worker */
  	struct work_struct worker;
  	u8 worker_irqs;
  
  	/* Implementation
  	 *
  	 * Only call these functions with the main lock held.
  	 */
  	void (*exit)(void);
  
  	void (*get_xyz)(s8 *x, s8 *y, s8 *z);
  	u8 (*get_vendor)(void);
  
  	void (*clear_irq)(enum ams_irq reg);
  
  #ifdef CONFIG_SENSORS_AMS_I2C
  	/* I2C properties */
810ad7b62   Jean Delvare   hwmon: (ams) Conv...
49
  	struct i2c_client *i2c_client;
dcb69dd01   Stelian Pop   hwmon: New AMS ha...
50
51
52
  #endif
  
  	/* Joystick emulation */
3fdbc3408   Dmitry Torokhov   HWMON: ams - conv...
53
  	struct input_polled_dev *idev;
dcb69dd01   Stelian Pop   hwmon: New AMS ha...
54
55
56
57
58
59
60
61
62
63
  	__u16 bustype;
  
  	/* calibrated null values */
  	int xcalib, ycalib, zcalib;
  };
  
  extern struct ams ams_info;
  
  extern void ams_sensors(s8 *x, s8 *y, s8 *z);
  extern int ams_sensor_attach(void);
98ceb75c7   Jean Delvare   macintosh/hwmon/a...
64
  extern void ams_sensor_detach(void);
dcb69dd01   Stelian Pop   hwmon: New AMS ha...
65
66
67
68
69
70
  
  extern int ams_pmu_init(struct device_node *np);
  extern int ams_i2c_init(struct device_node *np);
  
  extern int ams_input_init(void);
  extern void ams_input_exit(void);