Commit Graph

504 Commits

Author SHA1 Message Date
Joseph Chen b978e52ca5 power: pmic: rk8xx: inactive pmic_sleep by default
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: Ia5729341c5a94d0109a8a28e48ad8eb79b80962e
2021-01-27 17:11:30 +08:00
Joseph Chen 06b61291ba power: charge animation: add pmic suspend/resume
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: Ia1b6d232b0a9c0d0ce2e8ee47ae84aaa6d40bfac
2021-01-27 17:11:30 +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
Shawn Lin fae486e407 power: regulator: Use dev_read_size in gpio-regulator
Change-Id: Iff2e643d6dad6975fe0838dc439a31ecd5299f41
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
2021-01-08 09:24:05 +08:00
Shawn Lin cd282fabfa power: regulator: Migrate to dev_read_u32_array for gpio-regulator
fdtdec_get_int_array_count is obsoleted and we should use
dev_read_u32_array for seeking node members.

Change-Id: I666bd7317cfa203229454d24c910049c24bf8a2f
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
2021-01-07 10:00:59 +08:00
Shunqing Chen 3c3ec66903 fuel gauge: rk817/rk809: fix get rsoc error
Signed-off-by: Shunqing Chen <csq@rock-chips.com>
Change-Id: Id946d56c9aafef87bb864218155e1b2353991140
2020-12-18 14:43:48 +08:00
Joseph Chen 094465a906 power: charge animation: disable timer while uninit timer
Otherwise the time is still working in kernel if there is no
one to update it, which always wakeups system suspend.

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: Ic2291b26730557c50fb8cbd505d05b40bb582c74
2020-12-15 17:38:48 +08:00
Wenping Zhang 255e57518a power: charge animation: add eink charging display.
Signed-off-by: Wenping Zhang <wenping.zhang@rock-chips.com>
Change-Id: Id9d84a27ae2bbc8746e99ed01a96c53e2335a2b6
2020-12-10 17:51:14 +08:00
Shunqing Chen 3b02c9fe3a power: fg_cw201x: replace fdt functions
Signed-off-by: Shunqing Chen <csq@rock-chips.com>
Change-Id: Id03c367e619444f5f76ecbb36f831e09959d2888
2020-12-07 02:34:36 +00: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
David Wu 458cbae45a power: rockchip-io-domain: Use private write for rk3568
The i2c5 xfer went wrong because of io-domain was not right
and was configured correctly in uboot to ensure that kernel
was right before initializing the io-domain driver.

Change-Id: Ic2f94952f7a851dc5b781af9f31bba2562b5a2b5
Signed-off-by: David Wu <david.wu@rock-chips.com>
2020-11-16 11:45:51 +08:00
Jianqun Xu fcff2851be power: io-domain: rockchip: fix rk3568 grf offset
Change-Id: I1045ce0d942ea57e325bdf3b8aa4bc8c9023d9e8
Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
2020-11-10 17:15:52 +08:00
Jianqun Xu 230491661d io-domain: rockchip: add rk3568 support
Change-Id: Ic3a984043e82bd65957239acc25de79e00e1a6b8
Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
2020-10-23 15:02:15 +08:00
Joseph Chen 9ed86f1004 io-domain: rockchip: fix data abort
Stack:
       [< 0041e1ae >]  dev_get_driver_ops+0x4/0x8
       [< 0043fdb5 >]  regulator_get_value+0x9/0x1c
       [< 0043f42b >]  rockchip_iodomain_probe+0x9b/0x114
       [< 0041e07f >]  device_probe+0x14b/0x184
       [< 0041e9ff >]  uclass_get_device_tail+0xd/0x16
       [< 0041eb73 >]  uclass_first_device+0x1b/0x1e
       [< 0043f34f >]  io_domain_init+0x17/0x34
       [< 0040231f >]  board_init+0x7f/0xa0
       [< 0044fe6d >]  initcall_run_list+0x35/0x50
       [< 0040f839 >]  board_init_r+0x15/0x1c
       [< 0040f825 >]  board_init_r+0x1/0x1c

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I6864771eb1ffa4ae2ef92e712a503e8048774435
2020-08-05 11:04:50 +08:00
Jianqun Xu 2e312f93c5 power: rockchip-io-domain: get regmap base from parent device
The io-domain/pmu-io-domain node always under grf/pmugrf, so get the
grf/pmugrf regmap base just from its parent device.

Change-Id: I9f7d950744b48c239a556b7fe685749cdd5f99f2
Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
2020-07-08 14:21:02 +08:00
Joseph Chen 2833da14a1 pmic: rk8xx: fix compile error if CONFIG_IRQ is disabled
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I23a0da11618822be08f233cd0c75f550e8d8ca3a
2020-07-01 10:37:08 +08:00
Joseph Chen ed71c65549 pmic: rk8xx: add "addr" filed for battery bind
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I073dcd49f89a75d1d320f3e80307b137814d0e2f
2020-06-23 19:30:23 +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
Shunqing Chen 913fb045d4 fuel gauge: rk817/rk809: fix the issue of dsoc cannot reach 100
Change-Id: I8b5c995509df71f23fdf73381ac0e55de727b5c2
Signed-off-by: Shunqing Chen <csq@rock-chips.com>
2020-06-05 10:54:52 +08:00
Joseph Chen 25a7c60a0b Revert "regulator: pwm: remove init voltage setting"
This reverts commit ef473e3642.

We merged this commit while we didn't notice that this driver gets
init voltage from legacy "rockchip,pwm_voltage = <...>", but regulator
uclass gets it from "regulator-init-microvolt = <...>". so we have to
revert this commit to compatible the legacy one.

Change-Id: I52606d9a9268659d3d77f7d29d1eed1d80b30b1e
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2020-05-27 15:45:58 +08:00
Joseph Chen 5a157e97d5 Merge branch 'thunder-boot' into next-dev 2020-05-12 10:37:37 +08:00
Shunqing Chen 23858492ef power: charge animation: fix the issue that did not auto turn off screen
1.set auto_wakeup_screen_invert to 1 and set auto_off_screen_interval to 0.
2.set auto_screen_off_timeout to 1.
2.press power key to turn on screen.
3.screen will not be turned off at this time.

Change-Id: Ifc92f23a38d8ba0da4f6e37625b4114edb42f6a8
Signed-off-by: Shunqing Chen <csq@rock-chips.com>
2020-05-11 16:33:49 +08:00
Joseph Chen 41bb8b737c Merge branch 'next-dev' into thunder-boot
Conflicts:
	common/spl/spl_rkfw.c
	drivers/pinctrl/pinctrl-rockchip.c
	make.sh

Change-Id: I93f4dbe1e067c3b938bf64c4964bd5e7023b1daf
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2020-04-07 21:18:08 +08:00
Joseph Chen ae80c85fe8 power: io-domain: add initial message
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I4b6a508371dba74a3c992786a6cdb4d5b4d6eb80
2020-04-04 09:57:19 +08:00
Joseph Chen a4d1e7eec0 Merge branch 'next-dev' into thunder-boot 2020-04-03 18:12:46 +08:00
Jianqun Xu 042310d674 power: io-domain: add rv1126 support
Change-Id: I2198e21920576ab02ce7d1964d6b014e9de88c81
Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
2020-04-03 17:46:16 +08:00
Jianing Ren 8662398268 power: rename the include file phy-rockchip-usb2.h
Change-Id: I3725130115907555aad9ad4e669601b5059c8066
Signed-off-by: Jianing Ren <jianing.ren@rock-chips.com>
2020-04-03 14:46:48 +08:00
shengfei Xu 68a90c3146 regulator: rk809/817: implement get the switch voltage
If the switch is enabled, it's voltage is same as parent supply.

Signed-off-by: shengfei Xu <xsf@rock-chips.com>
Change-Id: I8fb60bd5aa3bb0a47cac84982113663e2bf5941e
2020-04-02 12:20:04 +08:00
Joseph Chen d4c8c99603 Merge branch 'next-dev' into thunder-boot 2020-03-31 18:25:21 +08:00
Joseph Chen 3fe21f028a regulator: rk8xx: fix buck get wrong value
Before this, we always get the 1st of BUCK range group which
brings the problems we face now.

Let's traverse all the possible BUCK ranges to fix this issue.

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I61a341fcbd190bcc0baff8267a94063c15abcc30
2020-03-31 09:35:25 +08:00
Joseph Chen e1e9b173e4 Merge branch 'next-dev' into thunder-boot 2020-03-28 15:01:31 +08:00
Jianqun Xu 96a4cf48b5 power: io-domain: fix err handle for regulator get
Change-Id: I7c8d760676c15776df35708bf4d35552da0cf96b
Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
2020-03-27 15:17:53 +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
Jason Zhu 6c64f7fece power: fuel gauge: allow fuel gauge in SPL
Sometimes we need low power test in spl. Update the config
to allow this.

Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
Change-Id: I0c7d035cb55e06980d1c2fd28ceef5adee4d7197
2020-03-23 17:00:24 +08:00
Joseph Chen 43e3c846b3 pmic: rk8xx: set rk818 2000mA input current if no battery node
Assume that no battery node means the board is always supplied with
adapter, so set 2000mA input curren to make board have enough power.

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I9d66c02682cc3ff66a2d8e365837fc66bf991933
2020-02-19 16:57:32 +08:00
David Wu 61ab4d721f power: io-domain: Don't printf sudev->name when get regulator failed
This patch fixed the following issue:

Stack:
       [< 00295020 >]  strnlen+0x10/0x28
       [< 002965b4 >]  vsnprintf_internal+0x61c/0xa84
       [< 00296a6c >]  vscnprintf+0x50/0x74
       [< 00296c58 >]  printf+0x94/0xb4
       [< 00263e04 >]  rockchip_iodomain_probe+0xcc/0x19c
       [< 0022e310 >]  device_probe+0x21c/0x268
       [< 0022f3e8 >]  uclass_get_device_tail+0x1c/0x40
       [< 0022f6dc >]  uclass_first_device+0x30/0x44
       [< 00263cdc >]  io_domain_init+0x2c/0x50
       [< 00202da8 >]  board_init+0xb4/0xc4
       [< 0027a480 >]  initcall_run_list+0x58/0x94
       [< 00214fbc >]  board_init_r+0x20/0x24
       [< 00201b24 >]  relocation_return+0x4/0x0

Change-Id: I1afc2613a1dba32e7f9c6ad2165e80853d421187
Signed-off-by: David Wu <david.wu@rock-chips.com>
2019-11-27 11:30:07 +08:00
Joseph Chen ef473e3642 regulator: pwm: remove init voltage setting
Regulator uclass takes over this job, avoid to init twice.

Change-Id: Idea56143bd7008742936d3bbe1ebadb00c683a47
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-11-19 14:25:46 +08:00
Joseph Chen 5d3e5a0afc Revert "regulator: fixed: print failed message"
This reverts commit b8f8a39729.

Change-Id: I6a2d474504833b9a4efa3ef37dc76c4051db1098
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-11-08 18:21:03 +08:00
Joseph Chen b8f8a39729 regulator: fixed: print failed message
Fixed-regulator maybe the first device probed by regulators_enable_boot_on(),
its failure ends up the other regulator traverse(e.g. PMIC regulator), we hope
to get this information.

Change-Id: I2f1f67232dbb8a1b72dc8dfec75f1f6414b2abb9
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-11-07 10:01:39 +08:00
Joseph Chen 54c0dba4a1 dm: regulator: print uc_pdata name instead of dev name
The uc_pdata->name is from property "regulator-name" which
is more accuracy to descript this regulator.

Change-Id: I813604ff528b757a1f9b9191dbdd4472f838a367
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-11-07 09:55:16 +08:00
Joseph Chen 871b668671 pmic: rk8xx: default disable virq chip by new interface
The irq framework takes over the enable/disable management
for virq chip.

Change-Id: I63202b22b121b4a889d5a408a6a5a8f50a3c24d8
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-10-23 11:25:02 +08:00
Joseph Chen 5eac14db17 power: charge animation: call irq suspend/resume before simple wfi
Some interrupt only need active when suspend(e.g. plugout, pwrkey).

Change-Id: Ieebaa5fbf9f69f424eefe5a52c1517be63acf873
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-08-09 18:11:40 +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
Shunqing Chen e064ede6e6 fuel gauge: rk817/rk809: fix code error
Change-Id: I297015130144cb3c41e45a2030b729edd61498ce
Signed-off-by: Shunqing Chen <csq@rock-chips.com>
2019-07-26 09:49:39 +08:00
Joseph Chen fe404743f8 power: io-domain: initialize all io-domain
There maybe more than one io-domain.

Change-Id: I786544547b7c5da034e4d9685d60144c22266c3b
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-07-25 16:23:07 +08:00
Masahiro Yamada f1ba13f8e2 UPSTREAM: libfdt: move headers to <linux/libfdt.h> and <linux/libfdt_env.h>
Thomas reported U-Boot failed to build host tools if libfdt-devel
package is installed because tools include libfdt headers from
/usr/include/ instead of using internal ones.

This commit moves the header code:
  include/libfdt.h         -> include/linux/libfdt.h
  include/libfdt_env.h     -> include/linux/libfdt_env.h

and replaces include directives:
  #include <libfdt.h>      -> #include <linux/libfdt.h>
  #include <libfdt_env.h>  -> #include <linux/libfdt_env.h>

Change-Id: I68fd5734d6460c169fa5ee2893c57cb5d73340b6
Reported-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
(cherry picked from commit b08c8c4870831c9315dcae237772238e80035bd5)
2019-07-05 19:33:35 +08:00
Joseph Chen 5fc2a70c78 power: charge animation: allow ctrl+c to exit extrem low charging
Change-Id: I736c2617a4d51085bc91377f1013d7f4b198c9fc
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-06-26 14:09:28 +08:00