From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Ondrej Jirman <megous@megous.com>
Cc: linux-sunxi@googlegroups.com, "Rob Herring" <robh+dt@kernel.org>,
"Mark Rutland" <mark.rutland@arm.com>,
"Maxime Ripard" <mripard@kernel.org>,
"Chen-Yu Tsai" <wens@csie.org>,
"Marco Felsch" <m.felsch@pengutronix.de>,
"Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Mylène Josserand" <mylene.josserand@bootlin.com>,
linux-input@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 1/3] input: edt-ft5x06: Add support for regulator
Date: Mon, 28 Oct 2019 21:12:33 -0700 [thread overview]
Message-ID: <20191029041233.GD57214@dtor-ws> (raw)
In-Reply-To: <20191029005806.3577376-2-megous@megous.com>
On Tue, Oct 29, 2019 at 01:58:04AM +0100, Ondrej Jirman wrote:
> From: Mylène Josserand <mylene.josserand@bootlin.com>
>
> Add the support for enabling optional regulator that may be used as VCC
> source.
>
> Signed-off-by: Ondrej Jirman <megous@megous.com>
> Signed-off-by: Mylène Josserand <mylene.josserand@bootlin.com>
Applied, thank you.
> ---
> drivers/input/touchscreen/edt-ft5x06.c | 30 ++++++++++++++++++++++++++
> 1 file changed, 30 insertions(+)
>
> diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c
> index 5525f1fb1526..d61731c0037d 100644
> --- a/drivers/input/touchscreen/edt-ft5x06.c
> +++ b/drivers/input/touchscreen/edt-ft5x06.c
> @@ -28,6 +28,7 @@
> #include <linux/input/mt.h>
> #include <linux/input/touchscreen.h>
> #include <asm/unaligned.h>
> +#include <linux/regulator/consumer.h>
>
> #define WORK_REGISTER_THRESHOLD 0x00
> #define WORK_REGISTER_REPORT_RATE 0x08
> @@ -88,6 +89,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;
> @@ -1036,6 +1038,13 @@ edt_ft5x06_ts_set_regs(struct edt_ft5x06_ts_data *tsdata)
> }
> }
>
> +static void edt_ft5x06_disable_regulator(void *arg)
> +{
> + struct edt_ft5x06_ts_data *data = arg;
> +
> + regulator_disable(data->vcc);
> +}
> +
> static int edt_ft5x06_ts_probe(struct i2c_client *client,
> const struct i2c_device_id *id)
> {
> @@ -1064,6 +1073,27 @@ 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;
> + }
> +
> + error = devm_add_action_or_reset(&client->dev,
> + edt_ft5x06_disable_regulator,
> + tsdata);
> + if (error)
> + return error;
> +
> tsdata->reset_gpio = devm_gpiod_get_optional(&client->dev,
> "reset", GPIOD_OUT_HIGH);
> if (IS_ERR(tsdata->reset_gpio)) {
> --
> 2.23.0
>
--
Dmitry
next prev parent reply other threads:[~2019-10-29 4:12 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-29 0:58 [PATCH 0/3] Add touchscreen support for TBS A711 Tablet Ondrej Jirman
2019-10-29 0:58 ` [PATCH 1/3] input: edt-ft5x06: Add support for regulator Ondrej Jirman
2019-10-29 4:12 ` Dmitry Torokhov [this message]
2019-10-29 8:55 ` Marco Felsch
2019-10-29 11:21 ` Ondřej Jirman
2019-10-29 11:29 ` Marco Felsch
2019-10-29 0:58 ` [PATCH 2/3] dt-bindings: input: edt-ft5x06: Add regulator support Ondrej Jirman
2019-10-29 0:58 ` [PATCH 3/3] arm: dts: sun8i: a83t: a711: Add touchscreen node Ondrej Jirman
2019-10-29 8:30 ` Maxime Ripard
2019-10-29 9:08 ` Marco Felsch
2019-10-29 11:13 ` Ondřej Jirman
2019-10-29 4:15 ` [PATCH 0/3] Add touchscreen support for TBS A711 Tablet Dmitry Torokhov
2019-10-29 9:04 ` Marco Felsch
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191029041233.GD57214@dtor-ws \
--to=dmitry.torokhov@gmail.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=devicetree@vger.kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sunxi@googlegroups.com \
--cc=m.felsch@pengutronix.de \
--cc=mark.rutland@arm.com \
--cc=megous@megous.com \
--cc=mripard@kernel.org \
--cc=mylene.josserand@bootlin.com \
--cc=robh+dt@kernel.org \
--cc=wens@csie.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).