From patchwork Thu Dec 3 13:12:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephan Gerhold X-Patchwork-Id: 338003 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.7 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, URIBL_BLOCKED, 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 8E5AEC64E8A for ; Thu, 3 Dec 2020 13:23:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3638E24734 for ; Thu, 3 Dec 2020 13:23:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387869AbgLCNW4 (ORCPT ); Thu, 3 Dec 2020 08:22:56 -0500 Received: from mo4-p01-ob.smtp.rzone.de ([81.169.146.164]:8186 "EHLO mo4-p01-ob.smtp.rzone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387653AbgLCNW4 (ORCPT ); Thu, 3 Dec 2020 08:22:56 -0500 X-Greylist: delayed 363 seconds by postgrey-1.27 at vger.kernel.org; Thu, 03 Dec 2020 08:22:54 EST DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1607001603; s=strato-dkim-0002; d=gerhold.net; h=Message-Id:Date:Subject:Cc:To:From:X-RZG-CLASS-ID:X-RZG-AUTH:From: Subject:Sender; bh=CTgCZe7d7nfdeH38bxJEE0AJMFZdf1suWYy3usg1nro=; b=rWEEgPvsXl2KcmCjSzDKpKkVdAwCjiBIvBXPcKuU5twWnKdLzns+BlPfD98bNo2Bmb LMiKDqKmBm7B+4itx6Pr6Tog8LYwE3I9o/aHcmSr7Q3BYk+mjkcQKT9kTeGJ3rp5DtzL ezW762dDTeRfxZ3u6b/H7Ru9c3hidj1s3miJbzMaJN8PwCNuZ2A1tWpge+T80vaq7Uxw kmji/qr/CwRY0zxEfYQ4EZ5l8AVh8pclceXQCsXSt4jHhy9++S1vz+0kW1BK3oYgSId4 dC1lyYPB8iA6lwEwCwfU3dZTYHIcjn3KaKcP/bb+4q/T9oKnL1JIZo3TfMLPPwqbEbyL vmjg== X-RZG-AUTH: ":P3gBZUipdd93FF5ZZvYFPugejmSTVR2nRPhVORvLd4SsytBXS7IYBkLahKxB5G6JlbU=" X-RZG-CLASS-ID: mo00 Received: from localhost.localdomain by smtp.strato.de (RZmta 47.3.4 DYNA|AUTH) with ESMTPSA id Z061efwB3DDuqib (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Thu, 3 Dec 2020 14:13:56 +0100 (CET) From: Stephan Gerhold To: Dmitry Torokhov Cc: linux-input@vger.kernel.org, Rob Herring , devicetree@vger.kernel.org, Stephan Gerhold , Linus Walleij Subject: [PATCH 1/3] dt-bindings: Input: tm2-touchkey - convert to yaml Date: Thu, 3 Dec 2020 14:12:40 +0100 Message-Id: <20201203131242.44397-1-stephan@gerhold.net> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Convert the device tree bindings for tm2-touchkey to the YAML format. While we're at it, clarify the descriptions a bit to make it clear that this driver can be used for many different MCUs that all implement a similar I2C protocol. Depending on the MCU the voltage requirements may be different, on some devices the controller uses 2.2V, 2.8V or even 3.3V for vcc-supply instead of 1.8V. Cc: Linus Walleij Signed-off-by: Stephan Gerhold Reviewed-by: Linus Walleij Reviewed-by: Rob Herring --- .../bindings/input/cypress,tm2-touchkey.txt | 33 --------- .../bindings/input/cypress,tm2-touchkey.yaml | 68 +++++++++++++++++++ 2 files changed, 68 insertions(+), 33 deletions(-) delete mode 100644 Documentation/devicetree/bindings/input/cypress,tm2-touchkey.txt create mode 100644 Documentation/devicetree/bindings/input/cypress,tm2-touchkey.yaml diff --git a/Documentation/devicetree/bindings/input/cypress,tm2-touchkey.txt b/Documentation/devicetree/bindings/input/cypress,tm2-touchkey.txt deleted file mode 100644 index 921172f689b8..000000000000 --- a/Documentation/devicetree/bindings/input/cypress,tm2-touchkey.txt +++ /dev/null @@ -1,33 +0,0 @@ -Samsung tm2-touchkey - -Required properties: -- compatible: - * "cypress,tm2-touchkey" - for the touchkey found on the tm2 board - * "cypress,midas-touchkey" - for the touchkey found on midas boards - * "cypress,aries-touchkey" - for the touchkey found on aries boards - * "coreriver,tc360-touchkey" - for the Coreriver TouchCore 360 touchkey -- reg: I2C address of the chip. -- interrupts: interrupt to which the chip is connected (see interrupt - binding[0]). -- vcc-supply : internal regulator output. 1.8V -- vdd-supply : power supply for IC 3.3V - -Optional properties: -- linux,keycodes: array of keycodes (max 4), default KEY_PHONE and KEY_BACK - -[0]: Documentation/devicetree/bindings/interrupt-controller/interrupts.txt - -Example: - &i2c0 { - /* ... */ - - touchkey@20 { - compatible = "cypress,tm2-touchkey"; - reg = <0x20>; - interrupt-parent = <&gpa3>; - interrupts = <2 IRQ_TYPE_EDGE_FALLING>; - vcc-supply=<&ldo32_reg>; - vdd-supply=<&ldo33_reg>; - linux,keycodes = ; - }; - }; diff --git a/Documentation/devicetree/bindings/input/cypress,tm2-touchkey.yaml b/Documentation/devicetree/bindings/input/cypress,tm2-touchkey.yaml new file mode 100644 index 000000000000..90d4def83182 --- /dev/null +++ b/Documentation/devicetree/bindings/input/cypress,tm2-touchkey.yaml @@ -0,0 +1,68 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/input/cypress,tm2-touchkey.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Samsung TM2 touch key controller + +maintainers: + - Stephan Gerhold + +description: | + Touch key controllers similar to the TM2 can be found in a wide range of + Samsung devices. They are implemented using many different MCUs, but use + a similar I2C protocol. + +allOf: + - $ref: input.yaml# + +properties: + compatible: + enum: + - cypress,tm2-touchkey + - cypress,midas-touchkey + - cypress,aries-touchkey + - coreriver,tc360-touchkey + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + + vdd-supply: + description: Optional regulator for LED voltage, 3.3V. + + vcc-supply: + description: Optional regulator for MCU, 1.8V-3.3V (depending on MCU). + + linux,keycodes: + minItems: 1 + maxItems: 4 + +required: + - compatible + - reg + - interrupts + +additionalProperties: false + +examples: + - | + #include + #include + i2c { + #address-cells = <1>; + #size-cells = <0>; + + touchkey@20 { + compatible = "cypress,tm2-touchkey"; + reg = <0x20>; + interrupt-parent = <&gpa3>; + interrupts = <2 IRQ_TYPE_EDGE_FALLING>; + vcc-supply = <&ldo32_reg>; + vdd-supply = <&ldo33_reg>; + linux,keycodes = ; + }; + }; From patchwork Thu Dec 3 13:12:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephan Gerhold X-Patchwork-Id: 338004 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.7 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, URIBL_BLOCKED, 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 321F5C63777 for ; Thu, 3 Dec 2020 13:23:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CACC124730 for ; Thu, 3 Dec 2020 13:23:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387671AbgLCNWt (ORCPT ); Thu, 3 Dec 2020 08:22:49 -0500 Received: from mo4-p02-ob.smtp.rzone.de ([85.215.255.83]:25626 "EHLO mo4-p02-ob.smtp.rzone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387653AbgLCNWt (ORCPT ); Thu, 3 Dec 2020 08:22:49 -0500 X-Greylist: delayed 355 seconds by postgrey-1.27 at vger.kernel.org; Thu, 03 Dec 2020 08:22:48 EST DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1607001597; s=strato-dkim-0002; d=gerhold.net; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: X-RZG-CLASS-ID:X-RZG-AUTH:From:Subject:Sender; bh=roHgNlmN+vU8M22GigtIWTMULnCCY+UXLgvb6z4Xc0E=; b=tN+WuVFkbyHJtY6s+ths9o3W50ynXhikRCPq1OvbqDMylUBdKX2sKOp43/pSujcV3J 9ALoLcoK0UJfovjZumWG8fHVa4NzMbm+kWlT5En5B8jQqN4FmKhETiGGXEwBgv9rlHUB uVDg+Asi5XF0kNnnmYbsfUZOV3aD+FZKmLLKGPslIQFR55Oi81pgpeW7wdhVBDAwC74T L33gDIxp6+Sks9CuUTLl/LPVC6qtua5a4nzV9AKbiJIHKn4h0P8jmZvWkNGYGd70bd8U p0aGbj/DOJrBWEY0Tzsivt7D8kdiKn9u6MkK49YVWLdo9g5oAxkUw8uVbhnD7ccJZbfW AnDA== X-RZG-AUTH: ":P3gBZUipdd93FF5ZZvYFPugejmSTVR2nRPhVORvLd4SsytBXS7IYBkLahKxB5G6JlbU=" X-RZG-CLASS-ID: mo00 Received: from localhost.localdomain by smtp.strato.de (RZmta 47.3.4 DYNA|AUTH) with ESMTPSA id Z061efwB3DDvqid (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Thu, 3 Dec 2020 14:13:57 +0100 (CET) From: Stephan Gerhold To: Dmitry Torokhov Cc: linux-input@vger.kernel.org, Rob Herring , devicetree@vger.kernel.org, Stephan Gerhold , Linus Walleij Subject: [PATCH 2/3] dt-bindings: Input: tm2-touchkey - document vddio-supply Date: Thu, 3 Dec 2020 14:12:41 +0100 Message-Id: <20201203131242.44397-2-stephan@gerhold.net> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201203131242.44397-1-stephan@gerhold.net> References: <20201203131242.44397-1-stephan@gerhold.net> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org The Samsung touchkey controllers are often used with external pull-up for the interrupt line and the I2C lines, so we might need to enable a regulator to bring the lines into usable state. Otherwise, this might cause spurious interrupts and reading from I2C will fail. Document support for a "vddio-supply" that is enabled by the tm2-touchkey driver so that the regulator gets enabled when needed. Cc: Linus Walleij Signed-off-by: Stephan Gerhold --- .../devicetree/bindings/input/cypress,tm2-touchkey.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Documentation/devicetree/bindings/input/cypress,tm2-touchkey.yaml b/Documentation/devicetree/bindings/input/cypress,tm2-touchkey.yaml index 90d4def83182..52dca8b64081 100644 --- a/Documentation/devicetree/bindings/input/cypress,tm2-touchkey.yaml +++ b/Documentation/devicetree/bindings/input/cypress,tm2-touchkey.yaml @@ -37,6 +37,11 @@ properties: vcc-supply: description: Optional regulator for MCU, 1.8V-3.3V (depending on MCU). + vddio-supply: + description: | + Optional regulator that provides digital I/O voltage, + e.g. for pulling up the interrupt line or the I2C pins. + linux,keycodes: minItems: 1 maxItems: 4 From patchwork Thu Dec 3 13:12:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephan Gerhold X-Patchwork-Id: 337259 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.7 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, URIBL_BLOCKED, 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 65E3BC64E7A for ; Thu, 3 Dec 2020 13:23:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 06FBE24733 for ; Thu, 3 Dec 2020 13:23:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728028AbgLCNWx (ORCPT ); Thu, 3 Dec 2020 08:22:53 -0500 Received: from mo4-p02-ob.smtp.rzone.de ([85.215.255.83]:19833 "EHLO mo4-p02-ob.smtp.rzone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387653AbgLCNWx (ORCPT ); Thu, 3 Dec 2020 08:22:53 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1607001600; s=strato-dkim-0002; d=gerhold.net; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: X-RZG-CLASS-ID:X-RZG-AUTH:From:Subject:Sender; bh=8SMbI6yVkHj4NPQvjTU7H4z9LztqFgyOWjDtBzDt84k=; b=nqPqCV7my3ZsGJaLNUnMb6+6nYtk5a7LocgPls+KqkuL2fgoeIriDKbcMLCta8EZW7 lELBdwqxd9pjInxo12fb+ka3ijU9ciuFzpT2hJ1tzjYOlHgC9DSrj7GYJKIXHgSf5496 OXZ6YNscxqJ0DV+hYfCpvB8aHYx06GJGV8/ME3Ixa0lp4QY7lZ/toxfGWkdICjcC61Vi p5WpTw+s3mn6BrKmPtaj2uM9RgLEtxPooya8C+7XnaItnQAiSt1tHH44/5UKmmcr4ta2 bEcMRQrc5Xu1fRelqE7+V34mCH33z4q34+qilkQNcfGA7laNT1gRaqH+cz+6B2SGyotW rqnQ== X-RZG-AUTH: ":P3gBZUipdd93FF5ZZvYFPugejmSTVR2nRPhVORvLd4SsytBXS7IYBkLahKxB5G6JlbU=" X-RZG-CLASS-ID: mo00 Received: from localhost.localdomain by smtp.strato.de (RZmta 47.3.4 DYNA|AUTH) with ESMTPSA id Z061efwB3DDwqif (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Thu, 3 Dec 2020 14:13:58 +0100 (CET) From: Stephan Gerhold To: Dmitry Torokhov Cc: linux-input@vger.kernel.org, Rob Herring , devicetree@vger.kernel.org, Stephan Gerhold , Linus Walleij Subject: [PATCH 3/3] Input: tm2-touchkey - add vddio regulator Date: Thu, 3 Dec 2020 14:12:42 +0100 Message-Id: <20201203131242.44397-3-stephan@gerhold.net> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201203131242.44397-1-stephan@gerhold.net> References: <20201203131242.44397-1-stephan@gerhold.net> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org The Samsung touchkey controllers are often used with external pull-up for the interrupt line and the I2C lines, so we might need to enable a regulator to bring the lines into usable state. Otherwise, this might cause spurious interrupts and reading from I2C will fail. Implement support for a "vddio-supply" that is enabled by the tm2-touchkey driver so that the regulator gets enabled when needed. Cc: Linus Walleij Signed-off-by: Stephan Gerhold Reviewed-by: Linus Walleij --- drivers/input/keyboard/tm2-touchkey.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/input/keyboard/tm2-touchkey.c b/drivers/input/keyboard/tm2-touchkey.c index fb078e049413..6218b1c682ef 100644 --- a/drivers/input/keyboard/tm2-touchkey.c +++ b/drivers/input/keyboard/tm2-touchkey.c @@ -48,7 +48,7 @@ struct tm2_touchkey_data { struct input_dev *input_dev; struct led_classdev led_dev; struct regulator *vdd; - struct regulator_bulk_data regulators[2]; + struct regulator_bulk_data regulators[3]; const struct touchkey_variant *variant; u32 keycodes[4]; int num_keycodes; @@ -204,6 +204,7 @@ static int tm2_touchkey_probe(struct i2c_client *client, touchkey->regulators[0].supply = "vcc"; touchkey->regulators[1].supply = "vdd"; + touchkey->regulators[2].supply = "vddio"; error = devm_regulator_bulk_get(&client->dev, ARRAY_SIZE(touchkey->regulators), touchkey->regulators);