Commit graph

166 commits

Author SHA1 Message Date
Zhaoxiang Jin fd736c4f2d drivers: regulator/nxp_vref: Remove nxp_ground_select property
Remove nxp_ground_select property.
Delete the use of NXP vref peripheral CSR register REFL_GRL_SEL bit.

Signed-off-by: Zhaoxiang Jin <Zhaoxiang.Jin_1@nxp.com>
2024-05-15 17:28:38 +02:00
Zhaoxiang Jin 5dde5416b3 drivers: regulator/nxp_vref: Fixed incorrect input parameter
Fixed incorrect parameter passed in function linear_range_get_value.

Signed-off-by: Zhaoxiang Jin <Zhaoxiang.Jin_1@nxp.com>
2024-05-15 17:28:38 +02:00
Mykola Kvach 69c6732d23 drivers: regulator: fixed warning during build in gpio regulator
Fix warning in gpio regulator:
    "declaration of 'ret' shadows a previous local".

Signed-off-by: Mykola Kvach <xakep.amatop@gmail.com>
2024-05-15 17:07:51 +02:00
Jerzy Kasenberg f2e3d3f951 soc: smartbond: Move PM_DEVICE dependency to soc
For DA1469x if PM config is selected PM_DEVICE must also
be selected for GPIO to work when device enters/exists
deep sleep.

Previously GPIO and regulator drivers selected PM_DEVICE
when PM was enabled.
Now it is moved to SOC instead.

PM_DEVICE selection in GPIO could result in circular dependency
for mcux if MEMC_MCUX_FLEXSPI (which is already dependent on PM_DEVICE)
was to be additionally dependent on GPIO.

Signed-off-by: Jerzy Kasenberg <jerzy.kasenberg@codecoup.pl>
2024-05-14 17:05:03 +02:00
Balaji Srinivasan d9b3ffa5ea drivers: regulator: npm6001: Fix compiler warning
This patch fixes a compiler warning about the val being used
uninitialized. The previously present if check did not seem to satisfy
compiler. Hence the val is now explictly initialized.

Signed-off-by: Balaji Srinivasan <balaji.srinivasan@nordicsemi.no>
2024-05-13 09:54:48 -05:00
Mike J. Chen d371a0f9ad drivers: regulator: shell: fix strcmp usage bug in cmd_adset
Bug in "enable/disable" argument parsing would cause
the oppostive of the requested setting to get
passed to active discharge API invocation.

Signed-off-by: Mike J. Chen <mjchen@google.com>
2024-05-10 11:50:15 +02:00
Mike J. Chen 6c244cf440 drivers: regulator: shell: print all 6-digits of micro values
Previously only the upper/first 3 digits of a micro value
would be printed, dropping the last 3 digits. This could cause
misleading output for cmds like vlist.

Signed-off-by: Mike J. Chen <mjchen@google.com>
2024-05-09 10:29:18 +02:00
Benjamin Cabé 30ce8b1b18 drivers: fix bad SPDX-License-Identifier header
fix typo in SPDX header

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2024-05-08 09:23:16 -04:00
Jerzy Kasenberg 0a60adc333 drivers: regulator: Smartbond: Fix current and voltage get functions
Argument to FIELD_GET macro was mixed up resulting in
incorrect values being reported for voltage and current

Signed-off-by: Jerzy Kasenberg <jerzy.kasenberg@codecoup.pl>
2024-05-08 11:59:43 +02:00
Mike J. Chen 40a8022e4a drivers: regulator: shell: add is_enabled cmd
Reports whether regulator is enabled or disabled

Signed-off-by: Mike J. Chen <mjchen@google.com>
2024-05-01 13:12:24 +02:00
Benjamin Cabé a761c55144 drivers: regulator: fix NXP VREF Kconfig leakage
Properly guard NXP VREF driver Kconfig options.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2024-04-26 19:48:11 +01:00
Ricardo Rivera-Matos 4928f3b7ff regulator: cp9314: Adds regulator_get_error_flags support
Adds a handler to check error flag bits. This should be called
by applications that call regulator_enable and receive -EINVAL
as a return.

Signed-off-by: Ricardo Rivera-Matos <rriveram@opensource.cirrus.com>
2024-04-26 16:08:39 +02:00
Ricardo Rivera-Matos f9ce311855 regulator: cp9314: Adds support for PGOOD pin
Adds support for the PGOOD pin. This pin is asserted by the
regulator when converter startup has completed and the output
is stable. If the PGOOD pin is not used, the PGOOD state is
check via the PGOOD_PIN_STS bit.

Signed-off-by: Ricardo Rivera-Matos <rriveram@opensource.cirrus.com>
2024-04-26 16:08:39 +02:00
Ricardo Rivera-Matos 99816aba6b regulator: cp9314: Tidies regulator enable conditional
Enables the converter via I2C as the else case when the EN pin
conditional fails. This used to not matter as no code followed,
but this will change in subsequent patches.

Signed-off-by: Ricardo Rivera-Matos <rriveram@opensource.cirrus.com>
2024-04-26 16:08:39 +02:00
Jerzy Kasenberg 1d83fa521c drivers: regulator: Add power management to DCDC
This change restore DCDC configuration after system resumes.

When CONFIG_PM_DEVICE is enabled each of the four rails that
support DCDC handle resume in regulator_da1469x_pm_action function.

Signed-off-by: Jerzy Kasenberg <jerzy.kasenberg@codecoup.pl>
2024-04-25 16:17:53 +02:00
Ricardo Rivera-Matos 30b27c73c3 regulator: cp9314: Cleans sleep related preprocesor directives
Removes conditional calling k_busy_wait() on single threaded
systems and uses k_sleep for both single and multi threaded
systems.

Commit e375d82 ("kernel: Implement k_sleep for Single Thread")
eliminated the need to call k_busy_wait() on single threaded
systems in place of k_sleep.

Signed-off-by: Ricardo Rivera-Matos <rriveram@opensource.cirrus.com>
2024-04-12 16:52:18 -04:00
Ricardo Rivera-Matos 7afc5932f0 regulator: regulator_common: Cleans sleep related preprocesor directives
Removes conditional calling k_busy_wait() on single threaded
systems and uses k_sleep for both single and multi threaded
systems.

Commit e375d82 ("kernel: Implement k_sleep for Single Thread")
eliminated the need to call k_busy_wait() on single threaded
systems in place of k_sleep.

Signed-off-by: Ricardo Rivera-Matos <rriveram@opensource.cirrus.com>
2024-04-12 16:52:18 -04:00
Ricardo Rivera-Matos 64a959c922 regulator: cp9314: Prevents reset while switching
Configures and initializes the EN GPIO to inactive prior
to calling the soft reset sequence during probe. The EN
pin may have been left asserted by the hardware on some systems.

Signed-off-by: Ricardo Rivera-Matos <rriveram@opensource.cirrus.com>
2024-03-21 13:16:56 -05:00
Ryan McClelland f41c900b03 drivers: regulator: fix shell help typo
Fix typo with adget shell help

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2024-03-11 10:18:18 -04:00
Martin Kiepfer 1a94b0ab24 drivers: regulator: axp192: Bugfix to control DCDC2 output
Fix wrong definition of DCDC2 register values.

Signed-off-by: Martin Kiepfer <mrmarteng@teleschirm.org>
2024-03-06 10:23:31 +00:00
Andy Sinclair b46e2f3d8a drivers: regulator: fake: Added is_enabled property
Added is_enabled devicetree property to fake regulator.
Allows testing of init behaviour when regulator is enabled
in hardware.

Signed-off-by: Andy Sinclair <andy.sinclair@nordicsemi.no>
2024-03-05 09:43:17 -05:00
Andy Sinclair 977fc0c2ad drivers: regulator: common: Added regulator-boot-off
Added regulator-boot-off option to common regulator driver.

Signed-off-by: Andy Sinclair <andy.sinclair@nordicsemi.no>
2024-03-05 09:43:17 -05:00
Ricardo Rivera-Matos 814a1875f6 drivers: regulator: cp9314: adds initial support
Adds support for the CP9314 switched capacitor converter. The
CP9314 is a multi-level DC/DC converter capable of operating in
2:1 and 3:1 modes.

Signed-off-by: Ricardo Rivera-Matos <rriveram@opensource.cirrus.com>
2024-02-27 14:57:12 +01:00
Ryan McClelland 4fb4f71f08 drivers: regulator: pca9420: implement active discharge api
Implement the api for controlling the active discharge setting within
the pca9420.

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2024-01-29 09:43:39 +01:00
Ryan McClelland 0f8ab3cf2d drivers: regulator: add active discharge api to regulator shell
Add the active discharge functions that can be called from the
regulator shell.

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2024-01-29 09:43:39 +01:00
Ryan McClelland 97efd21ce9 tests: drivers: regulator: add api test for active discharge
Add tests for active discharge apis not being implemented.

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2024-01-29 09:43:39 +01:00
Ryan McClelland 5a125a619c regulator: add active-discharge api
Add an active discharge api for regulators. This uses the already
existing but previously unused regulator-active-discharge
property.

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2024-01-29 09:43:39 +01:00
Bartosz Bilas c1a1e4524d drivers: regulator: max20335: add support for ship mode
Allows the user to disable PMIC.

Signed-off-by: Bartosz Bilas <b.bilas@grinn-global.com>
2024-01-10 16:29:30 -05:00
Bartosz Bilas 7213e8e1f5 drivers: regulator: max20335: allow current limit operations only for BUCKs
LDOs don't have such possibility so add the extra checks.

Signed-off-by: Bartosz Bilas <b.bilas@grinn-global.com>
2024-01-08 14:16:55 +01:00
Bartosz Bilas 7ef10d0f71 drivers: regulator: add regulator-init-microamp property
It allows setting regulator current value during driver
initialization automatically.

Signed-off-by: Bartosz Bilas <b.bilas@grinn-global.com>
2024-01-05 09:07:10 +01:00
Bartosz Bilas cafe9a5632 drivers: regulator: max20335: fix unused-const-variable warnings
There can be a case where not all regulators are being used,
resulting in an unused-const-variable warning,
so let's add a __maybe_unused keyword to suppress it.

Signed-off-by: Bartosz Bilas <b.bilas@grinn-global.com>
2024-01-04 13:52:02 +01:00
Andy Sinclair b3fdb7477b drivers: regulator: fixed: Removed pin state setting from init
The setting of initial state in handled by the common driver,
which calls the enable function for any regulator that has
regulator-boot-on set, and is not already enabled.

Signed-off-by: Andy Sinclair <andy.sinclair@nordicsemi.no>
2024-01-03 18:59:12 +00:00
Andy Sinclair c3a54ae1c3 drivers: regulator: Fixed reference counting during enable
Reference counting was broken when adding the enable delay.
Now reverted to previous pattern.

Signed-off-by: Andy Sinclair <andy.sinclair@nordicsemi.no>
2023-11-23 09:51:39 +00:00
Jerzy Kasenberg 46bbe052d3 drivers: regulator: add LDO/DCDC support for Smartbond.
This add regulator driver for Smartbond DA1469X SOC.
Driver can control VDD, V14, V18, V18P, V30 rails,
full voltage range supported by SOC is covered.
For VDD, V14, V18, V18P DCDC can be configured.

Special VDD_CLAMP (always on) and VDD_SLEPP are added
to allow configuration of VDD in sleep modes.

Signed-off-by: Jerzy Kasenberg <jerzy.kasenberg@codecoup.pl>
2023-11-22 14:55:16 +00:00
Henrik Brix Andersen c0c8952739 shell: do not enable subsystem/driver shell modules by default
Do not enable subsystem/driver shell modules by default and stop abusing
CONFIG_SHELL_MINIMAL, which is internal to the shell subsystem, to decide
when to enable a driver shell.

The list of shell modules has grown considerably through the
years. Enabling CONFIG_SHELL for doing e.g. an interactive debug session
leads to a large number of shell modules also being enabled unless
explicitly disabled, which again leads to non-negligible increases in
RAM/ROM usage.

This commit attempts to establish a policy of subsystem/driver shell
modules being disabled by default, requiring the user/application to
explicitly enable only those needed.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-11-20 09:21:40 +01:00
Andy Sinclair 04e18f093f drivers: regulator: Added startup and off/on delay to common driver
A configurable delay during regulator switch on is currently
only supported by the GPIO and fixed regulator drivers.

This functionality has been moved to the common driver, so it can
be easily added to any regulator driver.

Signed-off-by: Andy Sinclair <andy.sinclair@nordicsemi.no>
2023-11-13 21:30:10 +00:00
Andy Sinclair 0cbe0298cb drivers: regulator: npm1300: Fixed LDSW GPIO control
The load switch / LDO pin configuration function now
correctly configures the associated GPIO pin.

Signed-off-by: Andy Sinclair <andy.sinclair@nordicsemi.no>
2023-11-09 15:32:17 +01:00
Andy Sinclair 488f56c033 drivers: regulator: npm1300: soft start configuration
Added configuration of soft start functionality

Signed-off-by: Andy Sinclair <andy.sinclair@nordicsemi.no>
2023-11-09 15:32:17 +01:00
Andy Sinclair ec52722861 drivers: regulator: npm1300: Add boot state detection
Added boot state detection, so that the reference count is
set correctly and enable/disable work as expected.

With this fix it is no longer necessary to set
regulator-boot-on when the regulator is enabled in hardware.

Signed-off-by: Andy Sinclair <andy.sinclair@nordicsemi.no>
2023-11-07 14:48:15 +00:00
Bartosz Bilas e87fd3165f drivers: regulator: add MAX20335 driver
Add a MAX20335 MFD subdriver to manage the built-in PMIC.

Signed-off-by: Bartosz Bilas <b.bilas@grinn-global.com>
2023-11-02 20:32:40 +00:00
Bartosz Bilas 75444bdc64 drivers: regulator: axp192: fix init priority
That was missed in 66f5fce commit so let's adjust it as well.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2023-11-02 15:02:00 +00:00
Bartosz Bilas e2b01a3c48 drivers: regulator: shell: make use of the regulator current limits support
Add a new `clist` regulator shell subcommand that prints
the list of supported current limits for specified regulator device.

Signed-off-by: Bartosz Bilas <b.bilas@grinn-global.com>
2023-11-01 11:00:39 +00:00
Bartosz Bilas 66f5fce68f drivers: mfd: gpio: adjust init priority
Take into account the SPI bus init priorirty
that can be used for MFD drivers.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2023-10-26 09:50:31 +02:00
Jamie McCrae b3f3d90262 drivers: regulator: fixed/gpio: Add non-multithreading support
Adds support for using the fixed and GPIO regulator drivers when
multithreading is disabled, such as in MCUboot.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-10-26 09:49:35 +02:00
Dennis Grijalva 2516aa8b0b drivers: regulator: pca9420: Add support for configuring ASYS UVLO
Add support for configuring ASYS UVLO (under voltage lock out) threshold

Signed-off-by: Dennis Grijalva <dennisgrijalva@meta.com>
2023-10-20 15:14:04 +02:00
Declan Snyder b1d2a8a9b6 drivers: regulator: Add NXP VREF driver
Add binding, include header, and driver for NXP VREF IP block.

NXP VREF is an internal voltage reference generator on some SOCs
that fits well with the regulator API in zephyr.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-09-21 09:26:57 +02:00
Andy Sinclair dd52908fcf drivers: regulator: npm1300: Set voltage checks existing setting
Regulator voltage setting is not applied if the device output
is already configured for the requested voltage.
This change is needed to ensure correct device behaviour.

Signed-off-by: Andy Sinclair <andy.sinclair@nordicsemi.no>
2023-09-13 11:48:33 +02:00
Andy Sinclair 49ef9be4b9 drivers: regulator: npm1300: Add PFM mode
Set regulator mode updated to support forced PFM mode

Signed-off-by: Andy Sinclair <andy.sinclair@nordicsemi.no>
2023-09-13 11:48:33 +02:00
Nick Ward 2d65acca3a drivers: gpio: use gpio_is_ready_dt helper function
Update `struct gpio_dt_spec` use with gpio_is_ready_dt()

Signed-off-by: Nick Ward <nix.ward@gmail.com>
2023-08-28 08:48:35 -05:00
Martin Kiepfer 74db02bad1 drivers: gpio: AXP192 GPIO driver
AXP192 is a small power management IC, that also
features 5 GPIOS.
Besides GPIO driver this commit also includes needed modifications
in axp192 regulator and mfd driver as LDOIO0 functioanlity
is multiplexed with GPIO0 pin.

Signed-off-by: Martin Kiepfer <mrmarteng@teleschirm.org>
2023-08-22 18:08:51 +02:00