From: Mark Brown <broonie@kernel.org>
To: Kukjin Kim <kgene.kim@samsung.com>,
Sangbeom Kim <sbkim73@samsung.com>,
Samuel Ortiz <sameo@linux.intel.com>,
Lee Jones <lee.jones@linaro.org>
Cc: linux-kernel@vger.kernel.org, Mark Brown <broonie@linaro.org>
Subject: [PATCH] mfd: sec: Provide max_register to regmap
Date: Mon, 1 Jul 2013 23:02:19 +0100 [thread overview]
Message-ID: <1372716139-5586-1-git-send-email-broonie@kernel.org> (raw)
From: Mark Brown <broonie@linaro.org>
Enable debugfs register dumps and greater error checking within the
regmap API providing the maximum register to the regmap API.
Signed-off-by: Mark Brown <broonie@linaro.org>
---
drivers/mfd/sec-core.c | 41 ++++++++++++++++++++++++++++++++++++++++-
1 file changed, 40 insertions(+), 1 deletion(-)
diff --git a/drivers/mfd/sec-core.c b/drivers/mfd/sec-core.c
index cc896d1..7976768 100644
--- a/drivers/mfd/sec-core.c
+++ b/drivers/mfd/sec-core.c
@@ -25,6 +25,9 @@
#include <linux/mfd/samsung/core.h>
#include <linux/mfd/samsung/irq.h>
#include <linux/mfd/samsung/rtc.h>
+#include <linux/mfd/samsung/s2mps11.h>
+#include <linux/mfd/samsung/s5m8763.h>
+#include <linux/mfd/samsung/s5m8767.h>
#include <linux/regmap.h>
static struct mfd_cell s5m8751_devs[] = {
@@ -105,6 +108,26 @@ static struct regmap_config sec_regmap_config = {
.val_bits = 8,
};
+static struct regmap_config s2mps11_regmap_config = {
+ .reg_bits = 8,
+ .val_bits = 8,
+
+ .max_register = S2MPS11_REG_L38CTRL,
+};
+
+static struct regmap_config s5m8763_regmap_config = {
+ .reg_bits = 8,
+ .val_bits = 8,
+
+ .max_register = S5M8763_REG_LBCNFG2,
+};
+
+static struct regmap_config s5m8767_regmap_config = {
+ .reg_bits = 8,
+ .val_bits = 8,
+
+ .max_register = S5M8767_REG_LDO28CTRL,
+};
#ifdef CONFIG_OF
/*
@@ -160,6 +183,7 @@ static int sec_pmic_probe(struct i2c_client *i2c,
const struct i2c_device_id *id)
{
struct sec_platform_data *pdata = i2c->dev.platform_data;
+ const struct regmap_config *regmap;
struct sec_pmic_dev *sec_pmic;
int ret;
@@ -190,7 +214,22 @@ static int sec_pmic_probe(struct i2c_client *i2c,
sec_pmic->pdata = pdata;
}
- sec_pmic->regmap = devm_regmap_init_i2c(i2c, &sec_regmap_config);
+ switch (sec_pmic->device_type) {
+ case S2MPS11X:
+ regmap = &s2mps11_regmap_config;
+ break;
+ case S5M8763X:
+ regmap = &s5m8763_regmap_config;
+ break;
+ case S5M8767X:
+ regmap = &s5m8767_regmap_config;
+ break;
+ default:
+ regmap = &sec_regmap_config;
+ break;
+ }
+
+ sec_pmic->regmap = devm_regmap_init_i2c(i2c, regmap);
if (IS_ERR(sec_pmic->regmap)) {
ret = PTR_ERR(sec_pmic->regmap);
dev_err(&i2c->dev, "Failed to allocate register map: %d\n",
--
1.8.3.1
next reply other threads:[~2013-07-01 22:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-01 22:02 Mark Brown [this message]
2013-07-01 22:56 ` [PATCH] mfd: sec: Provide max_register to regmap Samuel Ortiz
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=1372716139-5586-1-git-send-email-broonie@kernel.org \
--to=broonie@kernel.org \
--cc=broonie@linaro.org \
--cc=kgene.kim@samsung.com \
--cc=lee.jones@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sameo@linux.intel.com \
--cc=sbkim73@samsung.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