summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSudhakar Manapati <smanap@codeaurora.org>2015-03-09 11:37:14 +0530
committerDavid Keitel <dkeitel@codeaurora.org>2016-03-23 20:57:52 -0700
commit3c6435a9f53d923e00ab4cfcd7e77b1c6ec0c072 (patch)
treeabc1670b57001704c8ea0756196a2a4fec9a130b
parentd23166718c77b586fec522c00b403b95200c43d7 (diff)
input: synaptics_dsx: Read touchscreen config-id during probe
Add support for reading configuration ID from the touch controller during probe and print it. This is required to identify if touch controller is programmed with correct touch firmware or not. Change-Id: I155f0392ae67e5f9b184b9cef2a7bbb7666be30d Signed-off-by: Sudhakar Manapati <smanap@codeaurora.org> Signed-off-by: Himanshu Aggarwal <haggarwa@codeaurora.org>
-rw-r--r--Documentation/devicetree/bindings/input/touchscreen/synaptics_dsx_i2c.txt1
-rw-r--r--drivers/input/touchscreen/synaptics_dsx/synaptics_dsx_core.c36
-rwxr-xr-xdrivers/input/touchscreen/synaptics_dsx/synaptics_dsx_i2c.c7
-rwxr-xr-xinclude/linux/input/synaptics_dsx_v2.h2
4 files changed, 44 insertions, 2 deletions
diff --git a/Documentation/devicetree/bindings/input/touchscreen/synaptics_dsx_i2c.txt b/Documentation/devicetree/bindings/input/touchscreen/synaptics_dsx_i2c.txt
index 2a77a029eee7..27df06c7457b 100644
--- a/Documentation/devicetree/bindings/input/touchscreen/synaptics_dsx_i2c.txt
+++ b/Documentation/devicetree/bindings/input/touchscreen/synaptics_dsx_i2c.txt
@@ -48,6 +48,7 @@ Optional property:
is required only if secure touch is enabled and used with this driver.
- clock-names: : Clock names used for secure touch. The names are:
"iface_clk", "core_clk".
+ - synaptics,config-id : Specifies the Config Id of touch controller.
Optional properties inside child node:
These properties are defined only when synaptics,detect-device property is defined in DT.
diff --git a/drivers/input/touchscreen/synaptics_dsx/synaptics_dsx_core.c b/drivers/input/touchscreen/synaptics_dsx/synaptics_dsx_core.c
index 1f5b7f3b4e18..57b6d357d2b2 100644
--- a/drivers/input/touchscreen/synaptics_dsx/synaptics_dsx_core.c
+++ b/drivers/input/touchscreen/synaptics_dsx/synaptics_dsx_core.c
@@ -2235,6 +2235,32 @@ static int synaptics_rmi4_alloc_fh(struct synaptics_rmi4_fn **fhandler,
return 0;
}
+static int synaptics_rmi4_read_configid(struct synaptics_rmi4_data *rmi4_data,
+ unsigned char ctrl_base_addr)
+{
+ unsigned int device_config_id;
+
+ /*
+ * We may get an error while trying to read config id if it is
+ * not provisioned by vendor
+ */
+ if (synaptics_rmi4_reg_read(rmi4_data, ctrl_base_addr,
+ (unsigned char *)(&device_config_id),
+ sizeof(device_config_id)) < 0)
+ dev_err(rmi4_data->pdev->dev.parent, "Failed to read device config ID from CTP\n");
+
+ if (rmi4_data->hw_if->board_data->config_id)
+ dev_info(rmi4_data->pdev->dev.parent,
+ "CTP Config ID=%pI4\tDT Config ID=%pI4\n",
+ &device_config_id,
+ &rmi4_data->hw_if->board_data->config_id);
+ else
+ dev_info(rmi4_data->pdev->dev.parent,
+ "CTP Config ID=%pI4\n", &device_config_id);
+
+ return 0;
+}
+
/**
* synaptics_rmi4_query_device()
*
@@ -2263,7 +2289,6 @@ static int synaptics_rmi4_query_device(struct synaptics_rmi4_data *rmi4_data)
struct synaptics_rmi4_fn *fhandler;
struct synaptics_rmi4_device_info *rmi;
unsigned char pkg_id[PACKAGE_ID_SIZE];
-
rmi = &(rmi4_data->rmi4_mod_info);
rescan_pdt:
@@ -2302,6 +2327,15 @@ rescan_pdt:
page_number);
switch (rmi_fd.fn_number) {
+ case SYNAPTICS_RMI4_F34:
+ /*
+ * Though function F34 is an interrupt source,
+ * but it is not a data source, hence do not
+ * add its handler to support_fn_list
+ */
+ synaptics_rmi4_read_configid(rmi4_data,
+ rmi_fd.ctrl_base_addr);
+ break;
case SYNAPTICS_RMI4_F01:
if (rmi_fd.intr_src_count == 0)
break;
diff --git a/drivers/input/touchscreen/synaptics_dsx/synaptics_dsx_i2c.c b/drivers/input/touchscreen/synaptics_dsx/synaptics_dsx_i2c.c
index f08737945b56..3b1c726e0257 100755
--- a/drivers/input/touchscreen/synaptics_dsx/synaptics_dsx_i2c.c
+++ b/drivers/input/touchscreen/synaptics_dsx/synaptics_dsx_i2c.c
@@ -1,7 +1,7 @@
/*
* Synaptics DSX touchscreen driver
*
- * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2014-2015, The Linux Foundation. All rights reserved.
*
* Linux foundation chooses to take subject only to the GPLv2 license terms,
* and distributes only under these terms.
@@ -326,6 +326,11 @@ static int synaptics_dsx_parse_dt(struct device *dev,
return rc;
}
+ rc = of_property_read_u32(np, "synaptics,config-id",
+ &rmi4_pdata->config_id);
+ if (rc && (rc != -EINVAL))
+ dev_err(dev, "Unable to read config id from DT\n");
+
rmi4_pdata->fw_name = "PRXXX_fw.img";
rc = of_property_read_string(np, "synaptics,fw-name",
&rmi4_pdata->fw_name);
diff --git a/include/linux/input/synaptics_dsx_v2.h b/include/linux/input/synaptics_dsx_v2.h
index fe293f5b99c7..4395f32f57a9 100755
--- a/include/linux/input/synaptics_dsx_v2.h
+++ b/include/linux/input/synaptics_dsx_v2.h
@@ -5,6 +5,7 @@
*
* Copyright (C) 2012 Alexandra Chin <alexandra.chin@tw.synaptics.com>
* Copyright (C) 2012 Scott Lin <scott.lin@tw.synaptics.com>
+ * Copyright (c) 2015, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -96,6 +97,7 @@ struct synaptics_dsx_board_data {
u32 disp_miny;
u32 disp_maxx;
u32 disp_maxy;
+ u32 config_id;
bool disable_gpios;
bool detect_device;
const char *fw_name;