From patchwork Sun Aug 29 09:19:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 12463801 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 01795C4320E for ; Sun, 29 Aug 2021 09:19:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CF99860F38 for ; Sun, 29 Aug 2021 09:19:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234905AbhH2JUh (ORCPT ); Sun, 29 Aug 2021 05:20:37 -0400 Received: from new4-smtp.messagingengine.com ([66.111.4.230]:45769 "EHLO new4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234584AbhH2JUh (ORCPT ); Sun, 29 Aug 2021 05:20:37 -0400 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailnew.nyi.internal (Postfix) with ESMTP id 4C540580B0E; Sun, 29 Aug 2021 05:19:45 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Sun, 29 Aug 2021 05:19:45 -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=fm2; bh=32Umrmr7bVOCf HszrT7/dKCGNVfpwUR3PiX2IsuXkD0=; b=oKaIEvcX/D5L7ukZRUGEqzIiG2K1G CdMHbFlteAvUYrPh3J9v2YyP4yF/uLRpU0h+/vgVpM28v9R8zqJGz2SmpxSOP5sC T9+V1h3mJBoNfLWvNqmAX7JPDifpGZH3TdUVV4gv+LvtodMgD4Mq+6YnB2eUSqmR +FrAIy9op3F9+afVz8Tv9qa5zDSeUUbSqtxEcYq0YeUcv0oeEors08LUv1QzCcT5 GCAibOLd45MAP2ygSCmCqHg/xaLA3h3p9Iotcw8UsAGMaOurxpFPEujhAPjGqRl4 UDVGroQtIL2OXP7bKvuEIEtmpYoCOyYtzgP2ZQVSmVOdCHt1JlmQpdWUA== 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=32Umrmr7bVOCfHszrT7/dKCGNVfpwUR3PiX2IsuXkD0=; b=LVjX/cRm VoOH29x6JCD82rcSBG5VL/PC5XwpvLoqMMNlnReD0efW3vsiez3ae+yMHDXkjSUt RxcPmANMBBQPREbAVOWsJQPlcO8ClfepJZ3SGJbvh1Ad4owFr5wjkLBOpyY0Azf5 bl5PKsZmJbRm3t69usmoyVIHO1+bQ9JcIR9vzzihv33hOi6lvSjmumVOERESp/iD mS7JE+RKv8vqjbizHqdhOcfgv7JIt5pkhCT1I/0Opt48pdGNWaiG8dIuMU8mY8hx BQxl5AH8HXWojF0n+Gho5gb9E70z2lPAidGVNedSNZD6YAB/ta/4TDnH75ztMhd/ w7GfkKZCZ52dHQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddruddujedgudefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeetlhhishht rghirhcuhfhrrghntghishcuoegrlhhishhtrghirhesrghlihhsthgrihhrvdefrdhmvg eqnecuggftrfgrthhtvghrnhepgeegtdetjeekgeeguefgheeuvedugedvteejveeiudeg vddtkeffkeehtdetudfhnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrg hilhhfrhhomheprghlihhsthgrihhrsegrlhhishhtrghirhdvfedrmhgv X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 29 Aug 2021 05:19:40 -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 v10 01/12] dt-bindings: Add Wacom to vendor bindings Date: Sun, 29 Aug 2021 19:19:13 +1000 Message-Id: <20210829091925.190-2-alistair@alistair23.me> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210829091925.190-1-alistair@alistair23.me> References: <20210829091925.190-1-alistair@alistair23.me> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@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 4dfaae537daf..31745c45dd92 100644 --- a/Documentation/devicetree/bindings/vendor-prefixes.yaml +++ b/Documentation/devicetree/bindings/vendor-prefixes.yaml @@ -1252,6 +1252,8 @@ patternProperties: description: Vision Optical Technology Co., Ltd. "^vxt,.*": description: VXT Ltd + "^wacom,.*": + description: Wacom Co., Ltd "^wand,.*": description: Wandbord (Technexion) "^waveshare,.*": From patchwork Sun Aug 29 09:19:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 12463805 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 2D955C4320E for ; Sun, 29 Aug 2021 09:19:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1507560F51 for ; Sun, 29 Aug 2021 09:19:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234944AbhH2JUs (ORCPT ); Sun, 29 Aug 2021 05:20:48 -0400 Received: from new4-smtp.messagingengine.com ([66.111.4.230]:52793 "EHLO new4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234922AbhH2JUr (ORCPT ); Sun, 29 Aug 2021 05:20:47 -0400 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailnew.nyi.internal (Postfix) with ESMTP id BFE61580B0B; Sun, 29 Aug 2021 05:19:55 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Sun, 29 Aug 2021 05:19:55 -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=fm2; bh=DvmjdCZONqMiz RnpwfTpRqqlbDgDApz/FK5y2XJHk4w=; b=zpw12bevIa+Q+8rgj9ddnfivb/GcA tkc6tON0xoLmdeTQk/VZK0jTCvOr6MZxFRc7Ee37203NLUFHS4MItfiqA4WFYJPh LoAnB3JG4K88SxQVof1YSNm65KBjFJNgPvMQXVOkFUILr87rJug11+bGsf6XIf/0 ADnYcqtt8LyfKo8Bc8xz3yLyRkrK81Ai5OVKO54ZhmogHhe6OzMs86UxuXr5HJJ/ 5PnPYWCddCNIWSORsK9YvO1wkmUXi4SASk7+NPjkIHIXZ88IbIak8RzZ2Jw66PVT gei9SFqazw57EaEzp45CL27ALTqzVwiujyz3j7WGDwQb2IIINQlMjpcfw== 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=DvmjdCZONqMizRnpwfTpRqqlbDgDApz/FK5y2XJHk4w=; b=BWqh+Xj5 SVr0YAL/nqrw8pNqrAqKu6xWTnB+usN9VmZjAvc54CXHLxgD0zP4MyBtPQN2rRAu v8x/SP/sbW2BDmVU7ZWTDpTK3TAMKLclAfYv7XgJgE6xuWGtFq8s7yaIGuceAEn0 2Nik8muWeiLO7l0b/B/yhJMTyihjIzCI1UIUptjp0bDo9elcJK/qohJit5oBgF/D /gVWJEEY9II4xbmQh4r918UoX/Gyeoq9Mdj2uVqt3lHW4JzfebZa8CJ8+nli05Nb aoI4+V0CnOZ7vfrdUOvP00qae/Bckhh/GFHwIeQjDa9vPpLrW23jUg2Cl3vGnPSR d6L7PFwplMAF6g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddruddujedgudefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeetlhhishht rghirhcuhfhrrghntghishcuoegrlhhishhtrghirhesrghlihhsthgrihhrvdefrdhmvg eqnecuggftrfgrthhtvghrnhepffdthffggefglefgkeejhfekiefgleelfefhtefhheef teelgeeggefgfeffvddtnecuffhomhgrihhnpeguvghvihgtvghtrhgvvgdrohhrghenuc evlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrlhhishht rghirhesrghlihhsthgrihhrvdefrdhmvg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 29 Aug 2021 05:19:51 -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 v10 02/12] dt-bindings: touchscreen: Initial commit of wacom,i2c Date: Sun, 29 Aug 2021 19:19:15 +1000 Message-Id: <20210829091925.190-4-alistair@alistair23.me> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210829091925.190-1-alistair@alistair23.me> References: <20210829091925.190-1-alistair@alistair23.me> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Signed-off-by: Alistair Francis Reviewed-by: Rob Herring Cc: devicetree@vger.kernel.org --- .../input/touchscreen/wacom,generic.yaml | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 Documentation/devicetree/bindings/input/touchscreen/wacom,generic.yaml diff --git a/Documentation/devicetree/bindings/input/touchscreen/wacom,generic.yaml b/Documentation/devicetree/bindings/input/touchscreen/wacom,generic.yaml new file mode 100644 index 000000000000..a8a7f362b0ce --- /dev/null +++ b/Documentation/devicetree/bindings/input/touchscreen/wacom,generic.yaml @@ -0,0 +1,48 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/input/touchscreen/wacom,generic.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Wacom I2C Controller + +maintainers: + - Alistair Francis + +allOf: + - $ref: touchscreen.yaml# + +properties: + compatible: + const: wacom,i2c-30 + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + + vdd-supply: + description: Power Supply + +required: + - compatible + - reg + - interrupts + +unevaluatedProperties: false + +examples: + - | + #include "dt-bindings/interrupt-controller/irq.h" + i2c { + #address-cells = <1>; + #size-cells = <0>; + digitiser@9 { + compatible = "wacom,i2c-30"; + reg = <0x9>; + interrupt-parent = <&gpio1>; + interrupts = <9 IRQ_TYPE_LEVEL_LOW>; + vdd-supply = <®_touch>; + }; + }; From patchwork Sun Aug 29 09:19:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 12463807 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 1F28BC432BE for ; Sun, 29 Aug 2021 09:20:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 056D160F38 for ; Sun, 29 Aug 2021 09:20:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234967AbhH2JUx (ORCPT ); Sun, 29 Aug 2021 05:20:53 -0400 Received: from new4-smtp.messagingengine.com ([66.111.4.230]:44849 "EHLO new4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234922AbhH2JUw (ORCPT ); Sun, 29 Aug 2021 05:20:52 -0400 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailnew.nyi.internal (Postfix) with ESMTP id 9F98B580B0E; Sun, 29 Aug 2021 05:20:00 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Sun, 29 Aug 2021 05:20:00 -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=fm2; bh=PKUtGSy8iZDEY lpTbw2VI9ddzDZdqrWO9usf566B1Ng=; b=IRdhLvUxixmJyrZ0v5fLEOsjuQ69b PkmUUdvKuO45+zYev49jYJKTrk4XahfRkmT5zhELZpExJaQKBHfBpdQjHj5JZpZu iyuRo7GooK0xpUmhP4eSQMQMzvA2Y1MyTA5n37E9SYkAiZMsc/2s/B5nwINna4lz PA2x7XWb3kFQyxdR6aCqrvZRy/zm+hwPF5wXkcGftFQrPZCVcAZdKZaIN2UX5gyd sbou/usqJUAw8o6cv9yg3acTQiEsCeMtxQ6ESfkZh23iRukSuFLfkKIGHSU1+E02 pHZ3rO1+T8DPFHTIvCDxSw01dneMT1994Fy5ctAcTOum50OsQpg5EDpow== 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=jsskgRqS LOqFAceAtEY+Uesj1Xu6D0lQh4cNN9Afv/CyRt3RzgC1SmFxhUef4+7iKRhr2CMR PDDit7/hKuqeXD5VbbGO8fw8DXK6sVO84LarcW1TaoptJzfNce9kGjHyidlPt0Ul dYHCHooiU8BdS1/Cfx0aMeHAGegCCcWynpIkfbceNeh8vMdw6d3XPWb7nOLDiMDd YvZSzC4JPyRHAVdaKylIGCJM7H0wHyjMtS4YV7qHJXOHE5WPkBcx1DCoOtzdOjEd qFBhtx6vZUsOPAgOAZr9Mp5BimDcAXxw0uAUKB6Z71CqLQGz83sM28QBd0pWNn3Z bIRGPPVhSubdPw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddruddujedgudefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgjfhgggfestdekre dtredttdenucfhrhhomheptehlihhsthgrihhrucfhrhgrnhgtihhsuceorghlihhsthgr ihhrsegrlhhishhtrghirhdvfedrmhgvqeenucggtffrrghtthgvrhhnpeeggedtteejke eggeeugfehueevudegvdetjeeviedugedvtdekffekhedtteduhfenucevlhhushhtvghr ufhiiigvpedunecurfgrrhgrmhepmhgrihhlfhhrohhmpegrlhhishhtrghirhesrghlih hsthgrihhrvdefrdhmvg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 29 Aug 2021 05:19:56 -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 v10 03/12] Input: wacom_i2c - Add device tree support to wacom_i2c Date: Sun, 29 Aug 2021 19:19:16 +1000 Message-Id: <20210829091925.190-5-alistair@alistair23.me> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210829091925.190-1-alistair@alistair23.me> References: <20210829091925.190-1-alistair@alistair23.me> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@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 Sun Aug 29 09:19:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 12463809 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 D1126C4320E for ; Sun, 29 Aug 2021 09:20:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B863C60F39 for ; Sun, 29 Aug 2021 09:20:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234901AbhH2JVB (ORCPT ); Sun, 29 Aug 2021 05:21:01 -0400 Received: from new4-smtp.messagingengine.com ([66.111.4.230]:54021 "EHLO new4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234959AbhH2JU5 (ORCPT ); Sun, 29 Aug 2021 05:20:57 -0400 Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailnew.nyi.internal (Postfix) with ESMTP id AF47D580B0E; Sun, 29 Aug 2021 05:20:05 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Sun, 29 Aug 2021 05:20:05 -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=fm2; bh=wDxD148pGxNLo fDiRuvl3Q1zS4b7Jw1CAMW3y7CSj/k=; b=hlAKNQvyWLDNHdhlmUFTWqHBYcGCB A76Hh6kui8L1Jf4dmTkXosdjYVgLB2JBbkfxUjlHa2fO9wvNYJj04BmoyCVUtP41 a3c86Fs3ydy7jwVXJBll41uxhls/DSp/DVer8El42yiyux6fZPNNtY1wuNJxo+1N LPFun28K0n8RCz9YwOIWDdTT7SN6Vr2+s9/TJ1bgRIArc8960MS5MT5jCISqzK6v ZtIRBxooNqc91nPuGHSrwAq4zJvstzXfW0Pt1vXFsQ9j4PneMCtLshzwM+3Immrh 8HSMS0TeZl4z+q13WT3BV2e+De2088NegCSgZlb6cn0w6N0EtxiWHc53g== 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=wDxD148pGxNLofDiRuvl3Q1zS4b7Jw1CAMW3y7CSj/k=; b=oNlxszp2 HbkMqDgKybM+dRY7Ld2OrhL2K8JbBVsvbJXcoeIPkcmBdlZXe5vAojOvISP+wJ2S i6fBqty/763SabfhpiK8h68hu4AR9Zjf/dZVStdev3//2drmUPgZeEcd5QlkpPnz HgiEs6hamkV14GFlQNFGvHMGdHu59TCOKCOpb9AF5ZUDKxdX/SVIX6FwvOfZwAWy PqRI7zY+d49JaS5J21APsWaC/Ae3qoWNrfU9HVnh6Ec20qN8b01FSKeTymKfNtNN rYpYm3Pr6DTDeb4hYg+16ipBSSs+h4HC++7/Zp+QPkFwBm0XBR9h4pJe536Z14iw pxuAMONXcFMV6w== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddruddujedguddvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgjfhgggfestdekre dtredttdenucfhrhhomheptehlihhsthgrihhrucfhrhgrnhgtihhsuceorghlihhsthgr ihhrsegrlhhishhtrghirhdvfedrmhgvqeenucggtffrrghtthgvrhhnpeeggedtteejke eggeeugfehueevudegvdetjeeviedugedvtdekffekhedtteduhfenucevlhhushhtvghr ufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrlhhishhtrghirhesrghlih hsthgrihhrvdefrdhmvg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 29 Aug 2021 05:20:00 -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 v10 04/12] Input: wacom_i2c - Add touchscren properties Date: Sun, 29 Aug 2021 19:19:17 +1000 Message-Id: <20210829091925.190-6-alistair@alistair23.me> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210829091925.190-1-alistair@alistair23.me> References: <20210829091925.190-1-alistair@alistair23.me> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Connect touchscreen properties to the wacom_i2c. Signed-off-by: Alistair Francis --- drivers/input/touchscreen/wacom_i2c.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/drivers/input/touchscreen/wacom_i2c.c b/drivers/input/touchscreen/wacom_i2c.c index 6053595f2b30..28255c77d426 100644 --- a/drivers/input/touchscreen/wacom_i2c.c +++ b/drivers/input/touchscreen/wacom_i2c.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -33,6 +34,8 @@ struct wacom_features { struct wacom_i2c { struct i2c_client *client; struct input_dev *input; + struct touchscreen_properties props; + struct wacom_features features; u8 data[WACOM_QUERY_SIZE]; bool prox; int tool; @@ -90,6 +93,7 @@ static irqreturn_t wacom_i2c_irq(int irq, void *dev_id) { struct wacom_i2c *wac_i2c = dev_id; struct input_dev *input = wac_i2c->input; + struct wacom_features *features = &wac_i2c->features; u8 *data = wac_i2c->data; unsigned int x, y, pressure; unsigned char tsw, f1, f2, ers; @@ -114,6 +118,8 @@ static irqreturn_t wacom_i2c_irq(int irq, void *dev_id) wac_i2c->prox = data[3] & 0x20; + touchscreen_report_pos(input, &wac_i2c->props, features->x_max, + features->y_max, true); input_report_key(input, BTN_TOUCH, tsw || ers); input_report_key(input, wac_i2c->tool, wac_i2c->prox); input_report_key(input, BTN_STYLUS, f1); @@ -151,7 +157,7 @@ static int wacom_i2c_probe(struct i2c_client *client, struct device *dev = &client->dev; struct wacom_i2c *wac_i2c; struct input_dev *input; - struct wacom_features features = { 0 }; + struct wacom_features *features; int error; if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { @@ -159,14 +165,15 @@ static int wacom_i2c_probe(struct i2c_client *client, return -EIO; } - error = wacom_query_device(client, &features); - if (error) - return error; - wac_i2c = devm_kzalloc(dev, sizeof(*wac_i2c), GFP_KERNEL); if (!wac_i2c) return -ENOMEM; + features = &wac_i2c->features; + error = wacom_query_device(client, features); + if (error) + return error; + wac_i2c->client = client; input = devm_input_allocate_device(dev); @@ -178,7 +185,7 @@ static int wacom_i2c_probe(struct i2c_client *client, input->name = "Wacom I2C Digitizer"; input->id.bustype = BUS_I2C; input->id.vendor = 0x56a; - input->id.version = features.fw_version; + input->id.version = features->fw_version; input->open = wacom_i2c_open; input->close = wacom_i2c_close; @@ -190,10 +197,11 @@ static int wacom_i2c_probe(struct i2c_client *client, __set_bit(BTN_STYLUS2, input->keybit); __set_bit(BTN_TOUCH, input->keybit); - input_set_abs_params(input, ABS_X, 0, features.x_max, 0, 0); - input_set_abs_params(input, ABS_Y, 0, features.y_max, 0, 0); + touchscreen_parse_properties(input, true, &wac_i2c->props); + input_set_abs_params(input, ABS_X, 0, features->x_max, 0, 0); + 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); + 0, features->pressure_max, 0, 0); input_set_drvdata(input, wac_i2c); From patchwork Sun Aug 29 09:19:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 12463811 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 CD11CC432BE for ; Sun, 29 Aug 2021 09:20:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B820660F44 for ; Sun, 29 Aug 2021 09:20:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234940AbhH2JVD (ORCPT ); Sun, 29 Aug 2021 05:21:03 -0400 Received: from new4-smtp.messagingengine.com ([66.111.4.230]:45459 "EHLO new4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234990AbhH2JVC (ORCPT ); Sun, 29 Aug 2021 05:21:02 -0400 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailnew.nyi.internal (Postfix) with ESMTP id 5FAAC580B11; Sun, 29 Aug 2021 05:20:10 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Sun, 29 Aug 2021 05:20:10 -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=fm2; bh=00k/cE/VEfTz/ +dQ9yaE8zGdsiZBwAiNjh1K23Pi1yc=; b=1dSzrr5YQgzRyafCzkmNdpZkQJ8wD Pn0Z7M8IFhl5/higyORImVky4GaHqrhYsFOVVXpG/J9aB8K9k2cR4AC3VzIHbuWE dTvLAsD0mFnJL+Wi2wBdfFZBl8lU3DTUak2HOw3Jfn7XFPnQPzo4HekHojXLfjYI r4sQfCmsG/xKzxUOIOtIbs+C7RXzjua1z5xYcnphZfes3G5eNp67o+XSxD6Bd/Rc fvksOTrDdOfaVzk3y7XjKxmOvGykiVLjSgwA4Maiquee+3/tfB1m8EKIZ0Cd7Ero 13XDGzag+rRDrQC+uIzvg5rSBgVO5r+VmkmlJeH8orMBHIx73G4mff6Sw== 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=00k/cE/VEfTz/+dQ9yaE8zGdsiZBwAiNjh1K23Pi1yc=; b=lAcBFIi+ tEugxtw5tamyDhgH/0BOd5n76H+CYWiG8BKzYJXuvvO1vi00WiICoozEKedniPPc D2Id11EX/xdtik+CfiPrfO/+++C+xKYSAe4NvyrmkrXRXr3IARLrn8ud75/kxcyl QgIgcM19b86jZIG6n0P0cSAP+9SL82tkVYtSvqjjnUEZ8L7xFOrbsyyQEM5vmNUZ xrSHClGmXMcT1h1xtNtD+1AW/Sto/m7KIcVHPcEVMfaZy5vHpQBV85ks5YIii8fy G9erClRG6fi3DFhiJhPlxC9GQlm8WDQiaSVisNPk5/QsIh1gEKYhjde1+z1j7YdH O9VvznakMq4SDQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddruddujedgudefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgjfhgggfestdekre dtredttdenucfhrhhomheptehlihhsthgrihhrucfhrhgrnhgtihhsuceorghlihhsthgr ihhrsegrlhhishhtrghirhdvfedrmhgvqeenucggtffrrghtthgvrhhnpeeggedtteejke eggeeugfehueevudegvdetjeeviedugedvtdekffekhedtteduhfenucevlhhushhtvghr ufhiiigvpedvnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrlhhishhtrghirhesrghlih hsthgrihhrvdefrdhmvg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 29 Aug 2021 05:20: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 Subject: [PATCH v10 05/12] Input: wacom_i2c - Read the descriptor values Date: Sun, 29 Aug 2021 19:19:18 +1000 Message-Id: <20210829091925.190-7-alistair@alistair23.me> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210829091925.190-1-alistair@alistair23.me> References: <20210829091925.190-1-alistair@alistair23.me> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org When we query the device let's also read the descriptor from the device. This tells us useful information, including the version, which we use to determine a generation. This is based on the driver from Wacom. Signed-off-by: Alistair Francis --- drivers/input/touchscreen/wacom_i2c.c | 64 +++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/drivers/input/touchscreen/wacom_i2c.c b/drivers/input/touchscreen/wacom_i2c.c index 28255c77d426..72ba4a36459b 100644 --- a/drivers/input/touchscreen/wacom_i2c.c +++ b/drivers/input/touchscreen/wacom_i2c.c @@ -16,6 +16,7 @@ #include #include +#define WACOM_DESC_REG 0x01 #define WACOM_CMD_QUERY0 0x04 #define WACOM_CMD_QUERY1 0x00 #define WACOM_CMD_QUERY2 0x33 @@ -24,11 +25,46 @@ #define WACOM_CMD_THROW1 0x00 #define WACOM_QUERY_SIZE 19 +#define WACOM_MAX_DATA_SIZE_BG9 10 +#define WACOM_MAX_DATA_SIZE_G12 15 +#define WACOM_MAX_DATA_SIZE_AG14 17 +#define WACOM_MAX_DATA_SIZE 22 + +/* Generation selction */ +/* Before and at G9 generation */ +#define WACOM_BG9 0 +/* G12 generation the IC supports "height"*/ +#define WACOM_G12 1 +/* After and at G14 generation the IC supports "height" and + * it is defined as "Z" axis + */ +#define WACOM_AG14 2 + +struct wacom_desc { + u16 descLen; + u16 version; + u16 reportLen; + u16 reportReg; + u16 inputReg; + u16 maxInputLen; + u16 outputReg; + u16 maxOutputLen; + u16 commReg; + u16 dataReg; + u16 vendorID; + u16 productID; + u16 fwVersion; + u16 misc_high; + u16 misc_low; +}; + struct wacom_features { + struct wacom_desc desc; int x_max; int y_max; int pressure_max; char fw_version; + unsigned char generation; }; struct wacom_i2c { @@ -45,6 +81,7 @@ static int wacom_query_device(struct i2c_client *client, struct wacom_features *features) { int ret; + u8 cmd_wac_desc[] = {WACOM_DESC_REG, 0x00}; u8 cmd1[] = { WACOM_CMD_QUERY0, WACOM_CMD_QUERY1, WACOM_CMD_QUERY2, WACOM_CMD_QUERY3 }; u8 cmd2[] = { WACOM_CMD_THROW0, WACOM_CMD_THROW1 }; @@ -70,6 +107,33 @@ static int wacom_query_device(struct i2c_client *client, }, }; + /* Read the description register */ + ret = i2c_master_send(client, cmd_wac_desc, sizeof(cmd_wac_desc)); + if (ret < 0) + return ret; + ret = i2c_master_recv(client, (char *)&features->desc, sizeof(features->desc)); + if (ret < 0) + return ret; + + switch (features->desc.maxInputLen) { + case WACOM_MAX_DATA_SIZE_BG9: + features->generation = WACOM_BG9; + break; + + case WACOM_MAX_DATA_SIZE_G12: + features->generation = WACOM_G12; + break; + + case WACOM_MAX_DATA_SIZE_AG14: + features->generation = WACOM_AG14; + break; + + default: + /* Cover all generations possible */ + features->generation = WACOM_AG14; + break; + } + ret = i2c_transfer(client->adapter, msgs, ARRAY_SIZE(msgs)); if (ret < 0) return ret; From patchwork Sun Aug 29 09:19:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 12463813 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 29986C432BE for ; Sun, 29 Aug 2021 09:20:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0DA29606A5 for ; Sun, 29 Aug 2021 09:20:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235034AbhH2JVN (ORCPT ); Sun, 29 Aug 2021 05:21:13 -0400 Received: from new4-smtp.messagingengine.com ([66.111.4.230]:49109 "EHLO new4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235011AbhH2JVH (ORCPT ); Sun, 29 Aug 2021 05:21:07 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.nyi.internal (Postfix) with ESMTP id 79337580B0E; Sun, 29 Aug 2021 05:20:15 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Sun, 29 Aug 2021 05:20:15 -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=fm2; bh=YL0Ib+4egCDn5 lJr21UYkr+YjUgCaf9QQCpk4lYgxBk=; b=g+iLLn7XL3I2ULYKFjSztrHCnpl5G rIM5AuFZMnDSkpYLi/EnSLXieiXgLU/k0pU2fMxsIqx1B15ZeeFGrjHyM6DYgBt1 w+YvFWC8y9+CMoITy6W/luMxKU5j0DQWja9hE69cyOXnsV+c23KehHSmx0krxx/a wuQONbuPO6sAfEMpyERjUMsv5nzkkbveJ1M0i0+UzkW2QooWGPUFT3WN0cg2dHDl 597cDzaAFe5y0rWuyHVVFtQL9ZSP7sHuIc7T04A1XKON69C7ZRdUetGsu9uYMr4Z /cOCLV2hVnIrifpdVSeLCbBA6qMD96gklxNyTyAkH1Pxg6xYWJdz71CEw== 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=YL0Ib+4egCDn5lJr21UYkr+YjUgCaf9QQCpk4lYgxBk=; b=A/qFCAip DhSFuvKjMMKzTxk1Nssf1QiKwK4BX11P6xR78b1Jn4mFPVPqf98wwaybJPMNh3wV AS14x5KY9Nzivqs2+aVtoqKL+1B4E46fqefKfJavr27q5btm8+o8YORO14SqA5T6 NFe2MysXYgAaiujNe1dkafZMlQnnLoaRL2IFKW5uDF51fB7AflD1z71cU4ZJmSo9 xbJvB0LRudYMK613jBLTAhuNJQeurTr3pf/IPpiCPNND2xIbW9KKa9Ac6AuYbNKM 198Z8xqvkcGeNYHeN4k/kIJleHUOzM7pZvTaBsD9ty39LHw4d18n3vo5XDITcxII jUTb8idJqYmqUQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddruddujedgudefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgjfhgggfestdekre dtredttdenucfhrhhomheptehlihhsthgrihhrucfhrhgrnhgtihhsuceorghlihhsthgr ihhrsegrlhhishhtrghirhdvfedrmhgvqeenucggtffrrghtthgvrhhnpeeggedtteejke eggeeugfehueevudegvdetjeeviedugedvtdekffekhedtteduhfenucevlhhushhtvghr ufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrlhhishhtrghirhesrghlih hsthgrihhrvdefrdhmvg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 29 Aug 2021 05:20:10 -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 v10 06/12] Input: wacom_i2c - Add support for distance and tilt x/y Date: Sun, 29 Aug 2021 19:19:19 +1000 Message-Id: <20210829091925.190-8-alistair@alistair23.me> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210829091925.190-1-alistair@alistair23.me> References: <20210829091925.190-1-alistair@alistair23.me> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Add support for the distance and tilt x/y. This is based on the out of tree rM2 driver. Signed-off-by: Alistair Francis --- drivers/input/touchscreen/wacom_i2c.c | 30 +++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/drivers/input/touchscreen/wacom_i2c.c b/drivers/input/touchscreen/wacom_i2c.c index 72ba4a36459b..d6036406a9f3 100644 --- a/drivers/input/touchscreen/wacom_i2c.c +++ b/drivers/input/touchscreen/wacom_i2c.c @@ -23,7 +23,7 @@ #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_MAX_DATA_SIZE_BG9 10 #define WACOM_MAX_DATA_SIZE_G12 15 @@ -63,6 +63,9 @@ struct wacom_features { int x_max; int y_max; int pressure_max; + int distance_max; + int tilt_x_max; + int tilt_y_max; char fw_version; unsigned char generation; }; @@ -144,6 +147,15 @@ 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->generation) { + features->distance_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->tilt_x_max = -1; + features->tilt_y_max = -1; + } dev_dbg(&client->dev, "x_max:%d, y_max:%d, pressure:%d, fw:%d\n", @@ -161,6 +173,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, @@ -176,6 +189,12 @@ static irqreturn_t wacom_i2c_irq(int irq, void *dev_id) y = le16_to_cpup((__le16 *)&data[6]); pressure = le16_to_cpup((__le16 *)&data[8]); + /* Signed */ + tilt_x = get_unaligned_le16(&data[11]); + tilt_y = get_unaligned_le16(&data[13]); + + distance = get_unaligned_le16(&data[15]); + if (!wac_i2c->prox) wac_i2c->tool = (data[3] & 0x0c) ? BTN_TOOL_RUBBER : BTN_TOOL_PEN; @@ -191,6 +210,9 @@ static irqreturn_t wacom_i2c_irq(int irq, void *dev_id) input_report_abs(input, ABS_X, x); input_report_abs(input, ABS_Y, y); 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: @@ -266,7 +288,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 Sun Aug 29 09:19:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 12463815 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 F186EC43216 for ; Sun, 29 Aug 2021 09:20:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DADC9606A5 for ; Sun, 29 Aug 2021 09:20:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234997AbhH2JVN (ORCPT ); Sun, 29 Aug 2021 05:21:13 -0400 Received: from new4-smtp.messagingengine.com ([66.111.4.230]:56541 "EHLO new4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235025AbhH2JVM (ORCPT ); Sun, 29 Aug 2021 05:21:12 -0400 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailnew.nyi.internal (Postfix) with ESMTP id 3781B580B11; Sun, 29 Aug 2021 05:20:20 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Sun, 29 Aug 2021 05:20: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=fm2; bh=RTgaVDXWoRXRJ wgIVpmycBU/xv+/gC91Z3TySev1IHA=; b=q+6sEqseAb8AOboKlK3XNpo33fJ5C LOjg6QGmywutNfcm2OGIvX1qnX7wMsPZcZMAXaXvBIthoTfvG+z9juHC6klCFBwb /tt08BKvv6kvfznLn9IMUHQ2oQElj1pM1FBi8H0AgZ8f22JPmEQd4ts+L9NBnjPb GuF/lYvUj9koJZv/lMo0y359lHG3NaOiwrJc+i/8wIsQd0dvclT0R51RVoLgfbAt c+u2RFyufcTfh/03Z6be6Zl34+vUJElLtnvjrbs54XFDrUKDjycK9NajfEkTSd1e uVU/lJQugJCQTHin+lU7LGsbNFglENa45BS8n4UMzf3kh0SNjBzFPQLYw== 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=RTgaVDXWoRXRJwgIVpmycBU/xv+/gC91Z3TySev1IHA=; b=X5HoutB3 LMo6ClVeRmbi5KWisdg913k2uaFDjh0dGQqcayK23RNEFikyZV2YpbAWxQd5OmsX oUf19y4rL8JVizKgQ2xxjTQxJmh5/qheOjHQGm3tz8RWKkxpbxuU5YSoWgnfNUrE gAcNpB3cy0wKCkffqACcylNkkXRN+ElpBGcBKJYsevqGgTniTBK3CupIRpkt49Y6 W3xKRO0I0xdaxZ5El/tt1Ci+BAkBAVER0P4DW9xxVkJBwEPF5bTjc1KFqiLnf2jy Cl9RLH1jeAyUzFQ3OQaOua5Vmo+xmVcDTxWdv3wQFY1bpD8qaDgSnTKmVoRliNdh 5GHZ7kx3DQ20Xw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddruddujedguddvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgjfhgggfestdekre dtredttdenucfhrhhomheptehlihhsthgrihhrucfhrhgrnhgtihhsuceorghlihhsthgr ihhrsegrlhhishhtrghirhdvfedrmhgvqeenucggtffrrghtthgvrhhnpeeggedtteejke eggeeugfehueevudegvdetjeeviedugedvtdekffekhedtteduhfenucevlhhushhtvghr ufhiiigvpedunecurfgrrhgrmhepmhgrihhlfhhrohhmpegrlhhishhtrghirhesrghlih hsthgrihhrvdefrdhmvg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 29 Aug 2021 05:20:15 -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 v10 07/12] Input: wacom_i2c - Clean up the query device fields Date: Sun, 29 Aug 2021 19:19:20 +1000 Message-Id: <20210829091925.190-9-alistair@alistair23.me> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210829091925.190-1-alistair@alistair23.me> References: <20210829091925.190-1-alistair@alistair23.me> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Improve the query device fields to be more verbose. Signed-off-by: Alistair Francis --- drivers/input/touchscreen/wacom_i2c.c | 63 ++++++++++++++++++--------- 1 file changed, 43 insertions(+), 20 deletions(-) diff --git a/drivers/input/touchscreen/wacom_i2c.c b/drivers/input/touchscreen/wacom_i2c.c index d6036406a9f3..a35d8fda7e7b 100644 --- a/drivers/input/touchscreen/wacom_i2c.c +++ b/drivers/input/touchscreen/wacom_i2c.c @@ -13,16 +13,33 @@ #include #include #include +#include #include #include +// Registers #define WACOM_DESC_REG 0x01 -#define WACOM_CMD_QUERY0 0x04 -#define WACOM_CMD_QUERY1 0x00 -#define WACOM_CMD_QUERY2 0x33 -#define WACOM_CMD_QUERY3 0x02 -#define WACOM_CMD_THROW0 0x05 -#define WACOM_CMD_THROW1 0x00 +#define WACOM_COMMAND_LSB 0x04 +#define WACOM_COMMAND_MSB 0x00 + +#define WACOM_DATA_LSB 0x05 +#define WACOM_DATA_MSB 0x00 + +// Report types +#define REPORT_FEATURE 0x30 + +// Requests / operations +#define OPCODE_GET_REPORT 0x02 + +// Power settings +#define POWER_ON 0x00 +#define POWER_SLEEP 0x01 + +// Input report ids +#define WACOM_PEN_DATA_REPORT 2 +#define WACOM_SHINONOME_REPORT 26 + +#define WACOM_QUERY_REPORT 3 #define WACOM_QUERY_SIZE 22 #define WACOM_MAX_DATA_SIZE_BG9 10 @@ -85,27 +102,30 @@ static int wacom_query_device(struct i2c_client *client, { int ret; u8 cmd_wac_desc[] = {WACOM_DESC_REG, 0x00}; - u8 cmd1[] = { WACOM_CMD_QUERY0, WACOM_CMD_QUERY1, - WACOM_CMD_QUERY2, WACOM_CMD_QUERY3 }; - u8 cmd2[] = { WACOM_CMD_THROW0, WACOM_CMD_THROW1 }; u8 data[WACOM_QUERY_SIZE]; + + u8 get_query_data_cmd[] = { + WACOM_COMMAND_LSB, + WACOM_COMMAND_MSB, + REPORT_FEATURE | WACOM_QUERY_REPORT, + OPCODE_GET_REPORT, + WACOM_DATA_LSB, + WACOM_DATA_MSB, + }; + struct i2c_msg msgs[] = { + // Request reading of feature ReportID: 3 (Pen Query Data) { .addr = client->addr, .flags = 0, - .len = sizeof(cmd1), - .buf = cmd1, - }, - { - .addr = client->addr, - .flags = 0, - .len = sizeof(cmd2), - .buf = cmd2, + .len = sizeof(get_query_data_cmd), + .buf = get_query_data_cmd, }, + // Read 21 bytes { .addr = client->addr, .flags = I2C_M_RD, - .len = sizeof(data), + .len = WACOM_QUERY_SIZE - 1, .buf = data, }, }; @@ -158,9 +178,12 @@ static int wacom_query_device(struct i2c_client *client, } dev_dbg(&client->dev, - "x_max:%d, y_max:%d, pressure:%d, fw:%d\n", + "x_max:%d, y_max:%d, pressure:%d, fw:%d, " + "distance: %d, tilt_x_max: %d, tilt_y_max: %d\n", features->x_max, features->y_max, - features->pressure_max, features->fw_version); + features->pressure_max, features->fw_version, + features->distance_max, + features->tilt_x_max, features->tilt_y_max); return 0; } From patchwork Sun Aug 29 09:19:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 12463817 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 35AACC43214 for ; Sun, 29 Aug 2021 09:20:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1EBEF60F42 for ; Sun, 29 Aug 2021 09:20:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235004AbhH2JVS (ORCPT ); Sun, 29 Aug 2021 05:21:18 -0400 Received: from new4-smtp.messagingengine.com ([66.111.4.230]:49883 "EHLO new4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235037AbhH2JVQ (ORCPT ); Sun, 29 Aug 2021 05:21:16 -0400 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailnew.nyi.internal (Postfix) with ESMTP id B1BAD580B14; Sun, 29 Aug 2021 05:20:24 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Sun, 29 Aug 2021 05:20:24 -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=fm2; bh=j08Pns4+NlfOm WdwOrXi5G1T1B1NXvmyECCHk9+fUro=; b=c07KQcnVosDVNiPrwsc+ezXMzW0oy fX0nJ3+hOSM1kKJFgQtEdn81R4QuWHKJGCEC436+3Gkm6T+81+SAJ8W71i1OBD0F wvyo9G59hgA1lYG8pOJb+3vwVtV3LUrhhZBXAJ3kPaAa8zsrXbiwpxjJWokmGiV8 E1HnUg/NTzLJpR8HfcnGBadJYM9U6vtLdtplNwvjUvZhsHjM3zCYsK+KZ2slH3Ar 0JcfHB8jJ1NmX97KzG8PAB7fbhYCc/EDKBwnIQjTzrUaD7tN+BIwx5YR+kJeLp+i NufoFtv13rBsGaiQTXKznyUdOpOP+FwN586UNm/BcGU9bM8VGKTS6B09g== 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=j08Pns4+NlfOmWdwOrXi5G1T1B1NXvmyECCHk9+fUro=; b=q5670IIO qyZ9XHNQMYVV4NfMcatRP7NS4SMaMxKJvhQGoJ1x4dZhzcZjWaF8FSX89pOdjDb7 gs4Y30Q7Tf5iBrWio9YTo4WsgrHH1xnH2BWQLW82zYtG3h7Vrwub75uBz6qBNK1B 8YOVzmzuea/I7N6rwSIGK9LRsGjCnjzKvUtWU9HKSqpd4o10AwG0F/tt6TtKqn+F wmztU1N1vSIDP/bisDO6Do5dTAtmsvqPcdt6TEg1yjqTIvAqfL3qAU5mzH2ZFLNp 2qhh10Oq/Stl3qHKdX+e3GtOb292eO7Xk8C7AlnrTBzup8dDW0G/6DOwcnoda2WY c6zpE+43mJLYtw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddruddujedguddvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgjfhgggfestdekre dtredttdenucfhrhhomheptehlihhsthgrihhrucfhrhgrnhgtihhsuceorghlihhsthgr ihhrsegrlhhishhtrghirhdvfedrmhgvqeenucggtffrrghtthgvrhhnpeeggedtteejke eggeeugfehueevudegvdetjeeviedugedvtdekffekhedtteduhfenucevlhhushhtvghr ufhiiigvpedunecurfgrrhgrmhepmhgrihhlfhhrohhmpegrlhhishhtrghirhesrghlih hsthgrihhrvdefrdhmvg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 29 Aug 2021 05:20:20 -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 v10 08/12] Input: wacom_i2c - Add support for vdd regulator Date: Sun, 29 Aug 2021 19:19:21 +1000 Message-Id: <20210829091925.190-10-alistair@alistair23.me> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210829091925.190-1-alistair@alistair23.me> References: <20210829091925.190-1-alistair@alistair23.me> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Add support for a VDD regulator. This allows the kernel to probe 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 a35d8fda7e7b..13341e76368b 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 @@ -92,6 +93,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; @@ -278,6 +280,16 @@ static int wacom_i2c_probe(struct i2c_client *client, if (!wac_i2c) return -ENOMEM; + 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; + } + features = &wac_i2c->features; error = wacom_query_device(client, features); if (error) @@ -286,8 +298,11 @@ static int wacom_i2c_probe(struct i2c_client *client, 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; @@ -322,6 +337,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; } @@ -331,6 +348,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 Sun Aug 29 09:19:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 12463819 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 9332FC432BE for ; Sun, 29 Aug 2021 09:20:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7434B606A5 for ; Sun, 29 Aug 2021 09:20:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235055AbhH2JVX (ORCPT ); Sun, 29 Aug 2021 05:21:23 -0400 Received: from new4-smtp.messagingengine.com ([66.111.4.230]:47013 "EHLO new4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235037AbhH2JVW (ORCPT ); Sun, 29 Aug 2021 05:21:22 -0400 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailnew.nyi.internal (Postfix) with ESMTP id 5B141580B0E; Sun, 29 Aug 2021 05:20:30 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Sun, 29 Aug 2021 05:20: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=fm2; bh=2joBurVjnCUY/ ny4RIIcJNacs95WXqyqBLv4DbH7Oe0=; b=caJvALLIiXKhEr5dDxzXS/Mp4oWwM 2Qnq3k+FjXKqhLRwgdqcDs82M7qIDl0N1+/RDpPuo7vmltZ04f2UoVsxzhmKoDgT 5xdm8NQzVhz+1Peq2A5qY0oDAudPb921N+XWT2AhE12AddpbexWQ2ZBCyXN7fbyE O0JieUtLcW0FE72NmnD055x1AP5YtQByV0IZcVdqmTcIXdEOpr8nXNs4tthOKtYE UTWlEQam6uThGVUPCk6KAVG2xZk6j/nfiUfPQ71McOsUslfI0gTfTJDfsYRYEbMA 7cpU8ByGEJa2fZCIsvg2pSFpj5aZIHgv6ffzAg5qvBjaIXg1TG2CPKCVA== 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=2joBurVjnCUY/ny4RIIcJNacs95WXqyqBLv4DbH7Oe0=; b=HlAkA/C6 xqugQbG3ny2rTM2YgrQ52qrshrc/+79WBh3nN3Js0EdrkokIjtBb7TLldbtEkrDm P4z79p5LVPf6WNgNgd4RnueIKrBUraZOUBbYlwn8aepifaylSgO72zGm6VUVHXu1 A2GBpo184KTSOksLX6qks64TGM5fxaXodIiAQngRvqaPQqNfLkm5867RbCjbSY0T UfAKzVjkTcm+gBd98BQ+Bg6edWWf0c/Jvk3K9KOSUNSQVr7RLCVoA0AHTFTSN14N Oj7ybyTpjlXDU5MnYCJUwJ011X3aUuLnsnVICyGBDN/iAZlUU2CuxsBjjbY8etdK 6RBPxTUPaeG1fA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddruddujedgudefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgjfhgggfestdekre dtredttdenucfhrhhomheptehlihhsthgrihhrucfhrhgrnhgtihhsuceorghlihhsthgr ihhrsegrlhhishhtrghirhdvfedrmhgvqeenucggtffrrghtthgvrhhnpeeggedtteejke eggeeugfehueevudegvdetjeeviedugedvtdekffekhedtteduhfenucevlhhushhtvghr ufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrlhhishhtrghirhesrghlih hsthgrihhrvdefrdhmvg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 29 Aug 2021 05:20:25 -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 v10 09/12] Input: wacom_i2c - Use macros for the bit masks Date: Sun, 29 Aug 2021 19:19:22 +1000 Message-Id: <20210829091925.190-11-alistair@alistair23.me> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210829091925.190-1-alistair@alistair23.me> References: <20210829091925.190-1-alistair@alistair23.me> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org To make the code easier to read use macros for the bit masks. Signed-off-by: Alistair Francis --- drivers/input/touchscreen/wacom_i2c.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/input/touchscreen/wacom_i2c.c b/drivers/input/touchscreen/wacom_i2c.c index 13341e76368b..f78a43212901 100644 --- a/drivers/input/touchscreen/wacom_i2c.c +++ b/drivers/input/touchscreen/wacom_i2c.c @@ -18,6 +18,14 @@ #include #include +// Bitmasks (for data[3]) +#define WACOM_TIP_SWITCH_bm (1 << 0) +#define WACOM_BARREL_SWITCH_bm (1 << 1) +#define WACOM_ERASER_bm (1 << 2) +#define WACOM_INVERT_bm (1 << 3) +#define WACOM_BARREL_SWITCH_2_bm (1 << 4) +#define WACOM_IN_RANGE_bm (1 << 5) + // Registers #define WACOM_DESC_REG 0x01 #define WACOM_COMMAND_LSB 0x04 @@ -206,10 +214,10 @@ static irqreturn_t wacom_i2c_irq(int irq, void *dev_id) if (error < 0) goto out; - tsw = data[3] & 0x01; - ers = data[3] & 0x04; - f1 = data[3] & 0x02; - f2 = data[3] & 0x10; + tsw = data[3] & WACOM_TIP_SWITCH_bm; + ers = data[3] & WACOM_ERASER_bm; + f1 = data[3] & WACOM_BARREL_SWITCH_bm; + f2 = data[3] & WACOM_BARREL_SWITCH_2_bm; x = le16_to_cpup((__le16 *)&data[4]); y = le16_to_cpup((__le16 *)&data[6]); pressure = le16_to_cpup((__le16 *)&data[8]); From patchwork Sun Aug 29 09:19:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 12463821 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 39639C432BE for ; Sun, 29 Aug 2021 09:20:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 213F660F38 for ; Sun, 29 Aug 2021 09:20:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235072AbhH2JV1 (ORCPT ); Sun, 29 Aug 2021 05:21:27 -0400 Received: from new4-smtp.messagingengine.com ([66.111.4.230]:45933 "EHLO new4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235037AbhH2JV1 (ORCPT ); Sun, 29 Aug 2021 05:21:27 -0400 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailnew.nyi.internal (Postfix) with ESMTP id 2D017580B11; Sun, 29 Aug 2021 05:20:35 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Sun, 29 Aug 2021 05:20:35 -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=fm2; bh=A4mgAYGVpG6Ka yGWNohPnEKS5U+ZGD2LaPPYB9DPm6Q=; b=nGmeTmkRD0Cqcq2SPfFMAQRd5W7+D uCnQYNcV54a+h8kHCNqhvvzsvFlQViMTm8qICXi5ZOAepHXuWq9wOvU9otAL2m8L hYcLfT+9YIN/IUxG0UCFZfe1oAu0WHUe6kZ8K2QTqTEmJJLfhXz8CsTka/pvWMGB i+g0aRXxQrTp56BBWEFZyFDaQp8qN7785RTonJb0+3wG5bVSRbC0s0bw8ez6Ju0U /CToEJm5RURost9EyrSJjLB9CvMxJ/AI69845Vdwoz3zQjjUogffRzObstLaDgzP 6L1yYRooKY95J+ZGSUDhqmxmgXAa41Z77y8nGftlYRInSDSOO3EczS6ag== 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=A4mgAYGVpG6KayGWNohPnEKS5U+ZGD2LaPPYB9DPm6Q=; b=HWEt0FsI cyVY0uYjISWEyOTI9QXyx5KWAss5nGv/nncKThrex9TAfnYM0paZC1NUl3RM7HbF IC8VzLZPIbl3unNKiWu0F0BIpXQeeTdPdjt4ZBf4P1kkNZXWWk9iqB91luzDLVmd GN4ppx1SAQWcj2KOf50hWjwVyrJt1oGQC4vH0XcxDK7Cw2gH1lZIvYJzB50IHbER jQ+TFVYFMk1BXvgaJAhrBb4vZCDjkSDLd3c6EwHB0Am9Di/23m+nzCQQxO9n55cx b4KOwiaMMqItqwRgEHe4KjCcaatOkch9IV8Ywe6NxP/vA+XnNkA68H0U797Ve463 XTyrWjwuJKA1zA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddruddujedgudefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgjfhgggfestdekre dtredttdenucfhrhhomheptehlihhsthgrihhrucfhrhgrnhgtihhsuceorghlihhsthgr ihhrsegrlhhishhtrghirhdvfedrmhgvqeenucggtffrrghtthgvrhhnpeeggedtteejke eggeeugfehueevudegvdetjeeviedugedvtdekffekhedtteduhfenucevlhhushhtvghr ufhiiigvpeefnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrlhhishhtrghirhesrghlih hsthgrihhrvdefrdhmvg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 29 Aug 2021 05:20:30 -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 v10 10/12] Input: wacom_i2c - Allow flipping the values from the DT Date: Sun, 29 Aug 2021 19:19:23 +1000 Message-Id: <20210829091925.190-12-alistair@alistair23.me> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210829091925.190-1-alistair@alistair23.me> References: <20210829091925.190-1-alistair@alistair23.me> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Allow the device tree properties to flip the tilx, position or distance values. This is required for the stylus to work correctly on the reMarkable 2. Signed-off-by: Alistair Francis Reviewed-by: Rob Herring --- .../input/touchscreen/wacom,generic.yaml | 20 +++++++++++ drivers/input/touchscreen/wacom_i2c.c | 34 +++++++++++++++++++ 2 files changed, 54 insertions(+) diff --git a/Documentation/devicetree/bindings/input/touchscreen/wacom,generic.yaml b/Documentation/devicetree/bindings/input/touchscreen/wacom,generic.yaml index a8a7f362b0ce..d451c9a235b6 100644 --- a/Documentation/devicetree/bindings/input/touchscreen/wacom,generic.yaml +++ b/Documentation/devicetree/bindings/input/touchscreen/wacom,generic.yaml @@ -25,6 +25,26 @@ properties: vdd-supply: description: Power Supply + flip-tilt-x: + type: boolean + description: Flip the tilt X values read from device + + flip-tilt-y: + type: boolean + description: Flip the tilt Y values read from device + + flip-pos-x: + type: boolean + description: Flip the X position values read from device + + flip-pos-y: + type: boolean + description: Flip the Y position values read from device + + flip-distance: + type: boolean + description: Flip the distance values read from device + required: - compatible - reg diff --git a/drivers/input/touchscreen/wacom_i2c.c b/drivers/input/touchscreen/wacom_i2c.c index f78a43212901..dd8fa351c6e4 100644 --- a/drivers/input/touchscreen/wacom_i2c.c +++ b/drivers/input/touchscreen/wacom_i2c.c @@ -105,6 +105,12 @@ struct wacom_i2c { u8 data[WACOM_QUERY_SIZE]; bool prox; int tool; + + bool flip_tilt_x; + bool flip_tilt_y; + bool flip_pos_x; + bool flip_pos_y; + bool flip_distance; }; static int wacom_query_device(struct i2c_client *client, @@ -198,6 +204,25 @@ static int wacom_query_device(struct i2c_client *client, return 0; } +static void wacom_of_read(struct wacom_i2c *wac_i2c) +{ + if (!IS_ENABLED(CONFIG_OF)) { + struct i2c_client *client = wac_i2c->client; + + wac_i2c->flip_tilt_x = of_property_read_bool(client->dev.of_node, "flip-tilt-x"); + wac_i2c->flip_tilt_y = of_property_read_bool(client->dev.of_node, "flip-tilt-y"); + wac_i2c->flip_pos_x = of_property_read_bool(client->dev.of_node, "flip-pos-x"); + wac_i2c->flip_pos_y = of_property_read_bool(client->dev.of_node, "flip-pos-y"); + wac_i2c->flip_distance = of_property_read_bool(client->dev.of_node, "flip-distance"); + } else { + wac_i2c->flip_tilt_x = false; + wac_i2c->flip_tilt_y = false; + wac_i2c->flip_pos_x = false; + wac_i2c->flip_pos_y = false; + wac_i2c->flip_distance = false; + } +} + static irqreturn_t wacom_i2c_irq(int irq, void *dev_id) { struct wacom_i2c *wac_i2c = dev_id; @@ -234,6 +259,13 @@ static irqreturn_t wacom_i2c_irq(int irq, void *dev_id) wac_i2c->prox = data[3] & 0x20; + // Flip the values based on properties from the device tree + distance = wac_i2c->flip_distance ? -distance : distance; + x = wac_i2c->flip_pos_x ? (features->x_max - x) : x; + y = wac_i2c->flip_pos_y ? (features->y_max - y) : y; + tilt_x = wac_i2c->flip_tilt_x ? -tilt_x : tilt_x; + tilt_y = wac_i2c->flip_tilt_y ? -tilt_y : tilt_y; + touchscreen_report_pos(input, &wac_i2c->props, features->x_max, features->y_max, true); input_report_key(input, BTN_TOUCH, tsw || ers); @@ -361,6 +393,8 @@ static int wacom_i2c_probe(struct i2c_client *client, return error; } + wacom_of_read(wac_i2c); + return 0; } From patchwork Sun Aug 29 09:19:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 12463823 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 74022C4320A for ; Sun, 29 Aug 2021 09:20:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 61DC860F55 for ; Sun, 29 Aug 2021 09:20:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235036AbhH2JVd (ORCPT ); Sun, 29 Aug 2021 05:21:33 -0400 Received: from new4-smtp.messagingengine.com ([66.111.4.230]:51723 "EHLO new4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235037AbhH2JVb (ORCPT ); Sun, 29 Aug 2021 05:21:31 -0400 Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailnew.nyi.internal (Postfix) with ESMTP id B1955580B0E; Sun, 29 Aug 2021 05:20:39 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Sun, 29 Aug 2021 05:20:39 -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=fm2; bh=+EvKAZLb0ChvJ XRDnM9S3OyJUJhWZBps8+iA1VzKiac=; b=IsL0lGMGzdrbDy3UQF0vHPOy0Gj5H FSDR9kwvrc4s0DAG9Oz25nWJOn47bE11SRvEHJoM2CKEFusjAvRjXuMKtu1VHBEI /ye1tRE49eKMCkgkbA1dFrBpAxmf0O8MGuE9jLOLXc9f0AMSmwXiajCGhUKmbMDA bkm7XBP1DonjgX3TSsoNBwvGTWqzGpMOhEoiQGzD1s5Fj00H7UkKQQ5tAfonMx9f Dcjv8NnXatAK15Oprqj7qo2L0+yHrUGV91f3R6ovHjCbhUGsckX0CfjSL/eY2Y3M QUKAVUxjtyIo9ONPnvS+uyskOc0YoywSELaBAXr4KhP8kHqDXaVtaA+yQ== 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=+EvKAZLb0ChvJXRDnM9S3OyJUJhWZBps8+iA1VzKiac=; b=TI1CQMh3 dvrD305oINxawyyUrdPycT4sg55Pv39GNL7fsRViHvzIY5VCQ9mMuPHvzOGYsfqV NFPi7dRqPMyrC9TjV70me1xtfBs+QN6+KNDCiy5Ev2TK1pRWj8FxesA4j8i112yP cXda6/R8zCCAj2mK3LknVo6fFlmbZq/+J3zxA7YeVUB1ZqE4BL4RkzldAiDk+CZT tc2PQ+KwLDwXeGhDD5wilma9XMb1OaZbGEFWUcEtn1X6gtX9/WrxCjRhYJtJapbl JchNEDbMddPkRTi25CsyvXVH8WzN3At3WFhY8GEO1q0rRpO/hrXOmX+C4xsoGY+0 EZ1HmSPPMUh9sQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddruddujedguddvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgjfhgggfestdekre dtredttdenucfhrhhomheptehlihhsthgrihhrucfhrhgrnhgtihhsuceorghlihhsthgr ihhrsegrlhhishhtrghirhdvfedrmhgvqeenucggtffrrghtthgvrhhnpeeggedtteejke eggeeugfehueevudegvdetjeeviedugedvtdekffekhedtteduhfenucevlhhushhtvghr ufhiiigvpedunecurfgrrhgrmhepmhgrihhlfhhrohhmpegrlhhishhtrghirhesrghlih hsthgrihhrvdefrdhmvg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 29 Aug 2021 05:20: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 v10 11/12] ARM: imx_v6_v7_defconfig: Enable Wacom I2C Date: Sun, 29 Aug 2021 19:19:24 +1000 Message-Id: <20210829091925.190-13-alistair@alistair23.me> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210829091925.190-1-alistair@alistair23.me> References: <20210829091925.190-1-alistair@alistair23.me> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Enable the Wacom I2C in the imx defconfig as it is used by the reMarkable2 tablet. Signed-off-by: Alistair Francis --- arch/arm/configs/imx_v6_v7_defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/configs/imx_v6_v7_defconfig b/arch/arm/configs/imx_v6_v7_defconfig index 079fcd8d1d11..477dac1edc75 100644 --- a/arch/arm/configs/imx_v6_v7_defconfig +++ b/arch/arm/configs/imx_v6_v7_defconfig @@ -176,6 +176,7 @@ CONFIG_TOUCHSCREEN_DA9052=y CONFIG_TOUCHSCREEN_EGALAX=y CONFIG_TOUCHSCREEN_GOODIX=y CONFIG_TOUCHSCREEN_ILI210X=y +CONFIG_TOUCHSCREEN_WACOM_I2C=y CONFIG_TOUCHSCREEN_MAX11801=y CONFIG_TOUCHSCREEN_IMX6UL_TSC=y CONFIG_TOUCHSCREEN_EDT_FT5X06=y From patchwork Sun Aug 29 09:19:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 12463825 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 5CFFDC432BE for ; Sun, 29 Aug 2021 09:20:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3F489606A5 for ; Sun, 29 Aug 2021 09:20:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235095AbhH2JVh (ORCPT ); Sun, 29 Aug 2021 05:21:37 -0400 Received: from new4-smtp.messagingengine.com ([66.111.4.230]:39601 "EHLO new4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235037AbhH2JVg (ORCPT ); Sun, 29 Aug 2021 05:21:36 -0400 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailnew.nyi.internal (Postfix) with ESMTP id 55167580B14; Sun, 29 Aug 2021 05:20:44 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Sun, 29 Aug 2021 05:20:44 -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=fm2; bh=9COMIqJL2Ybx3 3JZ6BTNawSa1Jp0SEZ7LgvLm9CZf2M=; b=m7hlypwHAe8y3g6j+f8yf7UfBt6Kf I7dWWiCliYnEZt/LnCqvMH97ryRmghS3nE7TfXmy/6QoF3ziRv7atJX8l78F9M/+ C3usyUiZ018fGl3boO50txx5TABtSBMdYZ8h7qsu798dyhLEJ3cBB6jJX8LXZvpY 57XAhrnwUpu6i1me04RpXJRn7iKxbY4NdTCguyJxZYFuSXIdiwxl+0acakLz0Bik LLn/ErN2wjMuLkLk9Bgcg3IsdZCs08igdPzGltNOkMJZ6eDWzmNUciaNyRRW3HPI f6K9EEV93IJz2AcHOi/EJf8KADhE55pw+nykaed/PTY4PqFK7IM6u8izQ== 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=9COMIqJL2Ybx33JZ6BTNawSa1Jp0SEZ7LgvLm9CZf2M=; b=toEZuPc5 2DW0kxDaESVwRMOTuhrdZqGMQcht1ObEjRuH6PkQntX3ASdhPfBs2RzPXMAleQQV GvRA1NcrwsCckXCpNFZXeQbbsXID1bZ5TLAae1Q9Df8Q0rdMbAXVbFr/0yMK15Ad ZOjB5r5LLSatkFhIYpv8f5aNrY1hbem8VFwNTmRxjUbkZill845bE3pkV6ahW998 aieq9ubgX/NtR60hkYpqWSxJmvByB3/2yZY/XavaRwvg7phH+XGg91RtLGZDDaHl 2GhfpubQNEu1riyYwwDCPSYvpGAsTL34dGJYuxYnsVvDmtqhmL8u/huCfoYPLSOG ltcfcMSCu672kA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddruddujedguddvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgjfhgggfestdekre dtredttdenucfhrhhomheptehlihhsthgrihhrucfhrhgrnhgtihhsuceorghlihhsthgr ihhrsegrlhhishhtrghirhdvfedrmhgvqeenucggtffrrghtthgvrhhnpeeggedtteejke eggeeugfehueevudegvdetjeeviedugedvtdekffekhedtteduhfenucevlhhushhtvghr ufhiiigvpeefnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrlhhishhtrghirhesrghlih hsthgrihhrvdefrdhmvg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 29 Aug 2021 05:20:40 -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 v10 12/12] ARM: dts: imx7d: remarkable2: add wacom digitizer device Date: Sun, 29 Aug 2021 19:19:25 +1000 Message-Id: <20210829091925.190-14-alistair@alistair23.me> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210829091925.190-1-alistair@alistair23.me> References: <20210829091925.190-1-alistair@alistair23.me> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@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..052f9da32398 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_LEVEL_LOW>; + 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