[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20150115112139.GS3043@sirena.org.uk>
Date: Thu, 15 Jan 2015 11:21:39 +0000
From: Mark Brown <broonie@...nel.org>
To: James Ban <james.ban.opensource@...semi.com>
Cc: Liam Girdwood <lgirdwood@...il.com>,
Support Opensource <support.opensource@...semi.com>,
LKML <linux-kernel@...r.kernel.org>,
David Dajun Chen <david.chen@...semi.com>
Subject: Re: [PATCH V1] regulator: da9211: fix unmatched of_node and add gpio
control
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.
Download attachment "signature.asc" of type "application/pgp-signature" (474 bytes)
Powered by blists - more mailing lists