universal7580: abov_touchkey: Fix firmware loading of ft1604 devices lineage-17.1
authorDanny Wood <danwood76@gmail.com>
Tue, 9 Feb 2021 15:43:46 +0000 (15:43 +0000)
committerDanny Wood <danwood76@gmail.com>
Tue, 16 Feb 2021 10:50:42 +0000 (10:50 +0000)
Also fix ft1604 firmware versions of other A510x variants

Change-Id: I33004e2f62b5954bf7b4f2ab6337c0ce39907287

drivers/input/keyboard/abov_touchkey_ft1804.c

index 8a0b6bd859bea9c65ef06f373cce843efad5f0ee..490b372dca8deb3945b3f0e36a64536a84ab6b52 100644 (file)
@@ -1760,13 +1760,16 @@ static int abov_tk_fw_update(struct abov_tk_info *info, u8 cmd)
        usleep_range(5 * 1000, 5 * 1000);
        tk_debug_info(true, &info->client->dev, "%s fw_mode_cmd sended\n", __func__);
 
-       if(abov_tk_fw_mode_check(info) != 1)
-       {
-               pr_err("%s: err, flash mode is not: %d\n", __func__, ret);
-               return 0;
+       if (is_ft1604_chip) {
+               tk_debug_info(true, &info->client->dev, "%s ft1604: skipping abov_tk_fw_mode_check() and abov_tk_flash_erase()\n", __func__);
+       } else {
+               if(abov_tk_fw_mode_check(info) != 1) {
+                       pr_err("%s: err, flash mode is not: %d\n", __func__, ret);
+                       return 0;
+               }
+               ret = abov_tk_flash_erase(info);
        }
 
-       ret = abov_tk_flash_erase(info);
        msleep(1300);
        tk_debug_info(true, &info->client->dev, "%s fw_write start\n", __func__);
 
@@ -3030,15 +3033,21 @@ static int __init get_bootloader(char *bootloader)
 {
        is_ft1604_chip = false;
 
-       if (strstr(bootloader, "A510M") || strstr(bootloader, "A510Y")) {
+       if (strstr(bootloader, "A510M")) {
                is_ft1604_chip = true;
                fw_path = "abov/abov_ft1604_a5_ltn.fw";
        }
+       else if (strstr(bootloader, "A510Y") || strstr(bootloader, "A510K") ||
+                       strstr(bootloader, "A510L") || strstr(bootloader, "A510S") ||
+                       strstr(bootloader, "A5108")) {
+               is_ft1604_chip = true;
+               fw_path = "abov/abov_ft1604_a5.fw";
+       }
        else if (strstr(bootloader, "A310N0") || strstr(bootloader, "A310M")) {
                is_ft1604_chip = true;
                fw_path = "abov/abov_ft1604_a3.fw";
        }
-       
+
        return 0;
 }
 early_param("androidboot.bootloader", get_bootloader);