From a89263aeeb109ad329c6edd3c7a2d8c203ec769e Mon Sep 17 00:00:00 2001 From: wengjun1 Date: Tue, 10 Nov 2020 15:24:14 +0800 Subject: [PATCH] dlkm: bo: Support multi panel-supplier for novatek on 5.4.0 - Since kernel 5.4.0 with android R can't use chosen property of devicetree to confirm which panel will be used, so get the right panel-supplier from active panel name. NO_PROP_NEEDED: needn't for shm2018 Change-Id: Iaddcf244e5db6dbb77e2d825b18e9645fe1807e3 Signed-off-by: wengjun1 Reviewed-on: https://gerrit.mot.com/1798496 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Jing Hu Reviewed-by: Huosheng Liao Submit-Approved: Jira Key --- .../touchscreen/nova_0flash_mmi/nt36xxx.c | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/drivers/input/touchscreen/nova_0flash_mmi/nt36xxx.c b/drivers/input/touchscreen/nova_0flash_mmi/nt36xxx.c index 390897d73d20..2f070248a893 100644 --- a/drivers/input/touchscreen/nova_0flash_mmi/nt36xxx.c +++ b/drivers/input/touchscreen/nova_0flash_mmi/nt36xxx.c @@ -1180,6 +1180,11 @@ static int32_t nvt_parse_dt(struct device *dev) { struct device_node *np = dev->of_node; int32_t ret = 0; +#if defined(NVT_CONFIG_DRM_PANEL) + int num_of_panel_supplier; + int j; + const char *panel_supplier; +#endif #if NVT_TOUCH_SUPPORT_HW_RST ts->reset_gpio = of_get_named_gpio_flags(np, "novatek,reset-gpio", 0, &ts->reset_flags); @@ -1196,8 +1201,28 @@ static int32_t nvt_parse_dt(struct device *dev) NVT_LOG("SWRST_N8_ADDR=0x%06X\n", SWRST_N8_ADDR); } +#if defined(NVT_CONFIG_DRM_PANEL) + num_of_panel_supplier = of_property_count_strings(np, "novatek,panel-supplier"); + NVT_LOG("%s: get novatek,panel-supplier count=%d", __func__, num_of_panel_supplier); + if (active_panel_name && num_of_panel_supplier > 0) { + for (j = 0; j < num_of_panel_supplier; j++) { + ret = of_property_read_string_index(np, "novatek,panel-supplier", j, &panel_supplier); + if (ret < 0) { + NVT_LOG("%s: cannot parse panel-supplier: %d\n", __func__, ret); + break; + } else if (panel_supplier && strstr(active_panel_name, panel_supplier)) { + ts->panel_supplier = panel_supplier; + NVT_LOG("%s: matched panel_supplier: %s", __func__, panel_supplier); + break; + } + } + } else { + ret = -EINVAL; + } +#else ret = of_property_read_string(np, "novatek,panel-supplier", &ts->panel_supplier); +#endif if (ret < 0) { NVT_LOG("Unable to read panel supplier\n"); } else {