12 #include <linux/module.h>
13 #include <linux/types.h>
14 #include <linux/errno.h>
16 #include <linux/adb.h>
17 #include <linux/pmu.h>
27 #define AMS_VENDOR 0x03
30 #define AMS_FF_CLEAR 0x04
31 #define AMS_FF_ENABLE 0x05
32 #define AMS_FF_LOW_LIMIT 0x06
33 #define AMS_FF_DEBOUNCE 0x07
36 #define AMS_SHOCK_CLEAR 0x08
37 #define AMS_SHOCK_ENABLE 0x09
38 #define AMS_SHOCK_HIGH_LIMIT 0x0a
39 #define AMS_SHOCK_DEBOUNCE 0x0b
42 #define AMS_CONTROL 0x0c
44 static u8 ams_pmu_cmd;
57 req.arg = &req_complete;
58 if (
pmu_request(&
req, ams_pmu_req_complete, 4, ams_pmu_cmd, 0x00, reg, value))
65 static u8 ams_pmu_get_register(
u8 reg)
70 req.arg = &req_complete;
71 if (
pmu_request(&
req, ams_pmu_req_complete, 3, ams_pmu_cmd, 0x01, reg))
76 if (
req.reply_len > 0)
113 static void ams_pmu_clear_irq(
enum ams_irq reg)
115 if (reg & AMS_IRQ_FREEFALL)
118 if (reg & AMS_IRQ_SHOCK)
122 static u8 ams_pmu_get_vendor(
void)
127 static void ams_pmu_get_xyz(
s8 *
x,
s8 *
y,
s8 *z)
129 *x = ams_pmu_get_register(
AMS_X);
130 *y = ams_pmu_get_register(
AMS_Y);
131 *z = ams_pmu_get_register(
AMS_Z);
134 static void ams_pmu_exit(
void)
157 ams_info.get_vendor = ams_pmu_get_vendor;
159 ams_info.clear_irq = ams_pmu_clear_irq;
167 ams_pmu_cmd = ((*prop) >> 8) & 0xff;