mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: James Ban <james.ban.opensource@diasemi.com>
Cc: Liam Girdwood <lgirdwood@gmail.com>,
	Support Opensource <support.opensource@diasemi.com>,
	LKML <linux-kernel@vger.kernel.org>,
	David Dajun Chen <david.chen@diasemi.com>
Subject: Re: [PATCH V1] regulator: da9211: fix unmatched of_node and add gpio control
Date: Thu, 15 Jan 2015 11:21:39 +0000	[thread overview]
Message-ID: <20150115112139.GS3043@sirena.org.uk> (raw)
In-Reply-To: <201501150135.t0F1Z6UD032294@krsrvapps-01.diasemi.com>

[-- Attachment #1: Type: text/plain, Size: 1403 bytes --]

On Thu, Jan 15, 2015 at 10:29:08AM +0900, James Ban wrote:
> This is a patch for fixing unmatched of_node and adding gpio control.

That sounds like two separate changes to me...

>  Optional properties:
> +- bucka-uses-gpio: BUCKA can be controlled by gpio.
> +- bucka-enable-platform-gpio: platform gpio for control of BUCKA.
> +- bucka-enable-init-state: initial state of gpio for BUCKA

Even for a single GPIO specifiers are usually called -gpios.  It also
seems redundant to have the -uses property, if there is a GPIO specifier
for the enable then we can just assume it's supposed to be used without
the extra property.

> +		bucka-uses-gpio;
> +		bucka-enable-platform-gpio = <&gpio 27 0>;
> +		bucka-enable-init-state = <0>;
> +
> +		buckb-uses-gpio;
> +		buckb-enable-platform-gpio = <&gpio 17 0>;
> +		buckb-enable-init-state = <0>;
> +
>  		regulators {
>  			BUCKA {
>  				regulator-name = "VBUCKA";

Would it not be more natural to have the properties in the node for the
regulator (the recently added of_parse_cb will help with that)?

> +	if (of_get_property(dev->of_node, "bucka-uses-gpio", NULL)) {
> +		gpio = of_get_named_gpio(dev->of_node,
> +					"bucka-enable-platform-gpio", 0);
> +		if (!gpio_is_valid(gpio)) {
> +			dev_err(dev, "invalid gpio: %d\n", gpio);
> +			return ERR_PTR(-EINVAL);
> +		}

This will be broken for deferred probe, it's better to pass through any
errors.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

      reply	other threads:[~2015-01-15 11:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-15  1:29 James Ban
2015-01-15 11:21 ` Mark Brown [this message]

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=20150115112139.GS3043@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=david.chen@diasemi.com \
    --cc=james.ban.opensource@diasemi.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=support.opensource@diasemi.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

all inboxes | Powered by JetHome®