From 3b040bb312f9fda69d2ec27b78554b8ba9a17972 Mon Sep 17 00:00:00 2001 From: litong20 Date: Fri, 10 Sep 2021 11:45:49 +0800 Subject: [PATCH] goodix: enable stylus clock on Rogue project. TP: Enable stylus clocks as touchIC external clock for active pen. Change-Id: I213a83cbe0384a0fa8f77342a1225b6d92a63f71 Reviewed-on: https://gerrit.mot.com/2063784 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Jichao Zou Submit-Approved: Jira Key --- .../goodix_berlin_mmi/goodix_ts_core.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/input/touchscreen/goodix_berlin_mmi/goodix_ts_core.c b/drivers/input/touchscreen/goodix_berlin_mmi/goodix_ts_core.c index 8611fb11ca79..ced01bcf832a 100644 --- a/drivers/input/touchscreen/goodix_berlin_mmi/goodix_ts_core.c +++ b/drivers/input/touchscreen/goodix_berlin_mmi/goodix_ts_core.c @@ -19,6 +19,7 @@ #include #include #include +#include #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 38) #include @@ -2161,6 +2162,7 @@ static int goodix_ts_probe(struct platform_device *pdev) { struct goodix_ts_core *core_data = NULL; struct goodix_bus_interface *bus_interface; + struct clk *stylus_clk; int ret; ts_info("goodix_ts_probe IN"); @@ -2188,6 +2190,20 @@ static int goodix_ts_probe(struct platform_device *pdev) ts_err("failed parse device info form dts, %d", ret); return -EINVAL; } + + if (of_get_property(bus_interface->dev->of_node, "clocks", NULL)) { + stylus_clk = devm_clk_get(bus_interface->dev, "stylus_clk"); + if (IS_ERR_OR_NULL(stylus_clk)) { + ts_err("failed to get stylus clk\n"); + } else { + ret = clk_prepare_enable(stylus_clk); + if(ret) { + ts_err("failed to enable stylus clk\n"); + } else + ts_info("success to enable stylus clk\n"); + } + } + } else { ts_err("no valid device tree node found"); return -ENODEV;