5 #include <linux/wakelock.h>
6 #include <linux/interrupt.h>
7 #include <linux/miscdevice.h>
8 #include <linux/platform_device.h>
9 #include <linux/input.h>
10 #include <linux/workqueue.h>
11 #include <linux/slab.h>
12 #include <linux/module.h>
13 #include <linux/hwmsensor.h>
14 #include <linux/earlysuspend.h>
15 #include <linux/hwmsen_dev.h>
18 #define SHK_TAG "<SHAKE> "
19 #define SHK_FUN(f) printk(SHK_TAG"%s\n", __func__)
20 #define SHK_ERR(fmt, args...) printk(SHK_TAG"%s %d : "fmt, __func__, __LINE__, ##args)
21 #define SHK_LOG(fmt, args...) printk(SHK_TAG fmt, ##args)
22 #define SHK_VER(fmt, args...) printk(SHK_TAG"%s: "fmt, __func__, ##args) //((void)0)
24 //#define OP_SHK_DELAY 0X01
25 #define OP_SHK_ENABLE 0X02
26 //#define OP_SHK_GET_DATA 0X04
28 #define SHK_INVALID_VALUE -1
30 #define EVENT_TYPE_SHK_VALUE REL_X
32 #define SHK_VALUE_MAX (32767)
33 #define SHK_VALUE_MIN (-32768)
34 #define SHK_STATUS_MIN (0)
35 #define SHK_STATUS_MAX (64)
36 #define SHK_DIV_MAX (32767)
37 #define SHK_DIV_MIN (1)
46 struct shk_control_path
48 // int (*enable_nodata)(int en);//only enable not report event to HAL
49 int (*open_report_data
)(int open
);//open data rerport to HAL
50 // int (*enable)(int en);
51 //bool is_support_batch;//version2.used for batch mode support flag
56 int (*get_data
)(u16
*value
, int *status
);
64 struct platform_driver
* platform_diver_addr
;
68 hwm_sensor_data shk_data
;
76 int (*shk_operate
)(void* self
, uint32_t command
, void* buff_in
, int size_in
,
77 void* buff_out
, int size_out
, int* actualout
);
81 struct input_dev
*idev
;
82 struct miscdevice mdev
;
83 struct work_struct report
;
84 struct mutex shk_op_mutex
;
85 atomic_t wake
; /*user-space request to wake-up, used with stop*/
88 struct early_suspend early_drv
;
89 atomic_t early_suspend
;
92 struct shk_data drv_data
;
93 struct shk_control_path shk_ctl
;
94 struct shk_data_path shk_data
;
95 bool is_active_nodata
; // Active, but HAL don't need data sensor. such as orientation need
96 bool is_active_data
; // Active and HAL need data .
97 bool is_batch_enable
; //version2.this is used for judging whether sensor is in batch mode
100 extern int shk_notify(void);
101 extern int shk_driver_add(struct shk_init_info
* obj
) ;
102 extern int shk_register_control_path(struct shk_control_path
*ctl
);
103 extern int shk_register_data_path(struct shk_data_path
*data
);