diff --git a/drivers/input/touchscreen/stmicro_mmi/Android.mk b/drivers/input/touchscreen/stmicro_mmi/Android.mk index 19022e919425..b0eedf33e2a3 100644 --- a/drivers/input/touchscreen/stmicro_mmi/Android.mk +++ b/drivers/input/touchscreen/stmicro_mmi/Android.mk @@ -5,6 +5,10 @@ ifeq ($(DRM_PANEL_NOTIFICATIONS),true) KERNEL_CFLAGS += CONFIG_DRM_PANEL_NOTIFICATIONS=y endif +ifeq ($(ST_LIMIT_USE_SUPPLIER),true) + KERNEL_CFLAGS += CONFIG_ST_LIMIT_USE_SUPPLIER=y +endif + include $(CLEAR_VARS) LOCAL_MODULE := stmicro_mmi.ko LOCAL_MODULE_TAGS := optional diff --git a/drivers/input/touchscreen/stmicro_mmi/Kbuild b/drivers/input/touchscreen/stmicro_mmi/Kbuild index 633c4f779d63..f8cd11e5eb76 100644 --- a/drivers/input/touchscreen/stmicro_mmi/Kbuild +++ b/drivers/input/touchscreen/stmicro_mmi/Kbuild @@ -20,6 +20,10 @@ ifneq ($(filter m y,$(CONFIG_DRM_PANEL_NOTIFICATIONS)),) EXTRA_CFLAGS += -DCONFIG_DRM_PANEL_NOTIFICATIONS endif +ifneq ($(filter m y,$(CONFIG_ST_LIMIT_USE_SUPPLIER)),) + EXTRA_CFLAGS += -DCONFIG_ST_LIMIT_USE_SUPPLIER +endif + ifneq ($(filter m y,$(CONFIG_INPUT_TOUCHSCREEN_MMI)),) EXTRA_CFLAGS += -DCONFIG_INPUT_TOUCHSCREEN_MMI stmicro_mmi-objs += fts_mmi_class.o diff --git a/drivers/input/touchscreen/stmicro_mmi/fts.c b/drivers/input/touchscreen/stmicro_mmi/fts.c index c746765fc3cf..139376ec3258 100644 --- a/drivers/input/touchscreen/stmicro_mmi/fts.c +++ b/drivers/input/touchscreen/stmicro_mmi/fts.c @@ -1517,7 +1517,7 @@ static ssize_t stm_fts_cmd_show(struct device *dev, switch (typeOfComand[0]) { /*ITO TEST*/ case 0x01: - res = production_test_ito(LIMITS_FILE, &tests); + res = production_test_ito(info->limit_path, &tests); break; /*PRODUCTION TEST*/ case 0x00: @@ -1541,7 +1541,7 @@ static ssize_t stm_fts_cmd_show(struct device *dev, } #endif - res = production_test_main(LIMITS_FILE, 1, init_type, + res = production_test_main(info->limit_path, 1, init_type, &tests, MP_FLAG_FACTORY); break; /*read mutual raw*/ @@ -1703,28 +1703,28 @@ static ssize_t stm_fts_cmd_show(struct device *dev, case 0x03: /* MS Raw DATA TEST */ res = fts_system_reset(); if (res >= OK) - res = production_test_ms_raw(LIMITS_FILE, 1, + res = production_test_ms_raw(info->limit_path, 1, &tests); break; case 0x04: /* MS CX DATA TEST */ res = fts_system_reset(); if (res >= OK) - res = production_test_ms_cx(LIMITS_FILE, 1, + res = production_test_ms_cx(info->limit_path, 1, &tests); break; case 0x05: /* SS RAW DATA TEST */ res = fts_system_reset(); if (res >= OK) - res = production_test_ss_raw(LIMITS_FILE, 1, + res = production_test_ss_raw(info->limit_path, 1, &tests); break; case 0x06: /* SS IX CX DATA TEST */ res = fts_system_reset(); if (res >= OK) - res = production_test_ss_ix_cx(LIMITS_FILE, 1, + res = production_test_ss_ix_cx(info->limit_path, 1, &tests); break; @@ -3023,7 +3023,7 @@ int fts_chip_initialization(struct fts_ts_info *info, int init_type) #ifndef COMPUTE_INIT_METHOD ret2 = production_test_initialization(init_type); #else - ret2 = production_test_main(LIMITS_FILE, 1, init_type, &tests, + ret2 = production_test_main(info->limit_path, 1, init_type, &tests, MP_FLAG_BOOT); #endif if (ret2 == OK) @@ -4029,6 +4029,27 @@ err_pinctrl_get: return retval; } +static int fts_mmi_set_limit_name(struct fts_ts_info *ts) +{ + int ret; + const char* supplier = NULL; + +#if defined(CONFIG_INPUT_TOUCHSCREEN_MMI) && defined(CONFIG_ST_LIMIT_USE_SUPPLIER) + if (ts->imports && ts->imports->get_supplier) { + ret = ts->imports->get_supplier(ts->dev, &supplier); + if (!ret) + snprintf(ts->limit_path, MAX_LIMIT_FILE_NAME, "%s_%s", + supplier, LIMITS_FILE); + } else + snprintf(ts->limit_path, MAX_LIMIT_FILE_NAME, "%s", LIMITS_FILE); +#else + snprintf(ts->limit_path, MAX_LIMIT_FILE_NAME, "%s", LIMITS_FILE); +#endif + + logError(1, "%s limit file path: %s\n", tag, ts->limit_path); + return 0; +} + /** * Probe function, called when the driver it is matched with a device with the *same name compatible name @@ -4353,6 +4374,7 @@ static int fts_probe(struct spi_device *client) #endif /* register touchscreen class if provisioned */ fts_mmi_init(info, true); + fts_mmi_set_limit_name(info); logError(1, "%s Probe Finished!\n", tag); return OK; diff --git a/drivers/input/touchscreen/stmicro_mmi/fts.h b/drivers/input/touchscreen/stmicro_mmi/fts.h index 850e5a663118..f832b9604d98 100644 --- a/drivers/input/touchscreen/stmicro_mmi/fts.h +++ b/drivers/input/touchscreen/stmicro_mmi/fts.h @@ -35,7 +35,7 @@ #include #include "fts_lib/ftsSoftware.h" #include "fts_lib/ftsHardware.h" - +#include "fts_lib/ftsTest.h" /****************** CONFIGURATION SECTION ******************/ /** @defgroup conf_section Driver Configuration Section @@ -354,6 +354,9 @@ struct fts_ts_info { * when allowed */ struct fts_sys_info *sysinfo; + /* touchscreen class*/ + struct ts_mmi_class_methods *imports; + char limit_path[MAX_LIMIT_FILE_NAME]; const char *fw_file; bool force_reflash; }; diff --git a/drivers/input/touchscreen/stmicro_mmi/fts_lib/ftsTest.c b/drivers/input/touchscreen/stmicro_mmi/fts_lib/ftsTest.c index c34eb38177a9..7e7f247d8800 100644 --- a/drivers/input/touchscreen/stmicro_mmi/fts_lib/ftsTest.c +++ b/drivers/input/touchscreen/stmicro_mmi/fts_lib/ftsTest.c @@ -7532,13 +7532,13 @@ int parseProductionTestLimits(char *path, LimitFile *file, char *label, char *buf = NULL; int n, size, pointer = 0, ret = OK; char *data_file = NULL; - + struct fts_ts_info *info = dev_get_drvdata(getDev()); if (file == NULL || strcmp(path, file->name) != 0 || file->size == 0) { logError(0, "%s No limit File data passed... try to get them from the system!\n", tag); - ret = getLimitsFile(LIMITS_FILE, &limit_file); + ret = getLimitsFile(info->limit_path, &limit_file); if (ret < OK) { logError(1, "%s parseProductionTestLimits: ERROR %08X\n", diff --git a/drivers/input/touchscreen/stmicro_mmi/fts_mmi_class.c b/drivers/input/touchscreen/stmicro_mmi/fts_mmi_class.c index 4eb1c7fd83fb..b21d6b683242 100644 --- a/drivers/input/touchscreen/stmicro_mmi/fts_mmi_class.c +++ b/drivers/input/touchscreen/stmicro_mmi/fts_mmi_class.c @@ -331,6 +331,8 @@ int fts_mmi_init(struct fts_ts_info *ts, bool enable) ret = ts_mmi_dev_register(ts->dev, &fts_mmi_methods); if (ret) dev_err(ts->dev, "Failed to register ts mmi\n"); + /* initialize class imported methods */ + ts->imports = &fts_mmi_methods.exports; dev_info(ts->dev, "MMI start sensing\n"); ret = fts_chip_initialization(ts, SPECIAL_FULL_PANEL_INIT); diff --git a/drivers/input/touchscreen/stmicro_mmi/fts_proc.c b/drivers/input/touchscreen/stmicro_mmi/fts_proc.c index b4d555b68023..4ea9876d37b5 100644 --- a/drivers/input/touchscreen/stmicro_mmi/fts_proc.c +++ b/drivers/input/touchscreen/stmicro_mmi/fts_proc.c @@ -1907,7 +1907,7 @@ static ssize_t fts_driver_test_write(struct file *file, const char __user *buf, /*ITO TEST*/ case CMD_ITOTEST: - res = production_test_ito(LIMITS_FILE, &tests); + res = production_test_ito(info->limit_path, &tests); break; /*Initialization*/ @@ -1926,7 +1926,7 @@ static ssize_t fts_driver_test_write(struct file *file, const char __user *buf, case CMD_MSRAWTEST: /* MS Raw DATA TEST */ if (numberParam == 2) /* need to specify if stopOnFail * */ - res = production_test_ms_raw(LIMITS_FILE, + res = production_test_ms_raw(info->limit_path, cmd[1], &tests); else { logError(1, "%s Wrong number of parameters!\n", @@ -1937,7 +1937,7 @@ static ssize_t fts_driver_test_write(struct file *file, const char __user *buf, case CMD_MSINITDATATEST:/* MS CX DATA TEST */ if (numberParam == 2) /* need stopOnFail */ - res = production_test_ms_cx(LIMITS_FILE, cmd[1], + res = production_test_ms_cx(info->limit_path, cmd[1], &tests); else { logError(1, "%s Wrong number of parameters!\n", @@ -1948,7 +1948,7 @@ static ssize_t fts_driver_test_write(struct file *file, const char __user *buf, case CMD_SSRAWTEST: /* SS RAW DATA TEST */ if (numberParam == 2) /* need stopOnFail */ - res = production_test_ss_raw(LIMITS_FILE, + res = production_test_ss_raw(info->limit_path, cmd[1], &tests); else { logError(1, "%s Wrong number of parameters!\n", @@ -1959,7 +1959,7 @@ static ssize_t fts_driver_test_write(struct file *file, const char __user *buf, case CMD_SSINITDATATEST:/* SS IX CX DATA TEST */ if (numberParam == 2) /* need stopOnFail */ - res = production_test_ss_ix_cx(LIMITS_FILE, + res = production_test_ss_ix_cx(info->limit_path, cmd[1], &tests); else { logError(1, "%s Wrong number of parameters!\n", @@ -1974,12 +1974,12 @@ static ssize_t fts_driver_test_write(struct file *file, const char __user *buf, * saveInit and * mpflag(optional)*/ if (numberParam == 3) - res = production_test_main(LIMITS_FILE, + res = production_test_main(info->limit_path, cmd[1], cmd[2], &tests, MP_FLAG_OTHERS); else - res = production_test_main(LIMITS_FILE, + res = production_test_main(info->limit_path, cmd[1], cmd[2], &tests, cmd[3]); @@ -2006,7 +2006,7 @@ static ssize_t fts_driver_test_write(struct file *file, const char __user *buf, lim.data = NULL; lim.size = 0; if (numberParam == 1) - res = getLimitsFile(LIMITS_FILE, &lim); + res = getLimitsFile(info->limit_path, &lim); else res = getLimitsFile(path, &lim); readData = lim.data; @@ -2033,7 +2033,7 @@ static ssize_t fts_driver_test_write(struct file *file, const char __user *buf, addr = ((u64)byteToRead) * 4; /* number of * words */ - res = getLimitsFile(LIMITS_FILE, &lim); + res = getLimitsFile(info->limit_path, &lim); readData = lim.data; fileSize = lim.size;