LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: H Hartley Sweeten <hartleys@visionengravers.com>
To: Wolfram Sang <w.sang@pengutronix.de>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [leds-pca9532] Add gpio capability
Date: Tue, 1 Feb 2011 10:27:23 -0600 [thread overview]
Message-ID: <0D753D10438DA54287A00B027084269764CEEDAC85@AUSP01VMBX24.collaborationhost.net> (raw)
In-Reply-To: <20110201080146.GA27955@pengutronix.de>
On Tuesday, February 01, 2011 1:02 AM, Wolfram Sang wrote:
>> From the datasheet:
>>[...]
>> So, you should provide both a direction_input and direction_output.
>
> He did in V2 of this patch (what made me also download the datasheet ;)).
Ok. Just looked at the v2 patch.
> +static int pca9532_gpio_direction_input(struct gpio_chip *gc, unsigned offset)
> +{
> + struct pca9532_data *data = container_of(gc, struct pca9532_data, gpio);
> + struct pca9532_led *led = &data->leds[offset];
> +
> + /* To use as input ensure pin is not driven */
> + led->state = PCA9532_OFF;
> + pca9532_setled(led);
> +
> + return 0;
> +}
> +
This looks good. When configured as an input the pin needs to be set high-impedance,
00 which is PCA9532_OFF).
> +static int pca9532_gpio_direction_output(struct gpio_chip *gc,
> unsigned offset, int val)
> +{
> + return 0;
> +}
> +
Not good. When the pin is configured as an output, the direction_output method also
requests that the pin be set to a desired level. For this driver that means that the
pca9532_gpio_direction_output function just needs to call pca9532_gpio_set_value.
Regards,
Hartley
next prev parent reply other threads:[~2011-02-01 16:27 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-31 23:56 H Hartley Sweeten
2011-02-01 8:01 ` Wolfram Sang
2011-02-01 16:27 ` H Hartley Sweeten [this message]
2011-02-01 17:22 ` Joachim Eastwood
2011-02-01 18:44 ` Wolfram Sang
-- strict thread matches above, loose matches on Subject: below --
2011-01-30 17:31 Joachim Eastwood
2011-01-30 18:25 ` Wolfram Sang
2011-01-30 19:12 ` Joachim Eastwood
2011-01-30 21:43 ` Wolfram Sang
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=0D753D10438DA54287A00B027084269764CEEDAC85@AUSP01VMBX24.collaborationhost.net \
--to=hartleys@visionengravers.com \
--cc=linux-kernel@vger.kernel.org \
--cc=w.sang@pengutronix.de \
--subject='RE: [leds-pca9532] Add gpio capability' \
/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
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).