All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sundar Iyer <sundar.iyer@stericsson.com>
To: <linux-arm-kernel@lists.infradead.org>,
	<dmitry.torokhov@gmail.com>, <sameo@linux.intel.com>,
	<ben-linux@fluff.org>
Cc: <linux-input@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	Sundar Iyer <sundar.iyer@stericsson.com>
Subject: [PATCH 09/20] mfd/tc3589x: add block identifier for multiple child devices
Date: Fri, 3 Dec 2010 20:35:42 +0530	[thread overview]
Message-ID: <1291388753-14662-10-git-send-email-sundar.iyer@stericsson.com> (raw)
In-Reply-To: <1291388753-14662-1-git-send-email-sundar.iyer@stericsson.com>

Add block identifier to be able to add multiple mfd clients
to the mfd core

Signed-off-by: Sundar Iyer <sundar.iyer@stericsson.com>
---
 arch/arm/mach-ux500/board-mop500.c |    1 +
 drivers/mfd/tc3589x.c              |   28 +++++++++++++++++++++++-----
 include/linux/mfd/tc3589x.h        |    7 +++++++
 3 files changed, 31 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-ux500/board-mop500.c b/arch/arm/mach-ux500/board-mop500.c
index 6aaf382..703840b 100644
--- a/arch/arm/mach-ux500/board-mop500.c
+++ b/arch/arm/mach-ux500/board-mop500.c
@@ -123,6 +123,7 @@ static struct tc3589x_gpio_platform_data mop500_tc35892_gpio_data = {
 };
 
 static struct tc3589x_platform_data mop500_tc35892_data = {
+	.block		= TC3589x_BLOCK_GPIO,
 	.gpio		= &mop500_tc35892_gpio_data,
 	.irq_base	= MOP500_EGPIO_IRQ_BASE,
 };
diff --git a/drivers/mfd/tc3589x.c b/drivers/mfd/tc3589x.c
index 7deff53..0ed9669 100644
--- a/drivers/mfd/tc3589x.c
+++ b/drivers/mfd/tc3589x.c
@@ -129,7 +129,7 @@ static struct resource gpio_resources[] = {
 	},
 };
 
-static struct mfd_cell tc3589x_devs[] = {
+static struct mfd_cell tc3589x_dev_gpio[] = {
 	{
 		.name		= "tc3589x-gpio",
 		.num_resources	= ARRAY_SIZE(gpio_resources),
@@ -240,6 +240,26 @@ static int tc3589x_chip_init(struct tc3589x *tc3589x)
 	return tc3589x_reg_write(tc3589x, TC3589x_RSTINTCLR, 0x1);
 }
 
+static int __devinit tc3589x_device_init(struct tc3589x *tc3589x)
+{
+	int ret = 0;
+	unsigned int blocks = tc3589x->pdata->block;
+
+	if (blocks & TC3589x_BLOCK_GPIO) {
+		ret = mfd_add_devices(tc3589x->dev, -1, tc3589x_dev_gpio,
+				ARRAY_SIZE(tc3589x_dev_gpio), NULL,
+				tc3589x->irq_base);
+		if (ret) {
+			dev_err(tc3589x->dev, "failed to add gpio child\n");
+			return ret;
+		}
+		dev_info(tc3589x->dev, "added gpio block\n");
+	}
+
+	return ret;
+
+}
+
 static int __devinit tc3589x_probe(struct i2c_client *i2c,
 				   const struct i2c_device_id *id)
 {
@@ -281,11 +301,9 @@ static int __devinit tc3589x_probe(struct i2c_client *i2c,
 		goto out_removeirq;
 	}
 
-	ret = mfd_add_devices(tc3589x->dev, -1, tc3589x_devs,
-			      ARRAY_SIZE(tc3589x_devs), NULL,
-			      tc3589x->irq_base);
+	ret = tc3589x_device_init(tc3589x);
 	if (ret) {
-		dev_err(tc3589x->dev, "failed to add children\n");
+		dev_err(tc3589x->dev, "failed to add child devices\n");
 		goto out_freeirq;
 	}
 
diff --git a/include/linux/mfd/tc3589x.h b/include/linux/mfd/tc3589x.h
index ea19188..da00958 100644
--- a/include/linux/mfd/tc3589x.h
+++ b/include/linux/mfd/tc3589x.h
@@ -9,6 +9,11 @@
 
 #include <linux/device.h>
 
+enum tx3589x_block {
+	TC3589x_BLOCK_GPIO        = 1 << 0,
+	TC3589x_BLOCK_KEYPAD      = 1 << 1,
+};
+
 #define TC3589x_RSTCTRL_IRQRST	(1 << 4)
 #define TC3589x_RSTCTRL_TIMRST	(1 << 3)
 #define TC3589x_RSTCTRL_ROTRST	(1 << 2)
@@ -122,10 +127,12 @@ struct tc3589x_gpio_platform_data {
 
 /**
  * struct tc3589x_platform_data - TC3589x platform data
+ * @block: bitmask of blocks to enable (use TC3589x_BLOCK_*)
  * @irq_base: base IRQ number.  %TC3589x_NR_IRQS irqs will be used.
  * @gpio: GPIO-specific platform data
  */
 struct tc3589x_platform_data {
+	unsigned int block;
 	int irq_base;
 	struct tc3589x_gpio_platform_data *gpio;
 };
-- 
1.7.2.dirty


WARNING: multiple messages have this Message-ID (diff)
From: Sundar Iyer <sundar.iyer@stericsson.com>
To: linux-arm-kernel@lists.infradead.org, dmitry.torokhov@gmail.com,
	sameo@linux.intel.com, ben-linux@fluff.org
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
	Sundar Iyer <sundar.iyer@stericsson.com>
Subject: [PATCH 09/20] mfd/tc3589x: add block identifier for multiple child devices
Date: Fri, 3 Dec 2010 20:35:42 +0530	[thread overview]
Message-ID: <1291388753-14662-10-git-send-email-sundar.iyer@stericsson.com> (raw)
In-Reply-To: <1291388753-14662-1-git-send-email-sundar.iyer@stericsson.com>

Add block identifier to be able to add multiple mfd clients
to the mfd core

Signed-off-by: Sundar Iyer <sundar.iyer@stericsson.com>
---
 arch/arm/mach-ux500/board-mop500.c |    1 +
 drivers/mfd/tc3589x.c              |   28 +++++++++++++++++++++++-----
 include/linux/mfd/tc3589x.h        |    7 +++++++
 3 files changed, 31 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-ux500/board-mop500.c b/arch/arm/mach-ux500/board-mop500.c
index 6aaf382..703840b 100644
--- a/arch/arm/mach-ux500/board-mop500.c
+++ b/arch/arm/mach-ux500/board-mop500.c
@@ -123,6 +123,7 @@ static struct tc3589x_gpio_platform_data mop500_tc35892_gpio_data = {
 };
 
 static struct tc3589x_platform_data mop500_tc35892_data = {
+	.block		= TC3589x_BLOCK_GPIO,
 	.gpio		= &mop500_tc35892_gpio_data,
 	.irq_base	= MOP500_EGPIO_IRQ_BASE,
 };
diff --git a/drivers/mfd/tc3589x.c b/drivers/mfd/tc3589x.c
index 7deff53..0ed9669 100644
--- a/drivers/mfd/tc3589x.c
+++ b/drivers/mfd/tc3589x.c
@@ -129,7 +129,7 @@ static struct resource gpio_resources[] = {
 	},
 };
 
-static struct mfd_cell tc3589x_devs[] = {
+static struct mfd_cell tc3589x_dev_gpio[] = {
 	{
 		.name		= "tc3589x-gpio",
 		.num_resources	= ARRAY_SIZE(gpio_resources),
@@ -240,6 +240,26 @@ static int tc3589x_chip_init(struct tc3589x *tc3589x)
 	return tc3589x_reg_write(tc3589x, TC3589x_RSTINTCLR, 0x1);
 }
 
+static int __devinit tc3589x_device_init(struct tc3589x *tc3589x)
+{
+	int ret = 0;
+	unsigned int blocks = tc3589x->pdata->block;
+
+	if (blocks & TC3589x_BLOCK_GPIO) {
+		ret = mfd_add_devices(tc3589x->dev, -1, tc3589x_dev_gpio,
+				ARRAY_SIZE(tc3589x_dev_gpio), NULL,
+				tc3589x->irq_base);
+		if (ret) {
+			dev_err(tc3589x->dev, "failed to add gpio child\n");
+			return ret;
+		}
+		dev_info(tc3589x->dev, "added gpio block\n");
+	}
+
+	return ret;
+
+}
+
 static int __devinit tc3589x_probe(struct i2c_client *i2c,
 				   const struct i2c_device_id *id)
 {
@@ -281,11 +301,9 @@ static int __devinit tc3589x_probe(struct i2c_client *i2c,
 		goto out_removeirq;
 	}
 
-	ret = mfd_add_devices(tc3589x->dev, -1, tc3589x_devs,
-			      ARRAY_SIZE(tc3589x_devs), NULL,
-			      tc3589x->irq_base);
+	ret = tc3589x_device_init(tc3589x);
 	if (ret) {
-		dev_err(tc3589x->dev, "failed to add children\n");
+		dev_err(tc3589x->dev, "failed to add child devices\n");
 		goto out_freeirq;
 	}
 
diff --git a/include/linux/mfd/tc3589x.h b/include/linux/mfd/tc3589x.h
index ea19188..da00958 100644
--- a/include/linux/mfd/tc3589x.h
+++ b/include/linux/mfd/tc3589x.h
@@ -9,6 +9,11 @@
 
 #include <linux/device.h>
 
+enum tx3589x_block {
+	TC3589x_BLOCK_GPIO        = 1 << 0,
+	TC3589x_BLOCK_KEYPAD      = 1 << 1,
+};
+
 #define TC3589x_RSTCTRL_IRQRST	(1 << 4)
 #define TC3589x_RSTCTRL_TIMRST	(1 << 3)
 #define TC3589x_RSTCTRL_ROTRST	(1 << 2)
@@ -122,10 +127,12 @@ struct tc3589x_gpio_platform_data {
 
 /**
  * struct tc3589x_platform_data - TC3589x platform data
+ * @block: bitmask of blocks to enable (use TC3589x_BLOCK_*)
  * @irq_base: base IRQ number.  %TC3589x_NR_IRQS irqs will be used.
  * @gpio: GPIO-specific platform data
  */
 struct tc3589x_platform_data {
+	unsigned int block;
 	int irq_base;
 	struct tc3589x_gpio_platform_data *gpio;
 };
-- 
1.7.2.dirty


WARNING: multiple messages have this Message-ID (diff)
From: sundar.iyer@stericsson.com (Sundar Iyer)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 09/20] mfd/tc3589x: add block identifier for multiple child devices
Date: Fri, 3 Dec 2010 20:35:42 +0530	[thread overview]
Message-ID: <1291388753-14662-10-git-send-email-sundar.iyer@stericsson.com> (raw)
In-Reply-To: <1291388753-14662-1-git-send-email-sundar.iyer@stericsson.com>

Add block identifier to be able to add multiple mfd clients
to the mfd core

Signed-off-by: Sundar Iyer <sundar.iyer@stericsson.com>
---
 arch/arm/mach-ux500/board-mop500.c |    1 +
 drivers/mfd/tc3589x.c              |   28 +++++++++++++++++++++++-----
 include/linux/mfd/tc3589x.h        |    7 +++++++
 3 files changed, 31 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-ux500/board-mop500.c b/arch/arm/mach-ux500/board-mop500.c
index 6aaf382..703840b 100644
--- a/arch/arm/mach-ux500/board-mop500.c
+++ b/arch/arm/mach-ux500/board-mop500.c
@@ -123,6 +123,7 @@ static struct tc3589x_gpio_platform_data mop500_tc35892_gpio_data = {
 };
 
 static struct tc3589x_platform_data mop500_tc35892_data = {
+	.block		= TC3589x_BLOCK_GPIO,
 	.gpio		= &mop500_tc35892_gpio_data,
 	.irq_base	= MOP500_EGPIO_IRQ_BASE,
 };
diff --git a/drivers/mfd/tc3589x.c b/drivers/mfd/tc3589x.c
index 7deff53..0ed9669 100644
--- a/drivers/mfd/tc3589x.c
+++ b/drivers/mfd/tc3589x.c
@@ -129,7 +129,7 @@ static struct resource gpio_resources[] = {
 	},
 };
 
-static struct mfd_cell tc3589x_devs[] = {
+static struct mfd_cell tc3589x_dev_gpio[] = {
 	{
 		.name		= "tc3589x-gpio",
 		.num_resources	= ARRAY_SIZE(gpio_resources),
@@ -240,6 +240,26 @@ static int tc3589x_chip_init(struct tc3589x *tc3589x)
 	return tc3589x_reg_write(tc3589x, TC3589x_RSTINTCLR, 0x1);
 }
 
+static int __devinit tc3589x_device_init(struct tc3589x *tc3589x)
+{
+	int ret = 0;
+	unsigned int blocks = tc3589x->pdata->block;
+
+	if (blocks & TC3589x_BLOCK_GPIO) {
+		ret = mfd_add_devices(tc3589x->dev, -1, tc3589x_dev_gpio,
+				ARRAY_SIZE(tc3589x_dev_gpio), NULL,
+				tc3589x->irq_base);
+		if (ret) {
+			dev_err(tc3589x->dev, "failed to add gpio child\n");
+			return ret;
+		}
+		dev_info(tc3589x->dev, "added gpio block\n");
+	}
+
+	return ret;
+
+}
+
 static int __devinit tc3589x_probe(struct i2c_client *i2c,
 				   const struct i2c_device_id *id)
 {
@@ -281,11 +301,9 @@ static int __devinit tc3589x_probe(struct i2c_client *i2c,
 		goto out_removeirq;
 	}
 
-	ret = mfd_add_devices(tc3589x->dev, -1, tc3589x_devs,
-			      ARRAY_SIZE(tc3589x_devs), NULL,
-			      tc3589x->irq_base);
+	ret = tc3589x_device_init(tc3589x);
 	if (ret) {
-		dev_err(tc3589x->dev, "failed to add children\n");
+		dev_err(tc3589x->dev, "failed to add child devices\n");
 		goto out_freeirq;
 	}
 
diff --git a/include/linux/mfd/tc3589x.h b/include/linux/mfd/tc3589x.h
index ea19188..da00958 100644
--- a/include/linux/mfd/tc3589x.h
+++ b/include/linux/mfd/tc3589x.h
@@ -9,6 +9,11 @@
 
 #include <linux/device.h>
 
+enum tx3589x_block {
+	TC3589x_BLOCK_GPIO        = 1 << 0,
+	TC3589x_BLOCK_KEYPAD      = 1 << 1,
+};
+
 #define TC3589x_RSTCTRL_IRQRST	(1 << 4)
 #define TC3589x_RSTCTRL_TIMRST	(1 << 3)
 #define TC3589x_RSTCTRL_ROTRST	(1 << 2)
@@ -122,10 +127,12 @@ struct tc3589x_gpio_platform_data {
 
 /**
  * struct tc3589x_platform_data - TC3589x platform data
+ * @block: bitmask of blocks to enable (use TC3589x_BLOCK_*)
  * @irq_base: base IRQ number.  %TC3589x_NR_IRQS irqs will be used.
  * @gpio: GPIO-specific platform data
  */
 struct tc3589x_platform_data {
+	unsigned int block;
 	int irq_base;
 	struct tc3589x_gpio_platform_data *gpio;
 };
-- 
1.7.2.dirty

  parent reply	other threads:[~2010-12-03 15:37 UTC|newest]

Thread overview: 100+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-03 15:05 [PATCH 00/20] ux500: platform data, TC3589x keypad driver Sundar Iyer
2010-12-03 15:05 ` Sundar Iyer
2010-12-03 15:05 ` Sundar Iyer
2010-12-03 15:05 ` [PATCH 01/20] mfd/ab8500: remove spi support Sundar Iyer
2010-12-03 15:05   ` Sundar Iyer
2010-12-03 15:05   ` Sundar Iyer
2010-12-09 14:29   ` Samuel Ortiz
2010-12-09 14:29     ` Samuel Ortiz
2010-12-09 14:35     ` Sundar R IYER
2010-12-09 14:35       ` Sundar R IYER
2010-12-09 15:36       ` Samuel Ortiz
2010-12-09 15:36         ` Samuel Ortiz
2010-12-19 20:48         ` Linus Walleij
2010-12-19 20:48           ` Linus Walleij
2010-12-24 10:53           ` Samuel Ortiz
2010-12-24 10:53             ` Samuel Ortiz
2010-12-03 15:05 ` [PATCH 02/20] mach-ux500: deprecate spi support for ab8500 Sundar Iyer
2010-12-03 15:05   ` Sundar Iyer
2010-12-03 15:05   ` Sundar Iyer
2010-12-03 15:05 ` [PATCH 03/20] mach-ux500: move keymaps to new file Sundar Iyer
2010-12-03 15:05   ` Sundar Iyer
2010-12-03 15:05   ` Sundar Iyer
2010-12-19 20:53   ` Linus Walleij
2010-12-19 20:53     ` Linus Walleij
2010-12-03 15:05 ` [PATCH 04/20] nomadik-gpio: allow sleep mode dir/pull to differ from normal mode Sundar Iyer
2010-12-03 15:05   ` Sundar Iyer
2010-12-03 15:05   ` Sundar Iyer
2010-12-03 15:05 ` [PATCH 05/20] mach-ux500: add STMPE1601 platform data Sundar Iyer
2010-12-03 15:05   ` Sundar Iyer
2010-12-03 15:05   ` Sundar Iyer
2010-12-19 20:54   ` Linus Walleij
2010-12-19 20:54     ` Linus Walleij
2010-12-03 15:05 ` [PATCH 06/20] mfd/tc35892: rename tc35892 header to tc3589x Sundar Iyer
2010-12-03 15:05   ` Sundar Iyer
2010-12-03 15:05   ` Sundar Iyer
2010-12-09 15:41   ` Samuel Ortiz
2010-12-09 15:41     ` Samuel Ortiz
2010-12-03 15:05 ` [PATCH 07/20] mfd/tc35892: rename tc35892 core driver " Sundar Iyer
2010-12-03 15:05   ` Sundar Iyer
2010-12-03 15:05   ` Sundar Iyer
2010-12-09 15:42   ` Samuel Ortiz
2010-12-09 15:42     ` Samuel Ortiz
2010-12-03 15:05 ` [PATCH 08/20] mfd/tc3589x: rename tc35892 structs/registers to tc359x Sundar Iyer
2010-12-03 15:05   ` Sundar Iyer
2010-12-03 15:05   ` Sundar Iyer
2010-12-09 15:45   ` Samuel Ortiz
2010-12-09 15:45     ` Samuel Ortiz
2010-12-03 15:05 ` Sundar Iyer [this message]
2010-12-03 15:05   ` [PATCH 09/20] mfd/tc3589x: add block identifier for multiple child devices Sundar Iyer
2010-12-03 15:05   ` Sundar Iyer
2010-12-09 15:48   ` Samuel Ortiz
2010-12-09 15:48     ` Samuel Ortiz
2010-12-03 15:05 ` [PATCH 10/20] input/tc3589x: add tc3589x keypad support Sundar Iyer
2010-12-03 15:05   ` Sundar Iyer
2010-12-03 15:05   ` Sundar Iyer
2010-12-05 18:38   ` Trilok Soni
2010-12-05 18:38     ` Trilok Soni
2010-12-03 15:05 ` [PATCH 11/20] mfd/tc3589x: fix random interrupt misses Sundar Iyer
2010-12-03 15:05   ` Sundar Iyer
2010-12-03 15:05   ` Sundar Iyer
2010-12-09 15:49   ` Samuel Ortiz
2010-12-09 15:49     ` Samuel Ortiz
2010-12-10  4:31     ` Sundar R IYER
2010-12-03 15:05 ` [PATCH 12/20] mfd/tc3589x: undo gpio module reset during chip init Sundar Iyer
2010-12-03 15:05   ` Sundar Iyer
2010-12-03 15:05   ` Sundar Iyer
2010-12-09 15:50   ` Samuel Ortiz
2010-12-09 15:50     ` Samuel Ortiz
2010-12-03 15:05 ` [PATCH 13/20] mfd/tc3589x: add suspend/resume support Sundar Iyer
2010-12-03 15:05   ` Sundar Iyer
2010-12-03 15:05   ` Sundar Iyer
2010-12-09 17:03   ` Samuel Ortiz
2010-12-09 17:03     ` Samuel Ortiz
2010-12-10  4:32     ` Sundar R IYER
2010-12-10  4:32       ` Sundar R IYER
2010-12-10  4:32       ` Sundar R IYER
2010-12-03 15:05 ` [PATCH 14/20] plat-nomadik/gpio: add expander gpio pins enumeration Sundar Iyer
2010-12-03 15:05   ` Sundar Iyer
2010-12-03 15:05   ` Sundar Iyer
2010-12-03 15:05 ` [PATCH 15/20] mach-ux500: add touchscreen interfaces platform data Sundar Iyer
2010-12-03 15:05   ` Sundar Iyer
2010-12-03 15:05   ` Sundar Iyer
2010-12-03 15:05 ` [PATCH 16/20] i2c/nomadik: add adapter name for updated sanity checkings Sundar Iyer
2010-12-03 15:05   ` Sundar Iyer
2010-12-03 15:05   ` Sundar Iyer
2010-12-03 15:05 ` [PATCH 17/20] mach-ux500: add TC35893 keypad platform data Sundar Iyer
2010-12-03 15:05   ` Sundar Iyer
2010-12-03 15:05   ` Sundar Iyer
2010-12-03 15:05 ` [PATCH 18/20] mach-ux500: explicit enable MTU TCR in the kernel Sundar Iyer
2010-12-03 15:05   ` Sundar Iyer
2010-12-03 15:05   ` Sundar Iyer
2010-12-03 15:05 ` [PATCH 19/20] mach-ux500: clean up checkpatch spits Sundar Iyer
2010-12-03 15:05   ` Sundar Iyer
2010-12-03 15:05   ` Sundar Iyer
2010-12-03 15:05 ` [PATCH 20/20] i2c/nomadik: some checkpatch warnings Sundar Iyer
2010-12-03 15:05   ` Sundar Iyer
2010-12-03 15:05   ` Sundar Iyer
2010-12-19 21:03 ` [PATCH 00/20] ux500: platform data, TC3589x keypad driver Linus Walleij
2010-12-19 21:03   ` Linus Walleij
2010-12-19 21:03   ` Linus Walleij

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1291388753-14662-10-git-send-email-sundar.iyer@stericsson.com \
    --to=sundar.iyer@stericsson.com \
    --cc=ben-linux@fluff.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sameo@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.