Index: include/linux/cyapa.h |
diff --git a/include/linux/cyapa.h b/include/linux/cyapa.h |
index a8f22cd068bd513b2faf2bd4f92ea0f1852e6355..c21d95f02dd13213a50ef1771a477d166c945c90 100644 |
--- a/include/linux/cyapa.h |
+++ b/include/linux/cyapa.h |
@@ -1,8 +1,11 @@ |
-#ifndef CYAPA_H |
-#define CYAPA_H |
+#ifndef _CYAPA_H |
+#define _CYAPA_H |
+#include <linux/types.h> |
+#include <linux/ioctl.h> |
#define CYAPA_I2C_NAME "cypress_i2c_apa" |
+#define CYAPA_MISC_NAME "cyapa_misc_dev" |
Olof Johansson
2011/05/02 05:47:12
This is unneccessarily long. It means udev will cr
|
/* Active power state scanning/processing refresh interval time. unit: ms. */ |
#define CYAPA_ACTIVE_POLLING_INTVAL_TIME 0x00 |
@@ -14,45 +17,101 @@ |
/* Max report rate limited for Cypress Trackpad. */ |
#define CYAPA_NO_LIMITED_REPORT_RATE 0 |
#define CYAPA_REPORT_RATE (CYAPA_NO_LIMITED_REPORT_RATE) |
-#define CYAPA_POLLING_REPORTRATE_DEFAULT 125 |
+#define CYAPA_POLLING_REPORTRATE_DEFAULT 60 |
+/* trackpad device */ |
+enum cyapa_work_mode { |
+ CYAPA_STREAM_MODE = 0x00, |
+ CYAPA_BOOTLOAD_MODE = 0x01, |
+}; |
/* APA trackpad firmware generation */ |
-enum cyapa_gen |
-{ |
- CYAPA_GEN1 = 0x01, |
- CYAPA_GEN2 = 0x02, |
+enum cyapa_gen { |
+ CYAPA_GEN1 = 0x01, /* only one finger supported. */ |
+ CYAPA_GEN2 = 0x02, /* max five fingers supported. */ |
}; |
/* |
** APA trackpad power states. |
** Used in register 0x00, bit3-2, PowerMode field. |
*/ |
-enum cyapa_powerstate |
-{ |
+enum cyapa_powerstate { |
CYAPA_PWR_ACTIVE = 0x01, |
CYAPA_PWR_LIGHT_SLEEP = 0x02, |
CYAPA_PWR_MEDIUM_SLEEP = 0x03, |
CYAPA_PWR_DEEP_SLEEP = 0x04, |
}; |
-struct cyapa_platform_data |
-{ |
- u32 flag; /* reserved for future use. */ |
+struct cyapa_platform_data { |
+ __u32 flag; /* reserved for future use. */ |
enum cyapa_gen gen; /* trackpad firmware generation. */ |
enum cyapa_powerstate power_state; |
- unsigned use_absolute_mode:1; /* use absolute data report or relative data report. */ |
- unsigned use_polling_mode:1; /* use polling mode or interrupt mode. */ |
- u8 polling_interval_time_active; /* active mode, polling refresh interval; ms */ |
- u8 polling_interval_time_lowpower; /* low power mode, polling refresh interval; ms */ |
- u8 active_touch_timeout; /* active touch timeout; ms */ |
+ |
+ /* active mode, polling refresh interval; ms */ |
+ __u8 polling_interval_time_active; |
+ /* low power mode, polling refresh interval; ms */ |
+ __u8 polling_interval_time_lowpower; |
+ __u8 active_touch_timeout; /* active touch timeout; ms */ |
char *name; /* device name of Cypress I2C trackpad. */ |
- s16 irq_gpio; /* the gpio id used for interrupt to notify host data is ready. */ |
- u32 report_rate; /* max limitation of data report rate. */ |
+ /* the gpio id used for interrupt to notify host data is ready. */ |
+ __s16 irq_gpio; |
+ __u32 report_rate; /* max limitation of data report rate. */ |
int (*wakeup)(void); |
int (*init)(void); |
}; |
-#endif //#ifndef CYAPA_H |
+/* |
+** Data structures for misc device ioclt read/write. |
+*/ |
+struct cyapa_misc_ioctl_data { |
+ __u8 *buf; /* pointer to a buffer for read/write data. */ |
+ __u16 len; /* valid data lenght in buf. */ |
+ __u16 flag; /* additional flag to speical ioctl command. */ |
+ __u16 rev; /* reserved. */ |
+}; |
+ |
+struct cyapa_driver_ver { |
+ __u8 major_ver; |
+ __u8 minor_ver; |
+ __u8 revision; |
+}; |
+ |
+struct cyapa_firmware_ver { |
+ __u8 major_ver; |
+ __u8 minor_ver; |
+}; |
+ |
+struct cyapa_hardware_ver { |
+ __u8 major_ver; |
+ __u8 minor_ver; |
+}; |
+ |
+/* |
+** Macro codes for misc device ioctl functions. |
+*********************************************************** |
+|device type|serial num|direction| data bytes | |
+|-----------|----------|---------|-------------| |
+| 8 bit | 8 bit | 2 bit | 8~14 bit | |
+|-----------|----------|---------|-------------| |
+*********************************************************** |
+*/ |
+#define CYAPA_IOC_MAGIC 'C' |
+#define CYAPA_IOC(nr) _IOC(_IOC_NONE, CYAPA_IOC_MAGIC, nr, 0) |
+/* bytes value is the bytes should be read/writen in 'buf' area |
+** in struct cyapa_misc_ioctl_data data structure. */ |
+#define CYAPA_IOC_R(nr, bytes) _IOC(IOC_OUT, CYAPA_IOC_MAGIC, nr, bytes) |
+#define CYAPA_IOC_W(nr, bytes) _IOC(IOC_IN, CYAPA_IOC_MAGIC, nr, bytes) |
+#define CYAPA_IOC_RW(nr, bytes) _IOC(IOC_INOUT, CYAPA_IOC_MAGIC, nr, bytes) |
+ |
+ |
+#define CYAPA_GET_PRODUCT_ID CYAPA_IOC_R(0x00, 16) |
+#define CYAPA_GET_DRIVER_VER CYAPA_IOC_R(0x01, 3) |
+#define CYAPA_GET_FIRMWARE_VER CYAPA_IOC_R(0x02, 2) |
+#define CYAPA_GET_HARDWARE_VER CYAPA_IOC_R(0x03, 2) |
+ |
+#define CYAPA_SET_BOOTLOADER_MODE CYAPA_IOC(0x40) |
+#define CYAPA_SET_STREAM_MODE CYAPA_IOC(0x41) |
+ |
+#endif /* #ifndef _CYAPA_H */ |