Commit Graph
100 Commits
Author SHA1 Message Date
Yonghua Yan 6ba7fd6522 Add lpd mitigate driver module
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
2022-12-06 05:21:07 -06:00
Yonghua Yan c7dabf3b12 Add LPD device notify support in mmi_relay
Add LPD notify support in mmi_relay.
Add LPD notify event type definition.

Change-Id: Ib2cca69bacb3de8a9321b9df70331cf5471e793e
Signed-off-by: Yonghua Yan <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/2450302
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
2022-12-06 05:20:26 -06:00
Yonghua Yan 582c3f412e Add glink oem command to support lpd mitigate mode
Add glink oem command to support lpd mitigate mode configuration
from AP side.

Change-Id: I505fb86a98f1d2d4e0078fe795d3e304086e8393
Signed-off-by: Yonghua Yan <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/2450314
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
2022-12-06 05:20:14 -06:00
Yonghua Yan cd5fb895e3 Revert "(CR):f_usbnet:Handle the rx error conditions"
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
2022-10-08 07:13:42 -05:00
Yonghua Yan c1d23c2a08 Skip BM ulog request if bm debug is disabled
Skip BM ulog request if bm ulog debug is disabled
to avoid adsp glink request race with other adsp glink clients
l(CR) qti_battery_charger and qti_glink_charger.

Change-Id: I97d2b6bac91b06a8434f0424a602936f0ce1e971
Signed-off-by: Yonghua Yan <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/2362826
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
2022-08-16 07:35:55 -05:00
Yonghua Yan 912fbabb8e update bm ulog mask
Update bm ulog mask according to adsp update
for ulog mask.

Change-Id: If37fae89a74f8391c8484492c78c0dad9267a965
Signed-off-by: Yonghua Yan <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/2343108
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
2022-07-24 23:02:38 -05:00
Yonghua Yan 896ff3dd7b usbnet: notify if config to sync with userspace
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
2022-07-22 02:44:28 -05:00
Yonghua Yan a2caade93d adjust flip charger input current
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
2022-07-12 10:38:59 -05:00
Yonghua Yan c6c43063cf support empty vbat shutdown with charger
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
2022-07-12 05:16:13 -05:00
Yonghua Yan b111dc0500 Monitor fg psy event once get the psy name
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
2022-07-07 09:24:20 -05:00
Yonghua Yan e22004f53f support battery ovp/occp/ocp
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
2022-07-05 07:22:59 -05:00
Yonghua Yan ff60c5497c Revert "(CR): Add OVP and OCP for battery"
This reverts commit 8dff4032ddd4f0cf9f3a6Montanafa338c712fc0a4eb.

Mot-CRs-fixed: (CR)

Change-Id: I5e05e24e2829c9d25f0592b9506906600adccde1
Reviewed-on: https://gerrit.mot.com/2322539
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
2022-07-05 07:07:40 -05:00
Yonghua Yan 1ff2f1a3f7 fixup! (CR): Reset charging if it's halt
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
2022-07-02 01:37:14 -05:00
Yonghua Yan d16d1f99f1 Reset charging if it's halt
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
2022-07-02 00:58:40 -05:00
Yonghua Yan ed90b000ce control charger irq for otg or battery presence
Disable charger IRQ if OTG is enabled or battery is absence
to prevent unexpected charger IRQ wakeup.

Change-Id: I71b699f25a5624f0f3699434f142abc8cd3d69d4
Signed-off-by: Yonghua Yan <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/2319107
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
2022-06-30 11:27:50 -05:00
Yonghua Yan fc575f57fc Trigger battery current read on demand
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
2022-06-30 05:34:31 -05:00
Yonghua Yan 9f61fd6d0e Add OVP and OCP for battery
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
2022-06-29 03:20:04 -05:00
Yonghua Yan d8ef9cab5a Add the description sysfs node when usbnet init
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
2022-06-23 10:20:36 -05:00
Yonghua Yan b9556551e5 add and remove sysfs files when usbnet config
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
2022-06-21 09:24:18 -05:00
Yonghua Yan 7eb1770837 Set to discharging status if charger absent
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
2022-06-15 05:59:53 -05:00
Yonghua Yan be6a9eccb7 correct the paired_ichg value before setting
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
2022-06-12 07:14:31 -05:00
Yonghua Yan 15dd6d3da4 Stop charging by paired battery
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
2022-06-09 19:40:51 -05:00
Yonghua Yan 3006d8909c remove the sysfs notify from interrupt context
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
2022-06-08 04:58:24 -05:00
Yonghua Yan aa3226523c usbnet: add sysfs files for net interface config
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
2022-06-07 05:33:56 -05:00
Yonghua Yan 6e4e7b316f Skip ichg set during paired notify in factory mode
Skip ichg set during paired notify in factory mode to avoid
dual battery charging balance policy disturb the factory test.

Change-Id: Id4ddd606e4544f4adf532affee232347ca3efce5
Signed-off-by: Yonghua Yan <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/2286055
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
2022-06-01 07:06:34 -05:00
Yonghua Yan 0769972de6 Add charger power watt uevent
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
2022-05-23 04:13:19 -05:00
Yonghua Yan e9dcdc46e0 Check return of regulator_enable
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
2022-05-19 07:34:57 -05:00
Yonghua Yan e4e70fc2b3 Turn off load switch during charging
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
2022-05-19 03:34:29 -05:00
Yonghua Yan 949abff4c6 Improve cw2217b fg driver compatibility
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
2022-05-19 01:35:40 -05:00
yanyh2 3717c3b14b Use delta OCV to limit the charging current
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
2022-05-05 02:35:10 -05:00
yanyh2 c7135bc1e5 Disable debugging log for power consumption
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
2022-04-26 04:33:27 -05:00
yanyh2 35608bf0a0 add kernel version check for I_BDEV
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
2022-04-25 22:04:16 -05:00
yanyh2 0b1ff3b85e fix build err for new Kernel version
moto_f_mass_storage.ko build error:
storage_common.c:218:20: error: no member named 'i_bdev'
in 'struct inode'

Change-Id: I1d0bde9c0f60a8147ea4f8668cdc0240ed35ac3c
Signed-off-by: yanyh2 <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/2252051
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
2022-04-25 07:01:53 -05:00
yanyh2 6cdc32108e usbnet: fix build error in new Kernel version
Build moto_f_usbnet.ko error:
f_usbnet.c:453:13: error: implicit declaration of function 'get_fs'
[-Werror,-Wimplicit-function-declaration]
f_usbnet.c:454:2: error: implicit declaration of function 'set_fs'
[-Werror,-Wimplicit-function-declaration]

Change-Id: I300f961b7398d22936428caa387cf653aff5b777
Signed-off-by: yanyh2 <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/2252054
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
2022-04-25 07:01:48 -05:00
yanyh2 daae15dbfa Use battery OCV to calculate the delta battery voltage
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
2022-04-20 06:37:42 -05:00
yanyh2 708f85fb4f support init bm ulog
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
2022-04-19 05:35:20 -05:00
yanyh2 dec0712199 Add factory kill time debounce support
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
2022-04-15 02:21:25 -05:00
yanyh2 36b2393bf1 update bq27426 battery profile for li/oneli
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
2022-04-12 04:38:09 -05:00
yanyh2 38e1c75ba0 Notify mmi_battery change when combo current change
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
2022-03-28 02:31:02 -05:00
yanyh2 3b1a54a3f4 Adjust the paired battery policy
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
2022-03-11 11:15:27 -06:00
yanyh2 ff9d290880 Add ibat polority invert from dt
Support configure the ibat polority invert from
device tree.

Change-Id: I6742831a97dcf57a334047e277dcdc3ce2778f44
Signed-off-by: yanyh2 <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/2210038
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
2022-03-08 04:47:52 -06:00
yanyh2 5010751c98 optimize battery charging policy
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
2022-03-03 03:14:44 -06:00
yanyh2 b4020e9c78 Add module parameter to enable panic on delta_vbat
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
2022-02-23 06:26:20 -06:00
yanyh2 b096b71953 Set paired battery discharge load based paired_ichg
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
2022-02-16 22:29:44 -06:00
yanyh2 2093641e5d Support a main battery power supply
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
2022-02-13 20:38:26 -06:00
yanyh2 f6da73c6b9 add paired battery info notification
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
2022-02-09 03:16:41 -06:00
yanyh2 8975cef12d add paired id to support paired battery notification
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
2022-02-09 03:16:21 -06:00
yanyh2 d4aeb6d6f2 ignore optional dts property exist check result
Don't return error if dts property is optional with default
value specified to allow probe continue.

Change-Id: I74e3d948b380fd90c09d96308d3bb2990e438574
Signed-off-by: yanyh2 <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/2185351
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
2022-02-09 03:15:38 -06:00
yanyh2 c35ac191dc Bringup sgm4154x charger driver to Moto product
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
2022-01-12 06:40:17 -06:00
yanyh2 9a2b3304dd Add initial sgm4154x driver code from vendor
Add sgm4154x charger driver source code from vendor as
initial version.

Change-Id: I4b18f92e47ae59bc053e25e6d21dc3a083cb6b8a
Signed-off-by: yanyh2 <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/2167394
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
2022-01-12 06:39:27 -06:00
yanyh2 64bca136c8 Adjust bq27426 fg module to support Android S
Adjust bq27426 fg module to support Android S and different
HW design.

Change-Id: I90e0c6e49a47ca148e519564cc1a448deeb29177
Signed-off-by: yanyh2 <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/2152626
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
2021-12-29 22:36:10 -06:00
yanyh2 fed40d1211 Reset charger configure and constraint for glink down
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
2021-12-23 21:13:13 -06:00
yanyh2 2afeda660d print ulog when write oem glink command
Print ulog when write oem glink command for adsp debugging
and charger and usb related issue analysis.

Change-Id: I742894e7378dd81f81c552ed45eeb1ff798f69cc
Signed-off-by: yanyh2 <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/2097322
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
2021-10-22 07:38:24 -05:00
yanyh2 c86591b770 Add a new DLKM to support smart pen charger driver
Create a new DLKM smart_pen_charger.ko to be the driver
for smart pen charging management.

DeviceTree property:
mmi,pen-psy-name = "wireless";

module parameter:
/sys/module/smart_pen_charger/parameters/simulator_enabled
N: Use pen_data from ADSP over OEM glink
Y: Use the simulator_data from user input over sysfs nodes

sysfs path: /sys/class/power_supply/wireless/device/
pen_control: wo, u32 value range:
  PEN_CTRL_DETACHED,
  PEN_CTRL_ATTACHED,
  PEN_CTRL_CHG_EN,
  PEN_CTRL_CHG_DIS,
pen_id: rw, u32
pen_soc: rw, u32 value range: 0~100
pen_status: rw, string value range:
"detached", "attached", "ready", "charging", "discharging", "charged",
pen_mac: rw, string value format: xx:xx:xx:xx:xx:xx
pen_error: rw, u32

Uevent to HAL:
POWER_SUPPLY_PEN_ID=xx
POWER_SUPPLY_PEN_SOC=xx
POWER_SUPPLY_PEN_STATUS=xx
POWER_SUPPLY_PEN_MAC=xx:xx:xx:xx:xx:xx
POWER_SUPPLY_PEN_ERROR=xx

Change-Id: Ic3466d9bca7fa9b30ac7256f9e05dc1022a4c500
Signed-off-by: yanyh2 <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/2076942
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
2021-09-27 04:49:37 -05:00
yanyh2 6f1bbe9f80 Add OEM glink notification and notifier call chain
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
2021-09-27 04:48:24 -05:00
Yonghua Yan 1b05406882 Revert "(CR): mmi_charger: Fix battery_supply_init, batt_psy."
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
2021-09-14 06:37:42 -05:00
yanyh2 853d4cf831 Add sysfs to support force disable charging
Add sysfs force_charging_disable to support disabling
charging from user.

Change-Id: Iaef5d4adbb3d069f19526a089d6a52fa87b6d541
Signed-off-by: yanyh2 <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/2062175
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
2021-09-09 03:43:12 -05:00
yanyh2 6949e07285 add lpd and vbus present state
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
2021-09-08 04:55:45 -05:00
yanyh2 2e9f46e6c7 Send LPD and VBUS uevent for LPD alarm feature
Send LPD and VBUS present state uevent to inform frameworks
for LPD alarm feature.

Change-Id: I1200b0c5cbcee88e4f9e7c78486c78d13eb65f89
Signed-off-by: yanyh2 <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/2061924
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
2021-09-08 04:55:36 -05:00
yanyh2 269b84091d fix mass_storage module GKI build issue
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
2021-09-02 03:52:54 -05:00
yanyh2 1ae623bb38 copy mass_storage driver from Kernel as initial version
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
2021-09-02 03:48:01 -05:00
yanyh2 0be96993e6 add glink oem command to get LPD info
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
2021-08-11 00:45:57 -05:00
yanyh2 5c3ede1352 remove the mmi_info module dependency
No mmi_info module dependency for moto_f_usbnet module
correct the previous mistake.

Change-Id: I1eba4fe5f67d5156e52fa5ca96babaca3044e51e
Signed-off-by: yanyh2 <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/2003160
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
2021-07-28 06:41:55 -05:00
yanyh2 d365f54dd6 use bi_bootmode to query the bootmode
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
2021-07-16 00:31:04 -05:00
yanyh2 e02e59d144 Modify bm ulog and mmi chargers for Android S
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
2021-07-06 07:11:18 -05:00
yanyh2 8f1226f4a5 Adjust the heartbeat time to 100s in discharging state
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
2021-06-29 01:41:38 -05:00
yanyh2 3737af3e2b adjust moto_f_usbnet driver makefile
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
2021-06-25 08:23:45 -05:00
yanyh2 6f4a7d98ab add vote mechanism support for mmi_charger
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
2021-06-21 01:00:46 -05:00
yanyh2 c5311dbe8d add charger state sync interface
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
2021-06-17 07:42:11 -05:00
yanyh2 5aa73a35c9 Revert "(CR): send charge rate uevent when power supply changes"
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
2021-06-17 07:42:00 -05:00
yanyh2 2286350930 Print ADSP battery manager log if charging changes
1. Print bm log when qti charger init complete
2. Print bm log when battery status changes
3. Print bm log when charger status changes

Change-Id: Iadbb43908094c1dbe7e91e32dc1c94c1f23d4ca1
Signed-off-by: yanyh2 <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/1971298
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
2021-06-08 02:24:00 -05:00
yanyh2 d9aca754c7 Create bm_adsp_ulog module
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
2021-06-08 02:23:38 -05:00
yanyh2 6bdd0e5bb6 send charge rate uevent when power supply changes
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
2021-05-31 00:53:50 -05:00
yanyh2 5015d763e9 Add 30W turbo charger type
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
2021-05-26 03:39:01 -05:00
yanyh2 177379d9c1 update the charger_suspend config in charger configure
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
2021-04-27 21:53:39 -05:00
yanyh2 22fba6ffac Move sysfs node to the parent of battery device
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
2021-04-21 21:28:42 -05:00
yanyh2 2aee554600 Get the profile id from device tree
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
2021-03-12 04:12:30 -06:00
yanyh2 94eb15587f Add new platfrom driver to support smb charger
Add a new platform driver to support the Qualcomm SMB charger
with multi-battery support.

Change-Id: I71c813172825c793ddc1a0e5a921e6bbe6e5839c
Signed-off-by: yanyh2 <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/1896697
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
2021-03-12 04:12:25 -06:00
yanyh2 bd37f2a732 Add change to be more compatible
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
2021-03-12 04:12:19 -06:00
yanyh2 276e029066 correct the charger present based on charger type
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
2021-03-03 10:24:54 -06:00
yanyh2 b733a866a7 Adjust the charger configure data
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
2021-01-29 01:59:55 -06:00
yanyh2 410f73bd71 Adjust charger configure data
Split the charger configure data into charging configure and
charger running environment constraint for platform charger
driver for easy understanding.

Change-Id: I73eef124355d7c58e566f7bd88c7981ea888dc99
Signed-off-by: yanyh2 <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/1864222
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
2021-01-29 01:59:40 -06:00
yanyh2 be4f6e6ce6 dlkm: add qti_glink_charger driver
A low level charger driver qti_glink_charger to support battery
charging functions over glink and satisfy the interfaces requirements by
common charger driver mmi_charger.

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 (basic charging functions HW
                      |        specific factory debugging interfaces)
                      |
--------------------glink---------------------------------------------
                      |
                      |
                     ADSP

Change-Id: I255413442f2137ebeb6200c2e82b8086cc846e54
Signed-off-by: yanyh2 <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/1800646
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
2020-12-11 02:55:51 -06:00
yanyh2 6c2bbf2914 dlkm: charger driver for Moto common features
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
2020-12-11 02:54:54 -06:00
yanyh2 70bbf3279e usbnet: fix CFI checking failure
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
2020-12-04 00:44:57 -06:00
yanyh2 90049fc45a vl53l5: add stmvl53l5 init and deinit functions
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
2020-08-18 07:30:57 -05:00
yanyh2 7f7b934af4 vl53l5: initial version of vl53l5 sensor driver
Porting vl53l5 tof sensor driver to Moto platforms
from vendor st.

Change-Id: I57da832527369802d8f05d6e695ef31ef4e81ee6
Signed-off-by: yanyh2 <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/1694821
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
2020-08-18 07:29:46 -05:00
yanyh2 ec1e89f49d usbnet: fix GKI compliance issue on sock access
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
2020-08-18 04:14:31 -05:00
yanyh2 a0f5f44356 vl53l1: Make do_gettimeofday compatible to new Kernel version
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
2020-07-13 05:06:22 -05:00
yanyh2 33425953ea usbnet: Use KERNEL_DS to replace get_ds() for compilation
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
2020-07-13 05:06:14 -05:00
yanyh2 7e2ed631f2 adjust factory image identification
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
2020-06-15 00:35:23 -05:00
yanyh2 3a181247c4 Support dts property to configure force device on option
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
2020-03-05 00:40:46 -06:00
yanyh2 5ab076b7d2 add PM7250B_SUBTYPE definition
Add the PM7250B_SUBTYPE definition in case Kernel qpnp-revid.h
does not define it in some platorms.

Change-Id: I7e32ff332dfb13ac0fc0387a42dc5ae596bf4d00
Signed-off-by: yanyh2 <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/1447619
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
2019-11-01 03:10:20 -05:00
yanyh2 f74a17a92a correct the charging state enumeration
There is no FAST_CHARGE_V5 for PMI632/PM8150B/PM7250B
so remove it from the definition.

Change-Id: I6b77ad9e947e6dec83059787e78b995c83e14d21
Signed-off-by: yanyh2 <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/1447603
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
2019-11-01 02:10:21 -05:00
yanyh2 868208ff28 support PM7250B
Add PMIC subtype PM7250B for battery charging
on SM7250 platform products.

Change-Id: I35d3c3a7aa7144b8ca3cd68dce4b75dce4b539e8
Signed-off-by: yanyh2 <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/1447558
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
Reviewed-by: Haijian Ma <mahj8@motorola.com>
2019-11-01 02:10:13 -05:00
yanyh2 fd106d73c0 add calibration_data node to laser sysfs
Add calibration_data node to laser sysfs:
/sys/devices/virtual/laser/stmvl53l1/calibration_data

Change-Id: I13b71671c81b3e0b9f0031e64866680f26161a12
Signed-off-by: yanyh2 <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/1420664
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
2019-09-14 00:20:54 -05:00
yanyh2 cf6288f94f stmvl53l1: support calibration data dynamic loading
In order to support run-time power management with dynamic
power on/off, it has to support calibration data loading after
power on TOF.
if not,xtalk calibration data will change after ranging
and override correct xtalk calib data

Change-Id: Ia67e3bb806ea8295bb7829888c201f22a0c0b59d
Signed-off-by: yanyh2 <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/1407816
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
(cherry picked from commit 799a22316b6c3b8809a448ff1fb37db9514db9ab)
Reviewed-on: https://gerrit.mot.com/1408713
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
2019-09-02 01:39:34 -05:00
yanyh2 ab22beed7e power: set charge done for battery supply
QG uses the battery supply charge done property for
capacity learning, but qcom battery may not be in
charge done state when mmi charger terminates the
charging as battery is full charged.
In that case, QG will not trigger the capacity learning
when it completes a full charge cycle.
As the FULL charge state is mantained by mmi charger, so
set the charge done state once mmi charger complete charging.

Change-Id: I574e6f3349949882bb38a759835cf85a67386fb5
Signed-off-by: yanyh2 <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/1396976
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Ryan Lattrel <ryanl@motorola.com>
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
2019-08-06 03:05:10 +00:00
Yonghua Yan 6944182738 power: only override USB ICL for high current
Unset the High Current mode if usb type is SDP or the target
icl lower is than 500mA.

If the High Current mode is set for SDP, the settled ICL may
be over the target icl value.

Change-Id: I05bb76d418c74b910eeed358e59e4b0fb3f33600
Signed-off-by: Yonghua Yan <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/1394159
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Reviewed-by: Haijian Ma <mahj8@motorola.com>
Submit-Approved: Jira Key
2019-08-01 03:54:39 +00:00
Yonghua Yan 7385bf598a power: override USB ICL
Override USB ICL using the targer ICL value, so that
the ICL settled value will not be limited to a lower
value than target value.
For example, when connect device using a CC floated
typec cable, the settled icl will be set to 100mA,
which will block the charging.

Change-Id: Icd2ea3e020437297642d790f4e1fa8ab25231504
Signed-off-by: Yonghua Yan <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/1393334
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Ryan Lattrel <ryanl@motorola.com>
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Reviewed-by: Haijian Ma <mahj8@motorola.com>
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
2019-07-30 08:25:58 +00:00