Commit Graph

21 Commits

Author SHA1 Message Date
Kumar Gala 8160f052d4 drivers: regulator: Update Kconfig
* Utilize DT_HAS_<COMPAT>_ENABLED for devicetree based drivers

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-17 09:58:55 -05:00
Kumar Gala 5eca3922d5 drivers: regulator_pmic: Fix compile issue
The regulator-pmic node is a child of the I2C device.  When this
was converted to i2c_dt_spec that was missed.

Also fixed a few minor formatting issues.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-23 09:23:37 -05:00
Benjamin Björnsson 4e841aea8d drivers: regulator: regulator_pmic: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-19 12:28:55 +00:00
Gerard Marull-Paretas fb60aab245 drivers: migrate includes to <zephyr/...>
In order to bring consistency in-tree, migrate all drivers to the new
prefix <zephyr/...>. Note that the conversion has been scripted, refer
to #45388 for more details.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-05-06 19:58:21 +02:00
Daniel DeGrasse 17979bdfb7 drivers: regulator: pmic: remove unneeded NULL check
Remove unneeded NULL check in pmic init function. Not required as
device_is_ready() will handle NULL device structs.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-01-28 10:06:21 +01:00
Daniel DeGrasse 3a4594e444 drivers: regulator: Remove non-const usage of config struct
Config struct in pmic regulator driver was being used as a non-constant
value when an array defined at compile time was cast to a struct used at
runtime. Move this pointer to the data struct in pmic driver.

Fixes #41951

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-01-28 10:06:21 +01:00
Gerard Marull-Paretas 1aeec129fc drivers: regulator: pmic: constify device config access
`const` was missing from one device config access.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas 3e9d8da9ec drivers: use DT_INST_PARENT
Replace usages of DT_PARENT(DT_DRV_INST(idx)) with more idiomatic
DT_INST_PARENT(idx).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-16 11:10:01 -06:00
Daniel DeGrasse cae297d917 drivers: pca9420: added support for current limit setting on PCA9420
Added ability to set VIN current limit when using the pca9420 PMIC

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2021-12-08 08:27:44 -05:00
Daniel DeGrasse 423dff8a51 drivers: pca9420: Added voltage level support for PCA9420
This commit adds support for editing the voltage levels on the buck
regulators on the PCA9420 PMIC

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2021-12-08 08:27:44 -05:00
Daniel DeGrasse 130f6eb816 drivers: regulator: add i2c regulator driver
This commit adds a generic i2c regulator driver, and enables the NXP
PCA9420 PMIC IC using this driver. The regulator driver also exposes an
additional API in include/drivers/regulator/consumer.h, which allows
drivers to implement support for adjusting voltage levels and current
limits, if their device supports it.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2021-12-08 08:27:44 -05:00
Jordan Yates 3b8e2f8983 drivers: regulator: convert to `gpio_dt_spec`
Convert regulator_fixed GPIO usage to utilize `struct gpio_dt_spec`.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-10-28 11:15:12 +02:00
Krzysztof Chruscinski 8e66894d4e drivers: regulator: Fix k_work_schedule return code handling
k_work_schedule may return other non-negative value than 0.
When driver was adapted to the new k_work API that was not
taken into account.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-09-24 06:36:50 -04:00
Gerard Marull-Paretas 2ca00a8aef drivers: regulator: remove usage of device_pm_control_nop
device_pm_control_nop is now deprecated in favour of NULL.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-04-28 16:43:29 -04:00
Johann Fischer b142a47f73 drivers: regulator: enable driver when compatible node is defined
Add regulator compatibility string to Kconfig.fixed file
and allow fixed regulator driver to be enabled when compatible
node is defined. However, remove this option from common Kconfig
as it is legitimate to enable/disable regulator support.

Change menuconfig REGULATOR_FIXED to config since this
menu nesting is not necessary.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-04-16 09:45:35 +02:00
Peter Bigot 571f9dbbd9 drivers: regulator: update to new delayable work API
Replace legacy API with new API.  Note that this driver uses the
schedule, not reschedule, API, since triggers for delay never overlap.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-03-03 20:06:00 -05:00
Kumar Gala 06a5946266 drivers: Convert to use new DEVICE_DT_INST_* macros
Move users that are DEVICE_DT_DECLARE(DT_DRV_INST(n, ...)) to
DEVICE_DT_INST_DECLARE(n, ...) and similar for DEVICE_DT_DEFINE.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-09 14:06:48 -06:00
Peter Bigot d9e45b579a drivers: regulator: convert to dt device defines
Use the devicetree node as the source of object name and other
information used when defining the device structure.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-12-01 15:19:22 -05:00
Peter Bigot 5263289631 drivers: regulator: avoid improper access to internal structures
Nothing in the API description the delayed work structure sanctions
direct reference to internal fields.  Do not assume that a delayed
work item can be submitted without delay by invoking k_work_submit()
with a reference to the contained work item.  Instead submit with the
delayed API and no wait.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-11-24 13:04:48 +02:00
Peter Bigot bce3a70ec5 regulator: check manager init for failure
Use the return value to verify success when assertions are enabled.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-11-19 12:36:44 -05:00
Peter A. Bigot f951566e56 drivers: regulator: add GPIO-controlled regulator driver
This provides structure for the regulator device hierarchy and a
driver for GPIO-controlled regulators along with its binding.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2020-10-28 15:22:53 +01:00