Commit Graph

143 Commits

Author SHA1 Message Date
shengfei Xu 465b1b6c16 power: pmic: rk8xx: SYS shut down voltage select 3100mV
Let the CPU stop working earlier so that the last operation
of spinand can be maintained at a better power supply level.

Signed-off-by: shengfei Xu <xsf@rock-chips.com>
Change-Id: I5bb008abaa6d5da3431f2edcee50579f7ab14eff
2021-02-24 11:14:56 +08:00
shengfei Xu b9e9168c08 power: pmic: rk8xx: add not_save_power_en
add not_save_power_en to judge whether save the PMIC_POWER_EN register.

Signed-off-by: shengfei Xu <xsf@rock-chips.com>
Change-Id: I6e2117ca947dacee41eead631a5c877bd6be3e7a
2021-02-23 11:26:28 +08:00
Joseph Chen 40db74046c power: pmic: rk8xx: implement suspend/resume callback
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I46b13886fcb3e7733155cd6f5fce15473c439da3
2021-01-27 17:11:30 +08:00
Joseph Chen 2a7051be6c dm: pmic: add suspend/resume callback
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: Iaa3b0b7f7b3a0563370baace876e095deb64c28f
2021-01-27 17:11:30 +08:00
Shunqing Chen 038c1ecaa2 power: charge animation: energy enough auto exit uboot charge
Change-Id: Ifa94783869c7cb35f819f3700c82bac7d00a7b05
Signed-off-by: Shunqing Chen <csq@rock-chips.com>
2020-11-26 15:23:46 +08:00
Shunqing Chen 00d11ef213 pmic: rk8xx: support power key config from dts
Signed-off-by: Shunqing Chen <csq@rock-chips.com>
Change-Id: I4b2def4e5b171b2b46f26695e9cabec8a7b496e2
2020-11-26 11:51:28 +08:00
Joseph Chen 50454a094f dm: pmic: add "addr" field for binding children
If some child info->prefix are the same, try to
distinguish them by parent addr.

Example:
	pmic@20, pmic@1a...

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I504cd887e232bb309d8e1790f6d55910172d08b5
2020-06-23 19:30:21 +08:00
Joseph Chen 3ec172ba59 pmic: rk8xx: update reg count for RK817/809
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I55e25a3f6ce46c6bfbdd440910824e527fdc4c58
2020-03-25 21:12:48 +08:00
Joseph Chen 4f9cab2711 dm: fuel gauge: rename fuel_gauge_get_soc() to fuel_gauge_update_get_soc()
New name is more accurate about internal implementation..

Change-Id: I16891f5f614fbb17f1e65e04ef4d8a713c8624f3
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-08-09 18:11:23 +08:00
Joseph Chen ded32713dc power: pmic: register interrupt controller as a irq chip
So that the child drivers can request their irq through the
generic interrupt framework.

Include: RK805/808/816/817/818.

Change-Id: I5556f2e926e850ac6717a05166eab5e19566d531
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-08-09 17:32:43 +08:00
Joseph Chen 6999767bb2 dm: regulator: add "regulator-loader-ignore" property support
The property indicates this regulator should skip init setting
sequence, usually for saving boot time.

Change-Id: I40a81c84b0696c70b16ddba50aeb457412287116
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-06-03 18:25:08 +08:00
Joseph Chen b3271e11e6 power: fuel gauge: add capability callback
Return "FG_CAP_FUEL_GAUGE | FG_CAP_CHARGER" as default value
when there's not implementation, which compatibles with all fg drivers.

Change-Id: Ie71e1271e504c63be42af41551e10e8c2c7d89ac
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-05-23 10:20:17 +08:00
Joseph Chen 94cf1096ee power: charge animation: fix cmd compile error
cmd depends on DM_CHARGE_DISPLAY and default y.

Change-Id: I5e685e0020c4aa1da80ffc27e5a576bc8969c3be
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-04-30 11:38:48 +08:00
Shengfei Xu ba76dc003e power: pmic: rk8xx: enable under-voltage protection to rk817/rk809
The under-voltage protection will shutdown the LDO3 and reset the PMIC.

Change-Id: Ic84c7ad1a2eed8c1f983e761988ffb903fc878af
Signed-off-by: Shengfei Xu <xsf@rock-chips.com>
2019-04-02 19:09:07 +08:00
Joseph Chen ebe3d004b5 power: charge animation: clean up code
Change-Id: I0d76d7ad28ef3683bbc78f36d4a0f00d5517e2fa
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-02-25 14:29:33 +08:00
Shengfei Xu 9e9e0e07b5 power: pmic: rk8xx: save PMIC_POWER_EN register for rk817/rk809
rk817/rk809 must restore the PMIC_POWER_EN OTP value before the system reboot.

Change-Id: Ia62cb8f5b0dc9fef8a32a3af5f087c55a9888d78
Signed-off-by: Shengfei Xu <xsf@rock-chips.com>
2019-02-01 10:31:28 +08:00
Joseph Chen f36a2342cd rockchip: board: move charge display function to charge display uclass
Change-Id: Ib5143d8bd9beafc585438e57216f2b7c17932859
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-01-24 15:44:08 +08:00
Joseph Chen 61a7a6d6a1 power: charge animation: add battery existence check
Change-Id: I8451d3069c11faa91d6b0087a764685cdf4f1bbf
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-12-11 11:31:50 +08:00
Joseph Chen 0ae9790ca7 dm: regulator: drop regulator-state-mem initial from autoset
init regulator-state-mem wastes time a lot and is only needed when
system suspend is called, so provide regulators_enable_state_mem()
the driver that implements system suspend.

Change-Id: I2499df7caa9224879eed057d9269e8dcdce11c51
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-10-07 11:36:44 +08:00
Joseph Chen 7623c170e8 pmic: rk8xx: print source on and off
It tells the reason why PMIC current powers on an last powers off,
this helps a lot for debugging when system suddenly power off or
restart due to unknown power supply cause.

Change-Id: Iec0c38dc1ac5745a9bc473848b5d617059b16faf
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-08-30 15:35:19 +08:00
Joseph Chen 71aebe781c dm: regulator: add regulator_get_suspend_enable and regulator_get_suspend_value
Change-Id: Ib5148f588896ff76a465923fb12956dc6c433de7
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-07-14 17:43:12 +08:00
Joseph Chen b29e2b63a9 dm: regulator: add "regulator-ramp-delay" support
Change-Id: Ic5bc78b2688b88d726c54dfff4f790746d92966b
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-03-27 09:02:36 +08:00
Joseph Chen e7f9facb5d power: charge animation: support auto wakeup and auto off screen
Change-Id: I93f97c46e5f08c3ebe4b577355f5e23a9e3659ed
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-03-19 09:25:49 +08:00
Joseph Chen 88949342ad power: add rockchip_pm.c for devices low power control
during system suspend in charge animation, we may need add
power manage control for some devices low power. Since U-Boot
don't provide standard suspend/resume callback for device. We
have to add rockchip_pm.c to write hard code to achieve this
for different platforms or boards.

Change-Id: I01f67c7c57cbcaae48d3def65eea8cab499af93b
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-02-26 09:16:57 +08:00
Joseph Chen 0e1b20c53d dm: regulator: add "regulator-init-microvolt" support
Change-Id: I5045dc33157d071460302b513b67b942fef1586d
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-02-25 16:49:59 +08:00
Joseph Chen 1b6b965c67 pmic: add rk809 support
include sub modules: pmic, regulator, pwrkey

Change-Id: I840983ceafc7677840674e7d1aebab703e3a537d
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-02-25 16:49:53 +08:00
Joseph Chen 1c223666dc pmic: rk8xx: add init register setting for rk817
1. set pmic_sleep as sleep function;
2. set pmic_int active low.

Change-Id: I4bc4034e18b19dc9b1b328870db652d11173fe3a
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-02-25 16:49:44 +08:00
Joseph Chen ac1dc0c37a charge animation: export struct charge_animation_pdata
This is the most flexsible way for all fuel gauge driver to get
fdt config info from charge animation platdata.

Change-Id: I33aa52c34f2c62c10b58003a10e5a8d1d6e5d7d3
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-02-09 14:28:54 +08:00
Joseph Chen 7f18d96c70 pmic: add RK817 support
include sub modules: pmic, regulator, pwrkey

Change-Id: I3a1cbaa3c4d069cbac17124f9c0fe3b01184697c
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-02-09 14:28:01 +08:00
Joseph Chen 23c016409e dm: fuel gauge: add charge current report interface
Change-Id: Ibef2b06d3b0df71bdf2f205a128578ca6314c37e
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-01-30 17:25:13 +08:00
Peng Fan 92671781a6 UPSTREAM: power: pmic.h: include dm/ofnode.h
Include dm/ofnode.h.

Change-Id: I44d76be779c10e354d012e46c591425bf0cb9a60
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Stefano Babic <sbabic@denx.de>
Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit d56f6ca288c588b6a17edf7a4952e1bc3b56220c)
2018-01-17 15:27:28 +08:00
Felix Brack 29b6917330 UPSTREAM: power: extend prefix match to regulator-name property
This patch extends pmic_bind_children prefix matching. In addition to
the node name the property regulator-name is used while trying to match
prefixes. This allows assigning different drivers to regulator nodes
named regulator@1 and regulator@10 for example.
I have discarded the idea of using other properties then regulator-name
as I do not see any benefit in using property compatible or even
regulator-compatible. Of course I am open to change this if there are
good reasons to do so.

Change-Id: Ifedf2c0a51cb725ddb290ee9dfd54a3fea45df70
Signed-off-by: Felix Brack <fb@ltec.ch>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit bf802f5d544f85c03b4097ab23d078be43c61855)
2018-01-17 15:27:28 +08:00
Joseph Chen e917b032f5 regulator: rk8xx: add regulator suspend state setting implement
Change-Id: I194f3bd7f9d7c03d9b8b15030d7448363b37af99
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2017-12-05 09:34:48 +08:00
Joseph Chen fbc6dab938 dm: regulator: support regulator set suspend state
support parse regulator standard property:
	regulator-off-in-suspend;
	regulator-suspend-microvolt;

Change-Id: I59bf60b28293e891b4d2817462efb36447c46887
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2017-12-05 09:34:48 +08:00
Joseph Chen 0cd6d3b96f dm: charge display: add interface to get and update fdt parameter
Change-Id: Ie2ab5c8c68fb629fd7628310f8a67084ef751f21
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2017-12-05 09:34:48 +08:00
Joseph Chen 55b6f88e0e dm: add charge display uclass
This is mainly used for charge animation.

Change-Id: Iac4ffe76b1985abfa44181a797a15df74e5bcf14
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2017-11-03 11:57:11 +08:00
Joseph Chen c8d15c4375 dm: pmic: add pmic_shutdown() interface
Change-Id: I9bed8de6d3733ab90175f26f68160ddd8f12e295
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2017-10-31 16:13:16 +08:00
Joseph Chen a7ca45e88e dm: power: add implementation of driver model fuel gauge uclass
Change-Id: I48fa0340d49cc1bc39c91223ac04e98790e0bee2
Signed-off-by: shengfei Xu <xsf@rock-chips.com>
2017-09-27 11:38:39 +08:00
Elaine Zhang 4b6f5dc9ea power: pmic: rk805: support rk805 pmic
Change-Id: I2d757eb748e5903e0287557f3c6a64b8e3c89596
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2017-09-13 16:47:53 +08:00
Elaine Zhang 5e1bceea9e power: pmic: rk816: support rk816 pmic
Change-Id: I609eef4efe25833d3d878a74931ca240365faa30
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2017-09-13 16:47:49 +08:00
Jean-Jacques Hiblot 5c970013a6 regulator: palmas: disable bypass when the LDO is enabled
Some LDOs have a bypass capability. Make sure that the bypass is disabled
when is the LDO is enabled (otherwise the voltage can't be changed).

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Keerthy <j-keerthy@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
2017-08-01 11:58:01 +09:00
Simon Glass e3f44f5c89 dm: power: Convert as3722 to driver model
Convert this PMIC driver to driver model and fix up other users. The
regulator and GPIO functions are now handled by separate drivers.

Update nyan-big to work correct. Three boards will need to be updated by
the maintainers: apalis-tk1, cei-tk1-som. Also the TODO in the code re
as3722_sd_set_voltage() needs to be completed.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Tested-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Tested-on: Jetson-TK1
Tested-by: Stephen Warren <swarren@nvidia.com>
2017-07-28 12:02:47 -06:00
Simon Glass c2012cb47c power: Add a GPIO driver for the as3722 PMIC
This pmic includes GPIOs which should have their own driver. Add
a driver to support these.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Tested-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Tested-on: Beaver, Jetson-TK1
Tested-by: Stephen Warren <swarren@nvidia.com>
2017-07-28 12:02:47 -06:00
Simon Glass deea211aec power: Add a regulator driver for the as3722 PMIC
This pmic includes regulators which should have their own driver. Add
a driver to support these.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Tested-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Tested-on: Beaver, Jetson-TK1
Tested-by: Stephen Warren <swarren@nvidia.com>
2017-07-28 12:02:47 -06:00
Keerthy 06bdf6003b regulator: Change get_enable return type to integer from bool
Change get_enable return type to int so errors can be returned.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2017-07-19 19:13:59 +09:00
Wadim Egorov ad98f882e8 power: regulator: rk8xx: Allow input current/charger shutdown configuration
The RK818 PMIC contains a charger. Add very basic charger functionality
to be able to regulate the USB input current and charger shutdown limits.

Signed-off-by: Wadim Egorov <w.egorov@phytec.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
2017-07-11 15:23:38 +02:00
Brock Zheng Techyauld Ltd abf54bf978 Fixup bug in PMIC TPS65217 register address definition
The addresses of the registers in TI TPS65217 are not continuous.
     There is a gap between ENABLE(0x16) and DEFUVLO(0x18). No 0x17
     register available.

     Fixup the enum values by adding a 'reserved' placeholder to correct
     the addresses higher than 0x17.

     Series-to: Heiko Schocher <hs@denx.de>

Signed-off-by: Brock Zheng Techyauld Ltd <yzheng@techyauld.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
2017-06-09 20:25:16 +09:00
Keerthy cdad57a7c1 power: pmic: lp87565: Add the basic pmic support
Add support to bind the regulators/child nodes with the pmic.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
2017-06-09 20:25:16 +09:00
Keerthy fc69d47262 board: ti: AM43XX: Add ddr voltage rail configuration
Add ddr voltage rail (dcdc3) configuration. Set the dcdc3
DDR supply to 1.35V.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>
2017-06-09 20:25:16 +09:00
Simon Glass 7a869e6cd1 dm: pmic: Convert uclass to livetree
Update the pmic uclass and all pmics to support a live device tree.

Signed-off-by: Simon Glass <sjg@chromium.org>
2017-06-01 07:03:12 -06:00