[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140107111954.GA2849@lukather>
Date: Tue, 7 Jan 2014 12:19:54 +0100
From: Maxime Ripard <maxime.ripard@...e-electrons.com>
To: Philipp Zabel <p.zabel@...gutronix.de>
Cc: devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
kernel@...gutronix.de, Roger Quadros <rogerq@...com>,
Mark Rutland <mark.rutland@....com>,
Stephen Warren <swarren@...dotorg.org>
Subject: Re: [PATCH v2 2/2] reset: Add GPIO support to reset controller
framework
Hi Philipp,
On Tue, Jan 07, 2014 at 10:52:21AM +0100, Philipp Zabel wrote:
> > > + const char *gpio_con_id = "reset";
> > > + struct reset_controller_dev *rcdev;
> > > + struct reset_control *rstc;
> > > + struct gpio_desc *gpiod;
> > > + bool asserted = false;
> > > + char scratch[48];
> > > + int ret;
> > > +
> > > + if (id) {
> > > + snprintf(scratch, 48, "%s-reset-boot-asserted", id);
> > > + assert_prop = scratch;
> > > + }
> > > +
> > > + asserted = of_property_read_bool(dev->of_node, assert_prop);
> > > +
> > > + if (id) {
> > > + snprintf(scratch, 48, "%s-reset", id);
> > > + gpio_con_id = scratch;
> > > + }
> > > +
> > > + gpiod = gpiod_get(dev, gpio_con_id);
> > > + if (IS_ERR(gpiod)) {
> > > + dev_err(dev, "Failed to get GPIO reset: %ld\n", PTR_ERR(gpiod));
> > > + return ERR_CAST(gpiod);
> > > + }
> > > +
> > > + ret = gpiod_direction_output(gpiod, asserted);
> > > + if (ret < 0)
> > > + goto err_put;
> >
> > What happens if the GPIO is active low? I see no way in your binding
> > and driver to give that information, and that would change the
> > behaviour quite a bit.
>
> I was under the (wrong) impression that gpiod_direction_output takes a
> logical value as gpiod_set_value does. Will fix that.
I don't think gpiod_set_value does either unfortunately.
Maxime
--
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
Download attachment "signature.asc" of type "application/pgp-signature" (837 bytes)
Powered by blists - more mailing lists