1 /* 2 * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 3 * 4 * HDF is dual licensed: you can use it either under the terms of 5 * the GPL, or the BSD license, at your option. 6 * See the LICENSE file in the root of this repository for complete details. 7 */ 8 9 #ifndef TOUCH_GT911_H 10 #define TOUCH_GT911_H 11 12 /* the macro defines of GT911 */ 13 #define MAX_SUPPORT_POINT 5 14 #define ONE_BYTE_MASK 0xFF 15 #define ONE_BYTE_OFFSET 8 16 #define GT_EVENT_UP 0x80 17 #define GT_EVENT_INVALID 0 18 19 #define GT_POINT_SIZE 8 20 #define GT_TRACK_ID 0 21 #define GT_X_LOW 1 22 #define GT_X_HIGH 2 23 #define GT_Y_LOW 3 24 #define GT_Y_HIGH 4 25 #define GT_ADDR_LEN 2 26 #define GT_BUF_STATE_ADDR 0x814E 27 #define GT_X_LOW_BYTE_BASE 0x814F 28 #define GT_FINGER_NUM_MASK 0x0F 29 #define GT_CLEAN_DATA_LEN 3 30 #define GT_REG_HIGH_POS 0 31 #define GT_REG_LOW_POS 1 32 #define GT_CLEAN_POS 2 33 #define GT_CLEAN_FLAG 0x0 34 /* Config info macro of GT911 */ 35 #define GT_CFG_INFO_ADDR 0x8140 36 #define GT_CFG_INFO_LEN 10 37 #define GT_PROD_ID_1ST 0 38 #define GT_PROD_ID_2ND 1 39 #define GT_PROD_ID_3RD 2 40 #define GT_PROD_ID_4TH 3 41 #define GT_FW_VER_LOW 4 42 #define GT_FW_VER_HIGH 5 43 #define GT_SOLU_X_LOW 6 44 #define GT_SOLU_X_HIGH 7 45 #define GT_SOLU_Y_LOW 8 46 #define GT_SOLU_Y_HIGH 9 47 #define FIRMWARE_3RD 2 48 #define KEY_CODE_4TH 3 49 #if defined(CONFIG_ARCH_ROCKCHIP) 50 #define FIRMWARE_LEN 241 51 #define GTP_REG_CONFIG_DATA 0x8050 52 #else 53 #define FIRMWARE_LEN 188 54 #endif 55 #if defined(CONFIG_ARCH_ROCKCHIP) 56 uint8_t firmWareParm[FIRMWARE_LEN] = { 57 0x80, 0x50, 0x64, 0xD0, 0x02, 0x00, 0x05, 0x05, 0x05, 0x00, 0x01, 58 0x00, /* 0x8050 is reg, GTP_REG_CONFIG_DATA */ 59 0x00, 0x0F, 0x46, 0x2D, 0x53, 0x11, 0x00, 0x00, 0x50, 0x11, 0x14, 60 0x14, 0x14, 0x20, 0x0A, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 61 0x53, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x14, 62 0x64, 0x1E, 0x28, 0x8C, 0x0C, 0x0E, 0x37, 0x39, 0x09, 0x06, 0x20, 63 0x37, 0x20, 0x12, 0x03, 0x24, 0x00, 0x00, 0x19, 0x6E, 0x80, 0x14, 64 0x02, 0x00, 0x00, 0x54, 0xB2, 0x27, 0x84, 0x35, 0x6A, 0x43, 0x59, 65 0x51, 0x4E, 0x5F, 0x4E, 0x00, 0x00, 0x00, 0x10, 0x28, 0x48, 0x00, 66 0xF0, 0x4A, 0x3A, 0xFF, 0xF0, 0x27, 0x05, 0x00, 0x00, 0x00, 0x00, 67 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 68 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 69 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 70 0x20, 0x50, 0x3C, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x06, 71 0x0C, 0x05, 0x0B, 0x04, 0x0A, 0x03, 0x09, 0x02, 0x08, 0x01, 0x07, 72 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 73 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 74 0x15, 0x16, 0x17, 0x18, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 75 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x05, 76 0x1E, 0x00, 0x02, 0x2A, 0x1E, 0x19, 0x14, 0x02, 0x00, 0x03, 0x0A, 77 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 78 0x04, 0x22, 0x03, 0x00, 0x00, 0x33, 0x00, 0x0F, 0x00, 0x00, 0x28, 79 0x50, 0x3C, 0x50, 0x00, 0x00, 0x05, 0x5F, 0xEB, 0x01}; 80 #else 81 uint8_t firmWareParm[FIRMWARE_LEN] = { 82 0x80, 0x47, 0x45, 0xC0, 0x03, 0xE0, 0x01, 0x05, 0x3D, 0x00, 0x01, 0x08, 83 0x28, 0x0F, 0x50, 0x32, 0x03, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 84 0x00, 0x18, 0x1A, 0x1E, 0x14, 0x86, 0x26, 0x08, 0x55, 0x57, 0xB2, 0x04, 85 0x00, 0x00, 0x00, 0x42, 0x02, 0x11, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 86 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x78, 0x94, 0xD5, 0x02, 0x07, 0x00, 87 0x00, 0x04, 0x97, 0x40, 0x00, 0x8A, 0x4A, 0x00, 0x80, 0x55, 0x00, 0x77, 88 0x61, 0x00, 0x6F, 0x70, 0x00, 0x6F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 89 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 90 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 91 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x0E, 0x0C, 0x0A, 0x08, 0x06, 92 0x04, 0x02, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 93 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 94 0x22, 0x21, 0x20, 0x1F, 0x1E, 0x1D, 0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 95 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 96 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 97 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5C, 0x01}; 98 #endif 99 #endif