summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSuper Liu <supercjliu@google.com>2023-03-20 02:38:11 +0000
committerTreeHugger Robot <treehugger-gerrit@google.com>2023-03-21 06:58:42 +0000
commitae89c6f045b0c9d0482ed0315241bd5027b33fff (patch)
tree25fc106d19e2c604886f40d70152f5970b1ffbbc
parent9952de196e851455c075c080bc0310887d645689 (diff)
downloadcommon-ae89c6f045b0c9d0482ed0315241bd5027b33fff.tar.gz
gti: support predefined dev id to create device
Bug: 272408020 Change-Id: I6c6300189782ceef4f9a7897e669abd6f72b385d Signed-off-by: Super Liu <supercjliu@google.com>
-rw-r--r--goog_touch_interface.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/goog_touch_interface.c b/goog_touch_interface.c
index 4cc7e1f..2585a47 100644
--- a/goog_touch_interface.c
+++ b/goog_touch_interface.c
@@ -3570,7 +3570,15 @@ struct goog_touch_interface *goog_touch_interface_probe(
gti_class = class_create(THIS_MODULE, GTI_NAME);
if (gti && gti_class) {
- char *name = kasprintf(GFP_KERNEL, "gti.%d", gti_dev_num);
+ u32 dev_id = gti_dev_num;
+ char *name;
+
+ if (gti->vendor_dev) {
+ struct device_node *np = gti->vendor_dev->of_node;
+
+ of_property_read_u32(np, "goog,dev-id", &dev_id);
+ }
+ name = kasprintf(GFP_KERNEL, "gti.%d", dev_id);
if (name &&
!alloc_chrdev_region(&gti->dev_id, 0, 1, name)) {