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 <hcv867@motorola.com>
Reviewed-on: https://gerrit.mot.com/1827959
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Ling Jin <lingjin@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
Konstantin Makariev 2020-12-15 09:56:19 -06:00 • committed by Konstantin Makariev
commit ca2c13ef09
3 changed files with 9 additions and 5 deletions

View file

@ -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

View file

@ -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

View file

@ -14,6 +14,7 @@ struct sec_ts_data *tsp_info;
#include "sec_ts.h"
#include "sec_mmi.h"
#include <linux/mmi_device.h>
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);