diff options
Diffstat (limited to 'drivers/input/touchscreen/rmi4/rmi_driver.h')
-rw-r--r-- | drivers/input/touchscreen/rmi4/rmi_driver.h | 109 |
1 files changed, 109 insertions, 0 deletions
diff --git a/drivers/input/touchscreen/rmi4/rmi_driver.h b/drivers/input/touchscreen/rmi4/rmi_driver.h new file mode 100644 index 00000000000..9e9f2c09822 --- /dev/null +++ b/drivers/input/touchscreen/rmi4/rmi_driver.h | |||
@@ -0,0 +1,109 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2011 Synaptics Incorporated | ||
3 | * Copyright (c) 2011 Unixphere | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation; either version 2 of the License, or | ||
8 | * (at your option) any later version. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
18 | */ | ||
19 | #ifndef _RMI_DRIVER_H | ||
20 | #define _RMI_DRIVER_H | ||
21 | |||
22 | #define RMI_DRIVER_MAJOR_VERSION 1 | ||
23 | #define RMI_DRIVER_MINOR_VERSION 3 | ||
24 | #define RMI_DRIVER_SUB_MINOR_VERSION 0 | ||
25 | |||
26 | /* TODO: Figure out some way to construct this string in the define macro | ||
27 | * using the values defined above. | ||
28 | */ | ||
29 | #define RMI_DRIVER_VERSION_STRING "1.3.0" | ||
30 | |||
31 | |||
32 | #define RMI_PRODUCT_ID_LENGTH 10 | ||
33 | #define RMI_PRODUCT_INFO_LENGTH 2 | ||
34 | #define RMI_DATE_CODE_LENGTH 3 | ||
35 | |||
36 | struct rmi_driver_data { | ||
37 | struct rmi_function_container rmi_functions; | ||
38 | |||
39 | struct rmi_function_container *f01_container; | ||
40 | |||
41 | int num_of_irq_regs; | ||
42 | u8 *current_irq_mask; | ||
43 | u8 *irq_mask_store; | ||
44 | bool irq_stored; | ||
45 | struct mutex irq_mutex; | ||
46 | struct lock_class_key irq_key; | ||
47 | |||
48 | unsigned char pdt_props; | ||
49 | unsigned char bsr; | ||
50 | bool enabled; | ||
51 | |||
52 | u8 manufacturer_id; | ||
53 | /* product id + null termination */ | ||
54 | u8 product_id[RMI_PRODUCT_ID_LENGTH + 1]; | ||
55 | |||
56 | #ifdef CONFIG_PM | ||
57 | bool suspended; | ||
58 | struct mutex suspend_mutex; | ||
59 | |||
60 | void *pm_data; | ||
61 | int (*pre_suspend) (const void *pm_data); | ||
62 | int (*post_resume) (const void *pm_data); | ||
63 | #endif | ||
64 | |||
65 | void *data; | ||
66 | }; | ||
67 | |||
68 | struct pdt_entry { | ||
69 | u8 query_base_addr:8; | ||
70 | u8 command_base_addr:8; | ||
71 | u8 control_base_addr:8; | ||
72 | u8 data_base_addr:8; | ||
73 | u8 interrupt_source_count:3; | ||
74 | u8 bits3and4:2; | ||
75 | u8 function_version:2; | ||
76 | u8 bit7:1; | ||
77 | u8 function_number:8; | ||
78 | }; | ||
79 | |||
80 | int rmi_driver_f01_init(struct rmi_device *rmi_dev); | ||
81 | |||
82 | static inline void copy_pdt_entry_to_fd(struct pdt_entry *pdt, | ||
83 | struct rmi_function_descriptor *fd, | ||
84 | u16 page_start) | ||
85 | { | ||
86 | fd->query_base_addr = pdt->query_base_addr + page_start; | ||
87 | fd->command_base_addr = pdt->command_base_addr + page_start; | ||
88 | fd->control_base_addr = pdt->control_base_addr + page_start; | ||
89 | fd->data_base_addr = pdt->data_base_addr + page_start; | ||
90 | fd->function_number = pdt->function_number; | ||
91 | fd->interrupt_source_count = pdt->interrupt_source_count; | ||
92 | fd->function_version = pdt->function_version; | ||
93 | } | ||
94 | |||
95 | /* Helper function to convert a short (in host processor endianess) to | ||
96 | * a byte array in the RMI endianess for shorts. See above comment for | ||
97 | * why we dont us htons or something like that. | ||
98 | */ | ||
99 | void hstoba(u8 *dest, u16 src); | ||
100 | |||
101 | /* Helper fn to convert a byte array representing a short in the RMI | ||
102 | * endian-ness to a short in the native processor's specific endianness. | ||
103 | * We don't use ntohs/htons here because, well, we're not dealing with | ||
104 | * a pair of shorts. And casting dest to short* wouldn't work, because | ||
105 | * that would imply knowing the byte order of short in the first place. | ||
106 | */ | ||
107 | void batohs(u16 *dest, u8 *src); | ||
108 | |||
109 | #endif | ||