diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig index 9af100b015e9..c3d0243add02 100644 --- a/drivers/input/touchscreen/Kconfig +++ b/drivers/input/touchscreen/Kconfig @@ -1312,4 +1312,6 @@ config TOUCHSCREEN_IQS5XX source "drivers/input/touchscreen/st/Kconfig" +source "drivers/input/touchscreen/focaltech_touch/Kconfig" + endif diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile index 518a70fd76db..5f2aac477580 100644 --- a/drivers/input/touchscreen/Makefile +++ b/drivers/input/touchscreen/Makefile @@ -111,3 +111,4 @@ obj-$(CONFIG_TOUCHSCREEN_ROHM_BU21023) += rohm_bu21023.o obj-$(CONFIG_TOUCHSCREEN_RASPBERRYPI_FW) += raspberrypi-ts.o obj-$(CONFIG_TOUCHSCREEN_IQS5XX) += iqs5xx.o obj-$(CONFIG_TOUCHSCREEN_ST) += st/ +obj-$(CONFIG_TOUCHSCREEN_FTS) += focaltech_touch/ diff --git a/drivers/input/touchscreen/focaltech_touch/Kconfig b/drivers/input/touchscreen/focaltech_touch/Kconfig index aeb312bc92c1..e306f02058a7 100644 --- a/drivers/input/touchscreen/focaltech_touch/Kconfig +++ b/drivers/input/touchscreen/focaltech_touch/Kconfig @@ -3,7 +3,7 @@ # config TOUCHSCREEN_FTS - bool "Focaltech Touchscreen" + tristate "Focaltech Touchscreen" help Say Y here if you have Focaltech touch panel. If unsure, say N. diff --git a/drivers/input/touchscreen/focaltech_touch/Makefile b/drivers/input/touchscreen/focaltech_touch/Makefile index d77fef873842..07052a64bb79 100644 --- a/drivers/input/touchscreen/focaltech_touch/Makefile +++ b/drivers/input/touchscreen/focaltech_touch/Makefile @@ -1,13 +1,8 @@ # Makefile for the focaltech touchscreen drivers. +obj-$(CONFIG_TOUCHSCREEN_FTS) += focaltech_fts.o -obj-$(CONFIG_TOUCHSCREEN_FTS) += focaltech_core.o -obj-$(CONFIG_TOUCHSCREEN_FTS) += focaltech_ex_fun.o -obj-$(CONFIG_TOUCHSCREEN_FTS) += focaltech_ex_mode.o -obj-$(CONFIG_TOUCHSCREEN_FTS) += focaltech_gesture.o -obj-$(CONFIG_TOUCHSCREEN_FTS) += focaltech_esdcheck.o -obj-$(CONFIG_TOUCHSCREEN_FTS) += focaltech_point_report_check.o - -obj-$(CONFIG_TOUCHSCREEN_FTS) += focaltech_i2c.o -obj-$(CONFIG_TOUCHSCREEN_FTS) += focaltech_flash.o -obj-$(CONFIG_TOUCHSCREEN_FTS) += focaltech_flash/ +focaltech_fts-y := focaltech_core.o focaltech_ex_fun.o focaltech_ex_mode.o \ + focaltech_gesture.o focaltech_esdcheck.o focaltech_point_report_check.o\ + focaltech_i2c.o focaltech_flash.o \ + focaltech_flash/focaltech_upgrade_ft3518.o diff --git a/drivers/input/touchscreen/focaltech_touch/focaltech_core.c b/drivers/input/touchscreen/focaltech_touch/focaltech_core.c index f374d99ab50e..e7d6a0fb0405 100644 --- a/drivers/input/touchscreen/focaltech_touch/focaltech_core.c +++ b/drivers/input/touchscreen/focaltech_touch/focaltech_core.c @@ -1709,28 +1709,47 @@ static int fts_ts_check_dt(struct device_node *np) static int fts_ts_check_default_tp(struct device_node *dt, const char *prop) { - const char *active_tp[3 + 1] = {NULL, NULL, NULL, NULL}; - int count; - int ret; + const char **active_tp = NULL; + int count, tmp, score = 0; + const char *active; + int ret, i; count = of_property_count_strings(dt->parent, prop); if (count <= 0 || count > 3) return -ENODEV; + active_tp = kcalloc(count, sizeof(char *), GFP_KERNEL); + if (!active_tp) { + FTS_ERROR("FTS alloc failed\n"); + return -ENOMEM; + } + ret = of_property_read_string_array(dt->parent, prop, - (const char **)&active_tp, count); + active_tp, count); if (ret < 0) { - pr_err(" %s:fail to read %s %d\n", __func__, prop, ret); - return -ENODEV; + FTS_ERROR("fail to read %s %d\n", prop, ret); + ret = -ENODEV; + goto out; } - if (!of_device_compatible_match(dt, active_tp)) { - pr_err(" %s:no match compatible: %s, %s %s\n", - __func__, active_tp[0]); - return -ENODEV; + for (i = 0; i < count; i++) { + active = active_tp[i]; + if (active != NULL) { + tmp = of_device_is_compatible(dt, active); + if (tmp > 0) + score++; + } } - return 0; + if (score <= 0) { + FTS_INFO("not match this driver\n"); + ret = -ENODEV; + goto out; + } + ret = 0; +out: + kfree(active_tp); + return ret; } static int fts_ts_probe(struct i2c_client *client, const struct i2c_device_id *id) diff --git a/drivers/input/touchscreen/focaltech_touch/focaltech_flash.c b/drivers/input/touchscreen/focaltech_touch/focaltech_flash.c index e6ab5113b628..51c56220c613 100644 --- a/drivers/input/touchscreen/focaltech_touch/focaltech_flash.c +++ b/drivers/input/touchscreen/focaltech_touch/focaltech_flash.c @@ -45,22 +45,12 @@ /***************************************************************************** * Global variable or extern global variabls/functions *****************************************************************************/ -u8 fw_file[] = { -#include FTS_UPGRADE_FW_FILE -}; - -u8 fw_file2[] = { -#include FTS_UPGRADE_FW2_FILE -}; - -u8 fw_file3[] = { -#include FTS_UPGRADE_FW3_FILE +u8 fw_file[1] = { +0, }; struct upgrade_module module_list[] = { {FTS_MODULE_ID, FTS_MODULE_NAME, fw_file, sizeof(fw_file)}, - {FTS_MODULE2_ID, FTS_MODULE2_NAME, fw_file2, sizeof(fw_file2)}, - {FTS_MODULE3_ID, FTS_MODULE3_NAME, fw_file3, sizeof(fw_file3)}, }; struct upgrade_func *upgrade_func_list[] = { diff --git a/drivers/input/touchscreen/focaltech_touch/focaltech_flash/Makefile b/drivers/input/touchscreen/focaltech_touch/focaltech_flash/Makefile index 43deb4a87200..465996f87340 100644 --- a/drivers/input/touchscreen/focaltech_touch/focaltech_flash/Makefile +++ b/drivers/input/touchscreen/focaltech_touch/focaltech_flash/Makefile @@ -1 +1 @@ -obj-$(CONFIG_TOUCHSCREEN_FTS) += focaltech_upgrade_ft3518.o \ No newline at end of file +obj-y += focaltech_upgrade_ft3518.o \ No newline at end of file