Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1051750imm; Wed, 18 Jul 2018 15:47:39 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeX5lq/Dqd0OrpV/J05zguyn0u437c+5/W0ZVxQXNbf4Zym2KfqpyAfe6e/S4rvCMyPFXu8 X-Received: by 2002:a17:902:b08d:: with SMTP id p13-v6mr7857996plr.0.1531954059225; Wed, 18 Jul 2018 15:47:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531954059; cv=none; d=google.com; s=arc-20160816; b=mIy9PAw/Cb7r2jeO6F+gYgE4DAbBgtSZHD31UwCvNs7svXvGnjH4GaXwvpA0u+oe+d MJ4l/uP1e06ICbZz78lcB6QI1c0vZb4JDiDiGIth5mMcHrNaJGCmrS2VlUxzUDK8GBmi 5BCsHWfZ3evP6IkB7tdVoathh5qC1p4Mx7UvLeXyuEJ01vZfsTWGEgn8+js5wpnIhlAZ 0u4Ytgkoa2GcEFmPi1sYzKvPVpy5416pv5gN3Spoefk6mUP/qy+l+XreMvQjNsoZaWyb I+fBUJS2hJmDtoR5JZbuhEK3ama4vkmmPteYsLqVEAPEYPPxuZgXRnxRzW7Px9IB4OY7 MIrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:if-you-cant-reach-me-try:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:mail-followup-to:message-id:subject:cc:to:from:date :dkim-signature:arc-authentication-results; bh=duUsdtAwqp54xlcpiXU9RUcVeSURfv4Hkgd43r1Wdfc=; b=lMrov7J4XYq3CNmJFnYCbo/Y1o+zjo8a9Bm3Jt96qFkYgT1W8/sU8Nowbi0bXwzuV9 SPHoWwoJNdRfcs0FtLawDcteZ9n/mMgrW69pYzD+quqPTJHgu2V757Bkjm0Oxpe70C+Y rM579YPNO84tK59eCqFgpx/a22S9YeMedNA1zRR8X5aHClxIxgXGQGmWOm6MxsABWcva Ss6Qy/wuItxdLvHSg4RIWTrvc+viWyyxdt4sQidD7J9htwLPjmCN43NLVX8GtN3ztbhf MuoJgC2EY0tOGzfeRzEJC0ade0VVoYWShFiXrYp8dOHadEnU+F04cqJyjB9ScOirhuW0 2TMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@megous.com header.s=mail header.b=ZqtWZwwL; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=megous.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j4-v6si3939818pll.101.2018.07.18.15.47.24; Wed, 18 Jul 2018 15:47:39 -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; dkim=pass header.i=@megous.com header.s=mail header.b=ZqtWZwwL; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=megous.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730460AbeGRX0x (ORCPT + 99 others); Wed, 18 Jul 2018 19:26:53 -0400 Received: from vps.xff.cz ([195.181.215.36]:46866 "EHLO vps.xff.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727009AbeGRX0x (ORCPT ); Wed, 18 Jul 2018 19:26:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megous.com; s=mail; t=1531954006; bh=KwbBMOuo6vvvJBoFh/oOb+5t+HNefZoyoCZ0+BvnO7Y=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ZqtWZwwLYNZnBqMfhFiyOcCG1dv4hO2WY9iTtZlFMhAXxxdIGcmdNQlTItuqepmM0 faZGgjwJ//iJYcNgBueTtyrg8Zc3L8J8l7aGdj2YP1JC5rfY7QQjfzVwTcUPjX7i36 JzgDtaTD9hoXB/2m/a6O/yKGwvMxT1aoUzHhw0yA= Date: Thu, 19 Jul 2018 00:46:45 +0200 From: =?utf-8?Q?Ond=C5=99ej?= Jirman To: =?utf-8?Q?Myl=C3=A8ne?= Josserand 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: <20180718224645.ns7nvqxvqc6huxcz@core> Mail-Followup-To: =?utf-8?Q?Myl=C3=A8ne?= Josserand , 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 References: <20180718182719.29663-1-mylene.josserand@bootlin.com> <20180718182719.29663-2-mylene.josserand@bootlin.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20180718182719.29663-2-mylene.josserand@bootlin.com> If-You-Cant-Reach-Me-Try: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? > 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. 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