All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/2] regulator: mt6360: Add support for MT6360 regulator
@ 2020-08-20  7:53 ` Gene Chen
  0 siblings, 0 replies; 51+ messages in thread
From: Gene Chen @ 2020-08-20  7:53 UTC (permalink / raw)
  To: matthias.bgg, robh+dt
  Cc: lgirdwood, broonie, linux-kernel, devicetree, linux-arm-kernel,
	linux-mediatek

This patch series add MT6360 regulator support contains driver and binding document

Gene Chen (2)
  regulator: mt6360: Add support for MT6360 regulator
  regulator: mt6360: Add DT binding documentation

 Documentation/devicetree/bindings/regulator/mt6360-regulator.yaml |  109 ++
 drivers/regulator/Kconfig                                         |    9 
 drivers/regulator/Makefile                                        |    1 
 drivers/regulator/mt6360-regulator.c                              |  458 ++++++++++
 include/dt-bindings/regulator/mediatek,mt6360-regulator.h         |   16 
 5 files changed, 593 insertions(+)

changelogs between v1 & v2
 - regulator: merge regmap to mfd driver for r/w with crc

changelogs between v2 & v3
 - Move regmap define to MFD parent driver
 - Add bindings document


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

* [PATCH v3 0/2] regulator: mt6360: Add support for MT6360 regulator
@ 2020-08-20  7:53 ` Gene Chen
  0 siblings, 0 replies; 51+ messages in thread
From: Gene Chen @ 2020-08-20  7:53 UTC (permalink / raw)
  To: matthias.bgg, robh+dt
  Cc: devicetree, lgirdwood, linux-kernel, broonie, linux-mediatek,
	linux-arm-kernel

This patch series add MT6360 regulator support contains driver and binding document

Gene Chen (2)
  regulator: mt6360: Add support for MT6360 regulator
  regulator: mt6360: Add DT binding documentation

 Documentation/devicetree/bindings/regulator/mt6360-regulator.yaml |  109 ++
 drivers/regulator/Kconfig                                         |    9 
 drivers/regulator/Makefile                                        |    1 
 drivers/regulator/mt6360-regulator.c                              |  458 ++++++++++
 include/dt-bindings/regulator/mediatek,mt6360-regulator.h         |   16 
 5 files changed, 593 insertions(+)

changelogs between v1 & v2
 - regulator: merge regmap to mfd driver for r/w with crc

changelogs between v2 & v3
 - Move regmap define to MFD parent driver
 - Add bindings document


_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

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

* [PATCH v3 0/2] regulator: mt6360: Add support for MT6360 regulator
@ 2020-08-20  7:53 ` Gene Chen
  0 siblings, 0 replies; 51+ messages in thread
From: Gene Chen @ 2020-08-20  7:53 UTC (permalink / raw)
  To: matthias.bgg, robh+dt
  Cc: devicetree, lgirdwood, linux-kernel, broonie, linux-mediatek,
	linux-arm-kernel

This patch series add MT6360 regulator support contains driver and binding document

Gene Chen (2)
  regulator: mt6360: Add support for MT6360 regulator
  regulator: mt6360: Add DT binding documentation

 Documentation/devicetree/bindings/regulator/mt6360-regulator.yaml |  109 ++
 drivers/regulator/Kconfig                                         |    9 
 drivers/regulator/Makefile                                        |    1 
 drivers/regulator/mt6360-regulator.c                              |  458 ++++++++++
 include/dt-bindings/regulator/mediatek,mt6360-regulator.h         |   16 
 5 files changed, 593 insertions(+)

changelogs between v1 & v2
 - regulator: merge regmap to mfd driver for r/w with crc

changelogs between v2 & v3
 - Move regmap define to MFD parent driver
 - Add bindings document


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v3 1/2] regulator: mt6360: Add support for MT6360 regulator
  2020-08-20  7:53 ` Gene Chen
  (?)
@ 2020-08-20  7:53   ` Gene Chen
  -1 siblings, 0 replies; 51+ messages in thread
From: Gene Chen @ 2020-08-20  7:53 UTC (permalink / raw)
  To: matthias.bgg, robh+dt
  Cc: lgirdwood, broonie, linux-kernel, devicetree, linux-arm-kernel,
	linux-mediatek, Gene Chen

From: Gene Chen <gene_chen@richtek.com>

Add MT6360 regulator driver that contains two BUCKs and six LDOs

Signed-off-by: Gene Chen <gene_chen@richtek.com>
---
 drivers/regulator/Kconfig                          |   9 +
 drivers/regulator/Makefile                         |   1 +
 drivers/regulator/mt6360-regulator.c               | 458 +++++++++++++++++++++
 .../regulator/mediatek,mt6360-regulator.h          |  16 +
 4 files changed, 484 insertions(+)
 create mode 100644 drivers/regulator/mt6360-regulator.c
 create mode 100644 include/dt-bindings/regulator/mediatek,mt6360-regulator.h

diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig
index de17ef7..8a6c3c6 100644
--- a/drivers/regulator/Kconfig
+++ b/drivers/regulator/Kconfig
@@ -711,6 +711,15 @@ config REGULATOR_MT6358
 	  This driver supports the control of different power rails of device
 	  through regulator interface.
 
+config REGULATOR_MT6360
+	tristate "MT6360 SubPMIC Regulator"
+	depends on MFD_MT6360
+	help
+	  Say Y here to enable MT6360 regulator support.
+	  This is support MT6360 PMIC/LDO part include
+	  2-channel buck with Thermal Shutdown and Overload Protection
+	  6-channel High PSRR and Low Dropout LDO.
+
 config REGULATOR_MT6380
 	tristate "MediaTek MT6380 PMIC"
 	depends on MTK_PMIC_WRAP
diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile
index d8d3ecf..821a33f 100644
--- a/drivers/regulator/Makefile
+++ b/drivers/regulator/Makefile
@@ -88,6 +88,7 @@ obj-$(CONFIG_REGULATOR_MPQ7920) += mpq7920.o
 obj-$(CONFIG_REGULATOR_MT6311) += mt6311-regulator.o
 obj-$(CONFIG_REGULATOR_MT6323)	+= mt6323-regulator.o
 obj-$(CONFIG_REGULATOR_MT6358)	+= mt6358-regulator.o
+obj-$(CONFIG_REGULATOR_MT6360) += mt6360-regulator.o
 obj-$(CONFIG_REGULATOR_MT6380)	+= mt6380-regulator.o
 obj-$(CONFIG_REGULATOR_MT6397)	+= mt6397-regulator.o
 obj-$(CONFIG_REGULATOR_QCOM_LABIBB) += qcom-labibb-regulator.o
diff --git a/drivers/regulator/mt6360-regulator.c b/drivers/regulator/mt6360-regulator.c
new file mode 100644
index 0000000..f01d1cc
--- /dev/null
+++ b/drivers/regulator/mt6360-regulator.c
@@ -0,0 +1,458 @@
+// SPDX-License-Identifier: GPL-2.0-only
+//
+// Copyright (C) 2020 MediaTek Inc.
+//
+// Author: Gene Chen <gene_chen@richtek.com>
+
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
+#include <linux/regmap.h>
+#include <linux/regulator/driver.h>
+#include <linux/regulator/machine.h>
+
+#include <dt-bindings/regulator/mediatek,mt6360-regulator.h>
+
+enum {
+	MT6360_REGULATOR_BUCK1 = 0,
+	MT6360_REGULATOR_BUCK2,
+	MT6360_REGULATOR_LDO6,
+	MT6360_REGULATOR_LDO7,
+	MT6360_REGULATOR_LDO1,
+	MT6360_REGULATOR_LDO2,
+	MT6360_REGULATOR_LDO3,
+	MT6360_REGULATOR_LDO5,
+	MT6360_REGULATOR_MAX,
+};
+
+struct mt6360_irq_mapping {
+	const char *name;
+	irq_handler_t handler;
+};
+
+struct mt6360_regulator_desc {
+	const struct regulator_desc desc;
+	unsigned int mode_reg;
+	unsigned int mode_mask;
+	unsigned int state_reg;
+	unsigned int state_mask;
+	const struct mt6360_irq_mapping *irq_tables;
+	int irq_table_size;
+};
+
+struct mt6360_regulator_data {
+	struct device *dev;
+	struct regmap *regmap;
+};
+
+static irqreturn_t mt6360_pgb_event_handler(int irq, void *data)
+{
+	struct regulator_dev *rdev = data;
+
+	regulator_notifier_call_chain(rdev, REGULATOR_EVENT_FAIL, NULL);
+	return IRQ_HANDLED;
+}
+
+static irqreturn_t mt6360_oc_event_handler(int irq, void *data)
+{
+	struct regulator_dev *rdev = data;
+
+	regulator_notifier_call_chain(rdev, REGULATOR_EVENT_OVER_CURRENT, NULL);
+	return IRQ_HANDLED;
+}
+
+static irqreturn_t mt6360_ov_event_handler(int irq, void *data)
+{
+	struct regulator_dev *rdev = data;
+
+	regulator_notifier_call_chain(rdev, REGULATOR_EVENT_REGULATION_OUT, NULL);
+	return IRQ_HANDLED;
+}
+
+static irqreturn_t mt6360_uv_event_handler(int irq, void *data)
+{
+	struct regulator_dev *rdev = data;
+
+	regulator_notifier_call_chain(rdev, REGULATOR_EVENT_UNDER_VOLTAGE, NULL);
+	return IRQ_HANDLED;
+}
+
+static const struct mt6360_irq_mapping buck1_irq_tbls[] = {
+	{ "buck1_pgb_evt", mt6360_pgb_event_handler },
+	{ "buck1_oc_evt", mt6360_oc_event_handler },
+	{ "buck1_ov_evt", mt6360_ov_event_handler },
+	{ "buck1_uv_evt", mt6360_uv_event_handler },
+};
+
+static const struct mt6360_irq_mapping buck2_irq_tbls[] = {
+	{ "buck2_pgb_evt", mt6360_pgb_event_handler },
+	{ "buck2_oc_evt", mt6360_oc_event_handler },
+	{ "buck2_ov_evt", mt6360_ov_event_handler },
+	{ "buck2_uv_evt", mt6360_uv_event_handler },
+};
+
+static const struct mt6360_irq_mapping ldo6_irq_tbls[] = {
+	{ "ldo6_pgb_evt", mt6360_pgb_event_handler },
+	{ "ldo6_oc_evt", mt6360_oc_event_handler },
+};
+
+static const struct mt6360_irq_mapping ldo7_irq_tbls[] = {
+	{ "ldo7_pgb_evt", mt6360_pgb_event_handler },
+	{ "ldo7_oc_evt", mt6360_oc_event_handler },
+};
+
+static const struct mt6360_irq_mapping ldo1_irq_tbls[] = {
+	{ "ldo1_pgb_evt", mt6360_pgb_event_handler },
+	{ "ldo1_oc_evt", mt6360_oc_event_handler },
+};
+
+static const struct mt6360_irq_mapping ldo2_irq_tbls[] = {
+	{ "ldo2_pgb_evt", mt6360_pgb_event_handler },
+	{ "ldo2_oc_evt", mt6360_oc_event_handler },
+};
+
+static const struct mt6360_irq_mapping ldo3_irq_tbls[] = {
+	{ "ldo3_pgb_evt", mt6360_pgb_event_handler },
+	{ "ldo3_oc_evt", mt6360_oc_event_handler },
+};
+
+static const struct mt6360_irq_mapping ldo5_irq_tbls[] = {
+	{ "ldo5_pgb_evt", mt6360_pgb_event_handler },
+	{ "ldo5_oc_evt", mt6360_oc_event_handler },
+};
+
+static const struct linear_range buck_vout_ranges[] = {
+	REGULATOR_LINEAR_RANGE(300000, 0x00, 0xc7, 5000),
+	REGULATOR_LINEAR_RANGE(1300000, 0xc8, 0xff, 0),
+};
+
+static const struct linear_range ldo_vout_ranges1[] = {
+	REGULATOR_LINEAR_RANGE(500000, 0x00, 0x09, 10000),
+	REGULATOR_LINEAR_RANGE(600000, 0x0a, 0x10, 0),
+	REGULATOR_LINEAR_RANGE(610000, 0x11, 0x19, 10000),
+	REGULATOR_LINEAR_RANGE(700000, 0x1a, 0x20, 0),
+	REGULATOR_LINEAR_RANGE(710000, 0x21, 0x29, 10000),
+	REGULATOR_LINEAR_RANGE(800000, 0x2a, 0x30, 0),
+	REGULATOR_LINEAR_RANGE(810000, 0x31, 0x39, 10000),
+	REGULATOR_LINEAR_RANGE(900000, 0x3a, 0x40, 0),
+	REGULATOR_LINEAR_RANGE(910000, 0x41, 0x49, 10000),
+	REGULATOR_LINEAR_RANGE(1000000, 0x4a, 0x50, 0),
+	REGULATOR_LINEAR_RANGE(1010000, 0x51, 0x59, 10000),
+	REGULATOR_LINEAR_RANGE(1100000, 0x5a, 0x60, 0),
+	REGULATOR_LINEAR_RANGE(1110000, 0x61, 0x69, 10000),
+	REGULATOR_LINEAR_RANGE(1200000, 0x6a, 0x70, 0),
+	REGULATOR_LINEAR_RANGE(1210000, 0x71, 0x79, 10000),
+	REGULATOR_LINEAR_RANGE(1300000, 0x7a, 0x80, 0),
+	REGULATOR_LINEAR_RANGE(1310000, 0x81, 0x89, 10000),
+	REGULATOR_LINEAR_RANGE(1400000, 0x8a, 0x90, 0),
+	REGULATOR_LINEAR_RANGE(1410000, 0x91, 0x99, 10000),
+	REGULATOR_LINEAR_RANGE(1500000, 0x9a, 0xa0, 0),
+	REGULATOR_LINEAR_RANGE(1510000, 0xa1, 0xa9, 10000),
+	REGULATOR_LINEAR_RANGE(1600000, 0xaa, 0xb0, 0),
+	REGULATOR_LINEAR_RANGE(1610000, 0xb1, 0xb9, 10000),
+	REGULATOR_LINEAR_RANGE(1700000, 0xba, 0xc0, 0),
+	REGULATOR_LINEAR_RANGE(1710000, 0xc1, 0xc9, 10000),
+	REGULATOR_LINEAR_RANGE(1800000, 0xca, 0xd0, 0),
+	REGULATOR_LINEAR_RANGE(1810000, 0xd1, 0xd9, 10000),
+	REGULATOR_LINEAR_RANGE(1900000, 0xda, 0xe0, 0),
+	REGULATOR_LINEAR_RANGE(1910000, 0xe1, 0xe9, 10000),
+	REGULATOR_LINEAR_RANGE(2000000, 0xea, 0xf0, 0),
+	REGULATOR_LINEAR_RANGE(2010000, 0xf1, 0xf9, 10000),
+	REGULATOR_LINEAR_RANGE(2100000, 0xfa, 0xff, 0),
+};
+
+static const struct linear_range ldo_vout_ranges2[] = {
+	REGULATOR_LINEAR_RANGE(1200000, 0x00, 0x09, 10000),
+	REGULATOR_LINEAR_RANGE(1300000, 0x0a, 0x10, 0),
+	REGULATOR_LINEAR_RANGE(1310000, 0x11, 0x19, 10000),
+	REGULATOR_LINEAR_RANGE(1400000, 0x1a, 0x1f, 0),
+	REGULATOR_LINEAR_RANGE(1500000, 0x20, 0x29, 10000),
+	REGULATOR_LINEAR_RANGE(1600000, 0x2a, 0x2f, 0),
+	REGULATOR_LINEAR_RANGE(1700000, 0x30, 0x39, 10000),
+	REGULATOR_LINEAR_RANGE(1800000, 0x3a, 0x40, 0),
+	REGULATOR_LINEAR_RANGE(1810000, 0x41, 0x49, 10000),
+	REGULATOR_LINEAR_RANGE(1900000, 0x4a, 0x4f, 0),
+	REGULATOR_LINEAR_RANGE(2000000, 0x50, 0x59, 10000),
+	REGULATOR_LINEAR_RANGE(2100000, 0x5a, 0x60, 0),
+	REGULATOR_LINEAR_RANGE(2110000, 0x61, 0x69, 10000),
+	REGULATOR_LINEAR_RANGE(2200000, 0x6a, 0x6f, 0),
+	REGULATOR_LINEAR_RANGE(2500000, 0x70, 0x79, 10000),
+	REGULATOR_LINEAR_RANGE(2600000, 0x7a, 0x7f, 0),
+	REGULATOR_LINEAR_RANGE(2700000, 0x80, 0x89, 10000),
+	REGULATOR_LINEAR_RANGE(2800000, 0x8a, 0x90, 0),
+	REGULATOR_LINEAR_RANGE(2810000, 0x91, 0x99, 10000),
+	REGULATOR_LINEAR_RANGE(2900000, 0x9a, 0xa0, 0),
+	REGULATOR_LINEAR_RANGE(2910000, 0xa1, 0xa9, 10000),
+	REGULATOR_LINEAR_RANGE(3000000, 0xaa, 0xb0, 0),
+	REGULATOR_LINEAR_RANGE(3010000, 0xb1, 0xb9, 10000),
+	REGULATOR_LINEAR_RANGE(3100000, 0xba, 0xc0, 0),
+	REGULATOR_LINEAR_RANGE(3110000, 0xc1, 0xc9, 10000),
+	REGULATOR_LINEAR_RANGE(3200000, 0xca, 0xcf, 0),
+	REGULATOR_LINEAR_RANGE(3300000, 0xd0, 0xd9, 10000),
+	REGULATOR_LINEAR_RANGE(3400000, 0xda, 0xe0, 0),
+	REGULATOR_LINEAR_RANGE(3410000, 0xe1, 0xe9, 10000),
+	REGULATOR_LINEAR_RANGE(3500000, 0xea, 0xf0, 0),
+	REGULATOR_LINEAR_RANGE(3510000, 0xf1, 0xf9, 10000),
+	REGULATOR_LINEAR_RANGE(3600000, 0xfa, 0xff, 0),
+};
+
+static const struct linear_range ldo_vout_ranges3[] = {
+	REGULATOR_LINEAR_RANGE(2700000, 0x00, 0x09, 10000),
+	REGULATOR_LINEAR_RANGE(2800000, 0x0a, 0x10, 0),
+	REGULATOR_LINEAR_RANGE(2810000, 0x11, 0x19, 10000),
+	REGULATOR_LINEAR_RANGE(2900000, 0x1a, 0x20, 0),
+	REGULATOR_LINEAR_RANGE(2910000, 0x21, 0x29, 10000),
+	REGULATOR_LINEAR_RANGE(3000000, 0x2a, 0x30, 0),
+	REGULATOR_LINEAR_RANGE(3010000, 0x31, 0x39, 10000),
+	REGULATOR_LINEAR_RANGE(3100000, 0x3a, 0x40, 0),
+	REGULATOR_LINEAR_RANGE(3110000, 0x41, 0x49, 10000),
+	REGULATOR_LINEAR_RANGE(3200000, 0x4a, 0x4f, 0),
+	REGULATOR_LINEAR_RANGE(3300000, 0x50, 0x59, 10000),
+	REGULATOR_LINEAR_RANGE(3400000, 0x5a, 0x60, 0),
+	REGULATOR_LINEAR_RANGE(3410000, 0x61, 0x69, 10000),
+	REGULATOR_LINEAR_RANGE(3500000, 0x6a, 0x70, 0),
+	REGULATOR_LINEAR_RANGE(3510000, 0x71, 0x79, 10000),
+	REGULATOR_LINEAR_RANGE(3600000, 0x7a, 0x7f, 0),
+};
+
+static int mt6360_regulator_set_mode(struct regulator_dev *rdev,
+				     unsigned int mode)
+{
+	const struct mt6360_regulator_desc *rdesc = (struct mt6360_regulator_desc *)rdev->desc;
+	struct regmap *regmap = rdev_get_regmap(rdev);
+	int shift = ffs(rdesc->mode_mask) - 1;
+	unsigned int val;
+	int ret;
+
+	switch (mode) {
+	case REGULATOR_MODE_NORMAL:
+		val = MT6360_OPMODE_NORMAL;
+		break;
+	case REGULATOR_MODE_STANDBY:
+		val = MT6360_OPMODE_ULP;
+		break;
+	case REGULATOR_MODE_IDLE:
+		val = MT6360_OPMODE_LP;
+		break;
+	default:
+		return -EINVAL;
+	}
+
+	ret = regmap_update_bits(regmap, rdesc->mode_reg, rdesc->mode_mask, val << shift);
+	if (ret) {
+		dev_err(&rdev->dev, "%s: fail (%d)\n", __func__, ret);
+		return ret;
+	}
+
+	return 0;
+}
+
+static unsigned int mt6360_regulator_get_mode(struct regulator_dev *rdev)
+{
+	const struct mt6360_regulator_desc *rdesc = (struct mt6360_regulator_desc *)rdev->desc;
+	struct regmap *regmap = rdev_get_regmap(rdev);
+	int shift = ffs(rdesc->mode_mask) - 1;
+	unsigned int val;
+	int ret;
+
+	ret = regmap_read(regmap, rdesc->mode_reg, &val);
+	if (ret)
+		return ret;
+
+	val &= rdesc->mode_mask;
+	val >>= shift;
+
+	switch (val) {
+	case MT6360_OPMODE_LP:
+		return REGULATOR_MODE_IDLE;
+	case MT6360_OPMODE_ULP:
+		return REGULATOR_MODE_STANDBY;
+	case MT6360_OPMODE_NORMAL:
+		return REGULATOR_MODE_NORMAL;
+	default:
+		return -EINVAL;
+	}
+}
+
+static int mt6360_regulator_get_status(struct regulator_dev *rdev)
+{
+	const struct mt6360_regulator_desc *rdesc = (struct mt6360_regulator_desc *)rdev->desc;
+	struct regmap *regmap = rdev_get_regmap(rdev);
+	unsigned int val;
+	int ret;
+
+	ret = regmap_read(regmap, rdesc->state_reg, &val);
+	if (ret)
+		return ret;
+
+	if (val & rdesc->state_mask)
+		return REGULATOR_STATUS_ON;
+
+	return REGULATOR_STATUS_OFF;
+}
+
+static const struct regulator_ops mt6360_regulator_ops = {
+	.list_voltage = regulator_list_voltage_linear_range,
+	.enable = regulator_enable_regmap,
+	.disable = regulator_disable_regmap,
+	.is_enabled = regulator_is_enabled_regmap,
+	.set_voltage_sel = regulator_set_voltage_sel_regmap,
+	.get_voltage_sel = regulator_get_voltage_sel_regmap,
+	.set_mode = mt6360_regulator_set_mode,
+	.get_mode = mt6360_regulator_get_mode,
+	.get_status = mt6360_regulator_get_status,
+};
+
+static unsigned int mt6360_regulator_of_map_mode(unsigned int hw_mode)
+{
+	switch (hw_mode) {
+	case MT6360_OPMODE_NORMAL:
+		return REGULATOR_MODE_NORMAL;
+	case MT6360_OPMODE_LP:
+		return REGULATOR_MODE_IDLE;
+	case MT6360_OPMODE_ULP:
+		return REGULATOR_MODE_STANDBY;
+	default:
+		return REGULATOR_MODE_INVALID;
+	}
+}
+
+#define MT6360_REGULATOR_DESC(_name, _sname, ereg, emask, vreg,	vmask,	\
+			      mreg, mmask, streg, stmask, vranges,	\
+			      vcnts, offon_delay, irq_tbls)		\
+{									\
+	.desc = {							\
+		.name = #_name,						\
+		.supply_name = #_sname,					\
+		.id =  MT6360_REGULATOR_##_name,			\
+		.of_match = of_match_ptr(#_name),			\
+		.of_map_mode = mt6360_regulator_of_map_mode,		\
+		.owner = THIS_MODULE,					\
+		.ops = &mt6360_regulator_ops,				\
+		.type = REGULATOR_VOLTAGE,				\
+		.vsel_reg = vreg,					\
+		.vsel_mask = vmask,					\
+		.enable_reg = ereg,					\
+		.enable_mask = emask,					\
+		.linear_ranges = vranges,				\
+		.n_linear_ranges = ARRAY_SIZE(vranges),			\
+		.n_voltages = vcnts,					\
+		.off_on_delay = offon_delay,				\
+	},								\
+	.mode_reg = mreg,						\
+	.mode_mask = mmask,						\
+	.state_reg = streg,						\
+	.state_mask = stmask,						\
+	.irq_tables = irq_tbls,						\
+	.irq_table_size = ARRAY_SIZE(irq_tbls),				\
+}
+
+static const struct mt6360_regulator_desc mt6360_regulator_descs[] =  {
+	MT6360_REGULATOR_DESC(BUCK1, BUCK1_VIN, 0x117, 0x40, 0x110, 0xff, 0x117, 0x30, 0x117, 0x04,
+			      buck_vout_ranges, 256, 0, buck1_irq_tbls),
+	MT6360_REGULATOR_DESC(BUCK2, BUCK2_VIN, 0x127, 0x40, 0x120, 0xff, 0x127, 0x30, 0x127, 0x04,
+			      buck_vout_ranges, 256, 0, buck2_irq_tbls),
+	MT6360_REGULATOR_DESC(LDO6, LDO_VIN3, 0x137, 0x40, 0x13B, 0xff, 0x137, 0x30, 0x137, 0x04,
+			      ldo_vout_ranges1, 256, 0, ldo6_irq_tbls),
+	MT6360_REGULATOR_DESC(LDO7, LDO_VIN3, 0x131, 0x40, 0x135, 0xff, 0x131, 0x30, 0x131, 0x04,
+			      ldo_vout_ranges1, 256, 0, ldo7_irq_tbls),
+	MT6360_REGULATOR_DESC(LDO1, LDO_VIN1, 0x217, 0x40, 0x21B, 0xff, 0x217, 0x30, 0x217, 0x04,
+			      ldo_vout_ranges2, 256, 0, ldo1_irq_tbls),
+	MT6360_REGULATOR_DESC(LDO2, LDO_VIN1, 0x211, 0x40, 0x215, 0xff, 0x211, 0x30, 0x211, 0x04,
+			      ldo_vout_ranges2, 256, 0, ldo2_irq_tbls),
+	MT6360_REGULATOR_DESC(LDO3, LDO_VIN1, 0x205, 0x40, 0x209, 0xff, 0x205, 0x30, 0x205, 0x04,
+			      ldo_vout_ranges2, 256, 100, ldo3_irq_tbls),
+	MT6360_REGULATOR_DESC(LDO5, LDO_VIN2, 0x20B, 0x40, 0x20F, 0x7f, 0x20B, 0x30, 0x20B, 0x04,
+			      ldo_vout_ranges3, 128, 100, ldo5_irq_tbls),
+};
+
+static int mt6360_regulator_irq_register(struct platform_device *pdev,
+					 struct regulator_dev *rdev,
+					 const struct mt6360_irq_mapping *tbls,
+					 int tbl_size)
+{
+	int i, irq, ret;
+
+	for (i = 0; i < tbl_size; i++) {
+		const struct mt6360_irq_mapping *irq_desc = tbls + i;
+
+		irq = platform_get_irq_byname(pdev, irq_desc->name);
+		if (irq < 0) {
+			dev_err(&pdev->dev, "Fail to get %s irq\n", irq_desc->name);
+			return irq;
+		}
+
+		ret = devm_request_threaded_irq(&pdev->dev, irq, NULL, irq_desc->handler, 0,
+						irq_desc->name, rdev);
+		if (ret) {
+			dev_err(&pdev->dev, "Fail to request %s irq\n", irq_desc->name);
+			return ret;
+		}
+	}
+
+	return 0;
+}
+
+static int mt6360_regulator_probe(struct platform_device *pdev)
+{
+	struct mt6360_regulator_data *mrd;
+	struct regulator_config config = {};
+	int i, ret;
+
+	mrd = devm_kzalloc(&pdev->dev, sizeof(*mrd), GFP_KERNEL);
+	if (!mrd)
+		return -ENOMEM;
+
+	mrd->dev = &pdev->dev;
+
+	mrd->regmap = dev_get_regmap(pdev->dev.parent, NULL);
+	if (!mrd->regmap) {
+		dev_err(&pdev->dev, "Failed to get parent regmap\n");
+		return -ENODEV;
+	}
+
+	config.dev = &pdev->dev;
+	config.driver_data = mrd;
+	config.regmap = mrd->regmap;
+
+	for (i = 0; i < ARRAY_SIZE(mt6360_regulator_descs); i++) {
+		const struct mt6360_regulator_desc *rdesc = mt6360_regulator_descs + i;
+		struct regulator_dev *rdev;
+
+		rdev = devm_regulator_register(&pdev->dev, &rdesc->desc, &config);
+		if (IS_ERR(rdev)) {
+			dev_err(&pdev->dev, "Failed to register  %d regulaotr\n", i);
+			return PTR_ERR(rdev);
+		}
+
+		ret = mt6360_regulator_irq_register(pdev, rdev, rdesc->irq_tables,
+						    rdesc->irq_table_size);
+		if (ret) {
+			dev_err(&pdev->dev, "Failed to register  %d regulaotr irqs\n", i);
+			return ret;
+		}
+	}
+
+	return 0;
+}
+
+static const struct of_device_id __maybe_unused mt6360_regulator_of_id[] = {
+	{ .compatible = "mediatek,mt6360-regulator", },
+	{},
+};
+MODULE_DEVICE_TABLE(of, mt6360_regulator_of_id);
+
+static struct platform_driver mt6360_regulator_driver = {
+	.driver = {
+		.name = "mt6360-regulator",
+		.of_match_table = mt6360_regulator_of_id,
+	},
+	.probe = mt6360_regulator_probe,
+};
+module_platform_driver(mt6360_regulator_driver);
+
+MODULE_AUTHOR("Gene Chen <gene_chen@richtek.com>");
+MODULE_DESCRIPTION("MT6360 Regulator Driver");
+MODULE_LICENSE("GPL v2");
diff --git a/include/dt-bindings/regulator/mediatek,mt6360-regulator.h b/include/dt-bindings/regulator/mediatek,mt6360-regulator.h
new file mode 100644
index 0000000..21c75de
--- /dev/null
+++ b/include/dt-bindings/regulator/mediatek,mt6360-regulator.h
@@ -0,0 +1,16 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+#ifndef __DT_BINDINGS_MEDIATEK_MT6360_REGULATOR_H__
+#define __DT_BINDINGS_MEDIATEK_MT6360_REGULATOR_H__
+
+/*
+ * BUCK/LDO mode constants which may be used in devicetree properties
+ * (eg. regulator-allowed-modes).
+ * See the manufacturer's datasheet for more information on these modes.
+ */
+
+#define MT6360_OPMODE_LP		2
+#define MT6360_OPMODE_ULP		3
+#define MT6360_OPMODE_NORMAL		0
+
+#endif
-- 
2.7.4


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

* [PATCH v3 1/2] regulator: mt6360: Add support for MT6360 regulator
@ 2020-08-20  7:53   ` Gene Chen
  0 siblings, 0 replies; 51+ messages in thread
From: Gene Chen @ 2020-08-20  7:53 UTC (permalink / raw)
  To: matthias.bgg, robh+dt
  Cc: Gene Chen, devicetree, lgirdwood, linux-kernel, broonie,
	linux-mediatek, linux-arm-kernel

From: Gene Chen <gene_chen@richtek.com>

Add MT6360 regulator driver that contains two BUCKs and six LDOs

Signed-off-by: Gene Chen <gene_chen@richtek.com>
---
 drivers/regulator/Kconfig                          |   9 +
 drivers/regulator/Makefile                         |   1 +
 drivers/regulator/mt6360-regulator.c               | 458 +++++++++++++++++++++
 .../regulator/mediatek,mt6360-regulator.h          |  16 +
 4 files changed, 484 insertions(+)
 create mode 100644 drivers/regulator/mt6360-regulator.c
 create mode 100644 include/dt-bindings/regulator/mediatek,mt6360-regulator.h

diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig
index de17ef7..8a6c3c6 100644
--- a/drivers/regulator/Kconfig
+++ b/drivers/regulator/Kconfig
@@ -711,6 +711,15 @@ config REGULATOR_MT6358
 	  This driver supports the control of different power rails of device
 	  through regulator interface.
 
+config REGULATOR_MT6360
+	tristate "MT6360 SubPMIC Regulator"
+	depends on MFD_MT6360
+	help
+	  Say Y here to enable MT6360 regulator support.
+	  This is support MT6360 PMIC/LDO part include
+	  2-channel buck with Thermal Shutdown and Overload Protection
+	  6-channel High PSRR and Low Dropout LDO.
+
 config REGULATOR_MT6380
 	tristate "MediaTek MT6380 PMIC"
 	depends on MTK_PMIC_WRAP
diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile
index d8d3ecf..821a33f 100644
--- a/drivers/regulator/Makefile
+++ b/drivers/regulator/Makefile
@@ -88,6 +88,7 @@ obj-$(CONFIG_REGULATOR_MPQ7920) += mpq7920.o
 obj-$(CONFIG_REGULATOR_MT6311) += mt6311-regulator.o
 obj-$(CONFIG_REGULATOR_MT6323)	+= mt6323-regulator.o
 obj-$(CONFIG_REGULATOR_MT6358)	+= mt6358-regulator.o
+obj-$(CONFIG_REGULATOR_MT6360) += mt6360-regulator.o
 obj-$(CONFIG_REGULATOR_MT6380)	+= mt6380-regulator.o
 obj-$(CONFIG_REGULATOR_MT6397)	+= mt6397-regulator.o
 obj-$(CONFIG_REGULATOR_QCOM_LABIBB) += qcom-labibb-regulator.o
diff --git a/drivers/regulator/mt6360-regulator.c b/drivers/regulator/mt6360-regulator.c
new file mode 100644
index 0000000..f01d1cc
--- /dev/null
+++ b/drivers/regulator/mt6360-regulator.c
@@ -0,0 +1,458 @@
+// SPDX-License-Identifier: GPL-2.0-only
+//
+// Copyright (C) 2020 MediaTek Inc.
+//
+// Author: Gene Chen <gene_chen@richtek.com>
+
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
+#include <linux/regmap.h>
+#include <linux/regulator/driver.h>
+#include <linux/regulator/machine.h>
+
+#include <dt-bindings/regulator/mediatek,mt6360-regulator.h>
+
+enum {
+	MT6360_REGULATOR_BUCK1 = 0,
+	MT6360_REGULATOR_BUCK2,
+	MT6360_REGULATOR_LDO6,
+	MT6360_REGULATOR_LDO7,
+	MT6360_REGULATOR_LDO1,
+	MT6360_REGULATOR_LDO2,
+	MT6360_REGULATOR_LDO3,
+	MT6360_REGULATOR_LDO5,
+	MT6360_REGULATOR_MAX,
+};
+
+struct mt6360_irq_mapping {
+	const char *name;
+	irq_handler_t handler;
+};
+
+struct mt6360_regulator_desc {
+	const struct regulator_desc desc;
+	unsigned int mode_reg;
+	unsigned int mode_mask;
+	unsigned int state_reg;
+	unsigned int state_mask;
+	const struct mt6360_irq_mapping *irq_tables;
+	int irq_table_size;
+};
+
+struct mt6360_regulator_data {
+	struct device *dev;
+	struct regmap *regmap;
+};
+
+static irqreturn_t mt6360_pgb_event_handler(int irq, void *data)
+{
+	struct regulator_dev *rdev = data;
+
+	regulator_notifier_call_chain(rdev, REGULATOR_EVENT_FAIL, NULL);
+	return IRQ_HANDLED;
+}
+
+static irqreturn_t mt6360_oc_event_handler(int irq, void *data)
+{
+	struct regulator_dev *rdev = data;
+
+	regulator_notifier_call_chain(rdev, REGULATOR_EVENT_OVER_CURRENT, NULL);
+	return IRQ_HANDLED;
+}
+
+static irqreturn_t mt6360_ov_event_handler(int irq, void *data)
+{
+	struct regulator_dev *rdev = data;
+
+	regulator_notifier_call_chain(rdev, REGULATOR_EVENT_REGULATION_OUT, NULL);
+	return IRQ_HANDLED;
+}
+
+static irqreturn_t mt6360_uv_event_handler(int irq, void *data)
+{
+	struct regulator_dev *rdev = data;
+
+	regulator_notifier_call_chain(rdev, REGULATOR_EVENT_UNDER_VOLTAGE, NULL);
+	return IRQ_HANDLED;
+}
+
+static const struct mt6360_irq_mapping buck1_irq_tbls[] = {
+	{ "buck1_pgb_evt", mt6360_pgb_event_handler },
+	{ "buck1_oc_evt", mt6360_oc_event_handler },
+	{ "buck1_ov_evt", mt6360_ov_event_handler },
+	{ "buck1_uv_evt", mt6360_uv_event_handler },
+};
+
+static const struct mt6360_irq_mapping buck2_irq_tbls[] = {
+	{ "buck2_pgb_evt", mt6360_pgb_event_handler },
+	{ "buck2_oc_evt", mt6360_oc_event_handler },
+	{ "buck2_ov_evt", mt6360_ov_event_handler },
+	{ "buck2_uv_evt", mt6360_uv_event_handler },
+};
+
+static const struct mt6360_irq_mapping ldo6_irq_tbls[] = {
+	{ "ldo6_pgb_evt", mt6360_pgb_event_handler },
+	{ "ldo6_oc_evt", mt6360_oc_event_handler },
+};
+
+static const struct mt6360_irq_mapping ldo7_irq_tbls[] = {
+	{ "ldo7_pgb_evt", mt6360_pgb_event_handler },
+	{ "ldo7_oc_evt", mt6360_oc_event_handler },
+};
+
+static const struct mt6360_irq_mapping ldo1_irq_tbls[] = {
+	{ "ldo1_pgb_evt", mt6360_pgb_event_handler },
+	{ "ldo1_oc_evt", mt6360_oc_event_handler },
+};
+
+static const struct mt6360_irq_mapping ldo2_irq_tbls[] = {
+	{ "ldo2_pgb_evt", mt6360_pgb_event_handler },
+	{ "ldo2_oc_evt", mt6360_oc_event_handler },
+};
+
+static const struct mt6360_irq_mapping ldo3_irq_tbls[] = {
+	{ "ldo3_pgb_evt", mt6360_pgb_event_handler },
+	{ "ldo3_oc_evt", mt6360_oc_event_handler },
+};
+
+static const struct mt6360_irq_mapping ldo5_irq_tbls[] = {
+	{ "ldo5_pgb_evt", mt6360_pgb_event_handler },
+	{ "ldo5_oc_evt", mt6360_oc_event_handler },
+};
+
+static const struct linear_range buck_vout_ranges[] = {
+	REGULATOR_LINEAR_RANGE(300000, 0x00, 0xc7, 5000),
+	REGULATOR_LINEAR_RANGE(1300000, 0xc8, 0xff, 0),
+};
+
+static const struct linear_range ldo_vout_ranges1[] = {
+	REGULATOR_LINEAR_RANGE(500000, 0x00, 0x09, 10000),
+	REGULATOR_LINEAR_RANGE(600000, 0x0a, 0x10, 0),
+	REGULATOR_LINEAR_RANGE(610000, 0x11, 0x19, 10000),
+	REGULATOR_LINEAR_RANGE(700000, 0x1a, 0x20, 0),
+	REGULATOR_LINEAR_RANGE(710000, 0x21, 0x29, 10000),
+	REGULATOR_LINEAR_RANGE(800000, 0x2a, 0x30, 0),
+	REGULATOR_LINEAR_RANGE(810000, 0x31, 0x39, 10000),
+	REGULATOR_LINEAR_RANGE(900000, 0x3a, 0x40, 0),
+	REGULATOR_LINEAR_RANGE(910000, 0x41, 0x49, 10000),
+	REGULATOR_LINEAR_RANGE(1000000, 0x4a, 0x50, 0),
+	REGULATOR_LINEAR_RANGE(1010000, 0x51, 0x59, 10000),
+	REGULATOR_LINEAR_RANGE(1100000, 0x5a, 0x60, 0),
+	REGULATOR_LINEAR_RANGE(1110000, 0x61, 0x69, 10000),
+	REGULATOR_LINEAR_RANGE(1200000, 0x6a, 0x70, 0),
+	REGULATOR_LINEAR_RANGE(1210000, 0x71, 0x79, 10000),
+	REGULATOR_LINEAR_RANGE(1300000, 0x7a, 0x80, 0),
+	REGULATOR_LINEAR_RANGE(1310000, 0x81, 0x89, 10000),
+	REGULATOR_LINEAR_RANGE(1400000, 0x8a, 0x90, 0),
+	REGULATOR_LINEAR_RANGE(1410000, 0x91, 0x99, 10000),
+	REGULATOR_LINEAR_RANGE(1500000, 0x9a, 0xa0, 0),
+	REGULATOR_LINEAR_RANGE(1510000, 0xa1, 0xa9, 10000),
+	REGULATOR_LINEAR_RANGE(1600000, 0xaa, 0xb0, 0),
+	REGULATOR_LINEAR_RANGE(1610000, 0xb1, 0xb9, 10000),
+	REGULATOR_LINEAR_RANGE(1700000, 0xba, 0xc0, 0),
+	REGULATOR_LINEAR_RANGE(1710000, 0xc1, 0xc9, 10000),
+	REGULATOR_LINEAR_RANGE(1800000, 0xca, 0xd0, 0),
+	REGULATOR_LINEAR_RANGE(1810000, 0xd1, 0xd9, 10000),
+	REGULATOR_LINEAR_RANGE(1900000, 0xda, 0xe0, 0),
+	REGULATOR_LINEAR_RANGE(1910000, 0xe1, 0xe9, 10000),
+	REGULATOR_LINEAR_RANGE(2000000, 0xea, 0xf0, 0),
+	REGULATOR_LINEAR_RANGE(2010000, 0xf1, 0xf9, 10000),
+	REGULATOR_LINEAR_RANGE(2100000, 0xfa, 0xff, 0),
+};
+
+static const struct linear_range ldo_vout_ranges2[] = {
+	REGULATOR_LINEAR_RANGE(1200000, 0x00, 0x09, 10000),
+	REGULATOR_LINEAR_RANGE(1300000, 0x0a, 0x10, 0),
+	REGULATOR_LINEAR_RANGE(1310000, 0x11, 0x19, 10000),
+	REGULATOR_LINEAR_RANGE(1400000, 0x1a, 0x1f, 0),
+	REGULATOR_LINEAR_RANGE(1500000, 0x20, 0x29, 10000),
+	REGULATOR_LINEAR_RANGE(1600000, 0x2a, 0x2f, 0),
+	REGULATOR_LINEAR_RANGE(1700000, 0x30, 0x39, 10000),
+	REGULATOR_LINEAR_RANGE(1800000, 0x3a, 0x40, 0),
+	REGULATOR_LINEAR_RANGE(1810000, 0x41, 0x49, 10000),
+	REGULATOR_LINEAR_RANGE(1900000, 0x4a, 0x4f, 0),
+	REGULATOR_LINEAR_RANGE(2000000, 0x50, 0x59, 10000),
+	REGULATOR_LINEAR_RANGE(2100000, 0x5a, 0x60, 0),
+	REGULATOR_LINEAR_RANGE(2110000, 0x61, 0x69, 10000),
+	REGULATOR_LINEAR_RANGE(2200000, 0x6a, 0x6f, 0),
+	REGULATOR_LINEAR_RANGE(2500000, 0x70, 0x79, 10000),
+	REGULATOR_LINEAR_RANGE(2600000, 0x7a, 0x7f, 0),
+	REGULATOR_LINEAR_RANGE(2700000, 0x80, 0x89, 10000),
+	REGULATOR_LINEAR_RANGE(2800000, 0x8a, 0x90, 0),
+	REGULATOR_LINEAR_RANGE(2810000, 0x91, 0x99, 10000),
+	REGULATOR_LINEAR_RANGE(2900000, 0x9a, 0xa0, 0),
+	REGULATOR_LINEAR_RANGE(2910000, 0xa1, 0xa9, 10000),
+	REGULATOR_LINEAR_RANGE(3000000, 0xaa, 0xb0, 0),
+	REGULATOR_LINEAR_RANGE(3010000, 0xb1, 0xb9, 10000),
+	REGULATOR_LINEAR_RANGE(3100000, 0xba, 0xc0, 0),
+	REGULATOR_LINEAR_RANGE(3110000, 0xc1, 0xc9, 10000),
+	REGULATOR_LINEAR_RANGE(3200000, 0xca, 0xcf, 0),
+	REGULATOR_LINEAR_RANGE(3300000, 0xd0, 0xd9, 10000),
+	REGULATOR_LINEAR_RANGE(3400000, 0xda, 0xe0, 0),
+	REGULATOR_LINEAR_RANGE(3410000, 0xe1, 0xe9, 10000),
+	REGULATOR_LINEAR_RANGE(3500000, 0xea, 0xf0, 0),
+	REGULATOR_LINEAR_RANGE(3510000, 0xf1, 0xf9, 10000),
+	REGULATOR_LINEAR_RANGE(3600000, 0xfa, 0xff, 0),
+};
+
+static const struct linear_range ldo_vout_ranges3[] = {
+	REGULATOR_LINEAR_RANGE(2700000, 0x00, 0x09, 10000),
+	REGULATOR_LINEAR_RANGE(2800000, 0x0a, 0x10, 0),
+	REGULATOR_LINEAR_RANGE(2810000, 0x11, 0x19, 10000),
+	REGULATOR_LINEAR_RANGE(2900000, 0x1a, 0x20, 0),
+	REGULATOR_LINEAR_RANGE(2910000, 0x21, 0x29, 10000),
+	REGULATOR_LINEAR_RANGE(3000000, 0x2a, 0x30, 0),
+	REGULATOR_LINEAR_RANGE(3010000, 0x31, 0x39, 10000),
+	REGULATOR_LINEAR_RANGE(3100000, 0x3a, 0x40, 0),
+	REGULATOR_LINEAR_RANGE(3110000, 0x41, 0x49, 10000),
+	REGULATOR_LINEAR_RANGE(3200000, 0x4a, 0x4f, 0),
+	REGULATOR_LINEAR_RANGE(3300000, 0x50, 0x59, 10000),
+	REGULATOR_LINEAR_RANGE(3400000, 0x5a, 0x60, 0),
+	REGULATOR_LINEAR_RANGE(3410000, 0x61, 0x69, 10000),
+	REGULATOR_LINEAR_RANGE(3500000, 0x6a, 0x70, 0),
+	REGULATOR_LINEAR_RANGE(3510000, 0x71, 0x79, 10000),
+	REGULATOR_LINEAR_RANGE(3600000, 0x7a, 0x7f, 0),
+};
+
+static int mt6360_regulator_set_mode(struct regulator_dev *rdev,
+				     unsigned int mode)
+{
+	const struct mt6360_regulator_desc *rdesc = (struct mt6360_regulator_desc *)rdev->desc;
+	struct regmap *regmap = rdev_get_regmap(rdev);
+	int shift = ffs(rdesc->mode_mask) - 1;
+	unsigned int val;
+	int ret;
+
+	switch (mode) {
+	case REGULATOR_MODE_NORMAL:
+		val = MT6360_OPMODE_NORMAL;
+		break;
+	case REGULATOR_MODE_STANDBY:
+		val = MT6360_OPMODE_ULP;
+		break;
+	case REGULATOR_MODE_IDLE:
+		val = MT6360_OPMODE_LP;
+		break;
+	default:
+		return -EINVAL;
+	}
+
+	ret = regmap_update_bits(regmap, rdesc->mode_reg, rdesc->mode_mask, val << shift);
+	if (ret) {
+		dev_err(&rdev->dev, "%s: fail (%d)\n", __func__, ret);
+		return ret;
+	}
+
+	return 0;
+}
+
+static unsigned int mt6360_regulator_get_mode(struct regulator_dev *rdev)
+{
+	const struct mt6360_regulator_desc *rdesc = (struct mt6360_regulator_desc *)rdev->desc;
+	struct regmap *regmap = rdev_get_regmap(rdev);
+	int shift = ffs(rdesc->mode_mask) - 1;
+	unsigned int val;
+	int ret;
+
+	ret = regmap_read(regmap, rdesc->mode_reg, &val);
+	if (ret)
+		return ret;
+
+	val &= rdesc->mode_mask;
+	val >>= shift;
+
+	switch (val) {
+	case MT6360_OPMODE_LP:
+		return REGULATOR_MODE_IDLE;
+	case MT6360_OPMODE_ULP:
+		return REGULATOR_MODE_STANDBY;
+	case MT6360_OPMODE_NORMAL:
+		return REGULATOR_MODE_NORMAL;
+	default:
+		return -EINVAL;
+	}
+}
+
+static int mt6360_regulator_get_status(struct regulator_dev *rdev)
+{
+	const struct mt6360_regulator_desc *rdesc = (struct mt6360_regulator_desc *)rdev->desc;
+	struct regmap *regmap = rdev_get_regmap(rdev);
+	unsigned int val;
+	int ret;
+
+	ret = regmap_read(regmap, rdesc->state_reg, &val);
+	if (ret)
+		return ret;
+
+	if (val & rdesc->state_mask)
+		return REGULATOR_STATUS_ON;
+
+	return REGULATOR_STATUS_OFF;
+}
+
+static const struct regulator_ops mt6360_regulator_ops = {
+	.list_voltage = regulator_list_voltage_linear_range,
+	.enable = regulator_enable_regmap,
+	.disable = regulator_disable_regmap,
+	.is_enabled = regulator_is_enabled_regmap,
+	.set_voltage_sel = regulator_set_voltage_sel_regmap,
+	.get_voltage_sel = regulator_get_voltage_sel_regmap,
+	.set_mode = mt6360_regulator_set_mode,
+	.get_mode = mt6360_regulator_get_mode,
+	.get_status = mt6360_regulator_get_status,
+};
+
+static unsigned int mt6360_regulator_of_map_mode(unsigned int hw_mode)
+{
+	switch (hw_mode) {
+	case MT6360_OPMODE_NORMAL:
+		return REGULATOR_MODE_NORMAL;
+	case MT6360_OPMODE_LP:
+		return REGULATOR_MODE_IDLE;
+	case MT6360_OPMODE_ULP:
+		return REGULATOR_MODE_STANDBY;
+	default:
+		return REGULATOR_MODE_INVALID;
+	}
+}
+
+#define MT6360_REGULATOR_DESC(_name, _sname, ereg, emask, vreg,	vmask,	\
+			      mreg, mmask, streg, stmask, vranges,	\
+			      vcnts, offon_delay, irq_tbls)		\
+{									\
+	.desc = {							\
+		.name = #_name,						\
+		.supply_name = #_sname,					\
+		.id =  MT6360_REGULATOR_##_name,			\
+		.of_match = of_match_ptr(#_name),			\
+		.of_map_mode = mt6360_regulator_of_map_mode,		\
+		.owner = THIS_MODULE,					\
+		.ops = &mt6360_regulator_ops,				\
+		.type = REGULATOR_VOLTAGE,				\
+		.vsel_reg = vreg,					\
+		.vsel_mask = vmask,					\
+		.enable_reg = ereg,					\
+		.enable_mask = emask,					\
+		.linear_ranges = vranges,				\
+		.n_linear_ranges = ARRAY_SIZE(vranges),			\
+		.n_voltages = vcnts,					\
+		.off_on_delay = offon_delay,				\
+	},								\
+	.mode_reg = mreg,						\
+	.mode_mask = mmask,						\
+	.state_reg = streg,						\
+	.state_mask = stmask,						\
+	.irq_tables = irq_tbls,						\
+	.irq_table_size = ARRAY_SIZE(irq_tbls),				\
+}
+
+static const struct mt6360_regulator_desc mt6360_regulator_descs[] =  {
+	MT6360_REGULATOR_DESC(BUCK1, BUCK1_VIN, 0x117, 0x40, 0x110, 0xff, 0x117, 0x30, 0x117, 0x04,
+			      buck_vout_ranges, 256, 0, buck1_irq_tbls),
+	MT6360_REGULATOR_DESC(BUCK2, BUCK2_VIN, 0x127, 0x40, 0x120, 0xff, 0x127, 0x30, 0x127, 0x04,
+			      buck_vout_ranges, 256, 0, buck2_irq_tbls),
+	MT6360_REGULATOR_DESC(LDO6, LDO_VIN3, 0x137, 0x40, 0x13B, 0xff, 0x137, 0x30, 0x137, 0x04,
+			      ldo_vout_ranges1, 256, 0, ldo6_irq_tbls),
+	MT6360_REGULATOR_DESC(LDO7, LDO_VIN3, 0x131, 0x40, 0x135, 0xff, 0x131, 0x30, 0x131, 0x04,
+			      ldo_vout_ranges1, 256, 0, ldo7_irq_tbls),
+	MT6360_REGULATOR_DESC(LDO1, LDO_VIN1, 0x217, 0x40, 0x21B, 0xff, 0x217, 0x30, 0x217, 0x04,
+			      ldo_vout_ranges2, 256, 0, ldo1_irq_tbls),
+	MT6360_REGULATOR_DESC(LDO2, LDO_VIN1, 0x211, 0x40, 0x215, 0xff, 0x211, 0x30, 0x211, 0x04,
+			      ldo_vout_ranges2, 256, 0, ldo2_irq_tbls),
+	MT6360_REGULATOR_DESC(LDO3, LDO_VIN1, 0x205, 0x40, 0x209, 0xff, 0x205, 0x30, 0x205, 0x04,
+			      ldo_vout_ranges2, 256, 100, ldo3_irq_tbls),
+	MT6360_REGULATOR_DESC(LDO5, LDO_VIN2, 0x20B, 0x40, 0x20F, 0x7f, 0x20B, 0x30, 0x20B, 0x04,
+			      ldo_vout_ranges3, 128, 100, ldo5_irq_tbls),
+};
+
+static int mt6360_regulator_irq_register(struct platform_device *pdev,
+					 struct regulator_dev *rdev,
+					 const struct mt6360_irq_mapping *tbls,
+					 int tbl_size)
+{
+	int i, irq, ret;
+
+	for (i = 0; i < tbl_size; i++) {
+		const struct mt6360_irq_mapping *irq_desc = tbls + i;
+
+		irq = platform_get_irq_byname(pdev, irq_desc->name);
+		if (irq < 0) {
+			dev_err(&pdev->dev, "Fail to get %s irq\n", irq_desc->name);
+			return irq;
+		}
+
+		ret = devm_request_threaded_irq(&pdev->dev, irq, NULL, irq_desc->handler, 0,
+						irq_desc->name, rdev);
+		if (ret) {
+			dev_err(&pdev->dev, "Fail to request %s irq\n", irq_desc->name);
+			return ret;
+		}
+	}
+
+	return 0;
+}
+
+static int mt6360_regulator_probe(struct platform_device *pdev)
+{
+	struct mt6360_regulator_data *mrd;
+	struct regulator_config config = {};
+	int i, ret;
+
+	mrd = devm_kzalloc(&pdev->dev, sizeof(*mrd), GFP_KERNEL);
+	if (!mrd)
+		return -ENOMEM;
+
+	mrd->dev = &pdev->dev;
+
+	mrd->regmap = dev_get_regmap(pdev->dev.parent, NULL);
+	if (!mrd->regmap) {
+		dev_err(&pdev->dev, "Failed to get parent regmap\n");
+		return -ENODEV;
+	}
+
+	config.dev = &pdev->dev;
+	config.driver_data = mrd;
+	config.regmap = mrd->regmap;
+
+	for (i = 0; i < ARRAY_SIZE(mt6360_regulator_descs); i++) {
+		const struct mt6360_regulator_desc *rdesc = mt6360_regulator_descs + i;
+		struct regulator_dev *rdev;
+
+		rdev = devm_regulator_register(&pdev->dev, &rdesc->desc, &config);
+		if (IS_ERR(rdev)) {
+			dev_err(&pdev->dev, "Failed to register  %d regulaotr\n", i);
+			return PTR_ERR(rdev);
+		}
+
+		ret = mt6360_regulator_irq_register(pdev, rdev, rdesc->irq_tables,
+						    rdesc->irq_table_size);
+		if (ret) {
+			dev_err(&pdev->dev, "Failed to register  %d regulaotr irqs\n", i);
+			return ret;
+		}
+	}
+
+	return 0;
+}
+
+static const struct of_device_id __maybe_unused mt6360_regulator_of_id[] = {
+	{ .compatible = "mediatek,mt6360-regulator", },
+	{},
+};
+MODULE_DEVICE_TABLE(of, mt6360_regulator_of_id);
+
+static struct platform_driver mt6360_regulator_driver = {
+	.driver = {
+		.name = "mt6360-regulator",
+		.of_match_table = mt6360_regulator_of_id,
+	},
+	.probe = mt6360_regulator_probe,
+};
+module_platform_driver(mt6360_regulator_driver);
+
+MODULE_AUTHOR("Gene Chen <gene_chen@richtek.com>");
+MODULE_DESCRIPTION("MT6360 Regulator Driver");
+MODULE_LICENSE("GPL v2");
diff --git a/include/dt-bindings/regulator/mediatek,mt6360-regulator.h b/include/dt-bindings/regulator/mediatek,mt6360-regulator.h
new file mode 100644
index 0000000..21c75de
--- /dev/null
+++ b/include/dt-bindings/regulator/mediatek,mt6360-regulator.h
@@ -0,0 +1,16 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+#ifndef __DT_BINDINGS_MEDIATEK_MT6360_REGULATOR_H__
+#define __DT_BINDINGS_MEDIATEK_MT6360_REGULATOR_H__
+
+/*
+ * BUCK/LDO mode constants which may be used in devicetree properties
+ * (eg. regulator-allowed-modes).
+ * See the manufacturer's datasheet for more information on these modes.
+ */
+
+#define MT6360_OPMODE_LP		2
+#define MT6360_OPMODE_ULP		3
+#define MT6360_OPMODE_NORMAL		0
+
+#endif
-- 
2.7.4


_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

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

* [PATCH v3 1/2] regulator: mt6360: Add support for MT6360 regulator
@ 2020-08-20  7:53   ` Gene Chen
  0 siblings, 0 replies; 51+ messages in thread
From: Gene Chen @ 2020-08-20  7:53 UTC (permalink / raw)
  To: matthias.bgg, robh+dt
  Cc: Gene Chen, devicetree, lgirdwood, linux-kernel, broonie,
	linux-mediatek, linux-arm-kernel

From: Gene Chen <gene_chen@richtek.com>

Add MT6360 regulator driver that contains two BUCKs and six LDOs

Signed-off-by: Gene Chen <gene_chen@richtek.com>
---
 drivers/regulator/Kconfig                          |   9 +
 drivers/regulator/Makefile                         |   1 +
 drivers/regulator/mt6360-regulator.c               | 458 +++++++++++++++++++++
 .../regulator/mediatek,mt6360-regulator.h          |  16 +
 4 files changed, 484 insertions(+)
 create mode 100644 drivers/regulator/mt6360-regulator.c
 create mode 100644 include/dt-bindings/regulator/mediatek,mt6360-regulator.h

diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig
index de17ef7..8a6c3c6 100644
--- a/drivers/regulator/Kconfig
+++ b/drivers/regulator/Kconfig
@@ -711,6 +711,15 @@ config REGULATOR_MT6358
 	  This driver supports the control of different power rails of device
 	  through regulator interface.
 
+config REGULATOR_MT6360
+	tristate "MT6360 SubPMIC Regulator"
+	depends on MFD_MT6360
+	help
+	  Say Y here to enable MT6360 regulator support.
+	  This is support MT6360 PMIC/LDO part include
+	  2-channel buck with Thermal Shutdown and Overload Protection
+	  6-channel High PSRR and Low Dropout LDO.
+
 config REGULATOR_MT6380
 	tristate "MediaTek MT6380 PMIC"
 	depends on MTK_PMIC_WRAP
diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile
index d8d3ecf..821a33f 100644
--- a/drivers/regulator/Makefile
+++ b/drivers/regulator/Makefile
@@ -88,6 +88,7 @@ obj-$(CONFIG_REGULATOR_MPQ7920) += mpq7920.o
 obj-$(CONFIG_REGULATOR_MT6311) += mt6311-regulator.o
 obj-$(CONFIG_REGULATOR_MT6323)	+= mt6323-regulator.o
 obj-$(CONFIG_REGULATOR_MT6358)	+= mt6358-regulator.o
+obj-$(CONFIG_REGULATOR_MT6360) += mt6360-regulator.o
 obj-$(CONFIG_REGULATOR_MT6380)	+= mt6380-regulator.o
 obj-$(CONFIG_REGULATOR_MT6397)	+= mt6397-regulator.o
 obj-$(CONFIG_REGULATOR_QCOM_LABIBB) += qcom-labibb-regulator.o
diff --git a/drivers/regulator/mt6360-regulator.c b/drivers/regulator/mt6360-regulator.c
new file mode 100644
index 0000000..f01d1cc
--- /dev/null
+++ b/drivers/regulator/mt6360-regulator.c
@@ -0,0 +1,458 @@
+// SPDX-License-Identifier: GPL-2.0-only
+//
+// Copyright (C) 2020 MediaTek Inc.
+//
+// Author: Gene Chen <gene_chen@richtek.com>
+
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
+#include <linux/regmap.h>
+#include <linux/regulator/driver.h>
+#include <linux/regulator/machine.h>
+
+#include <dt-bindings/regulator/mediatek,mt6360-regulator.h>
+
+enum {
+	MT6360_REGULATOR_BUCK1 = 0,
+	MT6360_REGULATOR_BUCK2,
+	MT6360_REGULATOR_LDO6,
+	MT6360_REGULATOR_LDO7,
+	MT6360_REGULATOR_LDO1,
+	MT6360_REGULATOR_LDO2,
+	MT6360_REGULATOR_LDO3,
+	MT6360_REGULATOR_LDO5,
+	MT6360_REGULATOR_MAX,
+};
+
+struct mt6360_irq_mapping {
+	const char *name;
+	irq_handler_t handler;
+};
+
+struct mt6360_regulator_desc {
+	const struct regulator_desc desc;
+	unsigned int mode_reg;
+	unsigned int mode_mask;
+	unsigned int state_reg;
+	unsigned int state_mask;
+	const struct mt6360_irq_mapping *irq_tables;
+	int irq_table_size;
+};
+
+struct mt6360_regulator_data {
+	struct device *dev;
+	struct regmap *regmap;
+};
+
+static irqreturn_t mt6360_pgb_event_handler(int irq, void *data)
+{
+	struct regulator_dev *rdev = data;
+
+	regulator_notifier_call_chain(rdev, REGULATOR_EVENT_FAIL, NULL);
+	return IRQ_HANDLED;
+}
+
+static irqreturn_t mt6360_oc_event_handler(int irq, void *data)
+{
+	struct regulator_dev *rdev = data;
+
+	regulator_notifier_call_chain(rdev, REGULATOR_EVENT_OVER_CURRENT, NULL);
+	return IRQ_HANDLED;
+}
+
+static irqreturn_t mt6360_ov_event_handler(int irq, void *data)
+{
+	struct regulator_dev *rdev = data;
+
+	regulator_notifier_call_chain(rdev, REGULATOR_EVENT_REGULATION_OUT, NULL);
+	return IRQ_HANDLED;
+}
+
+static irqreturn_t mt6360_uv_event_handler(int irq, void *data)
+{
+	struct regulator_dev *rdev = data;
+
+	regulator_notifier_call_chain(rdev, REGULATOR_EVENT_UNDER_VOLTAGE, NULL);
+	return IRQ_HANDLED;
+}
+
+static const struct mt6360_irq_mapping buck1_irq_tbls[] = {
+	{ "buck1_pgb_evt", mt6360_pgb_event_handler },
+	{ "buck1_oc_evt", mt6360_oc_event_handler },
+	{ "buck1_ov_evt", mt6360_ov_event_handler },
+	{ "buck1_uv_evt", mt6360_uv_event_handler },
+};
+
+static const struct mt6360_irq_mapping buck2_irq_tbls[] = {
+	{ "buck2_pgb_evt", mt6360_pgb_event_handler },
+	{ "buck2_oc_evt", mt6360_oc_event_handler },
+	{ "buck2_ov_evt", mt6360_ov_event_handler },
+	{ "buck2_uv_evt", mt6360_uv_event_handler },
+};
+
+static const struct mt6360_irq_mapping ldo6_irq_tbls[] = {
+	{ "ldo6_pgb_evt", mt6360_pgb_event_handler },
+	{ "ldo6_oc_evt", mt6360_oc_event_handler },
+};
+
+static const struct mt6360_irq_mapping ldo7_irq_tbls[] = {
+	{ "ldo7_pgb_evt", mt6360_pgb_event_handler },
+	{ "ldo7_oc_evt", mt6360_oc_event_handler },
+};
+
+static const struct mt6360_irq_mapping ldo1_irq_tbls[] = {
+	{ "ldo1_pgb_evt", mt6360_pgb_event_handler },
+	{ "ldo1_oc_evt", mt6360_oc_event_handler },
+};
+
+static const struct mt6360_irq_mapping ldo2_irq_tbls[] = {
+	{ "ldo2_pgb_evt", mt6360_pgb_event_handler },
+	{ "ldo2_oc_evt", mt6360_oc_event_handler },
+};
+
+static const struct mt6360_irq_mapping ldo3_irq_tbls[] = {
+	{ "ldo3_pgb_evt", mt6360_pgb_event_handler },
+	{ "ldo3_oc_evt", mt6360_oc_event_handler },
+};
+
+static const struct mt6360_irq_mapping ldo5_irq_tbls[] = {
+	{ "ldo5_pgb_evt", mt6360_pgb_event_handler },
+	{ "ldo5_oc_evt", mt6360_oc_event_handler },
+};
+
+static const struct linear_range buck_vout_ranges[] = {
+	REGULATOR_LINEAR_RANGE(300000, 0x00, 0xc7, 5000),
+	REGULATOR_LINEAR_RANGE(1300000, 0xc8, 0xff, 0),
+};
+
+static const struct linear_range ldo_vout_ranges1[] = {
+	REGULATOR_LINEAR_RANGE(500000, 0x00, 0x09, 10000),
+	REGULATOR_LINEAR_RANGE(600000, 0x0a, 0x10, 0),
+	REGULATOR_LINEAR_RANGE(610000, 0x11, 0x19, 10000),
+	REGULATOR_LINEAR_RANGE(700000, 0x1a, 0x20, 0),
+	REGULATOR_LINEAR_RANGE(710000, 0x21, 0x29, 10000),
+	REGULATOR_LINEAR_RANGE(800000, 0x2a, 0x30, 0),
+	REGULATOR_LINEAR_RANGE(810000, 0x31, 0x39, 10000),
+	REGULATOR_LINEAR_RANGE(900000, 0x3a, 0x40, 0),
+	REGULATOR_LINEAR_RANGE(910000, 0x41, 0x49, 10000),
+	REGULATOR_LINEAR_RANGE(1000000, 0x4a, 0x50, 0),
+	REGULATOR_LINEAR_RANGE(1010000, 0x51, 0x59, 10000),
+	REGULATOR_LINEAR_RANGE(1100000, 0x5a, 0x60, 0),
+	REGULATOR_LINEAR_RANGE(1110000, 0x61, 0x69, 10000),
+	REGULATOR_LINEAR_RANGE(1200000, 0x6a, 0x70, 0),
+	REGULATOR_LINEAR_RANGE(1210000, 0x71, 0x79, 10000),
+	REGULATOR_LINEAR_RANGE(1300000, 0x7a, 0x80, 0),
+	REGULATOR_LINEAR_RANGE(1310000, 0x81, 0x89, 10000),
+	REGULATOR_LINEAR_RANGE(1400000, 0x8a, 0x90, 0),
+	REGULATOR_LINEAR_RANGE(1410000, 0x91, 0x99, 10000),
+	REGULATOR_LINEAR_RANGE(1500000, 0x9a, 0xa0, 0),
+	REGULATOR_LINEAR_RANGE(1510000, 0xa1, 0xa9, 10000),
+	REGULATOR_LINEAR_RANGE(1600000, 0xaa, 0xb0, 0),
+	REGULATOR_LINEAR_RANGE(1610000, 0xb1, 0xb9, 10000),
+	REGULATOR_LINEAR_RANGE(1700000, 0xba, 0xc0, 0),
+	REGULATOR_LINEAR_RANGE(1710000, 0xc1, 0xc9, 10000),
+	REGULATOR_LINEAR_RANGE(1800000, 0xca, 0xd0, 0),
+	REGULATOR_LINEAR_RANGE(1810000, 0xd1, 0xd9, 10000),
+	REGULATOR_LINEAR_RANGE(1900000, 0xda, 0xe0, 0),
+	REGULATOR_LINEAR_RANGE(1910000, 0xe1, 0xe9, 10000),
+	REGULATOR_LINEAR_RANGE(2000000, 0xea, 0xf0, 0),
+	REGULATOR_LINEAR_RANGE(2010000, 0xf1, 0xf9, 10000),
+	REGULATOR_LINEAR_RANGE(2100000, 0xfa, 0xff, 0),
+};
+
+static const struct linear_range ldo_vout_ranges2[] = {
+	REGULATOR_LINEAR_RANGE(1200000, 0x00, 0x09, 10000),
+	REGULATOR_LINEAR_RANGE(1300000, 0x0a, 0x10, 0),
+	REGULATOR_LINEAR_RANGE(1310000, 0x11, 0x19, 10000),
+	REGULATOR_LINEAR_RANGE(1400000, 0x1a, 0x1f, 0),
+	REGULATOR_LINEAR_RANGE(1500000, 0x20, 0x29, 10000),
+	REGULATOR_LINEAR_RANGE(1600000, 0x2a, 0x2f, 0),
+	REGULATOR_LINEAR_RANGE(1700000, 0x30, 0x39, 10000),
+	REGULATOR_LINEAR_RANGE(1800000, 0x3a, 0x40, 0),
+	REGULATOR_LINEAR_RANGE(1810000, 0x41, 0x49, 10000),
+	REGULATOR_LINEAR_RANGE(1900000, 0x4a, 0x4f, 0),
+	REGULATOR_LINEAR_RANGE(2000000, 0x50, 0x59, 10000),
+	REGULATOR_LINEAR_RANGE(2100000, 0x5a, 0x60, 0),
+	REGULATOR_LINEAR_RANGE(2110000, 0x61, 0x69, 10000),
+	REGULATOR_LINEAR_RANGE(2200000, 0x6a, 0x6f, 0),
+	REGULATOR_LINEAR_RANGE(2500000, 0x70, 0x79, 10000),
+	REGULATOR_LINEAR_RANGE(2600000, 0x7a, 0x7f, 0),
+	REGULATOR_LINEAR_RANGE(2700000, 0x80, 0x89, 10000),
+	REGULATOR_LINEAR_RANGE(2800000, 0x8a, 0x90, 0),
+	REGULATOR_LINEAR_RANGE(2810000, 0x91, 0x99, 10000),
+	REGULATOR_LINEAR_RANGE(2900000, 0x9a, 0xa0, 0),
+	REGULATOR_LINEAR_RANGE(2910000, 0xa1, 0xa9, 10000),
+	REGULATOR_LINEAR_RANGE(3000000, 0xaa, 0xb0, 0),
+	REGULATOR_LINEAR_RANGE(3010000, 0xb1, 0xb9, 10000),
+	REGULATOR_LINEAR_RANGE(3100000, 0xba, 0xc0, 0),
+	REGULATOR_LINEAR_RANGE(3110000, 0xc1, 0xc9, 10000),
+	REGULATOR_LINEAR_RANGE(3200000, 0xca, 0xcf, 0),
+	REGULATOR_LINEAR_RANGE(3300000, 0xd0, 0xd9, 10000),
+	REGULATOR_LINEAR_RANGE(3400000, 0xda, 0xe0, 0),
+	REGULATOR_LINEAR_RANGE(3410000, 0xe1, 0xe9, 10000),
+	REGULATOR_LINEAR_RANGE(3500000, 0xea, 0xf0, 0),
+	REGULATOR_LINEAR_RANGE(3510000, 0xf1, 0xf9, 10000),
+	REGULATOR_LINEAR_RANGE(3600000, 0xfa, 0xff, 0),
+};
+
+static const struct linear_range ldo_vout_ranges3[] = {
+	REGULATOR_LINEAR_RANGE(2700000, 0x00, 0x09, 10000),
+	REGULATOR_LINEAR_RANGE(2800000, 0x0a, 0x10, 0),
+	REGULATOR_LINEAR_RANGE(2810000, 0x11, 0x19, 10000),
+	REGULATOR_LINEAR_RANGE(2900000, 0x1a, 0x20, 0),
+	REGULATOR_LINEAR_RANGE(2910000, 0x21, 0x29, 10000),
+	REGULATOR_LINEAR_RANGE(3000000, 0x2a, 0x30, 0),
+	REGULATOR_LINEAR_RANGE(3010000, 0x31, 0x39, 10000),
+	REGULATOR_LINEAR_RANGE(3100000, 0x3a, 0x40, 0),
+	REGULATOR_LINEAR_RANGE(3110000, 0x41, 0x49, 10000),
+	REGULATOR_LINEAR_RANGE(3200000, 0x4a, 0x4f, 0),
+	REGULATOR_LINEAR_RANGE(3300000, 0x50, 0x59, 10000),
+	REGULATOR_LINEAR_RANGE(3400000, 0x5a, 0x60, 0),
+	REGULATOR_LINEAR_RANGE(3410000, 0x61, 0x69, 10000),
+	REGULATOR_LINEAR_RANGE(3500000, 0x6a, 0x70, 0),
+	REGULATOR_LINEAR_RANGE(3510000, 0x71, 0x79, 10000),
+	REGULATOR_LINEAR_RANGE(3600000, 0x7a, 0x7f, 0),
+};
+
+static int mt6360_regulator_set_mode(struct regulator_dev *rdev,
+				     unsigned int mode)
+{
+	const struct mt6360_regulator_desc *rdesc = (struct mt6360_regulator_desc *)rdev->desc;
+	struct regmap *regmap = rdev_get_regmap(rdev);
+	int shift = ffs(rdesc->mode_mask) - 1;
+	unsigned int val;
+	int ret;
+
+	switch (mode) {
+	case REGULATOR_MODE_NORMAL:
+		val = MT6360_OPMODE_NORMAL;
+		break;
+	case REGULATOR_MODE_STANDBY:
+		val = MT6360_OPMODE_ULP;
+		break;
+	case REGULATOR_MODE_IDLE:
+		val = MT6360_OPMODE_LP;
+		break;
+	default:
+		return -EINVAL;
+	}
+
+	ret = regmap_update_bits(regmap, rdesc->mode_reg, rdesc->mode_mask, val << shift);
+	if (ret) {
+		dev_err(&rdev->dev, "%s: fail (%d)\n", __func__, ret);
+		return ret;
+	}
+
+	return 0;
+}
+
+static unsigned int mt6360_regulator_get_mode(struct regulator_dev *rdev)
+{
+	const struct mt6360_regulator_desc *rdesc = (struct mt6360_regulator_desc *)rdev->desc;
+	struct regmap *regmap = rdev_get_regmap(rdev);
+	int shift = ffs(rdesc->mode_mask) - 1;
+	unsigned int val;
+	int ret;
+
+	ret = regmap_read(regmap, rdesc->mode_reg, &val);
+	if (ret)
+		return ret;
+
+	val &= rdesc->mode_mask;
+	val >>= shift;
+
+	switch (val) {
+	case MT6360_OPMODE_LP:
+		return REGULATOR_MODE_IDLE;
+	case MT6360_OPMODE_ULP:
+		return REGULATOR_MODE_STANDBY;
+	case MT6360_OPMODE_NORMAL:
+		return REGULATOR_MODE_NORMAL;
+	default:
+		return -EINVAL;
+	}
+}
+
+static int mt6360_regulator_get_status(struct regulator_dev *rdev)
+{
+	const struct mt6360_regulator_desc *rdesc = (struct mt6360_regulator_desc *)rdev->desc;
+	struct regmap *regmap = rdev_get_regmap(rdev);
+	unsigned int val;
+	int ret;
+
+	ret = regmap_read(regmap, rdesc->state_reg, &val);
+	if (ret)
+		return ret;
+
+	if (val & rdesc->state_mask)
+		return REGULATOR_STATUS_ON;
+
+	return REGULATOR_STATUS_OFF;
+}
+
+static const struct regulator_ops mt6360_regulator_ops = {
+	.list_voltage = regulator_list_voltage_linear_range,
+	.enable = regulator_enable_regmap,
+	.disable = regulator_disable_regmap,
+	.is_enabled = regulator_is_enabled_regmap,
+	.set_voltage_sel = regulator_set_voltage_sel_regmap,
+	.get_voltage_sel = regulator_get_voltage_sel_regmap,
+	.set_mode = mt6360_regulator_set_mode,
+	.get_mode = mt6360_regulator_get_mode,
+	.get_status = mt6360_regulator_get_status,
+};
+
+static unsigned int mt6360_regulator_of_map_mode(unsigned int hw_mode)
+{
+	switch (hw_mode) {
+	case MT6360_OPMODE_NORMAL:
+		return REGULATOR_MODE_NORMAL;
+	case MT6360_OPMODE_LP:
+		return REGULATOR_MODE_IDLE;
+	case MT6360_OPMODE_ULP:
+		return REGULATOR_MODE_STANDBY;
+	default:
+		return REGULATOR_MODE_INVALID;
+	}
+}
+
+#define MT6360_REGULATOR_DESC(_name, _sname, ereg, emask, vreg,	vmask,	\
+			      mreg, mmask, streg, stmask, vranges,	\
+			      vcnts, offon_delay, irq_tbls)		\
+{									\
+	.desc = {							\
+		.name = #_name,						\
+		.supply_name = #_sname,					\
+		.id =  MT6360_REGULATOR_##_name,			\
+		.of_match = of_match_ptr(#_name),			\
+		.of_map_mode = mt6360_regulator_of_map_mode,		\
+		.owner = THIS_MODULE,					\
+		.ops = &mt6360_regulator_ops,				\
+		.type = REGULATOR_VOLTAGE,				\
+		.vsel_reg = vreg,					\
+		.vsel_mask = vmask,					\
+		.enable_reg = ereg,					\
+		.enable_mask = emask,					\
+		.linear_ranges = vranges,				\
+		.n_linear_ranges = ARRAY_SIZE(vranges),			\
+		.n_voltages = vcnts,					\
+		.off_on_delay = offon_delay,				\
+	},								\
+	.mode_reg = mreg,						\
+	.mode_mask = mmask,						\
+	.state_reg = streg,						\
+	.state_mask = stmask,						\
+	.irq_tables = irq_tbls,						\
+	.irq_table_size = ARRAY_SIZE(irq_tbls),				\
+}
+
+static const struct mt6360_regulator_desc mt6360_regulator_descs[] =  {
+	MT6360_REGULATOR_DESC(BUCK1, BUCK1_VIN, 0x117, 0x40, 0x110, 0xff, 0x117, 0x30, 0x117, 0x04,
+			      buck_vout_ranges, 256, 0, buck1_irq_tbls),
+	MT6360_REGULATOR_DESC(BUCK2, BUCK2_VIN, 0x127, 0x40, 0x120, 0xff, 0x127, 0x30, 0x127, 0x04,
+			      buck_vout_ranges, 256, 0, buck2_irq_tbls),
+	MT6360_REGULATOR_DESC(LDO6, LDO_VIN3, 0x137, 0x40, 0x13B, 0xff, 0x137, 0x30, 0x137, 0x04,
+			      ldo_vout_ranges1, 256, 0, ldo6_irq_tbls),
+	MT6360_REGULATOR_DESC(LDO7, LDO_VIN3, 0x131, 0x40, 0x135, 0xff, 0x131, 0x30, 0x131, 0x04,
+			      ldo_vout_ranges1, 256, 0, ldo7_irq_tbls),
+	MT6360_REGULATOR_DESC(LDO1, LDO_VIN1, 0x217, 0x40, 0x21B, 0xff, 0x217, 0x30, 0x217, 0x04,
+			      ldo_vout_ranges2, 256, 0, ldo1_irq_tbls),
+	MT6360_REGULATOR_DESC(LDO2, LDO_VIN1, 0x211, 0x40, 0x215, 0xff, 0x211, 0x30, 0x211, 0x04,
+			      ldo_vout_ranges2, 256, 0, ldo2_irq_tbls),
+	MT6360_REGULATOR_DESC(LDO3, LDO_VIN1, 0x205, 0x40, 0x209, 0xff, 0x205, 0x30, 0x205, 0x04,
+			      ldo_vout_ranges2, 256, 100, ldo3_irq_tbls),
+	MT6360_REGULATOR_DESC(LDO5, LDO_VIN2, 0x20B, 0x40, 0x20F, 0x7f, 0x20B, 0x30, 0x20B, 0x04,
+			      ldo_vout_ranges3, 128, 100, ldo5_irq_tbls),
+};
+
+static int mt6360_regulator_irq_register(struct platform_device *pdev,
+					 struct regulator_dev *rdev,
+					 const struct mt6360_irq_mapping *tbls,
+					 int tbl_size)
+{
+	int i, irq, ret;
+
+	for (i = 0; i < tbl_size; i++) {
+		const struct mt6360_irq_mapping *irq_desc = tbls + i;
+
+		irq = platform_get_irq_byname(pdev, irq_desc->name);
+		if (irq < 0) {
+			dev_err(&pdev->dev, "Fail to get %s irq\n", irq_desc->name);
+			return irq;
+		}
+
+		ret = devm_request_threaded_irq(&pdev->dev, irq, NULL, irq_desc->handler, 0,
+						irq_desc->name, rdev);
+		if (ret) {
+			dev_err(&pdev->dev, "Fail to request %s irq\n", irq_desc->name);
+			return ret;
+		}
+	}
+
+	return 0;
+}
+
+static int mt6360_regulator_probe(struct platform_device *pdev)
+{
+	struct mt6360_regulator_data *mrd;
+	struct regulator_config config = {};
+	int i, ret;
+
+	mrd = devm_kzalloc(&pdev->dev, sizeof(*mrd), GFP_KERNEL);
+	if (!mrd)
+		return -ENOMEM;
+
+	mrd->dev = &pdev->dev;
+
+	mrd->regmap = dev_get_regmap(pdev->dev.parent, NULL);
+	if (!mrd->regmap) {
+		dev_err(&pdev->dev, "Failed to get parent regmap\n");
+		return -ENODEV;
+	}
+
+	config.dev = &pdev->dev;
+	config.driver_data = mrd;
+	config.regmap = mrd->regmap;
+
+	for (i = 0; i < ARRAY_SIZE(mt6360_regulator_descs); i++) {
+		const struct mt6360_regulator_desc *rdesc = mt6360_regulator_descs + i;
+		struct regulator_dev *rdev;
+
+		rdev = devm_regulator_register(&pdev->dev, &rdesc->desc, &config);
+		if (IS_ERR(rdev)) {
+			dev_err(&pdev->dev, "Failed to register  %d regulaotr\n", i);
+			return PTR_ERR(rdev);
+		}
+
+		ret = mt6360_regulator_irq_register(pdev, rdev, rdesc->irq_tables,
+						    rdesc->irq_table_size);
+		if (ret) {
+			dev_err(&pdev->dev, "Failed to register  %d regulaotr irqs\n", i);
+			return ret;
+		}
+	}
+
+	return 0;
+}
+
+static const struct of_device_id __maybe_unused mt6360_regulator_of_id[] = {
+	{ .compatible = "mediatek,mt6360-regulator", },
+	{},
+};
+MODULE_DEVICE_TABLE(of, mt6360_regulator_of_id);
+
+static struct platform_driver mt6360_regulator_driver = {
+	.driver = {
+		.name = "mt6360-regulator",
+		.of_match_table = mt6360_regulator_of_id,
+	},
+	.probe = mt6360_regulator_probe,
+};
+module_platform_driver(mt6360_regulator_driver);
+
+MODULE_AUTHOR("Gene Chen <gene_chen@richtek.com>");
+MODULE_DESCRIPTION("MT6360 Regulator Driver");
+MODULE_LICENSE("GPL v2");
diff --git a/include/dt-bindings/regulator/mediatek,mt6360-regulator.h b/include/dt-bindings/regulator/mediatek,mt6360-regulator.h
new file mode 100644
index 0000000..21c75de
--- /dev/null
+++ b/include/dt-bindings/regulator/mediatek,mt6360-regulator.h
@@ -0,0 +1,16 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+#ifndef __DT_BINDINGS_MEDIATEK_MT6360_REGULATOR_H__
+#define __DT_BINDINGS_MEDIATEK_MT6360_REGULATOR_H__
+
+/*
+ * BUCK/LDO mode constants which may be used in devicetree properties
+ * (eg. regulator-allowed-modes).
+ * See the manufacturer's datasheet for more information on these modes.
+ */
+
+#define MT6360_OPMODE_LP		2
+#define MT6360_OPMODE_ULP		3
+#define MT6360_OPMODE_NORMAL		0
+
+#endif
-- 
2.7.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v3 2/2] regulator: mt6360: Add DT binding documentation
  2020-08-20  7:53 ` Gene Chen
  (?)
@ 2020-08-20  7:53   ` Gene Chen
  -1 siblings, 0 replies; 51+ messages in thread
From: Gene Chen @ 2020-08-20  7:53 UTC (permalink / raw)
  To: matthias.bgg, robh+dt
  Cc: lgirdwood, broonie, linux-kernel, devicetree, linux-arm-kernel,
	linux-mediatek, Gene Chen

From: Gene Chen <gene_chen@richtek.com>

Add a devicetree binding documentation for the mt6360 regulator driver.

Signed-off-by: Gene Chen <gene_chen@richtek.com>
---
 .../bindings/regulator/mt6360-regulator.yaml       | 109 +++++++++++++++++++++
 1 file changed, 109 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/regulator/mt6360-regulator.yaml

diff --git a/Documentation/devicetree/bindings/regulator/mt6360-regulator.yaml b/Documentation/devicetree/bindings/regulator/mt6360-regulator.yaml
new file mode 100644
index 0000000..bd66754
--- /dev/null
+++ b/Documentation/devicetree/bindings/regulator/mt6360-regulator.yaml
@@ -0,0 +1,109 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/regulator/mt6360-regulator.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: MT6360 Regulator from MediaTek Integrated
+
+maintainers:
+  - Gene Chen <gene_chen@richtek.com>
+
+description: |
+  list of regulators provided by this controller, must be named
+  after their hardware counterparts buck1/2 or ldo1/2/3/5/6/7
+
+properties:
+  compatible:
+    const: mediatek,mt6360-regulator
+
+  LDO_VIN3-supply:
+    description: Input supply phandle(s) for LDO3
+
+patternProperties:
+  "^buck[12]$":
+    $ref: "regulator.yaml#"
+
+  "^ldo[123567]$":
+    $ref: "regulator.yaml#"
+
+required:
+  - compatible
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+    #include <dt-bindings/regulator/mediatek,mt6360-regulator.h>
+    regulator {
+      compatible = "mediatek,mt6360-regulator";
+      LDO_VIN3-supply = <&BUCK2>;
+      buck1 {
+        regulator-compatible = "BUCK1";
+        regulator-name = "mt6360,buck1";
+        regulator-min-microvolt = <300000>;
+        regulator-max-microvolt = <1300000>;
+        regulator-allowed-modes = <MT6360_OPMODE_NORMAL
+             MT6360_OPMODE_LP
+             MT6360_OPMODE_ULP>;
+      };
+      BUCK2: buck2 {
+        regulator-compatible = "BUCK2";
+        regulator-name = "mt6360,buck2";
+        regulator-min-microvolt = <300000>;
+        regulator-max-microvolt = <1300000>;
+        regulator-allowed-modes = <MT6360_OPMODE_NORMAL
+             MT6360_OPMODE_LP
+             MT6360_OPMODE_ULP>;
+      };
+      ldo6 {
+        regulator-compatible = "LDO6";
+        regulator-name = "mt6360,ldo6";
+        regulator-min-microvolt = <500000>;
+        regulator-max-microvolt = <2100000>;
+        regulator-allowed-modes = <MT6360_OPMODE_NORMAL
+             MT6360_OPMODE_LP>;
+      };
+      ldo7 {
+        regulator-compatible = "LDO7";
+        regulator-name = "mt6360,ldo7";
+        regulator-min-microvolt = <500000>;
+        regulator-max-microvolt = <2100000>;
+        regulator-allowed-modes = <MT6360_OPMODE_NORMAL
+             MT6360_OPMODE_LP>;
+      };
+      ldo1 {
+        regulator-compatible = "LDO1";
+        regulator-name = "mt6360,ldo1";
+        regulator-min-microvolt = <1200000>;
+        regulator-max-microvolt = <3600000>;
+        regulator-allowed-modes = <MT6360_OPMODE_NORMAL
+             MT6360_OPMODE_LP>;
+      };
+        ldo2 {
+        regulator-compatible = "LDO2";
+        regulator-name = "mt6360,ldo2";
+        regulator-min-microvolt = <1200000>;
+        regulator-max-microvolt = <3600000>;
+        regulator-allowed-modes = <MT6360_OPMODE_NORMAL
+             MT6360_OPMODE_LP>;
+      };
+      ldo3 {
+        regulator-compatible = "LDO3";
+        regulator-name = "mt6360,ldo3";
+        regulator-min-microvolt = <1200000>;
+        regulator-max-microvolt = <3600000>;
+        regulator-allowed-modes = <MT6360_OPMODE_NORMAL
+             MT6360_OPMODE_LP>;
+      };
+      ldo5 {
+        regulator-compatible = "LDO5";
+        regulator-name = "mt6360,ldo5";
+        regulator-min-microvolt = <2700000>;
+        regulator-max-microvolt = <3600000>;
+        regulator-allowed-modes = <MT6360_OPMODE_NORMAL
+             MT6360_OPMODE_LP>;
+      };
+    };
+...
-- 
2.7.4


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

* [PATCH v3 2/2] regulator: mt6360: Add DT binding documentation
@ 2020-08-20  7:53   ` Gene Chen
  0 siblings, 0 replies; 51+ messages in thread
From: Gene Chen @ 2020-08-20  7:53 UTC (permalink / raw)
  To: matthias.bgg, robh+dt
  Cc: Gene Chen, devicetree, lgirdwood, linux-kernel, broonie,
	linux-mediatek, linux-arm-kernel

From: Gene Chen <gene_chen@richtek.com>

Add a devicetree binding documentation for the mt6360 regulator driver.

Signed-off-by: Gene Chen <gene_chen@richtek.com>
---
 .../bindings/regulator/mt6360-regulator.yaml       | 109 +++++++++++++++++++++
 1 file changed, 109 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/regulator/mt6360-regulator.yaml

diff --git a/Documentation/devicetree/bindings/regulator/mt6360-regulator.yaml b/Documentation/devicetree/bindings/regulator/mt6360-regulator.yaml
new file mode 100644
index 0000000..bd66754
--- /dev/null
+++ b/Documentation/devicetree/bindings/regulator/mt6360-regulator.yaml
@@ -0,0 +1,109 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/regulator/mt6360-regulator.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: MT6360 Regulator from MediaTek Integrated
+
+maintainers:
+  - Gene Chen <gene_chen@richtek.com>
+
+description: |
+  list of regulators provided by this controller, must be named
+  after their hardware counterparts buck1/2 or ldo1/2/3/5/6/7
+
+properties:
+  compatible:
+    const: mediatek,mt6360-regulator
+
+  LDO_VIN3-supply:
+    description: Input supply phandle(s) for LDO3
+
+patternProperties:
+  "^buck[12]$":
+    $ref: "regulator.yaml#"
+
+  "^ldo[123567]$":
+    $ref: "regulator.yaml#"
+
+required:
+  - compatible
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+    #include <dt-bindings/regulator/mediatek,mt6360-regulator.h>
+    regulator {
+      compatible = "mediatek,mt6360-regulator";
+      LDO_VIN3-supply = <&BUCK2>;
+      buck1 {
+        regulator-compatible = "BUCK1";
+        regulator-name = "mt6360,buck1";
+        regulator-min-microvolt = <300000>;
+        regulator-max-microvolt = <1300000>;
+        regulator-allowed-modes = <MT6360_OPMODE_NORMAL
+             MT6360_OPMODE_LP
+             MT6360_OPMODE_ULP>;
+      };
+      BUCK2: buck2 {
+        regulator-compatible = "BUCK2";
+        regulator-name = "mt6360,buck2";
+        regulator-min-microvolt = <300000>;
+        regulator-max-microvolt = <1300000>;
+        regulator-allowed-modes = <MT6360_OPMODE_NORMAL
+             MT6360_OPMODE_LP
+             MT6360_OPMODE_ULP>;
+      };
+      ldo6 {
+        regulator-compatible = "LDO6";
+        regulator-name = "mt6360,ldo6";
+        regulator-min-microvolt = <500000>;
+        regulator-max-microvolt = <2100000>;
+        regulator-allowed-modes = <MT6360_OPMODE_NORMAL
+             MT6360_OPMODE_LP>;
+      };
+      ldo7 {
+        regulator-compatible = "LDO7";
+        regulator-name = "mt6360,ldo7";
+        regulator-min-microvolt = <500000>;
+        regulator-max-microvolt = <2100000>;
+        regulator-allowed-modes = <MT6360_OPMODE_NORMAL
+             MT6360_OPMODE_LP>;
+      };
+      ldo1 {
+        regulator-compatible = "LDO1";
+        regulator-name = "mt6360,ldo1";
+        regulator-min-microvolt = <1200000>;
+        regulator-max-microvolt = <3600000>;
+        regulator-allowed-modes = <MT6360_OPMODE_NORMAL
+             MT6360_OPMODE_LP>;
+      };
+        ldo2 {
+        regulator-compatible = "LDO2";
+        regulator-name = "mt6360,ldo2";
+        regulator-min-microvolt = <1200000>;
+        regulator-max-microvolt = <3600000>;
+        regulator-allowed-modes = <MT6360_OPMODE_NORMAL
+             MT6360_OPMODE_LP>;
+      };
+      ldo3 {
+        regulator-compatible = "LDO3";
+        regulator-name = "mt6360,ldo3";
+        regulator-min-microvolt = <1200000>;
+        regulator-max-microvolt = <3600000>;
+        regulator-allowed-modes = <MT6360_OPMODE_NORMAL
+             MT6360_OPMODE_LP>;
+      };
+      ldo5 {
+        regulator-compatible = "LDO5";
+        regulator-name = "mt6360,ldo5";
+        regulator-min-microvolt = <2700000>;
+        regulator-max-microvolt = <3600000>;
+        regulator-allowed-modes = <MT6360_OPMODE_NORMAL
+             MT6360_OPMODE_LP>;
+      };
+    };
+...
-- 
2.7.4


_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

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

* [PATCH v3 2/2] regulator: mt6360: Add DT binding documentation
@ 2020-08-20  7:53   ` Gene Chen
  0 siblings, 0 replies; 51+ messages in thread
From: Gene Chen @ 2020-08-20  7:53 UTC (permalink / raw)
  To: matthias.bgg, robh+dt
  Cc: Gene Chen, devicetree, lgirdwood, linux-kernel, broonie,
	linux-mediatek, linux-arm-kernel

From: Gene Chen <gene_chen@richtek.com>

Add a devicetree binding documentation for the mt6360 regulator driver.

Signed-off-by: Gene Chen <gene_chen@richtek.com>
---
 .../bindings/regulator/mt6360-regulator.yaml       | 109 +++++++++++++++++++++
 1 file changed, 109 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/regulator/mt6360-regulator.yaml

diff --git a/Documentation/devicetree/bindings/regulator/mt6360-regulator.yaml b/Documentation/devicetree/bindings/regulator/mt6360-regulator.yaml
new file mode 100644
index 0000000..bd66754
--- /dev/null
+++ b/Documentation/devicetree/bindings/regulator/mt6360-regulator.yaml
@@ -0,0 +1,109 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/regulator/mt6360-regulator.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: MT6360 Regulator from MediaTek Integrated
+
+maintainers:
+  - Gene Chen <gene_chen@richtek.com>
+
+description: |
+  list of regulators provided by this controller, must be named
+  after their hardware counterparts buck1/2 or ldo1/2/3/5/6/7
+
+properties:
+  compatible:
+    const: mediatek,mt6360-regulator
+
+  LDO_VIN3-supply:
+    description: Input supply phandle(s) for LDO3
+
+patternProperties:
+  "^buck[12]$":
+    $ref: "regulator.yaml#"
+
+  "^ldo[123567]$":
+    $ref: "regulator.yaml#"
+
+required:
+  - compatible
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+    #include <dt-bindings/regulator/mediatek,mt6360-regulator.h>
+    regulator {
+      compatible = "mediatek,mt6360-regulator";
+      LDO_VIN3-supply = <&BUCK2>;
+      buck1 {
+        regulator-compatible = "BUCK1";
+        regulator-name = "mt6360,buck1";
+        regulator-min-microvolt = <300000>;
+        regulator-max-microvolt = <1300000>;
+        regulator-allowed-modes = <MT6360_OPMODE_NORMAL
+             MT6360_OPMODE_LP
+             MT6360_OPMODE_ULP>;
+      };
+      BUCK2: buck2 {
+        regulator-compatible = "BUCK2";
+        regulator-name = "mt6360,buck2";
+        regulator-min-microvolt = <300000>;
+        regulator-max-microvolt = <1300000>;
+        regulator-allowed-modes = <MT6360_OPMODE_NORMAL
+             MT6360_OPMODE_LP
+             MT6360_OPMODE_ULP>;
+      };
+      ldo6 {
+        regulator-compatible = "LDO6";
+        regulator-name = "mt6360,ldo6";
+        regulator-min-microvolt = <500000>;
+        regulator-max-microvolt = <2100000>;
+        regulator-allowed-modes = <MT6360_OPMODE_NORMAL
+             MT6360_OPMODE_LP>;
+      };
+      ldo7 {
+        regulator-compatible = "LDO7";
+        regulator-name = "mt6360,ldo7";
+        regulator-min-microvolt = <500000>;
+        regulator-max-microvolt = <2100000>;
+        regulator-allowed-modes = <MT6360_OPMODE_NORMAL
+             MT6360_OPMODE_LP>;
+      };
+      ldo1 {
+        regulator-compatible = "LDO1";
+        regulator-name = "mt6360,ldo1";
+        regulator-min-microvolt = <1200000>;
+        regulator-max-microvolt = <3600000>;
+        regulator-allowed-modes = <MT6360_OPMODE_NORMAL
+             MT6360_OPMODE_LP>;
+      };
+        ldo2 {
+        regulator-compatible = "LDO2";
+        regulator-name = "mt6360,ldo2";
+        regulator-min-microvolt = <1200000>;
+        regulator-max-microvolt = <3600000>;
+        regulator-allowed-modes = <MT6360_OPMODE_NORMAL
+             MT6360_OPMODE_LP>;
+      };
+      ldo3 {
+        regulator-compatible = "LDO3";
+        regulator-name = "mt6360,ldo3";
+        regulator-min-microvolt = <1200000>;
+        regulator-max-microvolt = <3600000>;
+        regulator-allowed-modes = <MT6360_OPMODE_NORMAL
+             MT6360_OPMODE_LP>;
+      };
+      ldo5 {
+        regulator-compatible = "LDO5";
+        regulator-name = "mt6360,ldo5";
+        regulator-min-microvolt = <2700000>;
+        regulator-max-microvolt = <3600000>;
+        regulator-allowed-modes = <MT6360_OPMODE_NORMAL
+             MT6360_OPMODE_LP>;
+      };
+    };
+...
-- 
2.7.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v3 2/2] regulator: mt6360: Add DT binding documentation
  2020-08-20  7:53   ` Gene Chen
  (?)
@ 2020-08-20 11:30     ` Mark Brown
  -1 siblings, 0 replies; 51+ messages in thread
From: Mark Brown @ 2020-08-20 11:30 UTC (permalink / raw)
  To: Gene Chen
  Cc: matthias.bgg, robh+dt, lgirdwood, linux-kernel, devicetree,
	linux-arm-kernel, linux-mediatek, Gene Chen

[-- Attachment #1: Type: text/plain, Size: 242 bytes --]

On Thu, Aug 20, 2020 at 03:53:42PM +0800, Gene Chen wrote:

> +properties:
> +  compatible:
> +    const: mediatek,mt6360-regulator
> +
> +  LDO_VIN3-supply:
> +    description: Input supply phandle(s) for LDO3
> +

Only LDO3 needs a supply?

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH v3 2/2] regulator: mt6360: Add DT binding documentation
@ 2020-08-20 11:30     ` Mark Brown
  0 siblings, 0 replies; 51+ messages in thread
From: Mark Brown @ 2020-08-20 11:30 UTC (permalink / raw)
  To: Gene Chen
  Cc: Gene Chen, devicetree, lgirdwood, linux-kernel, robh+dt,
	linux-mediatek, matthias.bgg, linux-arm-kernel


[-- Attachment #1.1: Type: text/plain, Size: 242 bytes --]

On Thu, Aug 20, 2020 at 03:53:42PM +0800, Gene Chen wrote:

> +properties:
> +  compatible:
> +    const: mediatek,mt6360-regulator
> +
> +  LDO_VIN3-supply:
> +    description: Input supply phandle(s) for LDO3
> +

Only LDO3 needs a supply?

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 170 bytes --]

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

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

* Re: [PATCH v3 2/2] regulator: mt6360: Add DT binding documentation
@ 2020-08-20 11:30     ` Mark Brown
  0 siblings, 0 replies; 51+ messages in thread
From: Mark Brown @ 2020-08-20 11:30 UTC (permalink / raw)
  To: Gene Chen
  Cc: Gene Chen, devicetree, lgirdwood, linux-kernel, robh+dt,
	linux-mediatek, matthias.bgg, linux-arm-kernel


[-- Attachment #1.1: Type: text/plain, Size: 242 bytes --]

On Thu, Aug 20, 2020 at 03:53:42PM +0800, Gene Chen wrote:

> +properties:
> +  compatible:
> +    const: mediatek,mt6360-regulator
> +
> +  LDO_VIN3-supply:
> +    description: Input supply phandle(s) for LDO3
> +

Only LDO3 needs a supply?

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v3 1/2] regulator: mt6360: Add support for MT6360 regulator
  2020-08-20  7:53   ` Gene Chen
  (?)
@ 2020-08-20 11:45     ` Mark Brown
  -1 siblings, 0 replies; 51+ messages in thread
From: Mark Brown @ 2020-08-20 11:45 UTC (permalink / raw)
  To: Gene Chen
  Cc: matthias.bgg, robh+dt, lgirdwood, linux-kernel, devicetree,
	linux-arm-kernel, linux-mediatek, Gene Chen

[-- Attachment #1: Type: text/plain, Size: 650 bytes --]

On Thu, Aug 20, 2020 at 03:53:41PM +0800, Gene Chen wrote:

> +	mrd->regmap = dev_get_regmap(pdev->dev.parent, NULL);
> +	if (!mrd->regmap) {
> +		dev_err(&pdev->dev, "Failed to get parent regmap\n");
> +		return -ENODEV;
> +	}

> +static const struct of_device_id __maybe_unused mt6360_regulator_of_id[] = {
> +	{ .compatible = "mediatek,mt6360-regulator", },
> +	{},
> +};
> +MODULE_DEVICE_TABLE(of, mt6360_regulator_of_id);

This device only exists in the context of a single parent device, there
should be no need for a compatible string here - this is just a detail
of how Linux does things.  The MFD should just instntiate the platform
device.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH v3 1/2] regulator: mt6360: Add support for MT6360 regulator
@ 2020-08-20 11:45     ` Mark Brown
  0 siblings, 0 replies; 51+ messages in thread
From: Mark Brown @ 2020-08-20 11:45 UTC (permalink / raw)
  To: Gene Chen
  Cc: Gene Chen, devicetree, lgirdwood, linux-kernel, robh+dt,
	linux-mediatek, matthias.bgg, linux-arm-kernel


[-- Attachment #1.1: Type: text/plain, Size: 650 bytes --]

On Thu, Aug 20, 2020 at 03:53:41PM +0800, Gene Chen wrote:

> +	mrd->regmap = dev_get_regmap(pdev->dev.parent, NULL);
> +	if (!mrd->regmap) {
> +		dev_err(&pdev->dev, "Failed to get parent regmap\n");
> +		return -ENODEV;
> +	}

> +static const struct of_device_id __maybe_unused mt6360_regulator_of_id[] = {
> +	{ .compatible = "mediatek,mt6360-regulator", },
> +	{},
> +};
> +MODULE_DEVICE_TABLE(of, mt6360_regulator_of_id);

This device only exists in the context of a single parent device, there
should be no need for a compatible string here - this is just a detail
of how Linux does things.  The MFD should just instntiate the platform
device.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 170 bytes --]

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

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

* Re: [PATCH v3 1/2] regulator: mt6360: Add support for MT6360 regulator
@ 2020-08-20 11:45     ` Mark Brown
  0 siblings, 0 replies; 51+ messages in thread
From: Mark Brown @ 2020-08-20 11:45 UTC (permalink / raw)
  To: Gene Chen
  Cc: Gene Chen, devicetree, lgirdwood, linux-kernel, robh+dt,
	linux-mediatek, matthias.bgg, linux-arm-kernel


[-- Attachment #1.1: Type: text/plain, Size: 650 bytes --]

On Thu, Aug 20, 2020 at 03:53:41PM +0800, Gene Chen wrote:

> +	mrd->regmap = dev_get_regmap(pdev->dev.parent, NULL);
> +	if (!mrd->regmap) {
> +		dev_err(&pdev->dev, "Failed to get parent regmap\n");
> +		return -ENODEV;
> +	}

> +static const struct of_device_id __maybe_unused mt6360_regulator_of_id[] = {
> +	{ .compatible = "mediatek,mt6360-regulator", },
> +	{},
> +};
> +MODULE_DEVICE_TABLE(of, mt6360_regulator_of_id);

This device only exists in the context of a single parent device, there
should be no need for a compatible string here - this is just a detail
of how Linux does things.  The MFD should just instntiate the platform
device.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v3 2/2] regulator: mt6360: Add DT binding documentation
  2020-08-20 11:30     ` Mark Brown
  (?)
@ 2020-08-24  7:21       ` Gene Chen
  -1 siblings, 0 replies; 51+ messages in thread
From: Gene Chen @ 2020-08-24  7:21 UTC (permalink / raw)
  To: Mark Brown
  Cc: Matthias Brugger, robh+dt, lgirdwood, linux-kernel, devicetree,
	linux-arm-kernel, linux-mediatek, Gene Chen

⊕

Mark Brown <broonie@kernel.org> 於 2020年8月20日 週四 下午7:30寫道:
>
> On Thu, Aug 20, 2020 at 03:53:42PM +0800, Gene Chen wrote:
>
> > +properties:
> > +  compatible:
> > +    const: mediatek,mt6360-regulator
> > +
> > +  LDO_VIN3-supply:
> > +    description: Input supply phandle(s) for LDO3
> > +
>
> Only LDO3 needs a supply?

LDO_VIN1/LDO_VIN2 is real MT6360 pin supply from VSYS to LDO1/2/3/5
LDO_VIN3 is also real pin supply from BUCK2 to LDO6/7

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

* Re: [PATCH v3 2/2] regulator: mt6360: Add DT binding documentation
@ 2020-08-24  7:21       ` Gene Chen
  0 siblings, 0 replies; 51+ messages in thread
From: Gene Chen @ 2020-08-24  7:21 UTC (permalink / raw)
  To: Mark Brown
  Cc: Gene Chen, devicetree, lgirdwood, linux-kernel, robh+dt,
	linux-mediatek, Matthias Brugger, linux-arm-kernel

⊕

Mark Brown <broonie@kernel.org> 於 2020年8月20日 週四 下午7:30寫道:
>
> On Thu, Aug 20, 2020 at 03:53:42PM +0800, Gene Chen wrote:
>
> > +properties:
> > +  compatible:
> > +    const: mediatek,mt6360-regulator
> > +
> > +  LDO_VIN3-supply:
> > +    description: Input supply phandle(s) for LDO3
> > +
>
> Only LDO3 needs a supply?

LDO_VIN1/LDO_VIN2 is real MT6360 pin supply from VSYS to LDO1/2/3/5
LDO_VIN3 is also real pin supply from BUCK2 to LDO6/7

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

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

* Re: [PATCH v3 2/2] regulator: mt6360: Add DT binding documentation
@ 2020-08-24  7:21       ` Gene Chen
  0 siblings, 0 replies; 51+ messages in thread
From: Gene Chen @ 2020-08-24  7:21 UTC (permalink / raw)
  To: Mark Brown
  Cc: Gene Chen, devicetree, lgirdwood, linux-kernel, robh+dt,
	linux-mediatek, Matthias Brugger, linux-arm-kernel

⊕

Mark Brown <broonie@kernel.org> 於 2020年8月20日 週四 下午7:30寫道:
>
> On Thu, Aug 20, 2020 at 03:53:42PM +0800, Gene Chen wrote:
>
> > +properties:
> > +  compatible:
> > +    const: mediatek,mt6360-regulator
> > +
> > +  LDO_VIN3-supply:
> > +    description: Input supply phandle(s) for LDO3
> > +
>
> Only LDO3 needs a supply?

LDO_VIN1/LDO_VIN2 is real MT6360 pin supply from VSYS to LDO1/2/3/5
LDO_VIN3 is also real pin supply from BUCK2 to LDO6/7

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v3 1/2] regulator: mt6360: Add support for MT6360 regulator
  2020-08-20 11:45     ` Mark Brown
  (?)
@ 2020-08-24 10:23       ` Gene Chen
  -1 siblings, 0 replies; 51+ messages in thread
From: Gene Chen @ 2020-08-24 10:23 UTC (permalink / raw)
  To: Mark Brown
  Cc: Matthias Brugger, robh+dt, lgirdwood, linux-kernel, devicetree,
	linux-arm-kernel, linux-mediatek, Gene Chen

Mark Brown <broonie@kernel.org> 於 2020年8月20日 週四 下午7:45寫道:
>
> On Thu, Aug 20, 2020 at 03:53:41PM +0800, Gene Chen wrote:
>
> > +     mrd->regmap = dev_get_regmap(pdev->dev.parent, NULL);
> > +     if (!mrd->regmap) {
> > +             dev_err(&pdev->dev, "Failed to get parent regmap\n");
> > +             return -ENODEV;
> > +     }
>
> > +static const struct of_device_id __maybe_unused mt6360_regulator_of_id[] = {
> > +     { .compatible = "mediatek,mt6360-regulator", },
> > +     {},
> > +};
> > +MODULE_DEVICE_TABLE(of, mt6360_regulator_of_id);
>
> This device only exists in the context of a single parent device, there
> should be no need for a compatible string here - this is just a detail
> of how Linux does things.  The MFD should just instntiate the platform
> device.

Trying to autoload module without of_id_table will cause run-time error:
ueventd: LoadWithAliases was unable to load
of:NregulatorT(null)Cmediatek,mt6360-regulator

https://lore.kernel.org/patchwork/patch/726691/
According to this patch, autoload can't load module which doesn't
include add id_table or of_id_table in module.alias
So I need keep of_if_table for auto load success

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

* Re: [PATCH v3 1/2] regulator: mt6360: Add support for MT6360 regulator
@ 2020-08-24 10:23       ` Gene Chen
  0 siblings, 0 replies; 51+ messages in thread
From: Gene Chen @ 2020-08-24 10:23 UTC (permalink / raw)
  To: Mark Brown
  Cc: Gene Chen, devicetree, lgirdwood, linux-kernel, robh+dt,
	linux-mediatek, Matthias Brugger, linux-arm-kernel

Mark Brown <broonie@kernel.org> 於 2020年8月20日 週四 下午7:45寫道:
>
> On Thu, Aug 20, 2020 at 03:53:41PM +0800, Gene Chen wrote:
>
> > +     mrd->regmap = dev_get_regmap(pdev->dev.parent, NULL);
> > +     if (!mrd->regmap) {
> > +             dev_err(&pdev->dev, "Failed to get parent regmap\n");
> > +             return -ENODEV;
> > +     }
>
> > +static const struct of_device_id __maybe_unused mt6360_regulator_of_id[] = {
> > +     { .compatible = "mediatek,mt6360-regulator", },
> > +     {},
> > +};
> > +MODULE_DEVICE_TABLE(of, mt6360_regulator_of_id);
>
> This device only exists in the context of a single parent device, there
> should be no need for a compatible string here - this is just a detail
> of how Linux does things.  The MFD should just instntiate the platform
> device.

Trying to autoload module without of_id_table will cause run-time error:
ueventd: LoadWithAliases was unable to load
of:NregulatorT(null)Cmediatek,mt6360-regulator

https://lore.kernel.org/patchwork/patch/726691/
According to this patch, autoload can't load module which doesn't
include add id_table or of_id_table in module.alias
So I need keep of_if_table for auto load success

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

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

* Re: [PATCH v3 1/2] regulator: mt6360: Add support for MT6360 regulator
@ 2020-08-24 10:23       ` Gene Chen
  0 siblings, 0 replies; 51+ messages in thread
From: Gene Chen @ 2020-08-24 10:23 UTC (permalink / raw)
  To: Mark Brown
  Cc: Gene Chen, devicetree, lgirdwood, linux-kernel, robh+dt,
	linux-mediatek, Matthias Brugger, linux-arm-kernel

Mark Brown <broonie@kernel.org> 於 2020年8月20日 週四 下午7:45寫道:
>
> On Thu, Aug 20, 2020 at 03:53:41PM +0800, Gene Chen wrote:
>
> > +     mrd->regmap = dev_get_regmap(pdev->dev.parent, NULL);
> > +     if (!mrd->regmap) {
> > +             dev_err(&pdev->dev, "Failed to get parent regmap\n");
> > +             return -ENODEV;
> > +     }
>
> > +static const struct of_device_id __maybe_unused mt6360_regulator_of_id[] = {
> > +     { .compatible = "mediatek,mt6360-regulator", },
> > +     {},
> > +};
> > +MODULE_DEVICE_TABLE(of, mt6360_regulator_of_id);
>
> This device only exists in the context of a single parent device, there
> should be no need for a compatible string here - this is just a detail
> of how Linux does things.  The MFD should just instntiate the platform
> device.

Trying to autoload module without of_id_table will cause run-time error:
ueventd: LoadWithAliases was unable to load
of:NregulatorT(null)Cmediatek,mt6360-regulator

https://lore.kernel.org/patchwork/patch/726691/
According to this patch, autoload can't load module which doesn't
include add id_table or of_id_table in module.alias
So I need keep of_if_table for auto load success

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v3 1/2] regulator: mt6360: Add support for MT6360 regulator
  2020-08-24 10:23       ` Gene Chen
  (?)
@ 2020-08-24 11:04         ` Mark Brown
  -1 siblings, 0 replies; 51+ messages in thread
From: Mark Brown @ 2020-08-24 11:04 UTC (permalink / raw)
  To: Gene Chen
  Cc: Matthias Brugger, robh+dt, lgirdwood, linux-kernel, devicetree,
	linux-arm-kernel, linux-mediatek, Gene Chen

[-- Attachment #1: Type: text/plain, Size: 691 bytes --]

On Mon, Aug 24, 2020 at 06:23:19PM +0800, Gene Chen wrote:
> Mark Brown <broonie@kernel.org> 於 2020年8月20日 週四 下午7:45寫道:

> > This device only exists in the context of a single parent device, there
> > should be no need for a compatible string here - this is just a detail
> > of how Linux does things.  The MFD should just instntiate the platform
> > device.

> Trying to autoload module without of_id_table will cause run-time error:
> ueventd: LoadWithAliases was unable to load
> of:NregulatorT(null)Cmediatek,mt6360-regulator

You shouldn't have this described in the device tree at all, like I say
the MFD should just instantiate the platform device.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH v3 1/2] regulator: mt6360: Add support for MT6360 regulator
@ 2020-08-24 11:04         ` Mark Brown
  0 siblings, 0 replies; 51+ messages in thread
From: Mark Brown @ 2020-08-24 11:04 UTC (permalink / raw)
  To: Gene Chen
  Cc: Gene Chen, devicetree, lgirdwood, linux-kernel, robh+dt,
	linux-mediatek, Matthias Brugger, linux-arm-kernel


[-- Attachment #1.1: Type: text/plain, Size: 691 bytes --]

On Mon, Aug 24, 2020 at 06:23:19PM +0800, Gene Chen wrote:
> Mark Brown <broonie@kernel.org> 於 2020年8月20日 週四 下午7:45寫道:

> > This device only exists in the context of a single parent device, there
> > should be no need for a compatible string here - this is just a detail
> > of how Linux does things.  The MFD should just instntiate the platform
> > device.

> Trying to autoload module without of_id_table will cause run-time error:
> ueventd: LoadWithAliases was unable to load
> of:NregulatorT(null)Cmediatek,mt6360-regulator

You shouldn't have this described in the device tree at all, like I say
the MFD should just instantiate the platform device.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 170 bytes --]

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

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

* Re: [PATCH v3 1/2] regulator: mt6360: Add support for MT6360 regulator
@ 2020-08-24 11:04         ` Mark Brown
  0 siblings, 0 replies; 51+ messages in thread
From: Mark Brown @ 2020-08-24 11:04 UTC (permalink / raw)
  To: Gene Chen
  Cc: Gene Chen, devicetree, lgirdwood, linux-kernel, robh+dt,
	linux-mediatek, Matthias Brugger, linux-arm-kernel


[-- Attachment #1.1: Type: text/plain, Size: 691 bytes --]

On Mon, Aug 24, 2020 at 06:23:19PM +0800, Gene Chen wrote:
> Mark Brown <broonie@kernel.org> 於 2020年8月20日 週四 下午7:45寫道:

> > This device only exists in the context of a single parent device, there
> > should be no need for a compatible string here - this is just a detail
> > of how Linux does things.  The MFD should just instntiate the platform
> > device.

> Trying to autoload module without of_id_table will cause run-time error:
> ueventd: LoadWithAliases was unable to load
> of:NregulatorT(null)Cmediatek,mt6360-regulator

You shouldn't have this described in the device tree at all, like I say
the MFD should just instantiate the platform device.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v3 2/2] regulator: mt6360: Add DT binding documentation
  2020-08-24  7:21       ` Gene Chen
  (?)
@ 2020-08-24 19:48         ` Mark Brown
  -1 siblings, 0 replies; 51+ messages in thread
From: Mark Brown @ 2020-08-24 19:48 UTC (permalink / raw)
  To: Gene Chen
  Cc: Matthias Brugger, robh+dt, lgirdwood, linux-kernel, devicetree,
	linux-arm-kernel, linux-mediatek, Gene Chen

[-- Attachment #1: Type: text/plain, Size: 417 bytes --]

On Mon, Aug 24, 2020 at 03:21:57PM +0800, Gene Chen wrote:
> > On Thu, Aug 20, 2020 at 03:53:42PM +0800, Gene Chen wrote:

> > > +  LDO_VIN3-supply:
> > > +    description: Input supply phandle(s) for LDO3

> > Only LDO3 needs a supply?

> LDO_VIN1/LDO_VIN2 is real MT6360 pin supply from VSYS to LDO1/2/3/5
> LDO_VIN3 is also real pin supply from BUCK2 to LDO6/7

So shouldn't there be a documented LDO_VIN1/2 then?

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH v3 2/2] regulator: mt6360: Add DT binding documentation
@ 2020-08-24 19:48         ` Mark Brown
  0 siblings, 0 replies; 51+ messages in thread
From: Mark Brown @ 2020-08-24 19:48 UTC (permalink / raw)
  To: Gene Chen
  Cc: Gene Chen, devicetree, lgirdwood, linux-kernel, robh+dt,
	linux-mediatek, Matthias Brugger, linux-arm-kernel


[-- Attachment #1.1: Type: text/plain, Size: 417 bytes --]

On Mon, Aug 24, 2020 at 03:21:57PM +0800, Gene Chen wrote:
> > On Thu, Aug 20, 2020 at 03:53:42PM +0800, Gene Chen wrote:

> > > +  LDO_VIN3-supply:
> > > +    description: Input supply phandle(s) for LDO3

> > Only LDO3 needs a supply?

> LDO_VIN1/LDO_VIN2 is real MT6360 pin supply from VSYS to LDO1/2/3/5
> LDO_VIN3 is also real pin supply from BUCK2 to LDO6/7

So shouldn't there be a documented LDO_VIN1/2 then?

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 170 bytes --]

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

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

* Re: [PATCH v3 2/2] regulator: mt6360: Add DT binding documentation
@ 2020-08-24 19:48         ` Mark Brown
  0 siblings, 0 replies; 51+ messages in thread
From: Mark Brown @ 2020-08-24 19:48 UTC (permalink / raw)
  To: Gene Chen
  Cc: Gene Chen, devicetree, lgirdwood, linux-kernel, robh+dt,
	linux-mediatek, Matthias Brugger, linux-arm-kernel


[-- Attachment #1.1: Type: text/plain, Size: 417 bytes --]

On Mon, Aug 24, 2020 at 03:21:57PM +0800, Gene Chen wrote:
> > On Thu, Aug 20, 2020 at 03:53:42PM +0800, Gene Chen wrote:

> > > +  LDO_VIN3-supply:
> > > +    description: Input supply phandle(s) for LDO3

> > Only LDO3 needs a supply?

> LDO_VIN1/LDO_VIN2 is real MT6360 pin supply from VSYS to LDO1/2/3/5
> LDO_VIN3 is also real pin supply from BUCK2 to LDO6/7

So shouldn't there be a documented LDO_VIN1/2 then?

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v3 1/2] regulator: mt6360: Add support for MT6360 regulator
  2020-08-24 11:04         ` Mark Brown
  (?)
@ 2020-08-25  9:13           ` Gene Chen
  -1 siblings, 0 replies; 51+ messages in thread
From: Gene Chen @ 2020-08-25  9:13 UTC (permalink / raw)
  To: Mark Brown
  Cc: Matthias Brugger, robh+dt, lgirdwood, linux-kernel, devicetree,
	linux-arm-kernel, linux-mediatek, Gene Chen

Mark Brown <broonie@kernel.org> 於 2020年8月24日 週一 下午7:05寫道:



>
> On Mon, Aug 24, 2020 at 06:23:19PM +0800, Gene Chen wrote:
> > Mark Brown <broonie@kernel.org> 於 2020年8月20日 週四 下午7:45寫道:
>
> > > This device only exists in the context of a single parent device, there
> > > should be no need for a compatible string here - this is just a detail
> > > of how Linux does things.  The MFD should just instntiate the platform
> > > device.
>
> > Trying to autoload module without of_id_table will cause run-time error:
> > ueventd: LoadWithAliases was unable to load
> > of:NregulatorT(null)Cmediatek,mt6360-regulator
>
> You shouldn't have this described in the device tree at all, like I say
> the MFD should just instantiate the platform device.

After I replace of_device_id by platform_device_id as below, I can
autoload module.
But I can't get of_node to parse init_data.
Should I use dev->parent->of_node and set
regulator_desc.regulator_node to parse each regulator definition in
device tree?

diff --git a/drivers/mfd/mt6360-core.c b/drivers/mfd/mt6360-core.c
index e995220..444dc8e 100644
--- a/drivers/mfd/mt6360-core.c
+++ b/drivers/mfd/mt6360-core.c
@@ -328,7 +328,7 @@ static const struct mfd_cell mt6360_devs[] = {
        OF_MFD_CELL("mt6360-led", mt6360_led_resources,
                    NULL, 0, 0, "mediatek,mt6360-led"),
        OF_MFD_CELL("mt6360-regulator", mt6360_regulator_resources,
-                   NULL, 0, 0, "mediatek,mt6360-regulator"),
+                   NULL, 0, 0, NULL),
        OF_MFD_CELL("mt6360-tcpc", NULL,
                    NULL, 0, 0, "mediatek,mt6360-tcpc"),
 };
diff --git a/drivers/regulator/mt6360-regulator.c
b/drivers/regulator/mt6360-regulator.c
index 97c16a2..d525bf1 100644
--- a/drivers/regulator/mt6360-regulator.c
+++ b/drivers/regulator/mt6360-regulator.c
@@ -438,11 +438,18 @@ static int mt6360_regulator_probe(struct
platform_device *pdev)
        return 0;
 }

+static const struct platform_device_id mt6360_regulator_id[] = {
+       { "mt6360-regulator", },
+       { },
+};
+MODULE_DEVICE_TABLE(platform, mt6360_regulator_id);
+
 static struct platform_driver mt6360_regulator_driver = {
        .driver = {
                .name = "mt6360-regulator",
        },
        .probe = mt6360_regulator_probe,
+       .id_table = mt6360_regulator_id,
 };

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

* Re: [PATCH v3 1/2] regulator: mt6360: Add support for MT6360 regulator
@ 2020-08-25  9:13           ` Gene Chen
  0 siblings, 0 replies; 51+ messages in thread
From: Gene Chen @ 2020-08-25  9:13 UTC (permalink / raw)
  To: Mark Brown
  Cc: Gene Chen, devicetree, lgirdwood, linux-kernel, robh+dt,
	linux-mediatek, Matthias Brugger, linux-arm-kernel

Mark Brown <broonie@kernel.org> 於 2020年8月24日 週一 下午7:05寫道:



>
> On Mon, Aug 24, 2020 at 06:23:19PM +0800, Gene Chen wrote:
> > Mark Brown <broonie@kernel.org> 於 2020年8月20日 週四 下午7:45寫道:
>
> > > This device only exists in the context of a single parent device, there
> > > should be no need for a compatible string here - this is just a detail
> > > of how Linux does things.  The MFD should just instntiate the platform
> > > device.
>
> > Trying to autoload module without of_id_table will cause run-time error:
> > ueventd: LoadWithAliases was unable to load
> > of:NregulatorT(null)Cmediatek,mt6360-regulator
>
> You shouldn't have this described in the device tree at all, like I say
> the MFD should just instantiate the platform device.

After I replace of_device_id by platform_device_id as below, I can
autoload module.
But I can't get of_node to parse init_data.
Should I use dev->parent->of_node and set
regulator_desc.regulator_node to parse each regulator definition in
device tree?

diff --git a/drivers/mfd/mt6360-core.c b/drivers/mfd/mt6360-core.c
index e995220..444dc8e 100644
--- a/drivers/mfd/mt6360-core.c
+++ b/drivers/mfd/mt6360-core.c
@@ -328,7 +328,7 @@ static const struct mfd_cell mt6360_devs[] = {
        OF_MFD_CELL("mt6360-led", mt6360_led_resources,
                    NULL, 0, 0, "mediatek,mt6360-led"),
        OF_MFD_CELL("mt6360-regulator", mt6360_regulator_resources,
-                   NULL, 0, 0, "mediatek,mt6360-regulator"),
+                   NULL, 0, 0, NULL),
        OF_MFD_CELL("mt6360-tcpc", NULL,
                    NULL, 0, 0, "mediatek,mt6360-tcpc"),
 };
diff --git a/drivers/regulator/mt6360-regulator.c
b/drivers/regulator/mt6360-regulator.c
index 97c16a2..d525bf1 100644
--- a/drivers/regulator/mt6360-regulator.c
+++ b/drivers/regulator/mt6360-regulator.c
@@ -438,11 +438,18 @@ static int mt6360_regulator_probe(struct
platform_device *pdev)
        return 0;
 }

+static const struct platform_device_id mt6360_regulator_id[] = {
+       { "mt6360-regulator", },
+       { },
+};
+MODULE_DEVICE_TABLE(platform, mt6360_regulator_id);
+
 static struct platform_driver mt6360_regulator_driver = {
        .driver = {
                .name = "mt6360-regulator",
        },
        .probe = mt6360_regulator_probe,
+       .id_table = mt6360_regulator_id,
 };

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

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

* Re: [PATCH v3 1/2] regulator: mt6360: Add support for MT6360 regulator
@ 2020-08-25  9:13           ` Gene Chen
  0 siblings, 0 replies; 51+ messages in thread
From: Gene Chen @ 2020-08-25  9:13 UTC (permalink / raw)
  To: Mark Brown
  Cc: Gene Chen, devicetree, lgirdwood, linux-kernel, robh+dt,
	linux-mediatek, Matthias Brugger, linux-arm-kernel

Mark Brown <broonie@kernel.org> 於 2020年8月24日 週一 下午7:05寫道:



>
> On Mon, Aug 24, 2020 at 06:23:19PM +0800, Gene Chen wrote:
> > Mark Brown <broonie@kernel.org> 於 2020年8月20日 週四 下午7:45寫道:
>
> > > This device only exists in the context of a single parent device, there
> > > should be no need for a compatible string here - this is just a detail
> > > of how Linux does things.  The MFD should just instntiate the platform
> > > device.
>
> > Trying to autoload module without of_id_table will cause run-time error:
> > ueventd: LoadWithAliases was unable to load
> > of:NregulatorT(null)Cmediatek,mt6360-regulator
>
> You shouldn't have this described in the device tree at all, like I say
> the MFD should just instantiate the platform device.

After I replace of_device_id by platform_device_id as below, I can
autoload module.
But I can't get of_node to parse init_data.
Should I use dev->parent->of_node and set
regulator_desc.regulator_node to parse each regulator definition in
device tree?

diff --git a/drivers/mfd/mt6360-core.c b/drivers/mfd/mt6360-core.c
index e995220..444dc8e 100644
--- a/drivers/mfd/mt6360-core.c
+++ b/drivers/mfd/mt6360-core.c
@@ -328,7 +328,7 @@ static const struct mfd_cell mt6360_devs[] = {
        OF_MFD_CELL("mt6360-led", mt6360_led_resources,
                    NULL, 0, 0, "mediatek,mt6360-led"),
        OF_MFD_CELL("mt6360-regulator", mt6360_regulator_resources,
-                   NULL, 0, 0, "mediatek,mt6360-regulator"),
+                   NULL, 0, 0, NULL),
        OF_MFD_CELL("mt6360-tcpc", NULL,
                    NULL, 0, 0, "mediatek,mt6360-tcpc"),
 };
diff --git a/drivers/regulator/mt6360-regulator.c
b/drivers/regulator/mt6360-regulator.c
index 97c16a2..d525bf1 100644
--- a/drivers/regulator/mt6360-regulator.c
+++ b/drivers/regulator/mt6360-regulator.c
@@ -438,11 +438,18 @@ static int mt6360_regulator_probe(struct
platform_device *pdev)
        return 0;
 }

+static const struct platform_device_id mt6360_regulator_id[] = {
+       { "mt6360-regulator", },
+       { },
+};
+MODULE_DEVICE_TABLE(platform, mt6360_regulator_id);
+
 static struct platform_driver mt6360_regulator_driver = {
        .driver = {
                .name = "mt6360-regulator",
        },
        .probe = mt6360_regulator_probe,
+       .id_table = mt6360_regulator_id,
 };

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v3 2/2] regulator: mt6360: Add DT binding documentation
  2020-08-24 19:48         ` Mark Brown
  (?)
@ 2020-08-25  9:21           ` Gene Chen
  -1 siblings, 0 replies; 51+ messages in thread
From: Gene Chen @ 2020-08-25  9:21 UTC (permalink / raw)
  To: Mark Brown
  Cc: Matthias Brugger, robh+dt, lgirdwood, linux-kernel, devicetree,
	linux-arm-kernel, linux-mediatek, Gene Chen

Mark Brown <broonie@kernel.org> 於 2020年8月25日 週二 上午3:49寫道:
>
> On Mon, Aug 24, 2020 at 03:21:57PM +0800, Gene Chen wrote:
> > > On Thu, Aug 20, 2020 at 03:53:42PM +0800, Gene Chen wrote:
>
> > > > +  LDO_VIN3-supply:
> > > > +    description: Input supply phandle(s) for LDO3
>
> > > Only LDO3 needs a supply?
>
> > LDO_VIN1/LDO_VIN2 is real MT6360 pin supply from VSYS to LDO1/2/3/5
> > LDO_VIN3 is also real pin supply from BUCK2 to LDO6/7
>
> So shouldn't there be a documented LDO_VIN1/2 then?

LDO_VINx is HW design layout, so actually it can't be changed by device tree.
LDO_VIN1/LDO_VIN2 supply from VSYS, not regulator, so I think usually
not to show the supply from in device tree.
or I should declare a dummy reference to system power like "*-supply =
<&system_power>;"?

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

* Re: [PATCH v3 2/2] regulator: mt6360: Add DT binding documentation
@ 2020-08-25  9:21           ` Gene Chen
  0 siblings, 0 replies; 51+ messages in thread
From: Gene Chen @ 2020-08-25  9:21 UTC (permalink / raw)
  To: Mark Brown
  Cc: Gene Chen, devicetree, lgirdwood, linux-kernel, robh+dt,
	linux-mediatek, Matthias Brugger, linux-arm-kernel

Mark Brown <broonie@kernel.org> 於 2020年8月25日 週二 上午3:49寫道:
>
> On Mon, Aug 24, 2020 at 03:21:57PM +0800, Gene Chen wrote:
> > > On Thu, Aug 20, 2020 at 03:53:42PM +0800, Gene Chen wrote:
>
> > > > +  LDO_VIN3-supply:
> > > > +    description: Input supply phandle(s) for LDO3
>
> > > Only LDO3 needs a supply?
>
> > LDO_VIN1/LDO_VIN2 is real MT6360 pin supply from VSYS to LDO1/2/3/5
> > LDO_VIN3 is also real pin supply from BUCK2 to LDO6/7
>
> So shouldn't there be a documented LDO_VIN1/2 then?

LDO_VINx is HW design layout, so actually it can't be changed by device tree.
LDO_VIN1/LDO_VIN2 supply from VSYS, not regulator, so I think usually
not to show the supply from in device tree.
or I should declare a dummy reference to system power like "*-supply =
<&system_power>;"?

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

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

* Re: [PATCH v3 2/2] regulator: mt6360: Add DT binding documentation
@ 2020-08-25  9:21           ` Gene Chen
  0 siblings, 0 replies; 51+ messages in thread
From: Gene Chen @ 2020-08-25  9:21 UTC (permalink / raw)
  To: Mark Brown
  Cc: Gene Chen, devicetree, lgirdwood, linux-kernel, robh+dt,
	linux-mediatek, Matthias Brugger, linux-arm-kernel

Mark Brown <broonie@kernel.org> 於 2020年8月25日 週二 上午3:49寫道:
>
> On Mon, Aug 24, 2020 at 03:21:57PM +0800, Gene Chen wrote:
> > > On Thu, Aug 20, 2020 at 03:53:42PM +0800, Gene Chen wrote:
>
> > > > +  LDO_VIN3-supply:
> > > > +    description: Input supply phandle(s) for LDO3
>
> > > Only LDO3 needs a supply?
>
> > LDO_VIN1/LDO_VIN2 is real MT6360 pin supply from VSYS to LDO1/2/3/5
> > LDO_VIN3 is also real pin supply from BUCK2 to LDO6/7
>
> So shouldn't there be a documented LDO_VIN1/2 then?

LDO_VINx is HW design layout, so actually it can't be changed by device tree.
LDO_VIN1/LDO_VIN2 supply from VSYS, not regulator, so I think usually
not to show the supply from in device tree.
or I should declare a dummy reference to system power like "*-supply =
<&system_power>;"?

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v3 1/2] regulator: mt6360: Add support for MT6360 regulator
  2020-08-25  9:13           ` Gene Chen
  (?)
@ 2020-08-25  9:26             ` Mark Brown
  -1 siblings, 0 replies; 51+ messages in thread
From: Mark Brown @ 2020-08-25  9:26 UTC (permalink / raw)
  To: Gene Chen
  Cc: Matthias Brugger, robh+dt, lgirdwood, linux-kernel, devicetree,
	linux-arm-kernel, linux-mediatek, Gene Chen

[-- Attachment #1: Type: text/plain, Size: 195 bytes --]

On Tue, Aug 25, 2020 at 05:13:43PM +0800, Gene Chen wrote:

> Should I use dev->parent->of_node and set
> regulator_desc.regulator_node to parse each regulator definition in
> device tree?

Yes.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH v3 1/2] regulator: mt6360: Add support for MT6360 regulator
@ 2020-08-25  9:26             ` Mark Brown
  0 siblings, 0 replies; 51+ messages in thread
From: Mark Brown @ 2020-08-25  9:26 UTC (permalink / raw)
  To: Gene Chen
  Cc: Gene Chen, devicetree, lgirdwood, linux-kernel, robh+dt,
	linux-mediatek, Matthias Brugger, linux-arm-kernel


[-- Attachment #1.1: Type: text/plain, Size: 195 bytes --]

On Tue, Aug 25, 2020 at 05:13:43PM +0800, Gene Chen wrote:

> Should I use dev->parent->of_node and set
> regulator_desc.regulator_node to parse each regulator definition in
> device tree?

Yes.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 170 bytes --]

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

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

* Re: [PATCH v3 1/2] regulator: mt6360: Add support for MT6360 regulator
@ 2020-08-25  9:26             ` Mark Brown
  0 siblings, 0 replies; 51+ messages in thread
From: Mark Brown @ 2020-08-25  9:26 UTC (permalink / raw)
  To: Gene Chen
  Cc: Gene Chen, devicetree, lgirdwood, linux-kernel, robh+dt,
	linux-mediatek, Matthias Brugger, linux-arm-kernel


[-- Attachment #1.1: Type: text/plain, Size: 195 bytes --]

On Tue, Aug 25, 2020 at 05:13:43PM +0800, Gene Chen wrote:

> Should I use dev->parent->of_node and set
> regulator_desc.regulator_node to parse each regulator definition in
> device tree?

Yes.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v3 2/2] regulator: mt6360: Add DT binding documentation
  2020-08-25  9:21           ` Gene Chen
  (?)
@ 2020-08-25  9:34             ` Mark Brown
  -1 siblings, 0 replies; 51+ messages in thread
From: Mark Brown @ 2020-08-25  9:34 UTC (permalink / raw)
  To: Gene Chen
  Cc: Matthias Brugger, robh+dt, lgirdwood, linux-kernel, devicetree,
	linux-arm-kernel, linux-mediatek, Gene Chen

[-- Attachment #1: Type: text/plain, Size: 634 bytes --]

On Tue, Aug 25, 2020 at 05:21:06PM +0800, Gene Chen wrote:
> Mark Brown <broonie@kernel.org> 於 2020年8月25日 週二 上午3:49寫道:

> > So shouldn't there be a documented LDO_VIN1/2 then?

> LDO_VINx is HW design layout, so actually it can't be changed by device tree.
> LDO_VIN1/LDO_VIN2 supply from VSYS, not regulator, so I think usually
> not to show the supply from in device tree.
> or I should declare a dummy reference to system power like "*-supply =
> <&system_power>;"?

When you say it's from the hardware design do you mean it's fixed by the
silicon or is this something that's fixed in the board?

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH v3 2/2] regulator: mt6360: Add DT binding documentation
@ 2020-08-25  9:34             ` Mark Brown
  0 siblings, 0 replies; 51+ messages in thread
From: Mark Brown @ 2020-08-25  9:34 UTC (permalink / raw)
  To: Gene Chen
  Cc: Gene Chen, devicetree, lgirdwood, linux-kernel, robh+dt,
	linux-mediatek, Matthias Brugger, linux-arm-kernel


[-- Attachment #1.1: Type: text/plain, Size: 634 bytes --]

On Tue, Aug 25, 2020 at 05:21:06PM +0800, Gene Chen wrote:
> Mark Brown <broonie@kernel.org> 於 2020年8月25日 週二 上午3:49寫道:

> > So shouldn't there be a documented LDO_VIN1/2 then?

> LDO_VINx is HW design layout, so actually it can't be changed by device tree.
> LDO_VIN1/LDO_VIN2 supply from VSYS, not regulator, so I think usually
> not to show the supply from in device tree.
> or I should declare a dummy reference to system power like "*-supply =
> <&system_power>;"?

When you say it's from the hardware design do you mean it's fixed by the
silicon or is this something that's fixed in the board?

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 170 bytes --]

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

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

* Re: [PATCH v3 2/2] regulator: mt6360: Add DT binding documentation
@ 2020-08-25  9:34             ` Mark Brown
  0 siblings, 0 replies; 51+ messages in thread
From: Mark Brown @ 2020-08-25  9:34 UTC (permalink / raw)
  To: Gene Chen
  Cc: Gene Chen, devicetree, lgirdwood, linux-kernel, robh+dt,
	linux-mediatek, Matthias Brugger, linux-arm-kernel


[-- Attachment #1.1: Type: text/plain, Size: 634 bytes --]

On Tue, Aug 25, 2020 at 05:21:06PM +0800, Gene Chen wrote:
> Mark Brown <broonie@kernel.org> 於 2020年8月25日 週二 上午3:49寫道:

> > So shouldn't there be a documented LDO_VIN1/2 then?

> LDO_VINx is HW design layout, so actually it can't be changed by device tree.
> LDO_VIN1/LDO_VIN2 supply from VSYS, not regulator, so I think usually
> not to show the supply from in device tree.
> or I should declare a dummy reference to system power like "*-supply =
> <&system_power>;"?

When you say it's from the hardware design do you mean it's fixed by the
silicon or is this something that's fixed in the board?

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v3 2/2] regulator: mt6360: Add DT binding documentation
  2020-08-25  9:34             ` Mark Brown
  (?)
@ 2020-08-25 10:01               ` Gene Chen
  -1 siblings, 0 replies; 51+ messages in thread
From: Gene Chen @ 2020-08-25 10:01 UTC (permalink / raw)
  To: Mark Brown
  Cc: Matthias Brugger, robh+dt, lgirdwood, linux-kernel, devicetree,
	linux-arm-kernel, linux-mediatek, Gene Chen

Mark Brown <broonie@kernel.org> 於 2020年8月25日 週二 下午5:34寫道:
>
> On Tue, Aug 25, 2020 at 05:21:06PM +0800, Gene Chen wrote:
> > Mark Brown <broonie@kernel.org> 於 2020年8月25日 週二 上午3:49寫道:
>
> > > So shouldn't there be a documented LDO_VIN1/2 then?
>
> > LDO_VINx is HW design layout, so actually it can't be changed by device tree.
> > LDO_VIN1/LDO_VIN2 supply from VSYS, not regulator, so I think usually
> > not to show the supply from in device tree.
> > or I should declare a dummy reference to system power like "*-supply =
> > <&system_power>;"?
>
> When you say it's from the hardware design do you mean it's fixed by the
> silicon or is this something that's fixed in the board?

fixed in the board, not silicon.

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

* Re: [PATCH v3 2/2] regulator: mt6360: Add DT binding documentation
@ 2020-08-25 10:01               ` Gene Chen
  0 siblings, 0 replies; 51+ messages in thread
From: Gene Chen @ 2020-08-25 10:01 UTC (permalink / raw)
  To: Mark Brown
  Cc: Gene Chen, devicetree, lgirdwood, linux-kernel, robh+dt,
	linux-mediatek, Matthias Brugger, linux-arm-kernel

Mark Brown <broonie@kernel.org> 於 2020年8月25日 週二 下午5:34寫道:
>
> On Tue, Aug 25, 2020 at 05:21:06PM +0800, Gene Chen wrote:
> > Mark Brown <broonie@kernel.org> 於 2020年8月25日 週二 上午3:49寫道:
>
> > > So shouldn't there be a documented LDO_VIN1/2 then?
>
> > LDO_VINx is HW design layout, so actually it can't be changed by device tree.
> > LDO_VIN1/LDO_VIN2 supply from VSYS, not regulator, so I think usually
> > not to show the supply from in device tree.
> > or I should declare a dummy reference to system power like "*-supply =
> > <&system_power>;"?
>
> When you say it's from the hardware design do you mean it's fixed by the
> silicon or is this something that's fixed in the board?

fixed in the board, not silicon.

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

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

* Re: [PATCH v3 2/2] regulator: mt6360: Add DT binding documentation
@ 2020-08-25 10:01               ` Gene Chen
  0 siblings, 0 replies; 51+ messages in thread
From: Gene Chen @ 2020-08-25 10:01 UTC (permalink / raw)
  To: Mark Brown
  Cc: Gene Chen, devicetree, lgirdwood, linux-kernel, robh+dt,
	linux-mediatek, Matthias Brugger, linux-arm-kernel

Mark Brown <broonie@kernel.org> 於 2020年8月25日 週二 下午5:34寫道:
>
> On Tue, Aug 25, 2020 at 05:21:06PM +0800, Gene Chen wrote:
> > Mark Brown <broonie@kernel.org> 於 2020年8月25日 週二 上午3:49寫道:
>
> > > So shouldn't there be a documented LDO_VIN1/2 then?
>
> > LDO_VINx is HW design layout, so actually it can't be changed by device tree.
> > LDO_VIN1/LDO_VIN2 supply from VSYS, not regulator, so I think usually
> > not to show the supply from in device tree.
> > or I should declare a dummy reference to system power like "*-supply =
> > <&system_power>;"?
>
> When you say it's from the hardware design do you mean it's fixed by the
> silicon or is this something that's fixed in the board?

fixed in the board, not silicon.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v3 2/2] regulator: mt6360: Add DT binding documentation
  2020-08-25 10:01               ` Gene Chen
  (?)
@ 2020-08-25 10:08                 ` Mark Brown
  -1 siblings, 0 replies; 51+ messages in thread
From: Mark Brown @ 2020-08-25 10:08 UTC (permalink / raw)
  To: Gene Chen
  Cc: Matthias Brugger, robh+dt, lgirdwood, linux-kernel, devicetree,
	linux-arm-kernel, linux-mediatek, Gene Chen

[-- Attachment #1: Type: text/plain, Size: 1122 bytes --]

On Tue, Aug 25, 2020 at 06:01:46PM +0800, Gene Chen wrote:
> Mark Brown <broonie@kernel.org> 於 2020年8月25日 週二 下午5:34寫道:

> > > LDO_VINx is HW design layout, so actually it can't be changed by device tree.
> > > LDO_VIN1/LDO_VIN2 supply from VSYS, not regulator, so I think usually
> > > not to show the supply from in device tree.
> > > or I should declare a dummy reference to system power like "*-supply =
> > > <&system_power>;"?

> > When you say it's from the hardware design do you mean it's fixed by the
> > silicon or is this something that's fixed in the board?

> fixed in the board, not silicon.

Ah, if it's fixed by the board that's exactly the sort of thing that
should be in DT - the DT describes the board so if some other system has
a different configuration then it will have a different DT.  With supply
properties you can just leave them missing in the DT, you're not
supposed to but so many systems do it that the framework will handle it.
Otherwise if you want to represent VSYS you can have a fixed voltage
regulator with no control and hook them up to it.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH v3 2/2] regulator: mt6360: Add DT binding documentation
@ 2020-08-25 10:08                 ` Mark Brown
  0 siblings, 0 replies; 51+ messages in thread
From: Mark Brown @ 2020-08-25 10:08 UTC (permalink / raw)
  To: Gene Chen
  Cc: Gene Chen, devicetree, lgirdwood, linux-kernel, robh+dt,
	linux-mediatek, Matthias Brugger, linux-arm-kernel


[-- Attachment #1.1: Type: text/plain, Size: 1122 bytes --]

On Tue, Aug 25, 2020 at 06:01:46PM +0800, Gene Chen wrote:
> Mark Brown <broonie@kernel.org> 於 2020年8月25日 週二 下午5:34寫道:

> > > LDO_VINx is HW design layout, so actually it can't be changed by device tree.
> > > LDO_VIN1/LDO_VIN2 supply from VSYS, not regulator, so I think usually
> > > not to show the supply from in device tree.
> > > or I should declare a dummy reference to system power like "*-supply =
> > > <&system_power>;"?

> > When you say it's from the hardware design do you mean it's fixed by the
> > silicon or is this something that's fixed in the board?

> fixed in the board, not silicon.

Ah, if it's fixed by the board that's exactly the sort of thing that
should be in DT - the DT describes the board so if some other system has
a different configuration then it will have a different DT.  With supply
properties you can just leave them missing in the DT, you're not
supposed to but so many systems do it that the framework will handle it.
Otherwise if you want to represent VSYS you can have a fixed voltage
regulator with no control and hook them up to it.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 170 bytes --]

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

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

* Re: [PATCH v3 2/2] regulator: mt6360: Add DT binding documentation
@ 2020-08-25 10:08                 ` Mark Brown
  0 siblings, 0 replies; 51+ messages in thread
From: Mark Brown @ 2020-08-25 10:08 UTC (permalink / raw)
  To: Gene Chen
  Cc: Gene Chen, devicetree, lgirdwood, linux-kernel, robh+dt,
	linux-mediatek, Matthias Brugger, linux-arm-kernel


[-- Attachment #1.1: Type: text/plain, Size: 1122 bytes --]

On Tue, Aug 25, 2020 at 06:01:46PM +0800, Gene Chen wrote:
> Mark Brown <broonie@kernel.org> 於 2020年8月25日 週二 下午5:34寫道:

> > > LDO_VINx is HW design layout, so actually it can't be changed by device tree.
> > > LDO_VIN1/LDO_VIN2 supply from VSYS, not regulator, so I think usually
> > > not to show the supply from in device tree.
> > > or I should declare a dummy reference to system power like "*-supply =
> > > <&system_power>;"?

> > When you say it's from the hardware design do you mean it's fixed by the
> > silicon or is this something that's fixed in the board?

> fixed in the board, not silicon.

Ah, if it's fixed by the board that's exactly the sort of thing that
should be in DT - the DT describes the board so if some other system has
a different configuration then it will have a different DT.  With supply
properties you can just leave them missing in the DT, you're not
supposed to but so many systems do it that the framework will handle it.
Otherwise if you want to represent VSYS you can have a fixed voltage
regulator with no control and hook them up to it.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v3 2/2] regulator: mt6360: Add DT binding documentation
  2020-08-25 10:08                 ` Mark Brown
  (?)
@ 2020-08-25 11:07                   ` Gene Chen
  -1 siblings, 0 replies; 51+ messages in thread
From: Gene Chen @ 2020-08-25 11:07 UTC (permalink / raw)
  To: Mark Brown
  Cc: Matthias Brugger, robh+dt, lgirdwood, linux-kernel, devicetree,
	linux-arm-kernel, linux-mediatek, Gene Chen

Mark Brown <broonie@kernel.org> 於 2020年8月25日 週二 下午6:08寫道:
>
> On Tue, Aug 25, 2020 at 06:01:46PM +0800, Gene Chen wrote:
> > Mark Brown <broonie@kernel.org> 於 2020年8月25日 週二 下午5:34寫道:
>
> > > > LDO_VINx is HW design layout, so actually it can't be changed by device tree.
> > > > LDO_VIN1/LDO_VIN2 supply from VSYS, not regulator, so I think usually
> > > > not to show the supply from in device tree.
> > > > or I should declare a dummy reference to system power like "*-supply =
> > > > <&system_power>;"?
>
> > > When you say it's from the hardware design do you mean it's fixed by the
> > > silicon or is this something that's fixed in the board?
>
> > fixed in the board, not silicon.
>
> Ah, if it's fixed by the board that's exactly the sort of thing that
> should be in DT - the DT describes the board so if some other system has
> a different configuration then it will have a different DT.  With supply
> properties you can just leave them missing in the DT, you're not
> supposed to but so many systems do it that the framework will handle it.
> Otherwise if you want to represent VSYS you can have a fixed voltage
> regulator with no control and hook them up to it.

ok, I think I will follow the framework to handle it.
I will add supply description in devicetree
  LDO_VIN1-supply:
    description: Input supply phandle(s) for LDO1/2/3 which is supply from VSYS
  LDO_VIN2-supply:
    description: Input supply phandle(s) for LDO5 which is supply from
VSYS
  LDO_VIN3-supply:
    description: Input supply phandle(s) for LDO6/7

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

* Re: [PATCH v3 2/2] regulator: mt6360: Add DT binding documentation
@ 2020-08-25 11:07                   ` Gene Chen
  0 siblings, 0 replies; 51+ messages in thread
From: Gene Chen @ 2020-08-25 11:07 UTC (permalink / raw)
  To: Mark Brown
  Cc: Gene Chen, devicetree, lgirdwood, linux-kernel, robh+dt,
	linux-mediatek, Matthias Brugger, linux-arm-kernel

Mark Brown <broonie@kernel.org> 於 2020年8月25日 週二 下午6:08寫道:
>
> On Tue, Aug 25, 2020 at 06:01:46PM +0800, Gene Chen wrote:
> > Mark Brown <broonie@kernel.org> 於 2020年8月25日 週二 下午5:34寫道:
>
> > > > LDO_VINx is HW design layout, so actually it can't be changed by device tree.
> > > > LDO_VIN1/LDO_VIN2 supply from VSYS, not regulator, so I think usually
> > > > not to show the supply from in device tree.
> > > > or I should declare a dummy reference to system power like "*-supply =
> > > > <&system_power>;"?
>
> > > When you say it's from the hardware design do you mean it's fixed by the
> > > silicon or is this something that's fixed in the board?
>
> > fixed in the board, not silicon.
>
> Ah, if it's fixed by the board that's exactly the sort of thing that
> should be in DT - the DT describes the board so if some other system has
> a different configuration then it will have a different DT.  With supply
> properties you can just leave them missing in the DT, you're not
> supposed to but so many systems do it that the framework will handle it.
> Otherwise if you want to represent VSYS you can have a fixed voltage
> regulator with no control and hook them up to it.

ok, I think I will follow the framework to handle it.
I will add supply description in devicetree
  LDO_VIN1-supply:
    description: Input supply phandle(s) for LDO1/2/3 which is supply from VSYS
  LDO_VIN2-supply:
    description: Input supply phandle(s) for LDO5 which is supply from
VSYS
  LDO_VIN3-supply:
    description: Input supply phandle(s) for LDO6/7

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

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

* Re: [PATCH v3 2/2] regulator: mt6360: Add DT binding documentation
@ 2020-08-25 11:07                   ` Gene Chen
  0 siblings, 0 replies; 51+ messages in thread
From: Gene Chen @ 2020-08-25 11:07 UTC (permalink / raw)
  To: Mark Brown
  Cc: Gene Chen, devicetree, lgirdwood, linux-kernel, robh+dt,
	linux-mediatek, Matthias Brugger, linux-arm-kernel

Mark Brown <broonie@kernel.org> 於 2020年8月25日 週二 下午6:08寫道:
>
> On Tue, Aug 25, 2020 at 06:01:46PM +0800, Gene Chen wrote:
> > Mark Brown <broonie@kernel.org> 於 2020年8月25日 週二 下午5:34寫道:
>
> > > > LDO_VINx is HW design layout, so actually it can't be changed by device tree.
> > > > LDO_VIN1/LDO_VIN2 supply from VSYS, not regulator, so I think usually
> > > > not to show the supply from in device tree.
> > > > or I should declare a dummy reference to system power like "*-supply =
> > > > <&system_power>;"?
>
> > > When you say it's from the hardware design do you mean it's fixed by the
> > > silicon or is this something that's fixed in the board?
>
> > fixed in the board, not silicon.
>
> Ah, if it's fixed by the board that's exactly the sort of thing that
> should be in DT - the DT describes the board so if some other system has
> a different configuration then it will have a different DT.  With supply
> properties you can just leave them missing in the DT, you're not
> supposed to but so many systems do it that the framework will handle it.
> Otherwise if you want to represent VSYS you can have a fixed voltage
> regulator with no control and hook them up to it.

ok, I think I will follow the framework to handle it.
I will add supply description in devicetree
  LDO_VIN1-supply:
    description: Input supply phandle(s) for LDO1/2/3 which is supply from VSYS
  LDO_VIN2-supply:
    description: Input supply phandle(s) for LDO5 which is supply from
VSYS
  LDO_VIN3-supply:
    description: Input supply phandle(s) for LDO6/7

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v3 0/2] regulator: mt6360: Add support for MT6360 regulator
  2020-08-20  7:53 ` Gene Chen
  (?)
@ 2020-08-26 12:55   ` Mark Brown
  -1 siblings, 0 replies; 51+ messages in thread
From: Mark Brown @ 2020-08-26 12:55 UTC (permalink / raw)
  To: robh+dt, Gene Chen, matthias.bgg
  Cc: linux-kernel, lgirdwood, linux-arm-kernel, linux-mediatek, devicetree

On Thu, 20 Aug 2020 15:53:40 +0800, Gene Chen wrote:
> This patch series add MT6360 regulator support contains driver and binding document
> 
> Gene Chen (2)
>   regulator: mt6360: Add support for MT6360 regulator
>   regulator: mt6360: Add DT binding documentation
> 
>  Documentation/devicetree/bindings/regulator/mt6360-regulator.yaml |  109 ++
>  drivers/regulator/Kconfig                                         |    9
>  drivers/regulator/Makefile                                        |    1
>  drivers/regulator/mt6360-regulator.c                              |  458 ++++++++++
>  include/dt-bindings/regulator/mediatek,mt6360-regulator.h         |   16
>  5 files changed, 593 insertions(+)
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next

Thanks!

[1/2] regulator: mt6360: Add support for MT6360 regulator
      commit: d321571d5e4c2d5511b75e6cf1a910e0a0c2a2e9
[2/2] regulator: mt6360: Add DT binding documentation
      (no commit info)

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

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

* Re: [PATCH v3 0/2] regulator: mt6360: Add support for MT6360 regulator
@ 2020-08-26 12:55   ` Mark Brown
  0 siblings, 0 replies; 51+ messages in thread
From: Mark Brown @ 2020-08-26 12:55 UTC (permalink / raw)
  To: robh+dt, Gene Chen, matthias.bgg
  Cc: devicetree, linux-mediatek, linux-kernel, linux-arm-kernel, lgirdwood

On Thu, 20 Aug 2020 15:53:40 +0800, Gene Chen wrote:
> This patch series add MT6360 regulator support contains driver and binding document
> 
> Gene Chen (2)
>   regulator: mt6360: Add support for MT6360 regulator
>   regulator: mt6360: Add DT binding documentation
> 
>  Documentation/devicetree/bindings/regulator/mt6360-regulator.yaml |  109 ++
>  drivers/regulator/Kconfig                                         |    9
>  drivers/regulator/Makefile                                        |    1
>  drivers/regulator/mt6360-regulator.c                              |  458 ++++++++++
>  include/dt-bindings/regulator/mediatek,mt6360-regulator.h         |   16
>  5 files changed, 593 insertions(+)
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next

Thanks!

[1/2] regulator: mt6360: Add support for MT6360 regulator
      commit: d321571d5e4c2d5511b75e6cf1a910e0a0c2a2e9
[2/2] regulator: mt6360: Add DT binding documentation
      (no commit info)

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

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

* Re: [PATCH v3 0/2] regulator: mt6360: Add support for MT6360 regulator
@ 2020-08-26 12:55   ` Mark Brown
  0 siblings, 0 replies; 51+ messages in thread
From: Mark Brown @ 2020-08-26 12:55 UTC (permalink / raw)
  To: robh+dt, Gene Chen, matthias.bgg
  Cc: devicetree, linux-mediatek, linux-kernel, linux-arm-kernel, lgirdwood

On Thu, 20 Aug 2020 15:53:40 +0800, Gene Chen wrote:
> This patch series add MT6360 regulator support contains driver and binding document
> 
> Gene Chen (2)
>   regulator: mt6360: Add support for MT6360 regulator
>   regulator: mt6360: Add DT binding documentation
> 
>  Documentation/devicetree/bindings/regulator/mt6360-regulator.yaml |  109 ++
>  drivers/regulator/Kconfig                                         |    9
>  drivers/regulator/Makefile                                        |    1
>  drivers/regulator/mt6360-regulator.c                              |  458 ++++++++++
>  include/dt-bindings/regulator/mediatek,mt6360-regulator.h         |   16
>  5 files changed, 593 insertions(+)
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next

Thanks!

[1/2] regulator: mt6360: Add support for MT6360 regulator
      commit: d321571d5e4c2d5511b75e6cf1a910e0a0c2a2e9
[2/2] regulator: mt6360: Add DT binding documentation
      (no commit info)

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2020-08-26 12:58 UTC | newest]

Thread overview: 51+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-20  7:53 [PATCH v3 0/2] regulator: mt6360: Add support for MT6360 regulator Gene Chen
2020-08-20  7:53 ` Gene Chen
2020-08-20  7:53 ` Gene Chen
2020-08-20  7:53 ` [PATCH v3 1/2] " Gene Chen
2020-08-20  7:53   ` Gene Chen
2020-08-20  7:53   ` Gene Chen
2020-08-20 11:45   ` Mark Brown
2020-08-20 11:45     ` Mark Brown
2020-08-20 11:45     ` Mark Brown
2020-08-24 10:23     ` Gene Chen
2020-08-24 10:23       ` Gene Chen
2020-08-24 10:23       ` Gene Chen
2020-08-24 11:04       ` Mark Brown
2020-08-24 11:04         ` Mark Brown
2020-08-24 11:04         ` Mark Brown
2020-08-25  9:13         ` Gene Chen
2020-08-25  9:13           ` Gene Chen
2020-08-25  9:13           ` Gene Chen
2020-08-25  9:26           ` Mark Brown
2020-08-25  9:26             ` Mark Brown
2020-08-25  9:26             ` Mark Brown
2020-08-20  7:53 ` [PATCH v3 2/2] regulator: mt6360: Add DT binding documentation Gene Chen
2020-08-20  7:53   ` Gene Chen
2020-08-20  7:53   ` Gene Chen
2020-08-20 11:30   ` Mark Brown
2020-08-20 11:30     ` Mark Brown
2020-08-20 11:30     ` Mark Brown
2020-08-24  7:21     ` Gene Chen
2020-08-24  7:21       ` Gene Chen
2020-08-24  7:21       ` Gene Chen
2020-08-24 19:48       ` Mark Brown
2020-08-24 19:48         ` Mark Brown
2020-08-24 19:48         ` Mark Brown
2020-08-25  9:21         ` Gene Chen
2020-08-25  9:21           ` Gene Chen
2020-08-25  9:21           ` Gene Chen
2020-08-25  9:34           ` Mark Brown
2020-08-25  9:34             ` Mark Brown
2020-08-25  9:34             ` Mark Brown
2020-08-25 10:01             ` Gene Chen
2020-08-25 10:01               ` Gene Chen
2020-08-25 10:01               ` Gene Chen
2020-08-25 10:08               ` Mark Brown
2020-08-25 10:08                 ` Mark Brown
2020-08-25 10:08                 ` Mark Brown
2020-08-25 11:07                 ` Gene Chen
2020-08-25 11:07                   ` Gene Chen
2020-08-25 11:07                   ` Gene Chen
2020-08-26 12:55 ` [PATCH v3 0/2] regulator: mt6360: Add support for MT6360 regulator Mark Brown
2020-08-26 12:55   ` Mark Brown
2020-08-26 12:55   ` Mark Brown

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.