1. Disable charger only when charger is offline and vbus is bad.
2. Get charger status from wireless charger if wireless charger present.
3. Get charger ibus limit from charger current_max property
indicating the AICL value for BC1.2 charger.
Change-Id: I0ff51a15d6faf4f545fcda200ae531240e531e04
Signed-off-by: Yonghua Yan <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/2536492
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Guobin Zhang <zhanggb@motorola.com>
Submit-Approved: Jira Key
Support input voltage limit for wireless charger separately so
as to load different input voltage limit for wired and wireless
charger input.
Change-Id: Ifab8e2ee36c0f549be4fb348396e4fadb6e650d6
Signed-off-by: Yonghua Yan <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/2516665
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: litong <litong20@motorola.com>
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
Keep the same delay work interval as discharging status for
FULL battery status to reduce battery status updating and log
printing for power save.
Change-Id: Iedca4ad8706dbeee9d7de9258e21c3e0ed4f3234
Signed-off-by: Yonghua Yan <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/2508996
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
Initialize the delay work before IRQ init in case the irq
occurs to schedule the delay work before it initialized
and cause Kernel panic.
Change-Id: I9497e4ca66193d9f9170b666dd15a9fed9fd890b
Signed-off-by: Yonghua Yan <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/2497207
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: litong <litong20@motorola.com>
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Submit-Approved: Jira Key
Align battery current reading request of power supply
property reading to avoid too frequent mmi charger
status updating and uevent change to user space on dual batteries
support products..
Update charger power only when power change more than 1W.
Change-Id: I154ad951d79db36ed06eaaeca32785b8a68051a3
Signed-off-by: Yonghua Yan <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/2482188
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
Add lpd mitigate driver module to support lpd policy from
AP side.
Support lpd mitigate mode configuration from AP side in devicetree.
Support lpd mitigation policy taking touch underwater detection
result into account.
Change-Id: I10516534a86d294620631c48127938c314c7659b
Signed-off-by: Yonghua Yan <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/2450334
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
This reverts commit 6295c4be3cd07939a46e542237d2ca5bc4e73aa3.
As this patch will cause socket connect fail after reconnect usb
in factory mode, so revert it before we get the final fixing on
SM8550 platform.
Mot-CRs-fixed: (CR)
Change-Id: Ied35f20d075778d4b5a097ff4996af29a1b8228b
Reviewed-on: https://gerrit.mot.com/2399151
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Yuecai Liu <liuyc20@motorola.com>
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
Notify usbnet if configure to sync with netconfig in userspace
in factory mode.
Clear the gadget in context in case it has been removed when
phone switch to host mode. In that case, there will be kernel
panic for invalid gadget device access.
Change-Id: I28fdb1455eff5fa0592f024e7f1096cbf662de23
Signed-off-by: Yonghua Yan <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/2337318
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Haichao Li <liuhc3@motorola.com>
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
The charger input current provides for both main
and flip battery charger, so there should be balance
between the two charger input in order to meet
the BC1.2 charger current spec:
SDP: 500/900mA
CDP: 1500mA
DCP: 1500mA
Change-Id: Idf52ec497a46a01340a8a96888148cc324858ad3
Signed-off-by: Yonghua Yan <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/2331227
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
In order to avoid battery over discharging when charger attached
in some cases with high system load or charging disabled in factory
mode.
Change-Id: If323b2a5c558c944ba85a33188235c58909b6ada
Signed-off-by: Yonghua Yan <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/2330746
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
The fg psy may be created later than sgm4154x charger probe
and the fg psy event will be missing according to current
psy filter condition in psy notify call.
In order to fix this, use the fg psy name directly for
psy check, and not check the fg psy pointer.
Change-Id: I6ca888864045c0f523bfbef9f30411567214d995
Signed-off-by: Yonghua Yan <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/2326012
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
In order to avoid battery over voltage and current
during charging or over current in discharging
add threshold to trigger the protection based on
battery voltage and current.
Change-Id: I2c9329a181ba9dd814d6e48a5e0f9c8e7f9d5147
Signed-off-by: Yonghua Yan <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/2322540
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Tested-by: Jira Key
Submit-Approved: Jira Key
When the battery charging is halt under chargable
condition, reset the battery charging to recover it.
Put the charger in HIZ mode if the battery is absent
or OTG is enabled to prevent battery charging by
boost power.
Mot-CRs-fixed: (CR)
Signed-off-by: Yonghua Yan <yanyh2@motorola.com>
Change-Id: I7631a7fdd2329c108d1dc2bd3d341775a194ccb8
Reviewed-on: https://gerrit.mot.com/2321180
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
When the battery charging is halt under chargable
condition, reset the battery charging to recover it.
Put the charger in HIZ mode if the battery is absent
or OTG is enabled to prevent battery charging by
boost power.
Change-Id: I435bcb751d22ef2ac515aa15bb63e423dfdc4cb6
Signed-off-by: Yonghua Yan <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/2320930
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
Schedule the heartbeat work to update the battery properties
if read current_now.
Change-Id: I47cdd15911219ce8af268a23acefd4980c081b45
Signed-off-by: Yonghua Yan <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/2316770
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
Add battery OVP and OCP for battery charging
to workaroud the CE certification.
Change-Id: I2004e4a280cf2e5e8ce0d19c501e4a338e45d500
Signed-off-by: Yonghua Yan <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/2316155
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
As the factory tcmd init depends on the usbnet description sysfs
node when tcmd start up, so create it as early as possible to
avoid tcmd fails to get usbnet description.
Change-Id: Ie2946efe49ffa5815504bd45734c3538bee15a1f
Signed-off-by: Yonghua Yan <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/2311260
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
Add and remove the sysfs files when usbnet configures the
ip by host PC.
When this sysfs files are ready, it means ip config received
from host PC and the phone can configure the network interface.
Change-Id: I2dabc4693d5e698e0c4853d0fa9d06e454ba7875
Signed-off-by: Yonghua Yan <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/2306945
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
Set charging status to discharging if charger absent
in case FG report confused status.
Change-Id: I95194b19750eb5af422ebb05f5937ca18a15a61c
Signed-off-by: Yonghua Yan <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/2301533
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
It gets incorrect paired_ichg value before setting to make a wrong
decision on charging current setting.
This issue may cause battery charging out of controlling of battery
charging policy.
Change-Id: If5ed84d5cebc231ecda70dcb919b76c681f52d84
Signed-off-by: Yonghua Yan <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/2298136
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
It's not reasonable to allow paired main battery to
charge the backup battery, as the main battery is
constant power supply for the system power, and it
does not benefit the principle to keep the main battery
voltage no less than backup battery.
Force battery soc to 0 only if paired battery volatge
is lower than empty voltage and soc becomes to 0.
Change-Id: Ifdaed984565f3c696d08fa43696e5b563930adf4
Signed-off-by: Yonghua Yan <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/2294021
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
Remove the sysfs notify for sysfs node from usb interrupt
context, as sysfs_notify may be scheduled or sleep.
Change-Id: I45baf51b96506e4df6290b74c3a033240f8a1a83
Signed-off-by: Yonghua Yan <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/2293617
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
Add sysfs files under /sys/devices/virtual/net/usb0/
1. ip address
2. subnet mask
3. iff flag
Userspace program can set the net interface for the usbnet in factory mode,
and read back the ip address, subnet mask, and net interface up/down flag
to configure the net interface via socket ioctl to sending ifrequest.
Change-Id: I5c9d1181823a07467eaa9acd1b722b52f7601bed
Signed-off-by: Yonghua Yan <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/2289066
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Haichao Li <liuhc3@motorola.com>
Reviewed-by: Tao Sun <suntao2@motorola.com>
Submit-Approved: Jira Key
Support charger power watt uevent to notify BatteryService
the charger power capability.
Filter uevent by uevent message POWER_SUPPLY_POWER_WATT=
to parse the charger power in watt.
Change-Id: I9Montana081355e68b281825476d241f570d3118c5fb
Signed-off-by: Yonghua Yan <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/2276713
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
Check return of regulator_enable to avoid compile issue
for in some build environment.
Change-Id: I49e64662959c2f5e57909901ae3c373ae57b3e08
Signed-off-by: Yonghua Yan <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/2273786
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
Turn off load switch when charger is attached and paired
battery is under charging, but not discharging.
Change-Id: Idbd2824c85a43175b8030eeb2e0af2e7a400f27e
Signed-off-by: Yonghua Yan <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/2273610
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
1. make it compatible with Android S build environment
2. add optional i2c pullup power regulator
3. make battery current polority selectable from DT
4. make the power supply name configurable from DT
5. use battery temperature for battery present detection
Change-Id: I326688b499296e3c99ebde67632af90edac092c1
Signed-off-by: Yonghua Yan <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/2269111
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Yuecai Liu <liuyc20@motorola.com>
Reviewed-by: Haijian Ma <mahj8@motorola.com>
Reviewed-by: Lu Chai <chailu1@motorola.com>
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Submit-Approved: Jira Key
Use delta OCV to limit the charging current to improve the controlling
policy accuracy as battery SOC may be incorrect for FG issue.
Change-Id: I55eda8f32d833ece0b281732b34bd4357fbdb6ef
Signed-off-by: yanyh2 <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/2259903
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
1. Consider the battery is absent if battery temperature
is lower than -30 degree C.
2. Disable bq27426 register dump for debugging in heartbeat
work.
3. Change the heartbeat work interval to 60s.
Change-Id: I043c6a28f998668a0dad7f39b75f21fb1b3c6f1f
Signed-off-by: yanyh2 <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/2253210
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
As I_BDEV cannot be used in GKI build before
kernel version 5.15, so add kernel version
check when use I_BDEV.
Change-Id: I7f02b64434559d4a1e00a2c8ea6b38bb1288957b
Signed-off-by: yanyh2 <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/2252790
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
In order to improve the accuracy of load switch controlling policy
use battery OCV instead of vbat to calculate the delta battery voltage
based on vbat, current and ESR.
Add panic debounce when decide to turn off load switch for high
battery voltage diff between flip and main battery.
Change-Id: Ib9b374952a8f6400e008953b123b4878b17fbe4f
Signed-off-by: yanyh2 <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/2247225
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
Support init bm ulog to print the bm ulog at init
stage to dump adsp init log at bm ulog driver probe.
The adsp init log will help to address the issue during
adsp module init stage.
Change-Id: I4c1a79da57f73463d885ff25466444c73036f43b
Signed-off-by: yanyh2 <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/2246243
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
Add factory kill time debounce support to debounce the factory
kill event for charger/usb online shake during boot in
factory mode.
Change-Id: I1ca70dbfebd1fa8555ca36dda2b7b6ab2dbc8a2d
Signed-off-by: yanyh2 <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/2242975
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Zhenxin Xi <xizx@motorola.com>
Submit-Approved: Jira Key
Update bq27426 fg profile for li and oneli products according
to the TI initial profile report.
Change-Id: If56c0f5ebe5de69b15cf110ea500ef9175823224
Signed-off-by: yanyh2 <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/2237962
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
Notify mmi_battery change when combo current change so that the
battery current status will be updated when combo current change.
Change-Id: Iddcf0d8fc7f9a1a44b6c042f1d72ae337931f37c
Signed-off-by: yanyh2 <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/2226482
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
1. Disable the charging and charger input via device tree
configuration
2. Disable charger input if battery is absent or temperature
is too low(<-30 degree C)
3. Force battery to empty to trigger android auto power off
if paired battery becomes empty to avoid it over discharging.
Change-Id: I7a42db2d0d0281ed1843fee11f79d2dcf9291a0e
Signed-off-by: yanyh2 <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/2211635
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
1. adjust the charging enable logic from sysfs node
2. fix logic issue on charging disable from mmi charger
3. add constant charge current and input current limit
in charger power supply
4. Disable high and low load switch when charger insert
Change-Id: Idbdfb2c0c10d69927402e2f219d642f58b7c9f1d
Signed-off-by: yanyh2 <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/2205999
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
Add module parameter to enable panic on delta_vbat when the
paired battery delta_vbat exceeds threshold of paired battery
load off state.
The panic is enabled only for engineering devices, and disabled
by default.
Change-Id: I0afe222c59e155af507e53e7ede6ede31ddf367a
Signed-off-by: yanyh2 <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/2196448
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
Configure the paired battery load according to the paired_ichg
which comes from the delta_soc mapping for paired battery voltage
and soc balance.
Change-Id: I8b4c5b0f95bec1656a96dfaf060d6b593052bfaa
Signed-off-by: yanyh2 <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/2192804
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
Add main battery power supply to support main battery
property read in multiple batteries products.
Change-Id: I73c89fc4795ad0ae299460ed616b7d07d5a66ca1
Signed-off-by: yanyh2 <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/2189094
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
Add paired battery notification to limit the battery
load to system power and charging speed.
Change-Id: Ia416fe0b69bb6535e2874f518dcbb8d534dc3039
Signed-off-by: yanyh2 <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/2186534
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
Add paired id used to support multiple batteries notification between
reference battery and target battery.
Change-Id: I2e1d991d055834a68c38eb7372c7fae17eb297e1
Signed-off-by: yanyh2 <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/2186431
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
1. Fix the build issue on Androd S
2. Support externel USB power supply for charger input detection
3. Support battery fuel gauge power supply to query battery status
4. Register the charger to mmi charger driver architecture
Change-Id: I852a176657964b4a8914176333171c0ab6d81b51
Signed-off-by: yanyh2 <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/2168097
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
Reset charger configure and constraint for glink down, so that
AP will resend the charger configure and constraint to ADSP
battery management, otherwise uninitilized value of charger
configure and constraint will be used in ADSP side after ADSP
restart, and then power max value will use default value 0;
Change-Id: Ic29a61763c85be62102ecb0333ae7f03f79ac670
Signed-off-by: yanyh2 <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/2153260
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Wentao Xu <xuwt2@motorola.com>
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
Add OEM glink notification for qti glink charger and
add qti charger notifier call chain to extend the qti
glink charger to be as communication proxy between AP
and ADSP battery manager.
Change-Id: I4351e2842e5f2105461a0d1d4bd2e5c8cdcd5d3e
Signed-off-by: yanyh2 <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/2076935
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Wentao Xu <xuwt2@motorola.com>
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
This reverts commit 993a25647b7c117aa576684ea553a62c00fe7b66.
This change does not match the purpose of mmi_charger design, it will
get mmi_charger controlling logic mess and break the exist factory
test rule and method.
Mot-CRs-fixed: (CR)
Change-Id: I8b44d53f4f2a24bc9b3035a2e776f91503b3de23
Reviewed-on: https://gerrit.mot.com/2066277
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Wentao Xu <xuwt2@motorola.com>
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
Save lpd and vbus present state in charger info data
structure.
Change-Id: Ic2ee432ff24669ae9d9412c8efdc58297fecb40c
Signed-off-by: yanyh2 <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/2061925
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
Modify the mass storage driver to build as a Motorola module
following Android GKI rule.
Change-Id: I278ce964d1689fb8dbf0df7b7e098e210d664565
Signed-off-by: yanyh2 <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/2053806
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Reviewed-by: Xiaojun Ji <jixj@motorola.com>
Submit-Approved: Jira Key
Copy the mass_storage driver from Kernel source as initial version
of Motorola mass storage base.
Change-Id: I0d95b47de5c1463164843d9e8cebce06e9492e52
Signed-off-by: yanyh2 <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/2053805
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Xiaojun Ji <jixj@motorola.com>
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Reviewed-by: Yuecai Liu <liuyc20@motorola.com>
Submit-Approved: Jira Key
Add glink oem command to get LPD info so as to show
the LPD information in AP log.
Change-Id: Ib9ce1fb89d626cde0465179a216028bd8abbdd5f
Signed-off-by: yanyh2 <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/2037809
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
As the bootmode cannot be fetched from bootarg in
SM8450 platform, so use common API bi_bootmode to
get the bootmode to support all platforms.
Change-Id: I16e9955d92649e84d14ee95e34c489faa2722c62
Signed-off-by: yanyh2 <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/2014700
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
Move the charger driver from mmi charger to be compatible with
Android S build.
Adjust the build make file to be compatible with Android S build.
Change-Id: I67969e25b691f9dfe64b43f65e42ad6e0545ebb6
Signed-off-by: yanyh2 <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/2003174
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Tested-by: Jira Key
Submit-Approved: Jira Key
There is a case that will make the system suspend failing for
mmi,charger wakelock and last for several minutes.
The reason is that the system suspend has the same 60s request
intervals as mmi charger heartbeat delay work, which will request
mmi,charger wakelock.
To avoid this two task run into resonating state, it's feasible to
change the mmi charger heartbeat interval to 100s.
Change-Id: Ie076e5a3657a6c67ea7e9fdcefd3ef897bc81d02
Signed-off-by: yanyh2 <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/1995180
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
Adjust the makefile to be compatible with Android S
version.
Change-Id: Ica70b178ae1b84dce47221c9018a4d35ff6c4363
Signed-off-by: yanyh2 <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/1992143
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Haichao Li <liuhc3@motorola.com>
Reviewed-by: Tao Sun <suntao2@motorola.com>
Submit-Approved: Jira Key
Add vote mechanism support for mmi charger so that
other modules can engage mmi charger interoperation.
Change-Id: I1772007c3acec199bd319601e3486bc7542c663f
Signed-off-by: yanyh2 <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/1984291
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
Do charger state sync when boot completed in case missing
some charger state change.
Change-Id: Iec128382d5edb98cda47752d07e606a6b66316be
Signed-off-by: yanyh2 <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/1982792
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Guobin Zhang <zhanggb@motorola.com>
Submit-Approved: Jira Key
As the reverted patch may cause panic for race resource batt_uenvp
when it accesses batt_uenvp which was just freed in heartbeat work.
Mot-CRs-fixed: (CR)
This reverts commit 715a9d18d8fa6b7acfc9540f5e3df2c4332baf28.
Change-Id: I07f3bf2cba6f30b345988231d0ee8ea18da27e4f
Reviewed-on: https://gerrit.mot.com/1982785
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Guobin Zhang <zhanggb@motorola.com>
Submit-Approved: Jira Key
1. Provide debugfs interface to collect battery manager ADSP log in AP side.
2. Provide debugfs interfaces to configure log level and category for log mask.
3. Provide exported APIs for other Moto battery charger DLKM to get battery
charger ADSP log and output to Kernel log or IPC logging.
Change-Id: I93cb18542414b21084a09218366d6d675beeb807
Signed-off-by: yanyh2 <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/1971297
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
Send charge rate uevent if power supply changes in case the
charge rate change uevent is missing by BatteryServices before
it starts up.
Change-Id: I4343454c54e30df1cbbc512d473b9061b10cbd84
Signed-off-by: yanyh2 <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/1964225
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
Add 30W turbo charger type support to identify
the charger type with power more than 25W.
Change-Id: I4365fa695b859c8d6916336fc34c832ca1c1aa82
Signed-off-by: yanyh2 <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/1960683
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Wentao Xu <xuwt2@motorola.com>
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
Update the charger_suspend config in charger configure function based
on demo_suspend status to make sure charger_suspend config will not be
cleared for charger configure reset.
Change-Id: Ib1f11c28003de60221886a4bb9dba0e4fcac7735
Signed-off-by: yanyh2 <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/1933674
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
The following sysfs nodes used by vendor init are required to
be the same among all the Moto products.
So move those sysfs nodes to the parent of battery device.
init.mmi.tcmd.rc:
/sys/class/power_supply/battery/device/factory_image_mode
init.mmi.rc:
/sys/class/power_supply/battery/device/force_max_chrg_temp
/sys/class/power_supply/battery/device/force_demo_mode
charge_only_mode:
/sys/class/power_supply/battery/device/factory_charge_upper
Change-Id: I55454e831e40d9fb82f64afb182941c471617a65
Signed-off-by: yanyh2 <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/1929184
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Wentao Xu <xuwt2@motorola.com>
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
Get the battery profile id via looking up from a profile id
and battery serial number mapping table in device tree, so
each product can specify the supported battery profile id and
serial number mapping table by its own in device tree.
Change-Id: Ide3a5b73e5500c47e1afca2122d6ef082982875d
Signed-off-by: yanyh2 <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/1899502
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Wentao Xu <xuwt2@motorola.com>
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
1. Use common wakeup source APIs
2. Add combo_health and combo_temp as combo property of
mmi_battery power supply.
3. Correct the initial value of battery status when
calculate the battery combo status.
4. Change the driver name to be constant for compatibles.
5. Export the including path for header file in Kbuild
6. Update the README for more platform driver support.
Change-Id: I0f3403c1e622aa35ccbf753d6c30142b16655752
Signed-off-by: yanyh2 <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/1896694
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Wentao Xu <xuwt2@motorola.com>
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
USB charger absence will assert during USB enumeration on
bootup with USB connected, so it will trigger the factory
kill power off unexpectedly in factory mode.
To avoid this issue, consider the charger as present as long
as the charger type is not unknown at the same time.
Change-Id: I96a04cc96536a63936c69946c507198d933ef560
Signed-off-by: yanyh2 <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/1891779
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
Update qti_glink charger driver to match the common
charger adjustment for the charger configure data
structure.
Change-Id: Ic0672b8b1f4a0eb8290accd2e5f02cf6078417e6
Signed-off-by: yanyh2 <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/1864228
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
As a common charger driver mmi_charger inherits Motorola legacy battery
charging features, including Demo charging, Step charging, Flash Fast
charging, and common features for factory test support.
More importantly, it provides a cross-platform solution to support
various battery charging design, not only Qualcomm SoC but also Samsung,
MTK, even remote system over network, and especially suite multiple
battery packs and multiple charger ICs in one system.
To achieve this goal, besides mmi_charger driver, there need a low level
charger driver for each battery charging solution(a couple of charger IC
& battery pack) to register to mmi_charger driver with implementation of
required interfaces depending on their own HW design.
With mmi_charger driver, Motorola common features have been stripped
from the HW dependent charger drivers(older Motorola charger drivers),
in which all the common features have to be implemented by each driver
of its own. So a low level charger driver can focus on HW specific
features and function development.
Motorola charger driver architecture:
----------------------------------------------------------------------
Userspace Common Interfaces for Charging Features and Factory Test
----------------------------------------------------------------------
Kernel mmi_charger (Motorola demo, step, flash-fast charging,
/ | \ factory and debugging interfaces)
/ | \
qti_glink_charger x_charger N_charger (basic charging functions HW
| | | specific factory debugging interfaces)
| | |
------------glink----i2c------spmi------------------------------------
| | |
| | |
ADSP i2c chip PMIC
Benefit from this new Motorola charger driver design:
1. Easy upgrade, migration, and maintenance, as common driver is
cross-platform and HW independent.
2. Reduce develop workload, as developers can pay more energy and
efforts on HW or platform specific business logic.
3. Easy to support complex battery charging solution, as it can support
N couples of charger IC & battery pack in one system at the same time
theoretically.
Change-Id: Ie44a22a2c65ea01fd3930879aeb9aae1c44341e0
Signed-off-by: yanyh2 <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/1502333
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Wentao Xu <xuwt2@motorola.com>
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
Correct function usb_ether_xmit return value type to match
the prototype of the member ndo_start_xmit in struct net_device_ops
to avoid CFI checking failure.
Change-Id: I8439e967ee824bb5f0ac8447d79ae066379a6465
Signed-off-by: yanyh2 <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/1818255
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Yuecai Liu <liuyc20@motorola.com>
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
Add init and deinit functions to prepare power and IO pins
for module init and exit.
Change-Id: Iaf8d26409f71998bb52b63873237198adef7a0cb
Signed-off-by: yanyh2 <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/1708657
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Reviewed-by: Yuecai Liu <liuyc20@motorola.com>
Submit-Approved: Jira Key
The API inet_ioctl() is not allowed to be used
in Android R for GKI compliance.
There should use sock_create_kern() instead
of dummy socket.
Change-Id: I37515cf8eece5be12a8cc2b91081f53bef5cd3ae
Signed-off-by: yanyh2 <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/1715791
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Yuecai Liu <liuyc20@motorola.com>
Reviewed-by: Ryan Lattrel <ryanl@motorola.com>
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
do_gettimeofday is not supported in new Kernel version, redefine
it if it is not supported for compatible compilation of stmvl53l1
DLKM module.
Change-Id: I718eedf4d8cd8479f0d34fca8a78e7e1e39e49ec
Signed-off-by: yanyh2 <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/1679227
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Yuecai Liu <liuyc20@motorola.com>
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
Legacy api get_ds is not used any more in new Kernel
version, and it can be replaced by KERNEL_DS directly
according to the explanation of the commit patch to
remove get_ds() from Kernel.
Change-Id: I9beffbeac23d5399fcf87f9bf832241f442654e0
Signed-off-by: yanyh2 <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/1679179
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Lu Chai <chailu1@motorola.com>
Reviewed-by: Yuecai Liu <liuyc20@motorola.com>
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
Adjust the way to identify factory bootloader to decide
whether SW is factory SW version.
When device in factory mode may be identified as factory version
in previous implementation.
Change-Id: I38b4fe9ea12d70b8e07416110c2d7e8a5bbf994a
Signed-off-by: yanyh2 <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/1616461
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Zhenxin Xi <xizx@motorola.com>
Submit-Approved: Jira Key
Add dts property to configure force_device_on_en_default
so the product can choose this option in dts.
Once this option is set, the TOF device will always be in
on state, the xshut will keep high and avdd will be on all
the time.
Change-Id: I0b74bcafdcb94e5b9356ff94ede4a97c62e57bdc
Signed-off-by: yanyh2 <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/1507387
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Reviewed-by: Yuecai Liu <liuyc20@motorola.com>
Submit-Approved: Jira Key