From: Pankaj Dubey <pankaj.dubey@samsung.com> To: linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: krzk@kernel.org, javier@osg.samsung.com, kgene@kernel.org, thomas.ab@samsung.com, myungjoo.ham@samsung.com, Pankaj Dubey <pankaj.dubey@samsung.com>, Lee Jones <lee.jones@linaro.org> Subject: [PATCH 1/6] mfd: max8997: Initialize max8997 register map Date: Mon, 07 Nov 2016 15:39:31 +0530 [thread overview] Message-ID: <1478513376-14307-2-git-send-email-pankaj.dubey@samsung.com> (raw) In-Reply-To: <1478513376-14307-1-git-send-email-pankaj.dubey@samsung.com> This patch add regmap initialization to use register map in max8997-clk device driver CC: Lee Jones <lee.jones@linaro.org> Signed-off-by: Pankaj Dubey <pankaj.dubey@samsung.com> --- drivers/mfd/max8997.c | 14 ++++++++++++++ include/linux/mfd/max8997-private.h | 3 +++ 2 files changed, 17 insertions(+) diff --git a/drivers/mfd/max8997.c b/drivers/mfd/max8997.c index 2d6e2c3..bda9ec8 100644 --- a/drivers/mfd/max8997.c +++ b/drivers/mfd/max8997.c @@ -175,11 +175,17 @@ static inline unsigned long max8997_i2c_get_driver_data(struct i2c_client *i2c, return id->driver_data; } +static const struct regmap_config max8997_regmap_config = { + .reg_bits = 8, + .val_bits = 8, +}; + static int max8997_i2c_probe(struct i2c_client *i2c, const struct i2c_device_id *id) { struct max8997_dev *max8997; struct max8997_platform_data *pdata = dev_get_platdata(&i2c->dev); + const struct regmap_config *config = &max8997_regmap_config; int ret = 0; max8997 = devm_kzalloc(&i2c->dev, sizeof(struct max8997_dev), @@ -202,6 +208,14 @@ static int max8997_i2c_probe(struct i2c_client *i2c, if (!pdata) return ret; + max8997->regmap = devm_regmap_init_i2c(i2c, config); + if (IS_ERR(max8997->regmap)) { + ret = PTR_ERR(max8997->regmap); + dev_err(max8997->dev, "Failed to allocate register map: %d\n", + ret); + return ret; + } + max8997->pdata = pdata; max8997->ono = pdata->ono; diff --git a/include/linux/mfd/max8997-private.h b/include/linux/mfd/max8997-private.h index 78c76cd..50c7129 100644 --- a/include/linux/mfd/max8997-private.h +++ b/include/linux/mfd/max8997-private.h @@ -25,6 +25,7 @@ #include <linux/i2c.h> #include <linux/export.h> #include <linux/irqdomain.h> +#include <linux/regmap.h> #define MAX8997_REG_INVALID (0xff) @@ -388,6 +389,8 @@ struct max8997_dev { struct mutex iolock; unsigned long type; + + struct regmap *regmap; struct platform_device *battery; /* battery control (not fuel gauge) */ int irq; -- 2.7.4
WARNING: multiple messages have this Message-ID (diff)
From: pankaj.dubey@samsung.com (Pankaj Dubey) To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 1/6] mfd: max8997: Initialize max8997 register map Date: Mon, 07 Nov 2016 15:39:31 +0530 [thread overview] Message-ID: <1478513376-14307-2-git-send-email-pankaj.dubey@samsung.com> (raw) In-Reply-To: <1478513376-14307-1-git-send-email-pankaj.dubey@samsung.com> This patch add regmap initialization to use register map in max8997-clk device driver CC: Lee Jones <lee.jones@linaro.org> Signed-off-by: Pankaj Dubey <pankaj.dubey@samsung.com> --- drivers/mfd/max8997.c | 14 ++++++++++++++ include/linux/mfd/max8997-private.h | 3 +++ 2 files changed, 17 insertions(+) diff --git a/drivers/mfd/max8997.c b/drivers/mfd/max8997.c index 2d6e2c3..bda9ec8 100644 --- a/drivers/mfd/max8997.c +++ b/drivers/mfd/max8997.c @@ -175,11 +175,17 @@ static inline unsigned long max8997_i2c_get_driver_data(struct i2c_client *i2c, return id->driver_data; } +static const struct regmap_config max8997_regmap_config = { + .reg_bits = 8, + .val_bits = 8, +}; + static int max8997_i2c_probe(struct i2c_client *i2c, const struct i2c_device_id *id) { struct max8997_dev *max8997; struct max8997_platform_data *pdata = dev_get_platdata(&i2c->dev); + const struct regmap_config *config = &max8997_regmap_config; int ret = 0; max8997 = devm_kzalloc(&i2c->dev, sizeof(struct max8997_dev), @@ -202,6 +208,14 @@ static int max8997_i2c_probe(struct i2c_client *i2c, if (!pdata) return ret; + max8997->regmap = devm_regmap_init_i2c(i2c, config); + if (IS_ERR(max8997->regmap)) { + ret = PTR_ERR(max8997->regmap); + dev_err(max8997->dev, "Failed to allocate register map: %d\n", + ret); + return ret; + } + max8997->pdata = pdata; max8997->ono = pdata->ono; diff --git a/include/linux/mfd/max8997-private.h b/include/linux/mfd/max8997-private.h index 78c76cd..50c7129 100644 --- a/include/linux/mfd/max8997-private.h +++ b/include/linux/mfd/max8997-private.h @@ -25,6 +25,7 @@ #include <linux/i2c.h> #include <linux/export.h> #include <linux/irqdomain.h> +#include <linux/regmap.h> #define MAX8997_REG_INVALID (0xff) @@ -388,6 +389,8 @@ struct max8997_dev { struct mutex iolock; unsigned long type; + + struct regmap *regmap; struct platform_device *battery; /* battery control (not fuel gauge) */ int irq; -- 2.7.4
next prev parent reply other threads:[~2016-11-07 10:06 UTC|newest] Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top 2016-11-07 10:09 [PATCH 0/6] Add support for MAX8997 Clock Driver Pankaj Dubey 2016-11-07 10:09 ` Pankaj Dubey 2016-11-07 10:09 ` Pankaj Dubey [this message] 2016-11-07 10:09 ` [PATCH 1/6] mfd: max8997: Initialize max8997 register map Pankaj Dubey 2016-11-07 14:22 ` Javier Martinez Canillas 2016-11-07 14:22 ` Javier Martinez Canillas 2016-11-07 17:12 ` Pankaj Dubey 2016-11-07 17:12 ` Pankaj Dubey 2016-11-07 10:09 ` [PATCH 5/6] mfd: max8997: Add max8997-clk name in mfd_cell Pankaj Dubey 2016-11-07 10:09 ` Pankaj Dubey 2016-11-07 15:08 ` Javier Martinez Canillas 2016-11-07 15:08 ` Javier Martinez Canillas [not found] ` <1478513376-14307-1-git-send-email-pankaj.dubey-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> 2016-11-07 10:09 ` [PATCH 2/6] dt-bindings: clk: max8997: Add DT binding documentation Pankaj Dubey 2016-11-07 10:09 ` Pankaj Dubey 2016-11-07 10:09 ` Pankaj Dubey 2016-11-07 14:47 ` Javier Martinez Canillas 2016-11-07 14:47 ` Javier Martinez Canillas 2016-11-14 16:15 ` Rob Herring 2016-11-14 16:15 ` Rob Herring 2016-11-17 2:17 ` pankaj.dubey 2016-11-17 2:17 ` pankaj.dubey 2016-11-07 10:09 ` [PATCH 3/6] clk: Add driver for Maxim-8997 PMIC clocks Pankaj Dubey 2016-11-07 10:09 ` Pankaj Dubey 2016-11-07 10:09 ` Pankaj Dubey 2016-11-07 15:01 ` Javier Martinez Canillas 2016-11-07 15:01 ` Javier Martinez Canillas 2016-11-07 15:01 ` Javier Martinez Canillas [not found] ` <63750c2f-35cb-91ab-276b-c788f51081cb-JPH+aEBZ4P+UEJcrhfAQsw@public.gmane.org> 2016-11-07 17:20 ` Pankaj Dubey 2016-11-07 17:20 ` Pankaj Dubey 2016-11-07 17:20 ` Pankaj Dubey 2016-11-07 17:41 ` Krzysztof Kozlowski 2016-11-07 17:41 ` Krzysztof Kozlowski 2016-11-07 10:09 ` [PATCH 4/6] ARM: dts: Add clock provider specific properties to max8997 node Pankaj Dubey 2016-11-07 10:09 ` Pankaj Dubey [not found] ` <1478513376-14307-5-git-send-email-pankaj.dubey-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> 2016-11-07 15:07 ` Javier Martinez Canillas 2016-11-07 15:07 ` Javier Martinez Canillas 2016-11-07 10:09 ` [PATCH 6/6] ARM: dts: Extend the S3C RTC node with rtc_src clock Pankaj Dubey 2016-11-07 10:09 ` Pankaj Dubey 2016-11-07 15:09 ` Javier Martinez Canillas 2016-11-07 15:09 ` Javier Martinez Canillas 2016-11-07 17:44 ` Krzysztof Kozlowski 2016-11-07 17:44 ` Krzysztof Kozlowski 2016-11-07 17:27 ` [PATCH 0/6] Add support for MAX8997 Clock Driver Krzysztof Kozlowski 2016-11-07 17:27 ` Krzysztof Kozlowski
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=1478513376-14307-2-git-send-email-pankaj.dubey@samsung.com \ --to=pankaj.dubey@samsung.com \ --cc=javier@osg.samsung.com \ --cc=kgene@kernel.org \ --cc=krzk@kernel.org \ --cc=lee.jones@linaro.org \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-samsung-soc@vger.kernel.org \ --cc=myungjoo.ham@samsung.com \ --cc=thomas.ab@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: linkBe 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.