From patchwork Wed Oct 28 10:17:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 11864163 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 41DE91130 for ; Thu, 29 Oct 2020 00:06:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0E15D20878 for ; Thu, 29 Oct 2020 00:05:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="CCVxFxGm" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389264AbgJ2AEQ (ORCPT ); Wed, 28 Oct 2020 20:04:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42684 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389390AbgJ2ACd (ORCPT ); Wed, 28 Oct 2020 20:02:33 -0400 Received: from mail-ed1-x542.google.com (mail-ed1-x542.google.com [IPv6:2a00:1450:4864:20::542]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC551C0613CF for ; Wed, 28 Oct 2020 17:02:32 -0700 (PDT) Received: by mail-ed1-x542.google.com with SMTP id dn5so1278657edb.10 for ; Wed, 28 Oct 2020 17:02:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=6uS0r7y6biXYa9U4d4/PAE9n89ZvBxgMX312oRTh6lg=; b=CCVxFxGmfy05Q68akXSjQsCJFHYqa+w34YILpnkF6uWLOR1JVX3zVzQAJ09p/D0SNU yaRazFZb/HzW5pt2hhCSd9T9zrUglfJqPd/3iMBDS9/FTaCAp7pAAOZzE1wbX8irW3Bl iHWBdBqdyMV/GAnLlNrq/8iIcWCTcRSpc1w6C/XPODtf0BkG48hyVb5ICDUEJPK5ZHY0 VD09tvGnmncQdfN4AJOFm5ll5Fl3tc5HIw8yZ18CpR+BLVSrjmldEids37qAg1Mjb3DV N6clHFsGF0VuqcKva8oB+E2XWD6uEwdLcDAFDkt96dzJYWc9DhyeedHFlsZokT+NnilL +7AQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=6uS0r7y6biXYa9U4d4/PAE9n89ZvBxgMX312oRTh6lg=; b=jlegUGwrha+7qPlOa2h2blWYY5DeU7WKVcwdkp5BAS3NYClx1eYs2NOoCAvYB1ohtP 8cNQjNwo5fsXEEwb2PrYhbRigqLiXJl0Yz6SKzvGQli55Gk+Z3U/+bDX5JZk6Q9e6TP/ THRxIhF4EJLEwxvgeKvMtunFL/TxpUA4mWTPdUve6uC+7Wbn4ub3Qm2r0ZNJdzrjjATi e6HCI8eskFOXYDmiJWipzlaIEpYijONFCpSlc7sApA6cyzxvnjV9/vIpz5w3rn33HzHD z18Aef7QDnTaD3Jzg8r2v8bmaPBY64g5NP07/mMUGdm1Ik9LaSdmqPCBdkZNR+lReJyX Q9/Q== X-Gm-Message-State: AOAM532o29pdERuQreEocxvxLPzbV1E8wKCQfEsPQxfb2rPCTYdkojBM yfKeWMvGii5groa4Ur7y6ys2q3meNNO0qMD2 X-Google-Smtp-Source: ABdhPJwX9hHG1DBF/vrwPA04qfIX4Usd1mJ95bLF2KJvyhKPLYcFMFc73JombKwmPQcjeBlKxSuh6g== X-Received: by 2002:a2e:3c10:: with SMTP id j16mr558726lja.236.1603880237980; Wed, 28 Oct 2020 03:17:17 -0700 (PDT) Received: from localhost.bredbandsbolaget (c-92d7225c.014-348-6c756e10.bbcust.telenor.se. [92.34.215.146]) by smtp.gmail.com with ESMTPSA id b12sm478741lfo.177.2020.10.28.03.17.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Oct 2020 03:17:17 -0700 (PDT) From: Linus Walleij To: Dmitry Torokhov , linux-input@vger.kernel.org Cc: Linus Walleij , Nick Dyer , Stephan Gerhold , devicetree@vger.kernel.org Subject: [PATCH 1/2] Input: atmel_mxt_ts: Convert bindings to YAML and extend Date: Wed, 28 Oct 2020 11:17:10 +0100 Message-Id: <20201028101711.696423-1-linus.walleij@linaro.org> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org This converts the Armel MXT touchscreen bindings to YAML format and extends them with the following two properties: - vdda-supply: the optional analog supply voltage - vdd-supply: the optional digital supply voltage I also explained about the reset-gpios property that this better be flagged as active high (0) despite actually being active low, because all current device trees and drivers assume that this is the case and will actively drive the line low to assert RESET. Tested the schema with all in-tree users and they verify fine. Cc: Nick Dyer Cc: Stephan Gerhold Cc: devicetree@vger.kernel.org Signed-off-by: Linus Walleij --- .../bindings/input/atmel,maxtouch.txt | 41 --------- .../bindings/input/atmel,maxtouch.yaml | 83 +++++++++++++++++++ MAINTAINERS | 2 +- 3 files changed, 84 insertions(+), 42 deletions(-) delete mode 100644 Documentation/devicetree/bindings/input/atmel,maxtouch.txt create mode 100644 Documentation/devicetree/bindings/input/atmel,maxtouch.yaml diff --git a/Documentation/devicetree/bindings/input/atmel,maxtouch.txt b/Documentation/devicetree/bindings/input/atmel,maxtouch.txt deleted file mode 100644 index c88919480d37..000000000000 --- a/Documentation/devicetree/bindings/input/atmel,maxtouch.txt +++ /dev/null @@ -1,41 +0,0 @@ -Atmel maXTouch touchscreen/touchpad - -Required properties: -- compatible: - atmel,maxtouch - - The following compatibles have been used in various products but are - deprecated: - atmel,qt602240_ts - atmel,atmel_mxt_ts - atmel,atmel_mxt_tp - atmel,mXT224 - -- reg: The I2C address of the device - -- interrupts: The sink for the touchpad's IRQ output - See ../interrupt-controller/interrupts.txt - -Optional properties for main touchpad device: - -- linux,gpio-keymap: When enabled, the SPT_GPIOPWN_T19 object sends messages - on GPIO bit changes. An array of up to 8 entries can be provided - indicating the Linux keycode mapped to each bit of the status byte, - starting at the LSB. Linux keycodes are defined in - . - - Note: the numbering of the GPIOs and the bit they start at varies between - maXTouch devices. You must either refer to the documentation, or - experiment to determine which bit corresponds to which input. Use - KEY_RESERVED for unused padding values. - -- reset-gpios: GPIO specifier for the touchscreen's reset pin (active low) - -Example: - - touch@4b { - compatible = "atmel,maxtouch"; - reg = <0x4b>; - interrupt-parent = <&gpio>; - interrupts = ; - }; diff --git a/Documentation/devicetree/bindings/input/atmel,maxtouch.yaml b/Documentation/devicetree/bindings/input/atmel,maxtouch.yaml new file mode 100644 index 000000000000..6173562f328a --- /dev/null +++ b/Documentation/devicetree/bindings/input/atmel,maxtouch.yaml @@ -0,0 +1,83 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/input/atmel,maxtouch.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Atmel maXTouch touchscreen/touchpad + +maintainers: + - Nick Dyer + - Linus Walleij + +description: | + Atmel maXTouch touchscreen or touchpads such as the mXT244 + and similar devices. + +properties: + compatible: + const: atmel,maxtouch + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + + vdda-supply: + description: + Optional regulator for the AVDD analog voltage. + + vdd-supply: + description: + Optional regulator for the VDD digital voltage. + + reset-gpios: + maxItems: 1 + description: + Optional GPIO specifier for the touchscreen's reset pin + (active low). The operating system should actively drive + the line low to assert reset, so the line must NOT be + flagged with GPIO_ACTIVE_LOW, it should (counterintuitively) + be set to GPIO_ACTIVE_HIGH. + + linux,gpio-keymap: + $ref: /schemas/types.yaml#/definitions/uint32-array + description: | + When enabled, the SPT_GPIOPWN_T19 object sends messages + on GPIO bit changes. An array of up to 8 entries can be provided + indicating the Linux keycode mapped to each bit of the status byte, + starting at the LSB. Linux keycodes are defined in + . + + Note: the numbering of the GPIOs and the bit they start at varies + between maXTouch devices. You must either refer to the documentation, + or experiment to determine which bit corresponds to which input. Use + KEY_RESERVED for unused padding values. + +required: + - compatible + - reg + - interrupts + +additionalProperties: false + +examples: + - | + #include + #include + i2c { + #address-cells = <1>; + #size-cells = <0>; + touchscreen@4a { + compatible = "atmel,maxtouch"; + reg = <0x4a>; + interrupt-parent = <&gpio>; + interrupts = <26 IRQ_TYPE_EDGE_FALLING>; + reset-gpios = <&gpio 27 GPIO_ACTIVE_HIGH>; + vdda-supply = <&ab8500_ldo_aux2_reg>; + vdd-supply = <&ab8500_ldo_aux5_reg>; + }; + }; + +... diff --git a/MAINTAINERS b/MAINTAINERS index e73636b75f29..b4b46fcb82db 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2966,7 +2966,7 @@ ATMEL MAXTOUCH DRIVER M: Nick Dyer S: Maintained T: git git://github.com/ndyer/linux.git -F: Documentation/devicetree/bindings/input/atmel,maxtouch.txt +F: Documentation/devicetree/bindings/input/atmel,maxtouch.yaml F: drivers/input/touchscreen/atmel_mxt_ts.c ATMEL WIRELESS DRIVER From patchwork Wed Oct 28 10:17:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 11863965 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C52B9921 for ; Wed, 28 Oct 2020 22:55:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9439620759 for ; Wed, 28 Oct 2020 22:55:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="a2fMGqvD" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389712AbgJ1Wyv (ORCPT ); Wed, 28 Oct 2020 18:54:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59792 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731882AbgJ1WyR (ORCPT ); Wed, 28 Oct 2020 18:54:17 -0400 Received: from mail-ej1-x641.google.com (mail-ej1-x641.google.com [IPv6:2a00:1450:4864:20::641]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ABB44C0613CF for ; Wed, 28 Oct 2020 15:54:14 -0700 (PDT) Received: by mail-ej1-x641.google.com with SMTP id s15so1200364ejf.8 for ; Wed, 28 Oct 2020 15:54:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=J41W71IQ8WSj0cCZqufjh6ZHmQkGRw/0YT8/352UCGg=; b=a2fMGqvD/R5ExXo7ON4SNTQow6QSUXZJ0oEN74ayDLbg5utNqTPolAjE7pddYpbZSP f7NczRPuiC6UdRNZovCzI0x684EeBMw6LseeFtivV1OW1Z2fJlokPJdPN8gZOZ489ST5 kEyPJOMFl4Sv47u2iFs7+oGLCuDRTR78hXZnqKlRMj2NOHwtvD0zrTfhBD9uEjRSRi/b wJr1k/Os2Sw/gb+3dwHuTERC3IJ/LeMimPscbDaC/6+0aDDOcZO9+Id2O9dkjkdzN6+d eHMonCC8G1hTf+c6rerzru+xIDq2+z9lliI8HoeStLY3ZXX58AQ3Lyk4RUsoSbwQVwGJ poEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=J41W71IQ8WSj0cCZqufjh6ZHmQkGRw/0YT8/352UCGg=; b=dX0hNM/ruLIBb7eMQ3bVS4ghRjRagl17I6cIEP+dWnLxCji24CbfTCC2NNB/a3fQgK vggZGastCnZPSq4tMvKJmDsd/Z1cD1HRv0zNCi2oclLE7Smd7lN6T6FXV6v2oQPhw83v 8qWFLfrRRuN6mewNy5dVGxBRK0jPUGyXz63ok5C+AxjBgtd6iNwl2NRm0Om8zBOSCpb7 diLxlrx7aeI5TkuyPcTy23xKdfD85ISHQZDuKZHj+LDPeX2V+jtnHBaSktf//lKmFpOL 5w22Fahj1I33VjICU12G5zfiO14dB8jc9ostCZbro1znDu3/CH0iitV2ZU3lQPq88PU4 3Krg== X-Gm-Message-State: AOAM530Grtz7SU3oQ+3Bf3BM2HVfkcBKMet3v9cKCboeidnCVyWuXDl5 KhaO35UDEtu79Mpgvq1e5tewl9qVqQx4os0w X-Google-Smtp-Source: ABdhPJw/4cihqwk4b0ci0MVLCI/GHS4dkvEWisPNkUShxWsYG/Ue9visClupCfzthEks0JpYzP7XgQ== X-Received: by 2002:a19:b14:: with SMTP id 20mr2693296lfl.308.1603880239749; Wed, 28 Oct 2020 03:17:19 -0700 (PDT) Received: from localhost.bredbandsbolaget (c-92d7225c.014-348-6c756e10.bbcust.telenor.se. [92.34.215.146]) by smtp.gmail.com with ESMTPSA id b12sm478741lfo.177.2020.10.28.03.17.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Oct 2020 03:17:19 -0700 (PDT) From: Linus Walleij To: Dmitry Torokhov , linux-input@vger.kernel.org Cc: Linus Walleij , Nick Dyer , Stephan Gerhold Subject: [PATCH 2/2] Input: atmel_mxt_ts: Support regulator supplies Date: Wed, 28 Oct 2020 11:17:11 +0100 Message-Id: <20201028101711.696423-2-linus.walleij@linaro.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201028101711.696423-1-linus.walleij@linaro.org> References: <20201028101711.696423-1-linus.walleij@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org This adds the code for the Atmel touchscreens such as mXT224 to obtain power regulators for the supply voltages AVDD and VDD. On mobile phones such as Samsung GT-I8190 (Golden) this is needed to explicitly bring power online. We just enable the regulators at probe() and disable them at remove() or in the errorpath for now. As regulators are naturally stubbed if not available, this should have no impact on existing systems. Cc: Nick Dyer Cc: Stephan Gerhold Signed-off-by: Linus Walleij --- drivers/input/touchscreen/atmel_mxt_ts.c | 37 +++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index 98f17fa3a892..701269f9744f 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -309,6 +310,7 @@ struct mxt_data { u8 multitouch; struct t7_config t7_cfg; struct mxt_dbg dbg; + struct regulator_bulk_data regulators[2]; struct gpio_desc *reset_gpio; bool use_retrigen_workaround; @@ -3134,6 +3136,21 @@ static int mxt_probe(struct i2c_client *client, const struct i2c_device_id *id) if (error) return error; + /* + * VDDA is the analog voltage supply 2.57..3.47 V + * VDD is the digital voltage supply 1.71..3.47 V + */ + data->regulators[0].supply = "vdda"; + data->regulators[1].supply = "vdd"; + error = devm_regulator_bulk_get(&client->dev, ARRAY_SIZE(data->regulators), + data->regulators); + if (error) { + if (error != -EPROBE_DEFER) + dev_err(&client->dev, "Failed to get regulators %d\n", + error); + return error; + } + data->reset_gpio = devm_gpiod_get_optional(&client->dev, "reset", GPIOD_OUT_LOW); if (IS_ERR(data->reset_gpio)) { @@ -3152,6 +3169,19 @@ static int mxt_probe(struct i2c_client *client, const struct i2c_device_id *id) disable_irq(client->irq); + error = regulator_bulk_enable(ARRAY_SIZE(data->regulators), + data->regulators); + if (error) { + dev_err(&client->dev, "failed to enable regulators: %d\n", + error); + return error; + } + /* + * The device takes 40ms to come up after power-on according + * to the mXT224 datasheet, page 13. + */ + msleep(MXT_BACKUP_TIME); + if (data->reset_gpio) { msleep(MXT_RESET_GPIO_TIME); gpiod_set_value(data->reset_gpio, 1); @@ -3160,7 +3190,7 @@ static int mxt_probe(struct i2c_client *client, const struct i2c_device_id *id) error = mxt_initialize(data); if (error) - return error; + goto err_disable_regulators; error = sysfs_create_group(&client->dev.kobj, &mxt_attr_group); if (error) { @@ -3174,6 +3204,9 @@ static int mxt_probe(struct i2c_client *client, const struct i2c_device_id *id) err_free_object: mxt_free_input_device(data); mxt_free_object_table(data); +err_disable_regulators: + regulator_bulk_disable(ARRAY_SIZE(data->regulators), + data->regulators); return error; } @@ -3185,6 +3218,8 @@ static int mxt_remove(struct i2c_client *client) sysfs_remove_group(&client->dev.kobj, &mxt_attr_group); mxt_free_input_device(data); mxt_free_object_table(data); + regulator_bulk_disable(ARRAY_SIZE(data->regulators), + data->regulators); return 0; }