Instead of having callsites track other reasons and their values before
updating FastChargeCurrent (FCC), use the pmic-voter to do this.
Change-Id: I7c3bea5529377b8233a5c697b1a042477c2834ac
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
Signed-off-by: Nicholas Troast <ntroast@codeaurora.org>
Currently while in parallel charging we reduce the total ICL to the
PMI's AICL result plus the current drawn from parallel charger.
The problem with this approach is that if AICL is low, we could
prematurely reduce the ICL.
Instead reduce the total ICL by 100mA per step. Also rerun AICL if the
PMI's ICL is higher than PMI's AICL result. This gives another chance
for AICL to settle higher than previous, enabling us to draw more
current.
Change-Id: I9e945ebc092d00c3b8caabb82ffa7af9d089f080
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
Currently the parallel enable function checks for few conditions and
could decide to disable parallel charging. That is against the
function's charter.
Move these checks to the smbchg_is_parallel_usb_ok() function where it
really belongs. Since the calculation of USB current is done there,
return it back. The call sites are expected to pass the returned
USB current to the enable() function if they decide to enable
parallel charging.
Change-Id: Ibc1f716bc287b65602960c87fbde84fc83b57b41
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
The FCC setting code, tries to enable parallel charger by calling
smbchg_parallel_usb_enable();
Instead change it to go through the smbchg_parallel_usb_check_ok()
api.
Change-Id: I672e0cf63f8dade94b799935fa7e183fb966a7b7
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
When an event happens which could change parallel charger
current distribution, the current driver won't act on it immediately.
It waits for a timed delay before reconfiguring.
If parallel charger is already in progress, don't delay for
reconfiguration. Act on it immediately.
Change-Id: I2685b1d19e0c5985a9bb1e0ce411e03e9f26154d
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
In certain conditions (such as RESET event) the USB driver
can request 0mA IUSB. Force the USB to suspend for all
ISUB requests <= 2mA.
Change-Id: Iaafaffc7327dc0ea0e55f473395d5aadfb3c1ddd
Signed-off-by: Anirudh Ghayal <aghayal@codeaurora.org>
Support setting the FLASH_TRIGGER power supply property in order to
disable the input current limit regulation loop when flash is strobing
without OTG connected.
Change-Id: I8d8dba8050a3fe066bbea108e4aaafda6045123b
Signed-off-by: Xiaozhe Shi <xiaozhes@codeaurora.org>
Add the power_supply property FLASH_TRIGGER in order to run algorithms
and workarounds for when the flash led need to strobe.
Change-Id: Icb2b25ffaaba329132f095f2377a22078633bf63
Signed-off-by: Xiaozhe Shi <xiaozhes@codeaurora.org>
The current implementation of the software ESR pulse does not work.
Lowering the FCC of the charger by 200mA does nothing if the charge
current is not FCC limited.
Instead, create an artificial ESR pulse by lowering the FCC to the
current battery current and subtracting 200mA from it. Cap this at the
termination current + 200mA though so that it does not accidentally
trigger charge termination.
In order to read the correct termination current, also read the battery
profile for the termination current in case termination is being done by
the fuel gauge.
CRs-Fixed: 838574
Change-Id: I41e8c9ecb39e489792637a91178cf5d4cdc6e837
Signed-off-by: Xiaozhe Shi <xiaozhes@codeaurora.org>
Register the battery over voltage interrupt in order to print warnings
when it happens.
CRs-Fixed: 901362
Change-Id: Ia4bb47caa0ea01022c00afeddc1c12b3b78fbe5c
Signed-off-by: Xiaozhe Shi <xiaozhes@codeaurora.org>
Since the hvdcp 3 detection sequence fakes disconnecting and
reconnecting the usb, this makes it look like the battery
charging status is glitching. So update the get_batt_prop_status
method to return CHARGING if the hvdcp_3_det_ignore_uv flag is
set.
CRs-Fixed: 899401
Change-Id: I675e5c14286fe376ef4ff747b2fc746e149513c4
Signed-off-by: Devesh Jhunjhunwala <deveshj@codeaurora.org>
The charger sets the POWER_SUPPLY_PROP_CHARGE_DONE on the bms power
supply during the chg_term interrupt handler function regardless of
whether charging actually terminated. In the cases of an instant
recharge trigger or manually calling the interrupt handler, the
CHARGE_DONE property will be falsely set.
Fix this by checking the real time status bit of the termination
interrupt before setting the charge_done property on the bms power
supply.
CRs-Fixed: 899712
Change-Id: I27e5969e462caba644e58095d6885e3b7e3c4523
Signed-off-by: Xiaozhe Shi <xiaozhes@codeaurora.org>
Currently the charger driver configures the fast charge current to 300mA
during a software ESR pulse. This is incorrect. FCC should be lowered by
a total delta of 200mA, not to 300mA.
Fix this in the charger driver.
CRs-Fixed: 872937
Change-Id: If7e8a52775d323f0b21d754a4322b85119b15ccc
Signed-off-by: Xiaozhe Shi <xiaozhes@codeaurora.org>
The parallel charger's VSYS is not connected on parallel charging
designs. All of the charge current flows through the CHGOUT to the
battery. However, if the primary charger is input current limited and
there is a large system load, then the parallel charger's current will
flow into the primary charger's CHGOUT. This will supplement the system
load instead of charging the battery.
This is a problem because all the current provided by the secondary
charger is fed through the batfet, and is sensed as charge current. The
amount of current provided to the battery is actually less than that
because the current is partially supplied to the system instead. This
results in the parallel charger not drawing enough current to charge the
battery even though there is plenty of current left before the input
current limit is hit.
Work around this issue by increasing the fast charge current on the
secondary charger and lowering it on the primary charger. This way, the
primary charger has more current to feed the system and the secondary
charger is less likely to be limited by the false charge current limit.
CRs-Fixed: 895883
Change-Id: I792ed9450bdac87d96b24707c1fb63fe93925b70
Signed-off-by: Xiaozhe Shi <xiaozhes@codeaurora.org>
Update the current and voltage tables for the qpnp-smbcharger driver so
that it also correctly supports the PMi8996 charger.
CRs-Fixed: 88862
Change-Id: I5b40ae169deb2b81bce99527cd18e71ea661be99
Signed-off-by: Xiaozhe Shi <xiaozhes@codeaurora.org>
Currently in the workaround select function, there is a missing break
statement after the PMI8994 subtype case. This causes PMi8994 chargers
to be configured with additional unnecessary workarounds for PMi8950.
Fix this bug by adding the break statement after the PMI8994 subtype
case.
CRs-Fixed: 892014
Change-Id: I66c5e2b49d88d4cc57445e802edd4ee115f0ec33
Signed-off-by: Xiaozhe Shi <xiaozhes@codeaurora.org>
Recognize the new PMIC subtype 0x13 as PMI8996.
Change-Id: If629f73695c16b966dcbbfec7fb5a93bc0f42265
Signed-off-by: Nicholas Troast <ntroast@codeaurora.org>
When BUSID pin is connected to ground, wsa speaker should be
set as left. When it is connected to VDD, wsa speaker should
be set as right. Current setting is inversed.
Correct stereo wsa speaker left/right setting for 8976.
Change-Id: If2b44be202f084d76cd9e58307d36c3fce802e3f
Signed-off-by: Yeleswarapu Nagaradhesh <nagaradh@codeaurora.org>
Some hardware configurations allow the USB driver to detect presence
and type without charger's APSD. This is true especially when the external
muxes are used to multiplex an USB port and a docking station on the usbin
input line.
The USB port when active, ends up notifying the USB driver via a gpio.
When docking station is active, USB side need not know about it.
Note that this change also removes the null checks for usb_psy. It is
initialized at probe and probe's success is dependent on proper usb_psy
detection and initialization.
Change-Id: I7e300ce19d82861f34ccf37545f3317221f727a9
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
Since there are many clients that control common resources like
input/battery current limit, implement a voting scheme to vote on
these resource values.
Change-Id: I2e7c114a8985030d3e54e7c98687c94aeb3c3c73
Signed-off-by: Devesh Jhunjhunwala <deveshj@codeaurora.org>
The dc path could be suspended while exiting the bootloader. Enable it
again at initialization.
CRs-Fixed: 883886
Change-Id: If25c0d8e4ed01d0c7637f1b06643a23cec330af4
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
Detect safety timer expired condition from charger and notify it to FG
through safety_timer_expired property. This can be used for PMi8952 V2.0
and future PMi chips. While at it, rename the safety-timeout irq to
wdog-timeout irq.
CRs-Fixed: 866074
Change-Id: I3a0f1f053a0038349bf5f704cf29eb5b84de2601
Signed-off-by: Chunmei Cai <ccai@codeaurora.org>
Add the pmic names to the revid structure for consumers.
Change-Id: I4887a2bd736d2568d23b0e6dd774436e064379e9
Signed-off-by: Xiaozhe Shi <xiaozhes@codeaurora.org>
Put soundwire in suspend state when system is in idle state.
This will avoid power consumption on speakers when system is in
idle state.
Change-Id: I4f38457fa7681957e21ff1381f9bd841533bd7b5
Signed-off-by: Sudheer Papothi <spapothi@codeaurora.org>
Commit 66a7393a3ba9685d1eddfbce72e3ef8f4848f19f ("mmc: block: ensure CMDQ
is empty before queuing cache flush") added a workaround for particular
vendor's eMMC devices. Workaround was to wait for all the outstanding
requests to finish up before queuing the flush request. Now detailed
root cause analysis from vendor shows that original issue can happen only
if DCMD command is sent to device too quickly (within less than 6
microseconds) after completion of previous small sector (less than 8
sectors) read operations. Hence with this change, we are fine tuning the
previous workaround such that it would almost have no impact on the storage
benchmark performance numbers.
Change-Id: I1df1c5d7bbcd7b526236651077b7dade2626cb30
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: Sahitya Tummala <stummala@codeaurora.org>
Some devices might stop responding to new commands if device cache flush
is queued to host controller while host controller is still processing
outstanding requests.
To workaround this issue, we are making the cmdq thread to wait for all
the oustanding requests to be finished before queuing cache flush command
on host controller.
Change-Id: I15387734f51ca4cadfc9e11270f14d8a0806a00f
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: Sahitya Tummala <stummala@codeaurora.org>
Currently, memshare relies on the system monitor only for
releasing memory for the allocated clients. It may happen that
XPU is still intact on the modem side while driver tries to
release the memory. This patch ensures that memory release only
happens if XPU is released.
Change-Id: I45716c0abe6bc08559854782ff73a332e148a7cb
Signed-off-by: Katish Paran <kparan@codeaurora.org>
Currently clock driver would try to get all the supported clock rates and
add to OPP framework. Avoid this by adding only the required fmaxes to opp
for clients to extract freq/voltage.
Change-Id: I7bd1de1a67da819f487ea1a7d79e326bb15bfbca
Signed-off-by: Taniya Das <tdas@codeaurora.org>
Port fixes for TX pop and spkr gain updates for tasha.
Also add fix in WSA for retry when device re-enumeration.
Change-Id: I6573517a101a4e5b0c34ef07a78c7dd0a4f127e5
Signed-off-by: Laxminath Kasam <lkasam@codeaurora.org>
Remove lowest power level to improve headroom in gpu active
for gmail scroll use case.
Change-Id: I531d5364273c1ac5240c5c5ffcd160323428854d
Signed-off-by: Anoop Kumar Yerukala <ayeruk@codeaurora.org>
Update bus votes for SVS power levels to improve
power in some of DOU use cases.
Change-Id: I4dff436a6ca147d4f94ceef56fb106f374cfde96
Signed-off-by: Anoop Kumar Yerukala <ayeruk@codeaurora.org>
This reverts commit aa22a57d7e.
As Android is using arm-eabi- tool chain for 32-bit kernel
compilation, To avoid unwind errors, we use arm-eabi-
tool chain instead of arm-linux-androideabi- for 32-bit kernel
compilation.
So this workaround is no longer required for arm-eabi- tool chain.
Change-Id: Id38c06d504fefba7894ab0ede6e482ee187902d3
Signed-off-by: Lingutla Chandrasekhar <clingutla@codeaurora.org>
Configure PC disable latency value for 8976 target when pm_qos
request to disable power collapse for DDR during SSR and coldboot.
CRs-Fixed: 914674
Change-Id: I65a2ca8b4a94a337195e8c4e8e4743e38f57197e
Signed-off-by: Anand N Sunkad <asunka@codeaurora.org>
Encourage IDLE and NEWLY_IDLE load balance by ignoring cache hotness and
discourage active load balance when by increasing busy balancing failure
threshold to initiate active load balancer in order to reduce scheduler
latency and avoid unnecessary active migration within a same domain.
Change-Id: I22f6aba11932ccbb82a436c0532589c46f9148ed
Signed-off-by: Joonwoo Park <joonwoop@codeaurora.org>
[pkondeti@codeaurora.org: resolved minor merge conflicts]
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
No need to call post_req if it's a DCMD request
completion.
Change-Id: Id11165967e316b1e556aaeb6d67bd18844cee6e1
Signed-off-by: Ritesh Harjani <riteshh@codeaurora.org>
Currently cmdq discard requests are not using same
softirq completion path as other cmdq request. So there
is no way to detect any error and handle it in case
of error of DCMD requests.
Make cmdq discard requests use blk_complete_requests
which complete via softirq completion path.
Change-Id: I1e03c81bc6fee8266cf1c86bada015e548770d7a
Signed-off-by: Ritesh Harjani <riteshh@codeaurora.org>
This does following:
1. Adds support to handle multiple cmdq software requests timeout.
Currently we schedule error handling work for the first timedout
request. We requeue all pending tasks, knock off all tasks from
device queue and reset card and controller as part of this, then
for all other software requests timeout, if it comes while executing
error work, we return BLK_EH_NOT_HANDLED.
This fixes BUG_ON in case of multiple requests timesout together.
2. Current code resets CQE, power cycle the card and requeue all the
requests in case of any error.
3. mmc_blk_cmdq_err work takes care freeing up all resource allocation
like clk and rpm hold, in case of reset_all.
4. Currently we were never clearing error CMDQ_STATE_ERR in case of any
error. This patch takes care of this bug.
Change-Id: I83d483c11fe2d7f2e462086cc3c0932057304c0d
Signed-off-by: Ritesh Harjani <riteshh@codeaurora.org>
This patch does following-
This adds an API(mmc_cmdq_hw_reset), for RESET_ALL
of SDHCI, power cycle mmc card and
reintialize it, which enables cmdq as well(if supported).
This acquires claim_host before calling mmc_power_restore.
mmc_power_restore should be called with claim_host acquired,
since this function is required from non-claim-host context in
cmdq error handling.
Change-Id: I31c4449dead1d4ad4e10a4822cce2298ec5fb4b6
Signed-off-by: Ritesh Harjani <riteshh@codeaurora.org>
Call mmc_/cmdq_post_req with tag number instead of
mrq. This is needed in error handling as part of multiple
request error handling.
Change-Id: I175432639d28378ec74669e31deb4d1667c49bb8
Signed-off-by: Ritesh Harjani <riteshh@codeaurora.org>
This adds WA to handle few CQE error which
can cause HALT to fail or can give CQTERRI info
as NULL.
Like - currently there is a HW bug that in
case of ADMA error CQE will not stop and CQTERRI
register will not be updated with any valid values.
Halt will also most likely fail in case of ADMA error.
Thus possible WA for this is to disable CQE,
do reset_all and requeue all the requests in flight.
Change-Id: I5aaddbb7bec1de7dbc959144dc2f1a5ad16789ff
Signed-off-by: Ritesh Harjani <riteshh@codeaurora.org>
1. Add a check in mmc_cmdq_should_pull_reqs to not pull.
Any requests in case if CQE is disabled and card is not suspended.
This means that CQE must be in error state and so mmc_cmdq_thread
should stop issuing requests.
2. Do not requeue the request in case of error in issue path.
Ideally there should not be any error in the issue path
of request. Even if there is an error, we should not
requeue this request as (like in case of DCMD,
blk_end_request with partial bytes of completion will
make sure that request is not finished and still can be
fetched). So requeing the same request which is still in
elevator is illegal.
Change-Id: I0c5e6556d3d881f1a675db4fff4f995de024ddf8
Signed-off-by: Ritesh Harjani <riteshh@codeaurora.org>
This patch adds following helper API/info -
1. cmdq_halt_poll to halt the controller using polling
method. This is to be mainly used in case of an error
from cmdq_irq context.
2. Adds num_cq_slots & dcmd_cq_slot info to
mmc_host structure. This can be useful info
for mmc host structure like in case of handling
of multiple error requests
3. Adds CMDQ_STATE_CQ_DISABLE for cmdq host.
In case of an error if halt also fails, CQE error handling
code will disable CQ. So block layer needs to know
- to not pull any requests in such case.
Change-Id: I8e9a8d5094db82336917fcca4361ce84316c34ef
Signed-off-by: Ritesh Harjani <riteshh@codeaurora.org>
cmdq_irq should be handled before clearning error interrupt.
Because in case of an error CQE needs to be halted/disabled
in cmdq_irq, before we clear the error interrupt.
Otherwise, CQE might start processing other requests whose
doorbell is set, even in case of error in previous completed
request.
Change-Id: I8c77ca08dcf440293844120c1b59d2dada84bac5
Signed-off-by: Ritesh Harjani <riteshh@codeaurora.org>
DCMD requests don't have data, check for the data pointer before
accessing it to prevent null pointer dereference in case of DCMD
timeout err. Also signal a completion event for non flush requests
like discard that wait for the completion of DCMD request.
Change-Id: Ia71a5f1e278a039ba22f6ac42614d9ae79dba7e9
Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org>
Occasionally, SR/HF rate PLLs may fail to achieve a lock, and the
output frequency may not match what software expects after configuring
a L value for a certain frequency. If the PLL fails to lock, that is,
the lock detection bit does not go high even after waiting for the
mandated amount of time, record additional PLL debug information in the
kernel log before panic().
Also update the SR PLL power up sequence to assert PLL_RESET_N and
PLL_BYPASSNL together.
Change-Id: Ib98d9b64cc8c8c11138ba75dea9eac649921c1e2
Signed-off-by: Taniya Das <tdas@codeaurora.org>