diff --git a/framework/model/input/driver/touchscreen/touch_gt911.c b/framework/model/input/driver/touchscreen/touch_gt911.c index 074c40d9839751889c9c97493258e4e626f6a7ec..1f19c4369a202b43413481996881d394fabd9981 100644 --- a/framework/model/input/driver/touchscreen/touch_gt911.c +++ b/framework/model/input/driver/touchscreen/touch_gt911.c @@ -18,6 +18,7 @@ #if defined(CONFIG_ARCH_ROCKCHIP) #define GT5688_FIRMWARE_VERSION 256 #define GT911_FIRMWARE_VERSION 4192 +static bool g_isGT5688 = false; #endif #define FOUR_BYTES 4 @@ -64,13 +65,13 @@ static int32_t ChipDetect(ChipDevice *device) switch (version) { case GT5688_FIRMWARE_VERSION: HDF_LOGI("%s:TOUCH IC is GT5688", __func__); + g_isGT5688 = true; break; case GT911_FIRMWARE_VERSION: HDF_LOGI("%s:TOUCH IC is GT911", __func__); break; default: HDF_LOGE("%s: ID wrong,IC FW version is %d", __func__, version); - return HDF_FAILURE; } #endif if (buf[GT_FW_VER_HIGH] == 0x0) { @@ -123,12 +124,13 @@ static void ChipVersionDefault(ChipDevice *device, FrameData *frame, const uint8 ((buf[GT_POINT_SIZE * i + GT_X_HIGH] & ONE_BYTE_MASK) << ONE_BYTE_OFFSET)); frame->fingers[i].y = resY - ((buf[GT_POINT_SIZE * i + GT_Y_LOW] & ONE_BYTE_MASK) | ((buf[GT_POINT_SIZE * i + GT_Y_HIGH] & ONE_BYTE_MASK) << ONE_BYTE_OFFSET)); - if (frame->fingers[i].y < GT_Y_OFFSET_A) { - frame->fingers[i].y += CORRECTION_VALUE_A; - } else if (frame->fingers[i].y < GT_Y_OFFSET_B) { - frame->fingers[i].y += CORRECTION_VALUE_B; - } else if (frame->fingers[i].y < GT_Y_OFFSET_C) { - frame->fingers[i].y += CORRECTION_VALUE_C; + if (g_isGT5688) { + if (frame->fingers[i].y < GT_Y_OFFSET_A) + frame->fingers[i].y += CORRECTION_VALUE_A; + else if (frame->fingers[i].y < GT_Y_OFFSET_B) + frame->fingers[i].y += CORRECTION_VALUE_B; + else if (frame->fingers[i].y < GT_Y_OFFSET_C) + frame->fingers[i].y += CORRECTION_VALUE_C; } #elif defined(LOSCFG_PLATFORM_STM32MP157) frame->fingers[i].x = (buf[GT_POINT_SIZE * i + GT_X_LOW] & ONE_BYTE_MASK) |