Commit Graph
80 Commits
Author SHA1 Message Date
xuwt2 18023a822f qti_glink_charger: fix build err
fix build err
qti_glink_charger/qti_glink_charger.c:685:12: error:
no member named 'tx_ept' in 'struct wls_dump'
                wls_info.tx_ept);
                ~~~~~~~~ ^


Change-Id: Ib00c2047d776b2a0b90d94fcd5efcbd25ab4c757
Signed-off-by: xuwt2 <xuwt2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/2425752
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
2022-11-09 22:11:23 -06:00
xuwt2 4088749529 qti_glink_charger: Checking wireless TX_MODE
get tx_mode status by accessing qti_glink
notify tx_mode when it changed

Change-Id: I325c1982141f7095548857d39fc38b5d8e6f2a5f
Signed-off-by: xuwt2 <xuwt2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/2418046
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
2022-11-09 06:30:07 -06:00
xuwt2 3c9aa14a44 qti_glink_charger: Add wls tx capability
To be compatible with the next generation wireless charger
Add to support ask Tx Capability from wireless charger

Change-Id: Ib137027bfd5cbe9bbd6a9f44a44cfe67bbf06bf2
Signed-off-by: xuwt2 <xuwt2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/2392470
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
2022-10-18 22:09:21 -05:00
xuwt2 4cda3bbcf7 qti_glink_charger: Add some debug info
Add some debug info prints
WLC stand type/power/fan/light/status
rc_connected

Change-Id: I5795a8e8b87bc67a4ac7c38dc0528c970fc6e58f
Signed-off-by: xuwt2 <xuwt2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/2327419
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-10 02:35:11 -05:00
xuwt2 949e1838bc factory: Add tx_mode_vout for factory testing
Add factory testing
Read vout of Tx mode

Change-Id: If33a0f3885b2b12ec6ab344f86593e0158eb4d45
Signed-off-by: xuwt2 <xuwt2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/2284794
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Haichao Li <liuhc3@motorola.com>
Reviewed-by: Yonghua Yan <yanyh2@motorola.com>
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
2022-05-31 02:20:01 -05:00
xuwt2 e12bf299f8 qti_glink_charger: Add WLC func
1, Add sysnode wlc_light_ctrl/wlc_fan_speed
2, Add NOTIFY_EVENT_WLS_WLC_CHANGE

Change-Id: I52f0ef0e26a8813d8b31534c2e6254749c140738
Signed-off-by: xuwt2 <xuwt2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/2257842
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Reviewed-by: Yonghua Yan <yanyh2@motorola.com>
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Tested-by: Jira Key
Submit-Approved: Jira Key
2022-05-09 21:45:36 -05:00
xuwt2 3ce7c9833b qti_glink_charger: Update wireless dump info
Different project use different wireless chip,
Need to define new wireless dump info struct,
Add WIRELESS_CPS4035B macro definition.
Update new wireless dump info base on WIRELESS_CPS4035B

Change-Id: Iadb02771c420540c5ac119a9c32fe9adcbb25536
Signed-off-by: xuwt2 <xuwt2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/2248230
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Yonghua Yan <yanyh2@motorola.com>
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
2022-04-21 01:39:42 -05:00
xuwt2 150edacf11 smart_pen_charger: Update pen soc to ADSP
Update pen soc to ADSP through QTI_GLINK
To sync stylus soc between APP and ADSP

Change-Id: I2e5099bbdcb1bbcde5f9e697b908387e17eca2fe
Signed-off-by: xuwt2 <xuwt2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/2198929
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-27 00:50:20 -06:00
xuwt2 3eb5c1a999 qti_glink_charger: Add wireless dump info
1, Add debugfs wls_dump_info to dump wireless info
-------- wireless info -------
CHIP_ID: 0x4035
MTP_FW_VER: 0x10006
IRQ STATUS: 0x0000
SYS_MODE:  RX/TX 3
OP_MODE:  BPP/EPP 0x2
RX_FOP:   127kHz
RX_VOUT: 9989mV
RX_VRECT: 10430mV
RX_IRECT: 570mV
RX_NEG_POWER: 15w
TX_IIN: 0mA
TX_VIN: 0mV
TX_VRECT: 0mV
TX_FOD_I: 0
TX_FOD_II: 0
TX_FOD_RP: 0
TX_DET_RX_POWER: 0mW
TX_POWER: 0mW
POWER_LOSS: 0mW
TX_FOD: 0
FOLIO_MODE: 1
PEN_STATUS: 0
PEN_SOC: 0
PEN_ERROR: 0
USB_OTG: 0
WLS_BOOST: 0
WLS_ICL_MA: 1250
WLS_ICL_THERM_MA: 1250
2, Add wireless dump info to dmesg

Change-Id: Ie0a60052469e3d0c1b7bf643dbe1c389ce0c14a6
Signed-off-by: xuwt2 <xuwt2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/2168508
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Reviewed-by: Yonghua Yan <yanyh2@motorola.com>
Submit-Approved: Jira Key
2022-01-12 22:38:31 -06:00
xuwt2 343be32253 smart_pen_charger: Add power_supply_changed when receive PEN event
Trigger wireless power_supply_changed when receive PEN event.
To inform qti_glink_charger to dump pen status into dmesg.

Change-Id: I815e98830ae679d2d3e7959a06d438cdad932e15
Signed-off-by: xuwt2 <xuwt2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/2168501
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Yonghua Yan <yanyh2@motorola.com>
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
2022-01-12 22:38:29 -06:00
xuwt2 81a711a700 smart_pen_charger: Add PEN_STAT_CHARGE_DISABLED
Add new pen status : PEN_STAT_CHARGE_DISABLED
it means the pen charging was disabled.

Change-Id: I784d770f34b1bbe1e8e34bf785810e180924de6d
Signed-off-by: xuwt2 <xuwt2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/2151778
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-22 23:43:37 -06:00
xuwt2 c5b96b7810 qti_glink_charger: Add wls_notify_callback
Registe wireless_charger_notifier to listen wls_event
from ADSP through QTI_GLINK.
Add rx_connected notify callback

Change-Id: I96a8a4979a1f1943d0449dfcfcfeabb4a3f5d485
Signed-off-by: xuwt2 <xuwt2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/2137107
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Reviewed-by: Yonghua Yan <yanyh2@motorola.com>
Submit-Approved: Jira Key
2021-12-07 05:51:43 -06:00
xuwt2 3519c7bfa7 qti_glink_charger: Add folio_mode
For support moto folio accessory.
Enable folio mode when moto folio attached.
Add folio_mode to qti_glink_charger.

Change-Id: I98a81e1438c370c8762425765b978e4a9b5ac43b
Signed-off-by: xuwt2 <xuwt2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/2136258
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Reviewed-by: Yonghua Yan <yanyh2@motorola.com>
Submit-Approved: Jira Key
2021-12-07 05:50:31 -06:00
xuwt2 1002584fa4 qti_glink_charger: Add wls input current limit for thermal
Add wireless_input_current_limit sysfs node
for thermal mititagion
/sys/class/power_supply/wireless/device/wls_input_current_limit

Change-Id: Id16344fd882d35e6cae1da3647ee53300898b69d
Signed-off-by: xuwt2 <xuwt2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/2134720
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Yonghua Yan <yanyh2@motorola.com>
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
2021-12-07 05:47:35 -06:00
xuwt2 701b7cbb08 smart_pen_charger: Add pen_status and pen_error notify
Add sysfs_notify()
Report notify when pen_status and pen_error changed.

Change-Id: I45fda6a759b35f93c736f278054994fd23f5e89d
Signed-off-by: xuwt2 <xuwt2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/2111243
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Yonghua Yan <yanyh2@motorola.com>
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
2021-11-23 06:19:59 -06:00
xuwt2 b4fe951973 qti_glink_charger: Add tx_mode and rx_connected sysfs node
Add tx_mode and rx_connected
this is to support moto wireless powershared

Change-Id: Idb36fdfb10fa9cbe4015f6c4ecd1f6c6e74deb26
Signed-off-by: xuwt2 <xuwt2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/2111245
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Yonghua Yan <yanyh2@motorola.com>
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
2021-11-23 06:19:49 -06:00
xuwt2 accd702702 qpnp_adaptive: Change Makefile to compatible with Android S build
Change the build make file to be compatible with
Android S build.

Change-Id: I9faf66a92f1d4c4bb32b6069d9ed4b9e08f66392
Signed-off-by: xuwt2 <xuwt2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/2117635
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Yonghua Yan <yanyh2@motorola.com>
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
2021-11-18 00:18:47 -06:00
xuwt2 5a102c87cb wls-chrg: Add FOD_CURR and FOD_A/FOD_B settings API
FOD: Foreign Object Detect,
It is a port of Wireless RX tunning development.
provide thoes API for WPC certification.

Change-Id: I6694dc1fa2c841ac189a3057281f4779d0c08ed7
Signed-off-by: xuwt2 <xuwt2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/2091619
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-19 05:36:33 -05:00
xuwt2 18499521b5 qti_glink_charger: extend addr&data to UINT32
Read and Write up to 4 byte device's register
extend addr&data to UINT32

Change-Id: I08b0fea6b3abd3833515ba1a9827e29acf2dbb2c
Signed-off-by: xuwt2 <xuwt2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/2076903
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Yonghua Yan <yanyh2@motorola.com>
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
2021-09-26 22:16:27 -05:00
xuwt2 42766db15e qti_glink: Add sysfs node to get wireless chip id
From factory test requirement
Add sysfs node to get wireless chip id

Change-Id: Ic24b4ac33a2231f2f580917fcfa9ca0f9fd4e65e
Signed-off-by: xuwt2 <xuwt2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/2062214
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Yonghua Yan <yanyh2@motorola.com>
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
2021-09-09 01:38:51 -05:00
xuwt2 bd4c7cab96 qti_glink_charger: move WLS property types to the end
qti_glink_charger is moto common module, it is used by several
moto projects(berlin/yukon/rouge)
the new property type must be add to the end, otherwise it will
affect other projects.

Change-Id: Icaa0e121b3efdf11dbf712eb06011ad5941f6929
Signed-off-by: xuwt2 <xuwt2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/2061419
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Wei Xu <xuwei9@lenovo.com>
Reviewed-by: Tao Sun <suntao2@motorola.com>
Submit-Approved: Jira Key
2021-09-07 05:44:44 -05:00
xuwt2 6fc618d1a6 qti_glink_charger: Add sysfs node for factory wireless testing
1, USB_SUSPEND
2, WLS_EN
3, WLS_VOLT_MAX
4, WLS_CURR_MAX

Change-Id: I9d7f724657733cb158279cee175cf83af3813a70
Signed-off-by: xuwt2 <xuwt2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/2051640
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Yonghua Yan <yanyh2@motorola.com>
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
2021-08-27 02:41:51 -05:00
xuwt2 cd073b1eef qpnp_adaptive_charge: Add adap_reinit
In 8350/7325 platform, batt_psy needs to wait for
Glink module to complete,
therefore, the qpnp_adaptive_charger module init will faile
due to batt_psy not ready.
Add adap_reinit_work to rerun module init when it failed by
batt_psy not ready.

Change-Id: Ib73aa4dcbe9e069c36ec4Montana415601ab6991e795
Signed-off-by: xuwt2 <xuwt2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/2008716
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Tao Sun <suntao2@motorola.com>
Submit-Approved: Jira Key
2021-07-10 20:13:16 -05:00
xuwt2 e7b1662f5c qpnp-adaptive-charge: use mmi_charger to contrl battery charging
In QCOM 7350/8350, the kernel doesn't provide pmic-vote to control
battery charging.
the mmi_charger is an intermediate layer that forwards charging control
to ADSP Battmngr from the application layer.
By using USE_MMI_CHARGER macro definition that qpnp-adaptive-charge can be use
mmi_charger's func to control battery charging

Change-Id: I4da0604eabdadfc483143360ef7b7aad174cda47
Signed-off-by: xuwt2 <xuwt2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1983612
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Yonghua Yan <yanyh2@motorola.com>
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
2021-06-22 22:18:31 -05:00
xuwt2 c0f3607d09 qti_glink_charger: Add sys node to set pmic_icl
Add force_pmic_icl sysnode to set pmic input current limitation
echo xxx > force_pmic_icl
cat force_pmic_icl

Change-Id: Ic368b04c499fc270ebd3cbf8ce041cbabb3939fe
Signed-off-by: xuwt2 <xuwt2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1927039
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Yonghua Yan <yanyh2@motorola.com>
Reviewed-by: Tao Sun <suntao2@motorola.com>
Submit-Approved: Jira Key
2021-04-19 21:05:51 -05:00
xuwt2 5c5deaac86 qti_glink_charger: Add sys node to pass TCMD to ADSP
Add TCMD sys node to deliver message to ADSP by glink
For example:
echo 1 > tcmd /*force turn on master switchedcap*/
echo 2 > tcmd /*force turn off master switchedcap*/

Change-Id: I4a530148f234d8af7d5a4c9a9af21865602f9217
Signed-off-by: xuwt2 <xuwt2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1920513
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Yonghua Yan <yanyh2@motorola.com>
Reviewed-by: Tao Sun <suntao2@motorola.com>
Submit-Approved: Jira Key
2021-04-14 22:02:38 -05:00
xuwt2 03781cce37 mmi_parallel_charger: Add Turbo_30w power level
Add Turbo_30w power level, it is designed to display
"TurboPower 30 connected" on UI when a 27W moto charger
was connected.

Change-Id: I64a8760d0d3428df163b860a804e7cfbe1d8e446
Signed-off-by: xuwt2 <xuwt2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1649366
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Ryan Lattrel <ryanl@motorola.com>
Reviewed-by: Haijian Ma <mahj8@motorola.com>
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
Reviewed-on: https://gerrit.mot.com/1893607
Reviewed-by: Wei Xu <xuwei9@lenovo.com>
Reviewed-by: Xiangpo Zhao <zhaoxp3@motorola.com>
Reviewed-by: Wentao Xu <xuwt2@motorola.com>
2021-03-05 00:08:40 -06:00
xuwt2 580c631cfa mmi_parallel_charger: set charge_control_limit as writeable
set battery psy "charge_control_limit" sysfs as wirteable
to resolve below dac_override denial.

Denial:
W thermal-engine: type=1400 audit(0.0:11): avc: denied { dac_override } for capability=1 scontext=u:r:thermal-engine:s0 tcontext=u:r:thermal-engine:s0 tclass=capability permissive=0

Error:

E ThermalEngine: open/sys/class/power_supply/battery/charge_control_limit failed13
E ThermalEngine: Unable to init battery charging mitigation to 0

Change-Id: I593eda9bbeeb4853a2a4586dd7173fd04b4c54d6
Signed-off-by: xuwt2 <xuwt2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1483710
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Jichao Zou <zoujc@motorola.com>
Submit-Approved: Jira Key
Reviewed-on: https://gerrit.mot.com/1893602
Reviewed-by: Wei Xu <xuwei9@lenovo.com>
Reviewed-by: Xiangpo Zhao <zhaoxp3@motorola.com>
Reviewed-by: Wentao Xu <xuwt2@motorola.com>
2021-03-05 00:07:45 -06:00
xuwt2 20762a20ae mmi_parallel_charger: UI support for 45W charger
when User attaches a 45W charger, the UI : 45W Hyper charging
In kernel space, driver module report "Hyper" to user space
when the 45w charger adapter connected
and report "Super" to user space when the 27w charger connected
/sys/class/power_supply/battery/charger_rate

Change-Id: I54041e6289fcea3808c1270bc70f2022c8d840cf
Signed-off-by: xuwt2 <xuwt2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1450586
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
Reviewed-on: https://gerrit.mot.com/1893600
Reviewed-by: Xiangpo Zhao <zhaoxp3@motorola.com>
Reviewed-by: Wei Xu <xuwei9@lenovo.com>
2021-03-05 00:07:03 -06:00
xuwt2 85d8d39c9a fg: soc report 99% lasted for long time
In defender Project, there are two fuel gauge(bq27426, qpnp-qg),
sometimes, the soc 99% lasted for long time after recharging.
the battery status was NOT_CHARGING, because the current has been
terminated.
in that case, force it report 100%

Change-Id: I9b851ac7a7e3776730be386420ea974c15cbe321
Signed-off-by: xuwt2 <xuwt2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1443240
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Yonghua Yan <yanyh2@motorola.com>
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
Reviewed-on: https://gerrit.mot.com/1893598
Reviewed-by: Xiangpo Zhao <zhaoxp3@motorola.com>
Reviewed-by: Wei Xu <xuwei9@lenovo.com>
2021-03-05 00:05:41 -06:00
xuwt2 78b3acd186 mmi_pl_chg: Add mmi_cycle_count to calculate batt age
-1, Add mmi_cycle_count func to caculate battery cycle count
-2, enable battery psy charge_full and charge_full_design

Change-Id: Ib8f60b6c8eb5940b8ef0e87c2328fb230cdbbb65
Signed-off-by: xuwt2 <xuwt2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1442066
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Yonghua Yan <yanyh2@motorola.com>
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
Reviewed-on: https://gerrit.mot.com/1893587
Reviewed-by: Wei Xu <xuwei9@lenovo.com>
Reviewed-by: Xiangpo Zhao <zhaoxp3@motorola.com>
2021-03-05 00:04:29 -06:00
xuwt2 e8666a4ba9 mmi_parallel_charger: Add factory mode detect
Add factory mode detect
force stop charging under factory mode

Change-Id: I84437d385971a5f62f0f2314e77da5b82d2966fd
Signed-off-by: xuwt2 <xuwt2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1439687
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
Reviewed-on: https://gerrit.mot.com/1893585
Reviewed-by: Wei Xu <xuwei9@lenovo.com>
Reviewed-by: Xiangpo Zhao <zhaoxp3@motorola.com>
2021-03-05 00:03:52 -06:00
xuwt2 5fba839bb3 mmi_pl_chg: clear pmic limit after remove pd power
the pmic current would be limit when 45w pd charger connect,
and must clear the pmic limit setting after PD power removed.

Change-Id: I814e2825ca29c0975542bda0dcc72f6571ea437a
Signed-off-by: xuwt2 <xuwt2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1439744
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
Reviewed-on: https://gerrit.mot.com/1893582
Reviewed-by: Wei Xu <xuwei9@lenovo.com>
Reviewed-by: Xiangpo Zhao <zhaoxp3@motorola.com>
2021-03-05 00:03:48 -06:00
xuwt2 3ecaecfa2d mmi_parallel_charger: "battery" psy update PROP_STATUS
Under the parallel charging framework, the battery status should be
determined by all charging IC status, and not only from pmic charging

Change-Id: Idc85e8b96c1ff854f42f321e8e7b7a4c5ec55f6c
Signed-off-by: xuwt2 <xuwt2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1435998
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
Reviewed-on: https://gerrit.mot.com/1893580
Reviewed-by: Wei Xu <xuwei9@lenovo.com>
Reviewed-by: Xiangpo Zhao <zhaoxp3@motorola.com>
2021-03-05 00:03:44 -06:00
xuwt2 ebf219ff99 mmi_parallel_charger: optimize 45w charger policy
-1, define new variables, sys_therm_cooling, batt_therm_cooling
sys_therm_cooling: response the system thermal throttle request.
batt_therm_cooling: independent trigger battery thermal throttle
base on battery safty requirement.
-2, select the right pd power to request PD adapter,
PD target power = min(req pd power, sys therm cooling pd power,
	batt therm cooling pd power).
-3, define ignore_hysteresis_degc.
-4, take POWER_SUPPLY_PROP_CP_STATUS1 replace PROP_STATUS

Change-Id: I98ed508d2a4d07fa7c14fdaa2307e917fbbaccb1
Signed-off-by: xuwt2 <xuwt2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1435405
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
Reviewed-on: https://gerrit.mot.com/1893579
Reviewed-by: Xiangpo Zhao <zhaoxp3@motorola.com>
Reviewed-by: Wei Xu <xuwei9@lenovo.com>
2021-03-05 00:02:42 -06:00
xuwt2 d1022ebaa7 optimize the charging logic in thermal mitigation process
-1, clear thermal mitigation flag in SM_QUITE and SM_ENTRY
-2, recovery charger power after quiting thermal mitigation

Change-Id: I1e77f3e443ece14c9b309057d50d433b657e2e66
Signed-off-by: xuwt2 <xuwt2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1430164
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Tao Sun <suntao2@motorola.com>
Submit-Approved: Jira Key
Reviewed-on: https://gerrit.mot.com/1893578
Reviewed-by: Wei Xu <xuwei9@lenovo.com>
Reviewed-by: Xiangpo Zhao <zhaoxp3@motorola.com>
2021-03-05 00:02:04 -06:00
xuwt2 b7e7cdd449 Improve the PD charging performance in high temperature
-1, define a last chrg step flag.
-2, Disable charger pump IC at PM_STATE_ENTRY.
-3, Add second search cycle in mmi_find_chrg_step
-4, clear the batt_curr_roof and pd_constant_power_cnt
when switch the state machine work

Change-Id: I1156b8168c387ae2edf88052e9251302ef899ae1
Signed-off-by: xuwt2 <xuwt2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1429346
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
Reviewed-on: https://gerrit.mot.com/1893575
Reviewed-by: Xiangpo Zhao <zhaoxp3@motorola.com>
Reviewed-by: Wei Xu <xuwei9@lenovo.com>
2021-03-05 00:01:42 -06:00
xuwt2 5d94df71ba mmi_paralel_charger: Enhance the compatibility of PD charger
-1, Set the initial PD current to 2A.
-2, filter out the wrong PD request power for selecting PD charger.
-3, clear the pps result history after error pd result handing
-4, detect the pd constant power state, and avoid to excessive
boost vbus

Change-Id: I158a68c2907af42c07cd408ce162b528b3e39f10
Signed-off-by: xuwt2 <xuwt2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1428520
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
Reviewed-on: https://gerrit.mot.com/1893572
Reviewed-by: Wei Xu <xuwei9@lenovo.com>
Reviewed-by: Xiangpo Zhao <zhaoxp3@motorola.com>
2021-03-05 00:01:08 -06:00
xuwt2 c454984ac3 mmi_parallel_charger: enhance the stability of sm work
Under certain condition, the PD adapter would be instability,
and the sm work who responsible for the entire charging policy
might exited abnormally.
improve the synchronous processing.

Change-Id: I87bb51a4b69178f9eb40d6519328975203027c7e
Signed-off-by: xuwt2 <xuwt2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1427554
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Jichao Zou <zoujc@motorola.com>
Submit-Approved: Jira Key
Reviewed-on: https://gerrit.mot.com/1893556
Reviewed-by: Xiangpo Zhao <zhaoxp3@motorola.com>
Reviewed-by: Wei Xu <xuwei9@lenovo.com>
2021-03-05 00:00:39 -06:00
xuwt2 13aa1a1a19 mmi_pl_chrg: improve the chrg recovery handling
Redefine the charger device error type,
In some case, the output of PD adapter is not stable,
It would cause the UCP or OCP occurs on the bq2597x,
Add a recovery handling to response to this issue.

Change-Id: I9350df26252483b5c9010c9ef27d0364b59d57b2
Signed-off-by: xuwt2 <xuwt2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1427195
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Jichao Zou <zoujc@motorola.com>
Submit-Approved: Jira Key
Reviewed-on: https://gerrit.mot.com/1893555
Reviewed-by: Xiangpo Zhao <zhaoxp3@motorola.com>
Reviewed-by: Wei Xu <xuwei9@lenovo.com>
2021-03-05 00:00:01 -06:00
xuwt2 58a7053ddc mmi_chrg_manager: optimize thermal mitigation logic
-1, optimize thremal logic
-2, force pmic charging when the battery capacity is high(upper 90%)

Change-Id: Ic8b6a58decf4903b757c1554efe587100b69236e
Signed-off-by: xuwt2 <xuwt2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1413367
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
Reviewed-on: https://gerrit.mot.com/1893553
Reviewed-by: Xiangpo Zhao <zhaoxp3@motorola.com>
Reviewed-by: Wei Xu <xuwei9@lenovo.com>
2021-03-04 23:59:29 -06:00
xuwt2 7165391abb mmi_pl_chrg: create some sysfs node for setting mmi_params
factory_charge_upper
factory_image_mode
force_demo_mode
force_max_chrg_temp

Change-Id: I4e40acf9a628becMontana3ca70652659b0b0b459be1
Signed-off-by: xuwt2 <xuwt2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1408893
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Haijian Ma <mahj8@motorola.com>
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
Reviewed-on: https://gerrit.mot.com/1893551
Reviewed-by: Xiangpo Zhao <zhaoxp3@motorola.com>
Reviewed-by: Wei Xu <xuwei9@lenovo.com>
2021-03-04 23:59:04 -06:00
xuwt2 616e6682fb mmi_parallel_charger: optimize temp zone structure
-1, set temp_c as signed constant
-2, add conditional judgment to prevent invalid temp zone

Change-Id: I7ed0fe09034c5669f1538954ebf871e1ed7cf0e7
Signed-off-by: xuwt2 <xuwt2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1408609
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
Reviewed-on: https://gerrit.mot.com/1893549
Reviewed-by: Xiangpo Zhao <zhaoxp3@motorola.com>
Reviewed-by: Wei Xu <xuwei9@lenovo.com>
2021-03-04 23:58:12 -06:00
xuwt2 6db973a7a7 mmi_parallel_charger: Optimize 40w charging logc, 1.0
-1, change the 40w charger cooling policy
-2, change the 40w charger thermal mitigaion policy

Change-Id: I248e5b01c748e5791d28dec48eede859e571e931
Signed-off-by: xuwt2 <xuwt2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1404488
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Guobin Zhang <zhanggb@motorola.com>
Submit-Approved: Jira Key
Reviewed-on: https://gerrit.mot.com/1893548
Reviewed-by: Wei Xu <xuwei9@lenovo.com>
Reviewed-by: Xiangpo Zhao <zhaoxp3@motorola.com>
2021-03-04 23:57:38 -06:00
xuwt2 f6112d2bf5 mmi_parallel_charger: Optimize 40w charging policy
-1, Add chrg ucp and ocp detection
-2, Add chrg_policy_error_recovery policy
-3, Add chrg_dev_init
-4, change charger thermal cooling policy,
remove THERMAL_COOLING chrg step, add thermal cooling process
into CC loop and CV loop, that to avoid miss chrg step in cooling

Change-Id: I57d66af338505c5ff9fd711de8b650afdb4a4027
Signed-off-by: xuwt2 <xuwt2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1389618
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
Reviewed-on: https://gerrit.mot.com/1893545
Reviewed-by: Xiangpo Zhao <zhaoxp3@motorola.com>
Reviewed-by: Wei Xu <xuwei9@lenovo.com>
2021-03-04 23:56:58 -06:00
xuwt2 1beb503a64 mmi_parallel_charger: Create Heartbeat work
Create Heartbeat work to listern battery && charger status
-1, check charger rate
-2, add mmi_power_supply_changed to report status
-3, register alarm to wake up heartbeat
-4, register pm suspend and resume

Change-Id: Ic4b4d95453fa9e4a2adeaaac48b0705e8726e3e4
Signed-off-by: xuwt2 <xuwt2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1385370
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
Reviewed-on: https://gerrit.mot.com/1893544
Reviewed-by: Wei Xu <xuwei9@lenovo.com>
Reviewed-by: Xiangpo Zhao <zhaoxp3@motorola.com>
2021-03-04 23:56:30 -06:00
xuwt2 c2876dcf3a DLKM: mmi_parallel_charger
upload the code of mmi_parallel_charger
this is the original release

Change-Id: Iae012a72e3c2c177d48154b9215eda54ab6b70a6
Signed-off-by: xuwt2 <xuwt2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1378406
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
Reviewed-on: https://gerrit.mot.com/1893536
Reviewed-by: Wei Xu <xuwei9@lenovo.com>
Reviewed-by: Xiangpo Zhao <zhaoxp3@motorola.com>
2021-03-04 23:55:52 -06:00
xuwt2 b3ca118609 qpnp-smbcharger-mmi: Add PD charging in DLKM
PD3.0 with PPS is a Mandatory requirement from VZW,
Add PD charging(include PPS/Fixed) policy in DLKM for single
charge path(only pmic charging)

Change-Id: Ic0f2fcf45f00dea214602846bdbe43b56805a114
Signed-off-by: xuwt2 <xuwt2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1847093
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Haijian Ma <mahj8@motorola.com>
Reviewed-by: Yonghua Yan <yanyh2@motorola.com>
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Submit-Approved: Jira Key
2021-01-13 01:58:08 -06:00
xuwt2 da72e45eb2 qpnp-smbcharger-mmi: Add charge_full_design in battery psy
Add charge_full_design property to sysfs and uevent of battery power
supply so as to support access by userspace.

Change-Id: I672e3f7bd5cbfbfce87fd8338f94fa5043c082e0
Signed-off-by: xuwt2 <xuwt2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1829543
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Yonghua Yan <yanyh2@motorola.com>
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
2020-12-17 03:28:37 -06:00
xuwt2 e3a1842549 the battery should be charged in taper-charger until iterm
the battery charge is considered complete when the charge current
reaches the iterm value, but before that it should be charged in
taper-charger until current actually reaches iterm.
However, https://gerrit.mot.com/#/c/1731691/ from smith changed
mmi_has_current_tapered() which use to confirm whether to reach iterm
that cause the battery charging was cut-off immediately after the SOC
was reporting 100%

Change-Id: I3f2b8134624ceca471c4cd5eecfd817002c4e865
Signed-off-by: xuwt2 <xuwt2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1761003
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Lu Chai <chailu1@motorola.com>
Reviewed-by: Haijian Ma <mahj8@motorola.com>
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
2020-09-27 05:26:35 -05:00
xuwt2 1bf5c78fff qpnp-smbcharger-mmi: Offer hvdcp_power_max setting by sysfs
To proivde a sysfs node to reset hvdcp_power_max setting,
and rerun HVDCP process after that

Change-Id: I497a22d3e6974f27396595f894d868b55f4a80f0
Signed-off-by: xuwt2 <xuwt2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1686918
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Haijian Ma <mahj8@motorola.com>
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Submit-Approved: Jira Key
2020-07-20 02:25:34 -05:00
xuwt2 977fe15282 mmi_sys_temp: Add thermal sensors monitor work
CRs: (CR), Add a thermal sensors temperature monitor policy
it can listen to the specified thermal sensors and
report their temperature when the power supply was changed

NO_PROP_NEEDED: if needed.

Change-Id: I09ff63c12c9723a00b992018cc2d693d143bd26e
Signed-off-by: xuwt2 <xuwt2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1424608
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Submit-Approved: Jira Key
Reviewed-on: https://gerrit.mot.com/1606687
Reviewed-by: Jichao Zou <zoujc@motorola.com>
Reviewed-by: Wentao Xu <xuwt2@motorola.com>
2020-06-08 03:26:41 -05:00
xuwt2 ea3b1a99b2 modules: power: Add a long heartbeat delay for discharging
when the batttery is discharging, if the hearbeat work schedule time is
too short, and work frequently will lead to power consumption problems.

Change-Id: Id9120295ee1452b14e790d6bc5876fd5fd94c6c2
Signed-off-by: xuwt2 <xuwt2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1504442
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Wentao Xu <xuwt2@motorola.com>
Reviewed-by: Yonghua Yan <yanyh2@motorola.com>
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
2020-03-01 22:22:17 -06:00
xuwt2 34ee4922f1 p938x_charger: change tm mode address
-1, tx_mode_reg address is 0x69,
the value of enable is 3, and disable is 0
-2, add TX_RM_POWER_TOGGLE setting in tx_mode
the tx mode will shut itself down whenever OVP or OCP excetion occrs
-3, change SYS_CMD_REG to 0x4e

Change-Id: I15e94cc4f944ef94f60b87c3de1415b397e768ed
Signed-off-by: xuwt2 <xuwt2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1480220
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Ryan Lattrel <ryanl@motorola.com>
Reviewed-by: Ling Jin <lingjin@motorola.com>
Submit-Approved: Jira Key
2020-01-15 15:15:37 -06:00
xuwt2 0329269ee2 p938x_charger: change the length of memcpy in fod_store
change the length of memcpy in fod_store

Change-Id: Ibdcedf3ae2afd1e12548a1916e69a49f67de9977
Signed-off-by: xuwt2 <xuwt2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1479581
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Ling Jin <lingjin@motorola.com>
Submit-Approved: Jira Key
2020-01-15 15:15:32 -06:00
xuwt2 6b6a1d0b9c MMI: Add DC psy notifier
The tree modules(p938x, smbcharger-mmi, qpnp-smb5) work
togegher to handle the logic of wireless charging.
In smbcharger-mmi, MMI_HB_VOLTER will hold dc suspend until
heartbeat work detect DC present,
In qpnp-smb5, dcin-plugin irq handle DC present status.
they are all triggered asynchronously in parallel,
and the DC present is always active after p938x VOUT_ON has been set
for a while.
And yet, at this point, smbcharger-mmi's heartbeat work has been
triggered by wireless psy change when p938x is VOUT_ON.
This leads to MMI_HB_VOLTER hold dc suspend in a minute to wait
heartbeat schedule again by itself

Change-Id: Idc8b62fa47975daeba3f0875d7715771fa8141a8
Signed-off-by: xuwt2 <xuwt2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1479568
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Ryan Lattrel <ryanl@motorola.com>
Reviewed-by: Ling Jin <lingjin@motorola.com>
Submit-Approved: Jira Key
2020-01-15 15:15:27 -06:00
xuwt2 5d98b519fb power: correct the registers address for pm660
Two function registers address form PM660 are different
with other PMICs:
PM660:
1341: USB_CMD_ICL_OVERRIDE
160B: POWER_PATH_STATUS_REGS

Other PMICs:
1342: USB_CMD_ICL_OVERRIDE
110B: POWER_PATH_STATUS_REGS

Change-Id: If1c2bcacf498281bf1b4156b65021e9b83c44041
Signed-off-by: xuwt2 <xuwt2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1426165
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Yonghua Yan <yanyh2@motorola.com>
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
2019-09-23 05:51:31 -05:00
xuwt2 0199f360d0 haptics: awinic: add haptic context while flat-up
-1, add haptic context whild flat-up reduce the gain of vibration
-2, disable this feature when the bootmode is factory

Change-Id: I75a871cf94af54f375a42be54ddcd1d380972797
Signed-off-by: yangjq <yangjq@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1374681
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
2019-06-21 07:27:30 -05:00
xuwt2 3346c4b7f7 mmi_pl_chg_manager: optimize charging policy in CC stage
In the constant current charging stage, we made a power compensation
strategy to improve the charging efficiency.
this patch is for optimize the power compensation strategy, so that
it can avoid the disturbance of thermal mitigation policy.
and it can help improve the accuracy of the battery fuel gauge

Change-Id: I404f63da75c93ca409b6bb5c7d581f62ba415f6c
Signed-off-by: xuwt2 <xuwt2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1336218
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
2019-04-12 05:14:35 -05:00
xuwt2 dfe97e9f53 power: improve debug prints
improve debug prints
change some error words

Change-Id: I85b4856c72c0cc3f93eafbd926a6ad4f25000121
Signed-off-by: xuwt2 <xuwt2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1286760
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Yonghua Yan <yanyh2@motorola.com>
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
2018-12-25 21:52:34 -06:00
xuwt2 74b456f42e power: improve error handling policy
-1, define PD reponds result
enum mmi_pd_pps_result {
	NO_ERROR,
	BLANCE_POWER,
	RESET_POWER,
};
if the result is RESET_POWER, that reset state machine
for recovery abnormal.
-2, ignore thermal mitigation when the pps power was tuning.

Change-Id: I6c7e9defa46818baad0b87c2f8362abd3a8ddd88
Signed-off-by: xuwt2 <xuwt2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1286752
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Yonghua Yan <yanyh2@motorola.com>
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
2018-12-25 21:52:30 -06:00
xuwt2 a9f24ec5ad haptics: awinic: add haptic context while flat-up
-1, add haptic context whild flat-up reduce the gain of vibration
-2, disable this feature when the bootmode is factory

Change-Id: I7c99cc9ffe257020176e51dd72f16da852315d36
Signed-off-by: xuwt2 <xuwt2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1263466
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Jialei Hao <haojl2@motorola.com>
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
2018-11-05 02:52:08 -06:00
xuwt2 1d6836e78e bq2597_mmi: replace PROP_STATUS with CHARGE_NOW_ERROR
the POWER_SUPPLY_PROP_STATUS only express charge status,
such as charging,discharging,not charging. and cannot be express
as Charge IC ERROR status.
use the POWER_SUPPLY_PROP_CHARGE_NOW_ERROE to express it

Change-Id: I319e41e903da33f1b052c3b856a0852c3b44c029
Signed-off-by: xuwt2 <xuwt2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1263621
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Yonghua Yan <yanyh2@motorola.com>
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
2018-11-01 22:16:14 -05:00
xuwt2 d537117733 mmi_pl_chg: replace PROP_STATUS with CHARGE_NOW_ERROR
In the bq2597x_mmi drive, the PROP_STATUS was replace with
CHARGE_NOW_ERROR, and the mmi_pl_chg_manager also replace it

Change-Id: Id9cdf2991f54717e2c4ed079b952b633d09efe46
Signed-off-by: xuwt2 <xuwt2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1263623
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Yonghua Yan <yanyh2@motorola.com>
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
2018-11-01 22:16:04 -05:00
xuwt2 c0f0e1e1ca power: bq2597x: free irq and gpio resource when rmmod
-1,free irq resource when remove this module
-2,free gpio resoure when remove this module
-3,free regulator resource when remove this module

Change-Id: I38b2e86498eb3c5d4fb68cbed5d057b2637a599c
Signed-off-by: xuwt2 <xuwt2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1254130
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
2018-10-12 03:58:22 -05:00
xuwt2 a6a71c1ebd mmi_pl_manager: support dynamic balance power with pps
-1, use circle array to record pps result for detecting some unstable
chargers.
-2, use the software algorithm to dynamic balance pps charger power.
once this charger can't balance power by itself

Change-Id: Ic30125ab6601b26d9da05617e9b0bbd81a02538f
Signed-off-by: xuwt2 <xuwt2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1254186
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
2018-10-12 03:58:11 -05:00
xuwt2 50429d1e4c mmi_pl_chg_manager: support charging limit under factory sw
Factory SW support to disable battery charging once the capacity larger
than 75%, and re-enable charging when the capacity lower than 60%.
the mmi_pl_chg_manager is the manager of parallel charging,
when the main charging path was disable by factory sw policy,
and the slave charging path was also to be disable.

Change-Id: If3b5b978aa47900e11a3abc15ffcfefd1a5dec20
Signed-off-by: xuwt2 <xuwt2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1254012
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
2018-10-11 04:18:38 -05:00
xuwt2 9a7380886d power: mmi_pl_chg_manager: uninstall driver module
change the remove func of mmi_pl_chg_manager that fixed the panic
issue when uninstall mmi_pl_chg_manager driver

Change-Id: Ifbac5fadfef8e6e6dbdf4e11a892c27ac7b4cc71
Signed-off-by: xuwt2 <xuwt2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1245080
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Master Yoda
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
2018-09-21 03:29:09 -05:00
xuwt2 1b715bf4bc power: adjust 27w charge polisy, optimize charging curve
Add new flag enter_sw_loop to ensure enter switch charge loop after
quit bq2597x charging.
To prevent unstable switch between the parallel charging and pmic
charging.

Change-Id: I24e7ea365eb2a2f3b30eaeab351f0282c544adb8
Signed-off-by: xuwt2 <xuwt2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1244541
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Master Yoda
Reviewed-by: Yonghua Yan <yanyh2@motorola.com>
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
2018-09-20 04:34:22 -05:00
xuwt2 5fae1f06aa power: adjust 27w charge policy, optimize charge performance
-1, For the float voltage, add compensation voltage.
-2, add compensation current during the supper charging step.

Change-Id: I78079231e0b9fcb3079de2cc39406eb22ff8e2ce
Signed-off-by: xuwt2 <xuwt2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1239054
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Yonghua Yan <yanyh2@motorola.com>
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
2018-09-07 02:17:41 -05:00
xuwt2 d1f48b738a power: adjust 27w charge policy, optimize charge performance
-1,add force_pmic_chg judgement lable in order to avoid recovery
   paralle charge when the thermal zone was changed

Change-Id: I2e1a9fe3ae564b6a58957c4e5eb5f640e234d737
Signed-off-by: xuwt2 <xuwt2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1230716
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Yonghua Yan <yanyh2@motorola.com>
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
2018-08-21 03:30:32 -05:00
xuwt2 b1232dce25 power: adjust 27w charge policy and parameters
-1, add force pmic chg functions.
-2, change the thermal policy, force to only pmic chg
    when the thermal level equal the max level.
-3, change the debug print level, only print MOTO_INTERRUPT

Change-Id: I2fb37bbdb9bbd32866e5a7e7af773dfea72f5e99
Signed-off-by: xuwt2 <xuwt2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1229055
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Yonghua Yan <yanyh2@motorola.com>
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
2018-08-17 05:06:16 -05:00
xuwt2 46f0c31d73 power: adjust 27w charge policy and parameters
-1, ESR pulse cycle adjust to 60s
-2, ESR pulse remain 5s each cycle
-3, both pps voltage and pps current reduce to generate ESR pulse
    during in the CV state

Change-Id: I67c704581312081c314dc3aa6e8c9a0a985fcf2d
Signed-off-by: xuwt2 <xuwt2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1222901
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Yonghua Yan <yanyh2@motorola.com>
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
2018-08-13 21:44:24 -05:00
xuwt2 07dda2d475 power: change bq2597x ucp threshold from 500mA to 300mA
change bq2597x ucp threshold from 500mA to 300mA

Change-Id: Iad315858b3d7f88a3aacee69560b3cd00f98b9b2
Signed-off-by: xuwt2 <xuwt2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1217350
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
2018-08-02 05:02:09 -05:00
xuwt2 bd367b5599 power: adjust 27w charge policy,optimize charge performance
adjust 27w charge policy, optimize charge performance

Change-Id: I8578bd63a43b7b88b404c00b1d3a202857d427dd
Signed-off-by: xuwt2 <xuwt2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1215894
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Yonghua Yan <yanyh2@motorola.com>
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
2018-08-02 05:02:01 -05:00
xuwt2 b47aa43bd7 power/driver: support thermal mitigation during charging
-1,create mmi-pl-chg power supply instance
-2,add thermal mitigation interface

Change-Id: I884dd4fe7094b8c401f1c978d042763bffd7b230
Signed-off-by: xuwt2 <xuwt2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1210446
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Yonghua Yan <yanyh2@motorola.com>
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
2018-07-25 07:34:20 -05:00
xuwt2 424f60c2ac power: disable bq2597x_mmi ADC during shutdown
Disable bq2597x_mmi ADC function during the phone shutdown

Change-Id: Icfa828624296979daca6dc810f9230ade1cac600
Signed-off-by: xuwt2 <xuwt2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1212343
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
2018-07-19 04:15:41 -05:00
xuwt2 ce6de67522 Add a macro for copying drive.ko to vendor/lib/modules
In order to ensure that dynamic drive.ko can be output
/vendor/lib/modules, define a new macro DLKM_INSTALL_TO_VENDOR_OUT

Change-Id: I0aad283865f5831e577c388a214174db645ed63e
Signed-off-by: xuwt2 <xuwt2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1204366
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
2018-07-05 01:02:27 -05:00
xuwt2 d87e797026 power/driver: upload mmi parallel charge manager driver
upload mmi parallel charge manager driver

Change-Id: Id34950931f75430c8d13bbdb66f1310c0f0994a1
Signed-off-by: xuwt2 <xuwt2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1197169
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Yonghua Yan <yanyh2@motorola.com>
Reviewed-by: Kenneth Kessler <kennykessler@motorola.com>
Submit-Approved: Jira Key
Reviewed-on: https://gerrit.mot.com/1202300
Reviewed-by: Ling Jin <lingjin@motorola.com>
2018-06-30 13:01:54 -05:00
xuwt2 4e5372dc1e power/driver: add bq2597x_mmi driver
Add Ti bq2597x_mmi driver

Change-Id: I3c7b42f4b478eb022b228a2be6c12c17ea831646
Signed-off-by: xuwt2 <xuwt2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1197165
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Yonghua Yan <yanyh2@motorola.com>
Reviewed-by: Kenneth Kessler <kennykessler@motorola.com>
Submit-Approved: Jira Key
Reviewed-on: https://gerrit.mot.com/1202298
Reviewed-by: Ling Jin <lingjin@motorola.com>
2018-06-30 12:45:35 -05:00