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: 13047208 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EA43BC433FE for ; Thu, 17 Nov 2022 19:05:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240151AbiKQTFz (ORCPT ); Thu, 17 Nov 2022 14:05:55 -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 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org 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) {