msm: gpio: move gpio driver to platform driver
Add support for platform driver, so that the irq's used for handling the
gpios can be taken using the resources[] from device file.
This will eliminate the dependency on cpu_is_xxx() checks during the
registering the IRQ's and will help in the single binary support for
7x27a and 8625.
Change-Id: I4c7a2f0ebe14d7ef28cb7e17d0a31112e07755a1
Signed-off-by: Taniya Das <tdas@codeaurora.org>
Signed-off-by: Chintan Pandya <cpandya@codeaurora.org>
diff --git a/arch/arm/mach-msm/devices-msm7x27.c b/arch/arm/mach-msm/devices-msm7x27.c
index 0fb64dc..cdb43ad 100644
--- a/arch/arm/mach-msm/devices-msm7x27.c
+++ b/arch/arm/mach-msm/devices-msm7x27.c
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2008 Google, Inc.
- * Copyright (c) 2008-2011, Code Aurora Forum. All rights reserved.
+ * Copyright (c) 2008-2012, Code Aurora Forum. All rights reserved.
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
@@ -18,6 +18,7 @@
#include <linux/msm_kgsl.h>
#include <linux/regulator/machine.h>
#include <linux/dma-mapping.h>
+#include <linux/init.h>
#include <asm/clkdev.h>
#include <mach/irqs.h>
#include <mach/msm_iomap.h>
@@ -839,3 +840,29 @@
FS_PCOM(FS_GFX3D, "fs_gfx3d"),
};
unsigned msm_num_footswitch_devices = ARRAY_SIZE(msm_footswitch_devices);
+
+static struct resource gpio_resources[] = {
+ {
+ .start = INT_GPIO_GROUP1,
+ .flags = IORESOURCE_IRQ,
+ },
+ {
+ .start = INT_GPIO_GROUP2,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+static struct platform_device msm_device_gpio = {
+ .name = "msmgpio",
+ .id = -1,
+ .resource = gpio_resources,
+ .num_resources = ARRAY_SIZE(gpio_resources),
+};
+
+static int __init msm7627_init_gpio(void)
+{
+ platform_device_register(&msm_device_gpio);
+ return 0;
+}
+
+postcore_initcall(msm7627_init_gpio);