* [RFC, PATCH 2/3] gpiodev - ARM PXA implementation
@ 2007-04-10 21:36 Paul Sokolovsky
0 siblings, 0 replies; only message in thread
From: Paul Sokolovsky @ 2007-04-10 21:36 UTC (permalink / raw)
To: linux-arm-kernel, linux-kernel; +Cc: David Brownell
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2007-04-10 21:36 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-10 21:36 [RFC, PATCH 2/3] gpiodev - ARM PXA implementation Paul Sokolovsky
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox