Add support to configure battery thermal coefficients so that different
battery thermistors can be supported. These coefficients can be
configured via "qcom,battery-thermal-coefficients" device tree property.
CRs-Fixed: 2004461
Change-Id: Iff25acd397a68c31057dff4db1896d46e396adc6
Signed-off-by: Yingwei Zhao <cyizhao@codeaurora.org>
Slope limit coefficient is used to define the maximum change in
battery SOC. There is a requirement to configure slope limit
coefficient based on charging status and battery temperature
threshold. Add support for it through the following properties.
- qcom,slope-limit-temp-threshold
- qcom,slope-limit-coeffs
Possibe values allowed for slope limit coefficient is 0 to 31.
Change-Id: I41eacb13734f1692a16c1b011c58a488e46515ec
Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
ESR filter coefficients for room temperature are functional and
ESR filter coefficients for cold temperature are not. Fix the
ESR filter configuration to always configure the ESR filters for
room temperature with normal and low temperature coefficients
depending on the specified temperature threshold.
Change-Id: If3bd8c187e59f59d29249bebdc1c243681dd41bd
Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
There is a requirement where an user wants to set CC_CV threshold
runtime so that it can be adjusted whenever the float voltage is
changed.
Add support for it via POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE
property.
Change-Id: I7fcb75f69f12fc2baf8e270a13cad6686c793bf9
Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
Booting up with higher battery id (e.g. 300KOhms) can cause a
failure in driver probe because none of the SRAM transactions
can go through during boot. This seems to be happening because
FG ALG treats it as a battery missing. Since driver fails to
probe early, it cannot even handle an interrupt to reconfigure
BMD. Hence, reconfigure BMD every time when the battery id is
obtained.
Since getting battery id now requires couple of SPMI writes,
move fg_get_batt_id() out of fg_get_batt_profile() as the latter
will be called from fg_parse_dt(). This makes fg_parse_dt() only
for parsing device tree properties from the device.
Change-Id: I1638f7325ce73b03f1ea54455f777f92cf8d06b3
Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
During SOC masking, SOC 100 will be shown to the user after the
charge termination and as long as the charger is inserted. After
the charger is removed or device is discharging when the charger
was inserted, showing the real monotonic SOC instantly reduces
the user experience. Linearize the drop in SOC so that it can be
spread to a wider range.
Change-Id: I509e59f8e5d9e9addd8c5721369fbcf664158338
Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
When SOC masking algorithm is enabled, a SOC of 100 will be shown
to the user when certain conditions are met. When the device
starts discharging after charge termination, auto recharge will
be triggered once the SOC or Vbatt goes below the threshold. When
the recharge is based on Vbatt, a fluctutation in Vbatt can cause
issues in SOC masking algorithm. To make it robust, adjust the
recharge voltage dynamically based on charging status and battery
SOC.
Add a device tree property to allow configuring auto recharge to
be based off SOC or battery voltage. This will help the user to
select auto recharge configuration easily.
Change-Id: I2d749806aa51b9fa747967b592b6622cc12bee65
Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
After charge termination, charging status might not get updated
until the recharge begins. This makes charge_full_update to be
not called at all thereby causing SOC masking algorithm to not
clear the charge_full flag. Use delta battery SOC interrupt to
help with this. Keep it disabled by default and enable it after
the charge termination. Disable it again when the user removes
the charger.
Since this needs delta battery SOC threshold to be configured,
add support for it.
Change-Id: Ic1a9f8a065c87efe88e315f2b2e1e1378151531b
Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
Delta MSOC and BSOC interrupts need to be configured only for
the rising edge as that is sufficient to handle most of the
actions to be done responding to them. Update the interrupt
configurations for pmi8998 and pm660.
Change-Id: I84d6d009c3b5227869309570d94c62bde6bea710
Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
When FG is restarted, RESTART_GO bit is set and it is cleared
only when the first estimate is done, signalled by SOC_READY
interrupt. If SOC_READY interrupt doesn't fire for some reason,
RESTART_GO bit will not get cleared. Fix this.
Change-Id: I99261d5020f5012ba0a4e35e543458f9e7b30210
Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
During battery hotswap, a strong charger will be supplying enough
current to keep the device up and running. Currently, FG driver
shows up the monotonic SOC and voltage as-is (which is zero) to
the battery power supply and hence to the userspace.
Show a fake battery SOC (50%) and fake battery voltage (3.7 V)
when the battery is missing. If a strong charger is not present,
then the device will be powered down anyways.
Change-Id: Ia2c85d1e75bbf0c937a7e36e786362c473c7f7cd
Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
This patch introduces a new binder_fd_array object,
that allows us to support one or more file descriptors
embedded in a buffer that is scatter-gathered.
Change-Id: I273d7e00807eda4defc5c94c4bd86e4812e2c7a8
Signed-off-by: Martijn Coenen <maco@google.com>
Git-commit: 5b3e17679b
Git-repo: https://git.linaro.org/kernel/linux-linaro-stable
Signed-off-by: Neeraj Upadhyay <neeraju@codeaurora.org>
Previously all data passed over binder needed
to be serialized, with the exception of Binder
objects and file descriptors.
This patchs adds support for scatter-gathering raw
memory buffers into a binder transaction, avoiding
the need to first serialize them into a Parcel.
To remain backwards compatibile with existing
binder clients, it introduces two new command
ioctls for this purpose - BC_TRANSACTION_SG and
BC_REPLY_SG. These commands may only be used with
the new binder_transaction_data_sg structure,
which adds a field for the total size of the
buffers we are scatter-gathering.
Because memory buffers may contain pointers to
other buffers, we allow callers to specify
a parent buffer and an offset into it, to indicate
this is a location pointing to the buffer that
we are fixing up. The kernel will then take care
of fixing up the pointer to that buffer as well.
Change-Id: Ia9bb2c588d932b6627a04baf4a62a09ae6aca087
Signed-off-by: Martijn Coenen <maco@google.com>
Git-commit: 34b8f97791
Git-repo: https://git.linaro.org/kernel/linux-linaro-stable
[tsoni@codeaurora.org: Fixed 32 bit compilation]
Signed-off-by: Neeraj Upadhyay <neeraju@codeaurora.org>
Signed-off-by: Trilok Soni <tsoni@codeaurora.org>
The binder_buffer allocator currently only allocates
space for the data and offsets buffers of a Parcel.
This change allows for requesting an additional chunk
of data in the buffer, which can for example be used
to hold additional meta-data about the transaction
(eg a security context).
Change-Id: Iabf59a64ff66a0457a9aa7077aef219c3dc05ba8
Signed-off-by: Martijn Coenen <maco@google.com>
Git-commit: d7c114e9e7
Git-repo: https://git.linaro.org/kernel/linux-linaro-stable
Signed-off-by: Neeraj Upadhyay <neeraju@codeaurora.org>
Moved handling of fixup for binder objects,
handles and file descriptors into separate
functions.
Change-Id: If68c2d93c3a42765cefda40dc807b39f6ab774c2
Signed-off-by: Martijn Coenen <maco@google.com>
Git-commit: 6ea3f1848b
Git-repo: https://git.linaro.org/kernel/linux-linaro-stable
Signed-off-by: Neeraj Upadhyay <neeraju@codeaurora.org>
Add a new module parameter 'devices', that can be
used to specify the names of the binder device
nodes we want to populate in /dev.
Each device node has its own context manager, and
is therefore logically separated from all the other
device nodes.
The config option CONFIG_ANDROID_BINDER_DEVICES can
be used to set the default value of the parameter.
This approach was favored over using IPC namespaces,
mostly because we require a single process to be a
part of multiple binder contexts, which seemed harder
to achieve with namespaces.
Change-Id: Idc765f6186282bdfcf95960d7b4168c5f0992c31
Signed-off-by: Martijn Coenen <maco@google.com>
Git-commit: 5711c305d2
Git-repo: https://git.linaro.org/kernel/linux-linaro-stable
Signed-off-by: Neeraj Upadhyay <neeraju@codeaurora.org>
Move the context manager state into a separate
struct context, and allow for each process to have
its own context associated with it.
Change-Id: I2a1c9adbc01ce1125e4f8661898e7ea4b4904ebe
Signed-off-by: Martijn Coenen <maco@google.com>
Git-commit: e11560a518
Git-repo: https://git.linaro.org/kernel/linux-linaro-stable
Signed-off-by: Neeraj Upadhyay <neeraju@codeaurora.org>
flat_binder_object is used for both handling
binder objects and file descriptors, even though
the two are mostly independent. Since we'll
have more fixup objects in binder in the future,
instead of extending flat_binder_object again,
split out file descriptors to their own object
while retaining backwards compatibility to
existing user-space clients. All binder objects
just share a header.
Change-Id: Ife64444979fba493c1865d2e4f4213ec26d03720
Signed-off-by: Martijn Coenen <maco@google.com>
Git-commit: d8e0aca03a
Git-repo: https://git.linaro.org/kernel/linux-linaro-stable
[neeraju@codeaurora.org: resolve trivial merge conflicts]
Signed-off-by: Neeraj Upadhyay <neeraju@codeaurora.org>
With the new chipset wcn3990 and new firmware HL-1.0, management
is supported via the WMI rather than legacy HTT.
Add support for the management over wmi for the ath10k driver.
CRs-Fixed: 2000484
Change-Id: Iaf387243d63870e063b3b5bf34cd7232dae921fc
Signed-off-by: Rakesh Pillai <pillair@codeaurora.org>
WCN3990 target needs different value for scan flags.
Add proper scan flags for WCN3990 and attach based
on hardware detected.
CRs-Fixed: 1115143
Change-Id: Ie4c02adb5ae65e12d250389d945e048cb6720479
Signed-off-by: Rakesh Pillai <pillair@codeaurora.org>
WCN3990 does not uses BMI for fw download.
Refactor startup sequence to support non BMI
platform.
CRs-Fixed: 1114413
Change-Id: I1e1f5c3808decf319474629ab257ae908895f3a8
Signed-off-by: Govind Singh <govinds@codeaurora.org>
HW checksum is not enabled in current release
of WCN3990.
Disable HW checksum for WCN3990.
CRs-Fixed: 2000365
Change-Id: I3b8ee3664150ee8c0c2a8fe9ed1d61c6d32f16b0
Signed-off-by: Govind Singh <govinds@codeaurora.org>
vdev params are being set after vdev is in down state, this
is resulting in firmware crash.
Fix this by skipping vdev access after vdev is in down state.
CRs-Fixed: 2000365
Change-Id: Ib15f038624682fb324fbd5c43fa5cddf462443cd
Signed-off-by: Govind Singh <govinds@codeaurora.org>
Add restriction in msm_dolby_dap_param_to_get_control_get
function to avoid reading buffer data with index over
buffer size.
Change-Id: I2bd443d4db1a272d20341fbb5b15891a8acf0bc8
CRs-Fixed: 1096076
Signed-off-by: Yidong Huang <yidongh@codeaurora.org>
WCN3990 is a 37 bit target and needs DMA_MAP of 37 bits.
The HTT RX datapath currently uses 32-bit address.
Refactor the HTT RX datapath to enable DMA MAP of 37 bits for WCN3990.
Fix ath10k_htt_rx_h_ppdu API usage.
CRs-Fixed: 2000491
Change-Id: I3d1505202a899796b0bfa7975844e3700326bfdf
Signed-off-by: Rakesh Pillai <pillair@codeaurora.org>
While enabling ICE setup and on error conditions, the regulator
is disabled. Before disabling the regulator, check if the
regulator is up and able to access the registers of regulator.
Change-Id: I94dd2b3e25444818f7bdf2f791f4fa9efaefce15
Signed-off-by: Brahmaji K <bkomma@codeaurora.org>
rmnet_data netlink handler currently does not check for the
incoming process pid and instead just loops back the pid.
A malicious root user could potentially send a message with
source pid 0 and this could cause rmnet_data to loop the message
back till an out of memory situation occurs.
rmnet_data also does not check for the message length of the
incoming netlink messages and instead casts the netlink message
without checking for the boundary.
Fix these two scenarios by adding the pid and message length checks
respectively.
Bug: 31252965
CRs-Fixed: 1098801
Change-Id: I172c1a7112e67e82959b397af7ddfd963d819bdc
Signed-off-by: Conner Huff <chuff@codeaurora.org>
In some cases it is useful to manually force the controller to
run at certain speeds (USB 2.0 or USB 3.0 speeds). For example,
EUD (Emebedded USB Debug) can only work when controller is
operating in USB 2.0 speeds. User can force USB 2.0 if EUD is
required.
Change-Id: Id022f372014a9218537bd1b5477d4555aff4578c
Signed-off-by: Vamsi Krishna Samavedam <vskrishn@codeaurora.org>