Commit Graph

504 Commits

Author SHA1 Message Date
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
Joseph Chen 992f4e7722 power: charge animation: enable regulator-mem-state
Change-Id: I31a687ca5a53c57d5b49fb23ec5951b34b1e25f1
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-10-07 11:37:08 +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
Sugar Zhang 7a5efcbd67 power: pmic: rk8xx: bind codec for rk809/rk817
Change-Id: I600f49799dde318d46e349264f568e38225a6414
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
2018-09-25 19:32:33 +08:00
Joseph Chen 175257e48b power: charge animation: support without CONFIG_IRQ enabled
If CONFIG_IRQ is not enabled, cpu can't suspend to ATF or wfi,
so that the wakeup period timer is useless.

Give a message warning when CONFIG_IRQ is not enabled.

Change-Id: I9af7e7114ab5d3b3d1026a3ba19ce6cbe56399eb
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-09-04 18:02:22 +08:00
Joseph Chen 5166b2759b fuel gauge: rk816: fix compile warning
Change-Id: I934f7a6b75c58d8827e0f0fa1838054608ff77f1
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-09-04 17:57:30 +08:00
Joseph Chen 2146330a8a power: charge animaition doesn't depends on ROCKCHIP_DRM_ROCKCHIP
at some time, we need virtual power mode supported by fuel gauge to
set a static adapter input current, which don't reall want charge
animation images show.

Change-Id: If256b15eb585990f5c99781f830480b0d0a83cb4
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-09-04 17:57:15 +08:00
Joseph Chen 32db71f8ce dm: regulator: print unfixed bucks voltage
This is mainly for debugging since voltage info is so important
when system abort at early boot flow of U-Boot or kernel. On
rockchip platforms, it usually prints vdd_arm and vdd_logic.

Change-Id: Ibb58cb8865ab6857a51a8f50d8a7633c9132985d
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-09-04 17:34:34 +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 14a3ce4514 fuel gauge: rk816: print charge type
Change-Id: Ieafcd6dfefce1419e4df7e52882c8a882b53adcc
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-08-15 09:22:41 +08:00
Joseph Chen 31ab5b3ba0 power: charge animation: lower the print info
Change-Id: If6f597f3cf1d6da67f14f8a598f5a50e14fb798f
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-08-14 20:55:34 +08:00
Elaine Zhang 5e347bef3e regulator: rk816: support rk816 ES2 chip
Change-Id: Idaba0e148b520e2d43d2185461acaab3ff9cb16d
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2018-08-06 11:20:55 +08:00
shengfei Xu 6266c4934d fuel gauge: rk817: clear the OFF_CNT register
Change-Id: Iab37f0a0b69a35ed56f3bef4c0d0699d4922e6bc
Signed-off-by: shengfei Xu <xsf@rock-chips.com>
2018-07-30 15:45:39 +08:00
shengfei Xu 8a7ae883f7 fuel gauge: rk817: set different input current when different charger is detected
The four power source types that are detected are:
Standard downstream port (SDP)
– This is a computer USB port capable of 500mA.
Charging downstream port (CDP)
- This is typically a powered USB hub capable of 1500mA.
Dedicated charging port (DCP)
- This is a standard wall charger capable of at least 1500mA.
DCP without shorting D+/D-(FLOATING)
- This is a non-standard wall charger capable of at least 1500mA.

Change-Id: Icb3d3c02d9ef5dfbcabf0232743ad057c578dcf4
Signed-off-by: shengfei Xu <xsf@rock-chips.com>
2018-07-25 14:36:15 +08:00
Joseph Chen fd62311e53 power: charge animation: fix i2c failed issue
i2c maybe interrpted by power key interrupt, so we need to
disable local irq when i2c transfer.

Change-Id: Ifd4c1f15ebab25c7fa54e4386c72e5731bc821b4
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-07-21 12:20:48 +08:00
Joseph Chen 93aee2d903 power: charge animation: fix auto off and optimise images show
- fix auto off screen issue;
- don't call charge_show_bmp() unless image changed;

Change-Id: I6474c8ef55617883da2ba4abb4da240a770e0d93
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-07-21 12:20:48 +08:00
Joseph Chen 5e80474146 power: charge animation: add poll time to update fuel gauge
Usually, fuel gauge is a i2c device and we had better set a
poll seconds to update it, which can reduce i2c read/write.

Change-Id: I192e8229d3b6b7f8887a38296314e69b9dc30753
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-07-21 12:20:48 +08:00
Joseph Chen 787a62ebeb power: charge animation: use read_key() to read power key
Change-Id: Id8218f0aa8d192baaa347d6e76ee2d0f002d9c6b
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-07-21 12:20:48 +08:00
shengfei Xu 852c7866fd fuel gauge: rk817: smooth the dispaly soc when system reboot
There is a difference between the display soc and real soc,
so it can not be directly equivalent.

Change-Id: I99dfa1e3952693053ccd853cd5802feb7eebf8b0
Signed-off-by: shengfei Xu <xsf@rock-chips.com>
2018-07-18 10:24:56 +08:00
Joseph Chen 712b6f80ff regulator: rk8xx: implement get suspend value and enable callback
- regulator_get_suspend_enable;
- regulator_get_suspend_value;

Change-Id: Id2326f4286d6eb45cfa5c0b47bcbf0030dbfd128
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-07-14 17:52:24 +08:00
Joseph Chen 8152d3f659 dm: regulator: update message print format
Change-Id: Ibaa0a21c64f672b59f4e1dc3881ecf232f471444
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-07-14 17:52: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 c204540bc3 regulator: rk8xx: remove REG_DCDC_UV_ACT setting
no special reason to remove, just to keep the same setting
with rkdevelop which is stable.

Change-Id: I3fe810d7080e29525cdf24c4475b0acb5380a9c5
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-07-09 10:40:41 +08:00
Joseph Chen 537b230e8f regulator: pwm: support "rockchip,pwm_voltage" init voltage
1. add this property to compabile legacy pwm regulator driver
   on rkdevelop;
2. give default init voltage 1.1v;

Change-Id: I7b1f989c28d91edd6e467ae1ba94299c6d695afb
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-07-09 10:38:51 +08:00
Joseph Chen a538876eeb dm: regulator: print init voltage
Change-Id: I266a76f43485eac8770e51787985b93992ef0668
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-07-09 10:29:34 +08:00
shengfei Xu 4aae031371 fuel gauge: rk817: fix the fuel gauge error
The GAS_GUAGE_Q_INIT was written to the wrong value causing the fuel gauge to fail.

Change-Id: Idbafc110deef6f6ce93dac9a0ad81974d1f112a9
Signed-off-by: shengfei Xu <xsf@rock-chips.com>
2018-07-03 10:52:53 +08:00
Joseph Chen 04d4208bc8 regulator: rk8xx: fix LDO 'config_reg' missing
1. use 'NA' to indicate not unsed or not exist configure;
2. there is not configure register for ldo, so define it as NA;

Change-Id: Ic87e5c9fe6128c14a47a306a8726c487d5b96664
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-07-03 10:52:29 +08:00
Joseph Chen f98160cbdd dm: regulator: verbose more regulator configure message
regulator_show() is used as an debug way, so its verbose
message should be detail enough, this helps a lot.

Change-Id: Iabe5fc65e8b6ff27b9c92bc3f0b6948e1013a9c8
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-07-03 10:52:29 +08:00
Joseph Chen 34483cf702 dm: regulator: make suspend and normal configure non relative
suspend configure result should not influence normal configure

Change-Id: I7107ad5f3303d1f1456ada5949deced5fa8e4ec2
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-07-03 10:52:29 +08:00
Joseph Chen 7dc573239e fuel gauge: rk818: clean up
this is a initial version porting from rkdevelop
commit: 64f6c0e.

Change-Id: Iadc46282e0782d0cd985cb0ee9d317cb5d94f41e
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-07-03 10:52:29 +08:00
Joseph Chen cf49f6adf1 power: charge animation: add debug message
Change-Id: Ib96ab67e9e2657385f19c9e2ab2ed518da0ad2f8
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-07-03 10:52:29 +08:00
Joseph Chen b609c2e80d fuel gauge: Kconfig: remove defaut y for rk816
Change-Id: I37534b0128e596a005c318e39e4b54382752b273
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-07-03 10:52:29 +08:00
Joseph Chen 917ec9ee71 power: pwm regulator: make message from printf to debug
Change-Id: I7e9b2a6bcfe437f01bb318281110935aaf029619
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-07-03 10:52:29 +08:00
shengfei Xu 8d2f64435d fuel gauge: rk817: calibrate the fuel gauge, when the system is powered on
There is an error with the fuel gauge, so we need to calibrate it.

Change-Id: I649cacaa97c69fd47bad6f6d02a7569e735b7a80
Signed-off-by: shengfei Xu <xsf@rock-chips.com>
2018-06-20 09:53:52 +08:00
Joseph Chen 5cfdc12322 pmic: rk8xx: make relative message more clear
1. adjust error message easy to be understood;
2. show RK808 chip id as "RK808";
3. check PMIC chip id read failed;

Change-Id: Ifc4c25ccc8cac4fdd91bcf6515b1dd6aa1bf71fa
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-06-01 11:52:47 +08:00
Kever Yang 27b7c22892 pwm-regulator: do not fail if no regulator-init-microvolt found
There are many boards in kernel do not have a regulator-init-microvolt
in pwm regulator, let's make it available.

Change-Id: Ib8235af4082f3428eb04684617a52bb68a4b2e7a
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
2018-05-25 11:51:49 +08:00
Joseph Chen 3929c02703 dm: pmic: add child node status verify
Ignore disabled child node when bind driver

Change-Id: Ib817bf643efa6c8511d4619993444dddaac7d6bd
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-05-16 15:23:16 +08:00
shengfei Xu d49682643c fuel gauge: improve the storage accuracy of dsoc
The save dsoc accuracy is not enough to cause the display soc
to be reduced by 1 when system reboot.

Change-Id: I35dbb0d1b2d123f65f7cd6ef74216bc1a6384d34
Signed-off-by: shengfei Xu <xsf@rock-chips.com>
2018-05-04 11:56:31 +08:00
shengfei Xu 9b07af4c22 fuel gauge: rk817: disable the bat discharge current limit function
Change-Id: Iec99275fbbd3ff2d6ba76d8ef3327c4c3312ef76
Signed-off-by: shengfei Xu <xsf@rock-chips.com>
2018-04-19 09:05:09 +08:00
Joseph Chen 868bdcf383 regulator: rk8xx: add ops->set_ramp_delay() implement
Change-Id: I8c7b7fad8c966d2fff8e2b0cf80ff59b6f70b57b
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-03-27 09:02:36 +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 79244e4cb1 power: charge animation: imporve extrem low power charge
Change-Id: I46203712e2aa02e04d645b660ea51811e7430821
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-03-26 10:04:52 +08:00
Andy Yan b33ebddfc8 power: pwm regulator: support live tree
Use live tree compatible api for pwm regulator.

Change-Id: Id12c96c0631b6d963d663ef83e3df50abef5e827
Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
2018-03-26 09:30:54 +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
shengfei Xu 616056c90c power: charge_animation: skip charge if charger offline
Change-Id: I66bd36fc4d3cd4a2f79cd5eb425f857fc8a577cb
Signed-off-by: shengfei Xu <xsf@rock-chips.com>
2018-03-19 09:25:49 +08:00
Joseph Chen a46d9cd774 fuel gauge: rk817: disable debug info
Change-Id: I6b48d9302aed33aa678b3a5496ed1aa8627a82b9
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-03-15 15:53:11 +08:00
shengfei Xu 6aaa9b68fd power: fuel gauge: rk817: fix the display soc jump from 0 to 100
Change-Id: I8ad336bfdce6bac04ec5d07d885fd8a0992b4339
Signed-off-by: shengfei Xu <xsf@rock-chips.com>
2018-03-13 11:13:01 +08:00
shengfei Xu ef4591a518 power: fuel gauge: add rk817 support
Change-Id: I721887363b8eeea628b0042d34f0ab66ed76e6a1
Signed-off-by: shengfei Xu <xsf@rock-chips.com>
2018-03-05 10:36:35 +08:00
Joseph Chen 8fc5ae065c power: charge_animation: move out delay
Change-Id: Ic46f9ba23fc8e9e3b41e8fc8118a29ecdc00de8f
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-03-01 16:29:12 +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 6ba708bc77 pmic: rk8xx: verify supported chip id list
Change-Id: I792181827a4c68dab8918694f4a0604d5f331537
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-02-11 17:46:30 +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 037c289fda fuel gauge: rk816: refactor code
1. use ofdata_to_platdata() to parse fdt;
2. clean up code.

Change-Id: I75a6cb721e10fa1f30e59b101b3db0bb19df8001
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-02-09 14:28:50 +08:00
Joseph Chen f23c35a88c power: charge animation: optimise code
1. compatible fdt node used on legacy U-Boot;
2. clean up code.

Change-Id: If9ad1df379b14d096e3310568bc39d2c5820753b
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-02-09 14:28:16 +08:00
Joseph Chen 3e0925058e regulator: add min_sel for rk816 buck and ldo
This fixes get voltage error

Change-Id: I8e0b6bd16b82ebdd0fe9d2d81a19bee0f8881037
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-02-09 14:28:05 +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 2f22a22f29 regulator: uclass: remove suspend voltage min and max validate
min and max voltage are used to limit run time voltage, suspend
voltage should not limited by them.

Change-Id: I8b3660c51992d8baec6401630e3ec093b01b1260
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-02-09 14:27:48 +08:00
Kever Yang 3d29ee38ce rockchip: power: charge animation depends on DRM_ROCKCHIP
charge animation need display provided by DRM_ROCKCHIP.

Change-Id: I58113e81dd2899c969d1e748548a498eb04db550
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
2018-02-07 18:12:15 +08:00
Joseph Chen d4e1125bbc power: charge animation: use platform_read_key()
Change-Id: Idbcec18cfacb74305880c8e207e51b1ff204a948
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-01-31 18:13:53 +08:00
Joseph Chen d6653c12a9 power: charge animation: compatible legacy device node
compatible with kernel 4.4 device node "uboot-charge".

Change-Id: I754091d02f73b265f852855d203775862f33f05c
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-01-30 17:25:14 +08:00
Joseph Chen 513d5509a4 fuel gauge: rk816: report charge current to framework
Change-Id: I47f48f78749783022bbd0b3876de406d73e37e7e
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-01-30 17:25:13 +08:00