Commit graph

1361 commits

Author SHA1 Message Date
Linux Build Service Account
78cf186b80 Merge "qpnp-fg-gen3: export the battery float voltage" 2016-08-26 22:23:00 -07:00
Linux Build Service Account
97cb0bb99f Merge "qcom-charger: smb-lib: correct the usb suspend votable name" 2016-08-26 22:23:00 -07:00
Linux Build Service Account
8dff1db3bc Merge "qcom-charger: qpnp-fg-gen3: add v2 SRAM register map" 2016-08-26 22:22:59 -07:00
Linux Build Service Account
9e59905b59 Merge "qcom-charger: smb138x: fix buck damage on v1.1 hardware" 2016-08-26 22:22:47 -07:00
Linux Build Service Account
d319bf625a Merge "qcom_charger: smb-lib: support faking battery capacity" 2016-08-26 14:48:51 -07:00
Linux Build Service Account
cf174274e9 Merge "qcom-charger: expand data structure smb_chg_param" 2016-08-26 14:48:19 -07:00
Abhijeet Dharmapurikar
52bf80303d qcom_charger: smb-lib: support faking battery capacity
On debug setups where the battery is not present, we need a way
to fake battery capacity instead of reporting some incorrect
/non-existent value. Provide means for the userspace to setup
a fake battery capacity.

Change-Id: Iff3ee1009d9c3215433cc267f016ef9cf2a9bff2
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
2016-08-25 15:55:39 -07:00
Abhijeet Dharmapurikar
79c88a3bdb qpnp-fg-gen3: export the battery float voltage
Implement VOLTAGE_MAX_DESIGN to expose the battery float voltage. This
property will reflect the values read from battery profile and will
will be used for setting the max voltage on charging chips.

Change-Id: I4b9028f8930ac2f3de6c043fa145494f37322160
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
2016-08-25 14:23:37 -07:00
Abhijeet Dharmapurikar
67d71eb938 qcom-charger: smb-lib: correct the usb suspend votable name
Currently the name of the votable that suspends usb is INPUT_SUSPEND.
However, the PMI has two inputs - USB and DC. The dc suspending votable
is correctly named DC_SUSPEND. So rename the INPUT_SUSPEND to an
appropriate name - USB_SUSPEND.

Change-Id: Ia5ea1b139f5e9d560dc6492aa9fc13ffeeda83ca
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
2016-08-25 14:22:52 -07:00
Nicholas Troast
ca38df6d39 qcom-charger: qpnp-fg-gen3: add v2 SRAM register map
The location of some fuel gauge SRAM registers have changed in
PMICOBALT v2. Add a new SRAM register map for v2 to handle these changes.

Change-Id: I1fcfce8e56b1d4e8b8f54457193cd547fb5e3de7
Signed-off-by: Nicholas Troast <ntroast@codeaurora.org>
2016-08-24 15:23:43 -07:00
Abhijeet Dharmapurikar
c56229417c qcom-charger: smb138x: fix buck damage on v1.1 hardware
Buck damage was seen to go away once the dead time were increased
in addition to increasing the OOB comparator threshold.

CRs-Fixed: 1055113
Change-Id: I8979d203fc7c35ec23e23874c8dd8f980a1cc619
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
2016-08-23 12:04:24 -07:00
Abhijeet Dharmapurikar
aecb04a1c3 smb138x: fix WD bite
Commit 85635da429 ("qcom-charger: smb138x: fix buck damage on
v1.1 hardware") introduced wa_flags as the first member
in the struct. However there are implict assumptions in the driver that
the first member is the library structure. This causes memory corruption
and an eventual watch dog bite reset.

Fix it by ensuring that the library struct is explicitly initialized
from the parent struct.

CRs-Fixed: 1055113
Change-Id: I38474a228ec7b245dc330b4a37847c9f1bf29c2a
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
2016-08-23 12:04:13 -07:00
Linux Build Service Account
c806677972 Merge "qcom-charger: qpnp-fg-gen3: increase ESR timer during suspend" 2016-08-19 05:29:25 -07:00
Nicholas Troast
36e5d56a0e qcom-charger: qpnp-fg-gen3: increase ESR timer during suspend
ESR pulses consume too much power during sleep states.

Add device tree properties to allow configuration of the ESR timing during
charging, discharging while awake, and discharging while asleep.

Configure these new device tree properties to increase the ESR timer
while in a sleep state to save power.

Change-Id: I673ab1a5713023ac4ab0271fec8d9a053df1c046
Signed-off-by: Nicholas Troast <ntroast@codeaurora.org>
2016-08-18 13:31:22 -07:00
Nicholas Troast
59e8c0d0d5 qcom-charger: qpnp-fg-gen3: add flag to bypass SRAM read/write wake lock
In the suspend path a wakelock should not be held. Add a flag to bypass
holding a wakelock during an SRAM read or write so that they can be used
in the suspend path.

Change-Id: I74ccae4e9b5aeccf261cc94e9bb89138d7d48345
Signed-off-by: Nicholas Troast <ntroast@codeaurora.org>
2016-08-18 13:30:41 -07:00
Linux Build Service Account
275e328705 Merge "qcom-charger: smb138x: fix buck damage on v1.1 hardware" 2016-08-18 12:04:52 -07:00
Lijuan Gao
cb761170c7 drivers: power: reset: Do warm reset when device reboot to edl
Device reboot to edl, it's for switching device to emergency dload mode.
So it's need to keep device to do warm reset.

Change-Id: I8f5d0845c6f2d37ea740949ce56e02c4cc7412be
Signed-off-by: Lijuan Gao <lijuang@codeaurora.org>
2016-08-18 00:11:45 -07:00
Harry Yang
4d1e66e5e5 qcom-charger: expand data structure smb_chg_param
Add callback function members in data structure smb_chg_param to
handle data conversions other than the default provided in the
existing framework.

CRs-Fixed: 1052854
Change-Id: I0f4f0e1e67f3097b567db006a7826a2d1fd7c2d6
Signed-off-by: Harry Yang <harryy@codeaurora.org>
2016-08-17 13:21:51 -07:00
Abhijeet Dharmapurikar
85635da429 qcom-charger: smb138x: fix buck damage on v1.1 hardware
Buck damage was observed because the OOB comparator activated
when HSFET was on, causing a direct short from VBUS to ground. Fix this
on V1.1 by increasing the OOB comparator threshold. On 2.0 this is fixed
by ensuring the OOB comparator activates only after HSFET minimum on
time. This in turn guarantees that HSFET and LSFET won't be on at the
same time.

Since the driver needs to detect the version of the smb, make use of the
qpnp-revid module.

CRs-Fixed: 1055113
Change-Id: I0a7946db2f1bdacf1974fb508da46f2ed4dadadc
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
2016-08-17 10:49:58 -07:00
Linux Build Service Account
d736395565 Merge "qcom-charger: smblib: update batt capacity status from bms" 2016-08-13 23:13:08 -07:00
Linux Build Service Account
f4b1836237 Merge "qcom-charger: smblib: update ICL votings in parallel charging" 2016-08-13 23:13:06 -07:00
Linux Build Service Account
06a047a77f Merge "qcom-charger: qpnp-fg-gen3: remove wakelock when reading SRAM props" 2016-08-13 23:13:03 -07:00
Linux Build Service Account
5abea2b1d9 Merge "qcom-charger: smb138x-charger: add parallel enable status properties" 2016-08-11 12:48:35 -07:00
Nicholas Troast
d59d299625 qcom-charger: qpnp-fg-gen3: remove wakelock when reading SRAM props
A wakelock is held when reading an SRAM prop. A wakelock is already held
when the SRAM read happens, so it is not necessary to hold a wakelock
again. Remove it.

Change-Id: I7bf5cafd34bd9187a13043f0995a49d2f26b8b6b
Signed-off-by: Nicholas Troast <ntroast@codeaurora.org>
2016-08-05 13:52:14 -07:00
Harry Yang
ad3847ae42 qcom-charger: smblib: update batt capacity status from bms
Import batt capacity status from bms, and notify userspace.

CRs-Fixed: 1048135
Change-Id: I76357e44452a8c16fe96df47af06ddab021c8f3f
Signed-off-by: Harry Yang <harryy@codeaurora.org>
2016-08-04 12:21:41 -07:00
Linux Build Service Account
bb61ebf654 Merge "qcom-charger: qpnp-smb2: use values from hardware for default settings" 2016-08-03 21:12:47 -07:00
Harry Yang
291f50a4a7 qcom-charger: smblib: update ICL votings in parallel charging
Add ICL vote to disable parallel charging on charger removal, as ICL
drops below the input threshold for parallel charging.

CRs-Fixed: 1049921
Change-Id: I8112070f7dd1eb385996b4f228ad288b51771e25
Signed-off-by: Harry Yang <harryy@codeaurora.org>
2016-08-03 11:06:54 -07:00
Linux Build Service Account
543fbd2090 Merge "power_supply: add CHARGER_TEMP and CHARGER_TEMP_MAX properties" 2016-08-03 04:58:34 -07:00
Linux Build Service Account
61e7996093 Merge "qcom-charger: qpnp-smb2: End charge cycle while battery is OV" 2016-08-03 04:58:33 -07:00
Linux Build Service Account
d80ef4e796 Merge "qcom-charger: add support for WiPower" 2016-08-03 04:58:29 -07:00
Linux Build Service Account
ade5764cd3 Merge "smb-lib: Add support for thermal daemon throttling fcc" 2016-08-02 21:58:47 -07:00
Nicholas Troast
081e422149 qcom-charger: smb138x-charger: add parallel enable status properties
There are several ways that the parallel charger can be enabled, and
disabled. Currently charging is enabled by default, but the hardware has
the option to disable the parallel charger via the CHG_EN pin on the
parallel charger. The parallel charger driver controls when the
parallel charger is enabled via the input suspend bit.

To better understand the state of the parallel charger add two power
supply properties to the parallel power supply:

CHARGING_ENABLED	- Reflects whether the parallel charger is
			  enabled by any source.
PIN_ENABLED		- Reflects whether hardware has voted to enable
			  the parallel charger.

Change-Id: I725245178ab02c5ec39b89998f5c2ca3d494c8ee
Signed-off-by: Nicholas Troast <ntroast@codeaurora.org>
2016-08-02 14:03:21 -07:00
Nicholas Troast
9c58552698 power_supply: add PIN_ENABLED property
Hardware disables the parallel charger via the CHG_EN pin. Add a new
property called PIN_ENABLED which reflects the status of the CHG_EN pin.

Change-Id: I79f95b145176b66d6b8cec5a21922ea16c2c8206
Signed-off-by: Nicholas Troast <ntroast@codeaurora.org>
2016-08-02 14:02:41 -07:00
Linux Build Service Account
aec1c3826b Merge "qcom-charger: qpnp-smb2: disable vbus-error IRQ trigger" 2016-08-01 21:56:45 -07:00
Linux Build Service Account
14051dfb5d Merge "smb-lib: introduce votable to disable charging" 2016-08-01 21:56:32 -07:00
Nicholas Troast
5bd071c647 power_supply: add CHARGER_TEMP and CHARGER_TEMP_MAX properties
CHARGER_TEMP reflects the temperature of the charging chip, and
CHARGER_TEMP_MAX reflects the temperature threshold at which the
hardware will take action to reduce the temperature of the charger.

Change-Id: I9cba8e370c753ac5aa33252fce0ea446f061b4c0
Signed-off-by: Nicholas Troast <ntroast@codeaurora.org>
2016-08-01 10:29:26 -07:00
Nicholas Troast
82ee420ef8 qcom-charger: qpnp-smb2: use values from hardware for default settings
Currently some hardware default charge settings are modified with
software default charge settings. Remove the software default settings,
and use only the device tree properties for changing the hardware
defaults.

Change-Id: I02a0cbbf547aacc5e813d027a2f3623cc01e1dd6
Signed-off-by: Nicholas Troast <ntroast@codeaurora.org>
2016-07-29 17:12:01 -07:00
Nicholas Troast
896365001e qcom-charger: qpnp-smb2: End charge cycle while battery is OV
Currently the charge cycle continues while the battery is OV. Configure
the charger to end the charge cycle while battery is OV.

Change-Id: I6fc333e15c5f0410c6b560b2a7005a1752f5f936
Signed-off-by: Nicholas Troast <ntroast@codeaurora.org>
2016-07-29 17:01:36 -07:00
Nicholas Troast
773ed5bace qcom-charger: qpnp-smb2: disable vbus-error IRQ trigger
When a Type-C legacy cable is connected to the phone but left unconnected
on the other side an interrupt storm can be observed which is caused by
the vbus-error interrupt trigger. Disable this interrupt trigger.

Change-Id: I5342c58acc83ecff4bf5f8e425de94daa1dabb50
Signed-off-by: Nicholas Troast <ntroast@codeaurora.org>
2016-07-29 16:51:05 -07:00
Harry Yang
4e4144f643 qcom-charger: add support for WiPower
Add support for WiPower by instantiating DC power supply and the required
properties.

CRs-Fixed: 1044422
Change-Id: I81d2e3b67bf55460f40406328c5ad8c40851033a
Signed-off-by: Harry Yang <harryy@codeaurora.org>
2016-07-29 10:46:09 -07:00
Linux Build Service Account
006d8efe02 Merge "defconfig: msmcortex: Enable FG_GEN3 driver" 2016-07-27 19:27:15 -07:00
Linux Build Service Account
354d219f20 Merge "smb-lib: account for Jeita while distributing FCC" 2016-07-27 19:26:39 -07:00
Linux Build Service Account
e0ae1fb68b Merge "qcom-charger: smb-lib: fix secure register writes" 2016-07-27 19:26:28 -07:00
Linux Build Service Account
b241a4901e Merge "qcom-charger: qpnp-smb2: update battery charging status on input suspend" 2016-07-27 19:26:22 -07:00
Subbaraman Narayanamurthy
5a3dc17283 power: qcom-charger: fix possible out of bounds access for GEN3 FG driver
Fix the following things in fg-util.c which is included by GEN3
FG driver:

- Possible out of bounds access in fg_sram_dfs_reg_write() when
  using bytes_read from sscanf
- Fix uninitialized usage of variable in write_next_line_to_log()

Change-Id: If9e7ba5632d1b5f99d91bda6276d9123c37e4dc7
Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
2016-07-27 14:51:48 -07:00
Linux Build Service Account
ce3bf6addf Merge "ARM: dts: msm: add FG GEN3 device on pmicobalt" 2016-07-27 06:32:34 -07:00
Linux Build Service Account
cb50168ee3 Merge "qcom-charger: smb2: configure input from wipower" 2016-07-26 23:34:30 -07:00
Subbaraman Narayanamurthy
b08d3a6891 power: qcom-charger: add driver for GEN3 fuel gauge
GEN3 FG (fuel gauge) is a new hardware peripheral which cannot
be supported along with existing GEN1/GEN2 FG supported under
qpnp-fg.c. Some of the differences are listed below.

- No conventional memory access for accessing SRAM
- No OTP region for battery profile
- FTRIM registers will be loaded to SRAM
- SRAM partitioning and address format got changed completely
- Battery id detection done by RR_ADC
- Encoding/Decoding changes for battery parameters

Hence add a new driver to support this GEN3 FG. This driver
reads the battery parameters like voltage, current, temperature,
resistance etc. acquired by the FG hardware and expose to the
userspace through a power supply class device.

Change-Id: Ibcd6e49c7dc7c3520527bcf9553296e846fb7458
Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
2016-07-26 12:08:49 -07:00
Linux Build Service Account
10b41ef511 Merge "of_batterydata: Pass battery id directly to find battery profile" 2016-07-22 08:56:33 -07:00
Subbaraman Narayanamurthy
f56fc4b5af of_batterydata: Pass battery id directly to find battery profile
Currently power supply name is passed to get the battery profile
in of_batterydata_get_best_profile(). This creates a dependency
of waiting for the driver that has the power supply class device.

Improve this by passing the battery id directly to the API. This
way, getting battery id will be the responsibility of caller.

CRs-Fixed: 1043798
Change-Id: I7a8c2b2fcc9b43e2e858114f7312fccf96dc3f78
Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
2016-07-21 12:23:07 -07:00