Commit graph

575924 commits

Author SHA1 Message Date
Subbaraman Narayanamurthy
110f63422b qpnp-fg-gen3: fg-util: Do not allow SRAM access when battery is missing
When the battery is removed and a strong charger is plugged in,
device will be kept powered. However, because of missing battery
SRAM access over IMA can fail leading to errors. Eventually, the
errors will go away when the battery is inserted again. However,
if the user tries to access SRAM registers or bms power supply
properties, it can cause further errors flooding logs. Handle
this gracefully by returning an error upon battery missing is
detected.

CRs-Fixed: 1072401
Change-Id: I764442548cb076dad89856d75394ef9cf355f83a
Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
2016-10-10 09:44:07 -07:00
Subbaraman Narayanamurthy
906f1b29ae qpnp-fg-gen3: fix reading OCV and Vbatt predicted values
Open circuit voltage and predicted battery voltage are read from
16 bits. However, the real value is present only in 15 bits.
Mask the bit 16 to get the proper readings.

Change-Id: I196ccc64fd221fead87a88f43dce1a21ba800908
Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
2016-10-10 09:44:06 -07:00
Subbaraman Narayanamurthy
0edd25653c qpnp-fg-gen3: add support to restart fuel gauge
Add a module parameter "fg_restart" to restart the fuel gauge
without loading the battery profile. This will be useful in
geting a fresh SOC estimate whenever required.

Change-Id: I0c054ad523a0eab72f777d010807bb3a55f63f7e
Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
2016-10-10 09:44:05 -07:00
Subbaraman Narayanamurthy
cdb65a95a8 power: qpnp-fg-gen3: add capacity learning feature
Batteries age across the time. Capacity learning is a feature
which uses the hardware autonomous coulomb counter to determine
the actual battery capacity against the advertised full capacity.
This will be useful to determine how much degradation has
happened to the battery. Capacity learning algorithm will start
based on some pre-set conditions like start SOC, battery
temperature and ends when the charging cycle is complete.

Actual capacity will be exposed through charge_full property.

Change-Id: I89cc14d213b0de10bc8d052dd76e1468fe9c30e5
Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
2016-10-10 09:44:05 -07:00
Subbaraman Narayanamurthy
bd811f3afd qpnp-fg-gen3: Add support to configure force battery profile loading
Currently, FG_GEN3 driver loads the battery profile if it finds
out the profile loaded earlier doesn't match with the available
profile. This will be done when the profile integrity bit is
set already. Make this force profile loading as a configurable
parameter through a device tree property.

While at it, add a module parameter to dump the profile contents
conditionally. This will be helpful in debugging.

Change-Id: Ibaff55aa5434ee283e6d597485d193e9e52bb74e
Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
2016-10-10 09:44:04 -07:00
Nicholas Troast
9435c04228 qpnp-fg-gen3: disable msoc-full and bsoc-delta IRQs as wakeup sources
msoc-full is not used to determine when the battery is full. The charger
will wakeup the device when it has terminated charging indicating that
the battery is full. Disable the msoc-full IRQ as a wakeup source.

The msoc-delta IRQ is used to wakeup the device when the SOC changes
therefore having the bsoc-delta IRQ as a wakeup source is unnecessary.
Disable the bsoc-delta IRQ as a wakeup source.

Change-Id: Iab7087ce3d6727abc852d3a84590cfa570ec584d
Signed-off-by: Nicholas Troast <ntroast@codeaurora.org>
2016-10-10 09:44:03 -07:00
Subbaraman Narayanamurthy
5b6c4f8f1b qpnp-fg-gen3: change the encoding for delta soc threshold
Currently, delta SOC threshold is written as a 8 bit value but
the encoding is in 11 bits. This will cause the delta SOC
threshold programmed to a lower value causing interrupts to fire
quickly. Change the numerator of delta SOC SRAM parameter so that
the delta SOC threshold will be set correctly. Maximum possible
threshold will be 12.45% (1/2048 * 255).

Change-Id: Ia908c917d71939b9d72b16ddca3400a692540bf3
Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
2016-10-10 09:44:02 -07:00
Subbaraman Narayanamurthy
16b979380c ARM: dts: msm: add CC_CV threshold to itech/ascent FG_GEN3 battery profiles
Configure CC_CV threshold voltage to 4.34V for both itech and
ascent battery profiles that will be used by GEN3 fuel gauge
on pmicobalt.

CRs-Fixed: 1068593
Change-Id: I7df3d343afa62ffdbf6f5db8c7fc7d94e2f0e3a0
Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
2016-10-10 09:44:02 -07:00
Subbaraman Narayanamurthy
5870397614 power: qpnp-fg-gen3: add support to configure VBtGTFltTh and VBtFull
Based on the battery profile parameters, Vbatt greater than float
voltage and full voltage thresholds needs to be configured. Add
support for the same. Since this needs the battery profile
parameters to be read in advance before the hardware is
initialized, shuffle the code to get battery profile early.

CRs-Fixed: 1068593
Change-Id: If5df62d933cc653a276967b3d16c080c6d4ecb2e
Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
2016-10-10 09:43:33 -07:00
Hardik Kantilal Patel
a421f9710c defconfig: Enable CONFIG_ICNSS_DEBUG for msmfalcon
Enable CONFIG_ICNSS_DEBUG to enable driver debugging.

CRs-fixed: 1076049
Change-Id: I0d97a9aca9525da4aee6a9ddbf97849cd9c11a55
Signed-off-by: Hardik Kantilal Patel <hkpatel@codeaurora.org>
2016-10-10 06:14:51 -07:00
Linux Build Service Account
1fac7f53bd Merge "input: misc: pat9125: fix issues found in static analysis" 2016-10-10 05:57:59 -07:00
Linux Build Service Account
d1df49872e Merge "ASoC: msm: create backend dailink for wcd934x MAD" 2016-10-10 05:57:59 -07:00
Linux Build Service Account
f6179aab9b Merge "ASoC: soundwire: add null check before pointer dereference." 2016-10-10 05:57:50 -07:00
Vevek Venkatesan
72ce5ca478 input: misc: pat9125: code clean-up in pat9125 driver
Remove redundant code from the Pixart PAT9125 reference driver
- Remove unwanted struct declarations and definitions
- Remove unwanted header files
- Dynamically allocate platform data structure
- Change pr_err to dev_err
- Changes as per Linux coding guidelines
- Clean-up probe and remove routines
- Remove unwanted file operations
- Remove unused functions and variables

Change-Id: I71b1d2548dc07c21ab8f12327662f5bb6998cdcb
Signed-off-by: Vevek Venkatesan <vevekv@codeaurora.org>
Signed-off-by: Shantanu Jain <shjain@codeaurora.org>
2016-10-09 23:21:25 -07:00
Himanshu Aggarwal
01e2708af5 input: misc: pat9125: fix issues found in static analysis
Fix the following issues found in static analysis:
- missing blank lines after declarations
- unnecessary return in a void function
- exporting world writable files is usually an error
- block comments use * on subsequent and trailing lines
- Add DT binding description and vendor prefixe for the
driver.
- Add Linux Foundation copyright markings.

Change-Id: Id2ed9a6d4e31bd2acd3185bf7ef9c78f8a41cf36
Signed-off-by: Himanshu Aggarwal <haggarwa@codeaurora.org>
Signed-off-by: Vevek Venkatesan <vevekv@codeaurora.org>
Signed-off-by: Shantanu Jain <shjain@codeaurora.org>
2016-10-09 23:21:05 -07:00
Lawrence Liao
4e09168fe6 This is the reference driver source code for Pixart OTS PAT9125.
Change-Id: Ie366894e9e89707fa2950a7ffbfe4e93059a19a3
Signed-off-by: Lawrence Liao <lawrence_liao@pixart.com>
(cherry picked from commit dfc4349a8aa02bb0b7b0639ad5368a5c85f6520f)
Git-commit: dfc4349a8aa02bb0b7b0639ad5368a5c85f6520f
Git-repo: https://github.com/PixartOpen/pixart-sensor-db810-linux-driver
[shjain@codeaurora.org: removed below listed files from original
commit as they are not needed and to resolve trivial merge conflicts:
1. arch/arm/boot/dts/qcom/apq8094-dragonboard.dtsi
2. arch/arm/boot/dts/qcom/msm8994-pinctrl.dtsi
3. arch/arm/boot/dts/qcom/msm8994.dtsi
4. drivers/input/misc/Makefile
5. drivers/input/misc/ots_pat9125/Makefile
Remove the unused pieces of algorithm from the reference
driver of Pixart PAT9125 Rotating side button.]
Signed-off-by: Shantanu Jain <shjain@codeaurora.org>
2016-10-10 11:48:08 +05:30
Linux Build Service Account
6bbaf84de6 Merge "wil6210: initial support for FTM and AOA" 2016-10-09 21:17:55 -07:00
Linux Build Service Account
8463e7300c Merge "ARM: dts: msm: Add IMEM dload-type entry for MSM8996 and MSMCOBALT" 2016-10-09 21:17:53 -07:00
Linux Build Service Account
34b3dfc782 Merge "soc: qcom: handle wdsp glink state notifications" 2016-10-09 21:17:52 -07:00
Linux Build Service Account
7bc3eae82e Merge "regulator: correct name used in debug consumer regulator_get call" 2016-10-09 21:17:51 -07:00
Linux Build Service Account
31131180a1 Merge "genirq: Avoid race between cpu hot plug and irq_desc() allocation paths" 2016-10-09 21:17:51 -07:00
Linux Build Service Account
132aa7560b Merge "ARM: dts: msm: Add icnss node for msmtriton" 2016-10-09 21:17:50 -07:00
Linux Build Service Account
62575a58aa Merge "ARM: dts: msm: Add icnss node for msmfalcon" 2016-10-09 21:17:49 -07:00
Linux Build Service Account
cd3b78c8ff Merge "ARM: dts: msm: add ion heaps for msmtriton" 2016-10-09 21:17:49 -07:00
Linux Build Service Account
8e23ae41f3 Merge "qcom-charger: update qc charger detection for PMICv2" 2016-10-09 21:17:46 -07:00
Abhimanyu Kapur
ddc2bf61b5 ARM: dts: msm: Add IMEM dload-type entry for MSM8996 and MSMCOBALT
Add IMEM dload-entry to support emmc dload feature
for msm8996 and msmcobalt SOCs.

CRs-Fixed: 993510
Change-Id: I0d26049817ce8d8172ee364b5d7a31ebdcb64194
Signed-off-by: Abhimanyu Kapur <abhimany@codeaurora.org>
2016-10-09 20:22:00 -07:00
Walter Yang
3b29155a55 ASoC: msm: create backend dailink for wcd934x MAD
To support ADSP SVA on wcd934x, dedicated backend dailink needs
to be created. Add the dailink associating the specific cpu dai
and the MAD codec dai.

CRs-Fixed: 1070327
Change-Id: I4152d81e4e951216a8ecdd93562eb1740dbb962c
Signed-off-by: Walter Yang <yandongy@codeaurora.org>
2016-10-09 19:43:51 -07:00
Linux Build Service Account
34b975e502 Merge "ARM: dts: msm: Update DCVS table for msmcobalt v2" 2016-10-08 18:29:38 -07:00
Linux Build Service Account
89fd48e0ae Merge "msm: vidc: Keep v4l2 plane count instance-specific" 2016-10-08 18:29:36 -07:00
Linux Build Service Account
5f659ecb42 Merge "icnss: Wait uninterruptible for unregister driver" 2016-10-08 06:35:54 -07:00
Linux Build Service Account
062b309db9 Merge "icnss: Prevent suspend while processing events" 2016-10-08 06:35:53 -07:00
Linux Build Service Account
3ffe336b5e Merge "msm: vidc: Selectively handle SYS_ERROR as FATAL" 2016-10-07 22:15:44 -07:00
Linux Build Service Account
dc9ba857fb Merge "msm: sde: Reject 0 size image for SDE rotator" 2016-10-07 22:15:43 -07:00
Linux Build Service Account
7685c7eae7 Merge "msm: kgsl: Get GPU snapshot if wait for global timestamp timeout" 2016-10-07 22:15:42 -07:00
Linux Build Service Account
49042f0e43 Merge "icnss: Provide API to check QMI support" 2016-10-07 22:15:42 -07:00
Linux Build Service Account
4eff38d585 Merge "msm: kgsl: Disable UCHE global filter" 2016-10-07 22:15:41 -07:00
Linux Build Service Account
5b3cec6473 Merge "usb: host: Flush hub workqueue before stopping controller" 2016-10-07 22:15:40 -07:00
Linux Build Service Account
eb3e44cc3f Merge "qpnp-smb2: smb-lib: add charge_done property" 2016-10-07 22:15:39 -07:00
Linux Build Service Account
8e2bd84fbe Merge "ARM: dts: msm: Add support to read FAB ID for PMICOBALT" 2016-10-07 22:15:37 -07:00
Linux Build Service Account
cd4a503c83 Merge "soc:qcom: common_log: change PMIC dump size from 4k to 64k" 2016-10-07 22:15:36 -07:00
Linux Build Service Account
c68dd38b5e Merge "power: reset: Skip emmc_dload sysfs entry creation" 2016-10-07 22:15:34 -07:00
Linux Build Service Account
b08e398913 Merge "msm: rpm-smd-debug: Remove unwanted pr_info" 2016-10-07 22:15:33 -07:00
Vidyakumar Athota
763a423ad5 soc: qcom: handle wdsp glink state notifications
When WDSP has crashed, G-link link state is updated with
GLINK_LINK_STATE_DOWN and remote side channels are closed.
Handle the link state down notification from G-link and
close the channels from local side when remote disconnect
channel event occurs.

Change-Id: Id956256fbb3ea6b18a3685a34dcd1f9b16e71e92
Signed-off-by: Vidyakumar Athota <vathota@codeaurora.org>
2016-10-07 17:19:29 -07:00
Oleg Perelet
7ef8974606 msm: kgsl: Remove GPU BCL and LMH support
a540 hardware does not support BCL and LMH after all.

CRs-Fixed: 1075694
Change-Id: I09808145d20ded63b5043cae6510429560cb599e
Signed-off-by: Oleg Perelet <operelet@codeaurora.org>
2016-10-07 14:45:26 -07:00
David Collins
7ff3a4cc82 regulator: correct name used in debug consumer regulator_get call
Call rdev_get_name() to obtain the name to use in the debug
consumer's regulator_get() call so that the debug consumer finds
the correct regulator when the name differs in the constraints
and desc structs.

Change-Id: Id6a47467cd118c89c8f58d1120381d4c64f8efee
CRs-Fixed: 1075693
Signed-off-by: David Collins <collinsd@codeaurora.org>
2016-10-07 13:59:18 -07:00
Siddartha Mohanadoss
0b3b8868b2 ARM: dts: msm: Add revid phandle to read FAB ID
Temperature compensation is needed for charger die
temperature. Offset and slope coefficients are applied
based on the FAB ID read from the REVID peripheral.

Change-Id: I8516a8109b8c9316dafbd547635d4c97bd50be0c
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
2016-10-07 13:36:33 -07:00
Siddartha Mohanadoss
a6a12dfeff iio: rradc: Add temperature compensation for die temperature
Add charger die temperature scaling coefficients based
on FAB ID. If FAB ID support is not available from the
REVID peripheral the driver does not report scaled
temperature for charger die temperature. Update temperature
compensation for PMIC die temperature.

Change-Id: I8864dccc1b53e70dac5d54129339e7224ec8ba67
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
2016-10-07 13:36:25 -07:00
Prasad Sodagudi
4e38f843b6 genirq: Avoid race between cpu hot plug and irq_desc() allocation paths
One of the core might have just allocated irq_desc() and other core
might be doing irq migration in the hot plug path. In the hot plug path
during the IRQ migration, for_each_active_irq macro is trying to get
irqs whose bits are set in allocated_irqs bit map but there is no return
value check after irq_to_desc for desc validity.

[   24.566381] msm_thermal:do_core_control Set Offline: CPU4 Temp: 73
[   24.568821] Unable to handle kernel NULL pointer dereference at virtual address 000000a4
[   24.568931] pgd = ffffffc002184000
[   24.568995] [000000a4] *pgd=0000000178df5003, *pud=0000000178df5003, *pmd=0000000178df6003, *pte=0060000017a00707
[   24.569153] ------------[ cut here ]------------
[   24.569228] Kernel BUG at ffffffc0000f3060 [verbose debug info unavailable]
[   24.569334] Internal error: Oops - BUG: 96000005 [#1] PREEMPT SMP
[   24.569422] Modules linked in:
[   24.569486] CPU: 4 PID: 28 Comm: migration/4 Tainted: G        W       4.4.8-perf-9407222-eng #1
[   24.569684] task: ffffffc0f28f0e80 ti: ffffffc0f2a84000 task.ti: ffffffc0f2a84000
[   24.569785] PC is at do_raw_spin_lock+0x20/0x160
[   24.569859] LR is at _raw_spin_lock+0x34/0x40
[   24.569931] pc : [<ffffffc0000f3060>] lr : [<ffffffc001023dec>] pstate: 200001c5
[   24.570029] sp : ffffffc0f2a87bc0
[   24.570091] x29: ffffffc0f2a87bc0 x28: ffffffc001033988
[   24.570174] x27: ffffffc001adebb0 x26: 0000000000000000
[   24.570257] x25: 00000000000000a0 x24: 0000000000000020
[   24.570339] x23: ffffffc001033978 x22: ffffffc001adeb80
[   24.570421] x21: 000000000000027e x20: 0000000000000000
[   24.570502] x19: 00000000000000a0 x18: 000000000000000d
[   24.570584] x17: 0000000000005f00 x16: 0000000000000003
[   24.570666] x15: 000000000000bd39 x14: 0ffffffffffffffe
[   24.570748] x13: 0000000000000000 x12: 0000000000000018
[   24.570829] x11: 0101010101010101 x10: 7f7f7f7f7f7f7f7f
[   24.570911] x9 : fefefefeff332e6d x8 : 7f7f7f7f7f7f7f7f
[   24.570993] x7 : ffffffc00344f6a0 x6 : 0000000000000000
[   24.571075] x5 : 0000000000000001 x4 : ffffffc00344f488
[   24.571157] x3 : 0000000000000000 x2 : 0000000000000000
[   24.571238] x1 : ffffffc0f2a84000 x0 : 0000000000004ead
...
...
...
[   24.581324] Call trace:
[   24.581379] [<ffffffc0000f3060>] do_raw_spin_lock+0x20/0x160
[   24.581463] [<ffffffc001023dec>] _raw_spin_lock+0x34/0x40
[   24.581546] [<ffffffc000103f10>] irq_migrate_all_off_this_cpu+0x84/0x1c4
[   24.581641] [<ffffffc00008ec84>] __cpu_disable+0x54/0x74
[   24.581722] [<ffffffc0000a3368>] take_cpu_down+0x1c/0x58
[   24.581803] [<ffffffc00013ac08>] multi_cpu_stop+0xb0/0x10c
[   24.581885] [<ffffffc00013ad60>] cpu_stopper_thread+0xb8/0x184
[   24.581972] [<ffffffc0000c4920>] smpboot_thread_fn+0x26c/0x290
[   24.582057] [<ffffffc0000c0f84>] kthread+0x100/0x108
[   24.582135] Code: aa0003f3 aa1e03e0 d503201f 5289d5a0 (b9400661)
[   24.582224] ---[ end trace 609f38584306f5d9 ]---

CRs-Fixed: 1074611
Change-Id: I6cc5399e511b6d62ec7fbc4cac21f4f41023520e
Signed-off-by: Prasad Sodagudi <psodagud@codeaurora.org>
Signed-off-by: Trilok Soni <tsoni@codeaurora.org>
Signed-off-by: Runmin Wang <runminw@codeaurora.org>
2016-10-07 13:07:10 -07:00
Linux Build Service Account
abdd37fc4b Merge "qpnp-smb2: do not configure BATT_OV to end charging cycle" 2016-10-07 12:20:04 -07:00
Linux Build Service Account
4a8282128c Merge "clk: msm: clock-osm: Update OSM timers and enable PLL droop override" 2016-10-07 12:20:02 -07:00