From patchwork Fri Jun 25 11:34:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 466839 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp1368924jao; Fri, 25 Jun 2021 04:36:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx12+qrIA+ijaCVc0cy2hw5H82s0Ozr8P7yxz/xBBno94kjoOvrDYfB3wWv6PDy8a2/fvjt X-Received: by 2002:a17:906:1792:: with SMTP id t18mr10252719eje.38.1624621010314; Fri, 25 Jun 2021 04:36:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624621010; cv=none; d=google.com; s=arc-20160816; b=oWDbgpzOQ0fPyn70wb+uA+AAgCy93mMKHA3rX4w1wkeUJCCR5+qbinZyPR9WfwqJMP vmqOOF3tm2WZYPUlGIScSu8hyBU6jzKVY1g0m+9SMN+6eRRJLjTk3UrjjdWPen5ZFRZ0 7ztU+YTHzVn35nILKLKlr6e13Muedfj1RfWJZcFTLFC29VO1RocAMWQbKkLKtlBPe0Yl z4PoGSFVYlxepr4y+rmMO3yep+d6go6r9/ha535d6BfbHJigVrjLt3YICXguMhdguDOF uOPxsH6/sKUhD301J534wB9kSj2oQbnAjH08IH1SkjzgKXhS4dvOG2G4V+eb7iPEIGiv RXHg== 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=mFVix5hj4qMWkWTebg8/V8+S9K9ne/G74p8v6BIfU6o=; b=IvArQm3sZfYv8ukMG06xdZF7hYTSKnGno75JGP8Mo6ZLax4dsaJ1oREqD4WAScWmeN sWQqNU+XzCFWpq4qIC9/HzDTsvsMEvUFhIQml4qrHTY3VvWD79WWF3XqwuLqL2rpUSdr hl+qqk33p2RHJSO2i2qdQwy4ZWokO7VZcx/h1Daz5bG7e/cJNlt75qR4koqlQ94rHH0s BYxqqjw2xvhhd3mKPQkFOj0FGX72zH1H7tRHOKExmJOA0fyqC8mKtOYAnuUoVs6pGH22 hnIfCen3DLf2obGM59tWZKVWkJppgWf/WTbI++RYLeHYz+3ETFT4x9MXVRcsNudFexEY 8KYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=I2So+MXm; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-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 eo22si5679431ejc.52.2021.06.25.04.36.49; Fri, 25 Jun 2021 04:36:50 -0700 (PDT) Received-SPF: pass (google.com: domain of devicetree-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=I2So+MXm; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-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 S229498AbhFYLjJ (ORCPT + 7 others); Fri, 25 Jun 2021 07:39:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229458AbhFYLjJ (ORCPT ); Fri, 25 Jun 2021 07:39:09 -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 25C28C061766 for ; Fri, 25 Jun 2021 04:36:48 -0700 (PDT) Received: by mail-lj1-x22b.google.com with SMTP id z22so12063760ljh.8 for ; Fri, 25 Jun 2021 04:36:48 -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=mFVix5hj4qMWkWTebg8/V8+S9K9ne/G74p8v6BIfU6o=; b=I2So+MXmqnpvFXypMoaFVV6uKyzK7GRRg14dhmjcbQaxRXBweaj2GX5hHc00YS6YRc kqNOoF7S4ESkn2VDsouQFHdx5zMYdbQaHyS1Zouc4VTgJkpdWiyIJHNqK9g91PxbpGRr xustDbI3DEeAOrO8FxjI7O/HA+SC/n2gefMOGdr+DoCU3ihT4wyi8+fmL0XGCq5qcUtk P1tbAxddEoFqC4FFN3rBSJIfI5TkD0WVbng42trX0B0Uy196AUuxCEOQT8l7NzT4mbM/ QINoGWYJ2T1KicpeY3kAKyc/rhBfX6kebAjGkl4e4FXYBUSYeu7+P1Gd2oH4g8fLtdfv Jt6A== 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=mFVix5hj4qMWkWTebg8/V8+S9K9ne/G74p8v6BIfU6o=; b=kGZkCFixZi3XXEZIAZ+2BsB/yEXb1+d53M/5W74YSYK1vOecfkukQpEsg8g+sQNZIU gAiCjxOt0m/t0jFV/CBzEdwGfjxvsM/5VDjcyTlVVRDgZXjc1jLmp/xPghjD8hQRS4vU y2XbH40GJcQf/yuM+JOd4R0crI4btUUSKM3Sc8irkd/wp8MOlaTsOQkVfcWbUV0++dCU IjqqpndQpEx8MpxFP21WyLlULlj+2xXNDcGg62lCqw8mVSnxx9P+857KmjLstXTE/in1 +18gnhPaw236C4C+MYtAekhIzAfL2DizXRjIUj4Sehyw2ZEZMXcm+Bi44T3kKE4E6dKu 3eOw== X-Gm-Message-State: AOAM531E+xOKVfD5w35ipazXaEP26+3PLnpyo9e60uRi0i+oeydDY5NS mZ6FiCNFmyCH0bI2O8BFnF7wVQ== X-Received: by 2002:a2e:8ecd:: with SMTP id e13mr38921ljl.193.1624621006511; Fri, 25 Jun 2021 04:36:46 -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 g24sm489682lfv.228.2021.06.25.04.36.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Jun 2021 04:36:46 -0700 (PDT) From: Linus Walleij To: Dmitry Torokhov , linux-input@vger.kernel.org Cc: Linus Walleij , Mark Brown , Michael Srba , phone-devel@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH 1/2] dt-bindings: input/ts/zinitix: Convert to YAML, fix and extend Date: Fri, 25 Jun 2021 13:34:34 +0200 Message-Id: <20210625113435.2539282-1-linus.walleij@linaro.org> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org This converts the Zinitix BT4xx and BT5xx touchscreen bindings to YAML, fix them up a bit and extends them. We list all the existing BT4xx and BT5xx components with compatible strings. These are all similar, use the same bindings and work in similar ways. We rename the supplies from the erroneous vdd/vddo to the actual supply names vcca/vdd as specified on the actual component. It is long established that supplies shall be named after the supply pin names of a component. The confusion probably stems from that in a certain product the rails to the component were named vdd/vddo. Drop some notes on how OS implementations should avoid confusion by first looking for vddo, and if that exists assume the legacy binding pair and otherwise use vcca/vdd. Add reset-gpios as sometimes manufacturers pulls a GPIO line to the reset line on the chip. Add optional touchscreen-fuzz-x and touchscreen-fuzz-y properties. Cc: Mark Brown Cc: Michael Srba Cc: phone-devel@vger.kernel.org Cc: devicetree@vger.kernel.org Signed-off-by: Linus Walleij Reviewed-by: Rob Herring --- .../input/touchscreen/zinitix,bt400.yaml | 115 ++++++++++++++++++ .../bindings/input/touchscreen/zinitix.txt | 40 ------ 2 files changed, 115 insertions(+), 40 deletions(-) create mode 100644 Documentation/devicetree/bindings/input/touchscreen/zinitix,bt400.yaml delete mode 100644 Documentation/devicetree/bindings/input/touchscreen/zinitix.txt -- 2.31.1 diff --git a/Documentation/devicetree/bindings/input/touchscreen/zinitix,bt400.yaml b/Documentation/devicetree/bindings/input/touchscreen/zinitix,bt400.yaml new file mode 100644 index 000000000000..6e8b4dede9d7 --- /dev/null +++ b/Documentation/devicetree/bindings/input/touchscreen/zinitix,bt400.yaml @@ -0,0 +1,115 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/input/touchscreen/zinitix,bt400.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Zinitix BT4xx and BT5xx series touchscreen controller bindings + +description: The Zinitix BT4xx and BT5xx series of touchscreen controllers + are Korea-produced touchscreens with embedded microcontrollers. The + BT4xx series was produced 2010-2013 and the BT5xx series 2013-2014. + +maintainers: + - Michael Srba + - Linus Walleij + +allOf: + - $ref: touchscreen.yaml# + +properties: + $nodename: + pattern: "^touchscreen(@.*)?$" + + compatible: + oneOf: + - const: zinitix,bt402 + - const: zinitix,bt403 + - const: zinitix,bt404 + - const: zinitix,bt412 + - const: zinitix,bt413 + - const: zinitix,bt431 + - const: zinitix,bt432 + - const: zinitix,bt531 + - const: zinitix,bt532 + - const: zinitix,bt538 + - const: zinitix,bt541 + - const: zinitix,bt548 + - const: zinitix,bt554 + - const: zinitix,at100 + + reg: + description: I2C address on the I2C bus + + clock-frequency: + description: I2C client clock frequency, defined for host when using + the device on the I2C bus + minimum: 0 + maximum: 400000 + + interrupts: + description: Interrupt to host + maxItems: 1 + + vcca-supply: + description: Analog power supply regulator on the VCCA pin + + vdd-supply: + description: Digital power supply regulator on the VDD pin. + In older device trees this can be the accidental name for the analog + supply on the VCCA pin, and in that case the deprecated vddo-supply is + used for the digital power supply. + + vddo-supply: + description: Deprecated name for the digital power supply, use vdd-supply + as this reflects the real name of the pin. If this supply is present, + the vdd-supply represents VCCA instead of VDD. Implementers should first + check for this property, and if it is present assume that the vdd-supply + represents the analog supply. + deprecated: true + + reset-gpios: + description: Reset line for the touchscreen, should be tagged + as GPIO_ACTIVE_LOW + + zinitix,mode: + description: Mode of reporting touch points. Some modes may not work + with a particular ts firmware for unknown reasons. Available modes are + 1 and 2. Mode 2 is the default and preferred. + $ref: /schemas/types.yaml#/definitions/uint32 + enum: [1, 2] + + touchscreen-size-x: true + touchscreen-size-y: true + touchscreen-fuzz-x: true + touchscreen-fuzz-y: true + +additionalProperties: false + +required: + - compatible + - reg + - interrupts + - touchscreen-size-x + - touchscreen-size-y + +examples: + - | + #include + #include + i2c { + #address-cells = <1>; + #size-cells = <0>; + + touchscreen@20 { + compatible = "zinitix,bt541"; + reg = <0x20>; + interrupt-parent = <&gpio>; + interrupts = <13 IRQ_TYPE_EDGE_FALLING>; + vcca-supply = <®_vcca_tsp>; + vdd-supply = <®_vdd_tsp>; + touchscreen-size-x = <540>; + touchscreen-size-y = <960>; + zinitix,mode = <2>; + }; + }; diff --git a/Documentation/devicetree/bindings/input/touchscreen/zinitix.txt b/Documentation/devicetree/bindings/input/touchscreen/zinitix.txt deleted file mode 100644 index 446efb9f5f55..000000000000 --- a/Documentation/devicetree/bindings/input/touchscreen/zinitix.txt +++ /dev/null @@ -1,40 +0,0 @@ -Device tree bindings for Zinitx BT541 touchscreen controller - -Required properties: - - - compatible : Should be "zinitix,bt541" - - reg : I2C address of the chip. Should be 0x20 - - interrupts : Interrupt to which the chip is connected - -Optional properties: - - - vdd-supply : Analog power supply regulator on VCCA pin - - vddo-supply : Digital power supply regulator on VDD pin - - zinitix,mode : Mode of reporting touch points. Some modes may not work - with a particular ts firmware for unknown reasons. Available - modes are 1 and 2. Mode 2 is the default and preferred. - -The touchscreen-* properties are documented in touchscreen.txt in this -directory. - -Example: - - i2c@00000000 { - /* ... */ - - bt541@20 { - compatible = "zinitix,bt541"; - reg = <0x20>; - interrupt-parent = <&msmgpio>; - interrupts = <13 IRQ_TYPE_EDGE_FALLING>; - pinctrl-names = "default"; - pinctrl-0 = <&tsp_default>; - vdd-supply = <®_vdd_tsp>; - vddo-supply = <&pm8916_l6>; - touchscreen-size-x = <540>; - touchscreen-size-y = <960>; - zinitix,mode = <2>; - }; - - /* ... */ - }; From patchwork Fri Jun 25 11:34:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 466840 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp1369222jao; Fri, 25 Jun 2021 04:37:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzRkhjAy0evr5ij53azBU1GmzL4glmoiICQIO/8lsfmcp0Qvwr2GoM5BfY1+oorwKlndwXc X-Received: by 2002:a17:906:a108:: with SMTP id t8mr10226378ejy.407.1624621030203; Fri, 25 Jun 2021 04:37:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624621030; cv=none; d=google.com; s=arc-20160816; b=vFrFQ+d5huhC2VKty3KzwzrOqzO0sIHnvRLic3qTms7bIUPIofUbRfv2hmZQKEJJbx AV2rFyzVgXl6CLhxSNs8V8TjcgRvfLKaGY0ZuJePMK18ObWlHnuvZYTdpeFamuUgBlXC UpYBVGcxCl13+8otnVxJRMWeu7/8wYosja3Q2fUhjJyzak2UQleWzQlRYtAc2kZDNPVM 6ebpcnNboVOcHzhc+ZCWz4yKFqJBJNvuJmuCyr3AWEvl14BVvqB0fO0SzHGNnlTy7jK8 ns2kYVO7Ui3t7WaxhSQaUksyy5JrO8wVLqCI8f2bSeCBQvxnMdLkSiDoO605I0XGDBcC /o/g== 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=IL2ShTazcf5mL4VUs+5IwZEMug7nEaknzbx4PS2gI3c=; b=dYN4QWJuDw2X2RMNyRyTSOsSipqmdyAmtmRXBOv1IAvSPOt5X+SKdnf1vXAdGxs0dz DyBBQH2ev7Am+jx8UuuYYbzlscbx5cxQ0eIIRIpozpHMytzCuvKzCXY2lA9d+ZL5FxX8 x+OfAl14sRSsGW7x1iY+5ktA/qkW8kJeaU9Q4+23/zEzH0aHEqntO3YbhTKQ1RwitPUJ 7NNfwfMoiU1ajb6tztmmAMR3LnDwIIi3w4Y1f0LeLK/dJaazA58Ptv76qm+nFaCZmYLN aqGE0J8a9PIa6EeIs+7ks67hU1radNQvC8kDtMlmBYoUltwhmDc9dvAYEntLJ4p4gnQO eM2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mwZxj4Oh; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-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 eo22si5679431ejc.52.2021.06.25.04.37.10; Fri, 25 Jun 2021 04:37:10 -0700 (PDT) Received-SPF: pass (google.com: domain of devicetree-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=mwZxj4Oh; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-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 S230031AbhFYLj3 (ORCPT + 7 others); Fri, 25 Jun 2021 07:39:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229458AbhFYLj3 (ORCPT ); Fri, 25 Jun 2021 07:39:29 -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 DCA1EC061574 for ; Fri, 25 Jun 2021 04:37:07 -0700 (PDT) Received: by mail-lf1-x12b.google.com with SMTP id d16so15725643lfn.3 for ; Fri, 25 Jun 2021 04:37:07 -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=IL2ShTazcf5mL4VUs+5IwZEMug7nEaknzbx4PS2gI3c=; b=mwZxj4Oh2cTM+KEk7ag3FRQ0dTmwplZ+SYsDu9Obztf/HyQWQoaxMugCnlxAOk+npo rWg2uT2+VhJ/mZZtHSdQ6NGWZrlMujCARK2ktaef88vfZ8n3upwkSNBzr4GkN2bJ1E6Y 0qCVwSGgDonNFzW+bGqWYSBheFuYvz45NaSG02C0Vi/IUrR+GkqtVxxBjOuQ2S8RhOtb 3PfgqMh49iwvRx4+qcdoTi4Plr7rKxyZwFV7FB+686qBIeY557/+7TI8Sgs2pCOtBPb7 eDK4PYnfTwbJ0uaAW3jn9sQkUFuvgkBvWH8J2Z/3oTpK3S8MqyDAdy4Ra7rj75xve/8l sKxQ== 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=IL2ShTazcf5mL4VUs+5IwZEMug7nEaknzbx4PS2gI3c=; b=j40jYLu0gHP3L3a3595eD8EuPOKKb5Lz87RGmk/0urG5VMkEURkQRcIT059WgEDZ6G ABBhYzVacXq8yxb9rRRGVx1e1W0skSSrSRfOfEUGORp7cUWb4dRFpoDtK7qPdmIqQ5US 7dtPoLTckFwC+gZa/Z+AKulJwDciCxO5Wg/nP06F8J3VZHw9mH0N7wfi4RANdh/VsKJP Ce00F5Exegoeel1YXmwI4RcBYiqKwG8FRfNsU55QlpF1Ywd+zEdvjyGkktyEb+dnGsbx AAJAZgzwg6m40U9jEyNgwTnrWgETW8YkLhxxQFzczHqjd8GdHTEIGapS7xjvkMN4keRF spyQ== X-Gm-Message-State: AOAM532aSYFqJPtlXqUdDEGSXAYrXd4M5V9oiIfsaKcVE2ySfoPfE0nv liD2M7rsnlMF4C/3nbVblsp7kg== X-Received: by 2002:ac2:4650:: with SMTP id s16mr7809807lfo.436.1624621026257; Fri, 25 Jun 2021 04:37:06 -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 g24sm489682lfv.228.2021.06.25.04.37.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Jun 2021 04:37:06 -0700 (PDT) From: Linus Walleij To: Dmitry Torokhov , linux-input@vger.kernel.org Cc: Linus Walleij , Mark Brown , Michael Srba , phone-devel@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH 2/2] Input: zinitix - Handle proper supply names Date: Fri, 25 Jun 2021 13:34:35 +0200 Message-Id: <20210625113435.2539282-2-linus.walleij@linaro.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210625113435.2539282-1-linus.walleij@linaro.org> References: <20210625113435.2539282-1-linus.walleij@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org The supply names of the Zinitix touchscreen were a bit confused, the new bindings rectifies this. To deal with old and new devicetrees, first check if we have "vddo" and in case that exists assume the old supply names. Else go and look for the new ones. We cannot just get the regulators since we would get an OK and a dummy regulator: we need to check explicitly for the old supply name. Use struct device *dev as a local variable instead of the I2C client since the device is what we are actually obtaining the resources from. Cc: Mark Brown Cc: Michael Srba Cc: phone-devel@vger.kernel.org Cc: devicetree@vger.kernel.org Signed-off-by: Linus Walleij --- Mark: please check that I'm doing this check the right way, I assume that since we get regulator dummies this is the way I need to check for the old regulator name but maybe there are better ways. --- drivers/input/touchscreen/zinitix.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) -- 2.31.1 diff --git a/drivers/input/touchscreen/zinitix.c b/drivers/input/touchscreen/zinitix.c index b8d901099378..7001307382f0 100644 --- a/drivers/input/touchscreen/zinitix.c +++ b/drivers/input/touchscreen/zinitix.c @@ -252,16 +252,28 @@ static int zinitix_init_touch(struct bt541_ts_data *bt541) static int zinitix_init_regulators(struct bt541_ts_data *bt541) { - struct i2c_client *client = bt541->client; + struct device *dev = &bt541->client->dev; int error; - bt541->supplies[0].supply = "vdd"; - bt541->supplies[1].supply = "vddo"; - error = devm_regulator_bulk_get(&client->dev, + /* + * Some older device trees have erroneous names for the regulators, + * so check if "vddo" is present and in that case use these names + * and warn. Else use the proper supply names on the component. + */ + if (IS_ENABLED(CONFIG_OF) && + of_property_read_bool(dev->of_node, "vddo-supply")) { + bt541->supplies[0].supply = "vdd"; + bt541->supplies[1].supply = "vddo"; + } else { + /* Else use the proper supply names */ + bt541->supplies[0].supply = "vcca"; + bt541->supplies[1].supply = "vdd"; + } + error = devm_regulator_bulk_get(dev, ARRAY_SIZE(bt541->supplies), bt541->supplies); if (error < 0) { - dev_err(&client->dev, "Failed to get regulators: %d\n", error); + dev_err(dev, "Failed to get regulators: %d\n", error); return error; }