Skip to contentSkip to conversation

mfd: regulator: max14577: Remove support for platform data

PATCH In review Krzysztof Kozlowski 3 participants 11 messages Feb 17, 2017 – Feb 28, 2017

Subsystems (3)
lore
Share & tools
lore

Krzysztof Kozlowski

author maintainer
#0 lore raw

cover mfd: regulator: max14577: Remove support for platform data

Hi,

Minor cleanup of max14577 family of drivers. The dependency inside:
1. Patch #3 and #4 depends for safeness on #1 so no one would try to run the driver on non-DT platform (such platform does not exist anyway...).
2. Patch #4 depends on patch #3 (compile time dependency).

Unfortunately I do not have the boards using these drivers, so testing would be appreciated.

Best regards,
Krzysztof

Krzysztof Kozlowski (4):
mfd: max14577: Explicitly depend on OF
mfd: max14577: Export OF module alias information
regulator: max14577: Remove support for platform data
mfd: max14577: Remove platform data and instantiation from I2C

 drivers/mfd/Kconfig                    |  1 +
 drivers/mfd/max14577.c                 | 23 +----------------------
 drivers/regulator/max14577-regulator.c | 15 +++------------
 include/linux/mfd/max14577.h           | 20 --------------------
 4 files changed, 5 insertions(+), 54 deletions(-)
Signature · 1 line
2.9.3
author maintainer
#1 lore raw

PATCH 1/4 mfd: max14577: Explicitly depend on OF

max14577 family of drivers are used only on Exynos-based ARMv7 boards which all were converted to DeviceTree long time ago. Driver still supports board-file initialization but it is going to be removed thus dependency on OF has to be marked explicitly.

---
 drivers/mfd/Kconfig | 1 +
 1 file changed, 1 insertion(+)
drivers/mfd/Kconfig +1 -0
index 55ecdfb74d31..ca196bd48ff2 100644
@@ -572,6 +572,7 @@ config MFD_88PM860X
 config MFD_MAX14577
 	tristate "Maxim Semiconductor MAX14577/77836 MUIC + Charger Support"
 	depends on I2C
+	depends on OF || COMPILE_TEST
 	select MFD_CORE
 	select REGMAP_I2C
 	select REGMAP_IRQ
Signature · 1 line
2.9.3
author maintainer
#2 lore raw

PATCH 2/4 mfd: max14577: Export OF module alias information

In reply to Krzysztof Kozlowski

Driver can be built as module and in such case for DT-based platform the OF match table will be used for matching. Export the module alias information for this. This will also allow removal of I2C device id related code.

---
 drivers/mfd/max14577.c | 1 +
 1 file changed, 1 insertion(+)
drivers/mfd/max14577.c +1 -0
index 6cbe96b28f42..f6772d64a6a4 100644
@@ -152,6 +152,7 @@ static const struct of_device_id max14577_dt_match[] = {
 	},
 	{},
 };
+MODULE_DEVICE_TABLE(of, max14577_dt_match);
 
 static bool max14577_muic_volatile_reg(struct device *dev, unsigned int reg)
 {
Signature · 1 line
2.9.3
author maintainer
#3 lore raw

PATCH 3/4 regulator: max14577: Remove support for platform data

In reply to Krzysztof Kozlowski

max14577 family of drivers are used only on Exynos-based ARMv7 boards which all were converted to DeviceTree long time ago. Remove the support for platform data to simplify the driver.

---
 drivers/regulator/max14577-regulator.c | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)
drivers/regulator/max14577-regulator.c +3 -12
index 0db288ce319c..fa9b4b3a2878 100644
@@ -245,7 +245,6 @@ static struct regmap *max14577_get_regmap(struct max14577 *max14577,
 static int max14577_regulator_probe(struct platform_device *pdev)
 {
 	struct max14577 *max14577 = dev_get_drvdata(pdev->dev.parent);
-	struct max14577_platform_data *pdata = dev_get_platdata(max14577->dev);
 	int i, ret = 0;
 	struct regulator_config config = {};
 	const struct regulator_desc *supported_regulators;
@@ -268,17 +267,9 @@ static int max14577_regulator_probe(struct platform_device *pdev)
 
 	for (i = 0; i < supported_regulators_size; i++) {
 		struct regulator_dev *regulator;
-		/*
-		 * Index of supported_regulators[] is also the id and must
-		 * match index of pdata->regulators[].
-		 */
-		if (pdata && pdata->regulators) {
-			config.init_data = pdata->regulators[i].initdata;
-			config.of_node = pdata->regulators[i].of_node;
-		} else {
-			config.init_data = match_init_data(i, dev_type);
-			config.of_node = match_of_node(i, dev_type);
-		}
+
+		config.init_data = match_init_data(i, dev_type);
+		config.of_node = match_of_node(i, dev_type);
 		config.regmap = max14577_get_regmap(max14577,
 				supported_regulators[i].id);
 
Signature · 1 line
2.9.3
maintainer Acked-by on v1 3/4
#4 lore raw

Re: [RFT 3/4] regulator: max14577: Remove support for platform data

Quoted 3 lines · Krzysztof Kozlowski

max14577 family of drivers are used only on Exynos-based ARMv7 boards which all were converted to DeviceTree long time ago. Remove the support for platform data to simplify the driver.

author maintainer
#5 lore raw

PATCH 4/4 mfd: max14577: Remove platform data and instantiation from I2C

In reply to Krzysztof Kozlowski

max14577 family of drivers can be now instantiated only from DeviceTree thus we can remove any I2C device id code and platform data. This simplifies the driver a little bit.

---
 drivers/mfd/max14577.c       | 22 ----------------------
 include/linux/mfd/max14577.h | 20 --------------------
 2 files changed, 42 deletions(-)
drivers/mfd/max14577.c +0 -22
index f6772d64a6a4..a6ec1451af94 100644
@@ -373,7 +373,6 @@ static int max14577_i2c_probe(struct i2c_client *i2c,
 			      const struct i2c_device_id *id)
 {
 	struct max14577 *max14577;
-	struct max14577_platform_data *pdata = dev_get_platdata(&i2c->dev);
 	struct device_node *np = i2c->dev.of_node;
 	int ret = 0;
 	const struct regmap_irq_chip *irq_chip;
@@ -381,18 +380,6 @@ static int max14577_i2c_probe(struct i2c_client *i2c,
 	unsigned int mfd_devs_size;
 	int irq_flags;
 
-	if (np) {
-		pdata = devm_kzalloc(&i2c->dev, sizeof(*pdata), GFP_KERNEL);
-		if (!pdata)
-			return -ENOMEM;
-		i2c->dev.platform_data = pdata;
-	}
-
-	if (!pdata) {
-		dev_err(&i2c->dev, "No platform data found.\n");
-		return -EINVAL;
-	}
-
 	max14577 = devm_kzalloc(&i2c->dev, sizeof(*max14577), GFP_KERNEL);
 	if (!max14577)
 		return -ENOMEM;
@@ -486,13 +473,6 @@ static int max14577_i2c_remove(struct i2c_client *i2c)
 	return 0;
 }
 
-static const struct i2c_device_id max14577_i2c_id[] = {
-	{ "max14577", MAXIM_DEVICE_TYPE_MAX14577, },
-	{ "max77836", MAXIM_DEVICE_TYPE_MAX77836, },
-	{ }
-};
-MODULE_DEVICE_TABLE(i2c, max14577_i2c_id);
-
 #ifdef CONFIG_PM_SLEEP
 static int max14577_suspend(struct device *dev)
 {
@@ -538,12 +518,10 @@ static struct i2c_driver max14577_i2c_driver = {
 	},
 	.probe = max14577_i2c_probe,
 	.remove = max14577_i2c_remove,
-	.id_table = max14577_i2c_id,
 };
 
 static int __init max14577_i2c_init(void)
 {
-	BUILD_BUG_ON(ARRAY_SIZE(max14577_i2c_id) != MAXIM_DEVICE_TYPE_NUM);
 	BUILD_BUG_ON(ARRAY_SIZE(max14577_dt_match) != MAXIM_DEVICE_TYPE_NUM);
 
 	/* Valid charger current values must be provided for each chipset */
include/linux/mfd/max14577.h +0 -20
index d81b52bb8bee..a97155662713 100644
@@ -62,26 +62,6 @@ struct max14577_charger_platform_data {
 };
 
 /*
- * MAX14577 MFD platform data
- */
-struct max14577_platform_data {
-	/* IRQ */
-	int irq_base;
-
-	/* current control GPIOs */
-	int gpio_pogo_vbatt_en;
-	int gpio_pogo_vbus_en;
-
-	/* current control GPIO control function */
-	int (*set_gpio_pogo_vbatt_en) (int gpio_val);
-	int (*set_gpio_pogo_vbus_en) (int gpio_val);
-
-	int (*set_gpio_pogo_cb) (int new_dev);
-
-	struct max14577_regulator_platform_data *regulators;
-};
-
-/*
  * Valid limits of current for max14577 and max77836 chargers.
  * They must correspond to MBCICHWRCL and MBCICHWRCH fields in CHGCTRL4
  * register for given chipset.
Signature · 1 line
2.9.3
#6 lore raw
In reply to Krzysztof Kozlowski

Hi,

Quoted 9 lines · Krzysztof Kozlowski

Hi,

Minor cleanup of max14577 family of drivers. The dependency inside:
1. Patch #3 and #4 depends for safeness on #1 so no one would try to run the driver on non-DT platform (such platform does not exist anyway...).
2. Patch #4 depends on patch #3 (compile time dependency).

Unfortunately I do not have the boards using these drivers, so testing would be appreciated.

Your patchset looks fine to me but I've noticed that maxim,max14577 bindings are not used currently in the mainline kernel.

AFAIK MAX14577 support is needed only for Gear1 board which doesn't have DTS file in the upstream kernel (moreover Exynos4212 SoC support has been removed recently).

It seems that MAX14577 support should also go away (unless there are some other boards using it that we support in the mainline kernel).

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

Quoted 14 lines

Best regards,
Krzysztof

Krzysztof Kozlowski (4):
mfd: max14577: Explicitly depend on OF
mfd: max14577: Export OF module alias information
regulator: max14577: Remove support for platform data
mfd: max14577: Remove platform data and instantiation from I2C

 drivers/mfd/Kconfig                    |  1 +
 drivers/mfd/max14577.c                 | 23 +----------------------
 drivers/regulator/max14577-regulator.c | 15 +++------------
 include/linux/mfd/max14577.h           | 20 --------------------
 4 files changed, 5 insertions(+), 54 deletions(-)
author maintainer
#7 lore raw
Quoted 18 lines · Bartlomiej Zolnierkiewicz

Hi,

Quoted 9 lines · Krzysztof Kozlowski

Hi,

Minor cleanup of max14577 family of drivers. The dependency inside:
1. Patch #3 and #4 depends for safeness on #1 so no one would try to run the driver on non-DT platform (such platform does not exist anyway...).
2. Patch #4 depends on patch #3 (compile time dependency).

Unfortunately I do not have the boards using these drivers, so testing would be appreciated.

Your patchset looks fine to me but I've noticed that maxim,max14577 bindings are not used currently in the mainline kernel.

Quoted 8 lines

AFAIK MAX14577 support is needed only for Gear1 board which doesn't have DTS file in the upstream kernel (moreover Exynos4212 SoC support has been removed recently).

It seems that MAX14577 support should also go away (unless there are some other boards using it that we support in the mainline kernel).

The driver supports two chipsets: max14577 and max77836. As you noted, the first one is for Gear 1. The second one is present on Gear2 which is supported by mainline. Simplifying the driver to support only max77836 would be a task requiring testing. I think review would be in such case not enough.

Best regards,
Krzysztof

#8 lore raw
Quoted 29 lines · Krzysztof Kozlowski
Quoted 18 lines · Bartlomiej Zolnierkiewicz

Hi,

Quoted 9 lines · Krzysztof Kozlowski

Hi,

Minor cleanup of max14577 family of drivers. The dependency inside:
1. Patch #3 and #4 depends for safeness on #1 so no one would try to run the driver on non-DT platform (such platform does not exist anyway...).
2. Patch #4 depends on patch #3 (compile time dependency).

Unfortunately I do not have the boards using these drivers, so testing would be appreciated.

Your patchset looks fine to me but I've noticed that maxim,max14577 bindings are not used currently in the mainline kernel.

Quoted 8 lines

AFAIK MAX14577 support is needed only for Gear1 board which doesn't have DTS file in the upstream kernel (moreover Exynos4212 SoC support has been removed recently).

It seems that MAX14577 support should also go away (unless there are some other boards using it that we support in the mainline kernel).

Quoted 5 lines

The driver supports two chipsets: max14577 and max77836. As you noted, the first one is for Gear 1. The second one is present on Gear2 which is supported by mainline. Simplifying the driver to support only max77836 would be a task requiring testing. I think review would be in such case not enough.

I think that this shouldn't be a big problem (if no one else volunteers we can do the testing on Gear2 device).

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

maintainer
#9 lore raw
Quoted 10 lines · Bartlomiej Zolnierkiewicz
Quoted 5 lines · Krzysztof Kozlowski

The driver supports two chipsets: max14577 and max77836. As you noted, the first one is for Gear 1. The second one is present on Gear2 which is supported by mainline. Simplifying the driver to support only max77836 would be a task requiring testing. I think review would be in such case not enough.

I think that this shouldn't be a big problem (if no one else volunteers we can do the testing on Gear2 device).

OTOH is it really gaining us much to remove the functionality vs the effort for testing? Removing the entire driver is fairly straightforward but if it's just some extra device support that's sitting there not bothering anyone perhaps it's not really a good use of time.

#10 lore raw

Hi,

Quoted 9 lines · Mark Brown
Quoted 7 lines · Bartlomiej Zolnierkiewicz
Quoted 5 lines · Krzysztof Kozlowski

The driver supports two chipsets: max14577 and max77836. As you noted, the first one is for Gear 1. The second one is present on Gear2 which is supported by mainline. Simplifying the driver to support only max77836 would be a task requiring testing. I think review would be in such case not enough.

Quoted 8 lines
Quoted 2 lines

I think that this shouldn't be a big problem (if no one else volunteers we can do the testing on Gear2 device).

OTOH is it really gaining us much to remove the functionality vs the effort for testing? Removing the entire driver is fairly straightforward but if it's just some extra device support that's sitting there not bothering anyone perhaps it's not really a good use of time.

We have to test the device from time to time anyway just to check that upstream support is still working so it shouldn't be much extra effort.

Leaving the code as it is for now is also okay for me (till it starts bothering somebody, i.e. people doing automatic DT bindings coverage/validity checking).

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics