Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2614822rwb; Thu, 17 Nov 2022 13:27:31 -0800 (PST) X-Google-Smtp-Source: AA0mqf4FDnW4BIKRCiJbIDFhtfgGSOWESJT72aVMLY5ctHkYMFl17RtwlBpZpB2Iw4RBHFPj+Ko8 X-Received: by 2002:a63:f008:0:b0:46f:8976:c7d2 with SMTP id k8-20020a63f008000000b0046f8976c7d2mr3898776pgh.7.1668720451542; Thu, 17 Nov 2022 13:27:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668720451; cv=none; d=google.com; s=arc-20160816; b=Xa7Sq9FpH5w3IoPs3mgKIgpjwbBGI08Nqlwim4bhOO8nztR97ldA4pnQ/xLNdoW9nk a51zTlyK0iOBiL0XiBrN/fTDs1iJPlPiKhgLFUiUgS6waiB5aMV5hkKQxc5jPfQ1DukT 1Ov6tS/b4cjJJ7pTkCNgfe1GnqhJX//7p07smuWmNz/tGkFBOyhf9SgCj/mfOFlsgCSR E8sGW5Y2x60x96iKUPOciTq+LP5TddN8rIIu6yW+tohon1vt0WzfMG0zc18+ZiU2n4jG VX94NlUmgx8jKbJQP2KvM24FwX6T6LqL6aJBgKWpJLxP5ay2POgvhHXn3ZH7HbnqzNSK YIAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=PbpYwFahmavJ+myYeV2uuSXQ6FE49awaT3SaBmdnVaI=; b=CFRzEnyW10zfk/cWQ4ucsS5rzjNv1+XJwUFFEdDKJqcAxJ3otK4GkKIM/9a5g04djS 89iDWPmOgqPATJ5Vv1DKygHPg7jZj+I5xIEdGfhA30cCS3k641wFJi1gbXoelQOxe33n pehXGMHVpVi8cuO7EE8vYyRTMD7ZclZqmWPGQu1VsRZ2cPxPsDVfNjFVEkmZECAUtdbh 9fQ1QryS8mCbfKEDzhDOCiWOuGDCU+qXv2QgF0QBwwSuJBs8qliJiecBDVSE+2o+w4cR 2inYihhDwGI+7mnMs/Md5P2MyyeynBfct+3im+MALSBtQ6qwIu06fVtcLJmgNCaE4DQt B3Gw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l7-20020a170902f68700b0018388edd187si2194406plg.56.2022.11.17.13.27.18; Thu, 17 Nov 2022 13:27: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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240908AbiKQVT1 (ORCPT + 92 others); Thu, 17 Nov 2022 16:19:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234246AbiKQVSl (ORCPT ); Thu, 17 Nov 2022 16:18:41 -0500 Received: from smtp.smtpout.orange.fr (smtp-19.smtpout.orange.fr [80.12.242.19]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 39E9E87A49 for ; Thu, 17 Nov 2022 13:16:43 -0800 (PST) Received: from [192.168.1.18] ([86.243.100.34]) by smtp.orange.fr with ESMTPA id vmFUoQx51FUJ3vmFUoimeH; Thu, 17 Nov 2022 22:16:41 +0100 X-ME-Helo: [192.168.1.18] X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Thu, 17 Nov 2022 22:16:41 +0100 X-ME-IP: 86.243.100.34 Message-ID: <4fe0c7c3-f5eb-4c01-8607-ce79a768cb06@wanadoo.fr> Date: Thu, 17 Nov 2022 22:16:40 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 Subject: Re: [PATCH 2/2] Input: cyttsp5 - add vddio regulator Content-Language: fr, en-US To: linmengbo0689@protonmail.com Cc: alistair@alistair23.me, devicetree@vger.kernel.org, dmitry.torokhov@gmail.com, krzysztof.kozlowski+dt@linaro.org, linus.walleij@linaro.org, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, robh+dt@kernel.org References: <20221117190507.87535-1-linmengbo0689@protonmail.com> <20221117190507.87535-3-linmengbo0689@protonmail.com> From: Christophe JAILLET In-Reply-To: <20221117190507.87535-3-linmengbo0689@protonmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,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 Le 17/11/2022 à 20:05, Lin, Meng-Bo a écrit : > 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 > --- > 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); Hi, dev_err_probe()? I think that devm_regulator_bulk_get() can return -EPROBE_DEFER; > 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); Eventually, the same here in order to be consistent. CJ > return error; > + } > > ts->input = devm_input_allocate_device(dev); > if (!ts->input) {