David Hays | 84b6fd3 | 2014-06-22 22:01:47 -0700 | [diff] [blame] | 1 | /* include/linux/max1187x.h |
| 2 | * |
| 3 | * Copyright (c)2012 Maxim Integrated Products, Inc. |
| 4 | * |
| 5 | * Driver Version: 3.0.7 |
| 6 | * Release Date: Feb 22, 2013 |
| 7 | * |
| 8 | * This software is licensed under the terms of the GNU General Public |
| 9 | * License version 2, as published by the Free Software Foundation, and |
| 10 | * may be copied, distributed, and modified under those terms. |
| 11 | * |
| 12 | * This program is distributed in the hope that it will be useful, |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | * GNU General Public License for more details. |
| 16 | * |
| 17 | */ |
| 18 | |
| 19 | #ifndef __MAX1187X_H |
| 20 | #define __MAX1187X_H |
| 21 | |
| 22 | #define MAX1187X_NAME "max1187x" |
| 23 | #define MAX1187X_TOUCH MAX1187X_NAME "_touchscreen_0" |
| 24 | #define MAX1187X_KEY MAX1187X_NAME "_key_0" |
| 25 | #define MAX1187X_LOG_NAME "[TP] " |
| 26 | |
| 27 | #define MAX_WORDS_COMMAND 9 |
| 28 | #define MAX_WORDS_REPORT 245 |
| 29 | #define MAX_WORDS_COMMAND_ALL (15 * MAX_WORDS_COMMAND) |
| 30 | |
| 31 | #define MAX1187X_NUM_FW_MAPPINGS_MAX 5 |
| 32 | #define MAX1187X_TOUCH_COUNT_MAX 10 |
| 33 | #define MAX1187X_TOUCH_REPORT_RAW 0x0800 |
| 34 | #define MAX1187X_TOUCH_REPORT_BASIC 0x0801 |
| 35 | #define MAX1187X_TOUCH_REPORT_EXTENDED 0x0802 |
| 36 | #define MAX_REPORT_READERS 5 |
| 37 | #define DEBUG_STRING_LEN_MAX 60 |
| 38 | #define MAX_FW_RETRIES 5 |
| 39 | |
| 40 | #define MAX1187X_PI 205887 |
| 41 | |
| 42 | #define MAX1187X_TOUCH_CONFIG_MAX 65 |
| 43 | #define MAX1187X_CALIB_TABLE_MAX 74 |
| 44 | #define MAX1187X_PRIVATE_CONFIG_MAX 34 |
| 45 | #define MAX1187X_LOOKUP_TABLE_MAX 8 |
| 46 | #define MAX1187X_IMAGE_FACTOR_MAX 460 |
| 47 | |
| 48 | #define MAX1187X_NO_BASELINE 0 |
| 49 | #define MAX1187X_FIX_BASELINE 1 |
| 50 | #define MAX1187X_AUTO_BASELINE 2 |
| 51 | |
| 52 | struct max1187x_touch_report_header { |
| 53 | u16 header; |
| 54 | u16 report_id; |
| 55 | u16 report_size; |
| 56 | u16 touch_count:4; |
| 57 | u16 touch_status:4; |
| 58 | u16 reserved0:5; |
| 59 | u16 cycles:1; |
| 60 | u16 reserved1:2; |
| 61 | u16 button0:1; |
| 62 | u16 button1:1; |
| 63 | u16 button2:1; |
| 64 | u16 button3:1; |
| 65 | u16 reserved2:12; |
| 66 | u16 framecounter; |
| 67 | }; |
| 68 | |
| 69 | struct max1187x_touch_report_basic { |
| 70 | u16 finger_id:4; |
| 71 | u16 reserved0:4; |
| 72 | u16 finger_status:4; |
| 73 | u16 reserved1:4; |
| 74 | u16 x:12; |
| 75 | u16 reserved2:4; |
| 76 | u16 y:12; |
| 77 | u16 reserved3:4; |
| 78 | u16 z; |
| 79 | }; |
| 80 | |
| 81 | struct max1187x_touch_report_extended { |
| 82 | u16 finger_id:4; |
| 83 | u16 reserved0:4; |
| 84 | u16 finger_status:4; |
| 85 | u16 reserved1:4; |
| 86 | u16 x:12; |
| 87 | u16 reserved2:4; |
| 88 | u16 y:12; |
| 89 | u16 reserved3:4; |
| 90 | u16 z; |
| 91 | s16 xspeed; |
| 92 | s16 yspeed; |
| 93 | s8 xpixel; |
| 94 | s8 ypixel; |
| 95 | u16 area; |
| 96 | u16 xmin; |
| 97 | u16 xmax; |
| 98 | u16 ymin; |
| 99 | u16 ymax; |
| 100 | }; |
| 101 | |
| 102 | struct max1187x_board_config { |
| 103 | u16 config_id; |
| 104 | u16 chip_id; |
| 105 | u8 major_ver; |
| 106 | u8 minor_ver; |
| 107 | u8 protocol_ver; |
| 108 | u16 vendor_pin; |
| 109 | u16 config_touch[MAX1187X_TOUCH_CONFIG_MAX]; |
| 110 | u16 config_cal[MAX1187X_CALIB_TABLE_MAX]; |
| 111 | u16 config_private[MAX1187X_PRIVATE_CONFIG_MAX]; |
| 112 | u16 config_lin_x[MAX1187X_LOOKUP_TABLE_MAX]; |
| 113 | u16 config_lin_y[MAX1187X_LOOKUP_TABLE_MAX]; |
| 114 | u16 config_ifactor[MAX1187X_IMAGE_FACTOR_MAX]; |
| 115 | }; |
| 116 | |
| 117 | struct max1187x_virtual_key { |
| 118 | int index; |
| 119 | int keycode; |
| 120 | int x_position; |
| 121 | int y_position; |
| 122 | }; |
| 123 | |
| 124 | struct max1187x_fw_mapping { |
| 125 | u32 chip_id; |
| 126 | char *filename; |
| 127 | u32 filesize; |
| 128 | u32 filecrc16; |
| 129 | u32 file_codesize; |
| 130 | }; |
| 131 | |
| 132 | struct max1187x_pdata { |
| 133 | struct max1187x_board_config *fw_config; |
| 134 | u32 gpio_tirq; |
| 135 | u32 gpio_reset; |
| 136 | u32 num_fw_mappings; |
| 137 | struct max1187x_fw_mapping fw_mapping[MAX1187X_NUM_FW_MAPPINGS_MAX]; |
| 138 | u32 defaults_allow; |
| 139 | u32 default_config_id; |
| 140 | u32 default_chip_id; |
| 141 | u32 i2c_words; |
| 142 | #define MAX1187X_REVERSE_X 0x0001 |
| 143 | #define MAX1187X_REVERSE_Y 0x0002 |
| 144 | #define MAX1187X_SWAP_XY 0x0004 |
| 145 | u32 coordinate_settings; |
| 146 | u32 panel_min_x; |
| 147 | u32 panel_max_x; |
| 148 | u32 panel_min_y; |
| 149 | u32 panel_max_y; |
| 150 | u32 lcd_x; |
| 151 | u32 lcd_y; |
| 152 | u32 num_rows; |
| 153 | u32 num_cols; |
| 154 | #define MAX1187X_PROTOCOL_A 0 |
| 155 | #define MAX1187X_PROTOCOL_B 1 |
| 156 | #define MAX1187X_PROTOCOL_CUSTOM1 2 |
| 157 | u16 input_protocol; |
| 158 | #define MAX1187X_UPDATE_NONE 0 |
| 159 | #define MAX1187X_UPDATE_BIN 1 |
| 160 | #define MAX1187X_UPDATE_CONFIG 2 |
| 161 | #define MAX1187X_UPDATE_BOTH 3 |
| 162 | u8 update_feature; |
| 163 | u8 support_htc_event; |
| 164 | u16 tw_mask; |
| 165 | u32 button_code0; |
| 166 | u32 button_code1; |
| 167 | u32 button_code2; |
| 168 | u32 button_code3; |
| 169 | #define MAX1187X_REPORT_MODE_BASIC 1 |
| 170 | #define MAX1187X_REPORT_MODE_EXTEND 2 |
| 171 | u8 report_mode; |
| 172 | struct max1187x_virtual_key *button_data; |
| 173 | }; |
| 174 | |
| 175 | #endif |
| 176 | |