From: Pavel Herrmann <morpheus.ibis@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 5/7] dm: gpio: Add draft GPIO core and convert sandbox to use it
Date: Wed, 29 Aug 2012 14:00:27 +0200 [thread overview]
Message-ID: <39609285.ETq8Rsx0ta@merom> (raw)
In-Reply-To: <1345564853-24500-6-git-send-email-marex@denx.de>
Hi
On Tuesday 21 August 2012 18:00:51 Marek Vasut wrote:
...snip...
> +/**
> + * gpio_request() - [COMPAT] Request GPIO
> + * gpio: GPIO number
> + * label: Name for the requested GPIO
> + *
> + * This function implements the API that's compatible with current
> + * GPIO API used in U-Boot. The request is forwarded to particular
> + * GPIO driver. Returns 0 on success, negative value on error.
> + */
> +int gpio_request(unsigned gpio, const char *label)
> +{
> + struct gpio_core_entry *e = gpio_to_entry(gpio);
> + if (!e)
> + return -EINVAL;
> +
> + return e->ops->gpio_request(gpio, label);
> +}
...snip...
Your core should have a driver API (as described in the core document), which
should be in form of gpio_$fname for each $fname in the gpio_ops. on top of
those you can have the command API, which accesses the gpio pins in a linear
fashion (like what you have now)
the reason for this is if you have a device on gpio (say some LEDs), which
knows (from platform data) that pins 3-6 of the parent device are connected to
this device. in your API, this has no way of working - even if you put global
pin numbering in the platform data, this would stop working if you had a PnP
GPIO controllers (say USB).
regards
Pavel Herrmann
next prev parent reply other threads:[~2012-08-29 12:00 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-21 16:00 [U-Boot] [PATCH 0/7] [RFC] Driver model, take 1 Marek Vasut
2012-08-21 16:00 ` [U-Boot] [PATCH 1/7] dm: Add skeleton support for cores and drivers Marek Vasut
2012-09-14 18:29 ` Tom Rini
2012-08-21 16:00 ` [U-Boot] [PATCH 2/7] dm: sandbox: Add necessary linker sections Marek Vasut
2012-08-21 16:00 ` [U-Boot] [PATCH 3/7] dm: sandbox: Add necessary GD sections Marek Vasut
2012-08-21 16:00 ` [U-Boot] [PATCH 4/7] dm: REMOVE: sandbox binding experiment Marek Vasut
2012-08-21 16:00 ` [U-Boot] [PATCH 5/7] dm: gpio: Add draft GPIO core and convert sandbox to use it Marek Vasut
2012-08-29 12:00 ` Pavel Herrmann [this message]
2012-08-21 16:00 ` [U-Boot] [PATCH 6/7] dm: add dummy demo driver and core Marek Vasut
2012-08-21 16:00 ` [U-Boot] [PATCH 7/7] dm: Add "dm dump" command Marek Vasut
2012-08-22 18:28 ` [U-Boot] [PATCH 0/7] [RFC] Driver model, take 1 Marek Vasut
2012-09-04 1:06 ` Graeme Russ
2012-09-04 6:44 ` Marek Vasut
2012-09-04 6:48 ` Graeme Russ
2012-09-14 18:34 ` Tom Rini
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=39609285.ETq8Rsx0ta@merom \
--to=morpheus.ibis@gmail.com \
--cc=u-boot@lists.denx.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.