Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp6961615imm; Tue, 24 Jul 2018 06:14:37 -0700 (PDT) X-Google-Smtp-Source: AAOMgpf1ytHIjGpanBtBOVjfeTp2EwP+W2cCeEnnoh7ey0agO8R2L5zUDmWP+evpVWG1AGdpRm00 X-Received: by 2002:a63:d20e:: with SMTP id a14-v6mr16261560pgg.226.1532438077353; Tue, 24 Jul 2018 06:14:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532438077; cv=none; d=google.com; s=arc-20160816; b=zQCnZ1zqkYCLblh/hy2Z9VArgCZxoMzm5YC2RvRzvO+luJwV24bf8cw6xOC4Oo/Y6L gVwnbIWsppo87zOEmUEKSYFw4m8oDsRvaPeINve96Zd5EL7vqSas2MurmsLa3SeIGuJV v721RyS1CV9NXug2D51ue9ccfERTF4Wkeb/1nbUcH9mRZ/m4fQwUB2h0la6mYfZCtfrJ ncUrRWcQCroMGBFXdEI+vS82d9SoyfSjlPdHsI2PdWlAKVvE7xrV/nBYDUVhnHKwbnTV AKXlGvOPyWKnpdXwF3Bx7E1l2DV/RJsuL4UydNZQA74jcm+5LHJEETkdeo9ZZYTryE2s QFuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:arc-authentication-results; bh=vFxENl9oRitEPMT58qe6lA12rYhQmmXxWoBPQ1OOsBE=; b=SM67igjyjzAeinGihsNL2nPxv7QpYVNLtiAGxHbfNTfTQT+uvktEIY4YgxwGaxPt6I WAud4hd+J76BB5j0arJSNN3clcXgjPe3JyatF69pq8dvG9+Qi1jLaWKs4XCex87CYfUm +pY4vOZTAivlPy3HjcGj+tawSUi4CyQPYoXBi0yOuoUdrDKZ2jiBI4TJ8epAZNBL/4Yq wvp6dYWlQf/MkilfNbATT4aDqdFJPq9XABPaLxPYU4ylrbEbpcflpFUtN56qE10GMrcz lUgO8Ii4dvDOTT8FevpLmcMWUPtk3Z1iYKlMMkI4XnUI1uAeuD05aa6p7M0jWw7ovH5I pWbA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t66-v6si11388440pfg.292.2018.07.24.06.14.22; Tue, 24 Jul 2018 06:14:37 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388359AbeGXOT7 convert rfc822-to-8bit (ORCPT + 99 others); Tue, 24 Jul 2018 10:19:59 -0400 Received: from mail.bootlin.com ([62.4.15.54]:32819 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388265AbeGXOT6 (ORCPT ); Tue, 24 Jul 2018 10:19:58 -0400 Received: by mail.bootlin.com (Postfix, from userid 110) id F174920737; Tue, 24 Jul 2018 15:13:29 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0 Received: from dell-desktop.home (AAubervilliers-681-1-78-122.w90-88.abo.wanadoo.fr [90.88.20.122]) by mail.bootlin.com (Postfix) with ESMTPSA id A0992203D9; Tue, 24 Jul 2018 15:13:19 +0200 (CEST) Date: Tue, 24 Jul 2018 15:13:19 +0200 From: =?UTF-8?B?TXlsw6huZQ==?= Josserand To: =?UTF-8?B?T25kxZllag==?= Jirman Cc: dmitry.torokhov@gmail.com, robh+dt@kernel.org, mark.rutland@arm.com, maxime.ripard@bootlin.com, wens@csie.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, thomas.petazzoni@bootlin.com, linux-input@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v3 1/3] Input: edt-ft5x06 - Add support for regulator Message-ID: <20180724151319.3139c5ae@dell-desktop.home> In-Reply-To: <20180718224645.ns7nvqxvqc6huxcz@core> References: <20180718182719.29663-1-mylene.josserand@bootlin.com> <20180718182719.29663-2-mylene.josserand@bootlin.com> <20180718224645.ns7nvqxvqc6huxcz@core> Organization: Bootlin X-Mailer: Claws Mail 3.14.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, Thank you for your review. On Thu, 19 Jul 2018 00:46:45 +0200 Ondřej Jirman wrote: > Hello Mylène, > > On Wed, Jul 18, 2018 at 08:27:17PM +0200, Mylène Josserand wrote: > > Add the support of regulator to use it as VCC source. > > > > Signed-off-by: Mylène Josserand > > --- > > .../bindings/input/touchscreen/edt-ft5x06.txt | 1 + > > drivers/input/touchscreen/edt-ft5x06.c | 29 ++++++++++++++++++++++ > > 2 files changed, 30 insertions(+) > > > > diff --git a/Documentation/devicetree/bindings/input/touchscreen/edt-ft5x06.txt b/Documentation/devicetree/bindings/input/touchscreen/edt-ft5x06.txt > > index 025cf8c9324a..48e975b9c1aa 100644 > > --- a/Documentation/devicetree/bindings/input/touchscreen/edt-ft5x06.txt > > +++ b/Documentation/devicetree/bindings/input/touchscreen/edt-ft5x06.txt > > @@ -30,6 +30,7 @@ Required properties: > > Optional properties: > > - reset-gpios: GPIO specification for the RESET input > > - wake-gpios: GPIO specification for the WAKE input > > + - vcc-supply: Regulator that supplies the touchscreen > > > > - pinctrl-names: should be "default" > > - pinctrl-0: a phandle pointing to the pin settings for the > > diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c > > index 1e18ca0d1b4e..aa94494b06b5 100644 > > --- a/drivers/input/touchscreen/edt-ft5x06.c > > +++ b/drivers/input/touchscreen/edt-ft5x06.c > > @@ -39,6 +39,7 @@ > > #include > > #include > > #include > > +#include > > > > #define WORK_REGISTER_THRESHOLD 0x00 > > #define WORK_REGISTER_REPORT_RATE 0x08 > > @@ -91,6 +92,7 @@ struct edt_ft5x06_ts_data { > > struct touchscreen_properties prop; > > u16 num_x; > > u16 num_y; > > + struct regulator *vcc; > > > > struct gpio_desc *reset_gpio; > > struct gpio_desc *wake_gpio; > > @@ -991,6 +993,22 @@ static int edt_ft5x06_ts_probe(struct i2c_client *client, > > > > tsdata->max_support_points = chip_data->max_support_points; > > > > + tsdata->vcc = devm_regulator_get(&client->dev, "vcc"); > > + if (IS_ERR(tsdata->vcc)) { > > + error = PTR_ERR(tsdata->vcc); > > + if (error != -EPROBE_DEFER) > > + dev_err(&client->dev, "failed to request regulator: %d\n", > > + error); > > + return error; > > + } > > + > > + error = regulator_enable(tsdata->vcc); > > + if (error < 0) { > > + dev_err(&client->dev, "failed to enable vcc: %d\n", > > + error); > > + return error; > > + } > > + > > tsdata->reset_gpio = devm_gpiod_get_optional(&client->dev, > > "reset", GPIOD_OUT_HIGH); > > if (IS_ERR(tsdata->reset_gpio)) { > > @@ -1120,20 +1138,31 @@ static int edt_ft5x06_ts_remove(struct i2c_client *client) > > static int __maybe_unused edt_ft5x06_ts_suspend(struct device *dev) > > { > > struct i2c_client *client = to_i2c_client(dev); > > + struct edt_ft5x06_ts_data *tsdata = i2c_get_clientdata(client); > > > > if (device_may_wakeup(dev)) > > enable_irq_wake(client->irq); > > > > + regulator_disable(tsdata->vcc); > > + > > How will the touchscreen wakeup the system with interrupt if you power it off > on suspend? Perhaps guard this with device_may_wakeup() too? True, thank you for pointing it out. > > > return 0; > > } > > > > static int __maybe_unused edt_ft5x06_ts_resume(struct device *dev) > > { > > struct i2c_client *client = to_i2c_client(dev); > > + struct edt_ft5x06_ts_data *tsdata = i2c_get_clientdata(client); > > + int ret; > > > > if (device_may_wakeup(dev)) > > disable_irq_wake(client->irq); > > > > + ret = regulator_enable(tsdata->vcc); > > + if (ret < 0) { > > + dev_err(dev, "failed to enable vcc: %d\n", ret); > > + return ret; > > + } > > + > > Ditto. ack > > Regards, > o. > > > return 0; > > } > > > > -- > > 2.11.0 > > > > > > _______________________________________________ > > linux-arm-kernel mailing list > > linux-arm-kernel@lists.infradead.org > > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel Best regards, -- Mylène Josserand, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering https://bootlin.com