Age | Commit message (Collapse) | Author |
|
Parallel charging increases charging capacity and efficiency by
distributing the current between two charging chips.
PMI8998 feeds the parallel charger via its MID input, and handles
input current limiting in its front-porch FET. As master charger,
PMI8998 is responsible for enabling/disabling the parallel
charger, and the FCC distribution.
To enable parallel charging in software, the following conditions
must be met:
- Strong USBIN input
- Battery present
- In fast or taper charging state
- Attached UFP source
While the enabling/disabling is always under the control of software
the disabling can also be done by hardware in case of fault.
Battery current is usually fixed to the battery rating. The FCC
distribution is simple, a split of 50/50 by default, which can
be changed in runtime.
When taper irq kicks in, the algorithm reduces parallel FCC by 25%.
This puts the charging back in constant current phase until the
next one happens where again the algorithm reduces the FCC by
25%. This continues until the parallel FCC drops to 500mA. At that
time parallel charging is disabled and master continues charging
the rest of constant voltage phase.
CRs-Fixed: 1023703 1030934
Change-Id: Ied7c31d5913df94a288d36ecf06d081d32e07396
Signed-off-by: Harry Yang <harryy@codeaurora.org>
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
|
|
This driver supports the SMB138X charger device.
This charger peripheral is common among other chips, therefore the
driver uses the smb library to support all common functionality.
Register access is provided by the parent device via regmap. Interrupts
are controlled by the parent device, and handlers are registered by the
SMB138X charger driver.
The power supply framework is used to communicate battery and usb
properties to userspace and other driver consumers such as fuel gauge
and USB.
VBUS and VCONN regulators are registered for supporting OTG, and powered
Type-C cables respectively.
CRs-Fixed: 1023141
Change-Id: I119d33cdfdfc874b5d7f6137618ee3e590c72064
Signed-off-by: Nicholas Troast <ntroast@codeaurora.org>
|
|
Add icl handler to report USB input current limit, and charge handler
to report charging state changes, providing input to parallel
charging algorithm.
CRs-Fixed: 1023703
Change-Id: Id51ad3dbd6e2637c105db681082eea98ab161a50
Signed-off-by: Harry Yang <harryy@codeaurora.org>
|
|
Add a votable structure - one veto to disable or unanimous
approval to enable.
Provide an open and flexiable machanism to enable/disable
parallel charging based on various dynamically changing
factors.
CRs-Fixed: 1023703
Change-Id: I552467645d6f8f633afe273b173a636e0eb396a7
Signed-off-by: Harry Yang <harryy@codeaurora.org>
|
|
Implement wake votable on top of PM wakesource APIs for PMIC voters
to hold system awake.
CRs-Fixed: 1023703
Change-Id: If2c8f65d932f2f0bdad9f0f026d440a2089cec5f
Signed-off-by: Harry Yang <harryy@codeaurora.org>
|
|
Charger drivers can have different operating modes such as standlone, or
parallel slave.
Add a mode variable to support different operating modes.
Change-Id: I885289a1eec68335645912c3ecbbe91a85836647
CRs-Fixed: 1023141
Signed-off-by: Nicholas Troast <ntroast@codeaurora.org>
|
|
Votables that are NULL or have already been destroyed need not be
destroyed again. Return immediately when destorying NULL votables.
CRs-Fixed: 1023141
Change-Id: I8e367dbe7acf72471a5a474f0e2a00a4004fcbfb
Signed-off-by: Nicholas Troast <ntroast@codeaurora.org>
|
|
The parallel charger does not use voting, therefore register getter and
setter functions need to be created or exposed.
CRs-Fixed: 1023141
Change-Id: I96a4877196be78c0eeecc3fc08419e8990572aaa
Signed-off-by: Nicholas Troast <ntroast@codeaurora.org>
|
|
Since the blocking chain notifiers can be called from process context,
the notification must not be sent from within a critical section.
Move the blocking notification outside the critical section.
Change-Id: Ia5679310fc59f25643e7c8d572cc230d262c5937
Signed-off-by: Archana Sathyakumar <asathyak@codeaurora.org>
|
|
The charger peripheral has a bit to control Qnovo pulse engine.
Enable it.
CRs-Fixed: 1018090
Change-Id: I2ddea8adf1aa9d999cc2fd3fd4f0e0f830147d4c
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
|
|
Qnovo hardware module controls battery charging pulses. Pulse
characteristics are programmed via sysfs files, this driver
translates those values to register values and writes to appropriate
registers.
CRs-Fixed: 1018090
Change-Id: I2573f719f4b2c2fa9a169659a65433fb834ea74e
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
|
|
There is a race condition between setting PD_ACTIVE = 0 and when losing CC.
If PD_ACTIVE is not set to 0 by the time the TYPE_C interrupt fires on
disconnect then the POWER_SUPPLY_TYPE will not be set to UNKNOWN.
Instead of relying on PD_ACTIVE being set to 0 before the TYPE_C interrupt
fires, just update the type upon PD_ACTIVE being set.
CRs-Fixed: 1017798
Change-Id: Icd62b9d98d5763d209c7de897653f19f8031e236
Signed-off-by: Harry Yang <harryy@codeaurora.org>
|
|
Currently the pmic votables need a device to be created.
Votables should be able to work on device less code. Remove
the need for device and instead use a void pointer to be passed
back to the callback.
CRs-Fixed: 1018090
Change-Id: If5dafbcc0d88596332b794ad5b6fdc1f9ff98a45
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
|
|
The default value was introduced to prevent crashes on the clients
where it couldn't handle situations when there were no voters.
The default value led to many complicated scenarios in the votable
implementation.
Remove the concept of default value and return error when
there are no votes. Update all the clients to handle error values
from votables. Also invoke the callback to inform about no active
voters.
CRs-Fixed: 1018090
Change-Id: I81f5974f81a697f3698bc58df1d3ed59fa2579a7
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
|
|
Currently the pmic-voter api assumes that the clients are represented
as unique integers. Using strings instead of integers adds flexibility.
- It enables the votable to be shared across multiple drivers without
having a common client enum
- Debug prints become more useful
While at it
- remove the use of num_clients in the apis. All of them default to
NUM_CLIENTS.
- Create a list of all the votables, this allows for searching for a
specific votable.
- Error if a votable is already created with the same name earlier.
- Add debug prints about current clients and effective results
- Remove passing in last_client and last_client_id in the callback. These
parameters go unused in all the usecases.
- Since clients are assigned sequentially and that they cannot
unregister from a votable (clients can only disable their votes, but
they cannot remove themselves), a null string in the client string
array means there are no more clients. Use this to speed up result
calculation by stopping at the id with a null string.
- Refactor the vote() implementation. Currently the SET_ANY case flows
differently than MIN or MAX, make them uniform.
- Create an api to call the callback without casting new votes.
CRs-Fixed: 1018090
Change-Id: I8e2bc3366ec12e8485e4be86ee56ba5e4d113c3c
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
|
|
Currently the charger driver sets the charge current based on device tree
property. Allow setting fast charge current (fcc) via power supply (psy)
property. Moreover the current voter for fcc is a min voter, change
that to max voter so that values above what device tree has set can
be used.
Similarly, introduce a max voter for battery float voltage (vfloat) and
set it to defaults via device tree.
CRs-Fixed: 1018090
Change-Id: I691984543f8beb3c52d3d578c7cc311c285a1fcc
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
|
|
Slow buses regmap holds a mutex lock, while for fast buses regmap holds a
spinlock. In order to remain compatible with slow buses spinlocks should
not be held before calling the regmap API.
CRs-Fixed: 1017800
Change-Id: I93aa6df8c7ec1916ba23d21d92e477510db949da
Signed-off-by: Harry Yang <harryy@codeaurora.org>
|
|
The POWER_SUPPLY_PROP_PD_ACTIVE property is intended to be a flag
set whenever the PD PHY is in use. But this includes attempts to
establish communication, which may involve trying to perform a hard
reset to see if the port partner responds. Thus updating the
psy_desc.type field to 'USB_PD' right when PD_ACTIVE=1 is premature
as the port partner may not be PD-capable and it could be un-set.
Instead allow the PD driver to directly update POWER_SUPPLY_PROP_TYPE
only after it is sure PD communication has succeeded.
Change-Id: Iae6804bcb3121e0852ec5d14d0939623b97a6e67
Signed-off-by: Jack Pham <jackp@codeaurora.org>
|
|
Type-C factory mode is unreliable and causes the Type-C mode to be
incorrectly detected in some cases. Disable it.
CRs-Fixed: 1019313
Change-Id: I5f66be80899c33816c886df526db9e50d7e9aff9
Signed-off-by: Nicholas Troast <ntroast@codeaurora.org>
|
|
Add support for the new version of bcl peripheral introduced
in PMIcobalt.
The new support includes,
1. support the new address space
2. set the new Ibat too high threshold
3. set the new vbat low comparator threshold
4. set the new vbat too low comparator threshold
5. enable the LMH DCVSh monitor algorithm, when the
thresholds are configured.
CRs-Fixed: 1010115
Change-Id: I6dad908bbc673ff1b7f7d3d05fecdfc8f48b5815
Signed-off-by: Ram Chandrasekar <rkumbako@codeaurora.org>
|
|
This snapshot is taken as of msm-3.18 commit
978d23c.
Accommodate the changes in the input arguments for
power_supply_register() API and use
power_supply_get_property() API to get the SoC information
from BMS.
CRs-Fixed: 1010115
Change-Id: I1af565ffd3b61e424aca1cbd5ec6cbef8d89f1fa
Signed-off-by: Ram Chandrasekar <rkumbako@codeaurora.org>
|
|
The QPNP SMB2 charger driver supports the charger peripheral present in
the PMICOBALT chip.
This charger peripheral is common among other chips, therefore the
driver uses the smb library to support all common functionality.
Register access is provided by the parent device via regmap. Interrupts
are controlled by the parent device, and handlers are registered by the
QPNP SMB2 charger driver.
The power supply framework is used to communicate battery and usb
properties to userspace and other driver consumers such as fuel gauge,
USB, and USB-PD.
VBUS and VCONN regulators are registered for supporting OTG, and powered
Type-C cables respectively.
CRs-Fixed: 1005389
Change-Id: I160ce3c8caae6999f52590099cf6d1de957dbbaf
Signed-off-by: Nicholas Troast <ntroast@codeaurora.org>
Signed-off-by: Harry Yang <harryy@codeaurora.org>
|
|
A library of common structures and functions that should be used by all
charger drivers that support an SMB charger peripheral.
The library includes high level register read/write access, interrupt
handlers, voter callbacks, and power supply property getters. It should be
extended with any functionality that can be leveraged by an SMB charger
peripheral.
All drivers that support an SMB charger peripheral should define their own
struct smb_charger to interface with the library.
CRs-Fixed: 1005389
Change-Id: I36796332af667874c1246ec35984122d45de6938
Signed-off-by: Nicholas Troast <ntroast@codeaurora.org>
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
Signed-off-by: Harry Yang <harryy@codeaurora.org>
|
|
Consumers may not want to specify a callback, especially for boolean
votables which only care about the state of the client votes rather than
reacting to a change in the effective result.
CRs-Fixed: 1005389
Change-Id: I72274126a382ef8e32d89e1e8aa98348aaaac420
Signed-off-by: Nicholas Troast <ntroast@codeaurora.org>
|
|
The original commit was reverted due to conflicts in the kernel upgrade
process. Now that the upgrade is complete we can introduce this commit
again.
Original commit:
commit 8e10bff71301 ("power: move QTI charger drivers to a new
sub-directory qcom-charger")
QTI charger drivers have outgrown their home in power and deserve their
own sub-directory. Move all QTI charger drivers and their dependencies to
a new sub-directory of power called qcom-charger.
CRs-Fixed: 1001767
Change-Id: I5465a944a79f622ddf69534075b067db0fb10c95
Signed-off-by: Nicholas Troast <ntroast@codeaurora.org>
|
|
POWER_SUPPLY_PROP_CHARGING_ENABLED has been used to indicate enabling
the charge path in some drivers and enabling the input path in others.
This leads to confusion of what charging enabled really means.
POWER_SUPPLY_PROP_BATTERY_CHARGING_ENABLED was introduced to indicate
enabling the charge path, and in this case
POWER_SUPPLY_PROP_CHARGING_ENABLED is used to indicate enabling the
input path. Since these are similarly named it leads to even more
confusion.
In an attempt to fix this confusion we introduce a new power supply
property POWER_SUPPLY_PROP_INPUT_SUSPEND which indicates suspending the
input path of the power supply. POWER_SUPPLY_PROP_CHARGING_ENABLED takes
its original definition of enabling the charge path. Then
POWER_SUPPLY_PROP_BATTERY_CHARGING_ENABLED will be retired from use.
CRs-Fixed: 1005389
Change-Id: I1ca8f5748a56a9395caa8ed8ed18f70e69f0cbe8
Signed-off-by: Nicholas Troast <ntroast@codeaurora.org>
|
|
Introduce the power_supply_typec_mode enum definitions which
will allow a charger to indicate the type of USB Type-C
connection that is established. Also add additional properties
for indicating CC pin orientation, changing source/sink power
role (useful for dynamic power role swap), and a flag to allow
the charger to expect VBUS changes during USB Power Delivery
power negotiation.
CRs-Fixed: 1005389
Change-Id: Iba9b652335fba4ee4f24a17eba8abdd5c85c21bb
Signed-off-by: Jack Pham <jackp@codeaurora.org>
Signed-off-by: Nicholas Troast <ntroast@codeaurora.org>
|
|
Currently msmpower off driver is not checking whether device
is in secure boot or not. So use generic API scm_is_secure_device()
and take appropriate decision to enable download feature.
Change-Id: Ic7bbe1f7c9b839ad5d1d07a6583f6a1b76bf8962
Signed-off-by: Prasad Sodagudi <psodagud@codeaurora.org>
|
|
Report the input current limited status via the power supply in
parallel mode in order to better optimize for HVDCP usecases.
Change-Id: Ibd3865828ccbfa44b36839f5d11e7a60b7ada77d
Signed-off-by: Ashay Jaiswal <ashayj@codeaurora.org>
|
|
POWER_SUPPLY_TYPE_USB_DCP type is returned in read_usb_type() if no
charger is connected, which might cause APSD to unnecessarily rerun.
To fix it, POWER_SUPPLY_TYPE_UNKNOWN should be returned instead.
A bug is also fixed by returning right after IDEV_STS register
read error in this function .
CRs-fixed: 963745
Change-Id: Ia399e05fe8d0ad13c2f1f272c6737e8798177174
Signed-off-by: Harry Yang <harryy@codeaurora.org>
|
|
ARB occurs upon DCP removal due to bit INPUT_MISSING_POLLER_EN_BIT
cleared in kernel charger driver. Enable input missing poller bit
to avoid ARB.
CRs-Fixed: 965458
Change-Id: I3597327d8607b61582d124318e06da701758e34b
Signed-off-by: Harry Yang <harryy@codeaurora.org>
|
|
The USB PHY no longer exports DP/DM control via power_supply.
Instead, use the regulator it exposes to replace the DPF_DMF
with regulator_enable() and DPR_DMR with regulator_disable().
All other operations (e.g. pulsing) are no-ops for now until
suitable replacements are available.
Signed-off-by: Jack Pham <jackp@codeaurora.org>
|
|
The USB power_supply object should be maintained by the
charger driver. Since it is now removed from the USB
controller driver, create and register it here. Many
of the calls to set/get_property can be simplified since
there are equivalent state variables we have access to.
PROP_OTG can be removed entirely since that is now handled
by emitting an EXTCON_USB_HOST notification.
Signed-off-by: Jack Pham <jackp@codeaurora.org>
|
|
Allow charger to expose an extcon device which can emit
notification for USB and USB-HOST cable connection states.
The driver can correspondingly register interest in being
notified of these cable connection statuses.
This is intended to replace the power_supply_set_present()
and power_supply_set_usb_otg() mechanisms currently used.
Change-Id: I6c7cf971f59ac3f3075f5c8f13786306729f25a8
Signed-off-by: Jack Pham <jackp@codeaurora.org>
|
|
Snapshot of debug_core module from 3.18(as of
e70ad0cd5efdd9dc91a77dcdac31d6132e1315c1)
Change-Id: Ie7a4c1ba59c3fb2d3745b4582dd14f0147593935
|
|
The sensor APIs have changed from using long to int for temperatures. Update
the variables types from long to int.
Change-Id: Id183b83339ceaacb6d340cca138845dd5ac6fbdf
Signed-off-by: Mahesh Sivasubramanian <msivasub@codeaurora.org>
|
|
Mutual exclusion between APM switching and LMH register accesses
is only required for HMSS version 1.2 and below on MSM8996. It
is not required for HMSS version 1.2 on MSM8996-Pro. Add support
for MSM8996-Pro so that the LMH mutex is not locked during APM
switching on MSM8996-Pro parts.
Change-Id: If09454827ed12c4d436c2fc792f5adcd45ef4312
Signed-off-by: David Collins <collinsd@codeaurora.org>
|
|
Currently, rslow compensation active settings are applied and
cleared based on certain conditions. However, if the device goes
for a reset, the flag used by FG driver to save the setting done
will vanish. For e.g. if an active setting is applied and the
device goes for a reset, even if there is a condition present to
clear the active setting, it will not be applied. This is due to
the fact that the flag (rslow_comp.active) is not set in first
place even though FG HW has that setting applied. Fix this by
reading rslow configuration during hw_init and set the flag.
CRs-Fixed: 977626
Change-Id: Ib6d9f7d79335b027f7ed7ee24dfd5c9bb303228d
Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
|
|
Update the fast-charge configuration for SMB1358 used to
index into the battery charge-current.
CRs-Fixed: 978046
Change-Id: I31ffc03d083c955ac1fdcf79ba5287a0107d3524
Signed-off-by: Anirudh Ghayal <aghayal@codeaurora.org>
|
|
Add ability to configure the polarity of enable-pin in
parallel-charger configuration.
CRs-Fixed: 978046
Change-Id: Ied82dff7afeaa58ea0815f555791c9a0d15e926a
Signed-off-by: Anirudh Ghayal <aghayal@codeaurora.org>
|
|
If insert HVDCP charger when device in sleep, kernel wakes up by the
interrupt and after DCP being detected, there is a chance that kernel
going to sleep again and hvdcp_det_work won't be run. This causes the
HVDCP detection failure and stay at 5V to be acting as normal DCP.
Hold a wake lock before schedule the hvdcp_det_work, and release the
wakelock after it being detected.
CRs-Fixed: 966430
Change-Id: I7ca503a5656ab9031d409079421a24710f2996e6
Signed-off-by: Chunmei Cai <ccai@codeaurora.org>
|
|
Currently, ESR is being under-estimated when the battery state of
charge (SOC) is less than 2%. Add a change which can do tuning to
use default ESR values when SOC is less than 2% and switch back
to ESR extraction when SOC goes above 2%. When the SOC is greater
than 2% and less than 5%, apply slow settings for ESR pulse. When
the SOC crosses 5%, apply the default settings.
This will allow the SOC to increase more accurately when the FG
starts with a better ESR value. This feature is supported via
device tree property "qcom,esr-pulse-tuning-en".
CRs-Fixed: 953448
Change-Id: I37da8d2a9d795dc3d4daffeaf80a72d188243bfd
Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
|
|
Currently, a battery profile is loaded when the profile integrity
bit is not present, a new battery is inserted, or battery voltage
is not in range across reboot. When the battery profile loading
happens after the device has booted up, the charger driver is
notified to disable battery charging.
However, in cases like offline mode charging, the device can boot
up again with charging enabled causing battery parameters to be
modified even before the charger driver can probe. This causes
a jump in state of charge (SOC) across reboot and causes the FG
to restart. To help with this scenario, make sure the charger
driver is ready, and charging is kept disabled before the battery
profile loading process start. Enable charging back when there is
no need to reload the battery profile, or the FG has restarted
and the first SOC estimate is done.
CRs-Fixed: 953448
Change-Id: I90b1c81ce502c0f6e96feab3b23cff61054422cb
Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
|
|
When the charger driver haven't been probed yet and batt_psy is
unavailable, batt_profile_init is rescheduled as it depends on
the charger to disable charging while loading profile. However,
this adds a constraint that SRAM parameters needs to be updated
every time just before batt_profile_init is called again. Else,
stale SRAM parameters will be used to decide whether the battery
profile can be loaded or not.
Hence, cancel and schedule the update_sram_data work whenever
battery profile loading is rescheduled again.
CRs-Fixed: 953448
Change-Id: I6e1108601baf744014227155b7b09e0ec4a0a9bb
Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
|
|
The battery missing detection (BMD) is incorrectly
being enabled. Fix it.
CRs-Fixed: 943881
Change-Id: I58407f0b6ca376bc4809073144429cd4cc3483c9
Signed-off-by: Anirudh Ghayal <aghayal@codeaurora.org>
|
|
This reverts commit e4d364b91cf5fabcca10ff8fee31af1ca25b3d1b.
|
|
Stats for cpu and cluster exit path query the ktime for every level and
this increases the overall idle exit latency. Get the timestamp only
once and use the same information to populate into different level.
Change-Id: Iece36015910fcb16bd04a25dae1bf0396ab463e2
Signed-off-by: Archana Sathyakumar <asathyak@codeaurora.org>
Conflicts:
drivers/cpuidle/lpm-levels.c
drivers/power/qcom/lpm-stats.c
|
|
Add sysfs node to query the total sleep time of a cpu since debugfs node
is not exposed to the userspace service.
Command:
cat /sys/module/lpm_stats/cpu0/total_sleep_time_secs
cat /sys/module/lpm_stats/cpu1/total_sleep_time_secs
cat /sys/module/lpm_stats/cpu2/total_sleep_time_secs
cat /sys/module/lpm_stats/cpu3/total_sleep_time_secs
CRs-fixed: 935207
Change-Id: I45be0a8be29932816aa42e097657a2a60933b986
Signed-off-by: Archana Sathyakumar <asathyak@codeaurora.org>
Signed-off-by: Mahesh Sivasubramanian <msivasub@codeaurora.org>
|
|
The current driver uses a boolean flag psy_registered to track
whether the power supplies are initialized. Instead check if the
psy pointers are non null to ensure they are initialized.
Signed-off-by: Rohit Vaswani <rvaswani@codeaurora.org>
|
|
Read the hi-power power-supply property in the
get_property callback to avoid warnings from the
power-supply framework.
Change-Id: I5a9bb9b625ceb308afab915db9ac784a567ffbfb
Signed-off-by: Anirudh Ghayal <aghayal@codeaurora.org>
|