mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Todd Fischer <todd.fischer@ridgerun.com>
To: linux-kernel@vger.kernel.org,
	davinci-linux-open-source@linux.davincidsp.com,
	sameo@linux.intel.com, lrg@slimlogic.co.uk,
	broonie@opensource.wolfsonmicro.com, todd.fischer@ridgerun.com
Subject: [PATCH 2/4]-V2 Make room for other tps6507x drivers to have board specific initialization data.
Date: Fri,  2 Apr 2010 15:37:31 -0600	[thread overview]
Message-ID: <1270244253-4234-3-git-send-email-todd.fischer@ridgerun.com> (raw)
In-Reply-To: <1270244253-4234-2-git-send-email-todd.fischer@ridgerun.com>

Add mfd structure which refrences sub-driver initialization data. For example,
for a giving hardware implementation, the voltage regulator sub-driver
initialization data provides the mapping betten a voltage regulator and what
the output voltage is being used for.

Signed-off-by: Todd Fischer <todd.fischer@ridgerun.com>
---
 arch/arm/mach-davinci/board-da850-evm.c |    7 ++++++-
 drivers/regulator/tps6507x-regulator.c  |   14 ++++++++++++--
 include/linux/mfd/tps6507x.h            |   11 +++++++++++
 3 files changed, 29 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
index 411284d..d059924 100644
--- a/arch/arm/mach-davinci/board-da850-evm.c
+++ b/arch/arm/mach-davinci/board-da850-evm.c
@@ -17,6 +17,7 @@
 #include <linux/i2c.h>
 #include <linux/i2c/at24.h>
 #include <linux/i2c/pca953x.h>
+#include <linux/mfd/tps6507x.h>
 #include <linux/gpio.h>
 #include <linux/platform_device.h>
 #include <linux/mtd/mtd.h>
@@ -533,10 +534,14 @@ struct regulator_init_data tps65070_regulator_data[] = {
 	},
 };
 
+static struct tps6507x_board tps_board = {
+	.tps6507x_pmic_init_data = &tps65070_regulator_data[0],
+};
+
 static struct i2c_board_info __initdata da850evm_tps65070_info[] = {
 	{
 		I2C_BOARD_INFO("tps6507x", 0x48),
-		.platform_data = &tps65070_regulator_data[0],
+		.platform_data = &tps_board,
 	},
 };
 
diff --git a/drivers/regulator/tps6507x-regulator.c b/drivers/regulator/tps6507x-regulator.c
index 91172e3..becf652 100644
--- a/drivers/regulator/tps6507x-regulator.c
+++ b/drivers/regulator/tps6507x-regulator.c
@@ -488,6 +488,7 @@ static int __devinit tps_6507x_probe(struct i2c_client *client,
 	struct regulator_init_data *init_data;
 	struct regulator_dev *rdev;
 	struct tps_pmic *tps;
+	struct tps6507x_board *tps_board;
 	int i;
 	int error;
 
@@ -496,12 +497,21 @@ static int __devinit tps_6507x_probe(struct i2c_client *client,
 		return -EIO;
 
 	/**
+	 * tps_board points to pmic related constants
+	 * coming from the board-evm file.
+	 */
+
+	tps_board = dev_get_platdata(&client->dev);
+	if (!tps_board)
+		return -EINVAL;
+
+	/**
 	 * init_data points to array of regulator_init structures
 	 * coming from the board-evm file.
 	 */
-	init_data = client->dev.platform_data;
+	init_data = tps_board->tps6507x_pmic_init_data;
 	if (!init_data)
-		return -EIO;
+		return -EINVAL;
 
 	tps = kzalloc(sizeof(*tps), GFP_KERNEL);
 	if (!tps)
diff --git a/include/linux/mfd/tps6507x.h b/include/linux/mfd/tps6507x.h
index 155bee1..fd73af5 100644
--- a/include/linux/mfd/tps6507x.h
+++ b/include/linux/mfd/tps6507x.h
@@ -131,4 +131,15 @@
 /* VDCDC MASK */
 #define TPS6507X_DEFDCDCX_DCDC_MASK		0X3F
 
+/**
+ * struct tps6507x_board - packages regulator and touchscreen init data
+ * @tps6507x_regulator_data: regulator initialization values
+ *
+ * Board data may be used to initialize regulator and touchscreen.
+ */
+
+struct tps6507x_board {
+	struct regulator_init_data *tps6507x_pmic_init_data;
+};
+
 #endif /*  __LINUX_MFD_TPS6507X_H */
-- 
1.6.0.4


  reply	other threads:[~2010-04-02 21:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-02 21:37 [PATCH 0/4]-V2 TPS6507x MFD driver Todd Fischer
2010-04-02 21:37 ` [PATCH 1/4]-V2 Move TPS6507x register definition to header file Todd Fischer
2010-04-02 21:37   ` Todd Fischer [this message]
2010-04-02 21:37     ` [PATCH 3/4]-V2 Cleaned up name space so each MFD sub-driver uses a different name space Todd Fischer
2010-04-02 21:37       ` [PATCH 4/4]-V2 Add MFD driver for TPS6507x family of multi-function chips and move TPS6507x regulator driver from being stand-alone to using the MFD driver Todd Fischer
2010-04-05 13:56         ` Mark Brown
2010-04-05 13:49       ` [PATCH 3/4]-V2 Cleaned up name space so each MFD sub-driver uses a different name space Mark Brown
2010-04-05 13:48     ` [PATCH 2/4]-V2 Make room for other tps6507x drivers to have board specific initialization data Mark Brown
2010-04-05 13:46   ` [PATCH 1/4]-V2 Move TPS6507x register definition to header file Mark Brown

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=1270244253-4234-3-git-send-email-todd.fischer@ridgerun.com \
    --to=todd.fischer@ridgerun.com \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=davinci-linux-open-source@linux.davincidsp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lrg@slimlogic.co.uk \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®