From: Mike Rapoport <mike.rapoport@gmail.com>
To: Grazvydas Ignotas <notasas@gmail.com>
Cc: linux-input@vger.kernel.org,
Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Mark Brown <broonie@opensource.wolfsonmicro.com>,
linux-omap@vger.kernel.org
Subject: Re: [PATCH v2] Input: ads7846: add regulator support
Date: Sat, 13 Feb 2010 21:40:26 +0200 [thread overview]
Message-ID: <f870da181002131140q45c91251mdd19f51bf5c9c9d7@mail.gmail.com> (raw)
In-Reply-To: <1266078714-18155-1-git-send-email-notasas@gmail.com>
Just one nitpicking comment below:
On Sat, Feb 13, 2010 at 6:31 PM, Grazvydas Ignotas <notasas@gmail.com> wrote:
> The ADS7846/TSC2046 touchscreen controllers can (and usually are)
> connected to various regulators for power, so add regulator support.
>
> Valid regulator will now be required, so boards without complete
> regulator setup should either disable regulator framework or enable
> CONFIG_REGULATOR_DUMMY.
>
> Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
> ---
> drivers/input/touchscreen/ads7846.c | 28 +++++++++++++++++++++++++++-
> 1 files changed, 27 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
> index 52d2ca1..8b05d8e 100644
> --- a/drivers/input/touchscreen/ads7846.c
> +++ b/drivers/input/touchscreen/ads7846.c
> @@ -27,6 +27,7 @@
> #include <linux/gpio.h>
> #include <linux/spi/spi.h>
> #include <linux/spi/ads7846.h>
> +#include <linux/regulator/consumer.h>
> #include <asm/irq.h>
>
> /*
> @@ -85,6 +86,7 @@ struct ads7846 {
> char name[32];
>
> struct spi_device *spi;
> + struct regulator *reg;
>
> #if defined(CONFIG_HWMON) || defined(CONFIG_HWMON_MODULE)
> struct attribute_group *attr_group;
> @@ -788,6 +790,8 @@ static void ads7846_disable(struct ads7846 *ts)
> }
> }
>
> + regulator_disable(ts->reg);
> +
> /* we know the chip's in lowpower mode since we always
> * leave it that way after every request
> */
> @@ -799,6 +803,8 @@ static void ads7846_enable(struct ads7846 *ts)
> if (!ts->disabled)
> return;
>
> + regulator_enable(ts->reg);
> +
> ts->disabled = 0;
> ts->irq_disabled = 0;
> enable_irq(ts->spi->irq);
> @@ -1139,6 +1145,19 @@ static int __devinit ads7846_probe(struct spi_device *spi)
>
> ts->last_msg = m;
>
> + ts->reg = regulator_get(&spi->dev, "vcc");
"vcc" is way too generic name. What about "vcc-ts" or "vcc-touch"?
> + if (IS_ERR(ts->reg)) {
> + dev_err(&spi->dev, "unable to get regulator: %ld\n",
> + PTR_ERR(ts->reg));
> + goto err_free_gpio;
> + }
> +
> + err = regulator_enable(ts->reg);
> + if (err) {
> + dev_err(&spi->dev, "unable to enable regulator: %d\n", err);
> + goto err_put_regulator;
> + }
> +
> if (request_irq(spi->irq, ads7846_irq, IRQF_TRIGGER_FALLING,
> spi->dev.driver->name, ts)) {
> dev_info(&spi->dev,
> @@ -1148,7 +1167,7 @@ static int __devinit ads7846_probe(struct spi_device *spi)
> spi->dev.driver->name, ts);
> if (err) {
> dev_dbg(&spi->dev, "irq %d busy?\n", spi->irq);
> - goto err_free_gpio;
> + goto err_disable_regulator;
> }
> }
>
> @@ -1180,6 +1199,10 @@ static int __devinit ads7846_probe(struct spi_device *spi)
> ads784x_hwmon_unregister(spi, ts);
> err_free_irq:
> free_irq(spi->irq, ts);
> + err_disable_regulator:
> + regulator_disable(ts->reg);
> + err_put_regulator:
> + regulator_put(ts->reg);
> err_free_gpio:
> if (ts->gpio_pendown != -1)
> gpio_free(ts->gpio_pendown);
> @@ -1208,6 +1231,9 @@ static int __devexit ads7846_remove(struct spi_device *spi)
> /* suspend left the IRQ disabled */
> enable_irq(ts->spi->irq);
>
> + regulator_disable(ts->reg);
> + regulator_put(ts->reg);
> +
> if (ts->gpio_pendown != -1)
> gpio_free(ts->gpio_pendown);
>
> --
> 1.6.3.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
--
Sincerely Yours,
Mike.
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2010-02-13 19:40 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-13 16:31 [PATCH v2] Input: ads7846: add regulator support Grazvydas Ignotas
2010-02-13 18:49 ` Mark Brown
2010-02-25 10:01 ` Dmitry Torokhov
2010-02-13 19:40 ` Mike Rapoport [this message]
2010-02-13 19:52 ` Mark Brown
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=f870da181002131140q45c91251mdd19f51bf5c9c9d7@mail.gmail.com \
--to=mike.rapoport@gmail.com \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=notasas@gmail.com \
/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).