linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/2] regulator: da9063: Use __stringify_1
       [not found] <ad5355c28c25fc273a450a11bc82f201fffad8cf.1624147922.git.plr.vincent@gmail.com>
@ 2021-06-22 11:03 ` Vincent Pelletier
  2021-06-22 11:03   ` [PATCH v2 2/2] regulator: da9063: Add support for full-current mode Vincent Pelletier
  2021-06-22 12:45 ` [PATCH v3 1/2] regulator: da9063: Use __stringify_1 Vincent Pelletier
  1 sibling, 1 reply; 5+ messages in thread
From: Vincent Pelletier @ 2021-06-22 11:03 UTC (permalink / raw)
  To: Support Opensource, Liam Girdwood, Mark Brown, linux-kernel,
	David Abdurachmanov

Indirect stringification is not intended here, and generated names may
unintentionally conflict with macros.

Signed-off-by: Vincent Pelletier <plr.vincent@gmail.com>
---
V1 -> V2:
- new patch for a cosmetic bug uncovered by 2/2
- cc linux-kernel ML
- fix subject prefix

 drivers/regulator/da9063-regulator.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/regulator/da9063-regulator.c b/drivers/regulator/da9063-regulator.c
index cf7d5341750e..21f4ddb37b09 100644
--- a/drivers/regulator/da9063-regulator.c
+++ b/drivers/regulator/da9063-regulator.c
@@ -88,7 +88,7 @@ struct da9063_regulator_info {
 /* Macros for LDO */
 #define DA9063_LDO(chip, regl_name, min_mV, step_mV, max_mV) \
 	.desc.id = chip##_ID_##regl_name, \
-	.desc.name = __stringify(chip##_##regl_name), \
+	.desc.name = __stringify_1(chip##_##regl_name), \
 	.desc.ops = &da9063_ldo_ops, \
 	.desc.min_uV = (min_mV) * 1000, \
 	.desc.uV_step = (step_mV) * 1000, \
@@ -108,7 +108,7 @@ struct da9063_regulator_info {
 #define DA9063_BUCK(chip, regl_name, min_mV, step_mV, max_mV, limits_array, \
 		    creg, cmask) \
 	.desc.id = chip##_ID_##regl_name, \
-	.desc.name = __stringify(chip##_##regl_name), \
+	.desc.name = __stringify_1(chip##_##regl_name), \
 	.desc.ops = &da9063_buck_ops, \
 	.desc.min_uV = (min_mV) * 1000, \
 	.desc.uV_step = (step_mV) * 1000, \
-- 
2.32.0


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

* [PATCH v2 2/2] regulator: da9063: Add support for full-current mode.
  2021-06-22 11:03 ` [PATCH v2 1/2] regulator: da9063: Use __stringify_1 Vincent Pelletier
@ 2021-06-22 11:03   ` Vincent Pelletier
  0 siblings, 0 replies; 5+ messages in thread
From: Vincent Pelletier @ 2021-06-22 11:03 UTC (permalink / raw)
  To: Support Opensource, Liam Girdwood, Mark Brown, linux-kernel,
	David Abdurachmanov

In addition to the ability of merging some power outputs, this chip has
an overdrive/full-current mode.
BCORE1, BCORE2 and BPRO have this ability, in which case the legal
current draw is increased from 2 amps to 2.5 amps (at the expense of
a quiescent current increase), and the configurable current limits
are doubled.
So add configuration alternatives for these new combinations, with their
updated current limits.

Signed-off-by: Vincent Pelletier <plr.vincent@gmail.com>
---
V1 -> V2:
- skip DA9063_ID_BCORES_MERGED_OD when not full-current, and vice-versa
- cc linux-kernel ML
- fix subject prefix

 drivers/regulator/da9063-regulator.c | 70 ++++++++++++++++++++++++++--
 1 file changed, 66 insertions(+), 4 deletions(-)

diff --git a/drivers/regulator/da9063-regulator.c b/drivers/regulator/da9063-regulator.c
index 21f4ddb37b09..1193b2eb8c07 100644
--- a/drivers/regulator/da9063-regulator.c
+++ b/drivers/regulator/da9063-regulator.c
@@ -31,14 +31,19 @@
 enum {
 	/* BUCKs */
 	DA9063_ID_BCORE1,
+	DA9063_ID_BCORE1_OD,
 	DA9063_ID_BCORE2,
+	DA9063_ID_BCORE2_OD,
 	DA9063_ID_BPRO,
+	DA9063_ID_BPRO_OD,
 	DA9063_ID_BMEM,
 	DA9063_ID_BIO,
 	DA9063_ID_BPERI,
 
 	/* BCORE1 and BCORE2 in merged mode */
 	DA9063_ID_BCORES_MERGED,
+	/* BCORE1 and BCORE2 in merged and full-current mode */
+	DA9063_ID_BCORES_MERGED_OD,
 	/* BMEM and BIO in merged mode */
 	DA9063_ID_BMEM_BIO_MERGED,
 	/* When two BUCKs are merged, they cannot be reused separately */
@@ -186,7 +191,8 @@ static const unsigned int da9063_buck_b_limits[] = {
 };
 
 /*
- * Current limits array (in uA) for merged BCORE1 and BCORE2.
+ * Current limits array (in uA) for merged BCORE1 and BCORE2, or
+ * BCORE1, BCORE2, BPRO in fullcurrent mode.
  * Entry indexes corresponds to register values.
  */
 static const unsigned int da9063_bcores_merged_limits[] = {
@@ -203,6 +209,16 @@ static const unsigned int da9063_bmem_bio_merged_limits[] = {
 	4600000, 4800000, 5000000, 5200000, 5400000, 5600000, 5800000, 6000000
 };
 
+/*
+ * Current limits array (in uA) for merged BCORE
+ * in full-current mode.
+ * Entry indexes corresponds to register values.
+ */
+static const unsigned int da9063_bcores_merged_fullcurrent_limits[] = {
+	2000000, 2400000, 2800000, 3200000, 3600000, 4000000, 4400000, 4800000,
+	5200000, 5600000, 6000000, 6400000, 6800000, 7200000, 7600000, 8000000
+};
+
 static int da9063_buck_set_mode(struct regulator_dev *rdev, unsigned int mode)
 {
 	struct da9063_regulator *regl = rdev_get_drvdata(rdev);
@@ -454,18 +470,36 @@ static const struct da9063_regulator_info da9063_regulator_info[] = {
 			    DA9063_REG_BUCK_ILIM_C, DA9063_BCORE1_ILIM_MASK),
 		DA9063_BUCK_COMMON_FIELDS(BCORE1),
 	},
+	{
+		DA9063_BUCK(DA9063, BCORE1_OD, 300, 10, 1570,
+			    da9063_bcores_merged_limits,
+			    DA9063_REG_BUCK_ILIM_C, DA9063_BCORE1_ILIM_MASK),
+		DA9063_BUCK_COMMON_FIELDS(BCORE1),
+	},
 	{
 		DA9063_BUCK(DA9063, BCORE2, 300, 10, 1570,
 			    da9063_buck_a_limits,
 			    DA9063_REG_BUCK_ILIM_C, DA9063_BCORE2_ILIM_MASK),
 		DA9063_BUCK_COMMON_FIELDS(BCORE2),
 	},
+	{
+		DA9063_BUCK(DA9063, BCORE2_OD, 300, 10, 1570,
+			    da9063_bcores_merged_limits,
+			    DA9063_REG_BUCK_ILIM_C, DA9063_BCORE2_ILIM_MASK),
+		DA9063_BUCK_COMMON_FIELDS(BCORE2),
+	},
 	{
 		DA9063_BUCK(DA9063, BPRO, 530, 10, 1800,
 			    da9063_buck_a_limits,
 			    DA9063_REG_BUCK_ILIM_B, DA9063_BPRO_ILIM_MASK),
 		DA9063_BUCK_COMMON_FIELDS(BPRO),
 	},
+	{
+		DA9063_BUCK(DA9063, BPRO_OD, 530, 10, 1800,
+			    da9063_bcores_merged_limits,
+			    DA9063_REG_BUCK_ILIM_B, DA9063_BPRO_ILIM_MASK),
+		DA9063_BUCK_COMMON_FIELDS(BPRO),
+	},
 	{
 		DA9063_BUCK(DA9063, BMEM, 800, 20, 3340,
 			    da9063_buck_b_limits,
@@ -491,6 +525,13 @@ static const struct da9063_regulator_info da9063_regulator_info[] = {
 		/* BCORES_MERGED uses the same register fields as BCORE1 */
 		DA9063_BUCK_COMMON_FIELDS(BCORE1),
 	},
+	{
+		DA9063_BUCK(DA9063, BCORES_MERGED_OD, 300, 10, 1570,
+			    da9063_bcores_merged_fullcurrent_limits,
+			    DA9063_REG_BUCK_ILIM_C, DA9063_BCORE1_ILIM_MASK),
+		/* BCORES_MERGED uses the same register fields as BCORE1 */
+		DA9063_BUCK_COMMON_FIELDS(BCORE1),
+	},
 	{
 		DA9063_BUCK(DA9063, BMEM_BIO_MERGED, 800, 20, 3340,
 			    da9063_bmem_bio_merged_limits,
@@ -545,12 +586,12 @@ static const struct da9063_regulator_info da9063_regulator_info[] = {
 static struct da9063_dev_model regulators_models[] = {
 	{
 		.regulator_info = da9063_regulator_info,
-		.n_regulators = ARRAY_SIZE(da9063_regulator_info),
+		.n_regulators = ARRAY_SIZE(da9063_regulator_info) - 4,
 		.type = PMIC_TYPE_DA9063,
 	},
 	{
 		.regulator_info = da9063_regulator_info,
-		.n_regulators = ARRAY_SIZE(da9063_regulator_info) - 6,
+		.n_regulators = ARRAY_SIZE(da9063_regulator_info) - 4 - 6,
 		.type = PMIC_TYPE_DA9063L,
 	},
 	{ }
@@ -600,12 +641,16 @@ static const struct regulator_init_data *da9063_get_regulator_initdata(
 
 static struct of_regulator_match da9063_matches[] = {
 	[DA9063_ID_BCORE1]           = { .name = "bcore1"           },
+	[DA9063_ID_BCORE1_OD]        = { .name = "bcore1-od"        },
 	[DA9063_ID_BCORE2]           = { .name = "bcore2"           },
+	[DA9063_ID_BCORE2_OD]        = { .name = "bcore2-od"        },
 	[DA9063_ID_BPRO]             = { .name = "bpro",            },
+	[DA9063_ID_BPRO_OD]          = { .name = "bpro-od",         },
 	[DA9063_ID_BMEM]             = { .name = "bmem",            },
 	[DA9063_ID_BIO]              = { .name = "bio",             },
 	[DA9063_ID_BPERI]            = { .name = "bperi",           },
 	[DA9063_ID_BCORES_MERGED]    = { .name = "bcores-merged"    },
+	[DA9063_ID_BCORES_MERGED_OD] = { .name = "bcores-merged-od" },
 	[DA9063_ID_BMEM_BIO_MERGED]  = { .name = "bmem-bio-merged", },
 	[DA9063_ID_LDO3]             = { .name = "ldo3",            },
 	[DA9063_ID_LDO7]             = { .name = "ldo7",            },
@@ -685,7 +730,7 @@ static int da9063_regulator_probe(struct platform_device *pdev)
 	struct da9063_regulators *regulators;
 	struct da9063_regulator *regl;
 	struct regulator_config config;
-	bool bcores_merged, bmem_bio_merged;
+	bool bcores_merged, bmem_bio_merged, bcore1_od, bcore2_od, bpro_od;
 	int id, irq, n, n_regulators, ret, val;
 
 	regl_pdata = da9063_parse_regulators_dt(pdev, &da9063_reg_matches);
@@ -714,6 +759,9 @@ static int da9063_regulator_probe(struct platform_device *pdev)
 		return ret;
 	}
 	bcores_merged = val & DA9063_BCORE_MERGE;
+	bpro_od = val & DA9063_BPRO_OD;
+	bcore2_od = val & DA9063_BCORE2_OD;
+	bcore1_od = val & DA9063_BCORE1_OD;
 	bmem_bio_merged = val & DA9063_BUCK_MERGE;
 
 	n_regulators = model->n_regulators;
@@ -768,6 +816,20 @@ static int da9063_regulator_probe(struct platform_device *pdev)
 			}
 			break;
 		}
+		if (
+			(id == DA9063_ID_BCORE1    &&  bcore1_od) ||
+			(id == DA9063_ID_BCORE1_OD && !bcore1_od) ||
+			/* BCORES_MERGED uses the same fullcurrent bit as BCORE1 */
+			(id == DA9063_ID_BCORES_MERGED    &&  bcore1_od) ||
+			(id == DA9063_ID_BCORES_MERGED_OD && !bcore1_od) ||
+			(id == DA9063_ID_BCORE2    &&  bcore2_od) ||
+			(id == DA9063_ID_BCORE2_OD && !bcore2_od) ||
+			(id == DA9063_ID_BPRO    &&  bpro_od) ||
+			(id == DA9063_ID_BPRO_OD && !bpro_od)
+		) {
+			id++;
+			continue;
+		}
 
 		/* Initialise regulator structure */
 		regl = &regulators->regulator[n];
-- 
2.32.0


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

* [PATCH v3 1/2] regulator: da9063: Use __stringify_1
       [not found] <ad5355c28c25fc273a450a11bc82f201fffad8cf.1624147922.git.plr.vincent@gmail.com>
  2021-06-22 11:03 ` [PATCH v2 1/2] regulator: da9063: Use __stringify_1 Vincent Pelletier
@ 2021-06-22 12:45 ` Vincent Pelletier
  2021-06-22 12:45   ` [PATCH v3 2/2] regulator: da9063: Add support for full-current mode Vincent Pelletier
  2021-06-22 13:09   ` [PATCH v3 1/2] regulator: da9063: Use __stringify_1 Mark Brown
  1 sibling, 2 replies; 5+ messages in thread
From: Vincent Pelletier @ 2021-06-22 12:45 UTC (permalink / raw)
  To: Support Opensource, Liam Girdwood, Mark Brown, linux-kernel,
	David Abdurachmanov

Indirect stringification is not intended here, and generated names may
unintentionally conflict with macros.

Signed-off-by: Vincent Pelletier <plr.vincent@gmail.com>
---
V2 -> V3: no change
V1 -> V2:
- new patch for a cosmetic bug uncovered by 2/2
- cc linux-kernel ML
- fix subject prefix

 drivers/regulator/da9063-regulator.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/regulator/da9063-regulator.c b/drivers/regulator/da9063-regulator.c
index cf7d5341750e..21f4ddb37b09 100644
--- a/drivers/regulator/da9063-regulator.c
+++ b/drivers/regulator/da9063-regulator.c
@@ -88,7 +88,7 @@ struct da9063_regulator_info {
 /* Macros for LDO */
 #define DA9063_LDO(chip, regl_name, min_mV, step_mV, max_mV) \
 	.desc.id = chip##_ID_##regl_name, \
-	.desc.name = __stringify(chip##_##regl_name), \
+	.desc.name = __stringify_1(chip##_##regl_name), \
 	.desc.ops = &da9063_ldo_ops, \
 	.desc.min_uV = (min_mV) * 1000, \
 	.desc.uV_step = (step_mV) * 1000, \
@@ -108,7 +108,7 @@ struct da9063_regulator_info {
 #define DA9063_BUCK(chip, regl_name, min_mV, step_mV, max_mV, limits_array, \
 		    creg, cmask) \
 	.desc.id = chip##_ID_##regl_name, \
-	.desc.name = __stringify(chip##_##regl_name), \
+	.desc.name = __stringify_1(chip##_##regl_name), \
 	.desc.ops = &da9063_buck_ops, \
 	.desc.min_uV = (min_mV) * 1000, \
 	.desc.uV_step = (step_mV) * 1000, \
-- 
2.32.0


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

* [PATCH v3 2/2] regulator: da9063: Add support for full-current mode.
  2021-06-22 12:45 ` [PATCH v3 1/2] regulator: da9063: Use __stringify_1 Vincent Pelletier
@ 2021-06-22 12:45   ` Vincent Pelletier
  2021-06-22 13:09   ` [PATCH v3 1/2] regulator: da9063: Use __stringify_1 Mark Brown
  1 sibling, 0 replies; 5+ messages in thread
From: Vincent Pelletier @ 2021-06-22 12:45 UTC (permalink / raw)
  To: Support Opensource, Liam Girdwood, Mark Brown, linux-kernel,
	David Abdurachmanov

In addition to the ability of merging some power outputs, this chip has
an overdrive/full-current mode.
BCORE1, BCORE2 and BPRO have this ability, in which case the legal
current draw is increased from 2 amps to 2.5 amps (at the expense of
a quiescent current increase), and the configurable current limits
are doubled.
So add configuration alternatives for these new combinations, with their
updated current limits.

Signed-off-by: Vincent Pelletier <plr.vincent@gmail.com>
---
V2 -> V3:
- ACTUALLY skip DA9063_ID_BCORES_MERGED_OD when not full-current, and
  vice-versa.
- head put in brown paper bag
V1 -> V2:
- skip DA9063_ID_BCORES_MERGED_OD when not full-current, and vice-versa
- cc linux-kernel ML
- fix subject prefix

 drivers/regulator/da9063-regulator.c | 73 ++++++++++++++++++++++++++--
 1 file changed, 69 insertions(+), 4 deletions(-)

diff --git a/drivers/regulator/da9063-regulator.c b/drivers/regulator/da9063-regulator.c
index 21f4ddb37b09..efcd9ceedd26 100644
--- a/drivers/regulator/da9063-regulator.c
+++ b/drivers/regulator/da9063-regulator.c
@@ -31,14 +31,19 @@
 enum {
 	/* BUCKs */
 	DA9063_ID_BCORE1,
+	DA9063_ID_BCORE1_OD,
 	DA9063_ID_BCORE2,
+	DA9063_ID_BCORE2_OD,
 	DA9063_ID_BPRO,
+	DA9063_ID_BPRO_OD,
 	DA9063_ID_BMEM,
 	DA9063_ID_BIO,
 	DA9063_ID_BPERI,
 
 	/* BCORE1 and BCORE2 in merged mode */
 	DA9063_ID_BCORES_MERGED,
+	/* BCORE1 and BCORE2 in merged and full-current mode */
+	DA9063_ID_BCORES_MERGED_OD,
 	/* BMEM and BIO in merged mode */
 	DA9063_ID_BMEM_BIO_MERGED,
 	/* When two BUCKs are merged, they cannot be reused separately */
@@ -186,7 +191,8 @@ static const unsigned int da9063_buck_b_limits[] = {
 };
 
 /*
- * Current limits array (in uA) for merged BCORE1 and BCORE2.
+ * Current limits array (in uA) for merged BCORE1 and BCORE2, or
+ * BCORE1, BCORE2, BPRO in fullcurrent mode.
  * Entry indexes corresponds to register values.
  */
 static const unsigned int da9063_bcores_merged_limits[] = {
@@ -203,6 +209,16 @@ static const unsigned int da9063_bmem_bio_merged_limits[] = {
 	4600000, 4800000, 5000000, 5200000, 5400000, 5600000, 5800000, 6000000
 };
 
+/*
+ * Current limits array (in uA) for merged BCORE
+ * in full-current mode.
+ * Entry indexes corresponds to register values.
+ */
+static const unsigned int da9063_bcores_merged_fullcurrent_limits[] = {
+	2000000, 2400000, 2800000, 3200000, 3600000, 4000000, 4400000, 4800000,
+	5200000, 5600000, 6000000, 6400000, 6800000, 7200000, 7600000, 8000000
+};
+
 static int da9063_buck_set_mode(struct regulator_dev *rdev, unsigned int mode)
 {
 	struct da9063_regulator *regl = rdev_get_drvdata(rdev);
@@ -454,18 +470,36 @@ static const struct da9063_regulator_info da9063_regulator_info[] = {
 			    DA9063_REG_BUCK_ILIM_C, DA9063_BCORE1_ILIM_MASK),
 		DA9063_BUCK_COMMON_FIELDS(BCORE1),
 	},
+	{
+		DA9063_BUCK(DA9063, BCORE1_OD, 300, 10, 1570,
+			    da9063_bcores_merged_limits,
+			    DA9063_REG_BUCK_ILIM_C, DA9063_BCORE1_ILIM_MASK),
+		DA9063_BUCK_COMMON_FIELDS(BCORE1),
+	},
 	{
 		DA9063_BUCK(DA9063, BCORE2, 300, 10, 1570,
 			    da9063_buck_a_limits,
 			    DA9063_REG_BUCK_ILIM_C, DA9063_BCORE2_ILIM_MASK),
 		DA9063_BUCK_COMMON_FIELDS(BCORE2),
 	},
+	{
+		DA9063_BUCK(DA9063, BCORE2_OD, 300, 10, 1570,
+			    da9063_bcores_merged_limits,
+			    DA9063_REG_BUCK_ILIM_C, DA9063_BCORE2_ILIM_MASK),
+		DA9063_BUCK_COMMON_FIELDS(BCORE2),
+	},
 	{
 		DA9063_BUCK(DA9063, BPRO, 530, 10, 1800,
 			    da9063_buck_a_limits,
 			    DA9063_REG_BUCK_ILIM_B, DA9063_BPRO_ILIM_MASK),
 		DA9063_BUCK_COMMON_FIELDS(BPRO),
 	},
+	{
+		DA9063_BUCK(DA9063, BPRO_OD, 530, 10, 1800,
+			    da9063_bcores_merged_limits,
+			    DA9063_REG_BUCK_ILIM_B, DA9063_BPRO_ILIM_MASK),
+		DA9063_BUCK_COMMON_FIELDS(BPRO),
+	},
 	{
 		DA9063_BUCK(DA9063, BMEM, 800, 20, 3340,
 			    da9063_buck_b_limits,
@@ -491,6 +525,13 @@ static const struct da9063_regulator_info da9063_regulator_info[] = {
 		/* BCORES_MERGED uses the same register fields as BCORE1 */
 		DA9063_BUCK_COMMON_FIELDS(BCORE1),
 	},
+	{
+		DA9063_BUCK(DA9063, BCORES_MERGED_OD, 300, 10, 1570,
+			    da9063_bcores_merged_fullcurrent_limits,
+			    DA9063_REG_BUCK_ILIM_C, DA9063_BCORE1_ILIM_MASK),
+		/* BCORES_MERGED uses the same register fields as BCORE1 */
+		DA9063_BUCK_COMMON_FIELDS(BCORE1),
+	},
 	{
 		DA9063_BUCK(DA9063, BMEM_BIO_MERGED, 800, 20, 3340,
 			    da9063_bmem_bio_merged_limits,
@@ -545,12 +586,12 @@ static const struct da9063_regulator_info da9063_regulator_info[] = {
 static struct da9063_dev_model regulators_models[] = {
 	{
 		.regulator_info = da9063_regulator_info,
-		.n_regulators = ARRAY_SIZE(da9063_regulator_info),
+		.n_regulators = ARRAY_SIZE(da9063_regulator_info) - 4,
 		.type = PMIC_TYPE_DA9063,
 	},
 	{
 		.regulator_info = da9063_regulator_info,
-		.n_regulators = ARRAY_SIZE(da9063_regulator_info) - 6,
+		.n_regulators = ARRAY_SIZE(da9063_regulator_info) - 4 - 6,
 		.type = PMIC_TYPE_DA9063L,
 	},
 	{ }
@@ -600,12 +641,16 @@ static const struct regulator_init_data *da9063_get_regulator_initdata(
 
 static struct of_regulator_match da9063_matches[] = {
 	[DA9063_ID_BCORE1]           = { .name = "bcore1"           },
+	[DA9063_ID_BCORE1_OD]        = { .name = "bcore1-od"        },
 	[DA9063_ID_BCORE2]           = { .name = "bcore2"           },
+	[DA9063_ID_BCORE2_OD]        = { .name = "bcore2-od"        },
 	[DA9063_ID_BPRO]             = { .name = "bpro",            },
+	[DA9063_ID_BPRO_OD]          = { .name = "bpro-od",         },
 	[DA9063_ID_BMEM]             = { .name = "bmem",            },
 	[DA9063_ID_BIO]              = { .name = "bio",             },
 	[DA9063_ID_BPERI]            = { .name = "bperi",           },
 	[DA9063_ID_BCORES_MERGED]    = { .name = "bcores-merged"    },
+	[DA9063_ID_BCORES_MERGED_OD] = { .name = "bcores-merged-od" },
 	[DA9063_ID_BMEM_BIO_MERGED]  = { .name = "bmem-bio-merged", },
 	[DA9063_ID_LDO3]             = { .name = "ldo3",            },
 	[DA9063_ID_LDO7]             = { .name = "ldo7",            },
@@ -685,7 +730,7 @@ static int da9063_regulator_probe(struct platform_device *pdev)
 	struct da9063_regulators *regulators;
 	struct da9063_regulator *regl;
 	struct regulator_config config;
-	bool bcores_merged, bmem_bio_merged;
+	bool bcores_merged, bmem_bio_merged, bcore1_od, bcore2_od, bpro_od;
 	int id, irq, n, n_regulators, ret, val;
 
 	regl_pdata = da9063_parse_regulators_dt(pdev, &da9063_reg_matches);
@@ -714,6 +759,9 @@ static int da9063_regulator_probe(struct platform_device *pdev)
 		return ret;
 	}
 	bcores_merged = val & DA9063_BCORE_MERGE;
+	bpro_od = val & DA9063_BPRO_OD;
+	bcore2_od = val & DA9063_BCORE2_OD;
+	bcore1_od = val & DA9063_BCORE1_OD;
 	bmem_bio_merged = val & DA9063_BUCK_MERGE;
 
 	n_regulators = model->n_regulators;
@@ -742,7 +790,9 @@ static int da9063_regulator_probe(struct platform_device *pdev)
 		/* Skip regulator IDs depending on merge mode configuration */
 		switch (id) {
 		case DA9063_ID_BCORE1:
+		case DA9063_ID_BCORE1_OD:
 		case DA9063_ID_BCORE2:
+		case DA9063_ID_BCORE2_OD:
 			if (bcores_merged) {
 				id++;
 				continue;
@@ -756,6 +806,7 @@ static int da9063_regulator_probe(struct platform_device *pdev)
 			}
 			break;
 		case DA9063_ID_BCORES_MERGED:
+		case DA9063_ID_BCORES_MERGED_OD:
 			if (!bcores_merged) {
 				id++;
 				continue;
@@ -768,6 +819,20 @@ static int da9063_regulator_probe(struct platform_device *pdev)
 			}
 			break;
 		}
+		if (
+			(id == DA9063_ID_BCORE1    &&  bcore1_od) ||
+			(id == DA9063_ID_BCORE1_OD && !bcore1_od) ||
+			/* BCORES_MERGED uses the same fullcurrent bit as BCORE1 */
+			(id == DA9063_ID_BCORES_MERGED    &&  bcore1_od) ||
+			(id == DA9063_ID_BCORES_MERGED_OD && !bcore1_od) ||
+			(id == DA9063_ID_BCORE2    &&  bcore2_od) ||
+			(id == DA9063_ID_BCORE2_OD && !bcore2_od) ||
+			(id == DA9063_ID_BPRO    &&  bpro_od) ||
+			(id == DA9063_ID_BPRO_OD && !bpro_od)
+		) {
+			id++;
+			continue;
+		}
 
 		/* Initialise regulator structure */
 		regl = &regulators->regulator[n];
-- 
2.32.0


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

* Re: [PATCH v3 1/2] regulator: da9063: Use __stringify_1
  2021-06-22 12:45 ` [PATCH v3 1/2] regulator: da9063: Use __stringify_1 Vincent Pelletier
  2021-06-22 12:45   ` [PATCH v3 2/2] regulator: da9063: Add support for full-current mode Vincent Pelletier
@ 2021-06-22 13:09   ` Mark Brown
  1 sibling, 0 replies; 5+ messages in thread
From: Mark Brown @ 2021-06-22 13:09 UTC (permalink / raw)
  To: Vincent Pelletier
  Cc: Support Opensource, Liam Girdwood, linux-kernel, David Abdurachmanov

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

On Tue, Jun 22, 2021 at 12:45:19PM +0000, Vincent Pelletier wrote:
> Indirect stringification is not intended here, and generated names may
> unintentionally conflict with macros.

Please don't submit new patches in reply to old serieses, it makes it
easy for things to get missed and creates confusion about what the
current versions of things are.  It's better to post new things as
independent serieses.

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

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

end of thread, other threads:[~2021-06-22 13:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <ad5355c28c25fc273a450a11bc82f201fffad8cf.1624147922.git.plr.vincent@gmail.com>
2021-06-22 11:03 ` [PATCH v2 1/2] regulator: da9063: Use __stringify_1 Vincent Pelletier
2021-06-22 11:03   ` [PATCH v2 2/2] regulator: da9063: Add support for full-current mode Vincent Pelletier
2021-06-22 12:45 ` [PATCH v3 1/2] regulator: da9063: Use __stringify_1 Vincent Pelletier
2021-06-22 12:45   ` [PATCH v3 2/2] regulator: da9063: Add support for full-current mode Vincent Pelletier
2021-06-22 13:09   ` [PATCH v3 1/2] regulator: da9063: Use __stringify_1 Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).