Heartbeat work in charger driver will work every 100s when no charging.
It will cost some power.
But when discharging, we do not need to pay attention to charging
function, we just need soc changing.
And for our test in genevn, fg driver will send a notification when soc
changed. So we could increase the period of heartbeat wor
Change-Id: I9f9dcda52f42bbb53bcff61820e1df9ab07e4f15
Reviewed-on: https://gerrit.mot.com/2417652
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Yonghua Yan <yanyh2@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
As HW requirement, 50W dock fan speed should be 4000 r/s. Or
there will be some problem for noisy or structure stability.
Change-Id: Ifd686225940fd37e313f5a7eeb2912c4d35768d5
Reviewed-on: https://gerrit.mot.com/2376077
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Wei Wei <weiweij@motorola.com>
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Submit-Approved: Jira Key
The feature of Moto 50w dock requests some file points from wlc driver,
so we should impleamnt them.
Change-Id: I265756f9dd2c4ab06b8114641513c1013b42dd54
Reviewed-on: https://gerrit.mot.com/2355232
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Submit-Approved: Jira Key
When WLC(wireless charge pad) is offline, cps4019 could not
accessed by i2c bus. And we should return the value of 0
to indicate the status of offline. For healthd judgement logic,
it will just distiguish the valud of 0(offline) and non-zero(online).
So it will regards -1 as non-zero(online). As a result, we should
not return non-zero value for psy properties.
Change-Id: I4724d1b4a2d2d607b07fa3b52475e707da55fecf
Reviewed-on: https://gerrit.mot.com/2337171
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Submit-Approved: Jira Key
For some charge pad, we need to get the result of iout
from cps4019 to judge its working status. So ibat could
not work in this scene. So we should change the current
result form ibat to iout.
Change-Id: Ie31b1308ecd59507208ad4ec9038e6e950bfef76
Reviewed-on: https://gerrit.mot.com/2330599
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Submit-Approved: Jira Key
If vbus is absent, CPS4019 could not be accessed duel to loss of power.
So before power supply read operations, we should check vbus status.
If it is not exist, we should not access CPS4019.
Change-Id: I32bcdec8dd7aa9829a727ffb0205adaa04e185ba
Reviewed-on: https://gerrit.mot.com/2334726
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Submit-Approved: Jira Key
For some authen tests, charging parameters may need to be changed
as requirement. And for original designation, these ops interfaces only
work in factory mode. So we need to export them in normal mode.
Change-Id: I4ed54474fb6f8e0a164231d8919bc0f385954bd5
Reviewed-on: https://gerrit.mot.com/2299683
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Submit-Approved: Jira Key
For some reasons, WLC authen test may upgrade FW without
fw version changed. So we add force flag for fw upgrade interface,
to let it could be applied in authen test.
Change-Id: I964984b4dd81e750e17ac23bfe0a5e9cf70a109f
Reviewed-on: https://gerrit.mot.com/2296260
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Submit-Approved: Jira Key
For 2nd charger IC(SC89890H), we found that it will take about
100ms to boost voltage. So we have to increase delay time to
wait boost voltage stable.
Change-Id: Icae4af50141188dfb89fefb5d1f1c0c75ae454ee
Reviewed-on: https://gerrit.mot.com/2283852
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
For the file pointer of psy/wireless/voltage_now, it should be the result
of VOUT value. If we use the result of vbus(from usb/voltage_now), it
could not distinguish between the result from charger out and the one
from wireless out. Meanwhile, the required voltage unit is 0.1mV. So
we should make the result by 10.
Change-Id: Ibf6e657da8bd594985c64cf2aabe004b153e78ea
Reviewed-on: https://gerrit.mot.com/2278185
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Submit-Approved: Jira Key
When the chip is blank, the value in ver&id register wiil
be a random value. So we could not judge fw status just
by version. We should also check chip id register. And to
avoid user version fw missing problem, I will check fw
not only in factory mode.
Change-Id: I51269a4489062ebc23beee362aac987bc9da8f49
Reviewed-on: https://gerrit.mot.com/2274673
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Tested-by: Jira Key
Submit-Approved: Jira Key
For cps4019, when there is no fw in chip(blank chip), its version
may be 0xB4B5.0xB6B7. It is larger than normal version number
(for example, 1.2). So fw update judgement should consider this
situation.
Change-Id: I033ab39837f85fab9d1d1e1694d0b3fb972a375d
Reviewed-on: https://gerrit.mot.com/2274466
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Submit-Approved: Jira Key
For wls power off charging, main charger driver will start before
wls charger driver. As a rsult, it could not get wls present status
at the beginning of power off charging. So we should check
wls presentation before USB ICL voting. And set ICL as defined.
Change-Id: Ibc846d907ce2deb85aeb787fcdd7427dd8ebc2e6
Reviewed-on: https://gerrit.mot.com/2272083
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Reviewed-by: Haijian Ma <mahj8@motorola.com>
Tested-by: Jira Key
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Submit-Approved: Jira Key
When battery so is 100, the led in charging pad should be changed
from blue to green. It depends on PPP command transmission. The
command is as following:
head -> 0x5
cmd -> 0x64
data -> null
And it gets the event from "battery"(could be changed in dts configuration)
power supply notification by register power supply "supplied-from" element.
Change-Id: If7978d97a6bdae51acbdcf7342719ab2facce6a8
Reviewed-on: https://gerrit.mot.com/2266476
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Submit-Approved: Jira Key
For original code from vender, some registers' address value
are incorrect. We should fix them as data sheet.
Change-Id: I52f68cd549b8b5bfa08f29168e7a99bb3d25fd4a
Reviewed-on: https://gerrit.mot.com/2265882
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
Adding tcmd test interface, and meanwhile, adjusting some
file point name as tcmd requirement.
Change-Id: I0b1460545288f320a5b5ecfd430f1ca6f38a0845
Reviewed-on: https://gerrit.mot.com/2264522
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Submit-Approved: Jira Key
For healthd's charge type judgment logic, we should set USB/online
as false when wireless charger connected. And set DC/WIRELESS type
as "wireless" at the same time.
Change-Id: I5397224e7432802891706b3b7facf79cb749cbd7
Reviewed-on: https://gerrit.mot.com/2263683
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Submit-Approved: Jira Key
For CQA test requirement, the name of the file point chip id
should be chip_id. And its result should be "0xXXXX". So we
will change this file point as requests.
Change-Id: Ic37fa0645c64a766960f0799e7aad7f469121491
Reviewed-on: https://gerrit.mot.com/2263347
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Submit-Approved: Jira Key
Add a file point interface to let tcmd could force wls
chg when usb&wls connected at the same time.
Change-Id: I545cc4d7ac8ffa562596ed85706b62fcacc718dd
Reviewed-on: https://gerrit.mot.com/2263182
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Submit-Approved: Jira Key
For special factory test, USB DP/DM may should not be
operated when VBUS status changed. So we will add
DP/DM operation ignore options in power supply property.
Change-Id: I226c02cf126ecae9308804334c1bdbfb933d7bac
Reviewed-on: https://gerrit.mot.com/2263246
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Submit-Approved: Jira Key
For original code from vender, some registers are defined
incorrectly. We should fix them as CPS4019's data sheet.
Change-Id: I2e5004a0578cbcd92ee046cea7e8d1af6e6900f3
Reviewed-on: https://gerrit.mot.com/2262811
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Submit-Approved: Jira Key
For cps4019 driver will call the fucntions in mmi_discrete_charger,
so we should add the relatvie dependence.
Change-Id: I8dc350da427ca076c2be3feaa1e7390fd557edbf
Reviewed-on: https://gerrit.mot.com/2258487
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Submit-Approved: Jira Key
Adding discrete charger symbol, to let wls4019 driver
could use interfaces in charger class. And the name of
main_charger is configured in dts file.
Change-Id: Ic74d77f6645c0b166feaafb3ee354b7d12323ccc
Reviewed-on: https://gerrit.mot.com/2255421
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Submit-Approved: Jira Key
For original usage, function check_chip_id is used to decide
whether FW need to be upgraded. But we have change it by
FW version checking. So this function will not used any more.
We should remove it.
Change-Id: Idbf875a8491f8321755c56f9b8cc5f2310409214
Reviewed-on: https://gerrit.mot.com/2255040
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Submit-Approved: Jira Key
In normal use, we may need to update FW to fix some
chip bugs. So we need to add fw check logic to decide
if the FW should be updated. And the latest FW version
is defined in dts file.
Change-Id: I4642dcd311b2fe6dc85c316efd88fa50d50e6a76
Reviewed-on: https://gerrit.mot.com/2254034
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
When wls charger connected, charger core will get charger type
from "online" property of wls. And set relative charging current
as dts configuration "mmi,wls-max-icl-ua".
Change-Id: Ie20fd2fb44a4dda15fc5d94e227a5a29a0eed6b2
Reviewed-on: https://gerrit.mot.com/2250276
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
Add status judgment for register reading, If register reading return an
error, we should regard it as status "false".
Change-Id: I6072ac01dcf531256e036bdc9814e0c5f9ffeb14
Reviewed-on: https://gerrit.mot.com/2251647
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
Adding mmi_info symbol table for CPS4019 to let
it could use the interface in mmi_boot_info
Change-Id: I4811b2a22f5fc5cc90e5427c387109831fffffed
Reviewed-on: https://gerrit.mot.com/2240634
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Submit-Approved: Jira Key
In the driver of CPS4019, we need to use some interfaces in
mmi_charger(for example: mmi_is_factory_mode). So we should
add relative dependence.
Change-Id: I06507728f8f15f0ddcc08ad855127e2167014b67
Reviewed-on: https://gerrit.mot.com/2239738
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Submit-Approved: Jira Key
Adding FW upgrade logic. Using default FW in commit:
https://gerrit.mot.com/#/c/2236788/
And just as upgrade logic of bootloader, we use dts
configuration of "wls_fw_name" to distinguish original
method and ours.
Be aware that it just works in factory mode.
Change-Id: Ib3d5d6b3aaf660ef5d2ec538d96aca70a6040c38
Reviewed-on: https://gerrit.mot.com/2239810
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Submit-Approved: Jira Key
Just as the commit of https://gerrit.mot.com/#/c/2239737/
CPS4019 is just powered by AC/VOUT. So if VBUS is low,
CPS4019 do not have power source. We have to use OTG
bootst from charger IC to get the power. So we should add
power boost trigger operation before FW checking logic.
Change-Id: I12f1641d2462ae821ffe07ae121e35cae3673b9c
Reviewed-on: https://gerrit.mot.com/2239809
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Reviewed-by: Haijian Ma <mahj8@motorola.com>
Submit-Approved: Jira Key
For our designation, cps4019's bootloader FW is a raw data
in head file(https://gerrit.mot.com/#/c/2239690/). So we use
a dts configuration(use_bl_in_h) to distinguish the original
method(using FW file) and ours. If this dts property is defined,
we will use tha raw data in header file.
Change-Id: Ibd08fff811bb8f3eb787984e85b188db1f1c4908
Reviewed-on: https://gerrit.mot.com/2239808
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
For CPS4019 is just powered by AC/VOUT. So if VBUS is low,
CPS4019 do not have power source. We have to use OTG
bootst from charger IC to get the power. So we should add
VBUS power detection and boost trigger operations.
Change-Id: I7630db66f517c17603d4f1b598802a179f63af9a
Reviewed-on: https://gerrit.mot.com/2239737
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Submit-Approved: Jira Key
For register map of CPS4019, FW_MAJOR_VER is from 0x2,
and FW_MINOR_VER is from 0x4. So we should fix the
configuration errors.
Change-Id: I9080c5f4d4a846d0947c14f0f5f36d6e939ad531
Reviewed-on: https://gerrit.mot.com/2239690
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Submit-Approved: Jira Key
For WLS gpio control, if GPIO is requested failed. We should block
the driver. Or if the driver use the gpio that is requested failed, there
will be some unexpected problems.
Change-Id: I8460d64032d673e5fcd32acd135e1f7b65f677d3
Reviewed-on: https://gerrit.mot.com/2239374
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Tested-by: Jira Key
Reviewed-by: Haijian Ma <mahj8@motorola.com>
Submit-Approved: Jira Key
In OTG mode, the output of VOUT from WLS should be disabled.
So we use gpio to control WLS through mux. When VBUS boost starts, disabling
WLS VOUT. And resuming it after VBUS boost stops.
This change is for BQ2589x.
Change-Id: Id6a0d81a9e50ba63c1dd89cce3cd1523d2a21af9
Reviewed-on: https://gerrit.mot.com/2239292
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Submit-Approved: Jira Key
In OTG mode, the output of VOUT from WLS should be disabled.
So we use gpio to control WLS through mux. When VBUS boost starts, disabling
WLS VOUT. And resuming it after VBUS boost stops.
This change is for SGM4154x.
Change-Id: I6749f58c7775d9cf8b351b63464a5dd42cf2cf8b
Reviewed-on: https://gerrit.mot.com/2239293
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Submit-Approved: Jira Key
Some device attributes do not have the interface of store. If we reguard
it as permission writable. We would get following errors:
[ 22.517191] Attribute vbus: write permission without 'store'
[ 22.522882] WARNING: CPU: 6 PID: 375 at drivers/base/core.c:2283 device_create_file+0x78/0x9c
[[ 22.619397] Hardware name: miami (DT)
[ 22.623067] pstate: 60400005 (nZCv daif +PAN -UAO)
[ 22.627864] pc : device_create_file+0x78/0x9c
[ 22.632219] lr : device_create_file+0x78/0x9c
Change-Id: I7497b33aff38cc122825b44623a03bd2765b3a83
Reviewed-on: https://gerrit.mot.com/2237072
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Submit-Approved: Jira Key
For linux 5.4, vfs_write will not be used, and it is changed to kernel_write,
so, we add the version judgment for this.
Change-Id: Iec34f046e608ec42436a741784aeeb9a1f46f479
Signed-off-by: weiweij <weiweij@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1806106
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Xiaojun Ji <jixj@motorola.com>
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Submit-Approved: Jira Key