Base on Kernel built-in Moto PD controlling policy, pdo select depends
on PD voltage max, so the product should decide which USB PD voltage is
allowed, including the USB PD input power(Hardcode 18W in current code).
Different product design may require different USB PD voltage allowance
and USB PD input power max allowance.
Current Moto PD controlling policy only applies to FIXED pdo but not
programmable pdo(PPS), which requires periodic PD output power
acknowledgement(at least 10s interval). So it has to redesign current
Moto PD controlling policy to support PPS pdo selection.
In order to avoid any PD controlling policy conflict with third party
disable the PD controlling policy modification interfaces for user space
(may be used by hvdcp_opti daemon in Qcom platform).
Change-Id: I7565e187e2619252bc6d611b7f4aabc90b72c687
Signed-off-by: xuwt2 <xuwt2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1461008
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: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
Reviewed-on: https://gerrit.mot.com/1771065
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
add sdam-magic-number parameter to judge if using
the different battery profile. we need clear sdam when
using different battery profile.
Change-Id: I248edf52f767abbadb1934328b88f8048af4a782
Signed-off-by: mahj8 <mahj8@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1549720
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Lu Chai <chailu1@motorola.com>
Reviewed-by: Yonghua Yan <yanyh2@motorola.com>
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Submit-Approved: Jira Key
Reviewed-on: https://gerrit.mot.com/1553272
Reviewed-on: https://gerrit.mot.com/1771064
As icl override has been done in sdp icl setting, so
there is no need to set icl override again after sdp
icl settting.
The icl override for the second time will use HW_AUTO_MODE
so the HC mode in register 0x1366 will be enabled.
In that case, the USB ICL settled will exceed 500mA with SDP
APSD result if a non-standard USBA-C cable is attached.
When use this USB cable, the typec orientation cannot be detected
as it always shows 0, but typec mode can be detected.
pm7250b_charger: smblib_update_usb_type: APSD=SDP PD=0 QC3P5=0
pm7250b_charger: smblib_icl_change_work: icl_settled=2450000
Change-Id: I3dee9b17a296d1f3a7f57f78a0162ced02f71c7e
Signed-off-by: yanyh2 <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/1544008
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Reviewed-by: Haijian Ma <mahj8@motorola.com>
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
Reviewed-on: https://gerrit.mot.com/1771041
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Old ticket (CR)
MMI Factory mode needs to be followed so change base QCOM.
This patch is needed to ensure that from the time smb5
loads to the mmi DLKM loads there is no charging.
Only needed for Factory purposes.
Change-Id: I3011dbfc3382d382be2fb3c07c02597bfa953d77
Signed-off-by: Kenny Kessler <kenny.kessler@motorola.com>
Reviewed-on: https://gerrit.mot.com/1255092
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Kenneth Kessler <kennykessler@motorola.com>
Submit-Approved: Jira Key
Reviewed-on: https://gerrit.mot.com/1526255
Reviewed-by: Ling Jin <lingjin@motorola.com>
Reviewed-on: https://gerrit.mot.com/1771036
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
In current factory environment, after USB OTG test(USB pins will be reconnected),
the typec mode detection is prior to vbus detection sometimes, and the
typec mode will be DEFAULT.
Then after the first time of apsd, the apsd result and real_charger_type
become SDP.
As a workaround for APSD detection issue, there will be APSD rerun if
the first APSD is SDP.
If there comes a usb_source_change irq right after apsd rerun, the pd policy
will receive the usb power change event and check the typec mode,
and real_charger_type, finally, it starts the USB enumeration as
typec mode greater than DEFAULT and real_charger_type is SDP.
At that time, APSD rerun and USB enumeration may collide and make conflict,
which is the reason why the second APSD gets a wrong result(DCP/HVDCP2)
and USB connection gets lost.
In order to avoid this situation, reset the real_charger_type to unknown
when rerun apsd, so that the USB enumeration will not be triggered by
pd policy unexpectedly but by charger driver.
Change-Id: Ifdde0a847ef18518a204f67843e61c6b5a9e7401
Signed-off-by: yanyh2 <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/1523010
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/1771030
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
ICL is set to 1000ma when BC1.2 result is OCP charger
with med or high type-c rp current.
(think plus usb-c book charger pack)
So don't override USB icl when type-c rp current is med or high.
Change-Id: Id3f9daedfbcf905b99612ba1977b2c710a764cba
Signed-off-by: Haijian Ma <mahj8@motorola.com>
Reviewed-on: https://gerrit.mot.com/1465715
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Lu Chai <chailu1@motorola.com>
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Submit-Approved: Jira Key
Reviewed-by: Yonghua Yan <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/1503915
Reviewed-on: https://gerrit.mot.com/1770998
Sometimes, a charger may be detected as SDP after apsd for the first
it plugins, add rerun APSD to reduce the APSD failure for the first
time.
Set the initial USB ICL to 500mA in case USB controller never complete
enumeration to set the target ICL.
Change-Id: I60aedd478fe890f1c40a202e3b0df4e64658cMontana
Signed-off-by: yanyh2 <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/1420421
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Haijian Ma <mahj8@motorola.com>
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Submit-Approved: Jira Key
Reviewed-on: https://gerrit.mot.com/1502930
Reviewed-on: https://gerrit.mot.com/1770982
When use the CC pin floated USB cable to connect to
PC or charger, typec mode cannot be detected, so it
cannot use the typec removal when USB cable is removed.
Since this USB cable make the device function as micro
usb, so just call the micro usb removal.
Change-Id: I6cf9fbcffa1fe05bade64dfce9309977e782eba4
Signed-off-by: Yonghua Yan <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/1390306
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/1770289
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Limit the usb icl to 1000mA for OCP chargers(BELKIN 5V/1A)
to avoid sudden vbus loss when the current load over 1000mA.
Change-Id: Iad650afcb0263e861171223967d3ab5a688346c3
Signed-off-by: Yonghua Yan <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/1371196
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
Reviewed-on: https://gerrit.mot.com/1770268
Attach Turbo charger to a phone, its screen shows the messages:
"Charging", followed by "Slowly Charging" and then finally
"TurboPower connected". Display messages are confusing.
This is because the USB ICL takes a period time to get settled
down from low icl to the target icl.
So here just return the target ICL to avoid this situation.
Change-Id: I1a3e4641c31fde6b59cc017e01b26a6ea12c6d15
Signed-off-by: Yonghua Yan <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/1364059
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
Reviewed-on: https://gerrit.mot.com/1770261
Commit "update parallel algorithm for ICL change" breaks type-C
Analog Audio adapter detection at boot time. Avoid re-running
AICL at boot (when icl_ua is unitialized) and also minimize
the wait time for AICL to complete.
refer to https://gerrit.mot.com/994075
Change-Id: I7ce1d76a9e10684f478cfff36cd631ed4066143b
Signed-off-by: Haijian Ma <mahj8@motorola.com>
Reviewed-on: https://gerrit.mot.com/1270015
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Submit-Approved: Jira Key
Reviewed-on: https://gerrit.mot.com/1770260
When connect the device to the typec port of a PC with high
or medium source advertise, the USB ICL is overridden by USB
phy voter with 500mA.
But for non-legacy typec, the typec source advertise should be prior
to usb bc1.2. So add condition check when set the USB ICL vote from
USB driver, if there is high or mid typec source advertise, and just
skip the USB driver ICL voter.
Change-Id: I519cf1afec40857ca640727fee6cc11f262af492
Signed-off-by: Yonghua Yan <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/1355853
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
Reviewed-on: https://gerrit.mot.com/1770259
Huawai P10 5A cable is considered a debug accessory cable in sink mode, so
charging in such conditions needs to be configured by setting proper PMIC
registers.
Porter from: https://gerrit.mot.com/#/c/1447696/
Change-Id: I978911ae93436c8b073fa092548e13f673262bb9
Signed-off-by: Cesar Santos <cmsantos@motorola.com>
Reviewed-on: https://gerrit.mot.com/1463313
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Dong-Hua Yan <a18317@motorola.com>
Reviewed-by: Ling Jin <lingjin@motorola.com>
Submit-Approved: Jira Key
Reviewed-on: https://gerrit.mot.com/1770258
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
PD adapter allowance voltage was setted to FORCE_5V,
that cause PD can't charge under the vbus up to 9v
this issue is introduced by QCom Rebase.
use QCOM_BASE to isolate FORCE_5V setting in PD active
Change-Id: I73d925b87e657f62516d7d3ee475f4ef0306195d
Signed-off-by: xuwt2 <xuwt2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1460627
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Cesar Augusto Marcelino dos Santos <cmsantos@motorola.com>
Reviewed-by: Haijian Ma <mahj8@motorola.com>
Reviewed-by: Yonghua Yan <yanyh2@motorola.com>
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
Reviewed-on: https://gerrit.mot.com/1770256
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
In factory mode, mmi init input current 3A, so get ICL state is 3A.
so mmi get HW current is 3A with SDP.
HW current should base on charger type, don't base on
ICL state.
Change-Id: I3b0aab68392f863115721f96f3dd4788dc9e0df7
Signed-off-by: Haijian Ma <mahj8@motorola.com>
Reviewed-on: https://gerrit.mot.com/1419455
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Yonghua Yan <yanyh2@motorola.com>
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Submit-Approved: Jira Key
Reviewed-on: https://gerrit.mot.com/1770253
Current Moto PD controlling policy only applies to FIXED pdo but not
programmable pdo(PPS), which requires periodic PD output power
acknowledgement(at least 10s interval). So it has to redesign current
Moto PD controlling policy to support PPS pdo selection.
In order to avoid any PD controlling policy conflict with third party
disable the PD controlling policy modification interfaces for user space
(may be used by hvdcp_opti daemon in Qcom platform).
pdo selection is only available in sink power role, so just return
unsupported to tell the caller not try any more.
refer to https://gerrit.mot.com/1461360
Change-Id: I675a1f21e6547b1e4e8af01c5f4ebe4a89972c41
Signed-off-by: mahj8 <mahj8@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1770250
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Submit-Approved: Jira Key
The PDO selection should be done by either the Kernel or User Space.
Setup a callback that selects the PDO based on what the Voltage Max
is set to when the function is called.
refer to https://gerrit.mot.com/1403781
Based on Gerrit https://gerrit.mot.com/#/c/1301690/
Change-Id: I54a14b47e79637c681cc24c78a75a1206ecd903e
Signed-off-by: mahj8 <mahj8@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1770248
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Submit-Approved: Jira Key
The charger driver should directly call into the policy
engine and select the proper PDO. Otherwise the first PDO
is selected.
refer to https://gerrit.mot.com/1403773
Based on Gerrit https://gerrit.mot.com/#/c/1301691/
Change-Id: I73a2ef923393977e202aebc142d09c4301de4fbe
Signed-off-by: mahj8 <mahj8@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1770246
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Submit-Approved: Jira Key
Export some pmic-voter interfaces for dlkm usage as well
as create access functions that are exported for dlkm to
manipulate the struct.
Change-Id: I306c65c9890bd69dc49fcd722ac0981ddb908dc6
Signed-off-by: Kenny Kessler <kenny.kessler@motorola.com>
Reviewed-on: https://gerrit.mot.com/1200744
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>
Reviewed-by: Kenneth Kessler <kennykessler@motorola.com>
Submit-Approved: Jira Key
Reviewed-on: https://gerrit.mot.com/1770243
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Kernel configs compose of several parts.These parts will be merged into
one final file such as "holi-qgki-debug_defconfig".
The rule of Moto-product-config files from high order is:
product debug config
platform debug config,
product config
platform config
Here is an example of product "denver" based on 4350
platform (holi):
1. factory build config list with order:
factory-holi-denver.config
factory-holi.config
moto-holi-denver.config
moto-holi.config
2. userdebug build config list with order:
debug-holi-denver.config
debug-holi.config
moto-holi-denver.config
moto-holi.config
3. user version config list with order:
moto-holi-denver.config
moto-holi.config
Change-Id: Ie7512300581337ae6768bdfa618613a797f3c10f
Signed-off-by: weimh1 <weimh1@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1769363
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Submit-Approved: Jira Key
Introduce a new configuration DENVER_DTB that will allow the
target to only build denver devices.
Change-Id: I766404bb7792c217d37eecd3a543d866fc018fae
Reviewed-on: https://gerrit.mot.com/1762925
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Submit-Approved: Jira Key
Tested-by: Jira Key
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Introduce a new configuration MMI_DEVICE_DTBS that will allow the
target to only build Motorola devices.
Change-Id: I8eb2d1586dd2d99c696a3e198e5809a12cab6ad9
Reviewed-on: https://gerrit.mot.com/1762924
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Submit-Approved: Jira Key
Tested-by: Jira Key
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Currently, metadata such as min/max block size is sent only for first
stream in FLAC gapless playback. This causes incorrect configuration
and, subsequently, framedrops in decoding of second stream and onwards
by sending these additional flac metadata, dsp receives stream-wise
metadata and decodes without dropping
Change-Id: Ibd4a9b24180622422ed719b075fd47bcd4ad0c9b
Signed-off-by: Amit Shekhar <ashekhar@codeaurora.org>
Signed-off-by: Banajit Goswami <bgoswami@codeaurora.org>
Signed-off-by: Sudheer Papothi <spapothi@codeaurora.org>
Signed-off-by: Meng Wang <mwang@codeaurora.org>
(cherry picked from commit feb23f7f5d63d7b890ba481d0b466b6e9a5eed15)
Reviewed-on: https://gerrit.mot.com/1752137
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Submit-Approved: Jira Key
Tested-by: Jira Key
Reviewed-by: Lianlu Chen <chenll4@lenovo.com>
Add out of bound check while parsing the SPI
slave-to-master fifo.
Change-Id: I14f707307fa277b2f8a7b543d3cc5e9ebac885db
Signed-off-by: Ajit Kumar <quic_kajit@quicinc.com>
For cmd close_ack or open request where rx_size is being
incrementing with respect to offset might lead to out of
bound read from rx_data.
Decrease rx_size as we process commands.
Change-Id: I492eadcbebb78386fc20f744eb9ad8db4a2914fc
Signed-off-by: Kaushal Hooda <quic_khooda@quicinc.com>
If iommu unmap fails and leaves dma or anon buffers still mapped in the
iommu, do not free them.
Change-Id: Ice0e1a59c1ac0ee7a9d62d8899966b84fa63d5ca
Signed-off-by: Lynus Vaz <quic_lvaz@quicinc.com>
Signed-off-by: Deepak Kumar <quic_dkumar@quicinc.com>
(cherry picked from commit e7c4bb239b)
Add condition check to make sure that the end address
of private entry does not go out of partition.
Change-Id: I88b3c69d86d90905b214c13a8c632b134b487a49
Signed-off-by: Sarannya S <quic_sarannya@quicinc.com>
Signed-off-by: Pranav Mahesh Phansalkar <quic_pphansal@quicinc.com>
(cherry picked from commit 58e401790a)
Add condition check to make sure that the end address
of private entry does not go out of partition.
Change-Id: I88b3c69d86d90905b214c13a8c632b134b487a49
Signed-off-by: Sarannya S <quic_sarannya@quicinc.com>
Signed-off-by: Pranav Mahesh Phansalkar <quic_pphansal@quicinc.com>
If iommu unmap fails and leaves dma or anon buffers still mapped in the
iommu, do not free them.
Change-Id: Ice0e1a59c1ac0ee7a9d62d8899966b84fa63d5ca
Signed-off-by: Lynus Vaz <quic_lvaz@quicinc.com>
Signed-off-by: Deepak Kumar <quic_dkumar@quicinc.com>
Prevent possible integer overflow by sanitizing the alloc request
size coming from the client against allottable amount of memory.
Change-Id: I74cb0f7b0808f20299586969fd5c810d44c3e576
Signed-off-by: Manoj Prabhu B <quic_bmanoj@quicinc.com>
Signed-off-by: Madhab Sharma <quic_madhshar@quicinc.com>