2021-11-23 23:28:04

by Adam Ward

[permalink] [raw]
Subject: [PATCH V3 0/3] regulator: da9121: add DA914x support

This series extends the DA9121 driver to add support for related products:

DA9141, 40A, Quad-Phase
DA9142, 20A, Dual-Phase

The changing of current limit when active is now prohibited, for the range,
due to possibility of undefined behaviour during transition

V2:
- Separate removal of obsolete/unused test compatible from binding

V3:
- Fix binding update
- Improve patch titles


Adam Ward (3):
dt-bindings: da9121: Remove erroneous compatible from binding
dt-bindings: da9121: Add DA914x binding info
regulator: da9121: Add DA914x support

.../bindings/regulator/dlg,da9121.yaml | 76 +++++++-----
drivers/regulator/da9121-regulator.c | 113 +++++++++++++++++-
drivers/regulator/da9121-regulator.h | 21 +++-
3 files changed, 173 insertions(+), 37 deletions(-)

--
2.25.1



2021-11-23 23:28:09

by Adam Ward

[permalink] [raw]
Subject: [PATCH V3 1/3] dt-bindings: da9121: Remove erroneous compatible from binding

Signed-off-by: Adam Ward <[email protected]>
---
.../bindings/regulator/dlg,da9121.yaml | 25 +++++++++----------
1 file changed, 12 insertions(+), 13 deletions(-)

diff --git a/Documentation/devicetree/bindings/regulator/dlg,da9121.yaml b/Documentation/devicetree/bindings/regulator/dlg,da9121.yaml
index 228018c87bea..0aee5fcd6093 100644
--- a/Documentation/devicetree/bindings/regulator/dlg,da9121.yaml
+++ b/Documentation/devicetree/bindings/regulator/dlg,da9121.yaml
@@ -25,19 +25,19 @@ description: |
the rated current, this translates across the device range to per
channel figures as so...

- | DA9121 DA9122 DA9220 DA9217 DA9140
+ | DA9121 DA9122 DA9220 DA9217
| /DA9130 /DA9131 /DA9132
- -----------------------------------------------------------------------------
- Output current / channel | 10000000 5000000 3000000 6000000 40000000
- Output current / phase | 5000000 5000000 3000000 3000000 9500000
- -----------------------------------------------------------------------------
- Min regulator-min-microvolt| 300000 300000 300000 300000 500000
- Max regulator-max-microvolt| 1900000 1900000 1900000 1900000 1000000
- Device hardware default | 1000000 1000000 1000000 1000000 1000000
- -----------------------------------------------------------------------------
- Min regulator-min-microamp | 7000000 3500000 3500000 7000000 26000000
- Max regulator-max-microamp | 20000000 10000000 6000000 12000000 78000000
- Device hardware default | 15000000 7500000 5500000 11000000 58000000
+ -------------------------------------------------------------------
+ Output current / channel | 10000000 5000000 3000000 6000000
+ Output current / phase | 5000000 5000000 3000000 3000000
+ -------------------------------------------------------------------
+ Min regulator-min-microvolt| 300000 300000 300000 300000
+ Max regulator-max-microvolt| 1900000 1900000 1900000 1900000
+ Device hardware default | 1000000 1000000 1000000 1000000
+ -------------------------------------------------------------------
+ Min regulator-min-microamp | 7000000 3500000 3500000 7000000
+ Max regulator-max-microamp | 20000000 10000000 6000000 12000000
+ Device hardware default | 15000000 7500000 5500000 11000000

properties:
$nodename:
@@ -51,7 +51,6 @@ properties:
- dlg,da9130
- dlg,da9131
- dlg,da9132
- - dlg,da9140

reg:
maxItems: 1
--
2.25.1


2021-11-23 23:28:12

by Adam Ward

[permalink] [raw]
Subject: [PATCH V3 2/3] dt-bindings: da9121: Add DA914x binding info

Signed-off-by: Adam Ward <[email protected]>
---
.../bindings/regulator/dlg,da9121.yaml | 75 +++++++++++--------
1 file changed, 44 insertions(+), 31 deletions(-)

diff --git a/Documentation/devicetree/bindings/regulator/dlg,da9121.yaml b/Documentation/devicetree/bindings/regulator/dlg,da9121.yaml
index 0aee5fcd6093..24ace6e1e5ec 100644
--- a/Documentation/devicetree/bindings/regulator/dlg,da9121.yaml
+++ b/Documentation/devicetree/bindings/regulator/dlg,da9121.yaml
@@ -17,27 +17,39 @@ description: |
Dialog Semiconductor DA9130 Single-channel 10A double-phase buck converter
Dialog Semiconductor DA9131 Double-channel 5A single-phase buck converter
Dialog Semiconductor DA9132 Double-channel 3A single-phase buck converter
-
- Current limits
-
- This is PER PHASE, and the current limit setting in the devices reflect
- that with a maximum 10A limit. Allowing for transients at/near double
- the rated current, this translates across the device range to per
- channel figures as so...
-
- | DA9121 DA9122 DA9220 DA9217
- | /DA9130 /DA9131 /DA9132
- -------------------------------------------------------------------
- Output current / channel | 10000000 5000000 3000000 6000000
- Output current / phase | 5000000 5000000 3000000 3000000
- -------------------------------------------------------------------
- Min regulator-min-microvolt| 300000 300000 300000 300000
- Max regulator-max-microvolt| 1900000 1900000 1900000 1900000
- Device hardware default | 1000000 1000000 1000000 1000000
- -------------------------------------------------------------------
- Min regulator-min-microamp | 7000000 3500000 3500000 7000000
- Max regulator-max-microamp | 20000000 10000000 6000000 12000000
- Device hardware default | 15000000 7500000 5500000 11000000
+ Dialog Semiconductor DA9141 Single-channel 40A quad-phase buck converter
+ Dialog Semiconductor DA9142 Single-channel 20A double-phase buck converter
+
+ Device parameter ranges
+
+ The current limits can be set to at/near double the rated current per channel
+ to allow for transient peaks.
+ Current limit changes when the output is enabled are not supported, as a
+ precaution against undefined behaviour.
+
+ |----------------------------------------------|
+ | | range & reset default value |
+ | Device |------------------------------|
+ | | microvolt | microamp |
+ |----------------------------------------------|
+ | DA9121/DA9130 | Min: 300000 | Min: 7000000 |
+ | | Max: 1900000 | Max: 20000000 |
+ |----------------------------------------------|
+ | DA9121/DA9131 | Min: 300000 | Min: 3500000 |
+ | | Max: 1900000 | Max: 10000000 |
+ |----------------------------------------------|
+ | DA9121/DA9131 | Min: 300000 | Min: 3500000 |
+ | | Max: 1900000 | Max: 6000000 |
+ |----------------------------------------------|
+ | DA9217 | Min: 300000 | Min: 7000000 |
+ | | Max: 1900000 | Max: 12000000 |
+ |----------------------------------------------|
+ | DA9141 | Min: 300000 | Min: 26000000 |
+ | | Max: 1300000 | Max: 78000000 |
+ |----------------------------------------------|
+ | DA9142 | Min: 300000 | Min: 13000000 |
+ | | Max: 1300000 | Max: 39000000 |
+ |----------------------------------------------|

properties:
$nodename:
@@ -51,6 +63,8 @@ properties:
- dlg,da9130
- dlg,da9131
- dlg,da9132
+ - dlg,da9141
+ - dlg,da9142

reg:
maxItems: 1
@@ -69,26 +83,24 @@ properties:

regulators:
type: object
- $ref: regulator.yaml#
description: |
- This node defines the settings for the BUCK. The content of the
- sub-node is defined by the standard binding for regulators; see regulator.yaml.
- The DA9121 regulator is bound using their names listed below
- buck1 - BUCK1
- buck2 - BUCK2 //DA9122, DA9220, DA9131, DA9132 only
+ List of regulators provided by the device

patternProperties:
"^buck([1-2])$":
type: object
$ref: regulator.yaml#
+ description: |
+ Properties for a single BUCK regulator

properties:
- regulator-mode:
- maxItems: 1
- description: Defined in include/dt-bindings/regulator/dlg,da9121-regulator.h
+ regulator-name:
+ pattern: "^BUCK([1-2])$"
+ description: |
+ BUCK2 present in DA9122, DA9220, DA9131, DA9132 only

regulator-initial-mode:
- maxItems: 1
+ enum: [ 0, 1, 2, 3 ]
description: Defined in include/dt-bindings/regulator/dlg,da9121-regulator.h

enable-gpios:
@@ -97,6 +109,7 @@ properties:

dlg,ripple-cancel:
$ref: "/schemas/types.yaml#/definitions/uint32"
+ enum: [ 0, 1, 2, 3 ]
description: |
Defined in include/dt-bindings/regulator/dlg,da9121-regulator.h
Only present on multi-channel devices (DA9122, DA9220, DA9131, DA9132)
--
2.25.1


2021-11-23 23:28:19

by Adam Ward

[permalink] [raw]
Subject: [PATCH V3 3/3] regulator: da9121: Add DA914x support

Signed-off-by: Adam Ward <[email protected]>
---
drivers/regulator/da9121-regulator.c | 113 ++++++++++++++++++++++++++-
drivers/regulator/da9121-regulator.h | 21 ++++-
2 files changed, 129 insertions(+), 5 deletions(-)

diff --git a/drivers/regulator/da9121-regulator.c b/drivers/regulator/da9121-regulator.c
index a5a83b772a85..c497b82fb518 100644
--- a/drivers/regulator/da9121-regulator.c
+++ b/drivers/regulator/da9121-regulator.c
@@ -86,6 +86,22 @@ static struct da9121_range da9121_3A_1phase_current = {
.reg_max = 6,
};

+static struct da9121_range da914x_40A_4phase_current = {
+ .val_min = 14000000,
+ .val_max = 80000000,
+ .val_stp = 2000000,
+ .reg_min = 1,
+ .reg_max = 14,
+};
+
+static struct da9121_range da914x_20A_2phase_current = {
+ .val_min = 7000000,
+ .val_max = 40000000,
+ .val_stp = 2000000,
+ .reg_min = 1,
+ .reg_max = 14,
+};
+
struct da9121_variant_info {
int num_bucks;
int num_phases;
@@ -97,6 +113,8 @@ static const struct da9121_variant_info variant_parameters[] = {
{ 2, 1, &da9121_3A_1phase_current }, //DA9121_TYPE_DA9220_DA9132
{ 2, 1, &da9121_5A_1phase_current }, //DA9121_TYPE_DA9122_DA9131
{ 1, 2, &da9121_6A_2phase_current }, //DA9121_TYPE_DA9217
+ { 1, 4, &da914x_40A_4phase_current }, //DA9121_TYPE_DA9141
+ { 1, 2, &da914x_20A_2phase_current }, //DA9121_TYPE_DA9142
};

struct da9121_field {
@@ -253,6 +271,11 @@ static int da9121_set_current_limit(struct regulator_dev *rdev,
goto error;
}

+ if (rdev->desc->ops->is_enabled(rdev)) {
+ ret = -EBUSY;
+ goto error;
+ }
+
ret = da9121_ceiling_selector(rdev, min_ua, max_ua, &sel);
if (ret < 0)
goto error;
@@ -537,11 +560,65 @@ static const struct regulator_desc da9217_reg = {
.vsel_mask = DA9121_MASK_BUCK_BUCKx_5_CHx_A_VOUT,
};

+#define DA914X_MIN_MV 500
+#define DA914X_MAX_MV 1000
+#define DA914X_STEP_MV 10
+#define DA914X_MIN_SEL (DA914X_MIN_MV / DA914X_STEP_MV)
+#define DA914X_N_VOLTAGES (((DA914X_MAX_MV - DA914X_MIN_MV) / DA914X_STEP_MV) \
+ + 1 + DA914X_MIN_SEL)
+
+static const struct regulator_desc da9141_reg = {
+ .id = DA9141_IDX_BUCK1,
+ .name = "DA9141",
+ .of_match = "buck1",
+ .of_parse_cb = da9121_of_parse_cb,
+ .owner = THIS_MODULE,
+ .regulators_node = of_match_ptr("regulators"),
+ .of_map_mode = da9121_map_mode,
+ .ops = &da9121_buck_ops,
+ .type = REGULATOR_VOLTAGE,
+ .n_voltages = DA914X_N_VOLTAGES,
+ .min_uV = DA914X_MIN_MV * 1000,
+ .uV_step = DA914X_STEP_MV * 1000,
+ .linear_min_sel = DA914X_MIN_SEL,
+ .vsel_reg = DA9121_REG_BUCK_BUCK1_5,
+ .vsel_mask = DA9121_MASK_BUCK_BUCKx_5_CHx_A_VOUT,
+ .enable_reg = DA9121_REG_BUCK_BUCK1_0,
+ .enable_mask = DA9121_MASK_BUCK_BUCKx_0_CHx_EN,
+ /* Default value of BUCK_BUCK1_0.CH1_SRC_DVC_UP */
+ .ramp_delay = 20000,
+ /* tBUCK_EN */
+ .enable_time = 20,
+};
+
+static const struct regulator_desc da9142_reg = {
+ .id = DA914X_IDX_BUCK1,
+ .name = "DA9142 BUCK1",
+ .of_match = "buck1",
+ .of_parse_cb = da9121_of_parse_cb,
+ .owner = THIS_MODULE,
+ .regulators_node = of_match_ptr("regulators"),
+ .of_map_mode = da9121_map_mode,
+ .ops = &da9121_buck_ops,
+ .type = REGULATOR_VOLTAGE,
+ .n_voltages = DA914X_N_VOLTAGES,
+ .min_uV = DA914X_MIN_MV * 1000,
+ .uV_step = DA914X_STEP_MV * 1000,
+ .linear_min_sel = DA914X_MIN_SEL,
+ .enable_reg = DA9121_REG_BUCK_BUCK1_0,
+ .enable_mask = DA9121_MASK_BUCK_BUCKx_0_CHx_EN,
+ .vsel_reg = DA9121_REG_BUCK_BUCK1_5,
+ .vsel_mask = DA9121_MASK_BUCK_BUCKx_5_CHx_A_VOUT,
+};
+
+
static const struct regulator_desc *local_da9121_regulators[][DA9121_IDX_MAX] = {
[DA9121_TYPE_DA9121_DA9130] = { &da9121_reg, NULL },
[DA9121_TYPE_DA9220_DA9132] = { &da9220_reg[0], &da9220_reg[1] },
[DA9121_TYPE_DA9122_DA9131] = { &da9122_reg[0], &da9122_reg[1] },
[DA9121_TYPE_DA9217] = { &da9217_reg, NULL },
+ [DA9121_TYPE_DA9141] = { &da9141_reg, NULL },
+ [DA9121_TYPE_DA9142] = { &da9142_reg, NULL },
};

static void da9121_status_poll_on(struct work_struct *work)
@@ -835,7 +912,7 @@ static int da9121_check_device_type(struct i2c_client *i2c, struct da9121 *chip)
goto error;
}

- if (device_id != DA9121_DEVICE_ID) {
+ if ((device_id != DA9121_DEVICE_ID) && (device_id != DA914X_DEVICE_ID) {
dev_err(chip->dev, "Invalid device ID: 0x%02x\n", device_id);
ret = -ENODEV;
goto error;
@@ -877,6 +954,22 @@ static int da9121_check_device_type(struct i2c_client *i2c, struct da9121 *chip)
break;
}

+ if (device_id == DA914X_DEVICE_ID) {
+ switch (chip->subvariant_id) {
+ case DA9121_SUBTYPE_DA9141:
+ type = "DA9141";
+ config_match = (variant_vrc == DA9141_VARIANT_VRC);
+ break;
+ case DA9121_SUBTYPE_DA9142:
+ type = "DA9142";
+ config_match = (variant_vrc == DA9142_VARIANT_VRC);
+ break;
+ default:
+ type = "Unknown";
+ break;
+ }
+ }
+
dev_info(chip->dev,
"Device detected (device-ID: 0x%02X, var-ID: 0x%02X, %s)\n",
device_id, variant_id, type);
@@ -890,8 +983,10 @@ static int da9121_check_device_type(struct i2c_client *i2c, struct da9121 *chip)
variant_mrc = (variant_id & DA9121_MASK_OTP_VARIANT_ID_MRC)
>> DA9121_SHIFT_OTP_VARIANT_ID_MRC;

- if ((device_id == DA9121_DEVICE_ID) &&
- (variant_mrc < DA9121_VARIANT_MRC_BASE)) {
+ if (((device_id == DA9121_DEVICE_ID) &&
+ (variant_mrc < DA9121_VARIANT_MRC_BASE)) ||
+ ((device_id == DA914X_DEVICE_ID) &&
+ (variant_mrc != DA9141_VARIANT_MRC_BASE))) {
dev_err(chip->dev,
"Cannot support variant MRC: 0x%02X\n", variant_mrc);
ret = -EINVAL;
@@ -931,6 +1026,14 @@ static int da9121_assign_chip_model(struct i2c_client *i2c,
chip->variant_id = DA9121_TYPE_DA9220_DA9132;
regmap = &da9121_2ch_regmap_config;
break;
+ case DA9121_SUBTYPE_DA9141:
+ chip->variant_id = DA9121_TYPE_DA9141;
+ regmap = &da9121_1ch_regmap_config;
+ break;
+ case DA9121_SUBTYPE_DA9142:
+ chip->variant_id = DA9121_TYPE_DA9142;
+ regmap = &da9121_2ch_regmap_config;
+ break;
}

/* Set these up for of_regulator_match call which may want .of_map_modes */
@@ -1010,6 +1113,8 @@ static const struct of_device_id da9121_dt_ids[] = {
{ .compatible = "dlg,da9131", .data = (void *) DA9121_SUBTYPE_DA9131 },
{ .compatible = "dlg,da9220", .data = (void *) DA9121_SUBTYPE_DA9220 },
{ .compatible = "dlg,da9132", .data = (void *) DA9121_SUBTYPE_DA9132 },
+ { .compatible = "dlg,da9141", .data = (void *) DA9121_SUBTYPE_DA9141 },
+ { .compatible = "dlg,da9142", .data = (void *) DA9121_SUBTYPE_DA9142 },
{ }
};
MODULE_DEVICE_TABLE(of, da9121_dt_ids);
@@ -1084,6 +1189,8 @@ static const struct i2c_device_id da9121_i2c_id[] = {
{"da9131", DA9121_TYPE_DA9122_DA9131},
{"da9220", DA9121_TYPE_DA9220_DA9132},
{"da9132", DA9121_TYPE_DA9220_DA9132},
+ {"da9141", DA9121_TYPE_DA9141},
+ {"da9142", DA9121_TYPE_DA9142},
{},
};
MODULE_DEVICE_TABLE(i2c, da9121_i2c_id);
diff --git a/drivers/regulator/da9121-regulator.h b/drivers/regulator/da9121-regulator.h
index 357f416e17c1..a328a0bdfa29 100644
--- a/drivers/regulator/da9121-regulator.h
+++ b/drivers/regulator/da9121-regulator.h
@@ -26,7 +26,9 @@ enum da9121_variant {
DA9121_TYPE_DA9121_DA9130,
DA9121_TYPE_DA9220_DA9132,
DA9121_TYPE_DA9122_DA9131,
- DA9121_TYPE_DA9217
+ DA9121_TYPE_DA9217,
+ DA9121_TYPE_DA9141,
+ DA9121_TYPE_DA9142
};

enum da9121_subvariant {
@@ -36,7 +38,9 @@ enum da9121_subvariant {
DA9121_SUBTYPE_DA9132,
DA9121_SUBTYPE_DA9122,
DA9121_SUBTYPE_DA9131,
- DA9121_SUBTYPE_DA9217
+ DA9121_SUBTYPE_DA9217,
+ DA9121_SUBTYPE_DA9141,
+ DA9121_SUBTYPE_DA9142
};

/* Minimum, maximum and default polling millisecond periods are provided
@@ -70,6 +74,14 @@ enum da9121_subvariant {
#define DA9121_REG_SYS_GPIO1_1 0x13
#define DA9121_REG_SYS_GPIO2_0 0x14
#define DA9121_REG_SYS_GPIO2_1 0x15
+#define DA914x_REG_SYS_GPIO3_0 0x16
+#define DA914x_REG_SYS_GPIO3_1 0x17
+#define DA914x_REG_SYS_GPIO4_0 0x18
+#define DA914x_REG_SYS_GPIO4_1 0x19
+#define DA914x_REG_SYS_ADMUX1_0 0x1A
+#define DA914x_REG_SYS_ADMUX1_1 0x1B
+#define DA914x_REG_SYS_ADMUX2_0 0x1C
+#define DA914x_REG_SYS_ADMUX2_1 0x1D
#define DA9121_REG_BUCK_BUCK1_0 0x20
#define DA9121_REG_BUCK_BUCK1_1 0x21
#define DA9121_REG_BUCK_BUCK1_2 0x22
@@ -276,6 +288,7 @@ enum da9121_subvariant {
#define DA9121_MASK_OTP_DEVICE_ID_DEV_ID 0xFF

#define DA9121_DEVICE_ID 0x05
+#define DA914x_DEVICE_ID 0x26

/* DA9121_REG_OTP_VARIANT_ID */

@@ -293,6 +306,10 @@ enum da9121_subvariant {
#define DA9131_VARIANT_VRC 0x1
#define DA9132_VARIANT_VRC 0x2

+#define DA914x_VARIANT_MRC_BASE 0x0
+#define DA9141_VARIANT_VRC 0x1
+#define DA9142_VARIANT_VRC 0x2
+
/* DA9121_REG_OTP_CUSTOMER_ID */

#define DA9121_MASK_OTP_CUSTOMER_ID_CUST_ID 0xFF
--
2.25.1


2021-11-27 03:07:22

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH V3 3/3] regulator: da9121: Add DA914x support

Hi Adam,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on broonie-regulator/for-next]
[also build test ERROR on robh/for-next linux/master linus/master v5.16-rc2 next-20211126]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url: https://github.com/0day-ci/linux/commits/Adam-Ward/regulator-da9121-add-DA914x-support/20211124-072849
base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next
config: nds32-randconfig-r003-20211126 (https://download.01.org/0day-ci/archive/20211127/[email protected]/config)
compiler: nds32le-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/623a92b6a8e3ca66e0792b1cb7dfa5b4bd769b81
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Adam-Ward/regulator-da9121-add-DA914x-support/20211124-072849
git checkout 623a92b6a8e3ca66e0792b1cb7dfa5b4bd769b81
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=nds32 SHELL=/bin/bash drivers/regulator/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>

All errors (new ones prefixed by >>):

drivers/regulator/da9121-regulator.c:571:15: error: 'DA9141_IDX_BUCK1' undeclared here (not in a function); did you mean 'DA9121_IDX_BUCK1'?
571 | .id = DA9141_IDX_BUCK1,
| ^~~~~~~~~~~~~~~~
| DA9121_IDX_BUCK1
drivers/regulator/da9121-regulator.c:595:15: error: 'DA914X_IDX_BUCK1' undeclared here (not in a function); did you mean 'DA9121_IDX_BUCK1'?
595 | .id = DA914X_IDX_BUCK1,
| ^~~~~~~~~~~~~~~~
| DA9121_IDX_BUCK1
drivers/regulator/da9121-regulator.c: In function 'da9121_check_device_type':
>> drivers/regulator/da9121-regulator.c:1210:26: error: unterminated argument list invoking macro "if"
1210 | MODULE_LICENSE("GPL v2");
| ^
>> drivers/regulator/da9121-regulator.c:1211: error: expected '(' at end of input
drivers/regulator/da9121-regulator.c:915:9: note: '-Wmisleading-indentation' is disabled from this point onwards, since column-tracking was disabled due to the size of the code/headers
915 | if ((device_id != DA9121_DEVICE_ID) && (device_id != DA914X_DEVICE_ID) {
| ^~
drivers/regulator/da9121-regulator.c:915:9: note: adding '-flarge-source-files' will allow for more column-tracking support, at the expense of compilation time and memory
>> drivers/regulator/da9121-regulator.c:915:9: error: expected declaration or statement at end of input
drivers/regulator/da9121-regulator.c:912:17: error: label 'error' used but not defined
912 | goto error;
| ^~~~
drivers/regulator/da9121-regulator.c:900:14: warning: unused variable 'config_match' [-Wunused-variable]
900 | bool config_match = false;
| ^~~~~~~~~~~~
drivers/regulator/da9121-regulator.c:899:15: warning: unused variable 'type' [-Wunused-variable]
899 | char *type;
| ^~~~
drivers/regulator/da9121-regulator.c:898:25: warning: unused variable 'variant_vrc' [-Wunused-variable]
898 | u8 variant_mrc, variant_vrc;
| ^~~~~~~~~~~
drivers/regulator/da9121-regulator.c:898:12: warning: unused variable 'variant_mrc' [-Wunused-variable]
898 | u8 variant_mrc, variant_vrc;
| ^~~~~~~~~~~
drivers/regulator/da9121-regulator.c:915:9: error: no return statement in function returning non-void [-Werror=return-type]
915 | if ((device_id != DA9121_DEVICE_ID) && (device_id != DA914X_DEVICE_ID) {
| ^~
At top level:
drivers/regulator/da9121-regulator.c:894:12: warning: 'da9121_check_device_type' defined but not used [-Wunused-function]
894 | static int da9121_check_device_type(struct i2c_client *i2c, struct da9121 *chip)
| ^~~~~~~~~~~~~~~~~~~~~~~~
drivers/regulator/da9121-regulator.c:884:29: warning: 'da9121_2ch_regmap_config' defined but not used [-Wunused-variable]
884 | static struct regmap_config da9121_2ch_regmap_config = {
| ^~~~~~~~~~~~~~~~~~~~~~~~
drivers/regulator/da9121-regulator.c:873:29: warning: 'da9121_1ch_regmap_config' defined but not used [-Wunused-variable]
873 | static struct regmap_config da9121_1ch_regmap_config = {
| ^~~~~~~~~~~~~~~~~~~~~~~~
drivers/regulator/da9121-regulator.c:775:12: warning: 'da9121_set_regulator_config' defined but not used [-Wunused-function]
775 | static int da9121_set_regulator_config(struct da9121 *chip)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/regulator/da9121-regulator.c:682:20: warning: 'da9121_irq_handler' defined but not used [-Wunused-function]
682 | static irqreturn_t da9121_irq_handler(int irq, void *data)
| ^~~~~~~~~~~~~~~~~~
drivers/regulator/da9121-regulator.c:624:13: warning: 'da9121_status_poll_on' defined but not used [-Wunused-function]
624 | static void da9121_status_poll_on(struct work_struct *work)
| ^~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors


vim +/if +1210 drivers/regulator/da9121-regulator.c

e6ff10f24c587c1 Vincent Whitchurch 2020-11-03 1209
e6ff10f24c587c1 Vincent Whitchurch 2020-11-03 @1210 MODULE_LICENSE("GPL v2");

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]

2021-11-29 00:51:05

by Rob Herring

[permalink] [raw]
Subject: Re: [PATCH V3 1/3] dt-bindings: da9121: Remove erroneous compatible from binding

On Tue, 23 Nov 2021 23:27:56 +0000, Adam Ward wrote:
> Signed-off-by: Adam Ward <[email protected]>
> ---
> .../bindings/regulator/dlg,da9121.yaml | 25 +++++++++----------
> 1 file changed, 12 insertions(+), 13 deletions(-)
>

Acked-by: Rob Herring <[email protected]>

2021-11-29 00:51:45

by Rob Herring

[permalink] [raw]
Subject: Re: [PATCH V3 2/3] dt-bindings: da9121: Add DA914x binding info

On Tue, Nov 23, 2021 at 11:27:57PM +0000, Adam Ward wrote:
> Signed-off-by: Adam Ward <[email protected]>

Both of these need a commit message.

> ---
> .../bindings/regulator/dlg,da9121.yaml | 75 +++++++++++--------
> 1 file changed, 44 insertions(+), 31 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/regulator/dlg,da9121.yaml b/Documentation/devicetree/bindings/regulator/dlg,da9121.yaml
> index 0aee5fcd6093..24ace6e1e5ec 100644
> --- a/Documentation/devicetree/bindings/regulator/dlg,da9121.yaml
> +++ b/Documentation/devicetree/bindings/regulator/dlg,da9121.yaml
> @@ -17,27 +17,39 @@ description: |
> Dialog Semiconductor DA9130 Single-channel 10A double-phase buck converter
> Dialog Semiconductor DA9131 Double-channel 5A single-phase buck converter
> Dialog Semiconductor DA9132 Double-channel 3A single-phase buck converter
> -
> - Current limits
> -
> - This is PER PHASE, and the current limit setting in the devices reflect
> - that with a maximum 10A limit. Allowing for transients at/near double
> - the rated current, this translates across the device range to per
> - channel figures as so...
> -
> - | DA9121 DA9122 DA9220 DA9217
> - | /DA9130 /DA9131 /DA9132
> - -------------------------------------------------------------------
> - Output current / channel | 10000000 5000000 3000000 6000000
> - Output current / phase | 5000000 5000000 3000000 3000000
> - -------------------------------------------------------------------
> - Min regulator-min-microvolt| 300000 300000 300000 300000
> - Max regulator-max-microvolt| 1900000 1900000 1900000 1900000
> - Device hardware default | 1000000 1000000 1000000 1000000
> - -------------------------------------------------------------------
> - Min regulator-min-microamp | 7000000 3500000 3500000 7000000
> - Max regulator-max-microamp | 20000000 10000000 6000000 12000000
> - Device hardware default | 15000000 7500000 5500000 11000000
> + Dialog Semiconductor DA9141 Single-channel 40A quad-phase buck converter
> + Dialog Semiconductor DA9142 Single-channel 20A double-phase buck converter
> +
> + Device parameter ranges
> +
> + The current limits can be set to at/near double the rated current per channel
> + to allow for transient peaks.
> + Current limit changes when the output is enabled are not supported, as a
> + precaution against undefined behaviour.
> +
> + |----------------------------------------------|
> + | | range & reset default value |
> + | Device |------------------------------|
> + | | microvolt | microamp |
> + |----------------------------------------------|
> + | DA9121/DA9130 | Min: 300000 | Min: 7000000 |
> + | | Max: 1900000 | Max: 20000000 |
> + |----------------------------------------------|
> + | DA9121/DA9131 | Min: 300000 | Min: 3500000 |
> + | | Max: 1900000 | Max: 10000000 |
> + |----------------------------------------------|
> + | DA9121/DA9131 | Min: 300000 | Min: 3500000 |
> + | | Max: 1900000 | Max: 6000000 |
> + |----------------------------------------------|
> + | DA9217 | Min: 300000 | Min: 7000000 |
> + | | Max: 1900000 | Max: 12000000 |
> + |----------------------------------------------|
> + | DA9141 | Min: 300000 | Min: 26000000 |
> + | | Max: 1300000 | Max: 78000000 |
> + |----------------------------------------------|
> + | DA9142 | Min: 300000 | Min: 13000000 |
> + | | Max: 1300000 | Max: 39000000 |
> + |----------------------------------------------|
>
> properties:
> $nodename:
> @@ -51,6 +63,8 @@ properties:
> - dlg,da9130
> - dlg,da9131
> - dlg,da9132
> + - dlg,da9141
> + - dlg,da9142
>
> reg:
> maxItems: 1
> @@ -69,26 +83,24 @@ properties:
>
> regulators:
> type: object
> - $ref: regulator.yaml#
> description: |
> - This node defines the settings for the BUCK. The content of the
> - sub-node is defined by the standard binding for regulators; see regulator.yaml.
> - The DA9121 regulator is bound using their names listed below
> - buck1 - BUCK1
> - buck2 - BUCK2 //DA9122, DA9220, DA9131, DA9132 only
> + List of regulators provided by the device
>
> patternProperties:
> "^buck([1-2])$":
> type: object
> $ref: regulator.yaml#
> + description: |
> + Properties for a single BUCK regulator
>
> properties:
> - regulator-mode:
> - maxItems: 1
> - description: Defined in include/dt-bindings/regulator/dlg,da9121-regulator.h
> + regulator-name:
> + pattern: "^BUCK([1-2])$"
> + description: |
> + BUCK2 present in DA9122, DA9220, DA9131, DA9132 only
>
> regulator-initial-mode:
> - maxItems: 1
> + enum: [ 0, 1, 2, 3 ]
> description: Defined in include/dt-bindings/regulator/dlg,da9121-regulator.h
>
> enable-gpios:
> @@ -97,6 +109,7 @@ properties:
>
> dlg,ripple-cancel:
> $ref: "/schemas/types.yaml#/definitions/uint32"
> + enum: [ 0, 1, 2, 3 ]
> description: |
> Defined in include/dt-bindings/regulator/dlg,da9121-regulator.h
> Only present on multi-channel devices (DA9122, DA9220, DA9131, DA9132)
> --
> 2.25.1
>
>

2021-11-29 00:54:38

by Rob Herring

[permalink] [raw]
Subject: Re: [PATCH V3 2/3] dt-bindings: da9121: Add DA914x binding info

On Tue, 23 Nov 2021 23:27:57 +0000, Adam Ward wrote:
> Signed-off-by: Adam Ward <[email protected]>
> ---
> .../bindings/regulator/dlg,da9121.yaml | 75 +++++++++++--------
> 1 file changed, 44 insertions(+), 31 deletions(-)
>

Reviewed-by: Rob Herring <[email protected]>

2021-11-29 15:27:33

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH v3 3/3] regulator: da9121: Add DA914x support

On Tue, Nov 23, 2021 at 11:27:58PM +0000, Adam Ward wrote:
> Signed-off-by: Adam Ward <[email protected]>

This doesn't build:

/mnt/kernel/drivers/regulator/da9121-regulator.c:571:8: error: 'DA9141_IDX_BUCK1' undeclared here (not in a function); did you mean 'DA9121_IDX_BUCK1'?
571 | .id = DA9141_IDX_BUCK1,
| ^~~~~~~~~~~~~~~~
| DA9121_IDX_BUCK1
/mnt/kernel/drivers/regulator/da9121-regulator.c:595:8: error: 'DA914X_IDX_BUCK1' undeclared here (not in a function); did you mean 'DA9121_IDX_BUCK1'?
595 | .id = DA914X_IDX_BUCK1,
| ^~~~~~~~~~~~~~~~
| DA9121_IDX_BUCK1
/mnt/kernel/drivers/regulator/da9121-regulator.c: In function 'da9121_check_device_type':
/mnt/kernel/drivers/regulator/da9121-regulator.c:915:55: error: 'DA914X_DEVICE_ID' undeclared (first use in this function); did you mean 'DA914x_DEVICE_ID'?
915 | if ((device_id != DA9121_DEVICE_ID) && (device_id != DA914X_DEVICE_ID) {
| ^~~~~~~~~~~~~~~~
| DA914x_DEVICE_ID
/mnt/kernel/drivers/regulator/da9121-regulator.c:915:55: note: each undeclared identifier is reported only once for each function it appears in
/mnt/kernel/drivers/regulator/da9121-regulator.c:915:72: error: expected ')' before '{' token
915 | if ((device_id != DA9121_DEVICE_ID) && (device_id != DA914X_DEVICE_ID) {
| ~ ^~
| )
/mnt/kernel/drivers/regulator/da9121-regulator.c:996:1: error: expected expression before '}' token
996 | }
| ^
/mnt/kernel/drivers/regulator/da9121-regulator.c:912:3: error: label 'error' used but not defined
912 | goto error;
| ^~~~
/mnt/kernel/drivers/regulator/da9121-regulator.c:900:7: error: unused variable 'config_match' [-Werror=unused-variable]
900 | bool config_match = false;
| ^~~~~~~~~~~~
/mnt/kernel/drivers/regulator/da9121-regulator.c:899:8: error: unused variable 'type' [-Werror=unused-variable]
899 | char *type;
| ^~~~
/mnt/kernel/drivers/regulator/da9121-regulator.c:898:18: error: unused variable 'variant_vrc' [-Werror=unused-variable]
898 | u8 variant_mrc, variant_vrc;
| ^~~~~~~~~~~
/mnt/kernel/drivers/regulator/da9121-regulator.c:898:5: error: unused variable 'variant_mrc' [-Werror=unused-variable]
898 | u8 variant_mrc, variant_vrc;
| ^~~~~~~~~~~
/mnt/kernel/drivers/regulator/da9121-regulator.c:996:1: error: no return statement in function returning non-void [-Werror=return-type]
996 | }
| ^


Attachments:
(No filename) (2.67 kB)
signature.asc (488.00 B)
Download all attachments

2021-11-29 22:11:49

by Adam Ward

[permalink] [raw]
Subject: RE: [PATCH v3 3/3] regulator: da9121: Add DA914x support

On Tues, Nov 29, 2021 at 15:25, Mark Brown wrote:
> This doesn't build:
Apologies for this

2021-12-01 18:35:18

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH V3 0/3] regulator: da9121: add DA914x support

On Tue, 23 Nov 2021 23:27:54 +0000, Adam Ward wrote:
> This series extends the DA9121 driver to add support for related products:
>
> DA9141, 40A, Quad-Phase
> DA9142, 20A, Dual-Phase
>
> The changing of current limit when active is now prohibited, for the range,
> due to possibility of undefined behaviour during transition
>
> [...]

Applied to

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

Thanks!

[1/3] dt-bindings: da9121: Remove erroneous compatible from binding
(no commit info)
[2/3] dt-bindings: da9121: Add DA914x binding info
(no commit info)
[3/3] regulator: da9121: Add DA914x support
commit: c5187a245e9bb0af2da8d37ede191569c824c66b

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