* [PATCH 0/2] regulator: Simplify max77693 driver
@ 2014-12-19 9:29 Krzysztof Kozlowski
2014-12-19 9:29 ` [PATCH 1/2] regulator: max77693: Let core parse DT and drop board files support Krzysztof Kozlowski
2014-12-19 9:29 ` [PATCH 2/2] mfd: max77693: Remove unused structures Krzysztof Kozlowski
0 siblings, 2 replies; 4+ messages in thread
From: Krzysztof Kozlowski @ 2014-12-19 9:29 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, linux-kernel, Samuel Ortiz, Lee Jones
Cc: Krzysztof Kozlowski
Hi,
Simplify the max77693 regulator driver by moving DT parse code out
to regulator core.
This removes also board file support. Exynos based boards are DT-only.
This removal allows bigger simplification of driver so overall diffstat
is nice: -95 deletions, 12 additions.
The patch 2/2 depends on first patch so please apply everything at once
or leave second patch for later.
Best regards,
Krzysztof
Krzysztof Kozlowski (2):
regulator: max77693: Let core parse DT and drop board files support
mfd: max77693: Remove unused structures
drivers/regulator/max77693.c | 93 +++++---------------------------------------
include/linux/mfd/max77693.h | 12 +-----
2 files changed, 10 insertions(+), 95 deletions(-)
--
1.9.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] regulator: max77693: Let core parse DT and drop board files support
2014-12-19 9:29 [PATCH 0/2] regulator: Simplify max77693 driver Krzysztof Kozlowski
@ 2014-12-19 9:29 ` Krzysztof Kozlowski
2014-12-19 9:29 ` [PATCH 2/2] mfd: max77693: Remove unused structures Krzysztof Kozlowski
1 sibling, 0 replies; 4+ messages in thread
From: Krzysztof Kozlowski @ 2014-12-19 9:29 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, linux-kernel, Samuel Ortiz, Lee Jones
Cc: Krzysztof Kozlowski
Simplify the driver by removing board file support and letting
regulator core to parse DT.
The max77693 regulator driver is used only on Exynos based boards which
are DT-only. Board files are not supported.
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
---
drivers/regulator/max77693.c | 93 +++++---------------------------------------
1 file changed, 9 insertions(+), 84 deletions(-)
diff --git a/drivers/regulator/max77693.c b/drivers/regulator/max77693.c
index 07b313e51b21..9665a488e2f1 100644
--- a/drivers/regulator/max77693.c
+++ b/drivers/regulator/max77693.c
@@ -128,6 +128,8 @@ static struct regulator_ops max77693_charger_ops = {
#define regulator_desc_esafeout(_num) { \
.name = "ESAFEOUT"#_num, \
.id = MAX77693_ESAFEOUT##_num, \
+ .of_match = of_match_ptr("ESAFEOUT"#_num), \
+ .regulators_node = of_match_ptr("regulators"), \
.n_voltages = 4, \
.ops = &max77693_safeout_ops, \
.type = REGULATOR_VOLTAGE, \
@@ -145,6 +147,8 @@ static const struct regulator_desc regulators[] = {
{
.name = "CHARGER",
.id = MAX77693_CHARGER,
+ .of_match = of_match_ptr("CHARGER"),
+ .regulators_node = of_match_ptr("regulators"),
.ops = &max77693_charger_ops,
.type = REGULATOR_CURRENT,
.owner = THIS_MODULE,
@@ -154,102 +158,23 @@ static const struct regulator_desc regulators[] = {
},
};
-#ifdef CONFIG_OF
-static int max77693_pmic_dt_parse_rdata(struct device *dev,
- struct max77693_regulator_data **rdata)
-{
- struct device_node *np;
- struct of_regulator_match *rmatch;
- struct max77693_regulator_data *tmp;
- int i, matched = 0;
-
- np = of_get_child_by_name(dev->parent->of_node, "regulators");
- if (!np)
- return -EINVAL;
-
- rmatch = devm_kzalloc(dev,
- sizeof(*rmatch) * ARRAY_SIZE(regulators), GFP_KERNEL);
- if (!rmatch) {
- of_node_put(np);
- return -ENOMEM;
- }
-
- for (i = 0; i < ARRAY_SIZE(regulators); i++)
- rmatch[i].name = regulators[i].name;
-
- matched = of_regulator_match(dev, np, rmatch, ARRAY_SIZE(regulators));
- of_node_put(np);
- if (matched <= 0)
- return matched;
- *rdata = devm_kzalloc(dev, sizeof(**rdata) * matched, GFP_KERNEL);
- if (!(*rdata))
- return -ENOMEM;
-
- tmp = *rdata;
-
- for (i = 0; i < matched; i++) {
- tmp->initdata = rmatch[i].init_data;
- tmp->of_node = rmatch[i].of_node;
- tmp->id = regulators[i].id;
- tmp++;
- }
-
- return matched;
-}
-#else
-static int max77693_pmic_dt_parse_rdata(struct device *dev,
- struct max77693_regulator_data **rdata)
-{
- return 0;
-}
-#endif /* CONFIG_OF */
-
-static int max77693_pmic_init_rdata(struct device *dev,
- struct max77693_regulator_data **rdata)
-{
- struct max77693_platform_data *pdata;
- int num_regulators = 0;
-
- pdata = dev_get_platdata(dev->parent);
- if (pdata) {
- *rdata = pdata->regulators;
- num_regulators = pdata->num_regulators;
- }
-
- if (!(*rdata) && dev->parent->of_node)
- num_regulators = max77693_pmic_dt_parse_rdata(dev, rdata);
-
- return num_regulators;
-}
-
static int max77693_pmic_probe(struct platform_device *pdev)
{
struct max77693_dev *iodev = dev_get_drvdata(pdev->dev.parent);
- struct max77693_regulator_data *rdata = NULL;
- int num_rdata, i;
+ int i;
struct regulator_config config = { };
- num_rdata = max77693_pmic_init_rdata(&pdev->dev, &rdata);
- if (!rdata || num_rdata <= 0) {
- dev_err(&pdev->dev, "No init data supplied.\n");
- return -ENODEV;
- }
-
- config.dev = &pdev->dev;
+ config.dev = iodev->dev;
config.regmap = iodev->regmap;
- for (i = 0; i < num_rdata; i++) {
- int id = rdata[i].id;
+ for (i = 0; i < ARRAY_SIZE(regulators); i++) {
struct regulator_dev *rdev;
- config.init_data = rdata[i].initdata;
- config.of_node = rdata[i].of_node;
-
rdev = devm_regulator_register(&pdev->dev,
- ®ulators[id], &config);
+ ®ulators[i], &config);
if (IS_ERR(rdev)) {
dev_err(&pdev->dev,
- "Failed to initialize regulator-%d\n", id);
+ "Failed to initialize regulator-%d\n", i);
return PTR_ERR(rdev);
}
}
--
1.9.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] mfd: max77693: Remove unused structures
2014-12-19 9:29 [PATCH 0/2] regulator: Simplify max77693 driver Krzysztof Kozlowski
2014-12-19 9:29 ` [PATCH 1/2] regulator: max77693: Let core parse DT and drop board files support Krzysztof Kozlowski
@ 2014-12-19 9:29 ` Krzysztof Kozlowski
2015-01-20 15:18 ` Lee Jones
1 sibling, 1 reply; 4+ messages in thread
From: Krzysztof Kozlowski @ 2014-12-19 9:29 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, linux-kernel, Samuel Ortiz, Lee Jones
Cc: Krzysztof Kozlowski
The max77693 regulator driver no longer supports board files. Remove the
left-overs. Additionally fix name of device in comment.
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
---
include/linux/mfd/max77693.h | 12 +-----------
1 file changed, 1 insertion(+), 11 deletions(-)
diff --git a/include/linux/mfd/max77693.h b/include/linux/mfd/max77693.h
index f0b6585cd874..09a4dedaeea8 100644
--- a/include/linux/mfd/max77693.h
+++ b/include/linux/mfd/max77693.h
@@ -30,7 +30,7 @@
#ifndef __LINUX_MFD_MAX77693_H
#define __LINUX_MFD_MAX77693_H
-/* MAX77686 regulator IDs */
+/* MAX77693 regulator IDs */
enum max77693_regulators {
MAX77693_ESAFEOUT1 = 0,
MAX77693_ESAFEOUT2,
@@ -38,12 +38,6 @@ enum max77693_regulators {
MAX77693_REG_MAX,
};
-struct max77693_regulator_data {
- int id;
- struct regulator_init_data *initdata;
- struct device_node *of_node;
-};
-
struct max77693_reg_data {
u8 addr;
u8 data;
@@ -103,10 +97,6 @@ struct max77693_led_platform_data {
/* MAX77693 */
struct max77693_platform_data {
- /* regulator data */
- struct max77693_regulator_data *regulators;
- int num_regulators;
-
/* muic data */
struct max77693_muic_platform_data *muic_data;
struct max77693_led_platform_data *led_data;
--
1.9.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] mfd: max77693: Remove unused structures
2014-12-19 9:29 ` [PATCH 2/2] mfd: max77693: Remove unused structures Krzysztof Kozlowski
@ 2015-01-20 15:18 ` Lee Jones
0 siblings, 0 replies; 4+ messages in thread
From: Lee Jones @ 2015-01-20 15:18 UTC (permalink / raw)
To: Krzysztof Kozlowski; +Cc: Liam Girdwood, Mark Brown, linux-kernel, Samuel Ortiz
On Fri, 19 Dec 2014, Krzysztof Kozlowski wrote:
> The max77693 regulator driver no longer supports board files. Remove the
> left-overs. Additionally fix name of device in comment.
>
> Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> ---
> include/linux/mfd/max77693.h | 12 +-----------
> 1 file changed, 1 insertion(+), 11 deletions(-)
For my own reference:
Acked-by: Lee Jones <lee.jones@linaro.org>
> diff --git a/include/linux/mfd/max77693.h b/include/linux/mfd/max77693.h
> index f0b6585cd874..09a4dedaeea8 100644
> --- a/include/linux/mfd/max77693.h
> +++ b/include/linux/mfd/max77693.h
> @@ -30,7 +30,7 @@
> #ifndef __LINUX_MFD_MAX77693_H
> #define __LINUX_MFD_MAX77693_H
>
> -/* MAX77686 regulator IDs */
> +/* MAX77693 regulator IDs */
> enum max77693_regulators {
> MAX77693_ESAFEOUT1 = 0,
> MAX77693_ESAFEOUT2,
> @@ -38,12 +38,6 @@ enum max77693_regulators {
> MAX77693_REG_MAX,
> };
>
> -struct max77693_regulator_data {
> - int id;
> - struct regulator_init_data *initdata;
> - struct device_node *of_node;
> -};
> -
> struct max77693_reg_data {
> u8 addr;
> u8 data;
> @@ -103,10 +97,6 @@ struct max77693_led_platform_data {
> /* MAX77693 */
>
> struct max77693_platform_data {
> - /* regulator data */
> - struct max77693_regulator_data *regulators;
> - int num_regulators;
> -
> /* muic data */
> struct max77693_muic_platform_data *muic_data;
> struct max77693_led_platform_data *led_data;
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-01-20 15:18 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-19 9:29 [PATCH 0/2] regulator: Simplify max77693 driver Krzysztof Kozlowski
2014-12-19 9:29 ` [PATCH 1/2] regulator: max77693: Let core parse DT and drop board files support Krzysztof Kozlowski
2014-12-19 9:29 ` [PATCH 2/2] mfd: max77693: Remove unused structures Krzysztof Kozlowski
2015-01-20 15:18 ` Lee Jones
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox