From patchwork Thu Nov 17 19:05:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lin, Meng-Bo" X-Patchwork-Id: 21877 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp576032wrr; Thu, 17 Nov 2022 11:11:32 -0800 (PST) X-Google-Smtp-Source: AA0mqf67f5sEkisEy3eCOcIJ186CHSPsSOZh44f+0KcyQhvoW2gW/kUo/dh5PRgj5zSh2vG7vvX2 X-Received: by 2002:a17:906:28cd:b0:7a5:a671:8236 with SMTP id p13-20020a17090628cd00b007a5a6718236mr3378803ejd.187.1668712291926; Thu, 17 Nov 2022 11:11:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668712291; cv=none; d=google.com; s=arc-20160816; b=ZOy295Nf3EHax9HhxkCJXQyW1ngOsWEoI4DwYQiEa6JXDF2uelh4f2QjluUxAvAjwh iPPV8FSUrnG2mx/ZKnJZn/yk0GvuFdI4qrLGSPVDX+UcL/M0eqtRMyXyq+QthYihGvVV DN1+yH4CGfg4hKLEOfOuGCBnKNxcPlBwTHT40E+OSjj0nakFy+D82p/ppLwr+OV8BtGE /JwJSDM2xLRwF0d5iDw7PhclWyGm6jzu77+wWytjoCnyDVqWKqkpJtAmrdg/CD8RkOOt 0eXL+nNp289qrIGXHEzQVOJqGkBXxNnlLvZ566em0YuIu4TOpa4GaNSknDBeA9Pe89rr IEcw== 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 :feedback-id:references:in-reply-to:message-id:subject:cc:from:to :dkim-signature:date; bh=U5nqDWG9FhX2ieLESGVMcwyTvDa3UugkxKXP+0flQCE=; b=JTB8IY8P8pLbl1iqBtLIlM+5gU05fP1/RGU5+DdfejeqYmyXpVcwzknLq19bEpno+P ubeF3VIrBnvrFJPpIRj7BONbx2D4lOdRs+1DVLtkrahug5y9ZLMAjgRNQkC0QY7ICM7O bq+iMK4nRr2DA0BYQwhi5W4Co8Nwk3sZo27ltqmJPGGcZVsdxRWIkID7uA5R1/88VMmj dHATZGnxApWge0PCm7C540xWI9/bMq6Xlb5wr6nSEgUDj0dQCrBFatrj7LEw483+LMYT ThYJRIrfojoTG/EgAIrXCWw5bru7WEuXUbTxapYnKjgli8jiG0nZmRaFn2ZPDAQjXJ9c LL1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@protonmail.com header.s=protonmail3 header.b=sNA43D1G; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=protonmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b11-20020a056402278b00b0045878eab247si1667872ede.193.2022.11.17.11.11.07; Thu, 17 Nov 2022 11:11:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@protonmail.com header.s=protonmail3 header.b=sNA43D1G; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=protonmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240217AbiKQTFl (ORCPT + 99 others); Thu, 17 Nov 2022 14:05:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240151AbiKQTFj (ORCPT ); Thu, 17 Nov 2022 14:05:39 -0500 Received: from mail-40140.protonmail.ch (mail-40140.protonmail.ch [185.70.40.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 75D157EC8C for ; Thu, 17 Nov 2022 11:05:37 -0800 (PST) Date: Thu, 17 Nov 2022 19:05:32 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1668711935; x=1668971135; bh=U5nqDWG9FhX2ieLESGVMcwyTvDa3UugkxKXP+0flQCE=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=sNA43D1GTk1KrLPZq18i+96MvMtzKp2n5/VzATph8CM1jOuorPqhrkSzLY0n+YMQj JDaYjwz5/zQ55flZ/vH9O5TEANFt/iRrKdDvheILyjbwICn1D+vbiroKSl9MJR8amh 66wogiRu+Ae+vAEx3lnXVT2WOY3d/g5ZdFr5R7VjBzS8EnjkZbS2Sm9Yw5AyTTTp31 h3eyeel+odwm84hvWvhpmhk/6/Qi1Gu7vT6/Xk6478HhMvRo83uASi6pVZh9voWbwt cf1S5vrIZVsSXJPSNu75ojZAbsFZxU7clgfQviw81E1EMdIXwLkGG6rTKdOIOPagyj AqewgeY596Ywg== To: linux-input@vger.kernel.org From: "Lin, Meng-Bo" Cc: Dmitry Torokhov , Rob Herring , Krzysztof Kozlowski , Linus Walleij , Alistair Francis , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] dt-bindings: input: cyttsp5: document vddio-supply Message-ID: <20221117190507.87535-2-linmengbo0689@protonmail.com> In-Reply-To: <20221117190507.87535-1-linmengbo0689@protonmail.com> References: <20221117190507.87535-1-linmengbo0689@protonmail.com> Feedback-ID: 40467236:user:proton MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749771660646245717?= X-GMAIL-MSGID: =?utf-8?q?1749771660646245717?= The Samsung touchscreen controllers are often used with external pull-up for the interrupt line and the I2C lines, so we might need to enable a regulator to bring the lines into usable state. Otherwise, this might cause spurious interrupts and reading from I2C will fail. Document support for a "vddio-supply" that is enabled by the cyttsp5 driver so that the regulator gets enabled when needed. Signed-off-by: Lin, Meng-Bo Acked-by: Krzysztof Kozlowski Reviewed-by: Alistair Francis --- .../devicetree/bindings/input/touchscreen/cypress,tt21000.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Documentation/devicetree/bindings/input/touchscreen/cypress,tt21000.yaml b/Documentation/devicetree/bindings/input/touchscreen/cypress,tt21000.yaml index 1959ec394768..869a9bdd962f 100644 --- a/Documentation/devicetree/bindings/input/touchscreen/cypress,tt21000.yaml +++ b/Documentation/devicetree/bindings/input/touchscreen/cypress,tt21000.yaml @@ -34,6 +34,9 @@ properties: vdd-supply: description: Regulator for voltage. + vddio-supply: + description: Optional Regulator for I/O voltage. + reset-gpios: maxItems: 1 From patchwork Thu Nov 17 19:05:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lin, Meng-Bo" X-Patchwork-Id: 21878 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp576133wrr; Thu, 17 Nov 2022 11:11:45 -0800 (PST) X-Google-Smtp-Source: AA0mqf5I5tH+kmUyKtSNBwsJRd5qX6wj+8PkWlvI74oV0Xv2kmWWqDvgFsrpEpNJq2dqY8AzI6KY X-Received: by 2002:a17:906:8314:b0:7ae:1063:55d3 with SMTP id j20-20020a170906831400b007ae106355d3mr3055769ejx.578.1668712305630; Thu, 17 Nov 2022 11:11:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668712305; cv=none; d=google.com; s=arc-20160816; b=Dkx8dEoGzHVK9vAbD5wzs6GslSyWjM1coS/5DYETQaTg8wpjc8BWP2oXMZxDELkPFW pHns51B6RCQxpEqHS8iukxRtdFKQSTNtZGfIZSPD9RjNBUF5PzlZC32vL+k9OHfPx/CC bV6kzKgcMl3pA0HEyARMKkPAYAd9hjWPPuNGnLU9FMxhUz5CGT9I4oc0HRYaBtcrM1wx nYcpTnaYVqX/CAtglh3Uf+kYqr/BdvKkHfI+O6RTKfm+W4wm+2o4KTstenWNKUdhNe64 ioUH9KEarP+fLxrCbNOKey5qlMFBtL97sArDE3kJc82E0WNX3b9o1PvOxohNalwBYRue IlvA== 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 :feedback-id:references:in-reply-to:message-id:subject:cc:from:to :dkim-signature:date; bh=SvQ/7qvSOWMTkyWcL82fB0gmqIP5uLDGT8xWRxWMlGM=; b=F1n8AmiqdVupczYqFa98Twnv6Rk6fPKGddZIWcs2gk/eaRCDN/pIIYBITZLeD/S20n V1w7AiIcrj16huq3KSDTi3GNWHxASAv9B4NGfSIFEkgyT3rnBRjlIHdicM9SpBYLuH38 OpBKxToxC0Lc0bbuksdgK8/mjEKnI4wyUc+1LMOezi+8zPHA6KnSRjo44EybvkNmnj0J 1Htw5N6pXOrksn/ZBSRv3eqp+7vunNBa2/OgaYSqGLKEpgTinbBurLi79/Fa5+qAInTN 9jq/NfddYQa/Ngx4hcr01KWxVw8FWMhIjz5a+SgqIVTNRANHFADgr3CdOFUcZpyktek+ blrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@protonmail.com header.s=protonmail3 header.b=ZoMIByvn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=protonmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g40-20020a056402322800b004591f959c3bsi1329286eda.427.2022.11.17.11.11.19; Thu, 17 Nov 2022 11:11:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@protonmail.com header.s=protonmail3 header.b=ZoMIByvn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=protonmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240125AbiKQTF4 (ORCPT + 99 others); Thu, 17 Nov 2022 14:05:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240236AbiKQTFx (ORCPT ); Thu, 17 Nov 2022 14:05:53 -0500 X-Greylist: delayed 9021 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Thu, 17 Nov 2022 11:05:52 PST Received: from mail-4324.protonmail.ch (mail-4324.protonmail.ch [185.70.43.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 385A67EC85; Thu, 17 Nov 2022 11:05:52 -0800 (PST) Date: Thu, 17 Nov 2022 19:05:41 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1668711950; x=1668971150; bh=SvQ/7qvSOWMTkyWcL82fB0gmqIP5uLDGT8xWRxWMlGM=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=ZoMIByvnSLQO+gpeH+/EAb+lwGCA8Wo65u926MAgWzntU1/w3U0ziauux0sk02nXu JnR0XbGNcPs5blnZypXQ581XnpjIU2p7aWewkws0ndQ8QuY8WnxDkJEinI7HVS4ygi TB0yGLHpsHldPd+Uxg2PbgEHOAsGXDSOBPhTY2vfWHhCRgoVW9Pfsdb/9yrnJnuxnC f7r9Sbn6qdjphjLRXT8SUzemkOQvVJHCXOnx85VNqy6lDLi3Hxrnl82nDGMoGndHNC BE5fWx2jcFhrTg+kYk/ifeDxFCn23hUthaTzn8Ukq4XTIzjV5Z/2mbLPaAy0gdvirE szp9fH4SOU4+A== To: linux-input@vger.kernel.org From: "Lin, Meng-Bo" Cc: Dmitry Torokhov , Rob Herring , Krzysztof Kozlowski , Linus Walleij , Alistair Francis , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] Input: cyttsp5 - add vddio regulator Message-ID: <20221117190507.87535-3-linmengbo0689@protonmail.com> In-Reply-To: <20221117190507.87535-1-linmengbo0689@protonmail.com> References: <20221117190507.87535-1-linmengbo0689@protonmail.com> Feedback-ID: 40467236:user:proton MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749771653430204970?= X-GMAIL-MSGID: =?utf-8?q?1749771674377496114?= The Samsung touchscreen controllers are often used with external pull-up for the interrupt line and the I2C lines, so we might need to enable a regulator to bring the lines into usable state. Otherwise, this might cause spurious interrupts and reading from I2C will fail. Implement support for a "vddio-supply" that is enabled by the cyttsp5 driver so that the regulator gets enabled when needed. Signed-off-by: Lin, Meng-Bo Acked-by: Alistair Francis --- drivers/input/touchscreen/cyttsp5.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/drivers/input/touchscreen/cyttsp5.c b/drivers/input/touchscreen/cyttsp5.c index 24ab1df9fc07..d02fdb940edf 100644 --- a/drivers/input/touchscreen/cyttsp5.c +++ b/drivers/input/touchscreen/cyttsp5.c @@ -190,7 +190,7 @@ struct cyttsp5 { int num_prv_rec; struct regmap *regmap; struct touchscreen_properties prop; - struct regulator *vdd; + struct regulator_bulk_data supplies[2]; }; /* @@ -767,7 +767,7 @@ static void cyttsp5_cleanup(void *data) { struct cyttsp5 *ts = data; - regulator_disable(ts->vdd); + regulator_bulk_disable(ARRAY_SIZE(ts->supplies), ts->supplies); } static int cyttsp5_probe(struct device *dev, struct regmap *regmap, int irq, @@ -790,9 +790,12 @@ static int cyttsp5_probe(struct device *dev, struct regmap *regmap, int irq, init_completion(&ts->cmd_done); /* Power up the device */ - ts->vdd = devm_regulator_get(dev, "vdd"); - if (IS_ERR(ts->vdd)) { - error = PTR_ERR(ts->vdd); + ts->supplies[0].supply = "vdd"; + ts->supplies[1].supply = "vddio"; + error = devm_regulator_bulk_get(dev, ARRAY_SIZE(ts->supplies), + ts->supplies); + if (error < 0) { + dev_err(ts->dev, "Failed to get regulators, error %d\n", error); return error; } @@ -800,9 +803,11 @@ static int cyttsp5_probe(struct device *dev, struct regmap *regmap, int irq, if (error) return error; - error = regulator_enable(ts->vdd); - if (error) + error = regulator_bulk_enable(ARRAY_SIZE(ts->supplies), ts->supplies); + if (error < 0) { + dev_err(ts->dev, "Failed to enable regulators, error %d\n", error); return error; + } ts->input = devm_input_allocate_device(dev); if (!ts->input) {