From: mpa@pengutronix.de (Markus Pargmann)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 2/4] regulator: Set ena_gpio_initialized in regulator drivers
Date: Fri, 10 Oct 2014 08:00:43 +0200 [thread overview]
Message-ID: <20141010060043.GA26053@pengutronix.de> (raw)
In-Reply-To: <1412780013.31093.7.camel@AMDC1943>
On Wed, Oct 08, 2014 at 04:53:33PM +0200, Krzysztof Kozlowski wrote:
> On ?ro, 2014-10-08 at 15:47 +0200, Markus Pargmann wrote:
> > This patch sets ena_gpio_initialized for all drivers which set a
> > ena_gpio from parsed DT properties. Drivers using pdata may get zero
> > initialized pdata and therefore copy a 0 into the regulator_config
> > ena_gpio field.
> >
> > Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
>
> (... rewind to s2m/s5m... I think Mark asked for splitting this per
> driver)
Then I misunderstood Mark, I thought he just meant the fixups at the end
of the last series.
>
> > diff --git a/drivers/regulator/s2mps11.c b/drivers/regulator/s2mps11.c
> > index adab82d5279f..49b9e1ddc87e 100644
> > --- a/drivers/regulator/s2mps11.c
> > +++ b/drivers/regulator/s2mps11.c
> > @@ -897,6 +897,7 @@ common_reg:
> > config.of_node = rdata[i].of_node;
> > }
> > config.ena_gpio = s2mps11->ext_control_gpio[i];
> > + config.ena_gpio_initialized = true;
> >
> > regulator = devm_regulator_register(&pdev->dev,
> > ®ulators[i], &config);
>
> Looks good.
>
> > diff --git a/drivers/regulator/s5m8767.c b/drivers/regulator/s5m8767.c
> > index 0ab5cbeeb797..7f176cdb7e37 100644
> > --- a/drivers/regulator/s5m8767.c
> > +++ b/drivers/regulator/s5m8767.c
> > @@ -466,6 +466,7 @@ static void s5m8767_regulator_config_ext_control(struct s5m8767_info *s5m8767,
> > }
> >
> > config->ena_gpio = rdata->ext_control_gpio;
> > + config->ena_gpio_initialized = true;
> > config->ena_gpio_flags = GPIOF_OUT_INIT_HIGH;
> > }
>
> It will work fine but a little messy. The 'config' is re-used in loop
> for next regulators, so:
> 1. regulator X with GPIO=-ENODEV, ena_gpio_initialized=false
> 2. regulator X+1 with real GPIO, ena_gpio_initialized=true
> 3. regulator X+2 with GPIO=-ENODEV, ena_gpio_initialized=true
>
>
> Instead do this in probe around line 950:
> config.ena_gpio = -EINVAL;
> config.ena_gpio_flags = 0;
> +config->ena_gpio_initialized = true;
> if (gpio_is_valid(pdata->regulators[i].ext_control_gpio))
> s5m8767_regulator_config_ext_control(s5m8767,
> &pdata->regulators[i], &config);
I will fix that.
Thanks,
Markus
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20141010/962dc5f8/attachment.sig>
next prev parent reply other threads:[~2014-10-10 6:00 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-08 13:47 [PATCH v2 0/4] regulator: Fix core behaviour for gpio 0 Markus Pargmann
2014-10-08 13:47 ` [PATCH v2 1/4] regulator: Add ena_gpio_initialized to regulator_config Markus Pargmann
2014-10-13 14:49 ` Mark Brown
2014-10-08 13:47 ` [PATCH v2 2/4] regulator: Set ena_gpio_initialized in regulator drivers Markus Pargmann
2014-10-08 14:53 ` Krzysztof Kozlowski
2014-10-10 6:00 ` Markus Pargmann [this message]
2014-10-13 14:42 ` Mark Brown
2014-11-03 13:22 ` Markus Pargmann
2014-10-08 13:47 ` [PATCH v2 3/4] regulator: fixed: Use gpio_is_valid Markus Pargmann
2014-10-13 14:47 ` Mark Brown
2014-11-03 13:38 ` Markus Pargmann
2014-10-08 13:47 ` [PATCH v2 4/4] regulator: gpio: " Markus Pargmann
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=20141010060043.GA26053@pengutronix.de \
--to=mpa@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.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).