commit 90adf98d9530054b8e665ba5a928de4307231d84 upstream.
Since commit 1c6c69525b ("genirq: Reject bogus threaded irq requests")
threaded IRQs without a primary handler need to be requested with
IRQF_ONESHOT, otherwise the request will fail.
scripts/coccinelle/misc/irqf_oneshot.cocci detected this issue.
Fixes: b5874f33bb ("wm831x_power: Use genirq")
Signed-off-by: Valentin Rothberg <valentinrothberg@gmail.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Zefan Li <lizefan@huawei.com>
OTG has higher priority than wireless charging, we need to:
1. bypass wireless irq work when OTG is plugged
2. report wireless online = 0 when using wireless charging then
plugging OTG
or it will show charging icon even battery status is "Not Charging"
Bug: 11073722
Change-Id: I5a807817a5733d043316d2ad04dde50b0b506895
Signed-off-by: Hank_Lee <Hank_Lee@asus.com>
modify hot limit temperature from 55°C to 45°C to stop charging
Bug: 11222237
Change-Id: I81bc8d75bba59635d5b136bbf41cf3090d4d2b4f
Signed-off-by: Hank_Lee <Hank_Lee@asus.com>
VBUS drop level may not affect VBUS_DET to trigger IRQ,
it results in AICL result much lower without being noticed,
we check AICL result during battery polling and reconfig it
if neccessary
Bug: 10812199
Change-Id: I98dde8cdd5061d02851cb5f519c437b220906add
Signed-off-by: Hank_Lee <Hank_Lee@asus.com>
Average current drawn can be calculated by reading the coulomb
counter based charge before and after the usecase is run and
dividing the difference in the charge by the time it took to
run the usecase.
Use power supply property POWER_SUPPLY_PROP_CHARGE_NOW, to
expose the coulomb counter based charge.
Change-Id: I43e26a2932ab3e3d9d79bb5af7daf2364ca133b7
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
Signed-off-by: Ajay Dudani <adudani@codeaurora.org>
In high temperature environment, charger will occur over-voltage
and it will latch charging battery function, we need to refine
JEITA function to avoid it
Bug: 9847839
Change-Id: I1185fd3a49e318ebd83b30d843d2b72c39f22e40
Signed-off-by: Hank_Lee <Hank_Lee@asus.com>
commit 3594f4c0d7 upstream.
The exposed interface for cm_notify_event() could result in the event msg
string being parsed as a format string. Make sure it is only used as a
literal string.
Signed-off-by: Kees Cook <keescook@chromium.org>
Cc: Anton Vorontsov <cbou@mail.ru>
Cc: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Anton Vorontsov <anton@enomsg.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Because AC has first priority of charging, we need to
disable wireless charging IRQ when AC plugged to avoid
reconfig AC input current frequently
Bug: 9615541
Change-Id: I908b4825193dc463ef11d7eaf47ac61204b6692a
Signed-off-by: Hank_Lee <Hank_Lee@asus.com>
USBIN input current limit may load smb345 default(500mA)
even AC adapter due to VBUS drop, we need to reconfig it
Bug: 9474296
Change-Id: I46ae320180a6ec6c3f9c6e9bab6a2b1f7c7ce05a
Signed-off-by: Hank_Lee <Hank_Lee@asus.com>
The system resume then suspend too fast
when put on or remove wireless charging dock
Change-Id: Idddb823036b58f1c390aee500574d8379a91731f
Signed-off-by: Hank_Lee <Hank_Lee@asus.com>
Reboot the device to charger mode when user turn off device and
Wirless/AC/USB is plugged.
verify ok in android-msm-flo-3.4-wip-debug.
Change-Id: I9b0ff5c9f4cb0f11677d978cb34bbd2db2082c51
Signed-off-by: singhome_lee <singhome_lee@asus.com>
To avoid battery is drained to critial low state,
it needs to shutdown device when charging + battery capacity = 0%
Change-Id: If62f1808fdfa527fba065f16268907fedc319601
Signed-off-by: hank_lee <hank_lee@asus.com>
Signed-off-by: alan_lu <alan_lu@asus.com>
1. If there is charging source, set Hard/Soft Hot Limit
when system is awake or suspend(shutdown)
2. Monitor battery temperature to set corresponding float voltage
and disable/enable charger
Change-Id: Ia804a935570bbb5a1fe22067a712eaef36e903c0
Signed-off-by: Hank_Lee <Hank_Lee@asus.com>
1. detect wireless charging
2. set input current limit as 300 mA and disable AICL
3. after 2 seconds, set input current limit as 500 mA
4. after 2 seconds, set input current limit as 700 mA
Change-Id: Ia91ea674ba7eea45f92421d13b75a578a2d21a77
Signed-off-by: Hank_Lee <Hank_Lee@asus.com>
Priority is : 1. AC, 2. wireless charging, 3. USB.
Charger default setting is that wireless charger has higher priority,
so disable wireless charging when AC is plugged in since hardare rev_c.
Bug: 8411313
Change-Id: I6da25d1d6fbdf683421918229babba0ab97afebc
Signed-off-by: Hank_Lee <Hank_Lee@asus.com>
If there is no charging source, we should not report "Full"
battery status or it will show charging icon
Bug: 8728645
Change-Id: If74cedaca272428208c536e647094cf81af20619
Signed-off-by: Hank_Lee <Hank_Lee@asus.com>
Report battery current to check charging/discharging
of system
Change-Id: I49705758992c9d21529a2e3f7874b990c7474d1b
Signed-off-by: hank_lee <hank_lee@asus.com>
Signed-off-by: alan_lu <alan_lu@asus.com>
Signed-off-by: Iliyan Malchev <malchev@google.com>
The current code can divide by zero in the scale_soc_while_chg
function if calculated_soc drops while charging.
This patch fix it.
Change-Id: I83c7e9c7056990499f474c9e1882f0377df05f0c
Rather than checking for the value 1 check that
bit zero is set.
Change-Id: Ie2842b28648084d8970329d7c76fcf0d0666a847
Signed-off-by: David Keitel <dkeitel@codeaurora.org>
Signed-off-by: Iliyan Malchev <malchev@google.com>
Some workarounds that are required for PMIC die version 3.0
differ slightly for die version 3.0.1.
Fix this by checking the PMIC subversion register to distinguish
between 3.0 and 3.0.1.
CRs-Fixed: 403150
Signed-off-by: David Keitel <dkeitel@codeaurora.org>
(cherry picked from commit 913c55e2706c36132fd42f90c05530b8e55a26ed)
Conflicts:
drivers/power/pm8921-charger.c
Change-Id: I11155d6180de09e1b9e0137f7943603d44102d07
Signed-off-by: Sridhar Gujje <sgujje@codeaurora.org>
Signed-off-by: Iliyan Malchev <malchev@google.com>
During charging adjustment, the measurement of voltage is not accurate.
Since the measured voltage during charging adjustment is not OCV
(open circuit voltage), it cannot show real battery voltage at CC to CV
point. But current implementation use inaccurate voltage as a voltage of
CC to CV point. This inaccurate voltage of CC to CV point can cause
wrong SoC adjusting. For instance, the SoC could stick at fixed value
until end of charging.
This patch increase accuracy of voltage measurement by using battery
current and battery resister.
Change-Id: I3a4cc4e58e409be5422ec6bf64678a9a92b9fe25
We observed that SoC suddenly increase from 98% or 99% to 100%
right after charger removal. This issue caused by charging adjusting
algorithm which adjust SoC to sync 100% with end of charging.
During charging adjustment, the adjusted SoC could be smaller than
original SoC. So when we remove charger, charging adjusting algorithm
stop adjusting SoC and then bms report original SoC which is larger
than before.
Previously, bms driver considered most of this case by using previous
SoC when SoC increase during discharging. But if SoC is 100%, previous
patch doesn't work.
So this patch add SoC 100% case by checking if charger is enabled.
Change-Id: I70945d391c9d821eaf875f1bcd1e8787077b98da