All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] Extend TCA6424 support
@ 2012-07-10 13:31 ` Chandrabhanu Mahapatra
  0 siblings, 0 replies; 30+ messages in thread
From: Chandrabhanu Mahapatra @ 2012-07-10 13:31 UTC (permalink / raw)
  To: rob.herring
  Cc: linux-kernel, devicetree-discuss, leed.aguilar, Chandrabhanu Mahapatra

Hi everyone!
This following patch series extends support capabilities of TCA6424 through
following patches.

The 1st patch adds 24 bit support for polarity inversion registers by providing
24 bit support for invert variable.
The 2nd patch adds 24 bit support of the variables such as irq_mask, irq_stat, etc.
The 3rd patch extends 24 lines irq support for TCA6424.
The 4th patch corrects the implementation of registration of device irqs using
appropiate api's.

These patches were based on mainline kernel v3.5rc6.

All your comments and suggestions are welcome.

Regards,
Chandrabhanu

Chandrabhanu Mahapatra (1):
  GPIO: PCA953X: Increase size of invert variable to support 24 bit

Leed Aguilar (3):
  gpio/pca953x: increase variables size to support 24 bit of data
  OMAP: Define TCA6424 max number of possible IRQs
  gpio/pca953x: register the device irq using appropriate api's

 arch/arm/plat-omap/include/plat/irqs.h |   11 +++++++-
 drivers/gpio/gpio-pca953x.c            |   47 ++++++++++++++++++--------------
 include/linux/i2c/pca953x.h            |    2 +-
 3 files changed, 38 insertions(+), 22 deletions(-)

-- 
1.7.10


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH 0/4] Extend TCA6424 support
@ 2012-07-10 13:31 ` Chandrabhanu Mahapatra
  0 siblings, 0 replies; 30+ messages in thread
From: Chandrabhanu Mahapatra @ 2012-07-10 13:31 UTC (permalink / raw)
  To: rob.herring
  Cc: linux-kernel, devicetree-discuss, leed.aguilar, Chandrabhanu Mahapatra

Hi everyone!
This following patch series extends support capabilities of TCA6424 through
following patches.

The 1st patch adds 24 bit support for polarity inversion registers by providing
24 bit support for invert variable.
The 2nd patch adds 24 bit support of the variables such as irq_mask, irq_stat, etc.
The 3rd patch extends 24 lines irq support for TCA6424.
The 4th patch corrects the implementation of registration of device irqs using
appropiate api's.

These patches were based on mainline kernel v3.5rc6.

All your comments and suggestions are welcome.

Regards,
Chandrabhanu

Chandrabhanu Mahapatra (1):
  GPIO: PCA953X: Increase size of invert variable to support 24 bit

Leed Aguilar (3):
  gpio/pca953x: increase variables size to support 24 bit of data
  OMAP: Define TCA6424 max number of possible IRQs
  gpio/pca953x: register the device irq using appropriate api's

 arch/arm/plat-omap/include/plat/irqs.h |   11 +++++++-
 drivers/gpio/gpio-pca953x.c            |   47 ++++++++++++++++++--------------
 include/linux/i2c/pca953x.h            |    2 +-
 3 files changed, 38 insertions(+), 22 deletions(-)

-- 
1.7.10

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH 1/4] GPIO: PCA953X: Increase size of invert variable to support 24 bit
  2012-07-10 13:31 ` Chandrabhanu Mahapatra
@ 2012-07-10 13:35   ` Chandrabhanu Mahapatra
  -1 siblings, 0 replies; 30+ messages in thread
From: Chandrabhanu Mahapatra @ 2012-07-10 13:35 UTC (permalink / raw)
  To: grant.likely, linus.walleij, rob.herring
  Cc: linux-kernel, devicetree-discuss, leed.aguilar, Chandrabhanu Mahapatra

TCA6424 is a low voltage 24 bit I2C and SMBus I/O expander of pca953x family
similar to its 16 bit predecessor TCA6416. It comes with three 8-bit active
Input, Output, Polarity Inversion and Configuration registers each. The polarity
of Input ports can be reversed by setting the appropiate bit in Polarity
Inversion registers.

The variables corresponding to Input, Output and Configuration registers have
already been updated to support 24 bit values. This patch thus updates the
invert variable of PCA953X platform data to support 24 bit.

Signed-off-by: Chandrabhanu Mahapatra <cmahapatra@ti.com>
---
 drivers/gpio/gpio-pca953x.c |   11 ++++++-----
 include/linux/i2c/pca953x.h |    2 +-
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c
index 1c313c7..af7024f 100644
--- a/drivers/gpio/gpio-pca953x.c
+++ b/drivers/gpio/gpio-pca953x.c
@@ -564,7 +564,7 @@ static void pca953x_irq_teardown(struct pca953x_chip *chip)
  * WARNING: This is DEPRECATED and will be removed eventually!
  */
 static void
-pca953x_get_alt_pdata(struct i2c_client *client, int *gpio_base, int *invert)
+pca953x_get_alt_pdata(struct i2c_client *client, int *gpio_base, u32 *invert)
 {
 	struct device_node *node;
 	const __be32 *val;
@@ -592,13 +592,13 @@ pca953x_get_alt_pdata(struct i2c_client *client, int *gpio_base, int *invert)
 }
 #else
 static void
-pca953x_get_alt_pdata(struct i2c_client *client, int *gpio_base, int *invert)
+pca953x_get_alt_pdata(struct i2c_client *client, int *gpio_base, u32 *invert)
 {
 	*gpio_base = -1;
 }
 #endif
 
-static int __devinit device_pca953x_init(struct pca953x_chip *chip, int invert)
+static int __devinit device_pca953x_init(struct pca953x_chip *chip, u32 invert)
 {
 	int ret;
 
@@ -617,7 +617,7 @@ out:
 	return ret;
 }
 
-static int __devinit device_pca957x_init(struct pca953x_chip *chip, int invert)
+static int __devinit device_pca957x_init(struct pca953x_chip *chip, u32 invert)
 {
 	int ret;
 	u32 val = 0;
@@ -653,8 +653,9 @@ static int __devinit pca953x_probe(struct i2c_client *client,
 {
 	struct pca953x_platform_data *pdata;
 	struct pca953x_chip *chip;
-	int irq_base=0, invert=0;
+	int irq_base = 0;
 	int ret;
+	u32 invert = 0;
 
 	chip = kzalloc(sizeof(struct pca953x_chip), GFP_KERNEL);
 	if (chip == NULL)
diff --git a/include/linux/i2c/pca953x.h b/include/linux/i2c/pca953x.h
index 139ba52..3c98dd4 100644
--- a/include/linux/i2c/pca953x.h
+++ b/include/linux/i2c/pca953x.h
@@ -11,7 +11,7 @@ struct pca953x_platform_data {
 	unsigned	gpio_base;
 
 	/* initial polarity inversion setting */
-	uint16_t	invert;
+	u32		invert;
 
 	/* interrupt base */
 	int		irq_base;
-- 
1.7.10


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 1/4] GPIO: PCA953X: Increase size of invert variable to support 24 bit
@ 2012-07-10 13:35   ` Chandrabhanu Mahapatra
  0 siblings, 0 replies; 30+ messages in thread
From: Chandrabhanu Mahapatra @ 2012-07-10 13:35 UTC (permalink / raw)
  To: grant.likely, linus.walleij, rob.herring
  Cc: linux-kernel, devicetree-discuss, leed.aguilar, Chandrabhanu Mahapatra

TCA6424 is a low voltage 24 bit I2C and SMBus I/O expander of pca953x family
similar to its 16 bit predecessor TCA6416. It comes with three 8-bit active
Input, Output, Polarity Inversion and Configuration registers each. The polarity
of Input ports can be reversed by setting the appropiate bit in Polarity
Inversion registers.

The variables corresponding to Input, Output and Configuration registers have
already been updated to support 24 bit values. This patch thus updates the
invert variable of PCA953X platform data to support 24 bit.

Signed-off-by: Chandrabhanu Mahapatra <cmahapatra@ti.com>
---
 drivers/gpio/gpio-pca953x.c |   11 ++++++-----
 include/linux/i2c/pca953x.h |    2 +-
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c
index 1c313c7..af7024f 100644
--- a/drivers/gpio/gpio-pca953x.c
+++ b/drivers/gpio/gpio-pca953x.c
@@ -564,7 +564,7 @@ static void pca953x_irq_teardown(struct pca953x_chip *chip)
  * WARNING: This is DEPRECATED and will be removed eventually!
  */
 static void
-pca953x_get_alt_pdata(struct i2c_client *client, int *gpio_base, int *invert)
+pca953x_get_alt_pdata(struct i2c_client *client, int *gpio_base, u32 *invert)
 {
 	struct device_node *node;
 	const __be32 *val;
@@ -592,13 +592,13 @@ pca953x_get_alt_pdata(struct i2c_client *client, int *gpio_base, int *invert)
 }
 #else
 static void
-pca953x_get_alt_pdata(struct i2c_client *client, int *gpio_base, int *invert)
+pca953x_get_alt_pdata(struct i2c_client *client, int *gpio_base, u32 *invert)
 {
 	*gpio_base = -1;
 }
 #endif
 
-static int __devinit device_pca953x_init(struct pca953x_chip *chip, int invert)
+static int __devinit device_pca953x_init(struct pca953x_chip *chip, u32 invert)
 {
 	int ret;
 
@@ -617,7 +617,7 @@ out:
 	return ret;
 }
 
-static int __devinit device_pca957x_init(struct pca953x_chip *chip, int invert)
+static int __devinit device_pca957x_init(struct pca953x_chip *chip, u32 invert)
 {
 	int ret;
 	u32 val = 0;
@@ -653,8 +653,9 @@ static int __devinit pca953x_probe(struct i2c_client *client,
 {
 	struct pca953x_platform_data *pdata;
 	struct pca953x_chip *chip;
-	int irq_base=0, invert=0;
+	int irq_base = 0;
 	int ret;
+	u32 invert = 0;
 
 	chip = kzalloc(sizeof(struct pca953x_chip), GFP_KERNEL);
 	if (chip == NULL)
diff --git a/include/linux/i2c/pca953x.h b/include/linux/i2c/pca953x.h
index 139ba52..3c98dd4 100644
--- a/include/linux/i2c/pca953x.h
+++ b/include/linux/i2c/pca953x.h
@@ -11,7 +11,7 @@ struct pca953x_platform_data {
 	unsigned	gpio_base;
 
 	/* initial polarity inversion setting */
-	uint16_t	invert;
+	u32		invert;
 
 	/* interrupt base */
 	int		irq_base;
-- 
1.7.10

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 2/4] gpio/pca953x: increase variables size to support 24 bit of data
  2012-07-10 13:31 ` Chandrabhanu Mahapatra
@ 2012-07-10 13:35   ` Chandrabhanu Mahapatra
  -1 siblings, 0 replies; 30+ messages in thread
From: Chandrabhanu Mahapatra @ 2012-07-10 13:35 UTC (permalink / raw)
  To: grant.likely, linus.walleij, rob.herring
  Cc: linux-kernel, devicetree-discuss, leed.aguilar, Chandrabhanu Mahapatra

From: Leed Aguilar <leed.aguilar@ti.com>

Increase variable size from u16 to u32 to allocate 24 bit of data required for
the TCA6424 I/O expander device type.

Signed-off-by: Leed Aguilar <leed.aguilar@ti.com>
Signed-off-by: Chandrabhanu Mahapatra <cmahapatra@ti.com>
---
 drivers/gpio/gpio-pca953x.c |   28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c
index af7024f..c3ca7d8 100644
--- a/drivers/gpio/gpio-pca953x.c
+++ b/drivers/gpio/gpio-pca953x.c
@@ -78,10 +78,10 @@ struct pca953x_chip {
 
 #ifdef CONFIG_GPIO_PCA953X_IRQ
 	struct mutex irq_lock;
-	uint16_t irq_mask;
-	uint16_t irq_stat;
-	uint16_t irq_trig_raise;
-	uint16_t irq_trig_fall;
+	u32 irq_mask;
+	u32 irq_stat;
+	u32 irq_trig_raise;
+	u32 irq_trig_fall;
 	int	 irq_base;
 #endif
 
@@ -349,8 +349,8 @@ static void pca953x_irq_bus_lock(struct irq_data *d)
 static void pca953x_irq_bus_sync_unlock(struct irq_data *d)
 {
 	struct pca953x_chip *chip = irq_data_get_irq_chip_data(d);
-	uint16_t new_irqs;
-	uint16_t level;
+	u32 new_irqs;
+	u32 level;
 
 	/* Look for any newly setup interrupt */
 	new_irqs = chip->irq_trig_fall | chip->irq_trig_raise;
@@ -368,8 +368,8 @@ static void pca953x_irq_bus_sync_unlock(struct irq_data *d)
 static int pca953x_irq_set_type(struct irq_data *d, unsigned int type)
 {
 	struct pca953x_chip *chip = irq_data_get_irq_chip_data(d);
-	uint16_t level = d->irq - chip->irq_base;
-	uint16_t mask = 1 << level;
+	u32 level = d->irq - chip->irq_base;
+	u32 mask = 1 << level;
 
 	if (!(type & IRQ_TYPE_EDGE_BOTH)) {
 		dev_err(&chip->client->dev, "irq %d: unsupported type %d\n",
@@ -399,12 +399,12 @@ static struct irq_chip pca953x_irq_chip = {
 	.irq_set_type		= pca953x_irq_set_type,
 };
 
-static uint16_t pca953x_irq_pending(struct pca953x_chip *chip)
+static u32 pca953x_irq_pending(struct pca953x_chip *chip)
 {
 	u32 cur_stat;
-	uint16_t old_stat;
-	uint16_t pending;
-	uint16_t trigger;
+	u32 old_stat;
+	u32 pending;
+	u32 trigger;
 	int ret, offset = 0;
 
 	switch (chip->chip_type) {
@@ -440,8 +440,8 @@ static uint16_t pca953x_irq_pending(struct pca953x_chip *chip)
 static irqreturn_t pca953x_irq_handler(int irq, void *devid)
 {
 	struct pca953x_chip *chip = devid;
-	uint16_t pending;
-	uint16_t level;
+	u32 pending;
+	u32 level;
 
 	pending = pca953x_irq_pending(chip);
 
-- 
1.7.10


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 2/4] gpio/pca953x: increase variables size to support 24 bit of data
@ 2012-07-10 13:35   ` Chandrabhanu Mahapatra
  0 siblings, 0 replies; 30+ messages in thread
From: Chandrabhanu Mahapatra @ 2012-07-10 13:35 UTC (permalink / raw)
  To: grant.likely, linus.walleij, rob.herring
  Cc: linux-kernel, devicetree-discuss, leed.aguilar, Chandrabhanu Mahapatra

From: Leed Aguilar <leed.aguilar@ti.com>

Increase variable size from u16 to u32 to allocate 24 bit of data required for
the TCA6424 I/O expander device type.

Signed-off-by: Leed Aguilar <leed.aguilar@ti.com>
Signed-off-by: Chandrabhanu Mahapatra <cmahapatra@ti.com>
---
 drivers/gpio/gpio-pca953x.c |   28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c
index af7024f..c3ca7d8 100644
--- a/drivers/gpio/gpio-pca953x.c
+++ b/drivers/gpio/gpio-pca953x.c
@@ -78,10 +78,10 @@ struct pca953x_chip {
 
 #ifdef CONFIG_GPIO_PCA953X_IRQ
 	struct mutex irq_lock;
-	uint16_t irq_mask;
-	uint16_t irq_stat;
-	uint16_t irq_trig_raise;
-	uint16_t irq_trig_fall;
+	u32 irq_mask;
+	u32 irq_stat;
+	u32 irq_trig_raise;
+	u32 irq_trig_fall;
 	int	 irq_base;
 #endif
 
@@ -349,8 +349,8 @@ static void pca953x_irq_bus_lock(struct irq_data *d)
 static void pca953x_irq_bus_sync_unlock(struct irq_data *d)
 {
 	struct pca953x_chip *chip = irq_data_get_irq_chip_data(d);
-	uint16_t new_irqs;
-	uint16_t level;
+	u32 new_irqs;
+	u32 level;
 
 	/* Look for any newly setup interrupt */
 	new_irqs = chip->irq_trig_fall | chip->irq_trig_raise;
@@ -368,8 +368,8 @@ static void pca953x_irq_bus_sync_unlock(struct irq_data *d)
 static int pca953x_irq_set_type(struct irq_data *d, unsigned int type)
 {
 	struct pca953x_chip *chip = irq_data_get_irq_chip_data(d);
-	uint16_t level = d->irq - chip->irq_base;
-	uint16_t mask = 1 << level;
+	u32 level = d->irq - chip->irq_base;
+	u32 mask = 1 << level;
 
 	if (!(type & IRQ_TYPE_EDGE_BOTH)) {
 		dev_err(&chip->client->dev, "irq %d: unsupported type %d\n",
@@ -399,12 +399,12 @@ static struct irq_chip pca953x_irq_chip = {
 	.irq_set_type		= pca953x_irq_set_type,
 };
 
-static uint16_t pca953x_irq_pending(struct pca953x_chip *chip)
+static u32 pca953x_irq_pending(struct pca953x_chip *chip)
 {
 	u32 cur_stat;
-	uint16_t old_stat;
-	uint16_t pending;
-	uint16_t trigger;
+	u32 old_stat;
+	u32 pending;
+	u32 trigger;
 	int ret, offset = 0;
 
 	switch (chip->chip_type) {
@@ -440,8 +440,8 @@ static uint16_t pca953x_irq_pending(struct pca953x_chip *chip)
 static irqreturn_t pca953x_irq_handler(int irq, void *devid)
 {
 	struct pca953x_chip *chip = devid;
-	uint16_t pending;
-	uint16_t level;
+	u32 pending;
+	u32 level;
 
 	pending = pca953x_irq_pending(chip);
 
-- 
1.7.10

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 3/4] OMAP: Define TCA6424 max number of possible IRQs
  2012-07-10 13:31 ` Chandrabhanu Mahapatra
@ 2012-07-10 13:36   ` Chandrabhanu Mahapatra
  -1 siblings, 0 replies; 30+ messages in thread
From: Chandrabhanu Mahapatra @ 2012-07-10 13:36 UTC (permalink / raw)
  To: grant.likely, linus.walleij, rob.herring
  Cc: linux-kernel, devicetree-discuss, leed.aguilar, Chandrabhanu Mahapatra

From: Leed Aguilar <leed.aguilar@ti.com>

TCA6424 being a 24 bit I2C and SMBus I/O expander has 24 available GPIO lines
that can be used as IRQs lines. So, the support for 24 more IRQ lines has been
added to the kernel.

Change-Id: I22e4fbb3a1e4c4b53ae698a9b22cdb0f4ad7f4e6
Signed-off-by: Leed Aguilar <leed.aguilar@ti.com>
Signed-off-by: Chandrabhanu Mahapatra <cmahapatra@ti.com>
---
 arch/arm/plat-omap/include/plat/irqs.h |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/arch/arm/plat-omap/include/plat/irqs.h b/arch/arm/plat-omap/include/plat/irqs.h
index 37bbbbb..97c71ba 100644
--- a/arch/arm/plat-omap/include/plat/irqs.h
+++ b/arch/arm/plat-omap/include/plat/irqs.h
@@ -378,8 +378,17 @@
 #endif
 #define OMAP_FPGA_IRQ_END	(OMAP_FPGA_IRQ_BASE + OMAP_FPGA_NR_IRQS)
 
+/* TCA6424A I2C and SMBus I/O expander */
+#define OMAP_TCA6424_IRQ_BASE	(OMAP_FPGA_IRQ_END)
+#ifdef CONFIG_GPIO_PCA953X
+#define OMAP_TCA6424_NR_IRQS	24
+#else
+#define OMAP_TCA6424_NR_IRQS	0
+#endif
+#define OMAP_TCA6424_IRQ_END	(OMAP_TCA6424_IRQ_BASE + OMAP_TCA6424_NR_IRQS)
+
 /* External TWL4030 can handle interrupts on 2430 and 34xx boards */
-#define	TWL4030_IRQ_BASE	(OMAP_FPGA_IRQ_END)
+#define	TWL4030_IRQ_BASE	(OMAP_TCA6424_IRQ_END)
 #ifdef	CONFIG_TWL4030_CORE
 #define	TWL4030_BASE_NR_IRQS	8
 #define	TWL4030_PWR_NR_IRQS	8
-- 
1.7.10


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 3/4] OMAP: Define TCA6424 max number of possible IRQs
@ 2012-07-10 13:36   ` Chandrabhanu Mahapatra
  0 siblings, 0 replies; 30+ messages in thread
From: Chandrabhanu Mahapatra @ 2012-07-10 13:36 UTC (permalink / raw)
  To: grant.likely, linus.walleij, rob.herring
  Cc: linux-kernel, devicetree-discuss, leed.aguilar, Chandrabhanu Mahapatra

From: Leed Aguilar <leed.aguilar@ti.com>

TCA6424 being a 24 bit I2C and SMBus I/O expander has 24 available GPIO lines
that can be used as IRQs lines. So, the support for 24 more IRQ lines has been
added to the kernel.

Change-Id: I22e4fbb3a1e4c4b53ae698a9b22cdb0f4ad7f4e6
Signed-off-by: Leed Aguilar <leed.aguilar@ti.com>
Signed-off-by: Chandrabhanu Mahapatra <cmahapatra@ti.com>
---
 arch/arm/plat-omap/include/plat/irqs.h |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/arch/arm/plat-omap/include/plat/irqs.h b/arch/arm/plat-omap/include/plat/irqs.h
index 37bbbbb..97c71ba 100644
--- a/arch/arm/plat-omap/include/plat/irqs.h
+++ b/arch/arm/plat-omap/include/plat/irqs.h
@@ -378,8 +378,17 @@
 #endif
 #define OMAP_FPGA_IRQ_END	(OMAP_FPGA_IRQ_BASE + OMAP_FPGA_NR_IRQS)
 
+/* TCA6424A I2C and SMBus I/O expander */
+#define OMAP_TCA6424_IRQ_BASE	(OMAP_FPGA_IRQ_END)
+#ifdef CONFIG_GPIO_PCA953X
+#define OMAP_TCA6424_NR_IRQS	24
+#else
+#define OMAP_TCA6424_NR_IRQS	0
+#endif
+#define OMAP_TCA6424_IRQ_END	(OMAP_TCA6424_IRQ_BASE + OMAP_TCA6424_NR_IRQS)
+
 /* External TWL4030 can handle interrupts on 2430 and 34xx boards */
-#define	TWL4030_IRQ_BASE	(OMAP_FPGA_IRQ_END)
+#define	TWL4030_IRQ_BASE	(OMAP_TCA6424_IRQ_END)
 #ifdef	CONFIG_TWL4030_CORE
 #define	TWL4030_BASE_NR_IRQS	8
 #define	TWL4030_PWR_NR_IRQS	8
-- 
1.7.10

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 4/4] gpio/pca953x: register the device irq using appropriate api's
  2012-07-10 13:31 ` Chandrabhanu Mahapatra
@ 2012-07-10 13:36   ` Chandrabhanu Mahapatra
  -1 siblings, 0 replies; 30+ messages in thread
From: Chandrabhanu Mahapatra @ 2012-07-10 13:36 UTC (permalink / raw)
  To: grant.likely, linus.walleij, rob.herring
  Cc: linux-kernel, devicetree-discuss, leed.aguilar, Chandrabhanu Mahapatra

From: Leed Aguilar <leed.aguilar@ti.com>

Here, the implementation of registration of requested IRQs has been corrected
with appropiate api's. The gpio number is requested through gpio_request_one()
API and conversion of the gpio to irq is done using the gpio_to_irq() API.

Change-Id: I964145e2a280d6553ea2c05ea8049810a1983930
Signed-off-by: Leed Aguilar <leed.aguilar@ti.com>
Signed-off-by: Chandrabhanu Mahapatra <cmahapatra@ti.com>
---
 drivers/gpio/gpio-pca953x.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c
index c3ca7d8..27486da 100644
--- a/drivers/gpio/gpio-pca953x.c
+++ b/drivers/gpio/gpio-pca953x.c
@@ -509,7 +509,13 @@ static int pca953x_irq_setup(struct pca953x_chip *chip,
 #endif
 		}
 
-		ret = request_threaded_irq(client->irq,
+		ret = gpio_request_one(client->irq, GPIOF_IN, "pca953x");
+		if (ret) {
+			dev_err(&client->dev, "gpio request failure\n");
+			goto out_failed;
+		}
+
+		ret = request_threaded_irq(gpio_to_irq(client->irq),
 					   NULL,
 					   pca953x_irq_handler,
 					   IRQF_TRIGGER_LOW | IRQF_ONESHOT,
-- 
1.7.10


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 4/4] gpio/pca953x: register the device irq using appropriate api's
@ 2012-07-10 13:36   ` Chandrabhanu Mahapatra
  0 siblings, 0 replies; 30+ messages in thread
From: Chandrabhanu Mahapatra @ 2012-07-10 13:36 UTC (permalink / raw)
  To: grant.likely, linus.walleij, rob.herring
  Cc: linux-kernel, devicetree-discuss, leed.aguilar, Chandrabhanu Mahapatra

From: Leed Aguilar <leed.aguilar@ti.com>

Here, the implementation of registration of requested IRQs has been corrected
with appropiate api's. The gpio number is requested through gpio_request_one()
API and conversion of the gpio to irq is done using the gpio_to_irq() API.

Change-Id: I964145e2a280d6553ea2c05ea8049810a1983930
Signed-off-by: Leed Aguilar <leed.aguilar@ti.com>
Signed-off-by: Chandrabhanu Mahapatra <cmahapatra@ti.com>
---
 drivers/gpio/gpio-pca953x.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c
index c3ca7d8..27486da 100644
--- a/drivers/gpio/gpio-pca953x.c
+++ b/drivers/gpio/gpio-pca953x.c
@@ -509,7 +509,13 @@ static int pca953x_irq_setup(struct pca953x_chip *chip,
 #endif
 		}
 
-		ret = request_threaded_irq(client->irq,
+		ret = gpio_request_one(client->irq, GPIOF_IN, "pca953x");
+		if (ret) {
+			dev_err(&client->dev, "gpio request failure\n");
+			goto out_failed;
+		}
+
+		ret = request_threaded_irq(gpio_to_irq(client->irq),
 					   NULL,
 					   pca953x_irq_handler,
 					   IRQF_TRIGGER_LOW | IRQF_ONESHOT,
-- 
1.7.10

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* Re: [PATCH 1/4] GPIO: PCA953X: Increase size of invert variable to support 24 bit
  2012-07-10 13:35   ` Chandrabhanu Mahapatra
  (?)
@ 2012-07-11 22:02   ` Linus Walleij
  -1 siblings, 0 replies; 30+ messages in thread
From: Linus Walleij @ 2012-07-11 22:02 UTC (permalink / raw)
  To: Chandrabhanu Mahapatra
  Cc: grant.likely, linus.walleij, rob.herring, linux-kernel,
	devicetree-discuss, leed.aguilar

On Tue, Jul 10, 2012 at 3:35 PM, Chandrabhanu Mahapatra
<cmahapatra@ti.com> wrote:

> TCA6424 is a low voltage 24 bit I2C and SMBus I/O expander of pca953x family
> similar to its 16 bit predecessor TCA6416. It comes with three 8-bit active
> Input, Output, Polarity Inversion and Configuration registers each. The polarity
> of Input ports can be reversed by setting the appropiate bit in Polarity
> Inversion registers.
>
> The variables corresponding to Input, Output and Configuration registers have
> already been updated to support 24 bit values. This patch thus updates the
> invert variable of PCA953X platform data to support 24 bit.
>
> Signed-off-by: Chandrabhanu Mahapatra <cmahapatra@ti.com>

I remember this (I think). So expand to 32bit to support 24 bit,
that looks reasonable.

Patch applied.

Thanks,
Linus Walleij

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 2/4] gpio/pca953x: increase variables size to support 24 bit of data
  2012-07-10 13:35   ` Chandrabhanu Mahapatra
  (?)
@ 2012-07-11 22:04   ` Linus Walleij
  -1 siblings, 0 replies; 30+ messages in thread
From: Linus Walleij @ 2012-07-11 22:04 UTC (permalink / raw)
  To: Chandrabhanu Mahapatra
  Cc: grant.likely, linus.walleij, rob.herring, linux-kernel,
	devicetree-discuss, leed.aguilar

On Tue, Jul 10, 2012 at 3:35 PM, Chandrabhanu Mahapatra
<cmahapatra@ti.com> wrote:

> From: Leed Aguilar <leed.aguilar@ti.com>
>
> Increase variable size from u16 to u32 to allocate 24 bit of data required for
> the TCA6424 I/O expander device type.
>
> Signed-off-by: Leed Aguilar <leed.aguilar@ti.com>
> Signed-off-by: Chandrabhanu Mahapatra <cmahapatra@ti.com>

Looks good.

Applied.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 3/4] OMAP: Define TCA6424 max number of possible IRQs
  2012-07-10 13:36   ` Chandrabhanu Mahapatra
  (?)
@ 2012-07-11 22:08   ` Linus Walleij
       [not found]     ` <CAF0AtAs8euY79y-JmD8Bk4oX-8+gwPKsr_JJin+853EesrUTcg@mail.gmail.com>
  -1 siblings, 1 reply; 30+ messages in thread
From: Linus Walleij @ 2012-07-11 22:08 UTC (permalink / raw)
  To: Chandrabhanu Mahapatra, Tony Lindgren
  Cc: grant.likely, linus.walleij, rob.herring, linux-kernel,
	devicetree-discuss, leed.aguilar

On Tue, Jul 10, 2012 at 3:36 PM, Chandrabhanu Mahapatra
<cmahapatra@ti.com> wrote:
> From: Leed Aguilar <leed.aguilar@ti.com>
>
> TCA6424 being a 24 bit I2C and SMBus I/O expander has 24 available GPIO lines
> that can be used as IRQs lines. So, the support for 24 more IRQ lines has been
> added to the kernel.
>
> Change-Id: I22e4fbb3a1e4c4b53ae698a9b22cdb0f4ad7f4e6

Gerrit crap, delete it.

> Signed-off-by: Leed Aguilar <leed.aguilar@ti.com>
> Signed-off-by: Chandrabhanu Mahapatra <cmahapatra@ti.com>

I need an ACK from Tony Lindgren for this patch if I shall take it through
the GPIO tree.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 4/4] gpio/pca953x: register the device irq using appropriate api's
  2012-07-10 13:36   ` Chandrabhanu Mahapatra
  (?)
@ 2012-07-11 22:11   ` Linus Walleij
  2012-07-23  6:52     ` Mahapatra, Chandrabhanu
  -1 siblings, 1 reply; 30+ messages in thread
From: Linus Walleij @ 2012-07-11 22:11 UTC (permalink / raw)
  To: Chandrabhanu Mahapatra
  Cc: grant.likely, linus.walleij, rob.herring, linux-kernel,
	devicetree-discuss, leed.aguilar

On Tue, Jul 10, 2012 at 3:36 PM, Chandrabhanu Mahapatra
<cmahapatra@ti.com> wrote:

> From: Leed Aguilar <leed.aguilar@ti.com>
>
> Here, the implementation of registration of requested IRQs has been corrected
> with appropiate api's. The gpio number is requested through gpio_request_one()
> API and conversion of the gpio to irq is done using the gpio_to_irq() API.
>
> Change-Id: I964145e2a280d6553ea2c05ea8049810a1983930

Delete that.

> Signed-off-by: Leed Aguilar <leed.aguilar@ti.com>
> Signed-off-by: Chandrabhanu Mahapatra <cmahapatra@ti.com>
> ---
>  drivers/gpio/gpio-pca953x.c |    8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c
> index c3ca7d8..27486da 100644
> --- a/drivers/gpio/gpio-pca953x.c
> +++ b/drivers/gpio/gpio-pca953x.c
> @@ -509,7 +509,13 @@ static int pca953x_irq_setup(struct pca953x_chip *chip,
>  #endif
>                 }
>
> -               ret = request_threaded_irq(client->irq,
> +               ret = gpio_request_one(client->irq, GPIOF_IN, "pca953x");

Not that it's really related to this one patch, but why is a GPIO number named
"irq" in client->irq??

> +               if (ret) {
> +                       dev_err(&client->dev, "gpio request failure\n");
> +                       goto out_failed;
> +               }
> +
> +               ret = request_threaded_irq(gpio_to_irq(client->irq),

It gets ever more confused as you're seemingly converting an IRQ to
an IRQ. Can we rename this variable in a separate patch?

Apart from this it looks good, but do I dare apply it without applying
3/4 (that needs ACK:ing)?

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 3/4] OMAP: Define TCA6424 max number of possible IRQs
@ 2012-07-14 20:44         ` Linus Walleij
  0 siblings, 0 replies; 30+ messages in thread
From: Linus Walleij @ 2012-07-14 20:44 UTC (permalink / raw)
  To: Mahapatra, Chandrabhanu
  Cc: Tony Lindgren, grant.likely, linus.walleij, rob.herring,
	linux-kernel, devicetree-discuss, leed.aguilar

On Thu, Jul 12, 2012 at 3:00 PM, Mahapatra, Chandrabhanu
<cmahapatra@ti.com> wrote:

> OK, but if your taking this patch through GPIO tree the better if the 4th
> patch is taken through it. TCA6424 fails if both the patches are not
> present.

If the situation is such they should be squashed into one since the
point after the first before the second patch is not bisectable.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 3/4] OMAP: Define TCA6424 max number of possible IRQs
@ 2012-07-14 20:44         ` Linus Walleij
  0 siblings, 0 replies; 30+ messages in thread
From: Linus Walleij @ 2012-07-14 20:44 UTC (permalink / raw)
  To: Mahapatra, Chandrabhanu
  Cc: linus.walleij-0IS4wlFg1OjSUeElwK9/Pw,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	rob.herring-bsGFqQB8/DxBDgjK7y7TUQ, leed.aguilar-l0cyMroinI0

On Thu, Jul 12, 2012 at 3:00 PM, Mahapatra, Chandrabhanu
<cmahapatra-l0cyMroinI0@public.gmane.org> wrote:

> OK, but if your taking this patch through GPIO tree the better if the 4th
> patch is taken through it. TCA6424 fails if both the patches are not
> present.

If the situation is such they should be squashed into one since the
point after the first before the second patch is not bisectable.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 4/4] gpio/pca953x: register the device irq using appropriate api's
  2012-07-11 22:11   ` Linus Walleij
@ 2012-07-23  6:52     ` Mahapatra, Chandrabhanu
  0 siblings, 0 replies; 30+ messages in thread
From: Mahapatra, Chandrabhanu @ 2012-07-23  6:52 UTC (permalink / raw)
  To: Linus Walleij
  Cc: grant.likely, linus.walleij, rob.herring, linux-kernel,
	devicetree-discuss, leed.aguilar

On Thu, Jul 12, 2012 at 3:41 AM, Linus Walleij <linus.walleij@linaro.org> wrote:
> On Tue, Jul 10, 2012 at 3:36 PM, Chandrabhanu Mahapatra
> <cmahapatra@ti.com> wrote:
>
>> From: Leed Aguilar <leed.aguilar@ti.com>
>>
>> Here, the implementation of registration of requested IRQs has been corrected
>> with appropiate api's. The gpio number is requested through gpio_request_one()
>> API and conversion of the gpio to irq is done using the gpio_to_irq() API.
>>
>> Change-Id: I964145e2a280d6553ea2c05ea8049810a1983930
>
> Delete that.
>
>> Signed-off-by: Leed Aguilar <leed.aguilar@ti.com>
>> Signed-off-by: Chandrabhanu Mahapatra <cmahapatra@ti.com>
>> ---
>>  drivers/gpio/gpio-pca953x.c |    8 +++++++-
>>  1 file changed, 7 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c
>> index c3ca7d8..27486da 100644
>> --- a/drivers/gpio/gpio-pca953x.c
>> +++ b/drivers/gpio/gpio-pca953x.c
>> @@ -509,7 +509,13 @@ static int pca953x_irq_setup(struct pca953x_chip *chip,
>>  #endif
>>                 }
>>
>> -               ret = request_threaded_irq(client->irq,
>> +               ret = gpio_request_one(client->irq, GPIOF_IN, "pca953x");
>
> Not that it's really related to this one patch, but why is a GPIO number named
> "irq" in client->irq??

Sorry, for the late reply. You need not pull this patch. There has
been some slight miss understanding and as it turns out the
gpio_request_one() should actually be done in the board file with the
appropriate gpio number. This gpio number should be converted to irq
in the board file and then finally sent as client->irq to pca953x
driver. Please undo this patch.


-- 
Chandrabhanu Mahapatra
Texas Instruments India Pvt. Ltd.

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH V1 0/3] Extend TCA6424 support
  2012-07-10 13:31 ` Chandrabhanu Mahapatra
@ 2012-07-28  6:05   ` Chandrabhanu Mahapatra
  -1 siblings, 0 replies; 30+ messages in thread
From: Chandrabhanu Mahapatra @ 2012-07-28  6:05 UTC (permalink / raw)
  To: linus.walleij, grant.likely, rob.herring, tony
  Cc: linux-kernel, devicetree-discuss, leed.aguilar, Chandrabhanu Mahapatra

Hi everyone!
This following patch series extends support capabilities of TCA6424 through
following patches.

The 1st patch adds 24 bit support for polarity inversion registers by providing
24 bit support for invert variable.
The 2nd patch adds 24 bit support of the variables such as irq_mask, irq_stat, etc.
The 3rd patch extends 24 lines irq support for TCA6424.

The 4th patch for the previous patch series has been removed.

These patches were based on mainline kernel v3.5rc7.

All your comments and suggestions are welcome.

Regards,
Chandrabhanu

Chandrabhanu Mahapatra (1):
  GPIO: PCA953X: Increase size of invert variable to support 24 bit

Leed Aguilar (2):
  gpio/pca953x: increase variables size to support 24 bit of data
  OMAP: Define TCA6424 max number of possible IRQs

 arch/arm/plat-omap/include/plat/irqs.h |   11 ++++++++-
 drivers/gpio/gpio-pca953x.c            |   39 ++++++++++++++++----------------
 include/linux/i2c/pca953x.h            |    2 +-
 3 files changed, 31 insertions(+), 21 deletions(-)

-- 
1.7.10


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH V1 0/3] Extend TCA6424 support
@ 2012-07-28  6:05   ` Chandrabhanu Mahapatra
  0 siblings, 0 replies; 30+ messages in thread
From: Chandrabhanu Mahapatra @ 2012-07-28  6:05 UTC (permalink / raw)
  To: linus.walleij, grant.likely, rob.herring, tony
  Cc: linux-kernel, devicetree-discuss, leed.aguilar, Chandrabhanu Mahapatra

Hi everyone!
This following patch series extends support capabilities of TCA6424 through
following patches.

The 1st patch adds 24 bit support for polarity inversion registers by providing
24 bit support for invert variable.
The 2nd patch adds 24 bit support of the variables such as irq_mask, irq_stat, etc.
The 3rd patch extends 24 lines irq support for TCA6424.

The 4th patch for the previous patch series has been removed.

These patches were based on mainline kernel v3.5rc7.

All your comments and suggestions are welcome.

Regards,
Chandrabhanu

Chandrabhanu Mahapatra (1):
  GPIO: PCA953X: Increase size of invert variable to support 24 bit

Leed Aguilar (2):
  gpio/pca953x: increase variables size to support 24 bit of data
  OMAP: Define TCA6424 max number of possible IRQs

 arch/arm/plat-omap/include/plat/irqs.h |   11 ++++++++-
 drivers/gpio/gpio-pca953x.c            |   39 ++++++++++++++++----------------
 include/linux/i2c/pca953x.h            |    2 +-
 3 files changed, 31 insertions(+), 21 deletions(-)

-- 
1.7.10

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH V1 1/3] GPIO: PCA953X: Increase size of invert variable to support 24 bit
  2012-07-28  6:05   ` Chandrabhanu Mahapatra
@ 2012-07-28  6:07     ` Chandrabhanu Mahapatra
  -1 siblings, 0 replies; 30+ messages in thread
From: Chandrabhanu Mahapatra @ 2012-07-28  6:07 UTC (permalink / raw)
  To: linus.walleij, grant.likely, rob.herring
  Cc: linux-kernel, devicetree-discuss, leed.aguilar, Chandrabhanu Mahapatra

TCA6424 is a low voltage 24 bit I2C and SMBus I/O expander of pca953x family
similar to its 16 bit predecessor TCA6416. It comes with three 8-bit active
Input, Output, Polarity Inversion and Configuration registers each. The polarity
of Input ports can be reversed by setting the appropiate bit in Polarity
Inversion registers.

The variables corresponding to Input, Output and Configuration registers have
already been updated to support 24 bit values. This patch thus updates the
invert variable of PCA953X platform data to support 24 bit.

Signed-off-by: Chandrabhanu Mahapatra <cmahapatra@ti.com>
---
 drivers/gpio/gpio-pca953x.c |   11 ++++++-----
 include/linux/i2c/pca953x.h |    2 +-
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c
index 1c313c7..af7024f 100644
--- a/drivers/gpio/gpio-pca953x.c
+++ b/drivers/gpio/gpio-pca953x.c
@@ -564,7 +564,7 @@ static void pca953x_irq_teardown(struct pca953x_chip *chip)
  * WARNING: This is DEPRECATED and will be removed eventually!
  */
 static void
-pca953x_get_alt_pdata(struct i2c_client *client, int *gpio_base, int *invert)
+pca953x_get_alt_pdata(struct i2c_client *client, int *gpio_base, u32 *invert)
 {
 	struct device_node *node;
 	const __be32 *val;
@@ -592,13 +592,13 @@ pca953x_get_alt_pdata(struct i2c_client *client, int *gpio_base, int *invert)
 }
 #else
 static void
-pca953x_get_alt_pdata(struct i2c_client *client, int *gpio_base, int *invert)
+pca953x_get_alt_pdata(struct i2c_client *client, int *gpio_base, u32 *invert)
 {
 	*gpio_base = -1;
 }
 #endif
 
-static int __devinit device_pca953x_init(struct pca953x_chip *chip, int invert)
+static int __devinit device_pca953x_init(struct pca953x_chip *chip, u32 invert)
 {
 	int ret;
 
@@ -617,7 +617,7 @@ out:
 	return ret;
 }
 
-static int __devinit device_pca957x_init(struct pca953x_chip *chip, int invert)
+static int __devinit device_pca957x_init(struct pca953x_chip *chip, u32 invert)
 {
 	int ret;
 	u32 val = 0;
@@ -653,8 +653,9 @@ static int __devinit pca953x_probe(struct i2c_client *client,
 {
 	struct pca953x_platform_data *pdata;
 	struct pca953x_chip *chip;
-	int irq_base=0, invert=0;
+	int irq_base = 0;
 	int ret;
+	u32 invert = 0;
 
 	chip = kzalloc(sizeof(struct pca953x_chip), GFP_KERNEL);
 	if (chip == NULL)
diff --git a/include/linux/i2c/pca953x.h b/include/linux/i2c/pca953x.h
index 139ba52..3c98dd4 100644
--- a/include/linux/i2c/pca953x.h
+++ b/include/linux/i2c/pca953x.h
@@ -11,7 +11,7 @@ struct pca953x_platform_data {
 	unsigned	gpio_base;
 
 	/* initial polarity inversion setting */
-	uint16_t	invert;
+	u32		invert;
 
 	/* interrupt base */
 	int		irq_base;
-- 
1.7.10


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH V1 1/3] GPIO: PCA953X: Increase size of invert variable to support 24 bit
@ 2012-07-28  6:07     ` Chandrabhanu Mahapatra
  0 siblings, 0 replies; 30+ messages in thread
From: Chandrabhanu Mahapatra @ 2012-07-28  6:07 UTC (permalink / raw)
  To: linus.walleij, grant.likely, rob.herring
  Cc: linux-kernel, devicetree-discuss, leed.aguilar, Chandrabhanu Mahapatra

TCA6424 is a low voltage 24 bit I2C and SMBus I/O expander of pca953x family
similar to its 16 bit predecessor TCA6416. It comes with three 8-bit active
Input, Output, Polarity Inversion and Configuration registers each. The polarity
of Input ports can be reversed by setting the appropiate bit in Polarity
Inversion registers.

The variables corresponding to Input, Output and Configuration registers have
already been updated to support 24 bit values. This patch thus updates the
invert variable of PCA953X platform data to support 24 bit.

Signed-off-by: Chandrabhanu Mahapatra <cmahapatra@ti.com>
---
 drivers/gpio/gpio-pca953x.c |   11 ++++++-----
 include/linux/i2c/pca953x.h |    2 +-
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c
index 1c313c7..af7024f 100644
--- a/drivers/gpio/gpio-pca953x.c
+++ b/drivers/gpio/gpio-pca953x.c
@@ -564,7 +564,7 @@ static void pca953x_irq_teardown(struct pca953x_chip *chip)
  * WARNING: This is DEPRECATED and will be removed eventually!
  */
 static void
-pca953x_get_alt_pdata(struct i2c_client *client, int *gpio_base, int *invert)
+pca953x_get_alt_pdata(struct i2c_client *client, int *gpio_base, u32 *invert)
 {
 	struct device_node *node;
 	const __be32 *val;
@@ -592,13 +592,13 @@ pca953x_get_alt_pdata(struct i2c_client *client, int *gpio_base, int *invert)
 }
 #else
 static void
-pca953x_get_alt_pdata(struct i2c_client *client, int *gpio_base, int *invert)
+pca953x_get_alt_pdata(struct i2c_client *client, int *gpio_base, u32 *invert)
 {
 	*gpio_base = -1;
 }
 #endif
 
-static int __devinit device_pca953x_init(struct pca953x_chip *chip, int invert)
+static int __devinit device_pca953x_init(struct pca953x_chip *chip, u32 invert)
 {
 	int ret;
 
@@ -617,7 +617,7 @@ out:
 	return ret;
 }
 
-static int __devinit device_pca957x_init(struct pca953x_chip *chip, int invert)
+static int __devinit device_pca957x_init(struct pca953x_chip *chip, u32 invert)
 {
 	int ret;
 	u32 val = 0;
@@ -653,8 +653,9 @@ static int __devinit pca953x_probe(struct i2c_client *client,
 {
 	struct pca953x_platform_data *pdata;
 	struct pca953x_chip *chip;
-	int irq_base=0, invert=0;
+	int irq_base = 0;
 	int ret;
+	u32 invert = 0;
 
 	chip = kzalloc(sizeof(struct pca953x_chip), GFP_KERNEL);
 	if (chip == NULL)
diff --git a/include/linux/i2c/pca953x.h b/include/linux/i2c/pca953x.h
index 139ba52..3c98dd4 100644
--- a/include/linux/i2c/pca953x.h
+++ b/include/linux/i2c/pca953x.h
@@ -11,7 +11,7 @@ struct pca953x_platform_data {
 	unsigned	gpio_base;
 
 	/* initial polarity inversion setting */
-	uint16_t	invert;
+	u32		invert;
 
 	/* interrupt base */
 	int		irq_base;
-- 
1.7.10

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH V1 2/3] gpio/pca953x: increase variables size to support 24 bit of data
  2012-07-28  6:05   ` Chandrabhanu Mahapatra
@ 2012-07-28  6:07     ` Chandrabhanu Mahapatra
  -1 siblings, 0 replies; 30+ messages in thread
From: Chandrabhanu Mahapatra @ 2012-07-28  6:07 UTC (permalink / raw)
  To: linus.walleij, grant.likely, rob.herring
  Cc: linux-kernel, devicetree-discuss, leed.aguilar, Chandrabhanu Mahapatra

From: Leed Aguilar <leed.aguilar@ti.com>

Increase variable size from u16 to u32 to allocate 24 bit of data required for
the TCA6424 I/O expander device type.

Signed-off-by: Leed Aguilar <leed.aguilar@ti.com>
Signed-off-by: Chandrabhanu Mahapatra <cmahapatra@ti.com>
---
 drivers/gpio/gpio-pca953x.c |   28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c
index af7024f..c3ca7d8 100644
--- a/drivers/gpio/gpio-pca953x.c
+++ b/drivers/gpio/gpio-pca953x.c
@@ -78,10 +78,10 @@ struct pca953x_chip {
 
 #ifdef CONFIG_GPIO_PCA953X_IRQ
 	struct mutex irq_lock;
-	uint16_t irq_mask;
-	uint16_t irq_stat;
-	uint16_t irq_trig_raise;
-	uint16_t irq_trig_fall;
+	u32 irq_mask;
+	u32 irq_stat;
+	u32 irq_trig_raise;
+	u32 irq_trig_fall;
 	int	 irq_base;
 #endif
 
@@ -349,8 +349,8 @@ static void pca953x_irq_bus_lock(struct irq_data *d)
 static void pca953x_irq_bus_sync_unlock(struct irq_data *d)
 {
 	struct pca953x_chip *chip = irq_data_get_irq_chip_data(d);
-	uint16_t new_irqs;
-	uint16_t level;
+	u32 new_irqs;
+	u32 level;
 
 	/* Look for any newly setup interrupt */
 	new_irqs = chip->irq_trig_fall | chip->irq_trig_raise;
@@ -368,8 +368,8 @@ static void pca953x_irq_bus_sync_unlock(struct irq_data *d)
 static int pca953x_irq_set_type(struct irq_data *d, unsigned int type)
 {
 	struct pca953x_chip *chip = irq_data_get_irq_chip_data(d);
-	uint16_t level = d->irq - chip->irq_base;
-	uint16_t mask = 1 << level;
+	u32 level = d->irq - chip->irq_base;
+	u32 mask = 1 << level;
 
 	if (!(type & IRQ_TYPE_EDGE_BOTH)) {
 		dev_err(&chip->client->dev, "irq %d: unsupported type %d\n",
@@ -399,12 +399,12 @@ static struct irq_chip pca953x_irq_chip = {
 	.irq_set_type		= pca953x_irq_set_type,
 };
 
-static uint16_t pca953x_irq_pending(struct pca953x_chip *chip)
+static u32 pca953x_irq_pending(struct pca953x_chip *chip)
 {
 	u32 cur_stat;
-	uint16_t old_stat;
-	uint16_t pending;
-	uint16_t trigger;
+	u32 old_stat;
+	u32 pending;
+	u32 trigger;
 	int ret, offset = 0;
 
 	switch (chip->chip_type) {
@@ -440,8 +440,8 @@ static uint16_t pca953x_irq_pending(struct pca953x_chip *chip)
 static irqreturn_t pca953x_irq_handler(int irq, void *devid)
 {
 	struct pca953x_chip *chip = devid;
-	uint16_t pending;
-	uint16_t level;
+	u32 pending;
+	u32 level;
 
 	pending = pca953x_irq_pending(chip);
 
-- 
1.7.10


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH V1 2/3] gpio/pca953x: increase variables size to support 24 bit of data
@ 2012-07-28  6:07     ` Chandrabhanu Mahapatra
  0 siblings, 0 replies; 30+ messages in thread
From: Chandrabhanu Mahapatra @ 2012-07-28  6:07 UTC (permalink / raw)
  To: linus.walleij, grant.likely, rob.herring
  Cc: linux-kernel, devicetree-discuss, leed.aguilar, Chandrabhanu Mahapatra

From: Leed Aguilar <leed.aguilar@ti.com>

Increase variable size from u16 to u32 to allocate 24 bit of data required for
the TCA6424 I/O expander device type.

Signed-off-by: Leed Aguilar <leed.aguilar@ti.com>
Signed-off-by: Chandrabhanu Mahapatra <cmahapatra@ti.com>
---
 drivers/gpio/gpio-pca953x.c |   28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c
index af7024f..c3ca7d8 100644
--- a/drivers/gpio/gpio-pca953x.c
+++ b/drivers/gpio/gpio-pca953x.c
@@ -78,10 +78,10 @@ struct pca953x_chip {
 
 #ifdef CONFIG_GPIO_PCA953X_IRQ
 	struct mutex irq_lock;
-	uint16_t irq_mask;
-	uint16_t irq_stat;
-	uint16_t irq_trig_raise;
-	uint16_t irq_trig_fall;
+	u32 irq_mask;
+	u32 irq_stat;
+	u32 irq_trig_raise;
+	u32 irq_trig_fall;
 	int	 irq_base;
 #endif
 
@@ -349,8 +349,8 @@ static void pca953x_irq_bus_lock(struct irq_data *d)
 static void pca953x_irq_bus_sync_unlock(struct irq_data *d)
 {
 	struct pca953x_chip *chip = irq_data_get_irq_chip_data(d);
-	uint16_t new_irqs;
-	uint16_t level;
+	u32 new_irqs;
+	u32 level;
 
 	/* Look for any newly setup interrupt */
 	new_irqs = chip->irq_trig_fall | chip->irq_trig_raise;
@@ -368,8 +368,8 @@ static void pca953x_irq_bus_sync_unlock(struct irq_data *d)
 static int pca953x_irq_set_type(struct irq_data *d, unsigned int type)
 {
 	struct pca953x_chip *chip = irq_data_get_irq_chip_data(d);
-	uint16_t level = d->irq - chip->irq_base;
-	uint16_t mask = 1 << level;
+	u32 level = d->irq - chip->irq_base;
+	u32 mask = 1 << level;
 
 	if (!(type & IRQ_TYPE_EDGE_BOTH)) {
 		dev_err(&chip->client->dev, "irq %d: unsupported type %d\n",
@@ -399,12 +399,12 @@ static struct irq_chip pca953x_irq_chip = {
 	.irq_set_type		= pca953x_irq_set_type,
 };
 
-static uint16_t pca953x_irq_pending(struct pca953x_chip *chip)
+static u32 pca953x_irq_pending(struct pca953x_chip *chip)
 {
 	u32 cur_stat;
-	uint16_t old_stat;
-	uint16_t pending;
-	uint16_t trigger;
+	u32 old_stat;
+	u32 pending;
+	u32 trigger;
 	int ret, offset = 0;
 
 	switch (chip->chip_type) {
@@ -440,8 +440,8 @@ static uint16_t pca953x_irq_pending(struct pca953x_chip *chip)
 static irqreturn_t pca953x_irq_handler(int irq, void *devid)
 {
 	struct pca953x_chip *chip = devid;
-	uint16_t pending;
-	uint16_t level;
+	u32 pending;
+	u32 level;
 
 	pending = pca953x_irq_pending(chip);
 
-- 
1.7.10

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH V1 3/3] OMAP: Define TCA6424 max number of possible IRQs
  2012-07-28  6:05   ` Chandrabhanu Mahapatra
@ 2012-07-28  6:10     ` Chandrabhanu Mahapatra
  -1 siblings, 0 replies; 30+ messages in thread
From: Chandrabhanu Mahapatra @ 2012-07-28  6:10 UTC (permalink / raw)
  To: linus.walleij, grant.likely, rob.herring, tony
  Cc: linux-kernel, devicetree-discuss, leed.aguilar, Chandrabhanu Mahapatra

From: Leed Aguilar <leed.aguilar@ti.com>

TCA6424 being a 24 bit I2C and SMBus I/O expander has 24 available GPIO lines
that can be used as IRQs lines. So, the support for 24 more IRQ lines has been
added to the kernel.

Signed-off-by: Leed Aguilar <leed.aguilar@ti.com>
Signed-off-by: Chandrabhanu Mahapatra <cmahapatra@ti.com>
---
 arch/arm/plat-omap/include/plat/irqs.h |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/arch/arm/plat-omap/include/plat/irqs.h b/arch/arm/plat-omap/include/plat/irqs.h
index 37bbbbb..97c71ba 100644
--- a/arch/arm/plat-omap/include/plat/irqs.h
+++ b/arch/arm/plat-omap/include/plat/irqs.h
@@ -378,8 +378,17 @@
 #endif
 #define OMAP_FPGA_IRQ_END	(OMAP_FPGA_IRQ_BASE + OMAP_FPGA_NR_IRQS)
 
+/* TCA6424A I2C and SMBus I/O expander */
+#define OMAP_TCA6424_IRQ_BASE	(OMAP_FPGA_IRQ_END)
+#ifdef CONFIG_GPIO_PCA953X
+#define OMAP_TCA6424_NR_IRQS	24
+#else
+#define OMAP_TCA6424_NR_IRQS	0
+#endif
+#define OMAP_TCA6424_IRQ_END	(OMAP_TCA6424_IRQ_BASE + OMAP_TCA6424_NR_IRQS)
+
 /* External TWL4030 can handle interrupts on 2430 and 34xx boards */
-#define	TWL4030_IRQ_BASE	(OMAP_FPGA_IRQ_END)
+#define	TWL4030_IRQ_BASE	(OMAP_TCA6424_IRQ_END)
 #ifdef	CONFIG_TWL4030_CORE
 #define	TWL4030_BASE_NR_IRQS	8
 #define	TWL4030_PWR_NR_IRQS	8
-- 
1.7.10


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH V1 3/3] OMAP: Define TCA6424 max number of possible IRQs
@ 2012-07-28  6:10     ` Chandrabhanu Mahapatra
  0 siblings, 0 replies; 30+ messages in thread
From: Chandrabhanu Mahapatra @ 2012-07-28  6:10 UTC (permalink / raw)
  To: linus.walleij, grant.likely, rob.herring, tony
  Cc: linux-kernel, devicetree-discuss, leed.aguilar, Chandrabhanu Mahapatra

From: Leed Aguilar <leed.aguilar@ti.com>

TCA6424 being a 24 bit I2C and SMBus I/O expander has 24 available GPIO lines
that can be used as IRQs lines. So, the support for 24 more IRQ lines has been
added to the kernel.

Signed-off-by: Leed Aguilar <leed.aguilar@ti.com>
Signed-off-by: Chandrabhanu Mahapatra <cmahapatra@ti.com>
---
 arch/arm/plat-omap/include/plat/irqs.h |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/arch/arm/plat-omap/include/plat/irqs.h b/arch/arm/plat-omap/include/plat/irqs.h
index 37bbbbb..97c71ba 100644
--- a/arch/arm/plat-omap/include/plat/irqs.h
+++ b/arch/arm/plat-omap/include/plat/irqs.h
@@ -378,8 +378,17 @@
 #endif
 #define OMAP_FPGA_IRQ_END	(OMAP_FPGA_IRQ_BASE + OMAP_FPGA_NR_IRQS)
 
+/* TCA6424A I2C and SMBus I/O expander */
+#define OMAP_TCA6424_IRQ_BASE	(OMAP_FPGA_IRQ_END)
+#ifdef CONFIG_GPIO_PCA953X
+#define OMAP_TCA6424_NR_IRQS	24
+#else
+#define OMAP_TCA6424_NR_IRQS	0
+#endif
+#define OMAP_TCA6424_IRQ_END	(OMAP_TCA6424_IRQ_BASE + OMAP_TCA6424_NR_IRQS)
+
 /* External TWL4030 can handle interrupts on 2430 and 34xx boards */
-#define	TWL4030_IRQ_BASE	(OMAP_FPGA_IRQ_END)
+#define	TWL4030_IRQ_BASE	(OMAP_TCA6424_IRQ_END)
 #ifdef	CONFIG_TWL4030_CORE
 #define	TWL4030_BASE_NR_IRQS	8
 #define	TWL4030_PWR_NR_IRQS	8
-- 
1.7.10

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* Re: [PATCH V1 3/3] OMAP: Define TCA6424 max number of possible IRQs
@ 2012-07-29 15:49       ` Linus Walleij
  0 siblings, 0 replies; 30+ messages in thread
From: Linus Walleij @ 2012-07-29 15:49 UTC (permalink / raw)
  To: Chandrabhanu Mahapatra, ext Tony Lindgren
  Cc: linus.walleij, grant.likely, rob.herring, linux-kernel,
	devicetree-discuss, Kevin Hilman

On Sat, Jul 28, 2012 at 8:10 AM, Chandrabhanu Mahapatra
<cmahapatra@ti.com> wrote:

> From: Leed Aguilar <leed.aguilar@ti.com>
>
> TCA6424 being a 24 bit I2C and SMBus I/O expander has 24 available GPIO lines
> that can be used as IRQs lines. So, the support for 24 more IRQ lines has been
> added to the kernel.
>
> Signed-off-by: Leed Aguilar <leed.aguilar@ti.com>
> Signed-off-by: Chandrabhanu Mahapatra <cmahapatra@ti.com>

Tony, this seems to touch only OMAP code, can you judge on it
and take it into your tree of desired?

Alternatively I can merge it to GPIO but then I need your ACK.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH V1 3/3] OMAP: Define TCA6424 max number of possible IRQs
@ 2012-07-29 15:49       ` Linus Walleij
  0 siblings, 0 replies; 30+ messages in thread
From: Linus Walleij @ 2012-07-29 15:49 UTC (permalink / raw)
  To: Chandrabhanu Mahapatra, ext Tony Lindgren
  Cc: Kevin Hilman, linus.walleij-0IS4wlFg1OjSUeElwK9/Pw,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	rob.herring-bsGFqQB8/DxBDgjK7y7TUQ

On Sat, Jul 28, 2012 at 8:10 AM, Chandrabhanu Mahapatra
<cmahapatra-l0cyMroinI0@public.gmane.org> wrote:

> From: Leed Aguilar <leed.aguilar-l0cyMroinI0@public.gmane.org>
>
> TCA6424 being a 24 bit I2C and SMBus I/O expander has 24 available GPIO lines
> that can be used as IRQs lines. So, the support for 24 more IRQ lines has been
> added to the kernel.
>
> Signed-off-by: Leed Aguilar <leed.aguilar-l0cyMroinI0@public.gmane.org>
> Signed-off-by: Chandrabhanu Mahapatra <cmahapatra-l0cyMroinI0@public.gmane.org>

Tony, this seems to touch only OMAP code, can you judge on it
and take it into your tree of desired?

Alternatively I can merge it to GPIO but then I need your ACK.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH V1 1/3] GPIO: PCA953X: Increase size of invert variable to support 24 bit
@ 2012-08-04 23:38       ` Linus Walleij
  0 siblings, 0 replies; 30+ messages in thread
From: Linus Walleij @ 2012-08-04 23:38 UTC (permalink / raw)
  To: Chandrabhanu Mahapatra
  Cc: linus.walleij, grant.likely, rob.herring, linux-kernel,
	devicetree-discuss, leed.aguilar

On Sat, Jul 28, 2012 at 8:07 AM, Chandrabhanu Mahapatra
<cmahapatra@ti.com> wrote:

> TCA6424 is a low voltage 24 bit I2C and SMBus I/O expander of pca953x family
> similar to its 16 bit predecessor TCA6416. It comes with three 8-bit active
> Input, Output, Polarity Inversion and Configuration registers each. The polarity
> of Input ports can be reversed by setting the appropiate bit in Polarity
> Inversion registers.
>
> The variables corresponding to Input, Output and Configuration registers have
> already been updated to support 24 bit values. This patch thus updates the
> invert variable of PCA953X platform data to support 24 bit.
>
> Signed-off-by: Chandrabhanu Mahapatra <cmahapatra@ti.com>

Why did you re-send this?

The patch is already in the upstream kernel. Please rebase your tree to v3.6-rc1
or so.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH V1 1/3] GPIO: PCA953X: Increase size of invert variable to support 24 bit
@ 2012-08-04 23:38       ` Linus Walleij
  0 siblings, 0 replies; 30+ messages in thread
From: Linus Walleij @ 2012-08-04 23:38 UTC (permalink / raw)
  To: Chandrabhanu Mahapatra
  Cc: linus.walleij-0IS4wlFg1OjSUeElwK9/Pw,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	rob.herring-bsGFqQB8/DxBDgjK7y7TUQ, leed.aguilar-l0cyMroinI0

On Sat, Jul 28, 2012 at 8:07 AM, Chandrabhanu Mahapatra
<cmahapatra-l0cyMroinI0@public.gmane.org> wrote:

> TCA6424 is a low voltage 24 bit I2C and SMBus I/O expander of pca953x family
> similar to its 16 bit predecessor TCA6416. It comes with three 8-bit active
> Input, Output, Polarity Inversion and Configuration registers each. The polarity
> of Input ports can be reversed by setting the appropiate bit in Polarity
> Inversion registers.
>
> The variables corresponding to Input, Output and Configuration registers have
> already been updated to support 24 bit values. This patch thus updates the
> invert variable of PCA953X platform data to support 24 bit.
>
> Signed-off-by: Chandrabhanu Mahapatra <cmahapatra-l0cyMroinI0@public.gmane.org>

Why did you re-send this?

The patch is already in the upstream kernel. Please rebase your tree to v3.6-rc1
or so.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH V1 0/3] Extend TCA6424 support
  2012-07-28  6:05   ` Chandrabhanu Mahapatra
                     ` (3 preceding siblings ...)
  (?)
@ 2012-08-04 23:39   ` Linus Walleij
  -1 siblings, 0 replies; 30+ messages in thread
From: Linus Walleij @ 2012-08-04 23:39 UTC (permalink / raw)
  To: Chandrabhanu Mahapatra
  Cc: linus.walleij, grant.likely, rob.herring, tony, linux-kernel,
	devicetree-discuss, leed.aguilar

On Sat, Jul 28, 2012 at 8:05 AM, Chandrabhanu Mahapatra
<cmahapatra@ti.com> wrote:

> These patches were based on mainline kernel v3.5rc7.

Aha. Rebase to v3.6-rc1 because much of this is now upstream.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 30+ messages in thread

end of thread, other threads:[~2012-08-04 23:39 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-10 13:31 [PATCH 0/4] Extend TCA6424 support Chandrabhanu Mahapatra
2012-07-10 13:31 ` Chandrabhanu Mahapatra
2012-07-10 13:35 ` [PATCH 1/4] GPIO: PCA953X: Increase size of invert variable to support 24 bit Chandrabhanu Mahapatra
2012-07-10 13:35   ` Chandrabhanu Mahapatra
2012-07-11 22:02   ` Linus Walleij
2012-07-10 13:35 ` [PATCH 2/4] gpio/pca953x: increase variables size to support 24 bit of data Chandrabhanu Mahapatra
2012-07-10 13:35   ` Chandrabhanu Mahapatra
2012-07-11 22:04   ` Linus Walleij
2012-07-10 13:36 ` [PATCH 3/4] OMAP: Define TCA6424 max number of possible IRQs Chandrabhanu Mahapatra
2012-07-10 13:36   ` Chandrabhanu Mahapatra
2012-07-11 22:08   ` Linus Walleij
     [not found]     ` <CAF0AtAs8euY79y-JmD8Bk4oX-8+gwPKsr_JJin+853EesrUTcg@mail.gmail.com>
2012-07-14 20:44       ` Linus Walleij
2012-07-14 20:44         ` Linus Walleij
2012-07-10 13:36 ` [PATCH 4/4] gpio/pca953x: register the device irq using appropriate api's Chandrabhanu Mahapatra
2012-07-10 13:36   ` Chandrabhanu Mahapatra
2012-07-11 22:11   ` Linus Walleij
2012-07-23  6:52     ` Mahapatra, Chandrabhanu
2012-07-28  6:05 ` [PATCH V1 0/3] Extend TCA6424 support Chandrabhanu Mahapatra
2012-07-28  6:05   ` Chandrabhanu Mahapatra
2012-07-28  6:07   ` [PATCH V1 1/3] GPIO: PCA953X: Increase size of invert variable to support 24 bit Chandrabhanu Mahapatra
2012-07-28  6:07     ` Chandrabhanu Mahapatra
2012-08-04 23:38     ` Linus Walleij
2012-08-04 23:38       ` Linus Walleij
2012-07-28  6:07   ` [PATCH V1 2/3] gpio/pca953x: increase variables size to support 24 bit of data Chandrabhanu Mahapatra
2012-07-28  6:07     ` Chandrabhanu Mahapatra
2012-07-28  6:10   ` [PATCH V1 3/3] OMAP: Define TCA6424 max number of possible IRQs Chandrabhanu Mahapatra
2012-07-28  6:10     ` Chandrabhanu Mahapatra
2012-07-29 15:49     ` Linus Walleij
2012-07-29 15:49       ` Linus Walleij
2012-08-04 23:39   ` [PATCH V1 0/3] Extend TCA6424 support Linus Walleij

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.