From patchwork Sun May 9 22:34:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 432878 Delivered-To: patch@linaro.org Received: by 2002:a02:c901:0:0:0:0:0 with SMTP id t1csp2335733jao; Sun, 9 May 2021 15:34:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzJNWeRp77VUO/fvzBhFyTIAziT3udHqcebGy0Dq2z7RYsa84Dw5tSzar+kLRi+jj0EPVW7 X-Received: by 2002:a17:906:a10e:: with SMTP id t14mr22403849ejy.103.1620599676127; Sun, 09 May 2021 15:34:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620599676; cv=none; d=google.com; s=arc-20160816; b=KB9Lukd6LpnJ9DC/6c8sljuO00sLBngNVcJOZRG9xTR+/j5u6/4jxuxBAxzKH3pYIq PX+lmyWvUq/WBDBZ9BsTRCE9PxxA4AKDmrsrqhudemHfyeh8R9r07Ao9CxAyE0nndr4c Rfzkmi07B1knyYl1sQg3L8HovxwpnGACo6CD9yPLt6Ny2HHOvL1EDyOPXDBFpUXK6XdW lda/hYEwYIVCl1Gh50hhbzeu1s8LHTCXUsXc4PdlcFKf/bpA/IsD0Id3YyJrT7LNWxW6 j9jY9QOEuKeokBeyET7oXF/KKTswJOpxXduR80zGolJae4y1imikCjMoN8aFlP2cw+Kw WG+w== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=F2EjP7ONijriLAGyy1GD+73Mqbm5Yex+dE0Su5lhmX4=; b=irtXhOtWMOuQNxQmO24MC6nP9U8XEpCWz3gGe1krmfPLG+x9qzYYXf/oBi6mbZVyXW BNioUELPwLDWdgKIgxttmq4zhzY6Ir310dkrvf3cw6/A8Fh1OTwQtunOmFroKK/iAQWG v20xvHDfs6KD3RP7RvmYvxzC5WkESNgMj2zFNq1v+sObgBhNodepu8tkTX++Za6Jggx2 nxp79M7xbIZ/ldVM4vUqMkFmX9U9BJipgDbDH1Nm7MNVxV8XDadYi4XQTidTwmG6GVP7 CNud15v+pxdjxWh3xGqv08JRu0hrddlEFtBRX1MO1QfKVdLust3jDhUWhRv1AmFQKe/W L3zw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="dViwsTi/"; 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 n2si8741324eda.470.2021.05.09.15.34.35; Sun, 09 May 2021 15:34: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="dViwsTi/"; 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 S229840AbhEIWfe (ORCPT + 1 other); Sun, 9 May 2021 18:35:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229815AbhEIWfe (ORCPT ); Sun, 9 May 2021 18:35:34 -0400 Received: from mail-lj1-x22b.google.com (mail-lj1-x22b.google.com [IPv6:2a00:1450:4864:20::22b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5390BC061574 for ; Sun, 9 May 2021 15:34:30 -0700 (PDT) Received: by mail-lj1-x22b.google.com with SMTP id w4so18469019ljw.9 for ; Sun, 09 May 2021 15:34:30 -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=F2EjP7ONijriLAGyy1GD+73Mqbm5Yex+dE0Su5lhmX4=; b=dViwsTi/pv287wM14WT1JQY3Z4swpMoG6XO+Tra+zT0ZjBoKkjx9LnB4D0z5Uyr0ej STVvwwc+QaPcb3HUCBC58qQlKM6IQWumu8sOXl6+iYEt/F5KgQzDVcG/HH7Vwbu+9vmu EenO5CwcW6vu0nxkLq8ckC6avcJ+z9XeREofOyrvXwKpTt3a+NWTcTjeIKBpWYwmUUwH 8fTQRIKEkJVhdDtaI4jKJZfs2CooG1edcjrxaHEOATMDcJAWBBvP4ObyNovs9cMon9RJ 5K6ngg/kiykcjZAZAmov+aZ/b2JesD6sBRbSOfIAU0PJx2Yalloehm4DbAACLbXHWF/u ET7w== 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=F2EjP7ONijriLAGyy1GD+73Mqbm5Yex+dE0Su5lhmX4=; b=uTg0oantRryPVfGnu4WxaPSyOmBtvrio/+w6jkWZ+NrWZ5tGTNbyw7zCQhrV00j1i0 UZTebr9+OB3zT5LyhiOOAvWzGvYZKCV5vQcY1+HCOPeS8pLsgg7HfLbMdvXnF92nzLYi tn6ZjSYZqIS4T0dQL2+6FpHdbXm1mXpwYWe5I8jAz58MCorKPa5T1W2kuP9PN4AZJiSQ NysEjK90ERUepQYZcu+z9VJ21+5b8tjSmzTT1nRc/VP96q2NLPQjeMPlyqfA0aLMmDb1 91EI77baFOrjcPS6mPqw7WVZrQme4KxAJ9M9qd2pvRmN6Wao+GOXxjuojZ4lhdMu2GZl VMSQ== X-Gm-Message-State: AOAM530IjpelWOsLD8LgmjV/8XoaD/msOEt67qAusO8pyib1WZeIFeer dI5ipLBrZGEbj1UbQRSDgral5g== X-Received: by 2002:a05:651c:293:: with SMTP id b19mr17556040ljo.451.1620599668543; Sun, 09 May 2021 15:34:28 -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 a16sm2022257lfl.51.2021.05.09.15.34.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 May 2021 15:34:27 -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 v5] Input: cyttsp - Convert bindings to YAML and extend Date: Mon, 10 May 2021 00:34:14 +0200 Message-Id: <20210509223416.346104-1-linus.walleij@linaro.org> X-Mailer: git-send-email 2.30.2 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 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 -- 2.30.2 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 Sun May 9 22:34:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 432879 Delivered-To: patch@linaro.org Received: by 2002:a02:c901:0:0:0:0:0 with SMTP id t1csp2335738jao; Sun, 9 May 2021 15:34:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwSGzJhUstgMOeqjV8N6oWxEfR80oxLVB2F52yZLUscHEnWP2B17oWtOyqLiluXbzB9sxoP X-Received: by 2002:a17:906:fac9:: with SMTP id lu9mr23172858ejb.29.1620599676563; Sun, 09 May 2021 15:34:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620599676; cv=none; d=google.com; s=arc-20160816; b=b6tpT5RrOTheCEvxZQiHtOOXCjJdEZWCtG7ll38NCkUSkjUIOwEodNE6MYquvZ6XAE VzTtEHrow1DLCHfwYTl5JlVec6OqoLQc/RmpMq2FkZ+/jgj325Hr4sf0SePAZcF2r1Ht BNIw5/SlGF7kCA9fiZQZvT0YGfkT9boqRD/2uwL0768maB10ClPuQumcPtgVBvWGR48v I4m6yNB9yNhK2HwOAh6GxHo0ne2V7UT95GuRWzgaZMsE+JIpmjqXL2QdkB2kCh0hdLJK XaZwnobOtmU5/a99qTZUDXoW3hJfp1QIAxQA55PzjswMpXJ+/6Go8mPflrImbr3k9ruC QZgw== 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=Ar6y7hws/LzmglxytevCO91fs4jxRRoR8GPk0J3Q6Ac=; b=cj2+f3C1ixkJipjsOIw1x5u63Vrb8VHtHYFJnOMPGdlefb6tpyjcRGj5QKAD5NZeMF Z5nU4gxGjkINH/hVUNJq1z8kUqHRJ6l3etZl3du8PljItjMSMFEY796OJsfkB5iimlvf 5cwI9KWmd6VxH1aI3YBe1oTyL/nezHqlyxW0LtX/ZQncoqssBJUCMrLwhdgz4VsxIK7I Xi5zX5W+o/CYa/8+XfrwFHOph9KXlECwyfm3PaD90vs4l2C6HeXH9HZ6Dc01milBcazM t4NtqaxhtVDTqXNgBo85JkdV7DLzjk7q7V12QSpbYPBjdlx1VqllLrxntGu90NEfqNc3 daAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=B2ePBmDE; 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 n2si8741324eda.470.2021.05.09.15.34.36; Sun, 09 May 2021 15:34: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=B2ePBmDE; 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 S229876AbhEIWfh (ORCPT + 1 other); Sun, 9 May 2021 18:35:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50486 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229847AbhEIWfg (ORCPT ); Sun, 9 May 2021 18:35:36 -0400 Received: from mail-lj1-x22e.google.com (mail-lj1-x22e.google.com [IPv6:2a00:1450:4864:20::22e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0124C061574 for ; Sun, 9 May 2021 15:34:31 -0700 (PDT) Received: by mail-lj1-x22e.google.com with SMTP id v5so18458604ljg.12 for ; Sun, 09 May 2021 15:34:31 -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=Ar6y7hws/LzmglxytevCO91fs4jxRRoR8GPk0J3Q6Ac=; b=B2ePBmDEqXYd1ZSE44p4Adatv2UF08L/P1xZs+SElkXnTBiLN1wstcyjuJaoOOPXf4 it9m/N6jTlMhOyA4UJ1Cw2DErkIMGmej0Ryh3AhaTR+bo+m2e2BFdHeQMFrMzDfGvXC7 v+8mYYEc65TzxTnKnduCJ20/SjZt7zbkB/DxRj4M/tflYfJIMyeNbWM+VMcNuaQKyeYW pCCksg7JWSA+NnEvQVILV8ZNo+Tr8khRwH8AayBtqedOxYsh0MuR66lvc4hc7X6hvOYc tlCOhm5/K4h46jwkgCvmBxzgu9nmRUQ7pRNUDMjKWTHcAzWk1hX1rKTX0KTNT9AW2kvI FSjw== 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=Ar6y7hws/LzmglxytevCO91fs4jxRRoR8GPk0J3Q6Ac=; b=JUSGvVtfiBpTWGyCvZ7O7xsSwim+N9N9eHBzhuln62sfP6m8/k2eQWUwX2paJ2rrPT C7gQm1ikVqQGsIdheyB95tH3PA+USQb453lLvoe5bDJgM+Mc2IQ2FQcW1ABXL8n530tG ppPTyOFtXMT4E1fWjt+AnxIk/wwSNHXeppEw0imfdxmIiAoBvBI7M1nTtNvAwIV7qDFW 6Qd0d1WrduG5j1dV5y37qjJcNg2adgYqZp3YQ9XgtXl36pctp965mgvspaTUhvQxf2oT jeK5ROFDgOiYMcX8fIMalZ7XHksSHGvaiPDcKwba3ID32TqXzErQuz1Km2Hsds2J+z3L B52A== X-Gm-Message-State: AOAM5336qTQ+JOAPmo2PtmanesPN+EPEkUTp1o/IQ9kZ4FD9lQecmIv2 oAGWR3XTKutqOXlVKyX2k4a8Zw== X-Received: by 2002:a2e:9ad9:: with SMTP id p25mr17858683ljj.127.1620599670507; Sun, 09 May 2021 15:34:30 -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 a16sm2022257lfl.51.2021.05.09.15.34.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 May 2021 15:34:30 -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 v5] Input: cyttsp - Probe from compatibles Date: Mon, 10 May 2021 00:34:15 +0200 Message-Id: <20210509223416.346104-2-linus.walleij@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210509223416.346104-1-linus.walleij@linaro.org> References: <20210509223416.346104-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 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.30.2 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 Sun May 9 22:34:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 432880 Delivered-To: patch@linaro.org Received: by 2002:a02:c901:0:0:0:0:0 with SMTP id t1csp2335750jao; Sun, 9 May 2021 15:34:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxjbpaCSw3oZAvoWZTRaRebJ4DFGKZarU2H33Ox20h49wxU0TQ2cHEg2/rfq7B5mTf9Is9z X-Received: by 2002:a17:906:1b09:: with SMTP id o9mr22571396ejg.102.1620599677637; Sun, 09 May 2021 15:34:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620599677; cv=none; d=google.com; s=arc-20160816; b=dAtztguRKicEvVZyIKWDeC3twMU/dL9adQLBAfpA91/4L3VnZE9C9PlJ/SCr+0uy31 rNkb43SrEaXphIP/F8YSQxcsORSeeiPWin0DXBpWmvT7RCjo0uCK/h4vRi0pmYSe7Yq2 69CPj1SYquVK5u+Mt8dtzsMzsE9NqS9Z6PT3wLLf9BluNkiRZu2zIl+wdGlJ9/zD1qvl yWEc1fCw2ol+W3tuZRdQbnZQZbNccUIE+JjixdiFktjxqSqxyU2pwOup4arYQrulnpPz zOuCyuCYf4FCy5Iycc1uMuLPjrZZDp1bURNSzKG34dltY+rk670MlELa5V2OF9EvnOBe 4UwA== 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=/XEFvoPEC4OvoR2e/02RptgwEhAcqU67gkc7kt6cnxs=; b=H6fxpnz/SnfFE5sCx0DyeAq/78HVlbVG/9v/SDjbbcsKAMTpKwg743F6VJYVFZtBiT 3NlxjPDk0Gw7tiyMQETNICE0jIXDeAvi2+cIiwDsIy7i4hNbFO0Ulnux+hbH26Qvcy/+ s6OWRQnCZIWa/yMHCw3m5+rJXpQ7AAk6w5JslsNrN5uYQS66m/fNwpwpH9Cmwas7gDOR AbfyWojx9x9vc/JJ9qh8UM+X9hV0EZuWYnCjxhBe6ul3XiBOQfv3QeIXzzEFEzm4PVdZ DZF0OOjM6iX1HOY41uRJ+57rQPJKQVNi34N4FTJwOtFNSI3G4ecFx/eG+3mcJgxI5/06 v6tw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xndKYbbw; 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 n2si8741324eda.470.2021.05.09.15.34.37; Sun, 09 May 2021 15:34: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=xndKYbbw; 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 S229847AbhEIWfj (ORCPT + 1 other); Sun, 9 May 2021 18:35:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229815AbhEIWfi (ORCPT ); Sun, 9 May 2021 18:35:38 -0400 Received: from mail-lf1-x12b.google.com (mail-lf1-x12b.google.com [IPv6:2a00:1450:4864:20::12b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DDFE8C061573 for ; Sun, 9 May 2021 15:34:33 -0700 (PDT) Received: by mail-lf1-x12b.google.com with SMTP id h4so20604037lfv.0 for ; Sun, 09 May 2021 15:34: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=/XEFvoPEC4OvoR2e/02RptgwEhAcqU67gkc7kt6cnxs=; b=xndKYbbwsWOL44jQWznLh01SJuKlxf9TFsfpLaVW2PXcvwI2AH9SooYs7kIe07vS2v PY4UWTyhodMl7F4kzjPAwg1D+iDeUgL+NNncnU+4X3+OU0B4UFylY4ddnmeCz1Ho8Cc7 pRFYCi9fLzD0yuvEweM/KI6/ALJ7ostMq6VQ1+kX7y25la5pSCDiaxt+cHIaKDwmqJAD mQi0RzeEhDCXIt7L6J+YMbGFNJOlBjp9VX6R3qZzsGWuHSp/sV4CEAYJ4vo0bRjejS5G EALJM5fAO0VeoC4x6ICE45gAZ8PtEyGAR3LXXf2KsGamWBhZVMjgFdjfxWqadyorinb/ xfJw== 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=/XEFvoPEC4OvoR2e/02RptgwEhAcqU67gkc7kt6cnxs=; b=EZZzIXTmXvmX8Re9mOeUAn4Tv+tsBB9b0Yjne9f7o7ElU5LP83BBdke+7zuN0SZR8f /wcMeCdswFw4seMCa5uxKN2AhYN5CM3Dd4ZLhC74WYh0Mw5PrGxKJRXfCW+vpM7qfj65 J78HiBIhWC1exieDKjUZQv9LxYB6wQN3jQSF4eo6qi2jTFMEBu0EFIKb6eJC0gFN1M+o yomwM9bVT/zFvCFiLS3vHrK+j3GQdnOWJ9Obxnxp9Johdeo3DYaTJBtYh8ZP1X1YMXdr p6EIRqlizsKAxDd/76V73bjWJBxb9alfMNt6V2Ut47l7+LjQwgNl0IKh0SHme8dHSOyC MBfA== X-Gm-Message-State: AOAM533ih1jM+KX6Jy9ICmiAFW5hEqsMx9ID4sJCjMtEfcgVwMgzsjx8 5YAr86HNQSfrg/BaTp1e8iIZhuuDvUtDOg== X-Received: by 2002:a19:f707:: with SMTP id z7mr14421374lfe.653.1620599672289; Sun, 09 May 2021 15:34: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 a16sm2022257lfl.51.2021.05.09.15.34.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 May 2021 15:34:32 -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 v5] Input: cyttsp - Obtain regulators Date: Mon, 10 May 2021 00:34:16 +0200 Message-Id: <20210509223416.346104-3-linus.walleij@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210509223416.346104-1-linus.walleij@linaro.org> References: <20210509223416.346104-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 v3->v5: - Rebase on v5.13-rc1 ChangeLog v1->v3: - Collect Javier's reviewed-by. --- drivers/input/touchscreen/cyttsp_core.c | 30 +++++++++++++++++++++++-- drivers/input/touchscreen/cyttsp_core.h | 2 ++ 2 files changed, 30 insertions(+), 2 deletions(-) -- 2.30.2 diff --git a/drivers/input/touchscreen/cyttsp_core.c b/drivers/input/touchscreen/cyttsp_core.c index 106dd4962785..5af4d034b36b 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" @@ -628,6 +629,19 @@ 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); + } + ts->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW); if (IS_ERR(ts->reset_gpio)) { error = PTR_ERR(ts->reset_gpio); @@ -673,20 +687,32 @@ struct cyttsp *cyttsp_probe(const struct cyttsp_bus_ops *bus_ops, 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); + } + cyttsp_hard_reset(ts); error = cyttsp_power_on(ts); if (error) - return ERR_PTR(error); + goto err_dis_reg; error = input_register_device(input_dev); if (error) { dev_err(ts->dev, "failed to register input device: %d\n", error); - return ERR_PTR(error); + goto err_dis_reg; } return ts; + +err_dis_reg: + regulator_bulk_disable(ARRAY_SIZE(ts->regulators), + ts->regulators); + return ERR_PTR(error); } EXPORT_SYMBOL_GPL(cyttsp_probe); 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;