Commit Graph

467 Commits

Author SHA1 Message Date
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
Joseph Chen 9d985d6e93 power: fg_cw201x: add capability callback
This is only a fuel gauge IC.

Change-Id: I003dee494aa89b388f5ef68381ce16227d7f9c65
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-06-17 17:41:33 +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
Shengfei Xu 4874919d22 power: pmic: rk8xx: get the correct on/off source
The on/off_source value has been changed,
so we can't get the correct on/off source.

Change-Id: I7c522574f5e8d3bbc3c5d73980cdccdb4717da52
Signed-off-by: Shengfei Xu <xsf@rock-chips.com>
2019-05-27 08:36:09 +08:00
Shunqing Chen d19b8cd2ae power: charge: add bq25700 support
Change-Id: I49c2e60ac94cea35e6a1e9ca1f713551a75e6265
Signed-off-by: Shunqing Chen <csq@rock-chips.com>
2019-05-23 11:59:52 +08:00
Joseph Chen 4d083e3f19 power: charge animation: add charger device support
If a fuel gauge device doesn't have both charger and fuel gauge
capabilities, try to find devices group to support that.

Change-Id: I78d929e80e79bea304bb2b29f423c90ca12be16f
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-05-23 10:20:32 +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 3415d4ebcd power: charge animation: select CONFIG_ARM_CPU_SUSPEND
Change-Id: I0c901e17b9da18d87f8dd7da776254a20c47ee11
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-05-17 12:00:44 +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
Shengfei Xu 327c34ef1d fuel gauge: rk817/rk809: only rk809 need pull-up and pull-down resistor
Change-Id: I9c88a0cf11205ba351305eb37bd1e725ed203dca
Signed-off-by: Shengfei Xu <xsf@rock-chips.com>
2019-03-28 14:42:43 +08:00
Joseph Chen c5449fd30c dm: dvfs: don't print fail message when there is no device
Change-Id: I8ec8920972261e8009dfd9306d8ab898460a71df
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-03-27 08:59:47 +08:00
Joseph Chen 2e68f6b5f9 power: charge animation: support long key event without release
Change-Id: I9d7cd439376f2f4ff89ea6bfe3baedbeaa4deeb9
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-03-18 11:34:06 +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
Joseph Chen 1b3009debe power: charge animation: add leds support
It supports charging and charging-full leds which
depends on soc value.

Change-Id: I6b37919c5bedf9b81d388853996cf83c6f75a73a
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-02-25 14:29:33 +08:00
Elaine Zhang 8b436ce576 power: charge animation: add rtc alarm check
Under the charging interface,if the rtc alarm is
triggered, boot on the system.

Change-Id: I6a921bd5c6971c45b02b2be84d9d6d79e9b17a36
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2019-02-25 10:08:47 +08:00
Elaine Zhang 47bc0dad56 rtc: add rk8xx rtc support
support rtc alarm interrupt and alarm trigger power up.

Change-Id: I7752f173d524f579b57b862d2788296ab1486c14
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2019-02-25 10:08:47 +08:00
Shunqing Chen e7c5611148 power: fuel gauge: fix rk818/rk816 gpio_desc null pointer issue
Change-Id: I2289eed51eadb0b7b11e9c81d6154f27f138c97f
Signed-off-by: Shunqing Chen <csq@rock-chips.com>
2019-02-20 08:44:43 +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
Shunqing Chen 573b2cce51 regulator: rk8xx: add switch get/set value
RK8xx switch does not need to set the voltage,
but if dts set regulator-min-microvolt/regulator-max-microvolt,
will cause regulator set value fail and not to enable this switch.
So add an empty function to return success.

Change-Id: Ifc3cfe24902123d7434f3f6560a8e530c03d0b2a
Signed-off-by: Shunqing Chen <csq@rock-chips.com>
2019-01-25 14:23:39 +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
Shunqing Chen de4e4f5097 fuel gauge: rk817/rk809: add charge detect for rk809
Change-Id: I481793e5e307534deefa15a9f71de75752170dc8
Signed-off-by: Shunqing Chen <csq@rock-chips.com>
2019-01-24 08:40:00 +08:00
Joseph Chen 45ec578384 dm: regulator: avoid double print voltage
regulator would print value when set init voltage.

Change-Id: I8bc9df40d452ae89cced7145e8760e29d7339ac8
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-01-14 14:57:26 +08:00
Joseph Chen fe9c49e6ed fuel gauge: rk816: fix first power on initilize as 0% and 0mAh
1. when first power but not charge in uboot, fuel gauge is initilized
   but miss saving data for kernel fuel gauge;
2. wait 75us after coulomb init, otherwise read back 0mAh;
3. always read remain capacity and print it for debug;

Change-Id: Iba30ef4e96942fcfbf61dacabf8199dc896bab64
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-01-10 11:54:06 +08:00
Joseph Chen 22f2eaa842 dvfs: Kconfig: wtemp dvfs driver depends on CONFIG_USING_KERNEL_DTB
Because wtemp dvfs driver reads all cpu/dmc info from kernel dtb.

Change-Id: Ifd85ed976bd880cf710c58e07351ef038f3a125c
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-01-08 15:05:41 +08:00
shengfei Xu 8d97d065e2 fuel gauge: rk817/rk809: support rk809
A “battery fuel gauge” is integrated in the RK809. Using
the proprietary algorithms and the sensed battery current
and voltage, the gauge can accurately calculate the battery
capacity based on the charging/discharging characteristics
of the battery preloaded in the system. The gauge then sends
the battery capacity information to the processor through
the I2C interface.

Change-Id: I4d1d0cce8d76f4ec39dfcd00c495c64257fd4b7b
Signed-off-by: Shengfei Xu <xsf@rock-chips.com>
2018-12-28 20:24:30 +08:00
Masahiro Yamada 0e00a84cde 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: I6c0f7e50e8b571106627f25ddac008a62bd2994e
Reported-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
2018-12-24 17:20:37 +08:00
Jianqun Xu 4f43646e36 power: rockchip: add io-domain driver
The io-domains on Rockchip SoCs will be supplied with 1.8V or 3.3V(3.0V)
depends on hardware design. The driver needs to config them through grf
register.

Change-Id: Ic896b94bfadd0b808da54992e58e2cf4a8fee950
Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
2018-12-24 16:44:06 +08:00
Elaine Zhang e54cf6dba7 power: regulator: add fan53555 regulator
add driver support for fan53555\syr82x\tcs452x dcdc.

Change-Id: Ib6132d7063ba8bda9631b45e128df1d278222dad
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2018-12-20 10:20:53 +08:00
Joseph Chen c8df86e750 fuel gauge: rk816/8: add battery existence report
Change-Id: I69fda35bd918d167aff7ac6d5d0d75ba6aa38372
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-12-11 14:06:59 +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 0eea0d250e dm: add dvfs uclass and wide temperature dvfs support
- add dvfs uclass;
- add dvfs command;
- add a simple wide temperature dvfs driver.

About wide temperature dvfs driver policy, see description in:
drivers/power/dvfs/rockchip_wtemp_dvfs.c

Change-Id: I36a8de6e47f8375bf1795b794c77d96b4571a361
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-12-10 18:03:51 +08:00
Joseph Chen 7ae458341f power: charge animation: print reason of exit charge
This is helpful to know charge state.

Change-Id: I96401b67220a0ebb782c5da1f8001b3bf4682c06
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-12-04 15:01:43 +08:00
Joseph Chen 71ebef54f7 dm: regulator: update regulator init voltage message
Change-Id: Ic24328579e765d011840e383618b771a31370d9c
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-12-03 16:52:06 +08:00
Joseph Chen d51c16c5a4 fuel gauge: Kconfig: remove default y for CW201x
Change-Id: I1e2af720ad00f95f37b6e663db7a25feb51e40ce
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-12-03 16:26:47 +08:00
Joseph Chen 53dc0e6778 regulator: pwm: use debug to verbose init voltage
dm regulator uclass would verbose this message.

Change-Id: I76c73bdcf6354d7d892f75ad022be416d3ab0c09
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-11-29 20:40:09 +08:00
Joseph Chen 03af66d3ee dm: pmic: use strstr() to match regulator prefix
this is more flexsible to match regulator type.

Change-Id: I5589b5d1d32d8ac1c6d09d64e680eddd31f2ba90
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-11-28 14:08:44 +08:00
Joseph Chen 151cb556ea fuel gauge: rk816: default enable usb sys
Change-Id: I54be4aa41a02adc51d764a48f1a1c966bff0445e
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-11-07 11:00:13 +08:00