touch: add qti dummy touch driver
Add support for dummy touchscreen driver to help boot up the HW with operating systems requiring at least one input devices in pre-silicon platforms. Change-Id: I0bb5c5a3dd2a8d945c3b0ecee738652ec9d2b561 Signed-off-by: Jeykumar Sankaran <quic_jeykumar@quicinc.com>
此提交包含在:
11
Android.mk
11
Android.mk
@@ -57,4 +57,15 @@ LOCAL_MODULE_PATH := $(KERNEL_MODULES_OUT)
|
|||||||
include $(DLKM_DIR)/Build_external_kernelmodule.mk
|
include $(DLKM_DIR)/Build_external_kernelmodule.mk
|
||||||
###########################################################
|
###########################################################
|
||||||
|
|
||||||
|
###########################################################
|
||||||
|
include $(CLEAR_VARS)
|
||||||
|
LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/**/*) $(wildcard $(LOCAL_PATH)/*)
|
||||||
|
LOCAL_MODULE := dummy_ts.ko
|
||||||
|
LOCAL_MODULE_KBUILD_NAME := dummy_ts.ko
|
||||||
|
LOCAL_MODULE_TAGS := optional
|
||||||
|
#LOCAL_MODULE_DEBUG_ENABLE := true
|
||||||
|
LOCAL_MODULE_PATH := $(KERNEL_MODULES_OUT)
|
||||||
|
include $(DLKM_DIR)/Build_external_kernelmodule.mk
|
||||||
|
###########################################################
|
||||||
|
|
||||||
endif # DLKM check
|
endif # DLKM check
|
||||||
|
6
Kbuild
6
Kbuild
@@ -115,4 +115,10 @@ ifeq ($(CONFIG_TOUCHSCREEN_ATMEL_MXT), y)
|
|||||||
obj-$(CONFIG_MSM_TOUCH) += atmel_mxt_ts.o
|
obj-$(CONFIG_MSM_TOUCH) += atmel_mxt_ts.o
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_TOUCHSCREEN_DUMMY), y)
|
||||||
|
dummy_ts-y := ./dummy_touch/dummy_touch.o
|
||||||
|
|
||||||
|
obj-$(CONFIG_MSM_TOUCH) += dummy_ts.o
|
||||||
|
endif
|
||||||
|
|
||||||
CDEFINES += -DBUILD_TIMESTAMP=\"$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')\"
|
CDEFINES += -DBUILD_TIMESTAMP=\"$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')\"
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
export CONFIG_TOUCHSCREEN_NT36XXX_I2C=y
|
export CONFIG_TOUCHSCREEN_NT36XXX_I2C=y
|
||||||
export CONFIG_TOUCHSCREEN_GOODIX_BRL=y
|
export CONFIG_TOUCHSCREEN_GOODIX_BRL=y
|
||||||
export CONFIG_TOUCHSCREEN_ATMEL_MXT=y
|
export CONFIG_TOUCHSCREEN_ATMEL_MXT=y
|
||||||
|
export CONFIG_TOUCHSCREEN_DUMMY=y
|
||||||
export CONFIG_MSM_TOUCH=m
|
export CONFIG_MSM_TOUCH=m
|
||||||
|
87
dummy_touch/dummy_touch.c
一般檔案
87
dummy_touch/dummy_touch.c
一般檔案
@@ -0,0 +1,87 @@
|
|||||||
|
// SPDX-License-Identifier: GPL-2.0-only
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <linux/module.h>
|
||||||
|
#include <linux/input.h>
|
||||||
|
#include <linux/platform_device.h>
|
||||||
|
#include <linux/mod_devicetable.h>
|
||||||
|
|
||||||
|
MODULE_DESCRIPTION("QTI dummy touchscreen driver");
|
||||||
|
MODULE_LICENSE("GPL v2");
|
||||||
|
|
||||||
|
#define DEVICE_COMPATIBLE "qti,dummy_ts"
|
||||||
|
#define DRIVER_NAME "qti_dummy_ts"
|
||||||
|
|
||||||
|
static int dummy_touch_probe(struct platform_device *device)
|
||||||
|
{
|
||||||
|
struct input_dev *touch_dev = NULL;
|
||||||
|
int rc;
|
||||||
|
|
||||||
|
touch_dev = input_allocate_device();
|
||||||
|
if (!touch_dev) {
|
||||||
|
pr_err("%s: input device allocate failed\n", __func__);
|
||||||
|
return -ENOMEM;
|
||||||
|
}
|
||||||
|
|
||||||
|
touch_dev->name = "qti_dummy_ts";
|
||||||
|
touch_dev->id.bustype = BUS_VIRTUAL;
|
||||||
|
touch_dev->evbit[0] = BIT_MASK(EV_KEY);
|
||||||
|
touch_dev->keybit[BIT_WORD(BTN_0)] = BIT_MASK(BTN_0);
|
||||||
|
touch_dev->dev.parent = NULL;
|
||||||
|
|
||||||
|
rc = input_register_device(touch_dev);
|
||||||
|
if (rc) {
|
||||||
|
pr_err("%s: touch device register failed, rc = %d\n", __func__, rc);
|
||||||
|
input_free_device(touch_dev);
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
pr_info("qti_dummy_ts device registered\n");
|
||||||
|
|
||||||
|
platform_set_drvdata(device, (void *)touch_dev);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int dummy_touch_remove(struct platform_device *device)
|
||||||
|
{
|
||||||
|
struct input_dev *touch_dev = NULL;
|
||||||
|
|
||||||
|
touch_dev = (struct input_dev *)platform_get_drvdata(device);
|
||||||
|
if (touch_dev)
|
||||||
|
input_free_device(touch_dev);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct of_device_id dummy_touch_id[] = {
|
||||||
|
{.compatible = DEVICE_COMPATIBLE},
|
||||||
|
{}
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct platform_driver dummy_touch_driver = {
|
||||||
|
|
||||||
|
.driver = {
|
||||||
|
.name = DRIVER_NAME,
|
||||||
|
.of_match_table = dummy_touch_id,
|
||||||
|
},
|
||||||
|
.probe = dummy_touch_probe,
|
||||||
|
.remove = dummy_touch_remove,
|
||||||
|
};
|
||||||
|
|
||||||
|
static int __init dummy_touch_init(void)
|
||||||
|
{
|
||||||
|
platform_driver_register(&dummy_touch_driver);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void __exit dummy_touch_exit(void)
|
||||||
|
{
|
||||||
|
platform_driver_unregister(&dummy_touch_driver);
|
||||||
|
}
|
||||||
|
|
||||||
|
late_initcall(dummy_touch_init);
|
||||||
|
module_exit(dummy_touch_exit);
|
@@ -3,6 +3,7 @@ ifneq ($(TARGET_BOARD_AUTO),true)
|
|||||||
ifeq ($(call is-board-platform-in-list,$(TARGET_BOARD_PLATFORM)),true)
|
ifeq ($(call is-board-platform-in-list,$(TARGET_BOARD_PLATFORM)),true)
|
||||||
BOARD_VENDOR_KERNEL_MODULES += $(KERNEL_MODULES_OUT)/nt36xxx-i2c.ko \
|
BOARD_VENDOR_KERNEL_MODULES += $(KERNEL_MODULES_OUT)/nt36xxx-i2c.ko \
|
||||||
$(KERNEL_MODULES_OUT)/goodix_ts.ko \
|
$(KERNEL_MODULES_OUT)/goodix_ts.ko \
|
||||||
$(KERNEL_MODULES_OUT)/atmel_mxt_ts.ko
|
$(KERNEL_MODULES_OUT)/atmel_mxt_ts.ko \
|
||||||
|
$(KERNEL_MODULES_OUT)/dummy_ts.ko
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
|
|
||||||
PRODUCT_PACKAGES += $(KERNEL_MODULES_OUT)/nt36xxx-i2c.ko \
|
PRODUCT_PACKAGES += $(KERNEL_MODULES_OUT)/nt36xxx-i2c.ko \
|
||||||
$(KERNEL_MODULES_OUT)/goodix_ts.ko \
|
$(KERNEL_MODULES_OUT)/goodix_ts.ko \
|
||||||
$(KERNEL_MODULES_OUT)/atmel_mxt_ts.ko
|
$(KERNEL_MODULES_OUT)/atmel_mxt_ts.ko \
|
||||||
|
$(KERNEL_MODULES_OUT)/dummy_ts.ko
|
||||||
|
新增問題並參考
封鎖使用者