public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Paul Sokolovsky <pmiscml@gmail.com>
To: linux-arm-kernel@lists.arm.linux.org.uk, linux-kernel@vger.kernel.org
Cc: David Brownell <david-b@pacbell.net>
Subject: [RFC, PATCH 2/3] gpiodev - ARM PXA implementation
Date: Wed, 11 Apr 2007 00:36:55 +0300	[thread overview]
Message-ID: <869542577.20070411003655@gmail.com> (raw)

Hello linux-arm-kernel,

GPIODEV API: Support for ARM PXA2xx CPU. Implementation is based on
Generic GPIO API. Generally, GPIODEV implementation should be provided
by device driver. But CPU-builtin devices in the current code are
treated is special manner ("arch devices"), so this approach is
followed for GPIODEV too.


Signed-off-by: Paul Sokolovsky <pmiscml@gmail.com>


Index: arch/arm/mach-pxa/generic.c
===================================================================
RCS file: /cvs/linux/kernel26/arch/arm/mach-pxa/generic.c,v
retrieving revision 1.39
retrieving revision 1.41
diff -u -r1.39 -r1.41
--- arch/arm/mach-pxa/generic.c 24 Feb 2007 13:14:41 -0000      1.39
+++ arch/arm/mach-pxa/generic.c 10 Apr 2007 15:35:33 -0000      1.41
@@ -24,6 +24,7 @@
 #include <linux/ioport.h>
 #include <linux/pm.h>
 #include <linux/string.h>
+#include <linux/gpiodev.h>
 
 #include <linux/sched.h>
 #include <asm/cnt32_to_63.h>
@@ -530,6 +531,41 @@
        .id             = -1,
 };
 
+
+static int pxa_gpiodev_get_value(struct device *dev, int gpio)
+{
+       return __gpio_get_value(gpio);
+}
+
+static void pxa_gpiodev_set_value(struct device *dev, int gpio, int value)
+{
+       __gpio_set_value(gpio, value);
+}
+
+static int pxa_gpiodev_to_irq(struct device *dev, int gpio)
+{
+       return IRQ_GPIO(gpio);
+}
+
+
+struct pxagpio_platform_data {
+       struct gpiodev_ops gpiodev_ops;
+} pxagpio_platform_data = {
+       .gpiodev_ops = {
+               .get = pxa_gpiodev_get_value,
+               .set = pxa_gpiodev_set_value,
+               .to_irq = pxa_gpiodev_to_irq,
+       }
+};
+
+struct platform_device pxagpio_device = {
+       .name           = "pxa2xx-gpio",
+       .id             = -1,
+       .dev            = {
+               .platform_data = &pxagpio_platform_data
+       }
+};
+
 static struct platform_device *devices[] __initdata = {
        &pxamci_device,
        &udc_device,
@@ -541,6 +580,7 @@
        &i2c_device,
        &i2s_device,
        &pxartc_device,
+       &pxagpio_device,
 };
 
 static int __init pxa_init(void)
  

-- 
Best regards,
 Paul                          mailto:pmiscml@gmail.com


                 reply	other threads:[~2007-04-10 21:36 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=869542577.20070411003655@gmail.com \
    --to=pmiscml@gmail.com \
    --cc=david-b@pacbell.net \
    --cc=linux-arm-kernel@lists.arm.linux.org.uk \
    --cc=linux-kernel@vger.kernel.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