All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] regulator: act8945a: add regulator driver for the sub-device of ACT8945A MFD
@ 2016-01-12  8:17 ` Wenyou Yang
  0 siblings, 0 replies; 35+ messages in thread
From: Wenyou Yang @ 2016-01-12  8:17 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Rob Herring, Pawel Moll, Mark Rutland,
	Ian Campbell, Kumar Gala, Krzysztof Kozlowski
  Cc: Javier Martinez Canillas, Lee Jones, Nicolas Ferre,
	linux-arm-kernel, linux-kernel, devicetree, Wenyou Yang

The ACT8945A is a Multi Function Device with the following subdevices:
 - Regulator
 - Charger

This patch set is to add regulator driver for ACT8945A.
It is based on the patch set:
	[PATCH v2] mfd: act8945a: add Active-semi ACT8945A PMIC MFD driver

Changes in v2:
 - add more help information in Kconfig.
 - update the file header with short version license and author line.
 - remove unused structure, struct act8945a_pmic.
 - substitute of_property_read_bool() for of_get_property().
 - due to removing the member of stuct act8945a_dev, dev.
 - remove the unnecessary print out.
 - use module_platform_driver(), instead of subsys_initcall().
 - substitute MODULE_LICENSE("GPL") for MODULE_LICENSE("GPL v2").
 - add Acked-by Rob Herring.

Wenyou Yang (2):
  regulator: act8945a: add regulator driver for ACT8945A
  regulator: add documentation for ACT8945A's regulator DT bindings

 .../bindings/regulator/act8945a-regulator.txt      |   78 ++++++
 drivers/regulator/Kconfig                          |    9 +
 drivers/regulator/Makefile                         |    1 +
 drivers/regulator/act8945a-regulator.c             |  267 ++++++++++++++++++++
 4 files changed, 355 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/regulator/act8945a-regulator.txt
 create mode 100644 drivers/regulator/act8945a-regulator.c

-- 
1.7.9.5

^ permalink raw reply	[flat|nested] 35+ messages in thread

* [PATCH v2 0/2] regulator: act8945a: add regulator driver for the sub-device of ACT8945A MFD
@ 2016-01-12  8:17 ` Wenyou Yang
  0 siblings, 0 replies; 35+ messages in thread
From: Wenyou Yang @ 2016-01-12  8:17 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Rob Herring, Pawel Moll, Mark Rutland,
	Ian Campbell, Kumar Gala, Krzysztof Kozlowski
  Cc: Javier Martinez Canillas, Lee Jones, Nicolas Ferre,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Wenyou Yang

The ACT8945A is a Multi Function Device with the following subdevices:
 - Regulator
 - Charger

This patch set is to add regulator driver for ACT8945A.
It is based on the patch set:
	[PATCH v2] mfd: act8945a: add Active-semi ACT8945A PMIC MFD driver

Changes in v2:
 - add more help information in Kconfig.
 - update the file header with short version license and author line.
 - remove unused structure, struct act8945a_pmic.
 - substitute of_property_read_bool() for of_get_property().
 - due to removing the member of stuct act8945a_dev, dev.
 - remove the unnecessary print out.
 - use module_platform_driver(), instead of subsys_initcall().
 - substitute MODULE_LICENSE("GPL") for MODULE_LICENSE("GPL v2").
 - add Acked-by Rob Herring.

Wenyou Yang (2):
  regulator: act8945a: add regulator driver for ACT8945A
  regulator: add documentation for ACT8945A's regulator DT bindings

 .../bindings/regulator/act8945a-regulator.txt      |   78 ++++++
 drivers/regulator/Kconfig                          |    9 +
 drivers/regulator/Makefile                         |    1 +
 drivers/regulator/act8945a-regulator.c             |  267 ++++++++++++++++++++
 4 files changed, 355 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/regulator/act8945a-regulator.txt
 create mode 100644 drivers/regulator/act8945a-regulator.c

-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 35+ messages in thread

* [PATCH v2 0/2] regulator: act8945a: add regulator driver for the sub-device of ACT8945A MFD
@ 2016-01-12  8:17 ` Wenyou Yang
  0 siblings, 0 replies; 35+ messages in thread
From: Wenyou Yang @ 2016-01-12  8:17 UTC (permalink / raw)
  To: linux-arm-kernel

The ACT8945A is a Multi Function Device with the following subdevices:
 - Regulator
 - Charger

This patch set is to add regulator driver for ACT8945A.
It is based on the patch set:
	[PATCH v2] mfd: act8945a: add Active-semi ACT8945A PMIC MFD driver

Changes in v2:
 - add more help information in Kconfig.
 - update the file header with short version license and author line.
 - remove unused structure, struct act8945a_pmic.
 - substitute of_property_read_bool() for of_get_property().
 - due to removing the member of stuct act8945a_dev, dev.
 - remove the unnecessary print out.
 - use module_platform_driver(), instead of subsys_initcall().
 - substitute MODULE_LICENSE("GPL") for MODULE_LICENSE("GPL v2").
 - add Acked-by Rob Herring.

Wenyou Yang (2):
  regulator: act8945a: add regulator driver for ACT8945A
  regulator: add documentation for ACT8945A's regulator DT bindings

 .../bindings/regulator/act8945a-regulator.txt      |   78 ++++++
 drivers/regulator/Kconfig                          |    9 +
 drivers/regulator/Makefile                         |    1 +
 drivers/regulator/act8945a-regulator.c             |  267 ++++++++++++++++++++
 4 files changed, 355 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/regulator/act8945a-regulator.txt
 create mode 100644 drivers/regulator/act8945a-regulator.c

-- 
1.7.9.5

^ permalink raw reply	[flat|nested] 35+ messages in thread

* [PATCH v2 1/2] regulator: act8945a: add regulator driver for ACT8945A
@ 2016-01-12  8:17   ` Wenyou Yang
  0 siblings, 0 replies; 35+ messages in thread
From: Wenyou Yang @ 2016-01-12  8:17 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Rob Herring, Pawel Moll, Mark Rutland,
	Ian Campbell, Kumar Gala, Krzysztof Kozlowski
  Cc: Javier Martinez Canillas, Lee Jones, Nicolas Ferre,
	linux-arm-kernel, linux-kernel, devicetree, Wenyou Yang

This patch adds new regulator driver to support ACT8945A MFD
chip's regulators.

The ACT8945A has three step-down DC/DC converters and four
low-dropout regulators.

Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
---

Changes in v2:
 - add more help information in Kconfig.
 - update the file header with short version license and author line.
 - remove unused structure, struct act8945a_pmic.
 - substitute of_property_read_bool() for of_get_property().
 - due to removing the member of stuct act8945a_dev, dev.
 - remove the unnecessary print out.
 - use module_platform_driver(), instead of subsys_initcall().
 - substitute MODULE_LICENSE("GPL") for MODULE_LICENSE("GPL v2").

 drivers/regulator/Kconfig              |    9 ++
 drivers/regulator/Makefile             |    1 +
 drivers/regulator/act8945a-regulator.c |  267 ++++++++++++++++++++++++++++++++
 3 files changed, 277 insertions(+)
 create mode 100644 drivers/regulator/act8945a-regulator.c

diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig
index ff109da..4f7122c 100644
--- a/drivers/regulator/Kconfig
+++ b/drivers/regulator/Kconfig
@@ -78,6 +78,15 @@ config REGULATOR_ACT8865
 	  This driver controls a active-semi act8865 voltage output
 	  regulator via I2C bus.
 
+config REGULATOR_ACT8945A
+	tristate "Active-semi ACT8945A voltage regulator"
+	depends on MFD_ACT8945A
+	help
+	  This driver controls a active-semi ACT8945A voltage regulator
+	  via I2C bus. The ACT8945A features three step-down DC/DC converters
+	  and four low-dropout linear regulators, along with a ActivePath
+	  battery charger.
+
 config REGULATOR_AD5398
 	tristate "Analog Devices AD5398/AD5821 regulators"
 	depends on I2C
diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile
index 980b194..348cfd7 100644
--- a/drivers/regulator/Makefile
+++ b/drivers/regulator/Makefile
@@ -15,6 +15,7 @@ obj-$(CONFIG_REGULATOR_AAT2870) += aat2870-regulator.o
 obj-$(CONFIG_REGULATOR_AB3100) += ab3100.o
 obj-$(CONFIG_REGULATOR_AB8500)	+= ab8500-ext.o ab8500.o
 obj-$(CONFIG_REGULATOR_ACT8865) += act8865-regulator.o
+obj-$(CONFIG_REGULATOR_ACT8945A) += act8945a-regulator.o
 obj-$(CONFIG_REGULATOR_AD5398) += ad5398.o
 obj-$(CONFIG_REGULATOR_ANATOP) += anatop-regulator.o
 obj-$(CONFIG_REGULATOR_ARIZONA) += arizona-micsupp.o arizona-ldo1.o
diff --git a/drivers/regulator/act8945a-regulator.c b/drivers/regulator/act8945a-regulator.c
new file mode 100644
index 0000000..c1aef04
--- /dev/null
+++ b/drivers/regulator/act8945a-regulator.c
@@ -0,0 +1,267 @@
+/*
+ * Voltage regulation driver for active-semi ACT8945A PMIC
+ *
+ * Copyright (C) 2015 Atmel Corporation
+ *
+ * Author: Wenyou Yang <wenyou.yang@atmel.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ */
+
+#include <linux/mfd/act8945a.h>
+#include <linux/module.h>
+#include <linux/of_device.h>
+#include <linux/platform_device.h>
+#include <linux/regulator/driver.h>
+#include <linux/regulator/machine.h>
+#include <linux/regulator/of_regulator.h>
+
+/**
+ * ACT8945A Global Register Map.
+ */
+#define	ACT8945A_SYS_MODE	0x00
+#define	ACT8945A_SYS_CTRL	0x01
+#define	ACT8945A_DCDC1_VSET1	0x20
+#define	ACT8945A_DCDC1_VSET2	0x21
+#define	ACT8945A_DCDC1_CTRL	0x22
+#define	ACT8945A_DCDC2_VSET1	0x30
+#define	ACT8945A_DCDC2_VSET2	0x31
+#define	ACT8945A_DCDC2_CTRL	0x32
+#define	ACT8945A_DCDC3_VSET1	0x40
+#define	ACT8945A_DCDC3_VSET2	0x41
+#define	ACT8945A_DCDC3_CTRL	0x42
+#define	ACT8945A_LDO1_VSET	0x50
+#define	ACT8945A_LDO1_CTRL	0x51
+#define	ACT8945A_LDO2_VSET	0x54
+#define	ACT8945A_LDO2_CTRL	0x55
+#define	ACT8945A_LDO3_VSET	0x60
+#define	ACT8945A_LDO3_CTRL	0x61
+#define	ACT8945A_LDO4_VSET	0x64
+#define	ACT8945A_LDO4_CTRL	0x65
+
+/**
+ * Field Definitions.
+ */
+#define	ACT8945A_ENA		0x80	/* ON - [7] */
+#define	ACT8945A_VSEL_MASK	0x3F	/* VSET - [5:0] */
+
+/**
+ * ACT8945A voltage number
+ */
+#define	ACT8945A_VOLTAGE_NUM	64
+
+enum {
+	ACT8945A_ID_DCDC1,
+	ACT8945A_ID_DCDC2,
+	ACT8945A_ID_DCDC3,
+	ACT8945A_ID_LDO1,
+	ACT8945A_ID_LDO2,
+	ACT8945A_ID_LDO3,
+	ACT8945A_ID_LDO4,
+	ACT8945A_REG_NUM,
+};
+
+struct act8945a_regulator_init_data {
+	int id;
+	const char *name;
+	struct regulator_init_data *init_data;
+};
+
+struct act8945a_pmic_data {
+	int num_regulators;
+	struct act8945a_regulator_init_data *regulators;
+};
+
+static const struct regulator_linear_range act8945a_voltage_ranges[] = {
+	REGULATOR_LINEAR_RANGE(600000, 0, 23, 25000),
+	REGULATOR_LINEAR_RANGE(1200000, 24, 47, 50000),
+	REGULATOR_LINEAR_RANGE(2400000, 48, 63, 100000),
+};
+
+static struct regulator_ops act8945a_ops = {
+	.list_voltage		= regulator_list_voltage_linear_range,
+	.map_voltage		= regulator_map_voltage_linear_range,
+	.get_voltage_sel	= regulator_get_voltage_sel_regmap,
+	.set_voltage_sel	= regulator_set_voltage_sel_regmap,
+	.enable			= regulator_enable_regmap,
+	.disable		= regulator_disable_regmap,
+	.is_enabled		= regulator_is_enabled_regmap,
+};
+
+#define ACT89xx_REG(_name, _family, _id, _vsel_reg, _supply)		\
+	[_family##_ID_##_id] = {					\
+		.name			= _name,			\
+		.supply_name		= _supply,			\
+		.id			= _family##_ID_##_id,		\
+		.type			= REGULATOR_VOLTAGE,		\
+		.ops			= &act8945a_ops,			\
+		.n_voltages		= ACT8945A_VOLTAGE_NUM,		\
+		.linear_ranges		= act8945a_voltage_ranges,	\
+		.n_linear_ranges	= ARRAY_SIZE(act8945a_voltage_ranges), \
+		.vsel_reg		= _family##_##_id##_##_vsel_reg, \
+		.vsel_mask		= ACT8945A_VSEL_MASK,		\
+		.enable_reg		= _family##_##_id##_CTRL,	\
+		.enable_mask		= ACT8945A_ENA,			\
+		.owner			= THIS_MODULE,			\
+	}
+
+static const struct regulator_desc act8945a_regulators[] = {
+	ACT89xx_REG("DCDC_REG1", ACT8945A, DCDC1, VSET1, "vp1"),
+	ACT89xx_REG("DCDC_REG2", ACT8945A, DCDC2, VSET1, "vp2"),
+	ACT89xx_REG("DCDC_REG3", ACT8945A, DCDC3, VSET1, "vp3"),
+	ACT89xx_REG("LDO_REG1", ACT8945A, LDO1, VSET, "inl45"),
+	ACT89xx_REG("LDO_REG2", ACT8945A, LDO2, VSET, "inl45"),
+	ACT89xx_REG("LDO_REG3", ACT8945A, LDO3, VSET, "inl67"),
+	ACT89xx_REG("LDO_REG4", ACT8945A, LDO4, VSET, "inl67"),
+};
+
+static const struct regulator_desc act8945a_alt_regulators[] = {
+	ACT89xx_REG("DCDC_REG1", ACT8945A, DCDC1, VSET2, "vp1"),
+	ACT89xx_REG("DCDC_REG2", ACT8945A, DCDC2, VSET2, "vp2"),
+	ACT89xx_REG("DCDC_REG3", ACT8945A, DCDC3, VSET2, "vp3"),
+	ACT89xx_REG("LDO_REG1", ACT8945A, LDO1, VSET, "inl45"),
+	ACT89xx_REG("LDO_REG2", ACT8945A, LDO2, VSET, "inl45"),
+	ACT89xx_REG("LDO_REG3", ACT8945A, LDO3, VSET, "inl67"),
+	ACT89xx_REG("LDO_REG4", ACT8945A, LDO4, VSET, "inl67"),
+};
+
+static struct of_regulator_match act8945a_matches[] = {
+	[ACT8945A_ID_DCDC1]	= { .name = "DCDC_REG1"},
+	[ACT8945A_ID_DCDC2]	= { .name = "DCDC_REG2"},
+	[ACT8945A_ID_DCDC3]	= { .name = "DCDC_REG3"},
+	[ACT8945A_ID_LDO1]	= { .name = "LDO_REG1"},
+	[ACT8945A_ID_LDO2]	= { .name = "LDO_REG2"},
+	[ACT8945A_ID_LDO3]	= { .name = "LDO_REG3"},
+	[ACT8945A_ID_LDO4]	= { .name = "LDO_REG4"},
+};
+
+static int act8945a_parse_dt_reg_data(struct platform_device *pdev,
+			struct act8945a_pmic_data *pdata,
+			struct of_regulator_match **act8945a_reg_matches)
+{
+	struct device_node *np;
+	struct of_regulator_match *matches;
+	struct act8945a_regulator_init_data *regulator;
+	unsigned int i, num_matches;
+	int ret;
+
+	np = of_get_child_by_name(pdev->dev.of_node, "regulators");
+	if (!np) {
+		dev_err(&pdev->dev, "regulator node not found\n");
+		return -EINVAL;
+	}
+
+	matches = act8945a_matches;
+	num_matches = ARRAY_SIZE(act8945a_matches);
+
+	ret = of_regulator_match(&pdev->dev, np, matches, num_matches);
+	of_node_put(np);
+	if (ret < 0) {
+		dev_err(&pdev->dev, "Error parsing regulator init data: %d\n",
+			ret);
+		return -EINVAL;
+	}
+
+	*act8945a_reg_matches = matches;
+
+	pdata->regulators = devm_kzalloc(&pdev->dev,
+		sizeof(struct act8945a_regulator_init_data) * num_matches,
+		GFP_KERNEL);
+	if (!pdata->regulators)
+		return -ENOMEM;
+
+	pdata->num_regulators = num_matches;
+	regulator = pdata->regulators;
+
+	for (i = 0; i < num_matches; i++) {
+		regulator->id = i;
+		regulator->name = matches[i].name;
+		regulator->init_data = matches[i].init_data;
+		regulator++;
+	}
+
+	return 0;
+}
+
+static struct regulator_init_data *act8945a_get_init_data(int id,
+				struct act8945a_pmic_data *pdata)
+{
+	int i;
+
+	if (!pdata)
+		return NULL;
+
+	for (i = 0; i < pdata->num_regulators; i++) {
+		if (pdata->regulators[i].id == id)
+			return pdata->regulators[i].init_data;
+	}
+
+	return NULL;
+}
+
+static int act8945a_pmic_probe(struct platform_device *pdev)
+{
+	struct act8945a_dev *act8945a_dev = dev_get_drvdata(pdev->dev.parent);
+	struct of_regulator_match *act8945a_reg_matches = NULL;
+	struct regulator_config config = { };
+	const struct regulator_desc *regulators, *desc;
+	struct regulator_dev *rdev;
+	struct act8945a_pmic_data pmic_data;
+	int i, num_regulators;
+	bool voltage_select;
+	int ret;
+
+	ret = act8945a_parse_dt_reg_data(pdev, &pmic_data,
+					 &act8945a_reg_matches);
+	if (ret < 0)
+		return ret;
+
+	voltage_select = of_property_read_bool(pdev->dev.of_node,
+					       "active-semi,vsel-high");
+
+	if (voltage_select) {
+		regulators = act8945a_alt_regulators;
+		num_regulators = ARRAY_SIZE(act8945a_alt_regulators);
+	} else {
+		regulators = act8945a_regulators;
+		num_regulators = ARRAY_SIZE(act8945a_regulators);
+	}
+
+	for (i = 0; i < num_regulators; i++) {
+		desc = &regulators[i];
+
+		config.dev = &pdev->dev;
+		config.init_data = act8945a_get_init_data(desc->id, &pmic_data);
+		config.regmap = act8945a_dev->regmap;
+		if (act8945a_reg_matches)
+			config.of_node = act8945a_reg_matches[i].of_node;
+
+		rdev = devm_regulator_register(&pdev->dev, desc, &config);
+		if (IS_ERR(rdev)) {
+			dev_err(&pdev->dev,
+				"failed to register %s regulator\n",
+				desc->name);
+			return PTR_ERR(rdev);
+		}
+	}
+
+	platform_set_drvdata(pdev, act8945a_dev);
+
+	return 0;
+}
+
+static struct platform_driver act8945a_pmic_driver = {
+	.driver = {
+		.name = "act8945a-pmic",
+	},
+	.probe = act8945a_pmic_probe,
+};
+module_platform_driver(act8945a_pmic_driver);
+
+MODULE_DESCRIPTION("Active-semi ACT8945A voltage regulator driver");
+MODULE_AUTHOR("Wenyou Yang <wenyou.yang@atmel.com>");
+MODULE_LICENSE("GPL");
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH v2 1/2] regulator: act8945a: add regulator driver for ACT8945A
@ 2016-01-12  8:17   ` Wenyou Yang
  0 siblings, 0 replies; 35+ messages in thread
From: Wenyou Yang @ 2016-01-12  8:17 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Rob Herring, Pawel Moll, Mark Rutland,
	Ian Campbell, Kumar Gala, Krzysztof Kozlowski
  Cc: Javier Martinez Canillas, Lee Jones, Nicolas Ferre,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Wenyou Yang

This patch adds new regulator driver to support ACT8945A MFD
chip's regulators.

The ACT8945A has three step-down DC/DC converters and four
low-dropout regulators.

Signed-off-by: Wenyou Yang <wenyou.yang-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
---

Changes in v2:
 - add more help information in Kconfig.
 - update the file header with short version license and author line.
 - remove unused structure, struct act8945a_pmic.
 - substitute of_property_read_bool() for of_get_property().
 - due to removing the member of stuct act8945a_dev, dev.
 - remove the unnecessary print out.
 - use module_platform_driver(), instead of subsys_initcall().
 - substitute MODULE_LICENSE("GPL") for MODULE_LICENSE("GPL v2").

 drivers/regulator/Kconfig              |    9 ++
 drivers/regulator/Makefile             |    1 +
 drivers/regulator/act8945a-regulator.c |  267 ++++++++++++++++++++++++++++++++
 3 files changed, 277 insertions(+)
 create mode 100644 drivers/regulator/act8945a-regulator.c

diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig
index ff109da..4f7122c 100644
--- a/drivers/regulator/Kconfig
+++ b/drivers/regulator/Kconfig
@@ -78,6 +78,15 @@ config REGULATOR_ACT8865
 	  This driver controls a active-semi act8865 voltage output
 	  regulator via I2C bus.
 
+config REGULATOR_ACT8945A
+	tristate "Active-semi ACT8945A voltage regulator"
+	depends on MFD_ACT8945A
+	help
+	  This driver controls a active-semi ACT8945A voltage regulator
+	  via I2C bus. The ACT8945A features three step-down DC/DC converters
+	  and four low-dropout linear regulators, along with a ActivePath
+	  battery charger.
+
 config REGULATOR_AD5398
 	tristate "Analog Devices AD5398/AD5821 regulators"
 	depends on I2C
diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile
index 980b194..348cfd7 100644
--- a/drivers/regulator/Makefile
+++ b/drivers/regulator/Makefile
@@ -15,6 +15,7 @@ obj-$(CONFIG_REGULATOR_AAT2870) += aat2870-regulator.o
 obj-$(CONFIG_REGULATOR_AB3100) += ab3100.o
 obj-$(CONFIG_REGULATOR_AB8500)	+= ab8500-ext.o ab8500.o
 obj-$(CONFIG_REGULATOR_ACT8865) += act8865-regulator.o
+obj-$(CONFIG_REGULATOR_ACT8945A) += act8945a-regulator.o
 obj-$(CONFIG_REGULATOR_AD5398) += ad5398.o
 obj-$(CONFIG_REGULATOR_ANATOP) += anatop-regulator.o
 obj-$(CONFIG_REGULATOR_ARIZONA) += arizona-micsupp.o arizona-ldo1.o
diff --git a/drivers/regulator/act8945a-regulator.c b/drivers/regulator/act8945a-regulator.c
new file mode 100644
index 0000000..c1aef04
--- /dev/null
+++ b/drivers/regulator/act8945a-regulator.c
@@ -0,0 +1,267 @@
+/*
+ * Voltage regulation driver for active-semi ACT8945A PMIC
+ *
+ * Copyright (C) 2015 Atmel Corporation
+ *
+ * Author: Wenyou Yang <wenyou.yang-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ */
+
+#include <linux/mfd/act8945a.h>
+#include <linux/module.h>
+#include <linux/of_device.h>
+#include <linux/platform_device.h>
+#include <linux/regulator/driver.h>
+#include <linux/regulator/machine.h>
+#include <linux/regulator/of_regulator.h>
+
+/**
+ * ACT8945A Global Register Map.
+ */
+#define	ACT8945A_SYS_MODE	0x00
+#define	ACT8945A_SYS_CTRL	0x01
+#define	ACT8945A_DCDC1_VSET1	0x20
+#define	ACT8945A_DCDC1_VSET2	0x21
+#define	ACT8945A_DCDC1_CTRL	0x22
+#define	ACT8945A_DCDC2_VSET1	0x30
+#define	ACT8945A_DCDC2_VSET2	0x31
+#define	ACT8945A_DCDC2_CTRL	0x32
+#define	ACT8945A_DCDC3_VSET1	0x40
+#define	ACT8945A_DCDC3_VSET2	0x41
+#define	ACT8945A_DCDC3_CTRL	0x42
+#define	ACT8945A_LDO1_VSET	0x50
+#define	ACT8945A_LDO1_CTRL	0x51
+#define	ACT8945A_LDO2_VSET	0x54
+#define	ACT8945A_LDO2_CTRL	0x55
+#define	ACT8945A_LDO3_VSET	0x60
+#define	ACT8945A_LDO3_CTRL	0x61
+#define	ACT8945A_LDO4_VSET	0x64
+#define	ACT8945A_LDO4_CTRL	0x65
+
+/**
+ * Field Definitions.
+ */
+#define	ACT8945A_ENA		0x80	/* ON - [7] */
+#define	ACT8945A_VSEL_MASK	0x3F	/* VSET - [5:0] */
+
+/**
+ * ACT8945A voltage number
+ */
+#define	ACT8945A_VOLTAGE_NUM	64
+
+enum {
+	ACT8945A_ID_DCDC1,
+	ACT8945A_ID_DCDC2,
+	ACT8945A_ID_DCDC3,
+	ACT8945A_ID_LDO1,
+	ACT8945A_ID_LDO2,
+	ACT8945A_ID_LDO3,
+	ACT8945A_ID_LDO4,
+	ACT8945A_REG_NUM,
+};
+
+struct act8945a_regulator_init_data {
+	int id;
+	const char *name;
+	struct regulator_init_data *init_data;
+};
+
+struct act8945a_pmic_data {
+	int num_regulators;
+	struct act8945a_regulator_init_data *regulators;
+};
+
+static const struct regulator_linear_range act8945a_voltage_ranges[] = {
+	REGULATOR_LINEAR_RANGE(600000, 0, 23, 25000),
+	REGULATOR_LINEAR_RANGE(1200000, 24, 47, 50000),
+	REGULATOR_LINEAR_RANGE(2400000, 48, 63, 100000),
+};
+
+static struct regulator_ops act8945a_ops = {
+	.list_voltage		= regulator_list_voltage_linear_range,
+	.map_voltage		= regulator_map_voltage_linear_range,
+	.get_voltage_sel	= regulator_get_voltage_sel_regmap,
+	.set_voltage_sel	= regulator_set_voltage_sel_regmap,
+	.enable			= regulator_enable_regmap,
+	.disable		= regulator_disable_regmap,
+	.is_enabled		= regulator_is_enabled_regmap,
+};
+
+#define ACT89xx_REG(_name, _family, _id, _vsel_reg, _supply)		\
+	[_family##_ID_##_id] = {					\
+		.name			= _name,			\
+		.supply_name		= _supply,			\
+		.id			= _family##_ID_##_id,		\
+		.type			= REGULATOR_VOLTAGE,		\
+		.ops			= &act8945a_ops,			\
+		.n_voltages		= ACT8945A_VOLTAGE_NUM,		\
+		.linear_ranges		= act8945a_voltage_ranges,	\
+		.n_linear_ranges	= ARRAY_SIZE(act8945a_voltage_ranges), \
+		.vsel_reg		= _family##_##_id##_##_vsel_reg, \
+		.vsel_mask		= ACT8945A_VSEL_MASK,		\
+		.enable_reg		= _family##_##_id##_CTRL,	\
+		.enable_mask		= ACT8945A_ENA,			\
+		.owner			= THIS_MODULE,			\
+	}
+
+static const struct regulator_desc act8945a_regulators[] = {
+	ACT89xx_REG("DCDC_REG1", ACT8945A, DCDC1, VSET1, "vp1"),
+	ACT89xx_REG("DCDC_REG2", ACT8945A, DCDC2, VSET1, "vp2"),
+	ACT89xx_REG("DCDC_REG3", ACT8945A, DCDC3, VSET1, "vp3"),
+	ACT89xx_REG("LDO_REG1", ACT8945A, LDO1, VSET, "inl45"),
+	ACT89xx_REG("LDO_REG2", ACT8945A, LDO2, VSET, "inl45"),
+	ACT89xx_REG("LDO_REG3", ACT8945A, LDO3, VSET, "inl67"),
+	ACT89xx_REG("LDO_REG4", ACT8945A, LDO4, VSET, "inl67"),
+};
+
+static const struct regulator_desc act8945a_alt_regulators[] = {
+	ACT89xx_REG("DCDC_REG1", ACT8945A, DCDC1, VSET2, "vp1"),
+	ACT89xx_REG("DCDC_REG2", ACT8945A, DCDC2, VSET2, "vp2"),
+	ACT89xx_REG("DCDC_REG3", ACT8945A, DCDC3, VSET2, "vp3"),
+	ACT89xx_REG("LDO_REG1", ACT8945A, LDO1, VSET, "inl45"),
+	ACT89xx_REG("LDO_REG2", ACT8945A, LDO2, VSET, "inl45"),
+	ACT89xx_REG("LDO_REG3", ACT8945A, LDO3, VSET, "inl67"),
+	ACT89xx_REG("LDO_REG4", ACT8945A, LDO4, VSET, "inl67"),
+};
+
+static struct of_regulator_match act8945a_matches[] = {
+	[ACT8945A_ID_DCDC1]	= { .name = "DCDC_REG1"},
+	[ACT8945A_ID_DCDC2]	= { .name = "DCDC_REG2"},
+	[ACT8945A_ID_DCDC3]	= { .name = "DCDC_REG3"},
+	[ACT8945A_ID_LDO1]	= { .name = "LDO_REG1"},
+	[ACT8945A_ID_LDO2]	= { .name = "LDO_REG2"},
+	[ACT8945A_ID_LDO3]	= { .name = "LDO_REG3"},
+	[ACT8945A_ID_LDO4]	= { .name = "LDO_REG4"},
+};
+
+static int act8945a_parse_dt_reg_data(struct platform_device *pdev,
+			struct act8945a_pmic_data *pdata,
+			struct of_regulator_match **act8945a_reg_matches)
+{
+	struct device_node *np;
+	struct of_regulator_match *matches;
+	struct act8945a_regulator_init_data *regulator;
+	unsigned int i, num_matches;
+	int ret;
+
+	np = of_get_child_by_name(pdev->dev.of_node, "regulators");
+	if (!np) {
+		dev_err(&pdev->dev, "regulator node not found\n");
+		return -EINVAL;
+	}
+
+	matches = act8945a_matches;
+	num_matches = ARRAY_SIZE(act8945a_matches);
+
+	ret = of_regulator_match(&pdev->dev, np, matches, num_matches);
+	of_node_put(np);
+	if (ret < 0) {
+		dev_err(&pdev->dev, "Error parsing regulator init data: %d\n",
+			ret);
+		return -EINVAL;
+	}
+
+	*act8945a_reg_matches = matches;
+
+	pdata->regulators = devm_kzalloc(&pdev->dev,
+		sizeof(struct act8945a_regulator_init_data) * num_matches,
+		GFP_KERNEL);
+	if (!pdata->regulators)
+		return -ENOMEM;
+
+	pdata->num_regulators = num_matches;
+	regulator = pdata->regulators;
+
+	for (i = 0; i < num_matches; i++) {
+		regulator->id = i;
+		regulator->name = matches[i].name;
+		regulator->init_data = matches[i].init_data;
+		regulator++;
+	}
+
+	return 0;
+}
+
+static struct regulator_init_data *act8945a_get_init_data(int id,
+				struct act8945a_pmic_data *pdata)
+{
+	int i;
+
+	if (!pdata)
+		return NULL;
+
+	for (i = 0; i < pdata->num_regulators; i++) {
+		if (pdata->regulators[i].id == id)
+			return pdata->regulators[i].init_data;
+	}
+
+	return NULL;
+}
+
+static int act8945a_pmic_probe(struct platform_device *pdev)
+{
+	struct act8945a_dev *act8945a_dev = dev_get_drvdata(pdev->dev.parent);
+	struct of_regulator_match *act8945a_reg_matches = NULL;
+	struct regulator_config config = { };
+	const struct regulator_desc *regulators, *desc;
+	struct regulator_dev *rdev;
+	struct act8945a_pmic_data pmic_data;
+	int i, num_regulators;
+	bool voltage_select;
+	int ret;
+
+	ret = act8945a_parse_dt_reg_data(pdev, &pmic_data,
+					 &act8945a_reg_matches);
+	if (ret < 0)
+		return ret;
+
+	voltage_select = of_property_read_bool(pdev->dev.of_node,
+					       "active-semi,vsel-high");
+
+	if (voltage_select) {
+		regulators = act8945a_alt_regulators;
+		num_regulators = ARRAY_SIZE(act8945a_alt_regulators);
+	} else {
+		regulators = act8945a_regulators;
+		num_regulators = ARRAY_SIZE(act8945a_regulators);
+	}
+
+	for (i = 0; i < num_regulators; i++) {
+		desc = &regulators[i];
+
+		config.dev = &pdev->dev;
+		config.init_data = act8945a_get_init_data(desc->id, &pmic_data);
+		config.regmap = act8945a_dev->regmap;
+		if (act8945a_reg_matches)
+			config.of_node = act8945a_reg_matches[i].of_node;
+
+		rdev = devm_regulator_register(&pdev->dev, desc, &config);
+		if (IS_ERR(rdev)) {
+			dev_err(&pdev->dev,
+				"failed to register %s regulator\n",
+				desc->name);
+			return PTR_ERR(rdev);
+		}
+	}
+
+	platform_set_drvdata(pdev, act8945a_dev);
+
+	return 0;
+}
+
+static struct platform_driver act8945a_pmic_driver = {
+	.driver = {
+		.name = "act8945a-pmic",
+	},
+	.probe = act8945a_pmic_probe,
+};
+module_platform_driver(act8945a_pmic_driver);
+
+MODULE_DESCRIPTION("Active-semi ACT8945A voltage regulator driver");
+MODULE_AUTHOR("Wenyou Yang <wenyou.yang-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>");
+MODULE_LICENSE("GPL");
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH v2 1/2] regulator: act8945a: add regulator driver for ACT8945A
@ 2016-01-12  8:17   ` Wenyou Yang
  0 siblings, 0 replies; 35+ messages in thread
From: Wenyou Yang @ 2016-01-12  8:17 UTC (permalink / raw)
  To: linux-arm-kernel

This patch adds new regulator driver to support ACT8945A MFD
chip's regulators.

The ACT8945A has three step-down DC/DC converters and four
low-dropout regulators.

Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
---

Changes in v2:
 - add more help information in Kconfig.
 - update the file header with short version license and author line.
 - remove unused structure, struct act8945a_pmic.
 - substitute of_property_read_bool() for of_get_property().
 - due to removing the member of stuct act8945a_dev, dev.
 - remove the unnecessary print out.
 - use module_platform_driver(), instead of subsys_initcall().
 - substitute MODULE_LICENSE("GPL") for MODULE_LICENSE("GPL v2").

 drivers/regulator/Kconfig              |    9 ++
 drivers/regulator/Makefile             |    1 +
 drivers/regulator/act8945a-regulator.c |  267 ++++++++++++++++++++++++++++++++
 3 files changed, 277 insertions(+)
 create mode 100644 drivers/regulator/act8945a-regulator.c

diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig
index ff109da..4f7122c 100644
--- a/drivers/regulator/Kconfig
+++ b/drivers/regulator/Kconfig
@@ -78,6 +78,15 @@ config REGULATOR_ACT8865
 	  This driver controls a active-semi act8865 voltage output
 	  regulator via I2C bus.
 
+config REGULATOR_ACT8945A
+	tristate "Active-semi ACT8945A voltage regulator"
+	depends on MFD_ACT8945A
+	help
+	  This driver controls a active-semi ACT8945A voltage regulator
+	  via I2C bus. The ACT8945A features three step-down DC/DC converters
+	  and four low-dropout linear regulators, along with a ActivePath
+	  battery charger.
+
 config REGULATOR_AD5398
 	tristate "Analog Devices AD5398/AD5821 regulators"
 	depends on I2C
diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile
index 980b194..348cfd7 100644
--- a/drivers/regulator/Makefile
+++ b/drivers/regulator/Makefile
@@ -15,6 +15,7 @@ obj-$(CONFIG_REGULATOR_AAT2870) += aat2870-regulator.o
 obj-$(CONFIG_REGULATOR_AB3100) += ab3100.o
 obj-$(CONFIG_REGULATOR_AB8500)	+= ab8500-ext.o ab8500.o
 obj-$(CONFIG_REGULATOR_ACT8865) += act8865-regulator.o
+obj-$(CONFIG_REGULATOR_ACT8945A) += act8945a-regulator.o
 obj-$(CONFIG_REGULATOR_AD5398) += ad5398.o
 obj-$(CONFIG_REGULATOR_ANATOP) += anatop-regulator.o
 obj-$(CONFIG_REGULATOR_ARIZONA) += arizona-micsupp.o arizona-ldo1.o
diff --git a/drivers/regulator/act8945a-regulator.c b/drivers/regulator/act8945a-regulator.c
new file mode 100644
index 0000000..c1aef04
--- /dev/null
+++ b/drivers/regulator/act8945a-regulator.c
@@ -0,0 +1,267 @@
+/*
+ * Voltage regulation driver for active-semi ACT8945A PMIC
+ *
+ * Copyright (C) 2015 Atmel Corporation
+ *
+ * Author: Wenyou Yang <wenyou.yang@atmel.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ */
+
+#include <linux/mfd/act8945a.h>
+#include <linux/module.h>
+#include <linux/of_device.h>
+#include <linux/platform_device.h>
+#include <linux/regulator/driver.h>
+#include <linux/regulator/machine.h>
+#include <linux/regulator/of_regulator.h>
+
+/**
+ * ACT8945A Global Register Map.
+ */
+#define	ACT8945A_SYS_MODE	0x00
+#define	ACT8945A_SYS_CTRL	0x01
+#define	ACT8945A_DCDC1_VSET1	0x20
+#define	ACT8945A_DCDC1_VSET2	0x21
+#define	ACT8945A_DCDC1_CTRL	0x22
+#define	ACT8945A_DCDC2_VSET1	0x30
+#define	ACT8945A_DCDC2_VSET2	0x31
+#define	ACT8945A_DCDC2_CTRL	0x32
+#define	ACT8945A_DCDC3_VSET1	0x40
+#define	ACT8945A_DCDC3_VSET2	0x41
+#define	ACT8945A_DCDC3_CTRL	0x42
+#define	ACT8945A_LDO1_VSET	0x50
+#define	ACT8945A_LDO1_CTRL	0x51
+#define	ACT8945A_LDO2_VSET	0x54
+#define	ACT8945A_LDO2_CTRL	0x55
+#define	ACT8945A_LDO3_VSET	0x60
+#define	ACT8945A_LDO3_CTRL	0x61
+#define	ACT8945A_LDO4_VSET	0x64
+#define	ACT8945A_LDO4_CTRL	0x65
+
+/**
+ * Field Definitions.
+ */
+#define	ACT8945A_ENA		0x80	/* ON - [7] */
+#define	ACT8945A_VSEL_MASK	0x3F	/* VSET - [5:0] */
+
+/**
+ * ACT8945A voltage number
+ */
+#define	ACT8945A_VOLTAGE_NUM	64
+
+enum {
+	ACT8945A_ID_DCDC1,
+	ACT8945A_ID_DCDC2,
+	ACT8945A_ID_DCDC3,
+	ACT8945A_ID_LDO1,
+	ACT8945A_ID_LDO2,
+	ACT8945A_ID_LDO3,
+	ACT8945A_ID_LDO4,
+	ACT8945A_REG_NUM,
+};
+
+struct act8945a_regulator_init_data {
+	int id;
+	const char *name;
+	struct regulator_init_data *init_data;
+};
+
+struct act8945a_pmic_data {
+	int num_regulators;
+	struct act8945a_regulator_init_data *regulators;
+};
+
+static const struct regulator_linear_range act8945a_voltage_ranges[] = {
+	REGULATOR_LINEAR_RANGE(600000, 0, 23, 25000),
+	REGULATOR_LINEAR_RANGE(1200000, 24, 47, 50000),
+	REGULATOR_LINEAR_RANGE(2400000, 48, 63, 100000),
+};
+
+static struct regulator_ops act8945a_ops = {
+	.list_voltage		= regulator_list_voltage_linear_range,
+	.map_voltage		= regulator_map_voltage_linear_range,
+	.get_voltage_sel	= regulator_get_voltage_sel_regmap,
+	.set_voltage_sel	= regulator_set_voltage_sel_regmap,
+	.enable			= regulator_enable_regmap,
+	.disable		= regulator_disable_regmap,
+	.is_enabled		= regulator_is_enabled_regmap,
+};
+
+#define ACT89xx_REG(_name, _family, _id, _vsel_reg, _supply)		\
+	[_family##_ID_##_id] = {					\
+		.name			= _name,			\
+		.supply_name		= _supply,			\
+		.id			= _family##_ID_##_id,		\
+		.type			= REGULATOR_VOLTAGE,		\
+		.ops			= &act8945a_ops,			\
+		.n_voltages		= ACT8945A_VOLTAGE_NUM,		\
+		.linear_ranges		= act8945a_voltage_ranges,	\
+		.n_linear_ranges	= ARRAY_SIZE(act8945a_voltage_ranges), \
+		.vsel_reg		= _family##_##_id##_##_vsel_reg, \
+		.vsel_mask		= ACT8945A_VSEL_MASK,		\
+		.enable_reg		= _family##_##_id##_CTRL,	\
+		.enable_mask		= ACT8945A_ENA,			\
+		.owner			= THIS_MODULE,			\
+	}
+
+static const struct regulator_desc act8945a_regulators[] = {
+	ACT89xx_REG("DCDC_REG1", ACT8945A, DCDC1, VSET1, "vp1"),
+	ACT89xx_REG("DCDC_REG2", ACT8945A, DCDC2, VSET1, "vp2"),
+	ACT89xx_REG("DCDC_REG3", ACT8945A, DCDC3, VSET1, "vp3"),
+	ACT89xx_REG("LDO_REG1", ACT8945A, LDO1, VSET, "inl45"),
+	ACT89xx_REG("LDO_REG2", ACT8945A, LDO2, VSET, "inl45"),
+	ACT89xx_REG("LDO_REG3", ACT8945A, LDO3, VSET, "inl67"),
+	ACT89xx_REG("LDO_REG4", ACT8945A, LDO4, VSET, "inl67"),
+};
+
+static const struct regulator_desc act8945a_alt_regulators[] = {
+	ACT89xx_REG("DCDC_REG1", ACT8945A, DCDC1, VSET2, "vp1"),
+	ACT89xx_REG("DCDC_REG2", ACT8945A, DCDC2, VSET2, "vp2"),
+	ACT89xx_REG("DCDC_REG3", ACT8945A, DCDC3, VSET2, "vp3"),
+	ACT89xx_REG("LDO_REG1", ACT8945A, LDO1, VSET, "inl45"),
+	ACT89xx_REG("LDO_REG2", ACT8945A, LDO2, VSET, "inl45"),
+	ACT89xx_REG("LDO_REG3", ACT8945A, LDO3, VSET, "inl67"),
+	ACT89xx_REG("LDO_REG4", ACT8945A, LDO4, VSET, "inl67"),
+};
+
+static struct of_regulator_match act8945a_matches[] = {
+	[ACT8945A_ID_DCDC1]	= { .name = "DCDC_REG1"},
+	[ACT8945A_ID_DCDC2]	= { .name = "DCDC_REG2"},
+	[ACT8945A_ID_DCDC3]	= { .name = "DCDC_REG3"},
+	[ACT8945A_ID_LDO1]	= { .name = "LDO_REG1"},
+	[ACT8945A_ID_LDO2]	= { .name = "LDO_REG2"},
+	[ACT8945A_ID_LDO3]	= { .name = "LDO_REG3"},
+	[ACT8945A_ID_LDO4]	= { .name = "LDO_REG4"},
+};
+
+static int act8945a_parse_dt_reg_data(struct platform_device *pdev,
+			struct act8945a_pmic_data *pdata,
+			struct of_regulator_match **act8945a_reg_matches)
+{
+	struct device_node *np;
+	struct of_regulator_match *matches;
+	struct act8945a_regulator_init_data *regulator;
+	unsigned int i, num_matches;
+	int ret;
+
+	np = of_get_child_by_name(pdev->dev.of_node, "regulators");
+	if (!np) {
+		dev_err(&pdev->dev, "regulator node not found\n");
+		return -EINVAL;
+	}
+
+	matches = act8945a_matches;
+	num_matches = ARRAY_SIZE(act8945a_matches);
+
+	ret = of_regulator_match(&pdev->dev, np, matches, num_matches);
+	of_node_put(np);
+	if (ret < 0) {
+		dev_err(&pdev->dev, "Error parsing regulator init data: %d\n",
+			ret);
+		return -EINVAL;
+	}
+
+	*act8945a_reg_matches = matches;
+
+	pdata->regulators = devm_kzalloc(&pdev->dev,
+		sizeof(struct act8945a_regulator_init_data) * num_matches,
+		GFP_KERNEL);
+	if (!pdata->regulators)
+		return -ENOMEM;
+
+	pdata->num_regulators = num_matches;
+	regulator = pdata->regulators;
+
+	for (i = 0; i < num_matches; i++) {
+		regulator->id = i;
+		regulator->name = matches[i].name;
+		regulator->init_data = matches[i].init_data;
+		regulator++;
+	}
+
+	return 0;
+}
+
+static struct regulator_init_data *act8945a_get_init_data(int id,
+				struct act8945a_pmic_data *pdata)
+{
+	int i;
+
+	if (!pdata)
+		return NULL;
+
+	for (i = 0; i < pdata->num_regulators; i++) {
+		if (pdata->regulators[i].id == id)
+			return pdata->regulators[i].init_data;
+	}
+
+	return NULL;
+}
+
+static int act8945a_pmic_probe(struct platform_device *pdev)
+{
+	struct act8945a_dev *act8945a_dev = dev_get_drvdata(pdev->dev.parent);
+	struct of_regulator_match *act8945a_reg_matches = NULL;
+	struct regulator_config config = { };
+	const struct regulator_desc *regulators, *desc;
+	struct regulator_dev *rdev;
+	struct act8945a_pmic_data pmic_data;
+	int i, num_regulators;
+	bool voltage_select;
+	int ret;
+
+	ret = act8945a_parse_dt_reg_data(pdev, &pmic_data,
+					 &act8945a_reg_matches);
+	if (ret < 0)
+		return ret;
+
+	voltage_select = of_property_read_bool(pdev->dev.of_node,
+					       "active-semi,vsel-high");
+
+	if (voltage_select) {
+		regulators = act8945a_alt_regulators;
+		num_regulators = ARRAY_SIZE(act8945a_alt_regulators);
+	} else {
+		regulators = act8945a_regulators;
+		num_regulators = ARRAY_SIZE(act8945a_regulators);
+	}
+
+	for (i = 0; i < num_regulators; i++) {
+		desc = &regulators[i];
+
+		config.dev = &pdev->dev;
+		config.init_data = act8945a_get_init_data(desc->id, &pmic_data);
+		config.regmap = act8945a_dev->regmap;
+		if (act8945a_reg_matches)
+			config.of_node = act8945a_reg_matches[i].of_node;
+
+		rdev = devm_regulator_register(&pdev->dev, desc, &config);
+		if (IS_ERR(rdev)) {
+			dev_err(&pdev->dev,
+				"failed to register %s regulator\n",
+				desc->name);
+			return PTR_ERR(rdev);
+		}
+	}
+
+	platform_set_drvdata(pdev, act8945a_dev);
+
+	return 0;
+}
+
+static struct platform_driver act8945a_pmic_driver = {
+	.driver = {
+		.name = "act8945a-pmic",
+	},
+	.probe = act8945a_pmic_probe,
+};
+module_platform_driver(act8945a_pmic_driver);
+
+MODULE_DESCRIPTION("Active-semi ACT8945A voltage regulator driver");
+MODULE_AUTHOR("Wenyou Yang <wenyou.yang@atmel.com>");
+MODULE_LICENSE("GPL");
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH v2 2/2] regulator: add documentation for ACT8945A's regulator DT bindings
  2016-01-12  8:17 ` Wenyou Yang
  (?)
@ 2016-01-12  8:17   ` Wenyou Yang
  -1 siblings, 0 replies; 35+ messages in thread
From: Wenyou Yang @ 2016-01-12  8:17 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Rob Herring, Pawel Moll, Mark Rutland,
	Ian Campbell, Kumar Gala, Krzysztof Kozlowski
  Cc: Javier Martinez Canillas, Lee Jones, Nicolas Ferre,
	linux-arm-kernel, linux-kernel, devicetree, Wenyou Yang

This patch adds documentation for the DT bindings of the regulator
subdevice of ACT8945A MFD.

Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
Acked-by: Rob Herring <robh@kernel.org>
---

Changes in v2:
 - add Acked-by Rob Herring.

 .../bindings/regulator/act8945a-regulator.txt      |   78 ++++++++++++++++++++
 1 file changed, 78 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/regulator/act8945a-regulator.txt

diff --git a/Documentation/devicetree/bindings/regulator/act8945a-regulator.txt b/Documentation/devicetree/bindings/regulator/act8945a-regulator.txt
new file mode 100644
index 0000000..f67ff86
--- /dev/null
+++ b/Documentation/devicetree/bindings/regulator/act8945a-regulator.txt
@@ -0,0 +1,78 @@
+Device-Tree bindings for regulators of Active-semi ACT8945A Multi-Function Device
+
+Required properties:
+ - compatible: "active-semi,act8945a-regulator"
+
+Optional properties:
+- active-semi,vsel-high: Indicates if the VSEL pin is set to logic-high.
+  If this property is missing, assume the VSEL pin is set to logic-low.
+
+Optional input supply properties:
+  - vp1-supply: The input supply for DCDC_REG1
+  - vp2-supply: The input supply for DCDC_REG2
+  - vp3-supply: The input supply for DCDC_REG3
+  - inl45-supply: The input supply for LDO_REG1 and LDO_REG2
+  - inl67-supply: The input supply for LDO_REG3 and LDO_REG4
+
+Any standard regulator properties can be used to configure the single regulator.
+
+The valid names for regulators are:
+	DCDC_REG1, DCDC_REG2, DCDC_REG3, LDO_REG1, LDO_REG2, LDO_REG3, LDO_REG4.
+
+Example:
+
+	pmic {
+		compatible = "active-semi,act8945a-regulator";
+		active-semi,vsel-high;
+
+		regulators {
+			vdd_1v35_reg: DCDC_REG1 {
+				regulator-name = "VDD_1V35";
+				regulator-min-microvolt = <1350000>;
+				regulator-max-microvolt = <1350000>;
+				regulator-always-on;
+			};
+
+			vdd_1v2_reg: DCDC_REG2 {
+				regulator-name = "VDD_1V2";
+				regulator-min-microvolt = <1100000>;
+				regulator-max-microvolt = <1300000>;
+				regulator-always-on;
+			};
+
+			vdd_3v3_reg: DCDC_REG3 {
+				regulator-name = "VDD_3V3";
+				regulator-min-microvolt = <3300000>;
+				regulator-max-microvolt = <3300000>;
+				regulator-always-on;
+			};
+
+			vdd_fuse_reg: LDO_REG1 {
+				regulator-name = "VDD_FUSE";
+				regulator-min-microvolt = <2500000>;
+				regulator-max-microvolt = <2500000>;
+				regulator-always-on;
+			};
+
+			vdd_3v3_lp_reg: LDO_REG2 {
+				regulator-name = "VDD_3V3_LP";
+				regulator-min-microvolt = <3300000>;
+				regulator-max-microvolt = <3300000>;
+				regulator-always-on;
+			};
+
+			vdd_led_reg: LDO_REG3 {
+				regulator-name = "VDD_LED";
+				regulator-min-microvolt = <3300000>;
+				regulator-max-microvolt = <3300000>;
+				regulator-always-on;
+			};
+
+			vdd_sdhc_1v8_reg: LDO_REG4 {
+				regulator-name = "VDD_SDHC_1V8";
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <1800000>;
+				regulator-always-on;
+			};
+		};
+	};
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH v2 2/2] regulator: add documentation for ACT8945A's regulator DT bindings
@ 2016-01-12  8:17   ` Wenyou Yang
  0 siblings, 0 replies; 35+ messages in thread
From: Wenyou Yang @ 2016-01-12  8:17 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Rob Herring, Pawel Moll, Mark Rutland,
	Ian Campbell, Kumar Gala, Krzysztof Kozlowski
  Cc: devicetree, Nicolas Ferre, linux-kernel, Wenyou Yang,
	Javier Martinez Canillas, Lee Jones, linux-arm-kernel

This patch adds documentation for the DT bindings of the regulator
subdevice of ACT8945A MFD.

Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
Acked-by: Rob Herring <robh@kernel.org>
---

Changes in v2:
 - add Acked-by Rob Herring.

 .../bindings/regulator/act8945a-regulator.txt      |   78 ++++++++++++++++++++
 1 file changed, 78 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/regulator/act8945a-regulator.txt

diff --git a/Documentation/devicetree/bindings/regulator/act8945a-regulator.txt b/Documentation/devicetree/bindings/regulator/act8945a-regulator.txt
new file mode 100644
index 0000000..f67ff86
--- /dev/null
+++ b/Documentation/devicetree/bindings/regulator/act8945a-regulator.txt
@@ -0,0 +1,78 @@
+Device-Tree bindings for regulators of Active-semi ACT8945A Multi-Function Device
+
+Required properties:
+ - compatible: "active-semi,act8945a-regulator"
+
+Optional properties:
+- active-semi,vsel-high: Indicates if the VSEL pin is set to logic-high.
+  If this property is missing, assume the VSEL pin is set to logic-low.
+
+Optional input supply properties:
+  - vp1-supply: The input supply for DCDC_REG1
+  - vp2-supply: The input supply for DCDC_REG2
+  - vp3-supply: The input supply for DCDC_REG3
+  - inl45-supply: The input supply for LDO_REG1 and LDO_REG2
+  - inl67-supply: The input supply for LDO_REG3 and LDO_REG4
+
+Any standard regulator properties can be used to configure the single regulator.
+
+The valid names for regulators are:
+	DCDC_REG1, DCDC_REG2, DCDC_REG3, LDO_REG1, LDO_REG2, LDO_REG3, LDO_REG4.
+
+Example:
+
+	pmic {
+		compatible = "active-semi,act8945a-regulator";
+		active-semi,vsel-high;
+
+		regulators {
+			vdd_1v35_reg: DCDC_REG1 {
+				regulator-name = "VDD_1V35";
+				regulator-min-microvolt = <1350000>;
+				regulator-max-microvolt = <1350000>;
+				regulator-always-on;
+			};
+
+			vdd_1v2_reg: DCDC_REG2 {
+				regulator-name = "VDD_1V2";
+				regulator-min-microvolt = <1100000>;
+				regulator-max-microvolt = <1300000>;
+				regulator-always-on;
+			};
+
+			vdd_3v3_reg: DCDC_REG3 {
+				regulator-name = "VDD_3V3";
+				regulator-min-microvolt = <3300000>;
+				regulator-max-microvolt = <3300000>;
+				regulator-always-on;
+			};
+
+			vdd_fuse_reg: LDO_REG1 {
+				regulator-name = "VDD_FUSE";
+				regulator-min-microvolt = <2500000>;
+				regulator-max-microvolt = <2500000>;
+				regulator-always-on;
+			};
+
+			vdd_3v3_lp_reg: LDO_REG2 {
+				regulator-name = "VDD_3V3_LP";
+				regulator-min-microvolt = <3300000>;
+				regulator-max-microvolt = <3300000>;
+				regulator-always-on;
+			};
+
+			vdd_led_reg: LDO_REG3 {
+				regulator-name = "VDD_LED";
+				regulator-min-microvolt = <3300000>;
+				regulator-max-microvolt = <3300000>;
+				regulator-always-on;
+			};
+
+			vdd_sdhc_1v8_reg: LDO_REG4 {
+				regulator-name = "VDD_SDHC_1V8";
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <1800000>;
+				regulator-always-on;
+			};
+		};
+	};
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH v2 2/2] regulator: add documentation for ACT8945A's regulator DT bindings
@ 2016-01-12  8:17   ` Wenyou Yang
  0 siblings, 0 replies; 35+ messages in thread
From: Wenyou Yang @ 2016-01-12  8:17 UTC (permalink / raw)
  To: linux-arm-kernel

This patch adds documentation for the DT bindings of the regulator
subdevice of ACT8945A MFD.

Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
Acked-by: Rob Herring <robh@kernel.org>
---

Changes in v2:
 - add Acked-by Rob Herring.

 .../bindings/regulator/act8945a-regulator.txt      |   78 ++++++++++++++++++++
 1 file changed, 78 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/regulator/act8945a-regulator.txt

diff --git a/Documentation/devicetree/bindings/regulator/act8945a-regulator.txt b/Documentation/devicetree/bindings/regulator/act8945a-regulator.txt
new file mode 100644
index 0000000..f67ff86
--- /dev/null
+++ b/Documentation/devicetree/bindings/regulator/act8945a-regulator.txt
@@ -0,0 +1,78 @@
+Device-Tree bindings for regulators of Active-semi ACT8945A Multi-Function Device
+
+Required properties:
+ - compatible: "active-semi,act8945a-regulator"
+
+Optional properties:
+- active-semi,vsel-high: Indicates if the VSEL pin is set to logic-high.
+  If this property is missing, assume the VSEL pin is set to logic-low.
+
+Optional input supply properties:
+  - vp1-supply: The input supply for DCDC_REG1
+  - vp2-supply: The input supply for DCDC_REG2
+  - vp3-supply: The input supply for DCDC_REG3
+  - inl45-supply: The input supply for LDO_REG1 and LDO_REG2
+  - inl67-supply: The input supply for LDO_REG3 and LDO_REG4
+
+Any standard regulator properties can be used to configure the single regulator.
+
+The valid names for regulators are:
+	DCDC_REG1, DCDC_REG2, DCDC_REG3, LDO_REG1, LDO_REG2, LDO_REG3, LDO_REG4.
+
+Example:
+
+	pmic {
+		compatible = "active-semi,act8945a-regulator";
+		active-semi,vsel-high;
+
+		regulators {
+			vdd_1v35_reg: DCDC_REG1 {
+				regulator-name = "VDD_1V35";
+				regulator-min-microvolt = <1350000>;
+				regulator-max-microvolt = <1350000>;
+				regulator-always-on;
+			};
+
+			vdd_1v2_reg: DCDC_REG2 {
+				regulator-name = "VDD_1V2";
+				regulator-min-microvolt = <1100000>;
+				regulator-max-microvolt = <1300000>;
+				regulator-always-on;
+			};
+
+			vdd_3v3_reg: DCDC_REG3 {
+				regulator-name = "VDD_3V3";
+				regulator-min-microvolt = <3300000>;
+				regulator-max-microvolt = <3300000>;
+				regulator-always-on;
+			};
+
+			vdd_fuse_reg: LDO_REG1 {
+				regulator-name = "VDD_FUSE";
+				regulator-min-microvolt = <2500000>;
+				regulator-max-microvolt = <2500000>;
+				regulator-always-on;
+			};
+
+			vdd_3v3_lp_reg: LDO_REG2 {
+				regulator-name = "VDD_3V3_LP";
+				regulator-min-microvolt = <3300000>;
+				regulator-max-microvolt = <3300000>;
+				regulator-always-on;
+			};
+
+			vdd_led_reg: LDO_REG3 {
+				regulator-name = "VDD_LED";
+				regulator-min-microvolt = <3300000>;
+				regulator-max-microvolt = <3300000>;
+				regulator-always-on;
+			};
+
+			vdd_sdhc_1v8_reg: LDO_REG4 {
+				regulator-name = "VDD_SDHC_1V8";
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <1800000>;
+				regulator-always-on;
+			};
+		};
+	};
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* Re: [PATCH v2 1/2] regulator: act8945a: add regulator driver for ACT8945A
  2016-01-12  8:17   ` Wenyou Yang
@ 2016-01-13 14:22     ` Peter Korsgaard
  -1 siblings, 0 replies; 35+ messages in thread
From: Peter Korsgaard @ 2016-01-13 14:22 UTC (permalink / raw)
  To: Wenyou Yang
  Cc: Liam Girdwood, Mark Brown, Rob Herring, Pawel Moll, Mark Rutland,
	Ian Campbell, Kumar Gala, Krzysztof Kozlowski, devicetree,
	Nicolas Ferre, linux-kernel, Javier Martinez Canillas, Lee Jones,
	linux-arm-kernel

>>>>> "Wenyou" == Wenyou Yang <wenyou.yang@atmel.com> writes:

 > This patch adds new regulator driver to support ACT8945A MFD
 > chip's regulators.

 > The ACT8945A has three step-down DC/DC converters and four
 > low-dropout regulators.

 > Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>

Isn't the regulator part of the act8945a identical to act8865? Can't we
just use the existing act8865-regulator.c driver? (E.G. support 8865
variant in the mfd driver, but only register the regulator sub device?)

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 35+ messages in thread

* [PATCH v2 1/2] regulator: act8945a: add regulator driver for ACT8945A
@ 2016-01-13 14:22     ` Peter Korsgaard
  0 siblings, 0 replies; 35+ messages in thread
From: Peter Korsgaard @ 2016-01-13 14:22 UTC (permalink / raw)
  To: linux-arm-kernel

>>>>> "Wenyou" == Wenyou Yang <wenyou.yang@atmel.com> writes:

 > This patch adds new regulator driver to support ACT8945A MFD
 > chip's regulators.

 > The ACT8945A has three step-down DC/DC converters and four
 > low-dropout regulators.

 > Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>

Isn't the regulator part of the act8945a identical to act8865? Can't we
just use the existing act8865-regulator.c driver? (E.G. support 8865
variant in the mfd driver, but only register the regulator sub device?)

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 35+ messages in thread

* RE: [PATCH v2 1/2] regulator: act8945a: add regulator driver for ACT8945A
@ 2016-01-14  1:23       ` Yang, Wenyou
  0 siblings, 0 replies; 35+ messages in thread
From: Yang, Wenyou @ 2016-01-14  1:23 UTC (permalink / raw)
  To: Peter Korsgaard
  Cc: Liam Girdwood, Mark Brown, Rob Herring, Pawel Moll, Mark Rutland,
	Ian Campbell, Kumar Gala, Krzysztof Kozlowski, devicetree, Ferre,
	Nicolas, linux-kernel, Javier Martinez Canillas, Lee Jones,
	linux-arm-kernel

> -----Original Message-----
> From: Peter Korsgaard [mailto:jacmet@gmail.com] On Behalf Of Peter Korsgaard
> Sent: 2016年1月13日 22:22
> To: Yang, Wenyou <Wenyou.Yang@atmel.com>
> Cc: Liam Girdwood <lgirdwood@gmail.com>; Mark Brown <broonie@kernel.org>;
> Rob Herring <robh+dt@kernel.org>; Pawel Moll <pawel.moll@arm.com>; Mark
> Rutland <mark.rutland@arm.com>; Ian Campbell <ijc+devicetree@hellion.org.uk>;
> Kumar Gala <galak@codeaurora.org>; Krzysztof Kozlowski
> <k.kozlowski@samsung.com>; devicetree@vger.kernel.org; Ferre, Nicolas
> <Nicolas.FERRE@atmel.com>; linux-kernel@vger.kernel.org; Javier Martinez
> Canillas <javier@dowhile0.org>; Lee Jones <lee.jones@linaro.org>; linux-arm-
> kernel@lists.infradead.org
> Subject: Re: [PATCH v2 1/2] regulator: act8945a: add regulator driver for
> ACT8945A
> 
> >>>>> "Wenyou" == Wenyou Yang <wenyou.yang@atmel.com> writes:
> 
>  > This patch adds new regulator driver to support ACT8945A MFD  > chip's
> regulators.
> 
>  > The ACT8945A has three step-down DC/DC converters and four  > low-dropout
> regulators.
> 
>  > Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
> 
> Isn't the regulator part of the act8945a identical to act8865? Can't we just use the
> existing act8865-regulator.c driver? (E.G. support 8865 variant in the mfd driver,
> but only register the regulator sub device?)

Yes, the regulator part of the act8945a is identical to act8865.

But the act8865-regulator driver is a struct i2c_driver,  and the mfd sub-device driver is a platform_driver driver, it is not easy to use it.

> 
> --
> Bye, Peter Korsgaard


Best Regards,
Wenyou Yang

^ permalink raw reply	[flat|nested] 35+ messages in thread

* RE: [PATCH v2 1/2] regulator: act8945a: add regulator driver for ACT8945A
@ 2016-01-14  1:23       ` Yang, Wenyou
  0 siblings, 0 replies; 35+ messages in thread
From: Yang, Wenyou @ 2016-01-14  1:23 UTC (permalink / raw)
  To: Peter Korsgaard
  Cc: Liam Girdwood, Mark Brown, Rob Herring, Pawel Moll, Mark Rutland,
	Ian Campbell, Kumar Gala, Krzysztof Kozlowski,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Ferre, Nicolas,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Javier Martinez Canillas,
	Lee Jones, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

> -----Original Message-----
> From: Peter Korsgaard [mailto:jacmet@gmail.com] On Behalf Of Peter Korsgaard
> Sent: 2016年1月13日 22:22
> To: Yang, Wenyou <Wenyou.Yang@atmel.com>
> Cc: Liam Girdwood <lgirdwood@gmail.com>; Mark Brown <broonie@kernel.org>;
> Rob Herring <robh+dt@kernel.org>; Pawel Moll <pawel.moll@arm.com>; Mark
> Rutland <mark.rutland@arm.com>; Ian Campbell <ijc+devicetree@hellion.org.uk>;
> Kumar Gala <galak@codeaurora.org>; Krzysztof Kozlowski
> <k.kozlowski@samsung.com>; devicetree@vger.kernel.org; Ferre, Nicolas
> <Nicolas.FERRE@atmel.com>; linux-kernel@vger.kernel.org; Javier Martinez
> Canillas <javier@dowhile0.org>; Lee Jones <lee.jones@linaro.org>; linux-arm-
> kernel@lists.infradead.org
> Subject: Re: [PATCH v2 1/2] regulator: act8945a: add regulator driver for
> ACT8945A
> 
> >>>>> "Wenyou" == Wenyou Yang <wenyou.yang@atmel.com> writes:
> 
>  > This patch adds new regulator driver to support ACT8945A MFD  > chip's
> regulators.
> 
>  > The ACT8945A has three step-down DC/DC converters and four  > low-dropout
> regulators.
> 
>  > Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
> 
> Isn't the regulator part of the act8945a identical to act8865? Can't we just use the
> existing act8865-regulator.c driver? (E.G. support 8865 variant in the mfd driver,
> but only register the regulator sub device?)

Yes, the regulator part of the act8945a is identical to act8865.

But the act8865-regulator driver is a struct i2c_driver,  and the mfd sub-device driver is a platform_driver driver, it is not easy to use it.

> 
> --
> Bye, Peter Korsgaard


Best Regards,
Wenyou Yang

^ permalink raw reply	[flat|nested] 35+ messages in thread

* [PATCH v2 1/2] regulator: act8945a: add regulator driver for ACT8945A
@ 2016-01-14  1:23       ` Yang, Wenyou
  0 siblings, 0 replies; 35+ messages in thread
From: Yang, Wenyou @ 2016-01-14  1:23 UTC (permalink / raw)
  To: linux-arm-kernel

> -----Original Message-----
> From: Peter Korsgaard [mailto:jacmet at gmail.com] On Behalf Of Peter Korsgaard
> Sent: 2016?1?13? 22:22
> To: Yang, Wenyou <Wenyou.Yang@atmel.com>
> Cc: Liam Girdwood <lgirdwood@gmail.com>; Mark Brown <broonie@kernel.org>;
> Rob Herring <robh+dt@kernel.org>; Pawel Moll <pawel.moll@arm.com>; Mark
> Rutland <mark.rutland@arm.com>; Ian Campbell <ijc+devicetree@hellion.org.uk>;
> Kumar Gala <galak@codeaurora.org>; Krzysztof Kozlowski
> <k.kozlowski@samsung.com>; devicetree at vger.kernel.org; Ferre, Nicolas
> <Nicolas.FERRE@atmel.com>; linux-kernel at vger.kernel.org; Javier Martinez
> Canillas <javier@dowhile0.org>; Lee Jones <lee.jones@linaro.org>; linux-arm-
> kernel at lists.infradead.org
> Subject: Re: [PATCH v2 1/2] regulator: act8945a: add regulator driver for
> ACT8945A
> 
> >>>>> "Wenyou" == Wenyou Yang <wenyou.yang@atmel.com> writes:
> 
>  > This patch adds new regulator driver to support ACT8945A MFD  > chip's
> regulators.
> 
>  > The ACT8945A has three step-down DC/DC converters and four  > low-dropout
> regulators.
> 
>  > Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
> 
> Isn't the regulator part of the act8945a identical to act8865? Can't we just use the
> existing act8865-regulator.c driver? (E.G. support 8865 variant in the mfd driver,
> but only register the regulator sub device?)

Yes, the regulator part of the act8945a is identical to act8865.

But the act8865-regulator driver is a struct i2c_driver,  and the mfd sub-device driver is a platform_driver driver, it is not easy to use it.

> 
> --
> Bye, Peter Korsgaard


Best Regards,
Wenyou Yang

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH v2 1/2] regulator: act8945a: add regulator driver for ACT8945A
  2016-01-14  1:23       ` Yang, Wenyou
  (?)
@ 2016-01-14  6:19         ` Lee Jones
  -1 siblings, 0 replies; 35+ messages in thread
From: Lee Jones @ 2016-01-14  6:19 UTC (permalink / raw)
  To: Yang, Wenyou
  Cc: Peter Korsgaard, Liam Girdwood, Mark Brown, Rob Herring,
	Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Krzysztof Kozlowski, devicetree, Ferre, Nicolas, linux-kernel,
	Javier Martinez Canillas, linux-arm-kernel

On Thu, 14 Jan 2016, Yang, Wenyou wrote:

> > -----Original Message-----
> > From: Peter Korsgaard [mailto:jacmet@gmail.com] On Behalf Of Peter Korsgaard
> > Sent: 2016年1月13日 22:22
> > To: Yang, Wenyou <Wenyou.Yang@atmel.com>
> > Cc: Liam Girdwood <lgirdwood@gmail.com>; Mark Brown <broonie@kernel.org>;
> > Rob Herring <robh+dt@kernel.org>; Pawel Moll <pawel.moll@arm.com>; Mark
> > Rutland <mark.rutland@arm.com>; Ian Campbell <ijc+devicetree@hellion.org.uk>;
> > Kumar Gala <galak@codeaurora.org>; Krzysztof Kozlowski
> > <k.kozlowski@samsung.com>; devicetree@vger.kernel.org; Ferre, Nicolas
> > <Nicolas.FERRE@atmel.com>; linux-kernel@vger.kernel.org; Javier Martinez
> > Canillas <javier@dowhile0.org>; Lee Jones <lee.jones@linaro.org>; linux-arm-
> > kernel@lists.infradead.org
> > Subject: Re: [PATCH v2 1/2] regulator: act8945a: add regulator driver for
> > ACT8945A
> > 
> > >>>>> "Wenyou" == Wenyou Yang <wenyou.yang@atmel.com> writes:
> > 
> >  > This patch adds new regulator driver to support ACT8945A MFD  > chip's
> > regulators.
> > 
> >  > The ACT8945A has three step-down DC/DC converters and four  > low-dropout
> > regulators.
> > 
> >  > Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
> > 
> > Isn't the regulator part of the act8945a identical to act8865? Can't we just use the
> > existing act8865-regulator.c driver? (E.G. support 8865 variant in the mfd driver,
> > but only register the regulator sub device?)
> 
> Yes, the regulator part of the act8945a is identical to act8865.
> 
> But the act8865-regulator driver is a struct i2c_driver,  and the mfd sub-device driver is a platform_driver driver, it is not easy to use it.

Take a look at some existing files with the pattern
drivers/mfd/*{spi,i2c,core}.c to see how this might be possible.

-- 
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] 35+ messages in thread

* Re: [PATCH v2 1/2] regulator: act8945a: add regulator driver for ACT8945A
@ 2016-01-14  6:19         ` Lee Jones
  0 siblings, 0 replies; 35+ messages in thread
From: Lee Jones @ 2016-01-14  6:19 UTC (permalink / raw)
  To: Yang, Wenyou
  Cc: Peter Korsgaard, Liam Girdwood, Mark Brown, Rob Herring,
	Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Krzysztof Kozlowski, devicetree, Ferre, Nicolas, linux-kernel,
	Javier Martinez Canillas, linux-arm-kernel

On Thu, 14 Jan 2016, Yang, Wenyou wrote:

> > -----Original Message-----
> > From: Peter Korsgaard [mailto:jacmet@gmail.com] On Behalf Of Peter Korsgaard
> > Sent: 2016年1月13日 22:22
> > To: Yang, Wenyou <Wenyou.Yang@atmel.com>
> > Cc: Liam Girdwood <lgirdwood@gmail.com>; Mark Brown <broonie@kernel.org>;
> > Rob Herring <robh+dt@kernel.org>; Pawel Moll <pawel.moll@arm.com>; Mark
> > Rutland <mark.rutland@arm.com>; Ian Campbell <ijc+devicetree@hellion.org.uk>;
> > Kumar Gala <galak@codeaurora.org>; Krzysztof Kozlowski
> > <k.kozlowski@samsung.com>; devicetree@vger.kernel.org; Ferre, Nicolas
> > <Nicolas.FERRE@atmel.com>; linux-kernel@vger.kernel.org; Javier Martinez
> > Canillas <javier@dowhile0.org>; Lee Jones <lee.jones@linaro.org>; linux-arm-
> > kernel@lists.infradead.org
> > Subject: Re: [PATCH v2 1/2] regulator: act8945a: add regulator driver for
> > ACT8945A
> > 
> > >>>>> "Wenyou" == Wenyou Yang <wenyou.yang@atmel.com> writes:
> > 
> >  > This patch adds new regulator driver to support ACT8945A MFD  > chip's
> > regulators.
> > 
> >  > The ACT8945A has three step-down DC/DC converters and four  > low-dropout
> > regulators.
> > 
> >  > Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
> > 
> > Isn't the regulator part of the act8945a identical to act8865? Can't we just use the
> > existing act8865-regulator.c driver? (E.G. support 8865 variant in the mfd driver,
> > but only register the regulator sub device?)
> 
> Yes, the regulator part of the act8945a is identical to act8865.
> 
> But the act8865-regulator driver is a struct i2c_driver,  and the mfd sub-device driver is a platform_driver driver, it is not easy to use it.

Take a look at some existing files with the pattern
drivers/mfd/*{spi,i2c,core}.c to see how this might be possible.

-- 
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] 35+ messages in thread

* [PATCH v2 1/2] regulator: act8945a: add regulator driver for ACT8945A
@ 2016-01-14  6:19         ` Lee Jones
  0 siblings, 0 replies; 35+ messages in thread
From: Lee Jones @ 2016-01-14  6:19 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, 14 Jan 2016, Yang, Wenyou wrote:

> > -----Original Message-----
> > From: Peter Korsgaard [mailto:jacmet at gmail.com] On Behalf Of Peter Korsgaard
> > Sent: 2016?1?13? 22:22
> > To: Yang, Wenyou <Wenyou.Yang@atmel.com>
> > Cc: Liam Girdwood <lgirdwood@gmail.com>; Mark Brown <broonie@kernel.org>;
> > Rob Herring <robh+dt@kernel.org>; Pawel Moll <pawel.moll@arm.com>; Mark
> > Rutland <mark.rutland@arm.com>; Ian Campbell <ijc+devicetree@hellion.org.uk>;
> > Kumar Gala <galak@codeaurora.org>; Krzysztof Kozlowski
> > <k.kozlowski@samsung.com>; devicetree at vger.kernel.org; Ferre, Nicolas
> > <Nicolas.FERRE@atmel.com>; linux-kernel at vger.kernel.org; Javier Martinez
> > Canillas <javier@dowhile0.org>; Lee Jones <lee.jones@linaro.org>; linux-arm-
> > kernel at lists.infradead.org
> > Subject: Re: [PATCH v2 1/2] regulator: act8945a: add regulator driver for
> > ACT8945A
> > 
> > >>>>> "Wenyou" == Wenyou Yang <wenyou.yang@atmel.com> writes:
> > 
> >  > This patch adds new regulator driver to support ACT8945A MFD  > chip's
> > regulators.
> > 
> >  > The ACT8945A has three step-down DC/DC converters and four  > low-dropout
> > regulators.
> > 
> >  > Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
> > 
> > Isn't the regulator part of the act8945a identical to act8865? Can't we just use the
> > existing act8865-regulator.c driver? (E.G. support 8865 variant in the mfd driver,
> > but only register the regulator sub device?)
> 
> Yes, the regulator part of the act8945a is identical to act8865.
> 
> But the act8865-regulator driver is a struct i2c_driver,  and the mfd sub-device driver is a platform_driver driver, it is not easy to use it.

Take a look at some existing files with the pattern
drivers/mfd/*{spi,i2c,core}.c to see how this might be possible.

-- 
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] 35+ messages in thread

* Re: [PATCH v2 1/2] regulator: act8945a: add regulator driver for ACT8945A
  2016-01-14  1:23       ` Yang, Wenyou
  (?)
@ 2016-01-14  7:27         ` Peter Korsgaard
  -1 siblings, 0 replies; 35+ messages in thread
From: Peter Korsgaard @ 2016-01-14  7:27 UTC (permalink / raw)
  To: Yang, Wenyou
  Cc: Liam Girdwood, Mark Brown, Rob Herring, Pawel Moll, Mark Rutland,
	Ian Campbell, Kumar Gala, Krzysztof Kozlowski, devicetree, Ferre,
	Nicolas, linux-kernel, Javier Martinez Canillas, Lee Jones,
	linux-arm-kernel

>>>>> "Yang," == Yang, Wenyou <Wenyou.Yang@atmel.com> writes:

 >> Isn't the regulator part of the act8945a identical to act8865? Can't we just use the
 >> existing act8865-regulator.c driver? (E.G. support 8865 variant in the mfd driver,
 >> but only register the regulator sub device?)

 > Yes, the regulator part of the act8945a is identical to act8865.

 > But the act8865-regulator driver is a struct i2c_driver, and the mfd
 > sub-device driver is a platform_driver driver, it is not easy to use
 > it.

But the mfd driver could support the act8865 variant as well (by only
registering the regulator mfd cell).

-- 
Venlig hilsen,
Peter Korsgaard 

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH v2 1/2] regulator: act8945a: add regulator driver for ACT8945A
@ 2016-01-14  7:27         ` Peter Korsgaard
  0 siblings, 0 replies; 35+ messages in thread
From: Peter Korsgaard @ 2016-01-14  7:27 UTC (permalink / raw)
  To: Yang, Wenyou
  Cc: Liam Girdwood, Mark Brown, Rob Herring, Pawel Moll, Mark Rutland,
	Ian Campbell, Kumar Gala, Krzysztof Kozlowski,
	devicetree@vger.kernel.org, Ferre, Nicolas,
	linux-kernel@vger.kernel.org, Javier Martinez Canillas,
	Lee Jones, linux-arm-kernel@lists.infradead.org

>>>>> "Yang," == Yang, Wenyou <Wenyou.Yang-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org> writes:

 >> Isn't the regulator part of the act8945a identical to act8865? Can't we just use the
 >> existing act8865-regulator.c driver? (E.G. support 8865 variant in the mfd driver,
 >> but only register the regulator sub device?)

 > Yes, the regulator part of the act8945a is identical to act8865.

 > But the act8865-regulator driver is a struct i2c_driver, and the mfd
 > sub-device driver is a platform_driver driver, it is not easy to use
 > it.

But the mfd driver could support the act8865 variant as well (by only
registering the regulator mfd cell).

-- 
Venlig hilsen,
Peter Korsgaard 
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 35+ messages in thread

* [PATCH v2 1/2] regulator: act8945a: add regulator driver for ACT8945A
@ 2016-01-14  7:27         ` Peter Korsgaard
  0 siblings, 0 replies; 35+ messages in thread
From: Peter Korsgaard @ 2016-01-14  7:27 UTC (permalink / raw)
  To: linux-arm-kernel

>>>>> "Yang," == Yang, Wenyou <Wenyou.Yang@atmel.com> writes:

 >> Isn't the regulator part of the act8945a identical to act8865? Can't we just use the
 >> existing act8865-regulator.c driver? (E.G. support 8865 variant in the mfd driver,
 >> but only register the regulator sub device?)

 > Yes, the regulator part of the act8945a is identical to act8865.

 > But the act8865-regulator driver is a struct i2c_driver, and the mfd
 > sub-device driver is a platform_driver driver, it is not easy to use
 > it.

But the mfd driver could support the act8865 variant as well (by only
registering the regulator mfd cell).

-- 
Venlig hilsen,
Peter Korsgaard 

^ permalink raw reply	[flat|nested] 35+ messages in thread

* RE: [PATCH v2 1/2] regulator: act8945a: add regulator driver for ACT8945A
@ 2016-01-14  8:07           ` Yang, Wenyou
  0 siblings, 0 replies; 35+ messages in thread
From: Yang, Wenyou @ 2016-01-14  8:07 UTC (permalink / raw)
  To: Peter Korsgaard
  Cc: Liam Girdwood, Mark Brown, Rob Herring, Pawel Moll, Mark Rutland,
	Ian Campbell, Kumar Gala, Krzysztof Kozlowski, devicetree, Ferre,
	Nicolas, linux-kernel, Javier Martinez Canillas, Lee Jones,
	linux-arm-kernel



> -----Original Message-----
> From: Peter Korsgaard [mailto:jacmet@gmail.com] On Behalf Of Peter Korsgaard
> Sent: 2016年1月14日 15:28
> To: Yang, Wenyou <Wenyou.Yang@atmel.com>
> Cc: Liam Girdwood <lgirdwood@gmail.com>; Mark Brown <broonie@kernel.org>;
> Rob Herring <robh+dt@kernel.org>; Pawel Moll <pawel.moll@arm.com>; Mark
> Rutland <mark.rutland@arm.com>; Ian Campbell <ijc+devicetree@hellion.org.uk>;
> Kumar Gala <galak@codeaurora.org>; Krzysztof Kozlowski
> <k.kozlowski@samsung.com>; devicetree@vger.kernel.org; Ferre, Nicolas
> <Nicolas.FERRE@atmel.com>; linux-kernel@vger.kernel.org; Javier Martinez
> Canillas <javier@dowhile0.org>; Lee Jones <lee.jones@linaro.org>; linux-arm-
> kernel@lists.infradead.org
> Subject: Re: [PATCH v2 1/2] regulator: act8945a: add regulator driver for
> ACT8945A
> 
> >>>>> "Yang," == Yang, Wenyou <Wenyou.Yang@atmel.com> writes:
> 
>  >> Isn't the regulator part of the act8945a identical to act8865? Can't we just use
> the  >> existing act8865-regulator.c driver? (E.G. support 8865 variant in the mfd
> driver,  >> but only register the regulator sub device?)
> 
>  > Yes, the regulator part of the act8945a is identical to act8865.
> 
>  > But the act8865-regulator driver is a struct i2c_driver, and the mfd  > sub-
> device driver is a platform_driver driver, it is not easy to use  > it.
> 
> But the mfd driver could support the act8865 variant as well (by only registering
> the regulator mfd cell).

I still don't understand.

The MFD sub device is registered as a platform device, the existing act8865 driver is registered as an i2c_driver. How do they match? :)

Could you point out which exiting driver for me to reference.  Thank you!


Best Regards,
Wenyou Yang

^ permalink raw reply	[flat|nested] 35+ messages in thread

* RE: [PATCH v2 1/2] regulator: act8945a: add regulator driver for ACT8945A
@ 2016-01-14  8:07           ` Yang, Wenyou
  0 siblings, 0 replies; 35+ messages in thread
From: Yang, Wenyou @ 2016-01-14  8:07 UTC (permalink / raw)
  To: Peter Korsgaard
  Cc: Liam Girdwood, Mark Brown, Rob Herring, Pawel Moll, Mark Rutland,
	Ian Campbell, Kumar Gala, Krzysztof Kozlowski,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Ferre, Nicolas,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Javier Martinez Canillas,
	Lee Jones, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r



> -----Original Message-----
> From: Peter Korsgaard [mailto:jacmet@gmail.com] On Behalf Of Peter Korsgaard
> Sent: 2016年1月14日 15:28
> To: Yang, Wenyou <Wenyou.Yang@atmel.com>
> Cc: Liam Girdwood <lgirdwood@gmail.com>; Mark Brown <broonie@kernel.org>;
> Rob Herring <robh+dt@kernel.org>; Pawel Moll <pawel.moll@arm.com>; Mark
> Rutland <mark.rutland@arm.com>; Ian Campbell <ijc+devicetree@hellion.org.uk>;
> Kumar Gala <galak@codeaurora.org>; Krzysztof Kozlowski
> <k.kozlowski@samsung.com>; devicetree@vger.kernel.org; Ferre, Nicolas
> <Nicolas.FERRE@atmel.com>; linux-kernel@vger.kernel.org; Javier Martinez
> Canillas <javier@dowhile0.org>; Lee Jones <lee.jones@linaro.org>; linux-arm-
> kernel@lists.infradead.org
> Subject: Re: [PATCH v2 1/2] regulator: act8945a: add regulator driver for
> ACT8945A
> 
> >>>>> "Yang," == Yang, Wenyou <Wenyou.Yang@atmel.com> writes:
> 
>  >> Isn't the regulator part of the act8945a identical to act8865? Can't we just use
> the  >> existing act8865-regulator.c driver? (E.G. support 8865 variant in the mfd
> driver,  >> but only register the regulator sub device?)
> 
>  > Yes, the regulator part of the act8945a is identical to act8865.
> 
>  > But the act8865-regulator driver is a struct i2c_driver, and the mfd  > sub-
> device driver is a platform_driver driver, it is not easy to use  > it.
> 
> But the mfd driver could support the act8865 variant as well (by only registering
> the regulator mfd cell).

I still don't understand.

The MFD sub device is registered as a platform device, the existing act8865 driver is registered as an i2c_driver. How do they match? :)

Could you point out which exiting driver for me to reference.  Thank you!


Best Regards,
Wenyou Yang

^ permalink raw reply	[flat|nested] 35+ messages in thread

* [PATCH v2 1/2] regulator: act8945a: add regulator driver for ACT8945A
@ 2016-01-14  8:07           ` Yang, Wenyou
  0 siblings, 0 replies; 35+ messages in thread
From: Yang, Wenyou @ 2016-01-14  8:07 UTC (permalink / raw)
  To: linux-arm-kernel



> -----Original Message-----
> From: Peter Korsgaard [mailto:jacmet at gmail.com] On Behalf Of Peter Korsgaard
> Sent: 2016?1?14? 15:28
> To: Yang, Wenyou <Wenyou.Yang@atmel.com>
> Cc: Liam Girdwood <lgirdwood@gmail.com>; Mark Brown <broonie@kernel.org>;
> Rob Herring <robh+dt@kernel.org>; Pawel Moll <pawel.moll@arm.com>; Mark
> Rutland <mark.rutland@arm.com>; Ian Campbell <ijc+devicetree@hellion.org.uk>;
> Kumar Gala <galak@codeaurora.org>; Krzysztof Kozlowski
> <k.kozlowski@samsung.com>; devicetree at vger.kernel.org; Ferre, Nicolas
> <Nicolas.FERRE@atmel.com>; linux-kernel at vger.kernel.org; Javier Martinez
> Canillas <javier@dowhile0.org>; Lee Jones <lee.jones@linaro.org>; linux-arm-
> kernel at lists.infradead.org
> Subject: Re: [PATCH v2 1/2] regulator: act8945a: add regulator driver for
> ACT8945A
> 
> >>>>> "Yang," == Yang, Wenyou <Wenyou.Yang@atmel.com> writes:
> 
>  >> Isn't the regulator part of the act8945a identical to act8865? Can't we just use
> the  >> existing act8865-regulator.c driver? (E.G. support 8865 variant in the mfd
> driver,  >> but only register the regulator sub device?)
> 
>  > Yes, the regulator part of the act8945a is identical to act8865.
> 
>  > But the act8865-regulator driver is a struct i2c_driver, and the mfd  > sub-
> device driver is a platform_driver driver, it is not easy to use  > it.
> 
> But the mfd driver could support the act8865 variant as well (by only registering
> the regulator mfd cell).

I still don't understand.

The MFD sub device is registered as a platform device, the existing act8865 driver is registered as an i2c_driver. How do they match? :)

Could you point out which exiting driver for me to reference.  Thank you!


Best Regards,
Wenyou Yang

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH v2 1/2] regulator: act8945a: add regulator driver for ACT8945A
  2016-01-14  8:07           ` Yang, Wenyou
  (?)
@ 2016-01-14 11:43             ` Peter Korsgaard
  -1 siblings, 0 replies; 35+ messages in thread
From: Peter Korsgaard @ 2016-01-14 11:43 UTC (permalink / raw)
  To: Yang, Wenyou
  Cc: Liam Girdwood, Mark Brown, Rob Herring, Pawel Moll, Mark Rutland,
	Ian Campbell, Kumar Gala, Krzysztof Kozlowski, devicetree, Ferre,
	Nicolas, linux-kernel, Javier Martinez Canillas, Lee Jones,
	linux-arm-kernel

>>>>> "Yang," == Yang, Wenyou <Wenyou.Yang@atmel.com> writes:

Hi,

>> 
 >>> Isn't the regulator part of the act8945a identical to act8865? Can't we just use
 >>> the existing act8865-regulator.c driver? (E.G. support 8865 variant in the mfd
 >>> driver, but only register the regulator sub device?)
 >> 
 >> > Yes, the regulator part of the act8945a is identical to act8865.
 >> 
 >> > But the act8865-regulator driver is a struct i2c_driver, and the mfd  > sub-
 >> device driver is a platform_driver driver, it is not easy to use  > it.
 >> 
 >> But the mfd driver could support the act8865 variant as well (by only registering
 >> the regulator mfd cell).

 > I still don't understand.

 > The MFD sub device is registered as a platform device, the existing
 > act8865 driver is registered as an i2c_driver. How do they match? :)

 > Could you point out which exiting driver for me to reference.  Thank you!

What I'm saying is that it isn't nice that we end up with both
act8865-regulator.c and act8954-regulator.c doing 95% the same. This can
either be fixed by:

- Adding act8865 support to your mfd driver (but only registering the
  regulator subdev for act8865) and changing the existing
  act8865-regulator driver to work as a mfd subdev (platform device)

- Extending the act8865-regulator driver to register as a platform
  driver in ADDITION to a i2c driver so it can be used with mfd. The
  driver already uses regmap so it should only be a matter of adding the
  pdev probe/remove functions.

-- 
Venlig hilsen,
Peter Korsgaard 

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH v2 1/2] regulator: act8945a: add regulator driver for ACT8945A
@ 2016-01-14 11:43             ` Peter Korsgaard
  0 siblings, 0 replies; 35+ messages in thread
From: Peter Korsgaard @ 2016-01-14 11:43 UTC (permalink / raw)
  To: Yang, Wenyou
  Cc: Liam Girdwood, Mark Brown, Rob Herring, Pawel Moll, Mark Rutland,
	Ian Campbell, Kumar Gala, Krzysztof Kozlowski,
	devicetree@vger.kernel.org, Ferre, Nicolas,
	linux-kernel@vger.kernel.org, Javier Martinez Canillas,
	Lee Jones, linux-arm-kernel@lists.infradead.org

>>>>> "Yang," == Yang, Wenyou <Wenyou.Yang-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org> writes:

Hi,

>> 
 >>> Isn't the regulator part of the act8945a identical to act8865? Can't we just use
 >>> the existing act8865-regulator.c driver? (E.G. support 8865 variant in the mfd
 >>> driver, but only register the regulator sub device?)
 >> 
 >> > Yes, the regulator part of the act8945a is identical to act8865.
 >> 
 >> > But the act8865-regulator driver is a struct i2c_driver, and the mfd  > sub-
 >> device driver is a platform_driver driver, it is not easy to use  > it.
 >> 
 >> But the mfd driver could support the act8865 variant as well (by only registering
 >> the regulator mfd cell).

 > I still don't understand.

 > The MFD sub device is registered as a platform device, the existing
 > act8865 driver is registered as an i2c_driver. How do they match? :)

 > Could you point out which exiting driver for me to reference.  Thank you!

What I'm saying is that it isn't nice that we end up with both
act8865-regulator.c and act8954-regulator.c doing 95% the same. This can
either be fixed by:

- Adding act8865 support to your mfd driver (but only registering the
  regulator subdev for act8865) and changing the existing
  act8865-regulator driver to work as a mfd subdev (platform device)

- Extending the act8865-regulator driver to register as a platform
  driver in ADDITION to a i2c driver so it can be used with mfd. The
  driver already uses regmap so it should only be a matter of adding the
  pdev probe/remove functions.

-- 
Venlig hilsen,
Peter Korsgaard 
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 35+ messages in thread

* [PATCH v2 1/2] regulator: act8945a: add regulator driver for ACT8945A
@ 2016-01-14 11:43             ` Peter Korsgaard
  0 siblings, 0 replies; 35+ messages in thread
From: Peter Korsgaard @ 2016-01-14 11:43 UTC (permalink / raw)
  To: linux-arm-kernel

>>>>> "Yang," == Yang, Wenyou <Wenyou.Yang@atmel.com> writes:

Hi,

>> 
 >>> Isn't the regulator part of the act8945a identical to act8865? Can't we just use
 >>> the existing act8865-regulator.c driver? (E.G. support 8865 variant in the mfd
 >>> driver, but only register the regulator sub device?)
 >> 
 >> > Yes, the regulator part of the act8945a is identical to act8865.
 >> 
 >> > But the act8865-regulator driver is a struct i2c_driver, and the mfd  > sub-
 >> device driver is a platform_driver driver, it is not easy to use  > it.
 >> 
 >> But the mfd driver could support the act8865 variant as well (by only registering
 >> the regulator mfd cell).

 > I still don't understand.

 > The MFD sub device is registered as a platform device, the existing
 > act8865 driver is registered as an i2c_driver. How do they match? :)

 > Could you point out which exiting driver for me to reference.  Thank you!

What I'm saying is that it isn't nice that we end up with both
act8865-regulator.c and act8954-regulator.c doing 95% the same. This can
either be fixed by:

- Adding act8865 support to your mfd driver (but only registering the
  regulator subdev for act8865) and changing the existing
  act8865-regulator driver to work as a mfd subdev (platform device)

- Extending the act8865-regulator driver to register as a platform
  driver in ADDITION to a i2c driver so it can be used with mfd. The
  driver already uses regmap so it should only be a matter of adding the
  pdev probe/remove functions.

-- 
Venlig hilsen,
Peter Korsgaard 

^ permalink raw reply	[flat|nested] 35+ messages in thread

* RE: [PATCH v2 1/2] regulator: act8945a: add regulator driver for ACT8945A
  2016-01-14 11:43             ` Peter Korsgaard
  (?)
@ 2016-01-14 12:46               ` Yang, Wenyou
  -1 siblings, 0 replies; 35+ messages in thread
From: Yang, Wenyou @ 2016-01-14 12:46 UTC (permalink / raw)
  To: Peter Korsgaard
  Cc: Liam Girdwood, Mark Brown, Rob Herring, Pawel Moll, Mark Rutland,
	Ian Campbell, Kumar Gala, Krzysztof Kozlowski, devicetree, Ferre,
	Nicolas, linux-kernel, Javier Martinez Canillas, Lee Jones,
	linux-arm-kernel

Hi Peter,

> -----Original Message-----
> From: Peter Korsgaard [mailto:jacmet@gmail.com] On Behalf Of Peter Korsgaard
> Sent: 2016年1月14日 19:43
> To: Yang, Wenyou <Wenyou.Yang@atmel.com>
> Cc: Liam Girdwood <lgirdwood@gmail.com>; Mark Brown <broonie@kernel.org>;
> Rob Herring <robh+dt@kernel.org>; Pawel Moll <pawel.moll@arm.com>; Mark
> Rutland <mark.rutland@arm.com>; Ian Campbell <ijc+devicetree@hellion.org.uk>;
> Kumar Gala <galak@codeaurora.org>; Krzysztof Kozlowski
> <k.kozlowski@samsung.com>; devicetree@vger.kernel.org; Ferre, Nicolas
> <Nicolas.FERRE@atmel.com>; linux-kernel@vger.kernel.org; Javier Martinez
> Canillas <javier@dowhile0.org>; Lee Jones <lee.jones@linaro.org>; linux-arm-
> kernel@lists.infradead.org
> Subject: Re: [PATCH v2 1/2] regulator: act8945a: add regulator driver for
> ACT8945A
> 
> >>>>> "Yang," == Yang, Wenyou <Wenyou.Yang@atmel.com> writes:
> 
> Hi,
> 
> >>
>  >>> Isn't the regulator part of the act8945a identical to act8865? Can't we just
> use  >>> the existing act8865-regulator.c driver? (E.G. support 8865 variant in the
> mfd  >>> driver, but only register the regulator sub device?)  >>  >> > Yes, the
> regulator part of the act8945a is identical to act8865.
>  >>
>  >> > But the act8865-regulator driver is a struct i2c_driver, and the mfd  > sub-
>   >> device driver is a platform_driver driver, it is not easy to use  > it.
>  >>
>  >> But the mfd driver could support the act8865 variant as well (by only
> registering  >> the regulator mfd cell).
> 
>  > I still don't understand.
> 
>  > The MFD sub device is registered as a platform device, the existing  > act8865
> driver is registered as an i2c_driver. How do they match? :)
> 
>  > Could you point out which exiting driver for me to reference.  Thank you!
> 
> What I'm saying is that it isn't nice that we end up with both act8865-regulator.c
> and act8954-regulator.c doing 95% the same. This can either be fixed by:
> 
> - Adding act8865 support to your mfd driver (but only registering the
>   regulator subdev for act8865) and changing the existing
>   act8865-regulator driver to work as a mfd subdev (platform device)
> 
> - Extending the act8865-regulator driver to register as a platform
>   driver in ADDITION to a i2c driver so it can be used with mfd. The
>   driver already uses regmap so it should only be a matter of adding the
>   pdev probe/remove functions.

Thank you for so detail information, I will do as you said.


Thanks & Best Regards,
Wenyou Yang

^ permalink raw reply	[flat|nested] 35+ messages in thread

* RE: [PATCH v2 1/2] regulator: act8945a: add regulator driver for ACT8945A
@ 2016-01-14 12:46               ` Yang, Wenyou
  0 siblings, 0 replies; 35+ messages in thread
From: Yang, Wenyou @ 2016-01-14 12:46 UTC (permalink / raw)
  To: Peter Korsgaard
  Cc: Liam Girdwood, Mark Brown, Rob Herring, Pawel Moll, Mark Rutland,
	Ian Campbell, Kumar Gala, Krzysztof Kozlowski, devicetree, Ferre,
	Nicolas, linux-kernel, Javier Martinez Canillas, Lee Jones,
	linux-arm-kernel

Hi Peter,

> -----Original Message-----
> From: Peter Korsgaard [mailto:jacmet@gmail.com] On Behalf Of Peter Korsgaard
> Sent: 2016年1月14日 19:43
> To: Yang, Wenyou <Wenyou.Yang@atmel.com>
> Cc: Liam Girdwood <lgirdwood@gmail.com>; Mark Brown <broonie@kernel.org>;
> Rob Herring <robh+dt@kernel.org>; Pawel Moll <pawel.moll@arm.com>; Mark
> Rutland <mark.rutland@arm.com>; Ian Campbell <ijc+devicetree@hellion.org.uk>;
> Kumar Gala <galak@codeaurora.org>; Krzysztof Kozlowski
> <k.kozlowski@samsung.com>; devicetree@vger.kernel.org; Ferre, Nicolas
> <Nicolas.FERRE@atmel.com>; linux-kernel@vger.kernel.org; Javier Martinez
> Canillas <javier@dowhile0.org>; Lee Jones <lee.jones@linaro.org>; linux-arm-
> kernel@lists.infradead.org
> Subject: Re: [PATCH v2 1/2] regulator: act8945a: add regulator driver for
> ACT8945A
> 
> >>>>> "Yang," == Yang, Wenyou <Wenyou.Yang@atmel.com> writes:
> 
> Hi,
> 
> >>
>  >>> Isn't the regulator part of the act8945a identical to act8865? Can't we just
> use  >>> the existing act8865-regulator.c driver? (E.G. support 8865 variant in the
> mfd  >>> driver, but only register the regulator sub device?)  >>  >> > Yes, the
> regulator part of the act8945a is identical to act8865.
>  >>
>  >> > But the act8865-regulator driver is a struct i2c_driver, and the mfd  > sub-
>   >> device driver is a platform_driver driver, it is not easy to use  > it.
>  >>
>  >> But the mfd driver could support the act8865 variant as well (by only
> registering  >> the regulator mfd cell).
> 
>  > I still don't understand.
> 
>  > The MFD sub device is registered as a platform device, the existing  > act8865
> driver is registered as an i2c_driver. How do they match? :)
> 
>  > Could you point out which exiting driver for me to reference.  Thank you!
> 
> What I'm saying is that it isn't nice that we end up with both act8865-regulator.c
> and act8954-regulator.c doing 95% the same. This can either be fixed by:
> 
> - Adding act8865 support to your mfd driver (but only registering the
>   regulator subdev for act8865) and changing the existing
>   act8865-regulator driver to work as a mfd subdev (platform device)
> 
> - Extending the act8865-regulator driver to register as a platform
>   driver in ADDITION to a i2c driver so it can be used with mfd. The
>   driver already uses regmap so it should only be a matter of adding the
>   pdev probe/remove functions.

Thank you for so detail information, I will do as you said.


Thanks & Best Regards,
Wenyou Yang

^ permalink raw reply	[flat|nested] 35+ messages in thread

* [PATCH v2 1/2] regulator: act8945a: add regulator driver for ACT8945A
@ 2016-01-14 12:46               ` Yang, Wenyou
  0 siblings, 0 replies; 35+ messages in thread
From: Yang, Wenyou @ 2016-01-14 12:46 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Peter,

> -----Original Message-----
> From: Peter Korsgaard [mailto:jacmet at gmail.com] On Behalf Of Peter Korsgaard
> Sent: 2016?1?14? 19:43
> To: Yang, Wenyou <Wenyou.Yang@atmel.com>
> Cc: Liam Girdwood <lgirdwood@gmail.com>; Mark Brown <broonie@kernel.org>;
> Rob Herring <robh+dt@kernel.org>; Pawel Moll <pawel.moll@arm.com>; Mark
> Rutland <mark.rutland@arm.com>; Ian Campbell <ijc+devicetree@hellion.org.uk>;
> Kumar Gala <galak@codeaurora.org>; Krzysztof Kozlowski
> <k.kozlowski@samsung.com>; devicetree at vger.kernel.org; Ferre, Nicolas
> <Nicolas.FERRE@atmel.com>; linux-kernel at vger.kernel.org; Javier Martinez
> Canillas <javier@dowhile0.org>; Lee Jones <lee.jones@linaro.org>; linux-arm-
> kernel at lists.infradead.org
> Subject: Re: [PATCH v2 1/2] regulator: act8945a: add regulator driver for
> ACT8945A
> 
> >>>>> "Yang," == Yang, Wenyou <Wenyou.Yang@atmel.com> writes:
> 
> Hi,
> 
> >>
>  >>> Isn't the regulator part of the act8945a identical to act8865? Can't we just
> use  >>> the existing act8865-regulator.c driver? (E.G. support 8865 variant in the
> mfd  >>> driver, but only register the regulator sub device?)  >>  >> > Yes, the
> regulator part of the act8945a is identical to act8865.
>  >>
>  >> > But the act8865-regulator driver is a struct i2c_driver, and the mfd  > sub-
>   >> device driver is a platform_driver driver, it is not easy to use  > it.
>  >>
>  >> But the mfd driver could support the act8865 variant as well (by only
> registering  >> the regulator mfd cell).
> 
>  > I still don't understand.
> 
>  > The MFD sub device is registered as a platform device, the existing  > act8865
> driver is registered as an i2c_driver. How do they match? :)
> 
>  > Could you point out which exiting driver for me to reference.  Thank you!
> 
> What I'm saying is that it isn't nice that we end up with both act8865-regulator.c
> and act8954-regulator.c doing 95% the same. This can either be fixed by:
> 
> - Adding act8865 support to your mfd driver (but only registering the
>   regulator subdev for act8865) and changing the existing
>   act8865-regulator driver to work as a mfd subdev (platform device)
> 
> - Extending the act8865-regulator driver to register as a platform
>   driver in ADDITION to a i2c driver so it can be used with mfd. The
>   driver already uses regmap so it should only be a matter of adding the
>   pdev probe/remove functions.

Thank you for so detail information, I will do as you said.


Thanks & Best Regards,
Wenyou Yang

^ permalink raw reply	[flat|nested] 35+ messages in thread

* RE: [PATCH v2 1/2] regulator: act8945a: add regulator driver for ACT8945A
@ 2016-01-20  7:37               ` Yang, Wenyou
  0 siblings, 0 replies; 35+ messages in thread
From: Yang, Wenyou @ 2016-01-20  7:37 UTC (permalink / raw)
  To: Peter Korsgaard
  Cc: Liam Girdwood, Mark Brown, Rob Herring, Pawel Moll, Mark Rutland,
	Ian Campbell, Kumar Gala, Krzysztof Kozlowski, devicetree, Ferre,
	Nicolas, linux-kernel, Javier Martinez Canillas, Lee Jones,
	linux-arm-kernel

Hi Peter,

> -----Original Message-----
> From: Peter Korsgaard [mailto:jacmet@gmail.com] On Behalf Of Peter Korsgaard
> Sent: 2016年1月14日 19:43
> To: Yang, Wenyou <Wenyou.Yang@atmel.com>
> Cc: Liam Girdwood <lgirdwood@gmail.com>; Mark Brown <broonie@kernel.org>;
> Rob Herring <robh+dt@kernel.org>; Pawel Moll <pawel.moll@arm.com>; Mark
> Rutland <mark.rutland@arm.com>; Ian Campbell <ijc+devicetree@hellion.org.uk>;
> Kumar Gala <galak@codeaurora.org>; Krzysztof Kozlowski
> <k.kozlowski@samsung.com>; devicetree@vger.kernel.org; Ferre, Nicolas
> <Nicolas.FERRE@atmel.com>; linux-kernel@vger.kernel.org; Javier Martinez
> Canillas <javier@dowhile0.org>; Lee Jones <lee.jones@linaro.org>; linux-arm-
> kernel@lists.infradead.org
> Subject: Re: [PATCH v2 1/2] regulator: act8945a: add regulator driver for
> ACT8945A
> 
> >>>>> "Yang," == Yang, Wenyou <Wenyou.Yang@atmel.com> writes:
> 
> Hi,
> 
> >>
>  >>> Isn't the regulator part of the act8945a identical to act8865? Can't we just
> use  >>> the existing act8865-regulator.c driver? (E.G. support 8865 variant in the
> mfd  >>> driver, but only register the regulator sub device?)  >>  >> > Yes, the
> regulator part of the act8945a is identical to act8865.
>  >>
>  >> > But the act8865-regulator driver is a struct i2c_driver, and the mfd  > sub-
>   >> device driver is a platform_driver driver, it is not easy to use  > it.
>  >>
>  >> But the mfd driver could support the act8865 variant as well (by only
> registering  >> the regulator mfd cell).
> 
>  > I still don't understand.
> 
>  > The MFD sub device is registered as a platform device, the existing  > act8865
> driver is registered as an i2c_driver. How do they match? :)
> 
>  > Could you point out which exiting driver for me to reference.  Thank you!
> 
> What I'm saying is that it isn't nice that we end up with both act8865-regulator.c
> and act8954-regulator.c doing 95% the same. This can either be fixed by:
> 
> - Adding act8865 support to your mfd driver (but only registering the
>   regulator subdev for act8865) and changing the existing
>   act8865-regulator driver to work as a mfd subdev (platform device)
> 
> - Extending the act8865-regulator driver to register as a platform
>   driver in ADDITION to a i2c driver so it can be used with mfd. The
>   driver already uses regmap so it should only be a matter of adding the
>   pdev probe/remove functions.

After think twice, I think this will complicates the act8865-regulator driver.

Moreover, after following up the Mark's advice, a lot redundant code is removed from act8945a-regulater driver. It is very simple now.

So I think it is better to keep a separate act8945a-regulator driver.

Thank you for detailed description.


Best Regards,
Wenyou Yang

^ permalink raw reply	[flat|nested] 35+ messages in thread

* RE: [PATCH v2 1/2] regulator: act8945a: add regulator driver for ACT8945A
@ 2016-01-20  7:37               ` Yang, Wenyou
  0 siblings, 0 replies; 35+ messages in thread
From: Yang, Wenyou @ 2016-01-20  7:37 UTC (permalink / raw)
  To: Peter Korsgaard
  Cc: Liam Girdwood, Mark Brown, Rob Herring, Pawel Moll, Mark Rutland,
	Ian Campbell, Kumar Gala, Krzysztof Kozlowski,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Ferre, Nicolas,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Javier Martinez Canillas,
	Lee Jones, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

Hi Peter,

> -----Original Message-----
> From: Peter Korsgaard [mailto:jacmet@gmail.com] On Behalf Of Peter Korsgaard
> Sent: 2016年1月14日 19:43
> To: Yang, Wenyou <Wenyou.Yang@atmel.com>
> Cc: Liam Girdwood <lgirdwood@gmail.com>; Mark Brown <broonie@kernel.org>;
> Rob Herring <robh+dt@kernel.org>; Pawel Moll <pawel.moll@arm.com>; Mark
> Rutland <mark.rutland@arm.com>; Ian Campbell <ijc+devicetree@hellion.org.uk>;
> Kumar Gala <galak@codeaurora.org>; Krzysztof Kozlowski
> <k.kozlowski@samsung.com>; devicetree@vger.kernel.org; Ferre, Nicolas
> <Nicolas.FERRE@atmel.com>; linux-kernel@vger.kernel.org; Javier Martinez
> Canillas <javier@dowhile0.org>; Lee Jones <lee.jones@linaro.org>; linux-arm-
> kernel@lists.infradead.org
> Subject: Re: [PATCH v2 1/2] regulator: act8945a: add regulator driver for
> ACT8945A
> 
> >>>>> "Yang," == Yang, Wenyou <Wenyou.Yang@atmel.com> writes:
> 
> Hi,
> 
> >>
>  >>> Isn't the regulator part of the act8945a identical to act8865? Can't we just
> use  >>> the existing act8865-regulator.c driver? (E.G. support 8865 variant in the
> mfd  >>> driver, but only register the regulator sub device?)  >>  >> > Yes, the
> regulator part of the act8945a is identical to act8865.
>  >>
>  >> > But the act8865-regulator driver is a struct i2c_driver, and the mfd  > sub-
>   >> device driver is a platform_driver driver, it is not easy to use  > it.
>  >>
>  >> But the mfd driver could support the act8865 variant as well (by only
> registering  >> the regulator mfd cell).
> 
>  > I still don't understand.
> 
>  > The MFD sub device is registered as a platform device, the existing  > act8865
> driver is registered as an i2c_driver. How do they match? :)
> 
>  > Could you point out which exiting driver for me to reference.  Thank you!
> 
> What I'm saying is that it isn't nice that we end up with both act8865-regulator.c
> and act8954-regulator.c doing 95% the same. This can either be fixed by:
> 
> - Adding act8865 support to your mfd driver (but only registering the
>   regulator subdev for act8865) and changing the existing
>   act8865-regulator driver to work as a mfd subdev (platform device)
> 
> - Extending the act8865-regulator driver to register as a platform
>   driver in ADDITION to a i2c driver so it can be used with mfd. The
>   driver already uses regmap so it should only be a matter of adding the
>   pdev probe/remove functions.

After think twice, I think this will complicates the act8865-regulator driver.

Moreover, after following up the Mark's advice, a lot redundant code is removed from act8945a-regulater driver. It is very simple now.

So I think it is better to keep a separate act8945a-regulator driver.

Thank you for detailed description.


Best Regards,
Wenyou Yang

^ permalink raw reply	[flat|nested] 35+ messages in thread

* [PATCH v2 1/2] regulator: act8945a: add regulator driver for ACT8945A
@ 2016-01-20  7:37               ` Yang, Wenyou
  0 siblings, 0 replies; 35+ messages in thread
From: Yang, Wenyou @ 2016-01-20  7:37 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Peter,

> -----Original Message-----
> From: Peter Korsgaard [mailto:jacmet at gmail.com] On Behalf Of Peter Korsgaard
> Sent: 2016?1?14? 19:43
> To: Yang, Wenyou <Wenyou.Yang@atmel.com>
> Cc: Liam Girdwood <lgirdwood@gmail.com>; Mark Brown <broonie@kernel.org>;
> Rob Herring <robh+dt@kernel.org>; Pawel Moll <pawel.moll@arm.com>; Mark
> Rutland <mark.rutland@arm.com>; Ian Campbell <ijc+devicetree@hellion.org.uk>;
> Kumar Gala <galak@codeaurora.org>; Krzysztof Kozlowski
> <k.kozlowski@samsung.com>; devicetree at vger.kernel.org; Ferre, Nicolas
> <Nicolas.FERRE@atmel.com>; linux-kernel at vger.kernel.org; Javier Martinez
> Canillas <javier@dowhile0.org>; Lee Jones <lee.jones@linaro.org>; linux-arm-
> kernel at lists.infradead.org
> Subject: Re: [PATCH v2 1/2] regulator: act8945a: add regulator driver for
> ACT8945A
> 
> >>>>> "Yang," == Yang, Wenyou <Wenyou.Yang@atmel.com> writes:
> 
> Hi,
> 
> >>
>  >>> Isn't the regulator part of the act8945a identical to act8865? Can't we just
> use  >>> the existing act8865-regulator.c driver? (E.G. support 8865 variant in the
> mfd  >>> driver, but only register the regulator sub device?)  >>  >> > Yes, the
> regulator part of the act8945a is identical to act8865.
>  >>
>  >> > But the act8865-regulator driver is a struct i2c_driver, and the mfd  > sub-
>   >> device driver is a platform_driver driver, it is not easy to use  > it.
>  >>
>  >> But the mfd driver could support the act8865 variant as well (by only
> registering  >> the regulator mfd cell).
> 
>  > I still don't understand.
> 
>  > The MFD sub device is registered as a platform device, the existing  > act8865
> driver is registered as an i2c_driver. How do they match? :)
> 
>  > Could you point out which exiting driver for me to reference.  Thank you!
> 
> What I'm saying is that it isn't nice that we end up with both act8865-regulator.c
> and act8954-regulator.c doing 95% the same. This can either be fixed by:
> 
> - Adding act8865 support to your mfd driver (but only registering the
>   regulator subdev for act8865) and changing the existing
>   act8865-regulator driver to work as a mfd subdev (platform device)
> 
> - Extending the act8865-regulator driver to register as a platform
>   driver in ADDITION to a i2c driver so it can be used with mfd. The
>   driver already uses regmap so it should only be a matter of adding the
>   pdev probe/remove functions.

After think twice, I think this will complicates the act8865-regulator driver.

Moreover, after following up the Mark's advice, a lot redundant code is removed from act8945a-regulater driver. It is very simple now.

So I think it is better to keep a separate act8945a-regulator driver.

Thank you for detailed description.


Best Regards,
Wenyou Yang

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH v2 1/2] regulator: act8945a: add regulator driver for ACT8945A
  2016-01-20  7:37               ` Yang, Wenyou
  (?)
@ 2016-01-20  7:41                 ` Peter Korsgaard
  -1 siblings, 0 replies; 35+ messages in thread
From: Peter Korsgaard @ 2016-01-20  7:41 UTC (permalink / raw)
  To: Yang, Wenyou
  Cc: Liam Girdwood, Mark Brown, Rob Herring, Pawel Moll, Mark Rutland,
	Ian Campbell, Kumar Gala, Krzysztof Kozlowski, devicetree, Ferre,
	Nicolas, linux-kernel, Javier Martinez Canillas, Lee Jones,
	linux-arm-kernel

>>>>> "Yang," == Yang, Wenyou <Wenyou.Yang@atmel.com> writes:

Hi,

>> > The MFD sub device is registered as a platform device, the existing  > act8865
 >> driver is registered as an i2c_driver. How do they match? :)
 >> 
 >> > Could you point out which exiting driver for me to reference.  Thank you!
 >> 
 >> What I'm saying is that it isn't nice that we end up with both act8865-regulator.c
 >> and act8954-regulator.c doing 95% the same. This can either be fixed by:
 >> 
 >> - Adding act8865 support to your mfd driver (but only registering the
 >> regulator subdev for act8865) and changing the existing
 >> act8865-regulator driver to work as a mfd subdev (platform device)
 >> 
 >> - Extending the act8865-regulator driver to register as a platform
 >> driver in ADDITION to a i2c driver so it can be used with mfd. The
 >> driver already uses regmap so it should only be a matter of adding the
 >> pdev probe/remove functions.

 > After think twice, I think this will complicates the act8865-regulator driver.

I don't think it will add a lot of complication (E.G. basically just the
platform probe/remove functions), but Ok - I'll wait and see your
simplified driver.

-- 
Venlig hilsen,
Peter Korsgaard 

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH v2 1/2] regulator: act8945a: add regulator driver for ACT8945A
@ 2016-01-20  7:41                 ` Peter Korsgaard
  0 siblings, 0 replies; 35+ messages in thread
From: Peter Korsgaard @ 2016-01-20  7:41 UTC (permalink / raw)
  To: Yang, Wenyou
  Cc: Liam Girdwood, Mark Brown, Rob Herring, Pawel Moll, Mark Rutland,
	Ian Campbell, Kumar Gala, Krzysztof Kozlowski,
	devicetree@vger.kernel.org, Ferre, Nicolas,
	linux-kernel@vger.kernel.org, Javier Martinez Canillas,
	Lee Jones, linux-arm-kernel@lists.infradead.org

>>>>> "Yang," == Yang, Wenyou <Wenyou.Yang-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org> writes:

Hi,

>> > The MFD sub device is registered as a platform device, the existing  > act8865
 >> driver is registered as an i2c_driver. How do they match? :)
 >> 
 >> > Could you point out which exiting driver for me to reference.  Thank you!
 >> 
 >> What I'm saying is that it isn't nice that we end up with both act8865-regulator.c
 >> and act8954-regulator.c doing 95% the same. This can either be fixed by:
 >> 
 >> - Adding act8865 support to your mfd driver (but only registering the
 >> regulator subdev for act8865) and changing the existing
 >> act8865-regulator driver to work as a mfd subdev (platform device)
 >> 
 >> - Extending the act8865-regulator driver to register as a platform
 >> driver in ADDITION to a i2c driver so it can be used with mfd. The
 >> driver already uses regmap so it should only be a matter of adding the
 >> pdev probe/remove functions.

 > After think twice, I think this will complicates the act8865-regulator driver.

I don't think it will add a lot of complication (E.G. basically just the
platform probe/remove functions), but Ok - I'll wait and see your
simplified driver.

-- 
Venlig hilsen,
Peter Korsgaard 
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 35+ messages in thread

* [PATCH v2 1/2] regulator: act8945a: add regulator driver for ACT8945A
@ 2016-01-20  7:41                 ` Peter Korsgaard
  0 siblings, 0 replies; 35+ messages in thread
From: Peter Korsgaard @ 2016-01-20  7:41 UTC (permalink / raw)
  To: linux-arm-kernel

>>>>> "Yang," == Yang, Wenyou <Wenyou.Yang@atmel.com> writes:

Hi,

>> > The MFD sub device is registered as a platform device, the existing  > act8865
 >> driver is registered as an i2c_driver. How do they match? :)
 >> 
 >> > Could you point out which exiting driver for me to reference.  Thank you!
 >> 
 >> What I'm saying is that it isn't nice that we end up with both act8865-regulator.c
 >> and act8954-regulator.c doing 95% the same. This can either be fixed by:
 >> 
 >> - Adding act8865 support to your mfd driver (but only registering the
 >> regulator subdev for act8865) and changing the existing
 >> act8865-regulator driver to work as a mfd subdev (platform device)
 >> 
 >> - Extending the act8865-regulator driver to register as a platform
 >> driver in ADDITION to a i2c driver so it can be used with mfd. The
 >> driver already uses regmap so it should only be a matter of adding the
 >> pdev probe/remove functions.

 > After think twice, I think this will complicates the act8865-regulator driver.

I don't think it will add a lot of complication (E.G. basically just the
platform probe/remove functions), but Ok - I'll wait and see your
simplified driver.

-- 
Venlig hilsen,
Peter Korsgaard 

^ permalink raw reply	[flat|nested] 35+ messages in thread

end of thread, other threads:[~2016-01-20  7:42 UTC | newest]

Thread overview: 35+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-12  8:17 [PATCH v2 0/2] regulator: act8945a: add regulator driver for the sub-device of ACT8945A MFD Wenyou Yang
2016-01-12  8:17 ` Wenyou Yang
2016-01-12  8:17 ` Wenyou Yang
2016-01-12  8:17 ` [PATCH v2 1/2] regulator: act8945a: add regulator driver for ACT8945A Wenyou Yang
2016-01-12  8:17   ` Wenyou Yang
2016-01-12  8:17   ` Wenyou Yang
2016-01-13 14:22   ` Peter Korsgaard
2016-01-13 14:22     ` Peter Korsgaard
2016-01-14  1:23     ` Yang, Wenyou
2016-01-14  1:23       ` Yang, Wenyou
2016-01-14  1:23       ` Yang, Wenyou
2016-01-14  6:19       ` Lee Jones
2016-01-14  6:19         ` Lee Jones
2016-01-14  6:19         ` Lee Jones
2016-01-14  7:27       ` Peter Korsgaard
2016-01-14  7:27         ` Peter Korsgaard
2016-01-14  7:27         ` Peter Korsgaard
2016-01-14  8:07         ` Yang, Wenyou
2016-01-14  8:07           ` Yang, Wenyou
2016-01-14  8:07           ` Yang, Wenyou
2016-01-14 11:43           ` Peter Korsgaard
2016-01-14 11:43             ` Peter Korsgaard
2016-01-14 11:43             ` Peter Korsgaard
2016-01-14 12:46             ` Yang, Wenyou
2016-01-14 12:46               ` Yang, Wenyou
2016-01-14 12:46               ` Yang, Wenyou
2016-01-20  7:37             ` Yang, Wenyou
2016-01-20  7:37               ` Yang, Wenyou
2016-01-20  7:37               ` Yang, Wenyou
2016-01-20  7:41               ` Peter Korsgaard
2016-01-20  7:41                 ` Peter Korsgaard
2016-01-20  7:41                 ` Peter Korsgaard
2016-01-12  8:17 ` [PATCH v2 2/2] regulator: add documentation for ACT8945A's regulator DT bindings Wenyou Yang
2016-01-12  8:17   ` Wenyou Yang
2016-01-12  8:17   ` Wenyou Yang

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.