Thread (19 messages) 19 messages, 4 authors, 2015-10-19

RE: [PATCH v7 3/9] Input: goodix - write configuration data to device

From: Tirdea, Irina <hidden>
Date: 2015-10-19 14:33:07
Also in: linux-devicetree, lkml

-----Original Message-----
From: Dmitry Torokhov [mailto:dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org]
Sent: 14 October, 2015 9:59
To: Tirdea, Irina
Cc: Bastien Nocera; Aleksei Mamlin; linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; Mark Rutland; Purdila, Octavian; linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org;
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH v7 3/9] Input: goodix - write configuration data to device

On Thu, Oct 08, 2015 at 01:19:29PM +0300, Irina Tirdea wrote:
quoted
Goodix devices can be configured by writing custom data to the device at
init. The configuration data is read with request_firmware from
"goodix_<id>_cfg.bin", where <id> is the product id read from the device
(e.g.: goodix_911_cfg.bin for Goodix GT911, goodix_9271_cfg.bin for
GT9271).

The configuration information has a specific format described in the Goodix
datasheet. It includes X/Y resolution, maximum supported touch points,
interrupt flags, various sensitivity factors and settings for advanced
features (like gesture recognition).

Before writing the firmware, it is necessary to reset the device. If
the device ACPI/DT information does not declare gpio pins (needed for
reset), writing the firmware will not be available for these devices.

This is based on Goodix datasheets for GT911 and GT9271 and on Goodix
driver gt9xx.c for Android (publicly available in Android kernel
trees for various devices).

Signed-off-by: Octavian Purdila <redacted>
Signed-off-by: Irina Tirdea <redacted>
---
 drivers/input/touchscreen/goodix.c | 229 +++++++++++++++++++++++++++++++------
 1 file changed, 196 insertions(+), 33 deletions(-)
<snip>
quoted
+/**
+ * goodix_config_cb - Callback to finish device init
+ *
+ * @ts: our goodix_ts_data pointer
+ *
+ * request_firmware_wait callback that finishes
+ * initialization of the device.
+ */
+static void goodix_config_cb(const struct firmware *cfg, void *ctx)
+{
+	struct goodix_ts_data *ts = (struct goodix_ts_data *)ctx;
+	int error;
+
+	if (cfg) {
+		/* send device configuration to the firmware */
+		error = goodix_send_cfg(ts, cfg);
+		if (error)
+			goto err_release_cfg;
+	}
+	goodix_configure_dev(ts);
+
+err_release_cfg:
+	kfree(ts->cfg_name);
+	release_firmware(cfg);
You need to use completion to signal remove() (and also probably
suspend/resume in the subsequent patches) that you are done handling
config, otherwise if you do bind/unbind via sysfs in a tight loop you
will observe a nice crash.

Thanks.
Right, missed that. Will fix in next version.

Thanks,
Irina

<snip>
--
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help