Skip to contentSkip to conversation

msm: Install the Google-Android gpio driver.

PATCH Superseded Gregory Bean 4 participants 8 messages Aug 31, 2010 – Sep 1, 2010

Subsystems (3)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 msm: Install the Google-Android gpio driver.

From: Arve Hj?nnev?g <[email protected]>

As part of the ongoing effort to converge on a common code base, adopt the Google-Android msmgpio driver, as it has a stronger pedigree than the previous submission from codeaurora.

Cc Arve Hj?nnev?g <[email protected]>
---
 arch/arm/mach-msm/Makefile  |    3 +
 arch/arm/mach-msm/gpio.c    |  627 +++++++++++++++++++++++++++++++++++++++++++
 arch/arm/mach-msm/gpio_hw.h |  277 +++++++++++++++++++
 3 files changed, 907 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-msm/gpio.c
 create mode 100644 arch/arm/mach-msm/gpio_hw.h
arch/arm/mach-msm/Makefile +3 -0
index 2263b8f..c95d19a 100644
@@ -22,3 +22,6 @@ obj-$(CONFIG_ARCH_QSD8X50) += board-qsd8x50.o devices-qsd8x50.o
 obj-$(CONFIG_ARCH_MSM7X30) += gpiomux-7x30.o gpiomux-v1.o gpiomux.o
 obj-$(CONFIG_ARCH_QSD8X50) += gpiomux-8x50.o gpiomux-v1.o gpiomux.o
 obj-$(CONFIG_ARCH_MSM8X60) += gpiomux-8x60.o gpiomux-v2.o gpiomux.o
+ifndef CONFIG_MSM_V2_TLMM
+obj-y	+= gpio.o
+endif
arch/arm/mach-msm/gpio.c new file +627 -0

627 lines not on this page · raw message

arch/arm/mach-msm/gpio_hw.h new file +277 -0

277 lines not on this page · raw message

Signature · 5 lines
1.7.0.4

--
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#1 lore raw

PATCH 2/2 msm: gpio: Add gpiomux calls to request and free.

Add gpiomux get and put calls to msmgpio request and free, in order to allow gpio lines to be properly reference-counted and power-managed.

---
 arch/arm/mach-msm/gpio.c |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)
arch/arm/mach-msm/gpio.c +27 -0
index fd899a1..ea93ecb 100644
@@ -21,6 +21,7 @@
 #include <linux/irq.h>
 #include <linux/module.h>
 #include "gpio_hw.h"
+#include "gpiomux.h"
 #include "proc_comm.h"
 #include "smd_private.h"
 
@@ -157,6 +158,16 @@ static int msm_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
 	return MSM_GPIO_TO_INT(chip->base + offset);
 }
 
+static int msm_gpio_request(struct gpio_chip *chip, unsigned offset)
+{
+        return msm_gpiomux_get(chip->base + offset);
+}
+
+static void msm_gpio_free(struct gpio_chip *chip, unsigned offset)
+{
+        msm_gpiomux_put(chip->base + offset);
+}
+
 struct msm_gpio_chip msm_gpio_chips[] = {
 	{
 		.regs = {
@@ -177,6 +188,8 @@ struct msm_gpio_chip msm_gpio_chips[] = {
 			.direction_input = msm_gpio_direction_input,
 			.direction_output = msm_gpio_direction_output,
 			.to_irq = msm_gpio_to_irq,
+			.request = msm_gpio_request,
+			.free = msm_gpio_free,
 		}
 	},
 	{
@@ -202,6 +215,8 @@ struct msm_gpio_chip msm_gpio_chips[] = {
 			.direction_input = msm_gpio_direction_input,
 			.direction_output = msm_gpio_direction_output,
 			.to_irq = msm_gpio_to_irq,
+			.request = msm_gpio_request,
+			.free = msm_gpio_free,
 		}
 	},
 	{
@@ -228,6 +243,8 @@ struct msm_gpio_chip msm_gpio_chips[] = {
 			.direction_input = msm_gpio_direction_input,
 			.direction_output = msm_gpio_direction_output,
 			.to_irq = msm_gpio_to_irq,
+			.request = msm_gpio_request,
+			.free = msm_gpio_free,
 		}
 	},
 	{
@@ -249,6 +266,8 @@ struct msm_gpio_chip msm_gpio_chips[] = {
 			.direction_input = msm_gpio_direction_input,
 			.direction_output = msm_gpio_direction_output,
 			.to_irq = msm_gpio_to_irq,
+			.request = msm_gpio_request,
+			.free = msm_gpio_free,
 		}
 	},
 	{
@@ -274,6 +293,8 @@ struct msm_gpio_chip msm_gpio_chips[] = {
 			.direction_input = msm_gpio_direction_input,
 			.direction_output = msm_gpio_direction_output,
 			.to_irq = msm_gpio_to_irq,
+			.request = msm_gpio_request,
+			.free = msm_gpio_free,
 		}
 	},
 	{
@@ -306,6 +327,8 @@ struct msm_gpio_chip msm_gpio_chips[] = {
 			.direction_input = msm_gpio_direction_input,
 			.direction_output = msm_gpio_direction_output,
 			.to_irq = msm_gpio_to_irq,
+			.request = msm_gpio_request,
+			.free = msm_gpio_free,
 		}
 	},
 #if defined(CONFIG_ARCH_QSD8X50) || defined(CONFIG_ARCH_MSM7X30)
@@ -333,6 +356,8 @@ struct msm_gpio_chip msm_gpio_chips[] = {
 			.direction_input = msm_gpio_direction_input,
 			.direction_output = msm_gpio_direction_output,
 			.to_irq = msm_gpio_to_irq,
+			.request = msm_gpio_request,
+			.free = msm_gpio_free,
 		}
 	},
 	{
@@ -359,6 +384,8 @@ struct msm_gpio_chip msm_gpio_chips[] = {
 			.direction_input = msm_gpio_direction_input,
 			.direction_output = msm_gpio_direction_output,
 			.to_irq = msm_gpio_to_irq,
+			.request = msm_gpio_request,
+			.free = msm_gpio_free,
 		}
 	},
 #endif
Signature · 5 lines
1.7.0.4

--
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#2 lore raw
In reply to Gregory Bean

arch/arm/mach-msm/gpio.c line 171

Quoted 12 lines · Gregory Bean

struct msm_gpio_chip msm_gpio_chips[] = {

arch/arm/mach-msm/gpio.c new file +11 -0
+       {
+               .regs = {
+                       .out =         GPIO_OUT_0,
+                       .in =          GPIO_IN_0,
+                       .int_status =  GPIO_INT_STATUS_0,
+                       .int_clear =   GPIO_INT_CLEAR_0,
+                       .int_en =      GPIO_INT_EN_0,
+                       .int_edge =    GPIO_INT_EDGE_0,
+                       .int_pos =     GPIO_INT_POS_0,
+                       .oe =          GPIO_OE_0,
+               }, 

Macro please.

Daniel

Signature · 2 lines
Sent by a consultant of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#3 lore raw
In reply to Gregory Bean

arch/arm/mach-msm/gpio.c line 469

Quoted 4 lines · Gregory Bean
arch/arm/mach-msm/gpio.c new file +3 -0
+                       /* printk("%s %08x %08x bit %d gpio %d irq %d\n",
+                               __func__, v, m, j, msm_chip->chip.start + j,
+                               FIRST_GPIO_IRQ + msm_chip->chip.start + j); */

Can you drop everything that's un-used .. There's also the enter/exit sleep functions, which I'm pretty sure aren't used. Also break this into two patches one for gpio and another for the interrupt component ..

Daniel

Signature · 2 lines
Sent by a consultant of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#4 lore raw
In reply to Gregory Bean
Quoted 7 lines · Gregory Bean

From: Arve Hj?nnev?g <[email protected]>

As part of the ongoing effort to converge on a common code base, adopt the Google-Android msmgpio driver, as it has a stronger pedigree than the previous submission from codeaurora.

Cc Arve Hj?nnev?g <[email protected]>

Arve, Are you planning to move this forward or is Greg going to? I've asked Greg (or you) for some changes to this.. If you have a problem with the changes please speak up ..

The signed-off is wrong on this commit also, You need to sign off on the commit (and Greg if needed).

Daniel

Signature · 2 lines
Sent by a consultant of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#5 lore raw
In reply to Gregory Bean
Quoted 10 lines · Gregory Bean

Subject: [PATCH 1/2] msm: Install the Google-Android gpio driver.

From: Arve Hj?nnev?g <[email protected]>

As part of the ongoing effort to converge on a common code base, adopt the Google-Android msmgpio driver, as it has a stronger pedigree than the previous submission from codeaurora.

Cc Arve Hj?nnev?g <[email protected]>

Hello Greg,

A couple comments on this.

Quoted 12 lines
arch/arm/mach-msm/gpio.c new file +12 -0
+struct msm_gpio_chip msm_gpio_chips[] = {
+	{
+		.regs = {
+			.out =         GPIO_OUT_0,
+			.in =          GPIO_IN_0,
+			.int_status =  GPIO_INT_STATUS_0,
+			.int_clear =   GPIO_INT_CLEAR_0,
+			.int_en =      GPIO_INT_EN_0,
+			.int_edge =    GPIO_INT_EDGE_0,
+			.int_pos =     GPIO_INT_POS_0,
+			.oe =          GPIO_OE_0,
+		},

arch/arm/mach-msm/gpio.c line 181

Quoted 10 lines
arch/arm/mach-msm/gpio.c new file +10 -0
+		.chip = {
+			.base = 0,
+			.ngpio = 16,
+			.get = msm_gpio_get,
+			.set = msm_gpio_set,
+			.direction_input = msm_gpio_direction_input,
+			.direction_output = msm_gpio_direction_output,
+			.to_irq = msm_gpio_to_irq,
+		}
+	},

This is a bit ugly... A 204 line struct definition is a bit hard to follow, especially the way it's broken up with all the #if defined stuff.

Each gpio "bank" is code duplication other than the .base and .ngpio. The whole thing can be reduced using a helper macro. Something like this:

#define MSM_GPIO_BANK(bank, base_gpio, num_gpio)			\
	{										\
		.regs = {								\
			.out			= GPIO_OUT_##bank,		\
			.in			= GPIO_IN_##bank,			\
			.int_status		= GPIO_INT_STATUS_##bank,	\
			.int_clear		= GPIO_INT_CLEAR_##bank,	\
			.int_en		= GPIO_INT_EN_##bank,		\
			.int_edge		= GPIO_INT_EDGE_##bank,		\
			.int_pos		= GPIO_INT_POS_##bank,		\
			.oe			= GPIO_OE_##bank,			\
		},									\
		.chip = {								\
			.direction_input	= msm_gpio_direction_input,	\
			.direction_output	= msm_gpio_direction_output,	\
			.get			= msm_gpio_get,			\
			.set			= msm_gpio_set,			\
			.to_irq		= msm_gpio_to_irq,		\
			.base			= base_gpio,			\
			.ngpio		= num_gpio,				\
		},									\
	}

Then the struct definition can be reduced to this:

struct msm_gpio_chip msm_gpio_chips[] = {

#if defined(CONFIG_ARCH_MSM7X30)
	MSM_GPIO_BANK(0, 0, 16),	/* gpio 0-15 */
	MSM_GPIO_BANK(1, 16, 28),	/* gpio 16-43 */
	MSM_GPIO_BANK(2, 44, 24),	/* gpio 44-67 */
	MSM_GPIO_BANK(3, 68, 27),	/* gpio 68-94 */
	MSM_GPIO_BANK(4, 95, 12),	/* gpio 95-106 */
	MSM_GPIO_BANK(5, 107, 27),	/* gpio 107-133 */
	MSM_GPIO_BANK(6, 134, 17),	/* gpio 134-150 */
	MSM_GPIO_BANK(7, 151, 31),	/* gpio 151-181 */
#elif defined(CONFIG_ARCH_QSD8X50)
	MSM_GPIO_BANK(0, 0, 16),	/* gpio 0-15 */
	MSM_GPIO_BANK(1, 16, 27),	/* gpio 16-42 */
	MSM_GPIO_BANK(2, 43, 25),	/* gpio 43-67 */
	MSM_GPIO_BANK(3, 68, 27),	/* gpio 68-94 */
	MSM_GPIO_BANK(4, 95, 9),	/* gpio 95-103 */
	MSM_GPIO_BANK(5, 104, 18),	/* gpio 104-121 */
	MSM_GPIO_BANK(6, 122, 31),	/* gpio 122-152 */
	MSM_GPIO_BANK(7, 153, 12),	/* gpio 153-164 */
#else
	MSM_GPIO_BANK(0, 0, 16),	/* gpio 0-15 */
	MSM_GPIO_BANK(1, 16, 27),	/* gpio 16-42 */
	MSM_GPIO_BANK(2, 43, 25),	/* gpio 43-67 */
	MSM_GPIO_BANK(3, 68, 27),	/* gpio 68-94 */
	MSM_GPIO_BANK(4, 95, 12),	/* gpio 95-106 */
	MSM_GPIO_BANK(5, 107, 15),	/* gpio 107-121 */

#endif
};

I'm not sure if that macro will actually work correctly. But you should get the idea.

Quoted 7 lines
arch/arm/mach-msm/gpio_hw.h new file +7 -0
+#if defined(CONFIG_ARCH_MSM7X30)
+#define GPIO1_REG(off) (MSM_GPIO1_BASE + (off))
+#define GPIO2_REG(off) (MSM_GPIO2_BASE + 0x400 + (off))
+#else
+#define GPIO1_REG(off) (MSM_GPIO1_BASE + 0x800 + (off))
+#define GPIO2_REG(off) (MSM_GPIO2_BASE + 0xC00 + (off))
+#endif

arch/arm/mach-msm/gpio_hw.h line 50

Quoted 10 lines
arch/arm/mach-msm/gpio_hw.h new file +10 -0
+
+#if defined(CONFIG_ARCH_MSM7X00A) || defined(CONFIG_ARCH_MSM7X27)
+
+/* output value */
+#define GPIO_OUT_0         GPIO1_REG(0x00)  /* gpio  15-0  */
+#define GPIO_OUT_1         GPIO2_REG(0x00)  /* gpio  42-16 */
+#define GPIO_OUT_2         GPIO1_REG(0x04)  /* gpio  67-43 */
+#define GPIO_OUT_3         GPIO1_REG(0x08)  /* gpio  94-68 */
+#define GPIO_OUT_4         GPIO1_REG(0x0C)  /* gpio 106-95 */
+#define GPIO_OUT_5         GPIO1_REG(0x50)  /* gpio 107-121 */

I realize this header is private (i.e. in the mach-msm directory) but you should probably prefix all of these GPIO_* defines with something to prevent any namespace clashes.

Regards,
Hartley

#6 lore raw
Quoted 96 lines · H Hartley Sweeten
Quoted 10 lines · Gregory Bean

Subject: [PATCH 1/2] msm: Install the Google-Android gpio driver.

From: Arve Hj?nnev?g <[email protected]>

As part of the ongoing effort to converge on a common code base, adopt the Google-Android msmgpio driver, as it has a stronger pedigree than the previous submission from codeaurora.

Cc Arve Hj?nnev?g <[email protected]>

Hello Greg,

A couple comments on this.

Quoted 12 lines
arch/arm/mach-msm/gpio.c new file +12 -0
+struct msm_gpio_chip msm_gpio_chips[] = {
+	{
+		.regs = {
+			.out =         GPIO_OUT_0,
+			.in =          GPIO_IN_0,
+			.int_status =  GPIO_INT_STATUS_0,
+			.int_clear =   GPIO_INT_CLEAR_0,
+			.int_en =      GPIO_INT_EN_0,
+			.int_edge =    GPIO_INT_EDGE_0,
+			.int_pos =     GPIO_INT_POS_0,
+			.oe =          GPIO_OE_0,
+		},

arch/arm/mach-msm/gpio.c line 181

Quoted 10 lines
arch/arm/mach-msm/gpio.c new file +10 -0
+		.chip = {
+			.base = 0,
+			.ngpio = 16,
+			.get = msm_gpio_get,
+			.set = msm_gpio_set,
+			.direction_input = msm_gpio_direction_input,
+			.direction_output = msm_gpio_direction_output,
+			.to_irq = msm_gpio_to_irq,
+		}
+	},

This is a bit ugly... A 204 line struct definition is a bit hard to follow, especially the way it's broken up with all the #if defined stuff.

Each gpio "bank" is code duplication other than the .base and .ngpio. The whole thing can be reduced using a helper macro. Something like this:

#define MSM_GPIO_BANK(bank, base_gpio, num_gpio)			\
	{										\
		.regs = {								\
			.out			= GPIO_OUT_##bank,		\
			.in			= GPIO_IN_##bank,			\
			.int_status		= GPIO_INT_STATUS_##bank,	\
			.int_clear		= GPIO_INT_CLEAR_##bank,	\
			.int_en		= GPIO_INT_EN_##bank,		\
			.int_edge		= GPIO_INT_EDGE_##bank,		\
			.int_pos		= GPIO_INT_POS_##bank,		\
			.oe			= GPIO_OE_##bank,			\
		},									\
		.chip = {								\
			.direction_input	= msm_gpio_direction_input,	\
			.direction_output	= msm_gpio_direction_output,	\
			.get			= msm_gpio_get,			\
			.set			= msm_gpio_set,			\
			.to_irq		= msm_gpio_to_irq,		\
			.base			= base_gpio,			\
			.ngpio		= num_gpio,				\
		},									\
	}

Then the struct definition can be reduced to this:

struct msm_gpio_chip msm_gpio_chips[] = {

#if defined(CONFIG_ARCH_MSM7X30)
	MSM_GPIO_BANK(0, 0, 16),	/* gpio 0-15 */
	MSM_GPIO_BANK(1, 16, 28),	/* gpio 16-43 */
	MSM_GPIO_BANK(2, 44, 24),	/* gpio 44-67 */
	MSM_GPIO_BANK(3, 68, 27),	/* gpio 68-94 */
	MSM_GPIO_BANK(4, 95, 12),	/* gpio 95-106 */
	MSM_GPIO_BANK(5, 107, 27),	/* gpio 107-133 */
	MSM_GPIO_BANK(6, 134, 17),	/* gpio 134-150 */
	MSM_GPIO_BANK(7, 151, 31),	/* gpio 151-181 */
#elif defined(CONFIG_ARCH_QSD8X50)
	MSM_GPIO_BANK(0, 0, 16),	/* gpio 0-15 */
	MSM_GPIO_BANK(1, 16, 27),	/* gpio 16-42 */
	MSM_GPIO_BANK(2, 43, 25),	/* gpio 43-67 */
	MSM_GPIO_BANK(3, 68, 27),	/* gpio 68-94 */
	MSM_GPIO_BANK(4, 95, 9),	/* gpio 95-103 */
	MSM_GPIO_BANK(5, 104, 18),	/* gpio 104-121 */
	MSM_GPIO_BANK(6, 122, 31),	/* gpio 122-152 */
	MSM_GPIO_BANK(7, 153, 12),	/* gpio 153-164 */
#else
	MSM_GPIO_BANK(0, 0, 16),	/* gpio 0-15 */
	MSM_GPIO_BANK(1, 16, 27),	/* gpio 16-42 */
	MSM_GPIO_BANK(2, 43, 25),	/* gpio 43-67 */
	MSM_GPIO_BANK(3, 68, 27),	/* gpio 68-94 */
	MSM_GPIO_BANK(4, 95, 12),	/* gpio 95-106 */
	MSM_GPIO_BANK(5, 107, 15),	/* gpio 107-121 */
Quoted 3 lines

#endif
};

Yeah, this macro method is much nicer. It drops 204 lines down to less than half that.. Less duplication and less lines to maintain.

Thanks for the review Hartley.

Daniel

Signature · 2 lines
Sent by a consultant of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#7 lore raw
Quoted 91 lines · Daniel Walker
Quoted 90 lines · H Hartley Sweeten
Quoted 10 lines · Gregory Bean

Subject: [PATCH 1/2] msm: Install the Google-Android gpio driver.

From: Arve Hjønnevåg <[email protected]>

As part of the ongoing effort to converge on a common code base, adopt the Google-Android msmgpio driver, as it has a stronger pedigree than the previous submission from codeaurora.

Cc Arve Hjønnevåg <[email protected]>

Hello Greg,

A couple comments on this.

Quoted 12 lines
arch/arm/mach-msm/gpio.c new file +12 -0
+struct msm_gpio_chip msm_gpio_chips[] = {
+	{
+		.regs = {
+			.out =         GPIO_OUT_0,
+			.in =          GPIO_IN_0,
+			.int_status =  GPIO_INT_STATUS_0,
+			.int_clear =   GPIO_INT_CLEAR_0,
+			.int_en =      GPIO_INT_EN_0,
+			.int_edge =    GPIO_INT_EDGE_0,
+			.int_pos =     GPIO_INT_POS_0,
+			.oe =          GPIO_OE_0,
+		},

arch/arm/mach-msm/gpio.c line 181

Quoted 10 lines
arch/arm/mach-msm/gpio.c new file +10 -0
+		.chip = {
+			.base = 0,
+			.ngpio = 16,
+			.get = msm_gpio_get,
+			.set = msm_gpio_set,
+			.direction_input = msm_gpio_direction_input,
+			.direction_output = msm_gpio_direction_output,
+			.to_irq = msm_gpio_to_irq,
+		}
+	},

This is a bit ugly... A 204 line struct definition is a bit hard to follow, especially the way it's broken up with all the #if defined stuff.

Each gpio "bank" is code duplication other than the .base and .ngpio. The whole thing can be reduced using a helper macro. Something like this:

#define MSM_GPIO_BANK(bank, base_gpio, num_gpio)			\
	{										\
		.regs = {								\
			.out			= GPIO_OUT_##bank,		\
			.in			= GPIO_IN_##bank,			\
			.int_status		= GPIO_INT_STATUS_##bank,	\
			.int_clear		= GPIO_INT_CLEAR_##bank,	\
			.int_en		= GPIO_INT_EN_##bank,		\
			.int_edge		= GPIO_INT_EDGE_##bank,		\
			.int_pos		= GPIO_INT_POS_##bank,		\
			.oe			= GPIO_OE_##bank,			\
		},									\
		.chip = {								\
			.direction_input	= msm_gpio_direction_input,	\
			.direction_output	= msm_gpio_direction_output,	\
			.get			= msm_gpio_get,			\
			.set			= msm_gpio_set,			\
			.to_irq		= msm_gpio_to_irq,		\
			.base			= base_gpio,			\
			.ngpio		= num_gpio,				\
		},									\
	}

Then the struct definition can be reduced to this:

struct msm_gpio_chip msm_gpio_chips[] = {

#if defined(CONFIG_ARCH_MSM7X30)
	MSM_GPIO_BANK(0, 0, 16),	/* gpio 0-15 */
	MSM_GPIO_BANK(1, 16, 28),	/* gpio 16-43 */
	MSM_GPIO_BANK(2, 44, 24),	/* gpio 44-67 */
	MSM_GPIO_BANK(3, 68, 27),	/* gpio 68-94 */
	MSM_GPIO_BANK(4, 95, 12),	/* gpio 95-106 */
	MSM_GPIO_BANK(5, 107, 27),	/* gpio 107-133 */
	MSM_GPIO_BANK(6, 134, 17),	/* gpio 134-150 */
	MSM_GPIO_BANK(7, 151, 31),	/* gpio 151-181 */
#elif defined(CONFIG_ARCH_QSD8X50)
	MSM_GPIO_BANK(0, 0, 16),	/* gpio 0-15 */
	MSM_GPIO_BANK(1, 16, 27),	/* gpio 16-42 */
	MSM_GPIO_BANK(2, 43, 25),	/* gpio 43-67 */
	MSM_GPIO_BANK(3, 68, 27),	/* gpio 68-94 */
	MSM_GPIO_BANK(4, 95, 9),	/* gpio 95-103 */
	MSM_GPIO_BANK(5, 104, 18),	/* gpio 104-121 */
	MSM_GPIO_BANK(6, 122, 31),	/* gpio 122-152 */
	MSM_GPIO_BANK(7, 153, 12),	/* gpio 153-164 */

#else

Quoted 8 lines
Quoted 8 lines
	MSM_GPIO_BANK(0, 0, 16),	/* gpio 0-15 */
	MSM_GPIO_BANK(1, 16, 27),	/* gpio 16-42 */
	MSM_GPIO_BANK(2, 43, 25),	/* gpio 43-67 */
	MSM_GPIO_BANK(3, 68, 27),	/* gpio 68-94 */
	MSM_GPIO_BANK(4, 95, 12),	/* gpio 95-106 */
	MSM_GPIO_BANK(5, 107, 15),	/* gpio 107-121 */

#endif
};

Which could also be further reduced to:

struct msm_gpio_chip msm_gpio_chips[] = {
	MSM_GPIO_BANK(0,   0, 16),	/* gpio 0-15 */
#if defined(CONFIG_ARCH_MSM7X30)
	MSM_GPIO_BANK(1,  16, 28),	/* gpio 16-43 */
 	MSM_GPIO_BANK(2,  44, 24),	/* gpio 44-67 */
 	MSM_GPIO_BANK(3,  68, 27),	/* gpio 68-94 */
 	MSM_GPIO_BANK(4,  95, 12),	/* gpio 95-106 */
 	MSM_GPIO_BANK(5, 107, 27),	/* gpio 107-133 */
 	MSM_GPIO_BANK(6, 134, 17),	/* gpio 134-150 */
 	MSM_GPIO_BANK(7, 151, 31),	/* gpio 151-181 */
#else
	MSM_GPIO_BANK(1,  16, 27),	/* gpio 16-42 */
	MSM_GPIO_BANK(2,  43, 25),	/* gpio 43-67 */
 	MSM_GPIO_BANK(3,  68, 27),	/* gpio 68-94 */
#if defined(CONFIG_ARCH_QSD8X50)
	MSM_GPIO_BANK(4,  95,  9),	/* gpio 95-103 */
 	MSM_GPIO_BANK(5, 104, 18),	/* gpio 104-121 */
 	MSM_GPIO_BANK(6, 122, 31),	/* gpio 122-152 */
 	MSM_GPIO_BANK(7, 153, 12),	/* gpio 153-164 */	
#else
	MSM_GPIO_BANK(4,  95, 12),	/* gpio 95-106 */

MSM_GPIO_BANK(5, 107, 15), /* gpio 107-121 */
#endif
#endif

~Ryan

Signature · 7 lines
Bluewater Systems Ltd - ARM Technology Solution Centre

Ryan Mallon         		5 Amuri Park, 404 Barbadoes St
[email protected]         	PO Box 13 889, Christchurch 8013
http://www.bluewatersys.com	New Zealand
Phone: +64 3 3779127		Freecall: Australia 1800 148 751
Fax:   +64 3 3779135			  USA 1800 261 2934