diff options
author | davidycchen <davidycchen@google.com> | 2021-10-20 14:12:04 +0800 |
---|---|---|
committer | David Chen <davidycchen@google.com> | 2021-10-21 09:20:04 +0000 |
commit | 4a947d1ba4f75eb46381fa62e6d6e768c082c21f (patch) | |
tree | 7b30322746ae577c209e7559a2d1cc732459339a /syna_tcm2_platform_spi.c | |
parent | bf9731c028f5959aa4e80834bd5579c906b894b9 (diff) | |
download | synaptics_touch-4a947d1ba4f75eb46381fa62e6d6e768c082c21f.tar.gz |
synaptics: support panel map device tree
Support panel map to recognize different panel.
Bug: 203479046
Test: Touch driver can recognize different panel.
Signed-off-by: davidycchen <davidycchen@google.com>
Change-Id: If762d3a2757605c78dcf75ea60a24356e7b8c6a6
Diffstat (limited to 'syna_tcm2_platform_spi.c')
-rw-r--r-- | syna_tcm2_platform_spi.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/syna_tcm2_platform_spi.c b/syna_tcm2_platform_spi.c index ba1e23b..547b798 100644 --- a/syna_tcm2_platform_spi.c +++ b/syna_tcm2_platform_spi.c @@ -37,6 +37,7 @@ */ #include <linux/spi/spi.h> +#include <drm/drm_panel.h> #include "syna_tcm2.h" #include "syna_tcm2_platform.h" @@ -443,6 +444,7 @@ static int syna_spi_parse_dt(struct syna_hw_interface *hw_if, struct device *dev) { int retval; + int index; u32 value; struct property *prop; struct device_node *np = dev->of_node; @@ -451,6 +453,35 @@ static int syna_spi_parse_dt(struct syna_hw_interface *hw_if, struct syna_hw_pwr_data *pwr = &hw_if->bdata_pwr; struct syna_hw_rst_data *rst = &hw_if->bdata_rst; struct syna_hw_bus_data *bus = &hw_if->bdata_io; + struct of_phandle_args panelmap; + struct drm_panel *panel = NULL; + + if (of_property_read_bool(np, "synaptics,panel_map")) { + for (index = 0 ;; index++) { + retval = of_parse_phandle_with_fixed_args(np, + "synaptics,panel_map", + 0, + index, + &panelmap); + if (retval) + return -EPROBE_DEFER; + panel = of_drm_find_panel(panelmap.np); + of_node_put(panelmap.np); + if (!IS_ERR_OR_NULL(panel)) { + retval = of_property_read_string_index(np, + "synaptics,firmware_names", + index, &name); + if (retval < 0) + hw_if->fw_name = FW_IMAGE_NAME; + else + hw_if->fw_name = name; + LOGI("Firmware name %s", hw_if->fw_name); + break; + } + } + } else { + hw_if->fw_name = FW_IMAGE_NAME; + } prop = of_find_property(np, "synaptics,irq-gpio", NULL); if (prop && prop->length) { |