diff options
author | Abhijeet Dharmapurikar <adharmap@codeaurora.org> | 2017-01-30 15:43:04 -0800 |
---|---|---|
committer | Abhijeet Dharmapurikar <adharmap@codeaurora.org> | 2017-01-31 22:23:39 -0800 |
commit | f0cf35f5921410fed20e7d2d5f89ed3326430a08 (patch) | |
tree | 429f70ea0e0e58babe4a3be363c7634e8c9c5b30 /drivers/power/ds2780_battery.c | |
parent | 684caa6de452edc82398b9f5b35c706caa535225 (diff) |
power: qcom-charger: separate parallel code
Currently the parallel charging code is tightly coupled in the main charger
files. Update the design to separate parallel charging code. This
parallel charging code will implement few votables and interacts with
the main and parallel charger.
A brief discussion on important changes
Usb main psy
The new design introduces a charger type called USB-Main which exposes all
the properties required to implement parallel charging for the main
charger. These properties are implemented/supported
- CONSTANT_CHARGE_CURRENT_MAX, sets and gets the FCC of the main charger
- ICL_REDUCTION, indicates by how much the main charger should reduce
its ICL. The parallel charger would draw some portion of the ICL and
this implementation ensures that the main charger reduce its ICL in
order to not exceed the adapter limits.
- VOLTAGE_MAX, sets the float voltage of the battery, we continue to
raise float voltage for the parallel charger so that it operates as
current source.
- INPUT_CURRENT_SETTLED: indicates the AICL results.
- FCC_DELTA: indicates the value by which the main is correcting the
FCC. The main reduces FCC by few mA when in Jeita or Step
charging. This helps in determining the exact FCC which in turn
helps distribute it correctly.
Slave percent
The new file implements the sysfs entry for slave percent. When
thermal balancer updates it, it ends up calling fcc distribution
and also the icl distribution. Note that the icl distribution too
is dependent on the slave's fcc percent - in that it gives 10
percent point more to the main charger.
ICL
ICL needs to be distributed only in USBIN_USBIN configuration.
As noted above the ICL distribution is based on fcc distribution
aka slave_percent. The main charger is given 10% more ICL since it
caters to system load in addition to charging the battery. This is
similar to our traditional USBIN USBIN implementation where FCC was
distributed 50/50 while ICL was distributed 60/40 percent - the main
got 10% more of the ICL value.
Note that the ICL distribution is invoked when AICL settled current
changes, not when the ICL itself changes. The new code tracks the
aicl settled value and invokes the icl distribution when it changes.
It first requests the main charger to reduce its icl and then updates
the parallel's icl.
FCC Votable
The FCC votable is moved to the new file and is similar to its previous
implementation - It distributes FCC when ever the FCC value changes, the
slave_pct changes or parallel charger is enabled or disabled. If the main
charger is further modifying the FCC from what its registers were
configured, this FCC callback takes that in to account via the
FCC_DELTA property prior to distribution.
FV Votable
Like the FCC votable the FV votable is moved to the new file.
The code is similar as it was implemented in the main file where
it distributes FV when ever the FV value changes.
TAPER entry
The code that stepwise reduces slave's ICL as it enters taper mode
is moved to this file. So that it can correctly do this, the
charge type is tracked in its internal structure.
PL_DISABLE Votable
The PL_DISABLE too is moved to a new file. There are few implementation
changes here.
- Earlier the code used to run the same sequence while enabling and
disabling. This could create a situation where FCC/ICL is incorrectly
configured for a brief period. That has been corrected, in that
the enable configures in this order configures fv, distributes fcc,
enables parallel, distributes aicl. The disable does that in reverse
order of enable.
- Charger's presence would vote on enabling/disabling parallel charger.
This is no more required. Instead a vote from CHG_STATE_VOTER suffices
for when fast charging begins. The voters that enable/disable parallel
when typec is present or is in sink mode or when uUSB cable is
inserted are removed.
CHG_STATE_VOTER and TAPER_END_VOTER
A typical charge cycle enters fast charging, moves to taper charging and
finally goes to end of charging. Parallel charging needs to be
enabled while fast charging starts and needs to be kept enabled during
the portion of taper charging when parallel's FCC is above 500mA threshold.
Note that if charging starts from taper, we only want to run it so long
as the parallel's FCC stays higher than 500mA threshold.
CHG_STATE_VOTER votes to enable parallel charging when fast charging
or parallel charging is in progress. When charging stops (i.e. when its not
in fast or taper charging) CHG_STATE_VOTER votes to disable parallel
charging.
Also the TAPER_END_VOTER votes to disable parallel charging when
parallel's FCC share falls below 500mA. It continues to vote disable on
parallel charging until charging stops. At that point it votes to
enable parallel charging.
Between these two voters, parallel charger
- enables when fast charging starts and remains enabled as it
transitions to taper charge.
- is disabled once parallel's FCC falls below 500mA threshold and
remains disabled in taper charge until charging stops.
This makes it important that the battery psy provide correct psy
changes when it enters/exit FAST or TAPER type. The PMI chip and its
battery_psy implementation already guarantees that.
PL_TAPER_EARLY_BAD_VOTER
During some runs we see that parallel operates in taper mode. Given that
we sets its FV higher than main's FV, the parallel should never operate
in taper mode. This voter disables parallel charging if this happens.
This voter enables parallel charging when the main charger stops
charging.
Change-Id: If1676cd126d7eeace7c44cf8d819038d03433d7e
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
Diffstat (limited to 'drivers/power/ds2780_battery.c')
0 files changed, 0 insertions, 0 deletions