[RFC, PATCH 2/3] gpiodev - ARM PXA implementation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <[email protected]>


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:[email protected]

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux