From patchwork Tue Aug 3 08:48:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair X-Patchwork-Id: 491110 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D89D8C432BE for ; Tue, 3 Aug 2021 08:49:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C2E8D60FA0 for ; Tue, 3 Aug 2021 08:49:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234699AbhHCItY (ORCPT ); Tue, 3 Aug 2021 04:49:24 -0400 Received: from new4-smtp.messagingengine.com ([66.111.4.230]:38925 "EHLO new4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234641AbhHCItW (ORCPT ); Tue, 3 Aug 2021 04:49:22 -0400 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailnew.nyi.internal (Postfix) with ESMTP id CD57C5809FE; Tue, 3 Aug 2021 04:49:11 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Tue, 03 Aug 2021 04:49:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alistair23.me; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; s=fm1; bh=U3smuC21xiclnAcPm0Ugo61M+O k4GIAM2qkc0U+vSB4=; b=nKqkO4vVYQVSPC3CwB63cLS2wQOqI45dGp6q8AWmxB Vz0wv6dmoSqcPaAjpzJYUXDA/+3evLAw1hVPucjotzW/K55gOdg92Lrr8+JAFYmg e6uz+2CO4e9onYN4uMYyE4fI4oclyamIIa01PiN04GLHk1LLAUlTcBfNHxIwg+Tr u2R2ea6uM4jQFZpqQV9YYfqXpzD1mucuZVeJNd9E2uQwkYBOPYEn6bxKH4WQ8AFO 8j7NSD7oOECrHZgJYNbylj/w7yNZ+0LFd4SF0Mwe5I6S8T/TFAgicu78myV0BbtI ugnBUWfO9Y6K/lbLWltoUSQ2Kks3z++tIu7qN6M7tp6A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :message-id:mime-version:subject:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=U3smuC21xiclnAcPm 0Ugo61M+Ok4GIAM2qkc0U+vSB4=; b=AWnxIELfCTMxO01+IGKFflnRMNVV/0jqI QAppWoPTRQjyDtLC0NNMVT7xJLtcRwlzZSJk0qi2o1S2JeXgNoKhAe8pI7SNxLNL asPFs72nssHezIp7QYNfIO1qSrMeNpRilS3KIfgTVXDGqPjlstTYpoCTfD3QqEma 9v2/nSU4Am73YCRBbTR/V5OVqkQ7t4o4+CYiBMvrR2kt/jQuai6pPZ4Nwj0oz6x2 nk1en5U76o3kFg7WzgNBMx61ZfPjwczfWTYVwoQGEQTGNQ5jDL5mIr8RDJEzOtqy mp3zydIObNUqk2wkBJyou4mdmyFZcv0ap3kwxAb+m1cA4RJnKQGNg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrieeggddtiecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgggfestdekredtredttdenucfhrhhomheptehlihhsthgrihhr ucfhrhgrnhgtihhsuceorghlihhsthgrihhrsegrlhhishhtrghirhdvfedrmhgvqeenuc ggtffrrghtthgvrhhnpeejleeihfdvtefgtdethfdtgefftdeiffefjeeiffefveeuleej heejvefhffeukeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfh hrohhmpegrlhhishhtrghirhesrghlihhsthgrihhrvdefrdhmvg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 3 Aug 2021 04:49:05 -0400 (EDT) From: Alistair Francis To: dmitry.torokhov@gmail.com, linux-input@vger.kernel.org, linux-imx@nxp.com, kernel@pengutronix.de, pinglinux@gmail.com, tatsunosuke.tobita@wacom.com, junkpainting@gmail.com, ping.cheng@wacom.com Cc: linux-kernel@vger.kernel.org, alistair23@gmail.com, robh+dt@kernel.org, devicetree@vger.kernel.org, Alistair Francis , Rob Herring Subject: [PATCH v8 1/9] dt-bindings: Add Wacom to vendor bindings Date: Tue, 3 Aug 2021 18:48:54 +1000 Message-Id: <20210803084902.336-1-alistair@alistair23.me> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Signed-off-by: Alistair Francis Acked-by: Rob Herring Cc: devicetree@vger.kernel.org --- Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/devicetree/bindings/vendor-prefixes.yaml b/Documentation/devicetree/bindings/vendor-prefixes.yaml index 07fb0d25fc15..71da86e7b3a2 100644 --- a/Documentation/devicetree/bindings/vendor-prefixes.yaml +++ b/Documentation/devicetree/bindings/vendor-prefixes.yaml @@ -1250,6 +1250,8 @@ patternProperties: description: Vision Optical Technology Co., Ltd. "^vxt,.*": description: VXT Ltd + "^wacom,.*": + description: Wacom Co., Ltd "^wand,.*": description: Wandbord (Technexion) "^waveshare,.*": From patchwork Tue Aug 3 08:48:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair X-Patchwork-Id: 491109 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AB696C4338F for ; Tue, 3 Aug 2021 08:49:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 97EEF61029 for ; Tue, 3 Aug 2021 08:49:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234760AbhHCIte (ORCPT ); Tue, 3 Aug 2021 04:49:34 -0400 Received: from new4-smtp.messagingengine.com ([66.111.4.230]:52235 "EHLO new4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234622AbhHCItd (ORCPT ); Tue, 3 Aug 2021 04:49:33 -0400 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailnew.nyi.internal (Postfix) with ESMTP id E08D65809FE; Tue, 3 Aug 2021 04:49:20 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Tue, 03 Aug 2021 04:49:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alistair23.me; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm1; bh=PKUtGSy8iZDEY lpTbw2VI9ddzDZdqrWO9usf566B1Ng=; b=T0svpK/Hftb2aU/J3aQiwbMPEE36/ 7kfZVWEvFFU3S4vIuMD5Y9WFDMYlpOPYXxG+x1NY0PQS3WtlxFD1ouqtoffI6YYc 30xpGtRp2YbcGDsCRAiu+mtueYumMO/Wtg+RxYkhlF4pAkq1IGgn3/oLnhXoOILL Q66m/3iuUlRC4FkfoLztxNxo9E3aM2LgtVM3DsfW4xYg3XgqfJykpEOe9Ci6TMUG eBrCcx1VJTApxaWLjZ+SOlml+p3tuyn5KFLoA0udk65r0uTkTGiY0QDoa/QuhjOD 6eRLFEcxm+oHwgp45T6Mtv4RsWyhirW9V4+A9hOvtHVetRXpgaRuXsL3g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=PKUtGSy8iZDEYlpTbw2VI9ddzDZdqrWO9usf566B1Ng=; b=BbSBcnuE dyUHrc1CoDFauqrHWqPaMD6G3YoHkSgaMwkXnYHi0Uy/isfCXWqBn1umfEEiuUrC D11LrWABJ3UCJQdYyKy6/lsN24oVnh120TOMmkKFRFfphYVoHEL/URGMozwfRmm3 PgODCtAqLhTextMe/JWzPO9E+MwFtOPXQS2l2iEy9A3TPSKCfpJ59Atky3SB4dsT eydqJHGf2hgKIUcgUvX1pGjRwHUUZLjIM3QRFSTggbxr29BYU1tn3/b/BHmTn+53 yUu3Esf+wMcG4p5HEiZINzucgF2MuoiyLnVIMZLomFg/Z6zb4ftKaZdCHBYAROSy Xy+t+0PIdQZXYA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrieeggddtiecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtkeertd ertddtnecuhfhrohhmpeetlhhishhtrghirhcuhfhrrghntghishcuoegrlhhishhtrghi rhesrghlihhsthgrihhrvdefrdhmvgeqnecuggftrfgrthhtvghrnhepgeegtdetjeekge eguefgheeuvedugedvteejveeiudegvddtkeffkeehtdetudfhnecuvehluhhsthgvrhfu ihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprghlihhsthgrihhrsegrlhhish htrghirhdvfedrmhgv X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 3 Aug 2021 04:49:16 -0400 (EDT) From: Alistair Francis To: dmitry.torokhov@gmail.com, linux-input@vger.kernel.org, linux-imx@nxp.com, kernel@pengutronix.de, pinglinux@gmail.com, tatsunosuke.tobita@wacom.com, junkpainting@gmail.com, ping.cheng@wacom.com Cc: linux-kernel@vger.kernel.org, alistair23@gmail.com, robh+dt@kernel.org, devicetree@vger.kernel.org, Alistair Francis Subject: [PATCH v8 3/9] Input: wacom_i2c - Add device tree support to wacom_i2c Date: Tue, 3 Aug 2021 18:48:56 +1000 Message-Id: <20210803084902.336-3-alistair@alistair23.me> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210803084902.336-1-alistair@alistair23.me> References: <20210803084902.336-1-alistair@alistair23.me> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Allow the wacom-i2c device to be exposed via device tree. Signed-off-by: Alistair Francis --- drivers/input/touchscreen/wacom_i2c.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/input/touchscreen/wacom_i2c.c b/drivers/input/touchscreen/wacom_i2c.c index 22826c387da5..6053595f2b30 100644 --- a/drivers/input/touchscreen/wacom_i2c.c +++ b/drivers/input/touchscreen/wacom_i2c.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #define WACOM_CMD_QUERY0 0x04 @@ -241,10 +242,17 @@ static const struct i2c_device_id wacom_i2c_id[] = { }; MODULE_DEVICE_TABLE(i2c, wacom_i2c_id); +static const struct of_device_id wacom_i2c_of_match_table[] = { + { .compatible = "wacom,i2c-30" }, + {} +}; +MODULE_DEVICE_TABLE(of, wacom_i2c_of_match_table); + static struct i2c_driver wacom_i2c_driver = { .driver = { .name = "wacom_i2c", .pm = &wacom_i2c_pm, + .of_match_table = wacom_i2c_of_match_table, }, .probe = wacom_i2c_probe, From patchwork Tue Aug 3 08:48:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair X-Patchwork-Id: 491108 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 594D3C4320A for ; Tue, 3 Aug 2021 08:49:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4680A6104F for ; Tue, 3 Aug 2021 08:49:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234833AbhHCItm (ORCPT ); Tue, 3 Aug 2021 04:49:42 -0400 Received: from new4-smtp.messagingengine.com ([66.111.4.230]:43351 "EHLO new4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234831AbhHCItl (ORCPT ); Tue, 3 Aug 2021 04:49:41 -0400 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailnew.nyi.internal (Postfix) with ESMTP id 6CEC4580A6F; Tue, 3 Aug 2021 04:49:30 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Tue, 03 Aug 2021 04:49:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alistair23.me; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm1; bh=jLYfQBxc5Fss5 wHk6K78mpbcM1U0H/2OtEIpp1nXFxo=; b=KoUaDUdq0JGBRJfCaLpRGFYCR1vHK pECWLeVRHGjYQtdWLREJQBJ0SvKFF2zP5OuHbLu1HI+mZ5dMcbPEYo6oZM0Wy0DD FJopDVRO1JnHMyf6aPANXDRKrwr0tnYCnkyi3UvFdVFoWIQGjWM3h3rwttia062/ 1nFvC30ov6NZZpitt2TMZ6HV/RYA5OrQo/alCp82faCHnHU0JejSYECJ2gnPtOo+ fKtRrRre923/u3mV4VV3EZZL+E6+MnHusnaPcqc8ozpPn2+Hp5ZZTJrs3rUeX5nJ NdvvZasj3AGvEOjk/ou4LEujhTgHIk7HRwKFYG1YS7sJXzs+g+5peHalg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=jLYfQBxc5Fss5wHk6K78mpbcM1U0H/2OtEIpp1nXFxo=; b=awA5LDpp 6I3/0FfGrxZ+1Q7Rta4IbB9mTnzP2WD8oWDVxhfWQrfytADuilwTtSkjo9uALLna PI3hF82+OzT0kUjo/1OTj8cLFFLzUpyE8aidLz8v1pkclK7WCDT9Rm2HsKYXNTvb U6fKlRVVG/UJLLZhKoczH7eM8deOMP9CxHEjaMWJTovEGZ2gjSzfVgKis9cQdR4L UgWox0644+f5picRyFkx7r3e5Spjr8DR5893t+UcgHHNnFigpOHgnCzBqb+dvsiV GBy4csxR3tGFk7/iTjMp5tJ39dXx9IjUAHPizWn8Lw9vX2NNGiKhsVd5qT7N9Anw o1Fg7aGfmPDotw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrieeggddtiecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtkeertd ertddtnecuhfhrohhmpeetlhhishhtrghirhcuhfhrrghntghishcuoegrlhhishhtrghi rhesrghlihhsthgrihhrvdefrdhmvgeqnecuggftrfgrthhtvghrnhepgeegtdetjeekge eguefgheeuvedugedvteejveeiudegvddtkeffkeehtdetudfhnecuvehluhhsthgvrhfu ihiivgepudenucfrrghrrghmpehmrghilhhfrhhomheprghlihhsthgrihhrsegrlhhish htrghirhdvfedrmhgv X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 3 Aug 2021 04:49:26 -0400 (EDT) From: Alistair Francis To: dmitry.torokhov@gmail.com, linux-input@vger.kernel.org, linux-imx@nxp.com, kernel@pengutronix.de, pinglinux@gmail.com, tatsunosuke.tobita@wacom.com, junkpainting@gmail.com, ping.cheng@wacom.com Cc: linux-kernel@vger.kernel.org, alistair23@gmail.com, robh+dt@kernel.org, devicetree@vger.kernel.org, Alistair Francis Subject: [PATCH v8 5/9] Input: wacom_i2c - Add support for distance and tilt x/y Date: Tue, 3 Aug 2021 18:48:58 +1000 Message-Id: <20210803084902.336-5-alistair@alistair23.me> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210803084902.336-1-alistair@alistair23.me> References: <20210803084902.336-1-alistair@alistair23.me> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org This is based on the out of tree rM2 driver. Signed-off-by: Alistair Francis --- drivers/input/touchscreen/wacom_i2c.c | 34 +++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/drivers/input/touchscreen/wacom_i2c.c b/drivers/input/touchscreen/wacom_i2c.c index b47bc08efdd1..e2449a4fa2e3 100644 --- a/drivers/input/touchscreen/wacom_i2c.c +++ b/drivers/input/touchscreen/wacom_i2c.c @@ -22,12 +22,18 @@ #define WACOM_CMD_QUERY3 0x02 #define WACOM_CMD_THROW0 0x05 #define WACOM_CMD_THROW1 0x00 -#define WACOM_QUERY_SIZE 19 +#define WACOM_QUERY_SIZE 22 + +#define WACOM_DISTANCE_TILT_VERSION 0x30 struct wacom_features { int x_max; int y_max; int pressure_max; + int distance_max; + int distance_physical_max; + int tilt_x_max; + int tilt_y_max; char fw_version; }; @@ -80,6 +86,17 @@ static int wacom_query_device(struct i2c_client *client, features->y_max = get_unaligned_le16(&data[5]); features->pressure_max = get_unaligned_le16(&data[11]); features->fw_version = get_unaligned_le16(&data[13]); + if (features->fw_version >= WACOM_DISTANCE_TILT_VERSION) { + features->distance_max = data[15]; + features->distance_physical_max = data[16]; + features->tilt_x_max = get_unaligned_le16(&data[17]); + features->tilt_y_max = get_unaligned_le16(&data[19]); + } else { + features->distance_max = -1; + features->distance_physical_max = -1; + features->tilt_x_max = -1; + features->tilt_y_max = -1; + } dev_dbg(&client->dev, "x_max:%d, y_max:%d, pressure:%d, fw:%d\n", @@ -97,6 +114,7 @@ static irqreturn_t wacom_i2c_irq(int irq, void *dev_id) u8 *data = wac_i2c->data; unsigned int x, y, pressure; unsigned char tsw, f1, f2, ers; + short tilt_x, tilt_y, distance; int error; error = i2c_master_recv(wac_i2c->client, @@ -111,6 +129,11 @@ static irqreturn_t wacom_i2c_irq(int irq, void *dev_id) x = le16_to_cpup((__le16 *)&data[4]); y = le16_to_cpup((__le16 *)&data[6]); pressure = le16_to_cpup((__le16 *)&data[8]); + distance = data[10]; + + /* Signed */ + tilt_x = le16_to_cpup((__le16 *)&data[11]); + tilt_y = le16_to_cpup((__le16 *)&data[13]); if (!wac_i2c->prox) wac_i2c->tool = (data[3] & 0x0c) ? @@ -125,6 +148,9 @@ static irqreturn_t wacom_i2c_irq(int irq, void *dev_id) input_report_key(input, BTN_STYLUS, f1); input_report_key(input, BTN_STYLUS2, f2); input_report_abs(input, ABS_PRESSURE, pressure); + input_report_abs(input, ABS_DISTANCE, distance); + input_report_abs(input, ABS_TILT_X, tilt_x); + input_report_abs(input, ABS_TILT_Y, tilt_y); input_sync(input); out: @@ -200,7 +226,11 @@ static int wacom_i2c_probe(struct i2c_client *client, input_set_abs_params(input, ABS_Y, 0, features->y_max, 0, 0); input_set_abs_params(input, ABS_PRESSURE, 0, features->pressure_max, 0, 0); - + input_set_abs_params(input, ABS_DISTANCE, 0, features->distance_max, 0, 0); + input_set_abs_params(input, ABS_TILT_X, -features->tilt_x_max, + features->tilt_x_max, 0, 0); + input_set_abs_params(input, ABS_TILT_Y, -features->tilt_y_max, + features->tilt_y_max, 0, 0); input_set_drvdata(input, wac_i2c); error = devm_request_threaded_irq(dev, client->irq, NULL, wacom_i2c_irq, From patchwork Tue Aug 3 08:49:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair X-Patchwork-Id: 491107 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 03178C4320A for ; Tue, 3 Aug 2021 08:49:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E09F36104F for ; Tue, 3 Aug 2021 08:49:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234827AbhHCItw (ORCPT ); Tue, 3 Aug 2021 04:49:52 -0400 Received: from new4-smtp.messagingengine.com ([66.111.4.230]:42519 "EHLO new4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234866AbhHCItv (ORCPT ); Tue, 3 Aug 2021 04:49:51 -0400 Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailnew.nyi.internal (Postfix) with ESMTP id 0C3065809FE; Tue, 3 Aug 2021 04:49:40 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Tue, 03 Aug 2021 04:49:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alistair23.me; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm1; bh=gJSZFhKVP4HKE Mu49hVwBOwgPgn/uZOPWaLARXY00kE=; b=KzgbTPr3fywsrseIj9nRceS7V7xQV bzRppA5eueRyL7f/hlCdUZfQ61iETZJffDpzRATcxxHGQzpZ8GYavNrUOml/ijzA rkUOYCyZhDEXED6FwHtG8ZFB52WSMrTXSFr4pIQYd9AoHIzN/QOdRz8j0LVpZSMV w5j2Vq+menNA0VdPco/O9GLD3S5y8Whn5U9K7EqJ0V0JUQ2/m5OSIKRZ/qfx4rgW XoIXMkVWfNfB/Jn1Oy3IqW/2BWFwCltYUObfUeknlSfzSKQVaVSelrAzdNmhVT03 00x/7aeNp34VO6h9QuWSx7dyKYLa1w+mfVX2byMc+/Xl/s2BM8SqrAqCQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=gJSZFhKVP4HKEMu49hVwBOwgPgn/uZOPWaLARXY00kE=; b=EqW95L1f MImTkOFAbyMFJn8lSQKdr1zWlaHhlvxndLEJJgFsnxiQz/LwXctwkN8poo7EH4zh /8pV5mx/nvYpYD25qTQrgYB+4Qg1YG3m7WzbSPINnqm63QQOSwNYEDuhR2hqdvEZ lJ9R9wpCrzNYYMwrj4q0uzcoS7z1ySbDuuZtJjQPlwAEBo+SYLFzYwyLedKUhLnw sj4k51FsQuBWK96ErEO4pKGmvChEAENwoyhvjjFP1eDOqyx8Qf1bC9bto8LgphSH 1OT+2tzOdN++0AOq99KE7YxzRjW4sIqdN14HBaZmrcHuC6EkdOWveS2os67ecuyV iRlXvhnH0Hf7dg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrieeggddtiecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtkeertd ertddtnecuhfhrohhmpeetlhhishhtrghirhcuhfhrrghntghishcuoegrlhhishhtrghi rhesrghlihhsthgrihhrvdefrdhmvgeqnecuggftrfgrthhtvghrnhepgeegtdetjeekge eguefgheeuvedugedvteejveeiudegvddtkeffkeehtdetudfhnecuvehluhhsthgvrhfu ihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprghlihhsthgrihhrsegrlhhish htrghirhdvfedrmhgv X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 3 Aug 2021 04:49:35 -0400 (EDT) From: Alistair Francis To: dmitry.torokhov@gmail.com, linux-input@vger.kernel.org, linux-imx@nxp.com, kernel@pengutronix.de, pinglinux@gmail.com, tatsunosuke.tobita@wacom.com, junkpainting@gmail.com, ping.cheng@wacom.com Cc: linux-kernel@vger.kernel.org, alistair23@gmail.com, robh+dt@kernel.org, devicetree@vger.kernel.org, Alistair Francis Subject: [PATCH v8 7/9] Input: wacom_i2c - Add support for vdd regulator Date: Tue, 3 Aug 2021 18:49:00 +1000 Message-Id: <20210803084902.336-7-alistair@alistair23.me> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210803084902.336-1-alistair@alistair23.me> References: <20210803084902.336-1-alistair@alistair23.me> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Add support for a VDD regulator. This allows the kernel to prove the Wacom-I2C device on the rM2. Signed-off-by: Alistair Francis --- drivers/input/touchscreen/wacom_i2c.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/drivers/input/touchscreen/wacom_i2c.c b/drivers/input/touchscreen/wacom_i2c.c index 49d1c15e623c..df77b17835e4 100644 --- a/drivers/input/touchscreen/wacom_i2c.c +++ b/drivers/input/touchscreen/wacom_i2c.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -59,6 +60,7 @@ struct wacom_i2c { struct input_dev *input; struct touchscreen_properties props; struct wacom_features features; + struct regulator *vdd; u8 data[WACOM_QUERY_SIZE]; bool prox; int tool; @@ -222,11 +224,24 @@ static int wacom_i2c_probe(struct i2c_client *client, if (error) return error; + wac_i2c->vdd = regulator_get(&client->dev, "vdd"); + if (IS_ERR(wac_i2c->vdd)) + return PTR_ERR(wac_i2c->vdd); + + error = regulator_enable(wac_i2c->vdd); + if (error) { + regulator_put(wac_i2c->vdd); + return error; + } + wac_i2c->client = client; input = devm_input_allocate_device(dev); - if (!input) + if (!input) { + regulator_disable(wac_i2c->vdd); + regulator_put(wac_i2c->vdd); return -ENOMEM; + } wac_i2c->input = input; @@ -261,6 +276,8 @@ static int wacom_i2c_probe(struct i2c_client *client, IRQF_ONESHOT, "wacom_i2c", wac_i2c); if (error) { dev_err(dev, "Failed to request IRQ: %d\n", error); + regulator_disable(wac_i2c->vdd); + regulator_put(wac_i2c->vdd); return error; } @@ -270,6 +287,8 @@ static int wacom_i2c_probe(struct i2c_client *client, error = input_register_device(wac_i2c->input); if (error) { dev_err(dev, "Failed to register input device: %d\n", error); + regulator_disable(wac_i2c->vdd); + regulator_put(wac_i2c->vdd); return error; } From patchwork Tue Aug 3 08:49:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair X-Patchwork-Id: 491106 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E2F31C4338F for ; Tue, 3 Aug 2021 08:49:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CCBAB6104F for ; Tue, 3 Aug 2021 08:49:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234869AbhHCIuC (ORCPT ); Tue, 3 Aug 2021 04:50:02 -0400 Received: from new4-smtp.messagingengine.com ([66.111.4.230]:50123 "EHLO new4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234784AbhHCIuA (ORCPT ); Tue, 3 Aug 2021 04:50:00 -0400 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailnew.nyi.internal (Postfix) with ESMTP id 46A615809FE; Tue, 3 Aug 2021 04:49:49 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Tue, 03 Aug 2021 04:49:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alistair23.me; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm1; bh=aTJFKJHurQDp2 WDR9JQ4KJfW6/cQqFXs3yKB0BYzJAY=; b=iZIxinplCmIp6MJ3epKnC2SgWTFaX pXrVWsF5fucYfIZg742gvITmCtSwY00ne7a8r3KfySj4ryvgusCUsb4MPEYBikYF HUS7PN3KaJNn5avYjNNip3wS0444IV0o9SX1nUn4NKeNxmiv/QnQcODnXZjmGAyq 3BhPxMbNlSWLPc0FMCpaGOJrVflw2dj0/uu0J1tVWVwCzUdcH60T5ZVgUdXLvj65 mDBCmS91b83YJfvULrOTSY0v45ny/5PE1IhChFweNdL35+d5FLnv06SLCvAuaP9D XcFUS3HkVm7vhutcI4nZvXAlEEZ40h9iHfF5wj/leajvY1p6yxhBzQBlA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=aTJFKJHurQDp2WDR9JQ4KJfW6/cQqFXs3yKB0BYzJAY=; b=FxUlhqG+ /DnSYzxh26JrrPEkvvkK/F1sjHBcLVPxq2DCTifi8OvzkCDBLWO0jDyvxpA6NmLV WN3dSBB8UZo79bQ7j4Tz1Z9I4dsdybPeIfEatFa9EXLvZ98vGs4krwS/VsPE6o4x Hol3c153qFSj8TdNiri+MIJjjqXWBB/AxV6ALPi6lHsyS8YvcfVg1hYM9j2/9FGE RpzQl6qEG4b0tKhNliJyT1aLUrVws1qa1YORPvfo3MolgUhzGG7CtGcdKFj5VQQc VnhbHBahK3dle10nYrUsX7VeSVN3ONhoGnty+hHY5aGQg+kgihXJLdVzEakIaecy 7qGX/CkfFQ9YNw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrieeggddtjecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtkeertd ertddtnecuhfhrohhmpeetlhhishhtrghirhcuhfhrrghntghishcuoegrlhhishhtrghi rhesrghlihhsthgrihhrvdefrdhmvgeqnecuggftrfgrthhtvghrnhepgeegtdetjeekge eguefgheeuvedugedvteejveeiudegvddtkeffkeehtdetudfhnecuvehluhhsthgvrhfu ihiivgepudenucfrrghrrghmpehmrghilhhfrhhomheprghlihhsthgrihhrsegrlhhish htrghirhdvfedrmhgv X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 3 Aug 2021 04:49:45 -0400 (EDT) From: Alistair Francis To: dmitry.torokhov@gmail.com, linux-input@vger.kernel.org, linux-imx@nxp.com, kernel@pengutronix.de, pinglinux@gmail.com, tatsunosuke.tobita@wacom.com, junkpainting@gmail.com, ping.cheng@wacom.com Cc: linux-kernel@vger.kernel.org, alistair23@gmail.com, robh+dt@kernel.org, devicetree@vger.kernel.org, Alistair Francis Subject: [PATCH v8 9/9] ARM: dts: imx7d: remarkable2: add wacom digitizer device Date: Tue, 3 Aug 2021 18:49:02 +1000 Message-Id: <20210803084902.336-9-alistair@alistair23.me> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210803084902.336-1-alistair@alistair23.me> References: <20210803084902.336-1-alistair@alistair23.me> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Enable the wacom_i2c touchscreen for the reMarkable2. Signed-off-by: Alistair Francis --- arch/arm/boot/dts/imx7d-remarkable2.dts | 61 +++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/arch/arm/boot/dts/imx7d-remarkable2.dts b/arch/arm/boot/dts/imx7d-remarkable2.dts index 89cbf13097a4..cc33b53ae6ba 100644 --- a/arch/arm/boot/dts/imx7d-remarkable2.dts +++ b/arch/arm/boot/dts/imx7d-remarkable2.dts @@ -34,6 +34,19 @@ reg_brcm: regulator-brcm { startup-delay-us = <150>; }; + reg_digitizer: regulator-digitizer { + compatible = "regulator-fixed"; + regulator-name = "VDD_3V3_DIGITIZER"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + pinctrl-names = "default", "sleep"; + pinctrl-0 = <&pinctrl_digitizer_reg>; + pinctrl-1 = <&pinctrl_digitizer_reg>; + gpio = <&gpio1 6 GPIO_ACTIVE_HIGH>; + enable-active-high; + startup-delay-us = <100000>; /* 100 ms */ + }; + wifi_pwrseq: wifi_pwrseq { compatible = "mmc-pwrseq-simple"; pinctrl-names = "default"; @@ -51,6 +64,28 @@ &clks { assigned-clock-rates = <0>, <32768>; }; +&i2c1 { + clock-frequency = <400000>; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_i2c1>; + status = "okay"; + + wacom_digitizer: digitizer@9 { + compatible = "wacom,i2c-30"; + reg = <0x09>; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_wacom>; + interrupt-parent = <&gpio1>; + interrupts = <1 IRQ_TYPE_EDGE_FALLING>; + flip-tilt-x; + flip-tilt-y; + flip-pos-x; + flip-pos-y; + flip-distance; + vdd-supply = <®_digitizer>; + }; +}; + &snvs_pwrkey { status = "okay"; }; @@ -117,6 +152,25 @@ &wdog1 { fsl,ext-reset-output; }; +&iomuxc_lpsr { + pinctrl_digitizer_reg: digitizerreggrp { + fsl,pins = < + /* DIGITIZER_PWR_EN */ + MX7D_PAD_LPSR_GPIO1_IO06__GPIO1_IO6 0x14 + >; + }; + + pinctrl_wacom: wacomgrp { + fsl,pins = < + /*MX7D_PAD_LPSR_GPIO1_IO05__GPIO1_IO5 0x00000014 /* FWE */ + MX7D_PAD_LPSR_GPIO1_IO04__GPIO1_IO4 0x00000074 /* PDCTB */ + MX7D_PAD_LPSR_GPIO1_IO01__GPIO1_IO1 0x00000034 /* WACOM INT */ + /*MX7D_PAD_LPSR_GPIO1_IO06__GPIO1_IO6 0x00000014 /* WACOM PWR ENABLE */ + /*MX7D_PAD_LPSR_GPIO1_IO00__GPIO1_IO0 0x00000074 /* WACOM RESET */ + >; + }; +}; + &iomuxc { pinctrl_brcm_reg: brcmreggrp { fsl,pins = < @@ -125,6 +179,13 @@ MX7D_PAD_SAI1_TX_BCLK__GPIO6_IO13 0x14 >; }; + pinctrl_i2c1: i2c1grp { + fsl,pins = < + MX7D_PAD_I2C1_SDA__I2C1_SDA 0x4000007f + MX7D_PAD_I2C1_SCL__I2C1_SCL 0x4000007f + >; + }; + pinctrl_uart1: uart1grp { fsl,pins = < MX7D_PAD_UART1_TX_DATA__UART1_DCE_TX 0x79