1 /* 2 * cyttsp5_core.h 3 * Parade TrueTouch(TM) Standard Product V5 Core Module. 4 * For use with Parade touchscreen controllers. 5 * Supported parts include: 6 * CYTMA5XX 7 * CYTMA448 8 * CYTMA445A 9 * CYTT21XXX 10 * CYTT31XXX 11 * 12 * Copyright (C) 2015 Parade Semiconductor 13 * Copyright (C) 2012-2015 Cypress Semiconductor 14 * 15 * This program is free software; you can redistribute it and/or 16 * modify it under the terms of the GNU General Public License 17 * version 2, and only version 2, as published by the 18 * Free Software Foundation. 19 * 20 * This program is distributed in the hope that it will be useful, 21 * but WITHOUT ANY WARRANTY; without even the implied warranty of 22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 * GNU General Public License for more details. 24 * 25 * Contact Parade Semiconductor at www.parade.com <ttdrivers@paradetech.com> 26 * 27 */ 28 29 #ifndef _LINUX_CYTTSP5_CORE_H 30 #define _LINUX_CYTTSP5_CORE_H 31 32 #include <linux/stringify.h> 33 34 #define CYTTSP5_I2C_NAME "cyttsp5_i2c_adapter" 35 #define CYTTSP5_SPI_NAME "cyttsp5_spi_adapter" 36 37 #define CYTTSP5_CORE_NAME "cyttsp5_core" 38 #define CYTTSP5_MT_NAME "cyttsp5_mt" 39 #define CYTTSP5_BTN_NAME "cyttsp5_btn" 40 #define CYTTSP5_PROXIMITY_NAME "cyttsp5_proximity" 41 42 #define CY_DRIVER_NAME TTDA 43 #define CY_DRIVER_MAJOR 03 44 #define CY_DRIVER_MINOR 08 45 46 #define CY_DRIVER_REVCTRL 874312 47 48 #define CY_DRIVER_VERSION \ 49 __stringify(CY_DRIVER_NAME) \ 50 "." __stringify(CY_DRIVER_MAJOR) \ 51 "." __stringify(CY_DRIVER_MINOR) \ 52 "." __stringify(CY_DRIVER_REVCTRL) 53 54 #define CY_DRIVER_DATE "20170125" 55 56 /* abs settings */ 57 #define CY_IGNORE_VALUE -1 58 59 enum cyttsp5_core_platform_flags { 60 CY_CORE_FLAG_NONE, 61 CY_CORE_FLAG_POWEROFF_ON_SLEEP = 0x02, 62 CY_CORE_FLAG_RESTORE_PARAMETERS = 0x04, 63 }; 64 65 enum cyttsp5_core_platform_easy_wakeup_gesture { 66 CY_CORE_EWG_NONE, 67 CY_CORE_EWG_TAP_TAP, 68 CY_CORE_EWG_TWO_FINGER_SLIDE, 69 CY_CORE_EWG_RESERVED, 70 CY_CORE_EWG_WAKE_ON_INT_FROM_HOST = 0xFF, 71 }; 72 73 enum cyttsp5_loader_platform_flags { 74 CY_LOADER_FLAG_NONE, 75 CY_LOADER_FLAG_CALIBRATE_AFTER_FW_UPGRADE, 76 /* Use CONFIG_VER field in TT_CFG to decide TT_CFG update */ 77 CY_LOADER_FLAG_CHECK_TTCONFIG_VERSION, 78 CY_LOADER_FLAG_CALIBRATE_AFTER_TTCONFIG_UPGRADE, 79 }; 80 81 struct touch_settings { 82 const uint8_t *data; 83 uint32_t size; 84 uint8_t tag; 85 }; 86 87 struct cyttsp5_touch_firmware { 88 const uint8_t *img; 89 uint32_t size; 90 const uint8_t *ver; 91 uint8_t vsize; 92 uint8_t panel_id; 93 }; 94 95 struct cyttsp5_touch_config { 96 struct touch_settings *param_regs; 97 struct touch_settings *param_size; 98 const uint8_t *fw_ver; 99 uint8_t fw_vsize; 100 uint8_t panel_id; 101 }; 102 103 struct cyttsp5_loader_platform_data { 104 struct cyttsp5_touch_firmware *fw; 105 struct cyttsp5_touch_config *ttconfig; 106 struct cyttsp5_touch_firmware **fws; 107 struct cyttsp5_touch_config **ttconfigs; 108 u32 flags; 109 }; 110 111 typedef int (*cyttsp5_platform_read) (struct device *dev, void *buf, int size); 112 113 #define CY_TOUCH_SETTINGS_MAX 32 114 115 struct cyttsp5_core_platform_data { 116 int irq_gpio; 117 int rst_gpio; 118 int level_irq_udelay; 119 u16 hid_desc_register; 120 u16 vendor_id; 121 u16 product_id; 122 123 int (*xres)(struct cyttsp5_core_platform_data *pdata, 124 struct device *dev); 125 int (*init)(struct cyttsp5_core_platform_data *pdata, 126 int on, struct device *dev); 127 int (*power)(struct cyttsp5_core_platform_data *pdata, 128 int on, struct device *dev, atomic_t *ignore_irq); 129 int (*detect)(struct cyttsp5_core_platform_data *pdata, 130 struct device *dev, cyttsp5_platform_read read); 131 int (*irq_stat)(struct cyttsp5_core_platform_data *pdata, 132 struct device *dev); 133 struct touch_settings *sett[CY_TOUCH_SETTINGS_MAX]; 134 u32 flags; 135 u8 easy_wakeup_gesture; 136 }; 137 138 struct touch_framework { 139 const int16_t *abs; 140 uint8_t size; 141 uint8_t enable_vkeys; 142 } __packed; 143 144 enum cyttsp5_mt_platform_flags { 145 CY_MT_FLAG_NONE, 146 CY_MT_FLAG_HOVER = 0x04, 147 CY_MT_FLAG_FLIP = 0x08, 148 CY_MT_FLAG_INV_X = 0x10, 149 CY_MT_FLAG_INV_Y = 0x20, 150 CY_MT_FLAG_VKEYS = 0x40, 151 CY_MT_FLAG_NO_TOUCH_ON_LO = 0x80, 152 }; 153 154 struct cyttsp5_mt_platform_data { 155 struct touch_framework *frmwrk; 156 unsigned short flags; 157 char const *inp_dev_name; 158 int vkeys_x; 159 int vkeys_y; 160 int swap_x; 161 int swap_y; 162 int xy_exchange; 163 }; 164 165 struct cyttsp5_btn_platform_data { 166 char const *inp_dev_name; 167 }; 168 169 struct cyttsp5_proximity_platform_data { 170 struct touch_framework *frmwrk; 171 char const *inp_dev_name; 172 }; 173 174 struct cyttsp5_platform_data { 175 struct cyttsp5_core_platform_data *core_pdata; 176 struct cyttsp5_mt_platform_data *mt_pdata; 177 struct cyttsp5_btn_platform_data *btn_pdata; 178 struct cyttsp5_proximity_platform_data *prox_pdata; 179 struct cyttsp5_loader_platform_data *loader_pdata; 180 }; 181 182 #endif /* _LINUX_CYTTSP5_CORE_H */ 183