From: Maxime Ripard <maxime.ripard@free-electrons.com>
To: Philipp Zabel <p.zabel@pengutronix.de>
Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel@pengutronix.de, Roger Quadros <rogerq@ti.com>,
Mark Rutland <mark.rutland@arm.com>,
Stephen Warren <swarren@wwwdotorg.org>
Subject: Re: [PATCH v2 2/2] reset: Add GPIO support to reset controller framework
Date: Tue, 7 Jan 2014 12:19:54 +0100 [thread overview]
Message-ID: <20140107111954.GA2849@lukather> (raw)
In-Reply-To: <1389088341.4815.9.camel@pizza.hi.pengutronix.de>
[-- Attachment #1: Type: text/plain, Size: 1461 bytes --]
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
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
next prev parent reply other threads:[~2014-01-07 11:19 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-06 17:55 [PATCH v2 1/2] Documentation: Add GPIO reset binding to reset binding documentation Philipp Zabel
[not found] ` <1389030903-27684-1-git-send-email-p.zabel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2014-01-06 17:55 ` [PATCH v2 2/2] reset: Add GPIO support to reset controller framework Philipp Zabel
[not found] ` <1389030903-27684-2-git-send-email-p.zabel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2014-01-06 18:14 ` Maxime Ripard
2014-01-07 9:52 ` Philipp Zabel
2014-01-07 11:19 ` Maxime Ripard [this message]
2014-01-07 11:28 ` Philipp Zabel
[not found] ` <1389094089.4815.22.camel-/rZezPiN1rtR6QfukMTsflXZhhPuCNm+@public.gmane.org>
2014-01-07 11:40 ` Maxime Ripard
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=20140107111954.GA2849@lukather \
--to=maxime.ripard@free-electrons.com \
--cc=devicetree@vger.kernel.org \
--cc=kernel@pengutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=p.zabel@pengutronix.de \
--cc=rogerq@ti.com \
--cc=swarren@wwwdotorg.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).