From ca2c13ef09a888f274296c021da26bdccf1228d3 Mon Sep 17 00:00:00 2001 From: Konstantin Makariev Date: Tue, 15 Dec 2020 09:56:19 -0600 Subject: [PATCH] sec_mmi: mmi status check Added MMI status check to driver's probe. Kernel module will be loaded only when MMI status check succeed. Driver node needs to have property mmi,status in device tree for this to work. Change-Id: Ie7dffc5e9bb4769492e5fd15f0da94908cf8ef79 Signed-off-by: Konstantin Makariev Reviewed-on: https://gerrit.mot.com/1827959 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Ling Jin Submit-Approved: Jira Key --- drivers/input/touchscreen/sec_mmi/Android.mk | 1 + drivers/input/touchscreen/sec_mmi/Kbuild | 2 ++ drivers/input/touchscreen/sec_mmi/sec_ts.c | 11 ++++++----- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/input/touchscreen/sec_mmi/Android.mk b/drivers/input/touchscreen/sec_mmi/Android.mk index e02d132fb148..dfa045e87172 100644 --- a/drivers/input/touchscreen/sec_mmi/Android.mk +++ b/drivers/input/touchscreen/sec_mmi/Android.mk @@ -5,6 +5,7 @@ include $(CLEAR_VARS) LOCAL_MODULE := sec_mmi.ko LOCAL_MODULE_TAGS := optional LOCAL_MODULE_PATH := $(KERNEL_MODULES_OUT) +LOCAL_ADDITIONAL_DEPENDENCIES := $(KERNEL_MODULES_OUT)/mmi_info.ko ifneq ($(findstring touchscreen_mmi.ko,$(BOARD_VENDOR_KERNEL_MODULES)),) KERNEL_CFLAGS += CONFIG_INPUT_TOUCHSCREEN_MMI=y LOCAL_ADDITIONAL_DEPENDENCIES := $(KERNEL_MODULES_OUT)/touchscreen_mmi.ko diff --git a/drivers/input/touchscreen/sec_mmi/Kbuild b/drivers/input/touchscreen/sec_mmi/Kbuild index 629c4a646040..617599696094 100644 --- a/drivers/input/touchscreen/sec_mmi/Kbuild +++ b/drivers/input/touchscreen/sec_mmi/Kbuild @@ -25,3 +25,5 @@ ifneq ($(filter m y,$(CONFIG_INPUT_TOUCHSCREEN_MMI)),) else sec_mmi-objs += sec_ts_mmi.o endif + +KBUILD_EXTRA_SYMBOLS += $(CURDIR)/$(KBUILD_EXTMOD)/../../../mmi_info/Module.symvers diff --git a/drivers/input/touchscreen/sec_mmi/sec_ts.c b/drivers/input/touchscreen/sec_mmi/sec_ts.c index 348d42555275..e82fb7779386 100644 --- a/drivers/input/touchscreen/sec_mmi/sec_ts.c +++ b/drivers/input/touchscreen/sec_mmi/sec_ts.c @@ -14,6 +14,7 @@ struct sec_ts_data *tsp_info; #include "sec_ts.h" #include "sec_mmi.h" +#include struct sec_ts_data *ts_dup; @@ -1737,6 +1738,11 @@ static int sec_ts_probe(struct i2c_client *client, const struct i2c_device_id *i return -EIO; } + if (client->dev.of_node && !mmi_device_is_available(client->dev.of_node)) { + input_err(true, &client->dev, "%s mmi: device not supported\n", __func__); + return -ENODEV; + } + /* parse dt */ if (client->dev.of_node) { pdata = devm_kzalloc(&client->dev, @@ -2671,11 +2677,6 @@ static int __init sec_ts_init(void) return -ENODEV; } #endif - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0)) - if (!ts_mmi_is_panel_match("mmi,panel_name", "lsi")) - return false; -#endif pr_err("%s\n", __func__); return i2c_add_driver(&sec_ts_driver);