* [PATCH 0/2] Allow caching of buck registers when no GPIO input control is configured
@ 2026-03-09 15:52 André Svensson
2026-03-09 15:52 ` [PATCH 1/2] regulator: dt-bindings: dlg,da9121: Add dlg,no-gpio-control André Svensson
2026-03-09 15:52 ` [PATCH 2/2] regulator: da9121: Allow caching BUCK registers André Svensson
0 siblings, 2 replies; 5+ messages in thread
From: André Svensson @ 2026-03-09 15:52 UTC (permalink / raw)
To: Support Opensource, Liam Girdwood, Mark Brown, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Adam Ward
Cc: linux-kernel, devicetree, kernel, Waqar Hameed, André Svensson
This series introduces a boolean DT property, dlg,no-gpio-control, for
the DA91xx regulators. Use this property to indicate that GPIO control
is not configured with the functions DVC/RELOAD/EN, allowing buck
registers to be cached.
The DA9121 driver checks dlg,no-gpio-control and updates regmap_config's
volatile_table if the property is present. Buck registers are removed
from the volatile_table if the property is present, enabling caching of
the registers, which removes I2C reads when performing an I2C write to
the buck registers.
---
André Svensson (2):
regulator: dt-bindings: dlg,da9121: Add dlg,no-gpio-control
regulator: da9121: Allow caching BUCK registers
.../devicetree/bindings/regulator/dlg,da9121.yaml | 49 ++++++++++++++++++++++
drivers/regulator/da9121-regulator.c | 35 +++++++++++++---
2 files changed, 78 insertions(+), 6 deletions(-)
---
base-commit: 05f7e89ab9731565d8a62e3b5d1ec206485eeb0b
change-id: 20260309-no-gpio-control-9cc02b1e8994
Best regards,
--
André Svensson <andre.svensson@axis.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/2] regulator: dt-bindings: dlg,da9121: Add dlg,no-gpio-control
2026-03-09 15:52 [PATCH 0/2] Allow caching of buck registers when no GPIO input control is configured André Svensson
@ 2026-03-09 15:52 ` André Svensson
2026-03-09 16:30 ` Mark Brown
2026-03-09 15:52 ` [PATCH 2/2] regulator: da9121: Allow caching BUCK registers André Svensson
1 sibling, 1 reply; 5+ messages in thread
From: André Svensson @ 2026-03-09 15:52 UTC (permalink / raw)
To: Support Opensource, Liam Girdwood, Mark Brown, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Adam Ward
Cc: linux-kernel, devicetree, kernel, Waqar Hameed, André Svensson
Add the optional boolean property dlg,no-gpio-control. When present, it
indicates that no DA91xx GPIO pins are configured/used with functions
RELOAD/DVC/EN, which can affect the output voltage control, regulator
mode control and enable signal control.
It is mutually exclusive with enable-gpios, regardless of whether the
referenced GPIO is connected to a GPIO pin or the IC_EN pin, since
enable-gpios allows the regulator to be controlled via an external
hardware signal.
Co-developed-by: Waqar Hameed <waqar.hameed@axis.com>
Signed-off-by: Waqar Hameed <waqar.hameed@axis.com>
Signed-off-by: André Svensson <andre.svensson@axis.com>
---
.../devicetree/bindings/regulator/dlg,da9121.yaml | 49 ++++++++++++++++++++++
1 file changed, 49 insertions(+)
diff --git a/Documentation/devicetree/bindings/regulator/dlg,da9121.yaml b/Documentation/devicetree/bindings/regulator/dlg,da9121.yaml
index 13b3f75f8e5e..ce76eb5b85bd 100644
--- a/Documentation/devicetree/bindings/regulator/dlg,da9121.yaml
+++ b/Documentation/devicetree/bindings/regulator/dlg,da9121.yaml
@@ -81,6 +81,14 @@ properties:
Specify the polling period, measured in milliseconds, between interrupt status
update checks. Range 1000-10000 ms.
+ dlg,no-gpio-control:
+ type: boolean
+ description: |
+ Available GPIO input pins of the regulator are strapped to fixed levels, therefore
+ GPIO configurable input functions, DVC/RELOAD/EN, cannot dynamically update BUCK
+ registers. GPIO pins connected as output pins are not required to be strapped to a
+ fixed level. Not allowed together with enable-gpios.
+
regulators:
type: object
additionalProperties: false
@@ -134,6 +142,17 @@ allOf:
properties:
buck2: false
+ - if:
+ required:
+ - dlg,no-gpio-control
+ then:
+ properties:
+ regulators:
+ patternProperties:
+ "^buck([1-2])$":
+ properties:
+ enable-gpios: false
+
additionalProperties: false
examples:
@@ -168,6 +187,36 @@ examples:
};
};
+ - |
+ #include <dt-bindings/interrupt-controller/irq.h>
+ #include <dt-bindings/regulator/dlg,da9121-regulator.h>
+ i2c {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ pmic@68 {
+ compatible = "dlg,da9121";
+ reg = <0x68>;
+
+ interrupt-parent = <&gpio6>;
+ interrupts = <11 IRQ_TYPE_LEVEL_LOW>;
+
+ dlg,irq-polling-delay-passive-ms = <2000>;
+ dlg,no-gpio-control;
+
+ regulators {
+ DA9121_BUCK: buck1 {
+ regulator-name = "BUCK1";
+ regulator-min-microvolt = <300000>;
+ regulator-max-microvolt = <1900000>;
+ regulator-min-microamp = <7000000>;
+ regulator-max-microamp = <20000000>;
+ regulator-boot-on;
+ regulator-initial-mode = <DA9121_BUCK_MODE_AUTO>;
+ };
+ };
+ };
+ };
+
- |
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/interrupt-controller/irq.h>
--
2.43.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2/2] regulator: da9121: Allow caching BUCK registers
2026-03-09 15:52 [PATCH 0/2] Allow caching of buck registers when no GPIO input control is configured André Svensson
2026-03-09 15:52 ` [PATCH 1/2] regulator: dt-bindings: dlg,da9121: Add dlg,no-gpio-control André Svensson
@ 2026-03-09 15:52 ` André Svensson
1 sibling, 0 replies; 5+ messages in thread
From: André Svensson @ 2026-03-09 15:52 UTC (permalink / raw)
To: Support Opensource, Liam Girdwood, Mark Brown, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Adam Ward
Cc: linux-kernel, devicetree, kernel, Waqar Hameed, André Svensson
Some BUCK registers may change without software writes when GPIO pins
are configured for functions DVC/RELOAD/EN. If the board does
not use these pin-controlled features, caching is possible.
Caching buck registers removes unnecessary I2C reads when performing
register updates. For example, updating regulator mode can result in
two I2C reads, one from the regulator core regulator_set_mode and one
from the DA9121 driver, where da9121_buck_set_mode uses
regmap_update_bits (read/modify/write).
Check for the optional DT property dlg,no-gpio-control. When present,
select the regmap configuration which does not mark the BUCK1 register
block (DA9121_REG_BUCK_BUCK1_0..DA9121_REG_BUCK_BUCK1_6) as volatile, so
that regmap can cache BUCK1 registers and avoid unnecessary I2C reads.
The dlg,no-gpio-control property is mutually exclusive with
enable-gpios, regardless of whether the referenced GPIO is connected to
a GPIO pin or the IC_EN pin, since pulling IC_EN low powers down the
regulator and registers are reinitialized at startup, leaving cached
values stale.
Co-developed-by: Waqar Hameed <waqar.hameed@axis.com>
Signed-off-by: Waqar Hameed <waqar.hameed@axis.com>
Signed-off-by: André Svensson <andre.svensson@axis.com>
---
drivers/regulator/da9121-regulator.c | 35 +++++++++++++++++++++++++++++------
1 file changed, 29 insertions(+), 6 deletions(-)
diff --git a/drivers/regulator/da9121-regulator.c b/drivers/regulator/da9121-regulator.c
index ef161eb0ca27..ed62a41deb84 100644
--- a/drivers/regulator/da9121-regulator.c
+++ b/drivers/regulator/da9121-regulator.c
@@ -864,6 +864,21 @@ static const struct regmap_access_table da9121_volatile_table = {
.n_yes_ranges = ARRAY_SIZE(da9121_volatile_ranges),
};
+/*
+ * When GPIO functions DVC/RELOAD/EN are not used, the registers in the range
+ * DA9121_REG_BUCK_BUCK1_0 to DA9121_REG_BUCK_BUCK1_6 need not be volatile
+ * because register writes to these registers can only be performed via I2C.
+ */
+static const struct regmap_range da9121_volatile_ranges_no_gpio_ctrl[] = {
+ regmap_reg_range(DA9121_REG_SYS_STATUS_0, DA9121_REG_SYS_EVENT_2),
+ regmap_reg_range(DA9121_REG_SYS_GPIO0_0, DA9121_REG_SYS_GPIO2_1),
+};
+
+static const struct regmap_access_table da9121_volatile_table_no_gpio_ctrl = {
+ .yes_ranges = da9121_volatile_ranges_no_gpio_ctrl,
+ .n_yes_ranges = ARRAY_SIZE(da9121_volatile_ranges_no_gpio_ctrl),
+};
+
/* DA9121 regmap config for 1 channel variants */
static const struct regmap_config da9121_1ch_regmap_config = {
.reg_bits = 8,
@@ -994,10 +1009,18 @@ static int da9121_assign_chip_model(struct i2c_client *i2c,
struct da9121 *chip)
{
const struct regmap_config *regmap;
+ struct regmap_config regmap_config_1ch = da9121_1ch_regmap_config;
+ struct regmap_config regmap_config_2ch = da9121_2ch_regmap_config;
+
int ret = 0;
chip->dev = &i2c->dev;
+ if (of_property_read_bool(i2c->dev.of_node, "dlg,no-gpio-control")) {
+ regmap_config_1ch.volatile_table = &da9121_volatile_table_no_gpio_ctrl;
+ regmap_config_2ch.volatile_table = &da9121_volatile_table_no_gpio_ctrl;
+ }
+
/* Use configured subtype to select the regulator descriptor index and
* register map, common to both consumer and automotive grade variants
*/
@@ -1005,29 +1028,29 @@ static int da9121_assign_chip_model(struct i2c_client *i2c,
case DA9121_SUBTYPE_DA9121:
case DA9121_SUBTYPE_DA9130:
chip->variant_id = DA9121_TYPE_DA9121_DA9130;
- regmap = &da9121_1ch_regmap_config;
+ regmap = ®map_config_1ch;
break;
case DA9121_SUBTYPE_DA9217:
chip->variant_id = DA9121_TYPE_DA9217;
- regmap = &da9121_1ch_regmap_config;
+ regmap = ®map_config_1ch;
break;
case DA9121_SUBTYPE_DA9122:
case DA9121_SUBTYPE_DA9131:
chip->variant_id = DA9121_TYPE_DA9122_DA9131;
- regmap = &da9121_2ch_regmap_config;
+ regmap = ®map_config_2ch;
break;
case DA9121_SUBTYPE_DA9220:
case DA9121_SUBTYPE_DA9132:
chip->variant_id = DA9121_TYPE_DA9220_DA9132;
- regmap = &da9121_2ch_regmap_config;
+ regmap = ®map_config_2ch;
break;
case DA9121_SUBTYPE_DA9141:
chip->variant_id = DA9121_TYPE_DA9141;
- regmap = &da9121_1ch_regmap_config;
+ regmap = ®map_config_1ch;
break;
case DA9121_SUBTYPE_DA9142:
chip->variant_id = DA9121_TYPE_DA9142;
- regmap = &da9121_2ch_regmap_config;
+ regmap = ®map_config_2ch;
break;
default:
return -EINVAL;
--
2.43.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] regulator: dt-bindings: dlg,da9121: Add dlg,no-gpio-control
2026-03-09 15:52 ` [PATCH 1/2] regulator: dt-bindings: dlg,da9121: Add dlg,no-gpio-control André Svensson
@ 2026-03-09 16:30 ` Mark Brown
2026-03-10 8:55 ` André Svensson
0 siblings, 1 reply; 5+ messages in thread
From: Mark Brown @ 2026-03-09 16:30 UTC (permalink / raw)
To: André Svensson
Cc: Support Opensource, Liam Girdwood, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Adam Ward, linux-kernel,
devicetree, kernel, Waqar Hameed
[-- Attachment #1: Type: text/plain, Size: 684 bytes --]
On Mon, Mar 09, 2026 at 04:52:35PM +0100, André Svensson wrote:
> Add the optional boolean property dlg,no-gpio-control. When present, it
> indicates that no DA91xx GPIO pins are configured/used with functions
> RELOAD/DVC/EN, which can affect the output voltage control, regulator
> mode control and enable signal control.
> It is mutually exclusive with enable-gpios, regardless of whether the
> referenced GPIO is connected to a GPIO pin or the IC_EN pin, since
> enable-gpios allows the regulator to be controlled via an external
> hardware signal.
This should probably explain why we can't infer the absence of GPIOs
from the lack of any relevant GPIO properties.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] regulator: dt-bindings: dlg,da9121: Add dlg,no-gpio-control
2026-03-09 16:30 ` Mark Brown
@ 2026-03-10 8:55 ` André Svensson
0 siblings, 0 replies; 5+ messages in thread
From: André Svensson @ 2026-03-10 8:55 UTC (permalink / raw)
To: Mark Brown, André Svensson
Cc: Support Opensource, Liam Girdwood, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Adam Ward, linux-kernel,
devicetree, kernel, Waqar Hameed
On 3/9/26 5:30 PM, Mark Brown wrote:
> On Mon, Mar 09, 2026 at 04:52:35PM +0100, André Svensson wrote:
>> Add the optional boolean property dlg,no-gpio-control. When present, it
>> indicates that no DA91xx GPIO pins are configured/used with functions
>> RELOAD/DVC/EN, which can affect the output voltage control, regulator
>> mode control and enable signal control.
>
>> It is mutually exclusive with enable-gpios, regardless of whether the
>> referenced GPIO is connected to a GPIO pin or the IC_EN pin, since
>> enable-gpios allows the regulator to be controlled via an external
>> hardware signal.
>
> This should probably explain why we can't infer the absence of GPIOs
> from the lack of any relevant GPIO properties.
Thanks, I’ll clarify that in v2.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-03-10 8:55 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-03-09 15:52 [PATCH 0/2] Allow caching of buck registers when no GPIO input control is configured André Svensson
2026-03-09 15:52 ` [PATCH 1/2] regulator: dt-bindings: dlg,da9121: Add dlg,no-gpio-control André Svensson
2026-03-09 16:30 ` Mark Brown
2026-03-10 8:55 ` André Svensson
2026-03-09 15:52 ` [PATCH 2/2] regulator: da9121: Allow caching BUCK registers André Svensson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®