All of lore.kernel.org
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <k.kozlowski@samsung.com>
To: Samuel Ortiz <sameo@linux.intel.com>,
	Lee Jones <lee.jones@linaro.org>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>,
	linux-kernel@vger.kernel.org, Ben Dooks <ben-linux@fluff.org>,
	Kukjin Kim <kgene.kim@samsung.com>,
	Russell King <linux@arm.linux.org.uk>,
	linux-arm-kernel@lists.infradead.org,
	linux-samsung-soc@vger.kernel.org, devicetree@vger.kernel.org
Cc: Kyungmin Park <kyungmin.park@samsung.com>,
	Marek Szyprowski <m.szyprowski@samsung.com>,
	Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
	Javier Martinez Canillas <javier.martinez@collabora.co.uk>,
	Chanwoo Choi <cw00.choi@samsung.com>,
	Krzysztof Kozlowski <k.kozlowski@samsung.com>
Subject: [PATCH 1/8] regulator: max77802: Remove support for board files
Date: Mon, 27 Oct 2014 16:03:39 +0100	[thread overview]
Message-ID: <1414422226-10948-2-git-send-email-k.kozlowski@samsung.com> (raw)
In-Reply-To: <1414422226-10948-1-git-send-email-k.kozlowski@samsung.com>

The driver is used only on Exynos based boards with DTS support.
Convert the driver to DTS-only version.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
---
 drivers/regulator/max77802.c | 44 +++++++++++++++-----------------------------
 1 file changed, 15 insertions(+), 29 deletions(-)

diff --git a/drivers/regulator/max77802.c b/drivers/regulator/max77802.c
index 5839c4509e1f..61d03e9f8acf 100644
--- a/drivers/regulator/max77802.c
+++ b/drivers/regulator/max77802.c
@@ -70,6 +70,9 @@ static unsigned int ramp_table_77802_4bit[] = {
 };
 
 struct max77802_regulator_prv {
+	struct max77686_regulator_data *regulators;
+	int num_regulators;
+
 	unsigned int opmode[MAX77802_REG_MAX];
 };
 
@@ -517,9 +520,8 @@ static struct regulator_desc regulators[] = {
 	regulator_77802_desc_n_ldo(35, 2, 1),
 };
 
-#ifdef CONFIG_OF
-static int max77802_pmic_dt_parse_pdata(struct platform_device *pdev,
-					struct max77686_platform_data *pdata)
+static int max77802_pmic_dt_parse(struct platform_device *pdev,
+				struct max77802_regulator_prv *max77802)
 {
 	struct max77686_dev *iodev = dev_get_drvdata(pdev->dev.parent);
 	struct device_node *pmic_np, *regulators_np;
@@ -534,15 +536,15 @@ static int max77802_pmic_dt_parse_pdata(struct platform_device *pdev,
 		return -EINVAL;
 	}
 
-	pdata->num_regulators = ARRAY_SIZE(regulators);
+	max77802->num_regulators = ARRAY_SIZE(regulators);
 	rdata = devm_kzalloc(&pdev->dev, sizeof(*rdata) *
-			     pdata->num_regulators, GFP_KERNEL);
+			     max77802->num_regulators, GFP_KERNEL);
 	if (!rdata) {
 		of_node_put(regulators_np);
 		return -ENOMEM;
 	}
 
-	for (i = 0; i < pdata->num_regulators; i++) {
+	for (i = 0; i < max77802->num_regulators; i++) {
 		rmatch.name = regulators[i].name;
 		rmatch.init_data = NULL;
 		rmatch.of_node = NULL;
@@ -557,44 +559,28 @@ static int max77802_pmic_dt_parse_pdata(struct platform_device *pdev,
 		rdata[i].id = regulators[i].id;
 	}
 
-	pdata->regulators = rdata;
+	max77802->regulators = rdata;
 	of_node_put(regulators_np);
 
 	return 0;
 }
-#else
-static int max77802_pmic_dt_parse_pdata(struct platform_device *pdev,
-					struct max77686_platform_data *pdata)
-{
-	return 0;
-}
-#endif /* CONFIG_OF */
 
 static int max77802_pmic_probe(struct platform_device *pdev)
 {
 	struct max77686_dev *iodev = dev_get_drvdata(pdev->dev.parent);
-	struct max77686_platform_data *pdata = dev_get_platdata(iodev->dev);
 	struct max77802_regulator_prv *max77802;
 	int i, ret = 0, val;
 	struct regulator_config config = { };
 
-	/* This is allocated by the MFD driver */
-	if (!pdata) {
-		dev_err(&pdev->dev, "no platform data found for regulator\n");
-		return -ENODEV;
-	}
-
 	max77802 = devm_kzalloc(&pdev->dev,
 				sizeof(struct max77802_regulator_prv),
 				GFP_KERNEL);
 	if (!max77802)
 		return -ENOMEM;
 
-	if (iodev->dev->of_node) {
-		ret = max77802_pmic_dt_parse_pdata(pdev, pdata);
-		if (ret)
-			return ret;
-	}
+	ret = max77802_pmic_dt_parse(pdev, max77802);
+	if (ret)
+		return ret;
 
 	config.dev = iodev->dev;
 	config.regmap = iodev->regmap;
@@ -603,11 +589,11 @@ static int max77802_pmic_probe(struct platform_device *pdev)
 
 	for (i = 0; i < MAX77802_REG_MAX; i++) {
 		struct regulator_dev *rdev;
-		int id = pdata->regulators[i].id;
+		int id = max77802->regulators[i].id;
 		int shift = max77802_get_opmode_shift(id);
 
-		config.init_data = pdata->regulators[i].initdata;
-		config.of_node = pdata->regulators[i].of_node;
+		config.init_data = max77802->regulators[i].initdata;
+		config.of_node = max77802->regulators[i].of_node;
 
 		ret = regmap_read(iodev->regmap, regulators[i].enable_reg, &val);
 		val = val >> shift & MAX77802_OPMODE_MASK;
-- 
1.9.1


WARNING: multiple messages have this Message-ID (diff)
From: k.kozlowski@samsung.com (Krzysztof Kozlowski)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/8] regulator: max77802: Remove support for board files
Date: Mon, 27 Oct 2014 16:03:39 +0100	[thread overview]
Message-ID: <1414422226-10948-2-git-send-email-k.kozlowski@samsung.com> (raw)
In-Reply-To: <1414422226-10948-1-git-send-email-k.kozlowski@samsung.com>

The driver is used only on Exynos based boards with DTS support.
Convert the driver to DTS-only version.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
---
 drivers/regulator/max77802.c | 44 +++++++++++++++-----------------------------
 1 file changed, 15 insertions(+), 29 deletions(-)

diff --git a/drivers/regulator/max77802.c b/drivers/regulator/max77802.c
index 5839c4509e1f..61d03e9f8acf 100644
--- a/drivers/regulator/max77802.c
+++ b/drivers/regulator/max77802.c
@@ -70,6 +70,9 @@ static unsigned int ramp_table_77802_4bit[] = {
 };
 
 struct max77802_regulator_prv {
+	struct max77686_regulator_data *regulators;
+	int num_regulators;
+
 	unsigned int opmode[MAX77802_REG_MAX];
 };
 
@@ -517,9 +520,8 @@ static struct regulator_desc regulators[] = {
 	regulator_77802_desc_n_ldo(35, 2, 1),
 };
 
-#ifdef CONFIG_OF
-static int max77802_pmic_dt_parse_pdata(struct platform_device *pdev,
-					struct max77686_platform_data *pdata)
+static int max77802_pmic_dt_parse(struct platform_device *pdev,
+				struct max77802_regulator_prv *max77802)
 {
 	struct max77686_dev *iodev = dev_get_drvdata(pdev->dev.parent);
 	struct device_node *pmic_np, *regulators_np;
@@ -534,15 +536,15 @@ static int max77802_pmic_dt_parse_pdata(struct platform_device *pdev,
 		return -EINVAL;
 	}
 
-	pdata->num_regulators = ARRAY_SIZE(regulators);
+	max77802->num_regulators = ARRAY_SIZE(regulators);
 	rdata = devm_kzalloc(&pdev->dev, sizeof(*rdata) *
-			     pdata->num_regulators, GFP_KERNEL);
+			     max77802->num_regulators, GFP_KERNEL);
 	if (!rdata) {
 		of_node_put(regulators_np);
 		return -ENOMEM;
 	}
 
-	for (i = 0; i < pdata->num_regulators; i++) {
+	for (i = 0; i < max77802->num_regulators; i++) {
 		rmatch.name = regulators[i].name;
 		rmatch.init_data = NULL;
 		rmatch.of_node = NULL;
@@ -557,44 +559,28 @@ static int max77802_pmic_dt_parse_pdata(struct platform_device *pdev,
 		rdata[i].id = regulators[i].id;
 	}
 
-	pdata->regulators = rdata;
+	max77802->regulators = rdata;
 	of_node_put(regulators_np);
 
 	return 0;
 }
-#else
-static int max77802_pmic_dt_parse_pdata(struct platform_device *pdev,
-					struct max77686_platform_data *pdata)
-{
-	return 0;
-}
-#endif /* CONFIG_OF */
 
 static int max77802_pmic_probe(struct platform_device *pdev)
 {
 	struct max77686_dev *iodev = dev_get_drvdata(pdev->dev.parent);
-	struct max77686_platform_data *pdata = dev_get_platdata(iodev->dev);
 	struct max77802_regulator_prv *max77802;
 	int i, ret = 0, val;
 	struct regulator_config config = { };
 
-	/* This is allocated by the MFD driver */
-	if (!pdata) {
-		dev_err(&pdev->dev, "no platform data found for regulator\n");
-		return -ENODEV;
-	}
-
 	max77802 = devm_kzalloc(&pdev->dev,
 				sizeof(struct max77802_regulator_prv),
 				GFP_KERNEL);
 	if (!max77802)
 		return -ENOMEM;
 
-	if (iodev->dev->of_node) {
-		ret = max77802_pmic_dt_parse_pdata(pdev, pdata);
-		if (ret)
-			return ret;
-	}
+	ret = max77802_pmic_dt_parse(pdev, max77802);
+	if (ret)
+		return ret;
 
 	config.dev = iodev->dev;
 	config.regmap = iodev->regmap;
@@ -603,11 +589,11 @@ static int max77802_pmic_probe(struct platform_device *pdev)
 
 	for (i = 0; i < MAX77802_REG_MAX; i++) {
 		struct regulator_dev *rdev;
-		int id = pdata->regulators[i].id;
+		int id = max77802->regulators[i].id;
 		int shift = max77802_get_opmode_shift(id);
 
-		config.init_data = pdata->regulators[i].initdata;
-		config.of_node = pdata->regulators[i].of_node;
+		config.init_data = max77802->regulators[i].initdata;
+		config.of_node = max77802->regulators[i].of_node;
 
 		ret = regmap_read(iodev->regmap, regulators[i].enable_reg, &val);
 		val = val >> shift & MAX77802_OPMODE_MASK;
-- 
1.9.1

  reply	other threads:[~2014-10-27 15:29 UTC|newest]

Thread overview: 89+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-27 15:03 [PATCH 0/8] regulator: max77686: Add GPIO control Krzysztof Kozlowski
2014-10-27 15:03 ` Krzysztof Kozlowski
2014-10-27 15:03 ` Krzysztof Kozlowski [this message]
2014-10-27 15:03   ` [PATCH 1/8] regulator: max77802: Remove support for board files Krzysztof Kozlowski
2014-10-27 19:36   ` Javier Martinez Canillas
2014-10-27 19:36     ` Javier Martinez Canillas
2014-10-28  8:45     ` Krzysztof Kozlowski
2014-10-28  8:45       ` Krzysztof Kozlowski
2014-10-28  8:50       ` Javier Martinez Canillas
2014-10-28  8:50         ` Javier Martinez Canillas
2014-10-27 15:03 ` [PATCH 2/8] regulator: max77686: " Krzysztof Kozlowski
2014-10-27 15:03   ` Krzysztof Kozlowski
2014-10-27 15:03   ` Krzysztof Kozlowski
2014-10-27 19:41   ` Javier Martinez Canillas
2014-10-27 19:41     ` Javier Martinez Canillas
2014-10-28  0:37   ` Mark Brown
2014-10-28  0:37     ` Mark Brown
2014-10-28  8:40     ` Krzysztof Kozlowski
2014-10-28  8:40       ` Krzysztof Kozlowski
2014-10-27 15:03 ` [PATCH 3/8] mfd: max77686/802: " Krzysztof Kozlowski
2014-10-27 15:03   ` Krzysztof Kozlowski
2014-10-27 15:03   ` Krzysztof Kozlowski
2014-10-27 19:48   ` Javier Martinez Canillas
2014-10-27 19:48     ` Javier Martinez Canillas
2014-10-28  9:11     ` Krzysztof Kozlowski
2014-10-28  9:11       ` Krzysztof Kozlowski
2014-10-27 15:03 ` [PATCH 4/8] regulator: max77686: Make regulator_desc array const Krzysztof Kozlowski
2014-10-27 15:03   ` Krzysztof Kozlowski
2014-10-27 15:03   ` Krzysztof Kozlowski
2014-10-27 19:50   ` Javier Martinez Canillas
2014-10-27 19:50     ` Javier Martinez Canillas
2014-10-28  0:38   ` Mark Brown
2014-10-28  0:38     ` Mark Brown
2014-10-27 15:03 ` [PATCH 5/8] regulator: max77686: Initialize opmode explicitly to normal mode Krzysztof Kozlowski
2014-10-27 15:03   ` Krzysztof Kozlowski
2014-10-27 15:03   ` Krzysztof Kozlowski
2014-10-27 19:51   ` Javier Martinez Canillas
2014-10-27 19:51     ` Javier Martinez Canillas
2014-10-27 15:03 ` [PATCH 6/8] regulator: max77686: Add external GPIO control Krzysztof Kozlowski
2014-10-27 15:03   ` Krzysztof Kozlowski
2014-10-27 15:03   ` Krzysztof Kozlowski
2014-10-27 20:03   ` Javier Martinez Canillas
2014-10-27 20:03     ` Javier Martinez Canillas
2014-10-28  8:52     ` Krzysztof Kozlowski
2014-10-28  8:52       ` Krzysztof Kozlowski
2014-10-28 12:11       ` Krzysztof Kozlowski
2014-10-28 12:11         ` Krzysztof Kozlowski
2014-10-29 10:42         ` Krzysztof Kozlowski
2014-10-29 10:42           ` Krzysztof Kozlowski
2014-10-29 10:49           ` Javier Martinez Canillas
2014-10-29 10:49             ` Javier Martinez Canillas
2014-10-30 13:56             ` Alexandre Courbot
2014-10-30 13:56               ` Alexandre Courbot
2014-10-30 13:56               ` Alexandre Courbot
2014-10-30 15:03               ` Krzysztof Kozlowski
2014-10-30 15:03                 ` Krzysztof Kozlowski
2014-10-30 15:03                 ` Krzysztof Kozlowski
2014-10-31  3:31                 ` Alexandre Courbot
2014-10-31  3:31                   ` Alexandre Courbot
2014-10-31  3:31                   ` Alexandre Courbot
2014-10-31  7:51                   ` Krzysztof Kozlowski
2014-10-31  7:51                     ` Krzysztof Kozlowski
2014-10-31  7:51                     ` Krzysztof Kozlowski
2014-10-31 10:32                     ` Mark Brown
2014-10-31 10:32                       ` Mark Brown
2014-10-31 10:32                       ` Mark Brown
2014-10-31 11:45                       ` Krzysztof Kozlowski
2014-10-31 11:45                         ` Krzysztof Kozlowski
2014-10-31 11:45                         ` Krzysztof Kozlowski
2014-10-31 11:54                         ` Mark Brown
2014-10-31 11:54                           ` Mark Brown
2014-10-31 11:54                           ` Mark Brown
2014-11-03 12:07                       ` Krzysztof Kozlowski
2014-11-03 12:07                         ` Krzysztof Kozlowski
2014-11-03 12:07                         ` Krzysztof Kozlowski
2014-11-03 13:23                         ` Mark Brown
2014-11-03 13:23                           ` Mark Brown
2014-11-03 13:23                           ` Mark Brown
2014-11-01  5:47                     ` Alexandre Courbot
2014-11-01  5:47                       ` Alexandre Courbot
2014-11-01  5:47                       ` Alexandre Courbot
2014-10-27 15:03 ` [PATCH 7/8] mfd/regulator: dt-bindings: max77686: Document gpio property Krzysztof Kozlowski
2014-10-27 15:03   ` Krzysztof Kozlowski
2014-10-27 20:15   ` Javier Martinez Canillas
2014-10-27 20:15     ` Javier Martinez Canillas
2014-10-28  8:53     ` Krzysztof Kozlowski
2014-10-28  8:53       ` Krzysztof Kozlowski
2014-10-27 15:03 ` [PATCH 8/8] ARM: dts: exynos4412-trats: Switch max77686 regulators to GPIO control Krzysztof Kozlowski
2014-10-27 15:03   ` 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=1414422226-10948-2-git-send-email-k.kozlowski@samsung.com \
    --to=k.kozlowski@samsung.com \
    --cc=b.zolnierkie@samsung.com \
    --cc=ben-linux@fluff.org \
    --cc=broonie@kernel.org \
    --cc=cw00.choi@samsung.com \
    --cc=devicetree@vger.kernel.org \
    --cc=javier.martinez@collabora.co.uk \
    --cc=kgene.kim@samsung.com \
    --cc=kyungmin.park@samsung.com \
    --cc=lee.jones@linaro.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=m.szyprowski@samsung.com \
    --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.