From patchwork Wed May 26 23:03:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 448503 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,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 480D3C47082 for ; Wed, 26 May 2021 23:06:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 23D39613D2 for ; Wed, 26 May 2021 23:06:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233149AbhEZXHf (ORCPT ); Wed, 26 May 2021 19:07:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234605AbhEZXHf (ORCPT ); Wed, 26 May 2021 19:07:35 -0400 Received: from mail-lj1-x232.google.com (mail-lj1-x232.google.com [IPv6:2a00:1450:4864:20::232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CCEA4C06175F for ; Wed, 26 May 2021 16:06:01 -0700 (PDT) Received: by mail-lj1-x232.google.com with SMTP id a4so3828428ljd.5 for ; Wed, 26 May 2021 16:06:01 -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=Jw4KLtA4uqHxoFwXu4kv0bluyXyE1glORw3zuhcTQzA=; b=Y8QKcIGtSvMrM/KhMmPOygYfUZ69FTCfY6/Fp/YC2xF0/8IlTAmPNWTg4RapZoeg28 QVTtKOwl//5IZm6lRSzWghGtZCnppLGw8GyTiwc5gQf3xeRUJgrRO4e4R9VzgCBclf0C mBm5ZwEtoxu1RCvM6De5QesR+1pWtwPHLtdioZUZvKRwHPU2uINT67w7Eycjhmyfd8yl +I+wYQfKVYXHbRt3+HIWOjPuJNhTXO9aldZI4NudqZXQ8Ijb65zJHjr7LZniDolo07cN 93yiFCVv+wmevWtbmhyu1ld8+gyEEvYToSY0cmuJCr1gbROso7QW8k9kkxYA4Y/aY6+5 AXfg== 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=Jw4KLtA4uqHxoFwXu4kv0bluyXyE1glORw3zuhcTQzA=; b=ln7val+P5IRbUGokjbuaeTFYxO2TRavbzX7PjDygEo5c8ztzJKTZxNPrVEwF3YXZRD AUniIc/P1NnjvZDSIHqQOmzEcW8Xk6OwMlOKy2e++V0VJpLqgsIfgmgj1OfgmK9jbEh+ Eh5nwyHJJTGsTmkVu1q5Jrmkcl7PY4Vc4thtxaDqFhpazZmKPJIJH2ofkzq3JAtMWi39 g/4zl7ZNXtxoRy+RVQ/2IzmBBoC8ovbwWEga81vodFYJrisGF66ztzhW56mwd9T/4sFe /aIFYj+YeA3Ny3BNRaiVc8DGU2xi/ElYDgpamLKAJxqhy+B4Ubk+eE5po5cy1ffKxw3h QHkg== X-Gm-Message-State: AOAM533aaNZk/FAiqICT6kxaxPqjWNe9UWJYdz684b9A2ajMGx+IuUFk Ui6W4DHMEH0t79MJ23aIP8i7KQ== X-Google-Smtp-Source: ABdhPJwecfmtltDoT7E3my/joZRhY8WWUpHzKCh31cExENE+CE9zbUwCffrJr0NMfKikAjNm1XR8YQ== X-Received: by 2002:a2e:88ca:: with SMTP id a10mr301743ljk.259.1622070359983; Wed, 26 May 2021 16:05:59 -0700 (PDT) Received: from localhost.localdomain (c-fdcc225c.014-348-6c756e10.bbcust.telenor.se. [92.34.204.253]) by smtp.gmail.com with ESMTPSA id w21sm35415lfl.117.2021.05.26.16.05.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 May 2021 16:05:59 -0700 (PDT) From: Linus Walleij To: Ferruh Yigit , Dmitry Torokhov , Javier Martinez Canillas Cc: Henrik Rydberg , linux-input@vger.kernel.org, Linus Walleij , devicetree@vger.kernel.org, Rob Herring Subject: [PATCH 1/3 v6] Input: cyttsp - Convert bindings to YAML and extend Date: Thu, 27 May 2021 01:03:50 +0200 Message-Id: <20210526230352.1433537-1-linus.walleij@linaro.org> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org This converts the CYTTSP "Cypress TrueTouch Standard Product" to YAML bindings and fixes and adds some things in the process: - Rename the bindings file to cypress,cy8ctma340 after the main product in the series. - Add proper compatibles for the two known products: CY8CTMA340 and CY8CTST341. - Deprecate "cypress,cyttsp-spi" and "cypress,cyttsp-i2c" because device compatibles should be named after the hardware and not after which bus they are connected to. The topology implicitly tells us which bus it is and what interface to used. - Add VCPIN and VDD supplies, these are present just like on the CY8CTMA140. Cc: devicetree@vger.kernel.org Cc: Ferruh Yigit Reviewed-by: Rob Herring Reviewed-by: Javier Martinez Canillas Signed-off-by: Linus Walleij --- ChangeLog v5->v6: - No changes just resending with the other patches. ChangeLog v4->v5: - Rebase on v5.13-rc1 ChangeLog v3->v4: - Drop wording about falling interrupt edge. Do not mandate interrupt type in the binding. ChangeLog v2->v3: - Collect Robs and Javiers Review tags. - Use the right mail address for Javier. - Include in the patch series with the rest of the CYTTSP fixes. ChangeLog v1->v2: - Use minItems and maxItems directly without -items - Drop u32 type from all properties ending with "-ms" that thus have implicit types. - Add maintiner to Cc. Patch to add the new compatibles to the Linux driver is sent separately. --- .../input/touchscreen/cypress,cy8ctma340.yaml | 148 ++++++++++++++++++ .../bindings/input/touchscreen/cyttsp.txt | 93 ----------- 2 files changed, 148 insertions(+), 93 deletions(-) create mode 100644 Documentation/devicetree/bindings/input/touchscreen/cypress,cy8ctma340.yaml delete mode 100644 Documentation/devicetree/bindings/input/touchscreen/cyttsp.txt diff --git a/Documentation/devicetree/bindings/input/touchscreen/cypress,cy8ctma340.yaml b/Documentation/devicetree/bindings/input/touchscreen/cypress,cy8ctma340.yaml new file mode 100644 index 000000000000..762e56ee90cd --- /dev/null +++ b/Documentation/devicetree/bindings/input/touchscreen/cypress,cy8ctma340.yaml @@ -0,0 +1,148 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/input/touchscreen/cypress,cy8ctma340.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Cypress CY8CTMA340 series touchscreen controller bindings + +description: The Cypress CY8CTMA340 series (also known as "CYTTSP" after + the marketing name Cypress TrueTouch Standard Product) touchscreens can + be connected to either I2C or SPI buses. + +maintainers: + - Javier Martinez Canillas + - Linus Walleij + +allOf: + - $ref: touchscreen.yaml# + +properties: + $nodename: + pattern: "^touchscreen(@.*)?$" + + compatible: + oneOf: + - const: cypress,cy8ctma340 + - const: cypress,cy8ctst341 + - const: cypress,cyttsp-spi + description: Legacy compatible for SPI connected CY8CTMA340 + deprecated: true + - const: cypress,cyttsp-i2c + description: Legacy compatible for I2C connected CY8CTMA340 + deprecated: true + + reg: + description: I2C address when used on the I2C bus, or the SPI chip + select index when used on the SPI bus + + clock-frequency: + description: I2C client clock frequency, defined for host when using + the device on the I2C bus + minimum: 0 + maximum: 400000 + + spi-max-frequency: + description: SPI clock frequency, defined for host, defined when using + the device on the SPI bus. The throughput is maximum 2 Mbps so the + typical value is 2000000, if higher rates are used the total throughput + needs to be restricted to 2 Mbps. + minimum: 0 + maximum: 6000000 + + interrupts: + description: Interrupt to host + maxItems: 1 + + vcpin-supply: + description: Analog power supply regulator on VCPIN pin + + vdd-supply: + description: Digital power supply regulator on VDD pin + + reset-gpios: + description: Reset line for the touchscreen, should be tagged + as GPIO_ACTIVE_LOW + + bootloader-key: + description: the 8-byte bootloader key that is required to switch + the chip from bootloader mode (default mode) to application mode + $ref: /schemas/types.yaml#/definitions/uint8-array + minItems: 8 + maxItems: 8 + + touchscreen-size-x: true + touchscreen-size-y: true + touchscreen-fuzz-x: true + touchscreen-fuzz-y: true + + active-distance: + description: the distance in pixels beyond which a touch must move + before movement is detected and reported by the device + $ref: /schemas/types.yaml#/definitions/uint32 + minimum: 0 + maximum: 15 + + active-interval-ms: + description: the minimum period in ms between consecutive + scanning/processing cycles when the chip is in active mode + minimum: 0 + maximum: 255 + + lowpower-interval-ms: + description: the minimum period in ms between consecutive + scanning/processing cycles when the chip is in low-power mode + minimum: 0 + maximum: 2550 + + touch-timeout-ms: + description: minimum time in ms spent in the active power state while no + touches are detected before entering low-power mode + minimum: 0 + maximum: 2550 + + use-handshake: + description: enable register-based handshake (boolean). This should only + be used if the chip is configured to use 'blocking communication with + timeout' (in this case the device generates an interrupt at the end of + every scanning/processing cycle) + $ref: /schemas/types.yaml#/definitions/flag + +additionalProperties: false + +required: + - compatible + - reg + - interrupts + - bootloader-key + - touchscreen-size-x + - touchscreen-size-y + +examples: + - | + #include + #include + spi { + #address-cells = <1>; + #size-cells = <0>; + num-cs = <1>; + cs-gpios = <&gpio 2 GPIO_ACTIVE_HIGH>; + + touchscreen@0 { + compatible = "cypress,cy8ctma340"; + reg = <0>; + interrupt-parent = <&gpio>; + interrupts = <20 IRQ_TYPE_EDGE_FALLING>; + reset-gpios = <&gpio 21 GPIO_ACTIVE_LOW>; + vdd-supply = <&ldo_aux1_reg>; + vcpin-supply = <&ldo_aux2_reg>; + bootloader-key = /bits/ 8 <0x00 0x01 0x02 0x03 0x04 0x05 0x06 0x07>; + touchscreen-size-x = <480>; + touchscreen-size-y = <800>; + active-interval-ms = <0>; + touch-timeout-ms = <255>; + lowpower-interval-ms = <10>; + }; + }; + +... diff --git a/Documentation/devicetree/bindings/input/touchscreen/cyttsp.txt b/Documentation/devicetree/bindings/input/touchscreen/cyttsp.txt deleted file mode 100644 index 6ee274aa8b03..000000000000 --- a/Documentation/devicetree/bindings/input/touchscreen/cyttsp.txt +++ /dev/null @@ -1,93 +0,0 @@ -* Cypress cyttsp touchscreen controller - -Required properties: - - compatible : must be "cypress,cyttsp-i2c" or "cypress,cyttsp-spi" - - reg : Device I2C address or SPI chip select number - - spi-max-frequency : Maximum SPI clocking speed of the device (for cyttsp-spi) - - interrupts : (gpio) interrupt to which the chip is connected - (see interrupt binding[0]). - - bootloader-key : the 8-byte bootloader key that is required to switch - the chip from bootloader mode (default mode) to - application mode. - This property has to be specified as an array of 8 - '/bits/ 8' values. - -Optional properties: - - reset-gpios : the reset gpio the chip is connected to - (see GPIO binding[1] for more details). - - touchscreen-size-x : horizontal resolution of touchscreen (in pixels) - - touchscreen-size-y : vertical resolution of touchscreen (in pixels) - - touchscreen-fuzz-x : horizontal noise value of the absolute input device - (in pixels) - - touchscreen-fuzz-y : vertical noise value of the absolute input device - (in pixels) - - active-distance : the distance in pixels beyond which a touch must move - before movement is detected and reported by the device. - Valid values: 0-15. - - active-interval-ms : the minimum period in ms between consecutive - scanning/processing cycles when the chip is in active mode. - Valid values: 0-255. - - lowpower-interval-ms : the minimum period in ms between consecutive - scanning/processing cycles when the chip is in low-power mode. - Valid values: 0-2550 - - touch-timeout-ms : minimum time in ms spent in the active power state while no - touches are detected before entering low-power mode. - Valid values: 0-2550 - - use-handshake : enable register-based handshake (boolean). This should - only be used if the chip is configured to use 'blocking - communication with timeout' (in this case the device - generates an interrupt at the end of every - scanning/processing cycle). - -[0]: Documentation/devicetree/bindings/interrupt-controller/interrupts.txt -[1]: Documentation/devicetree/bindings/gpio/gpio.txt - -Example: - &i2c1 { - /* ... */ - cyttsp@a { - compatible = "cypress,cyttsp-i2c"; - reg = <0xa>; - interrupt-parent = <&gpio0>; - interrupts = <28 0>; - reset-gpios = <&gpio3 4 GPIO_ACTIVE_LOW>; - - touchscreen-size-x = <800>; - touchscreen-size-y = <480>; - touchscreen-fuzz-x = <4>; - touchscreen-fuzz-y = <7>; - - bootloader-key = /bits/ 8 <0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08>; - active-distance = <8>; - active-interval-ms = <0>; - lowpower-interval-ms = <200>; - touch-timeout-ms = <100>; - }; - - /* ... */ - }; - - &mcspi1 { - /* ... */ - cyttsp@0 { - compatible = "cypress,cyttsp-spi"; - spi-max-frequency = <6000000>; - reg = <0>; - interrupt-parent = <&gpio0>; - interrupts = <28 0>; - reset-gpios = <&gpio3 4 GPIO_ACTIVE_LOW>; - - touchscreen-size-x = <800>; - touchscreen-size-y = <480>; - touchscreen-fuzz-x = <4>; - touchscreen-fuzz-y = <7>; - - bootloader-key = /bits/ 8 <0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08>; - active-distance = <8>; - active-interval-ms = <0>; - lowpower-interval-ms = <200>; - touch-timeout-ms = <100>; - }; - - /* ... */ - }; From patchwork Wed May 26 23:03:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 448230 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp5658071jac; Wed, 26 May 2021 16:15:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw3NLw6C6JESFZ9bL7enP7IMy1bPT6STETlfJoVI7IlkS7p2HenWXnU3JsoIkp2cRrTlThV X-Received: by 2002:a02:9621:: with SMTP id c30mr552606jai.113.1622070936066; Wed, 26 May 2021 16:15:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622070936; cv=none; d=google.com; s=arc-20160816; b=V+/wYquqO4/Pfi0Re3zp0EKSz5EAuhiMoROP8ePjEvzgv8B8P0b5yWgY3cgK2W398g ttYWN2L63mDJpAi61Jl0uEDoeEo0S0ZBvj25Uaz4JuK9VbqZdn7uQqA7ke7/wcZmZubP fGPTeGAm4QfoLKN1fhajyv6Fi+diSM3vBHluAC8U0V3JokuzH/hZUIxlN36bK3DZTbiY klQY95cbto9cKDh1h3EN0o3kNTb66mr3NcYDtl8Za8TuUQFeSlleYyOSXc6ImATNN2rB Sri0emw/yBUfyyNR/MNIxHj/vwIlgMyyJw0WXOiCmdgaaNwGQKNkNCZL74vYVAI1qy5l Ha6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=LQ+NVSE12x9Re+JEwRuLPo0/XN0+woXtggWLeLMlBSI=; b=CtawPuOV6m20u4eKUAM4RjZXpWwx3beaxYUXziy+/ATFYtxyNkToWk6m9660kINqJ+ ONYrNzPqCIPREMq+4GU4Tbn3ys3Z753bfmMXZVdkSD0Blb2UaqkdPEeo+bgEVQLsmJ8r t6ysLGiG4HSIZQsuL98w+nLrONy5z7rXAVRcn1UFNfz6JV69zCIzG/x3/MHc7p5HoTUs K+bBIcsRhk/qVvv1vIkkgl3/ItUENJqtbVleqly4XJ7J/WAc60iNgYGVR8F0BZvtuvVB mmhWS1nbBrUg2zsPxsdgFEhVrKfhVLwBp+CVH2VjQoggJkO/QCRr269pXQXNsdALc6Q0 tuog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DfqfE95R; spf=pass (google.com: domain of linux-input-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-input-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h6si628212iow.71.2021.05.26.16.15.35; Wed, 26 May 2021 16:15:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-input-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DfqfE95R; spf=pass (google.com: domain of linux-input-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-input-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233103AbhEZXRH (ORCPT + 1 other); Wed, 26 May 2021 19:17:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39624 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232367AbhEZXRG (ORCPT ); Wed, 26 May 2021 19:17:06 -0400 Received: from mail-lj1-x229.google.com (mail-lj1-x229.google.com [IPv6:2a00:1450:4864:20::229]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B8228C061574 for ; Wed, 26 May 2021 16:15:33 -0700 (PDT) Received: by mail-lj1-x229.google.com with SMTP id o8so3889864ljp.0 for ; Wed, 26 May 2021 16:15:33 -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=LQ+NVSE12x9Re+JEwRuLPo0/XN0+woXtggWLeLMlBSI=; b=DfqfE95RBJx7pZLX2Wbbhwz0+1zjSVyxH0Lb/14Sn1Ifwggl2alBcGXEpPG6zNzvH/ sDhMBPRZGBeOafA0Odim1v5Uq4wtwi22/AaWIrFFUrrjwv+1hUULfZr8cC+Vy6uAxGUb uQ1msYk0gnlGhDOidTxXy6w4THuW9xu1WFCY0VO0jk7+WJ3QY1zVSj08NK78SW4rEIun m+A4ZG7sEdyl+w+XT00q/Yys09Jlla51ltojh7iD3bS9gAnZ42W/s9RcYMpPOePoti4P gDr3bTWWcwQ5CIP9ZoTMoTvy88Otr398cRUBF9FhaB21i6E2/ng5FY0NpI7UBjwQfNPS BgsQ== 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=LQ+NVSE12x9Re+JEwRuLPo0/XN0+woXtggWLeLMlBSI=; b=TtQDORbHwouJ3GtTPJQ+nsh8+E09t/QZUYvjaw0fydZwvO8qajyvmU2U2kK0oSEPkQ hy/UTfw+hap3LI6B2rJlLhtgqIv6+LHWNYyuucCVOg35/lMknqgL7UyhQmVn1EmcX9NC RSyR5C++att2r0ExfvWvvwawVUfb5lFHuI50k9nJ1ZsIlMD8G3GG6X/oNehESd8BCQcG Ygxpl4ii9NymWSt0UcAp+k4fN6FNKcByYBhzlEHqaOaQnkrSmNtmIGT+xLmhLnkh4ySD GIg4J8vnA9LHG1JuleeREaItJ5OjWY3Cz6T4CTpqTos0agJF6i4vWAK905SYoVUAMyzs hZOg== X-Gm-Message-State: AOAM531NpPyR/XB31qFN2kNi29cTqmbOm2K70ciW+8+TtxPHVz8jVyWx LUHgk3ax+jSapW6hEVP49FC3TA== X-Received: by 2002:a2e:b54b:: with SMTP id a11mr303092ljn.459.1622070932090; Wed, 26 May 2021 16:15:32 -0700 (PDT) Received: from localhost.localdomain (c-fdcc225c.014-348-6c756e10.bbcust.telenor.se. [92.34.204.253]) by smtp.gmail.com with ESMTPSA id w21sm35415lfl.117.2021.05.26.16.15.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 May 2021 16:15:31 -0700 (PDT) From: Linus Walleij To: Ferruh Yigit , Dmitry Torokhov , Javier Martinez Canillas Cc: Henrik Rydberg , linux-input@vger.kernel.org, Linus Walleij Subject: [PATCH 2/3 v6] Input: cyttsp - Probe from compatibles Date: Thu, 27 May 2021 01:03:51 +0200 Message-Id: <20210526230352.1433537-2-linus.walleij@linaro.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210526230352.1433537-1-linus.walleij@linaro.org> References: <20210526230352.1433537-1-linus.walleij@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org The driver (both SPI and I2C interface) should probe from the compatible strings, cypress,cy8ctma340 etc when using device tree, not as now, where it is probing implicitly from the I2C/SPI node name "cypress,cyttsp-i2c" etc. Reviewed-by: Javier Martinez Canillas Signed-off-by: Linus Walleij --- ChangeLog v5->v6: - No changes just resending with the other patches. ChangeLog v3->v5: - Rebase on v5.13-rc1 ChangeLog v1->v3: - Add MODULE_DEVICE_TABLE() for both sets of compatible strings. - Collect Javiers review tag. --- drivers/input/touchscreen/cyttsp_i2c.c | 8 ++++++++ drivers/input/touchscreen/cyttsp_spi.c | 8 ++++++++ 2 files changed, 16 insertions(+) -- 2.31.1 diff --git a/drivers/input/touchscreen/cyttsp_i2c.c b/drivers/input/touchscreen/cyttsp_i2c.c index 061debf64a2b..0a09f07bc23a 100644 --- a/drivers/input/touchscreen/cyttsp_i2c.c +++ b/drivers/input/touchscreen/cyttsp_i2c.c @@ -52,10 +52,18 @@ static const struct i2c_device_id cyttsp_i2c_id[] = { }; MODULE_DEVICE_TABLE(i2c, cyttsp_i2c_id); +static const struct of_device_id cyttsp_of_i2c_match[] = { + { .compatible = "cypress,cy8ctma340", }, + { .compatible = "cypress,cy8ctst341", }, + { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(of, cyttsp_of_i2c_match); + static struct i2c_driver cyttsp_i2c_driver = { .driver = { .name = CY_I2C_NAME, .pm = &cyttsp_pm_ops, + .of_match_table = cyttsp_of_i2c_match, }, .probe = cyttsp_i2c_probe, .id_table = cyttsp_i2c_id, diff --git a/drivers/input/touchscreen/cyttsp_spi.c b/drivers/input/touchscreen/cyttsp_spi.c index 54e410921d53..8715e5354d79 100644 --- a/drivers/input/touchscreen/cyttsp_spi.c +++ b/drivers/input/touchscreen/cyttsp_spi.c @@ -160,10 +160,18 @@ static int cyttsp_spi_probe(struct spi_device *spi) return 0; } +static const struct of_device_id cyttsp_of_spi_match[] = { + { .compatible = "cypress,cy8ctma340", }, + { .compatible = "cypress,cy8ctst341", }, + { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(of, cyttsp_of_spi_match); + static struct spi_driver cyttsp_spi_driver = { .driver = { .name = CY_SPI_NAME, .pm = &cyttsp_pm_ops, + .of_match_table = cyttsp_of_spi_match, }, .probe = cyttsp_spi_probe, }; From patchwork Wed May 26 23:03:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 448231 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp5658104jac; Wed, 26 May 2021 16:15:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw2BIgInGZ52CkwAjhd9lQh/9Z4vPvQPc8RHOSXEgktaySIwCMrut4z/owRNO/GCdqudObl X-Received: by 2002:a92:b30b:: with SMTP id p11mr564224ilh.114.1622070937626; Wed, 26 May 2021 16:15:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622070937; cv=none; d=google.com; s=arc-20160816; b=mtPmVB4STWSlRkB5vRu7atDUXVIE8QgOzT+WpWUiNCmRPJTk6HKHrFak+gC+xMsnoh LXN/YtVDQJZzaqEyWfrKF8PRL4DU/1ziS1oTpcOT4uZjQd8V0Cv9Daoar+RF4ENINbiI XZppgOyDfEIR7lFeTDYOo8soOuITcwh047EPruw3EXyvX6/1tMQghpZhGHxa4WQrPx9j l/goHW7hxge7O9n9sN9Thra7NiIaeWf+IFRKa5yJz5i/wgIG4Hz5Czq5uqQTO97rTZra gYr2jbJ1FSReX6LX35MJMjpTOIZ2hbOGs3NCi02iE+lnXGpd2C6MeY89ptA8jnoNmTAv nLNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=0DjTaqYVmw4sFTfSYb46C13BK1sRLGmvwIDf0owRwSk=; b=TaydLPq8vrS1XvK7PZancMmNi+C0hKpGlEVZENhjb6Pb2BoecRVcKNKMT4qCLtkOhB sVqmj9vYLleot20MHEX1NqjX3yiTx+6U31B6Ci4eDaT21k23X8ZQ42+MjU9AJV9z8jPa 29a86Z0ndykt8ukJ29OuZdKC26redTdXhZAQ6+GayepDySsHGWsfpEmpLty6IYCFBwbD w9AXDSrSX6WJk/ISBdIjjP4Dhok46BFYZwFenSxcxvEmA6fT/p3dFrn/jL/XHHLgk7l5 j4BF5yDFIM+4IU66JjK62gU5doZHQCs8FuI1OWDm4Nj6PWZKjvXP7q/q4yyhTyxC3XP4 zxtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TynxlRzq; spf=pass (google.com: domain of linux-input-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-input-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h6si628212iow.71.2021.05.26.16.15.37; Wed, 26 May 2021 16:15:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-input-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TynxlRzq; spf=pass (google.com: domain of linux-input-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-input-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233302AbhEZXRI (ORCPT + 1 other); Wed, 26 May 2021 19:17:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232367AbhEZXRI (ORCPT ); Wed, 26 May 2021 19:17:08 -0400 Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16398C061574 for ; Wed, 26 May 2021 16:15:36 -0700 (PDT) Received: by mail-lf1-x130.google.com with SMTP id f30so5080661lfj.1 for ; Wed, 26 May 2021 16:15:36 -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=0DjTaqYVmw4sFTfSYb46C13BK1sRLGmvwIDf0owRwSk=; b=TynxlRzqScTpSMQ7lnK75RqB4QCwli44vGogJISQvqvE2WpcR3mse6HlIPnY5SR7H3 NrFVcTUWMF4LxwyqVik6lITXkqcFD+40f3xxfevXQAdc8quqdVXCXb389iT5w8DnGjc+ fB62x8ToPwcivGsHhT9dMEro0+BijzgYRwX/8H4v6dZ+HPQI898S7VxMF+ph40V7NiJv KaEKnD9ATFbvGdP+7ZpFT5DhBz7u14bLWxya+J99IYGX7zH075y8riCVdlGGWnoeKxJc hHcM0pBW+UAM36igd9DRAgS6ry2EP+EvcoyWq+4qtNrk7jXbmBdWJtGxHc1XzcgULXJz uMig== 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=0DjTaqYVmw4sFTfSYb46C13BK1sRLGmvwIDf0owRwSk=; b=j5ezo1A8QA5FhrVxtqpyTqKKMbNWxdMVIuwv4sGaUUDZhW1CyCzZUTnTqILN8HEcaK xgW7B4aXLQyrkhxPLshOtCY5GR7sY0fWbRiW2n+LtoUVlTKgLkBBgT67fcMnCsPxq5h9 9TCsLYSMy4b8HpVmYAHh6/fzoT4XH6niENC3oSy+Y1shQ684X+8z8veS/kWQoYQZi3Zv rhN4HK35D/AKvzhUrgIhe7L3z+tdOKo/M2hOlsRi56Re6UOZyESja/fEXg3cvIjMVT/u 8lJZ2OyZV40jfLqsFq7CJoecIjtFMjAm+M7I5Dm19qRdLzBbUrvZlv3nHIs6dAUqie2x Cx+w== X-Gm-Message-State: AOAM531Hb1rMnnAR0pywP/Q0Imkap85EvZj9/zOCrGy8IvfeFM7ABrwu PzH0FzoVQ29xoW+dWx+pMZHy0A== X-Received: by 2002:a05:6512:33cc:: with SMTP id d12mr324813lfg.42.1622070934436; Wed, 26 May 2021 16:15:34 -0700 (PDT) Received: from localhost.localdomain (c-fdcc225c.014-348-6c756e10.bbcust.telenor.se. [92.34.204.253]) by smtp.gmail.com with ESMTPSA id w21sm35415lfl.117.2021.05.26.16.15.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 May 2021 16:15:34 -0700 (PDT) From: Linus Walleij To: Ferruh Yigit , Dmitry Torokhov , Javier Martinez Canillas Cc: Henrik Rydberg , linux-input@vger.kernel.org, Linus Walleij Subject: [PATCH 3/3 v6] Input: cyttsp - Obtain regulators Date: Thu, 27 May 2021 01:03:52 +0200 Message-Id: <20210526230352.1433537-3-linus.walleij@linaro.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210526230352.1433537-1-linus.walleij@linaro.org> References: <20210526230352.1433537-1-linus.walleij@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org The CYTTSP TMA340 chips have two supplies: VCPIN and VDD for analog and digital voltage respectively. Add some minimal code to obtain and enable these regulators if need be. Reviewed-by: Javier Martinez Canillas Signed-off-by: Linus Walleij --- ChangeLog v5->v6: - Move enablement right after fetching the regulators. - Use a devm_add_action_or_reset() hook to turn the regulator off. ChangeLog v3->v5: - Rebase on v5.13-rc1 ChangeLog v1->v3: - Collect Javier's reviewed-by. --- drivers/input/touchscreen/cyttsp_core.c | 35 +++++++++++++++++++++++++ drivers/input/touchscreen/cyttsp_core.h | 2 ++ 2 files changed, 37 insertions(+) -- 2.31.1 diff --git a/drivers/input/touchscreen/cyttsp_core.c b/drivers/input/touchscreen/cyttsp_core.c index 106dd4962785..d9debcdeeec7 100644 --- a/drivers/input/touchscreen/cyttsp_core.c +++ b/drivers/input/touchscreen/cyttsp_core.c @@ -22,6 +22,7 @@ #include #include #include +#include #include "cyttsp_core.h" @@ -608,6 +609,14 @@ static int cyttsp_parse_properties(struct cyttsp *ts) return 0; } +static void cyttsp_disable_regulators(void *_ts) +{ + struct cyttsp *ts = _ts; + + regulator_bulk_disable(ARRAY_SIZE(ts->regulators), + ts->regulators); +} + struct cyttsp *cyttsp_probe(const struct cyttsp_bus_ops *bus_ops, struct device *dev, int irq, size_t xfer_buf_size) { @@ -628,6 +637,32 @@ struct cyttsp *cyttsp_probe(const struct cyttsp_bus_ops *bus_ops, ts->bus_ops = bus_ops; ts->irq = irq; + /* + * VCPIN is the analog voltage supply + * VDD is the digital voltage supply + */ + ts->regulators[0].supply = "vcpin"; + ts->regulators[1].supply = "vdd"; + error = devm_regulator_bulk_get(dev, ARRAY_SIZE(ts->regulators), + ts->regulators); + if (error) { + dev_err(dev, "Failed to get regulators: %d\n", error); + return ERR_PTR(error); + } + + error = regulator_bulk_enable(ARRAY_SIZE(ts->regulators), + ts->regulators); + if (error) { + dev_err(dev, "Cannot enable regulators: %d\n", error); + return ERR_PTR(error); + } + + error = devm_add_action_or_reset(dev, cyttsp_disable_regulators, ts); + if (error) { + dev_err(dev, "failed to install chip disable handler\n"); + return ERR_PTR(error); + } + ts->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW); if (IS_ERR(ts->reset_gpio)) { error = PTR_ERR(ts->reset_gpio); diff --git a/drivers/input/touchscreen/cyttsp_core.h b/drivers/input/touchscreen/cyttsp_core.h index 9bc4fe7e6ac5..8eba9d8ba74a 100644 --- a/drivers/input/touchscreen/cyttsp_core.h +++ b/drivers/input/touchscreen/cyttsp_core.h @@ -23,6 +23,7 @@ #include #include #include +#include #define CY_NUM_RETRY 16 /* max number of retries for read ops */ @@ -122,6 +123,7 @@ struct cyttsp { enum cyttsp_state state; bool suspended; + struct regulator_bulk_data regulators[2]; struct gpio_desc *reset_gpio; bool use_hndshk; u8 act_dist;