Commit Graph
773 Commits
Author SHA1 Message Date
David Keitel 8e67275cb4 power: pm8921-charger: make usb_max_current configurable
Allow the module parameter to be configurable through the board
files. This gives another option to set the usb_max_current
setting if userspace is not able to set this during
bootup.

Change-Id: I96886f8d0f3f03905163d93c4f8f3e637d98127f
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
2012-12-03 15:56:25 -08:00
Abhijeet Dharmapurikar 70ef382867 power: pm8921-charger: fix DC issue
The current code does not start the unplug check worker if dc
path is used. This is because it assumes an external charger
for the DC path.

Reorganize the DC insertion handler to check whether an external
charger is used. If not, call the unplug check worker since we
are running in a configuration where the DC path on pm8921 charger
is used.

Also update the code such that hkadc calibration is called when a
dc charger is plugged in, similar to when the usb charger is plugged
in. This is to avoid inaccuracies because of shifts in MBG when a
charger (either DC or USB) is inserted.

CRs-Fixed: 403147
Change-Id: I11a17fc105dea398140abc1a59e6355e9e55b322
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
2012-11-26 15:49:05 -08:00
Abhijeet Dharmapurikar 683472d400 power: pm8921-bms: use configurable poll times
The current code calculates the state of charge every 20 seconds.
We need to increase the frequency when the voltage drops to near
cutoff values.

Make the poll interval configurable, choose 1 second interval when
the battery nears the cutoff voltage and 20 seconds otherwise.

Change-Id: I1bc779e5890f6994442c562ee5abf37c06dc6d3d
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
2012-11-25 22:59:29 -08:00
Abhijeet Dharmapurikar d7cb1c7f49 power: pm8921-charger: remove unused charging enable/disable api
This api could interfere with the internal working of the charger.
The end of charge detection is broken in hardware, the software workaround
relies on the enable/disable of the charging function. We don't want
this to be changed via some external api.

CRs-Fixed: 417243
Change-Id: Idc4ceb7973d1a424834f8c2a4bc5916ef7b1e961
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
2012-11-25 22:59:28 -08:00
Joonwoo Park 9bbb4d1c78 ASoC: wcd9xxx: Disconnect slimbus channel manually
Depending on the ADSP's operating mode, it's possible that slimbus
channel removal request is NACKed.  Since current codec driver has
an assumption that all channel removal requests are guaranteed to be
delivered, when it's NACKed codec would have overflow error.
Fix this overflow issue by waiting channel removal IRQ when requests
channel removal then close the channel manually if there was no removal
IRQ as this likely means channel removal request was NACked.

CRs-fixed: 417075
Change-Id: Iebfafe0159a33c13fdec6889e75b757732a3e415
Signed-off-by: Joonwoo Park <joonwoop@codeaurora.org>
2012-11-19 18:38:53 -08:00
Linux Build Service Account 8a1689884c Merge "power: pm8921-bms: change r_sense unit from mOhm to uOhm" 2012-11-14 12:54:36 -08:00
Linux Build Service Account 8d6c67507c Merge "power: qpnp-bms: read battery data" 2012-11-14 12:54:11 -08:00
Xiaozhe Shi d69c91e4be power: pm8921-bms: change r_sense unit from mOhm to uOhm
Change the unit of r_sense from Milli Ohms to Micro Ohms in order to
increase the precision of ccadc and current readings.

Change-Id: Ic3f2c4e5bafd3a1556412005564fc0b549e6813c
Signed-off-by: Xiaozhe Shi <xiaozhes@codeaurora.org>
2012-11-12 18:33:24 -08:00
Linux Build Service Account 09e493cbf2 Merge "mfd: pm8038: Add structure to support pm8xxx vibrator" 2012-11-09 13:18:34 -08:00
Linux Build Service Account 8784e3c446 Merge "power: pm8921-charger: calculate safety time" 2012-11-07 19:53:53 -08:00
Linux Build Service Account 8c0bde6f6f Merge "power: pm8921-charger: make safe current configurable" 2012-11-07 01:35:29 -08:00
Xiaozhe Shi 73a6569252 power: qpnp-bms: read battery data
Read in battery data from the batterydata-lib API for future use.

Currently, the battery data isn't used for anything, and battery-id
reading is not yet supported.

Change-Id: Id2169e24c23c1e180bbf8c8c7f467f599df1640c
Signed-off-by: Xiaozhe Shi <xiaozhes@codeaurora.org>
2012-11-05 17:37:11 -08:00
Abhijeet Dharmapurikar 77b1f6bfe8 power: pm8921-charger: calculate safety time
We observed that to fully charge a depleted battery with a 500mA source
the default safety time of 180 minutes is insufficient. The safety timer
kicks in at around 95% and stops charging the battery.

Instead of assuming a default of 180 minutes, calculate the charge time
required based on battery capacity and the minimum possible charge
current. Add a 20 minute buffer period to this calculated safety time.

CRs-Fixed: 414619
Change-Id: I08d8d319d096c050ae53d90eeac293c9b1bab2bf
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
2012-11-05 16:21:21 -08:00
Linux Build Service Account 855c8511a8 Merge "ASoC: wcd9xxx: Fix mbhc voltage measurement inconsistency" 2012-11-05 10:35:25 -08:00
Amy Maloche a1df6b7ebb mfd: pm8038: Add structure to support pm8xxx vibrator
Although not in internal reference designs, customers
may need to use pmic based vibrator instead of isa1200.

CRs-fixed: 416276
Change-Id: I3833ca4b98fdec0b2695593526081a5059b8752e
Signed-off-by: Amy Maloche <amaloche@codeaurora.org>
2012-11-01 09:39:43 -07:00
Joonwoo Park d87ec4ca9f ASoC: wcd9xxx: Fix mbhc voltage measurement inconsistency
There is mbhc voltage measurement inconsistency due to offset of
measurement result between with BG and without BG.
Change mbhc BG mode to slow mode and enable it while it's needed so
different BG mode won't make measurement offset.

Change-Id: I507aee6e00d81263a6368cd5727f2e63705d3ec6
Signed-off-by: Joonwoo Park <joonwoop@codeaurora.org>
2012-10-31 12:42:11 -07:00
Linux Build Service Account baad5a8d74 Merge "power: pm8921-bms: expose coulomb counter based charge" 2012-10-30 18:44:10 -07:00
Abhijeet Dharmapurikar a8f3542afe power: pm8921-charger: make safe current configurable
The safe current is a one time write per boot value. It determines
the max charge current that can be pushed in the battery.

Make this configurable via platform data so the safe value can
be set different for different batteries. If not specified use
a default of 1500mA

Change-Id: I830bf2e679e76efe7ed9d8bb30a8d459d8b9a09a
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
2012-10-30 12:23:19 -07:00
Abhijeet Dharmapurikar 4c78f46809 power: pm8921-bms: expose coulomb counter based charge
Average current drawn can be calculated by reading the coulomb
counter based charge before and after the usecase is run and
dividing the difference in the charge by the time it took to
run the usecase.

Use power supply property POWER_SUPPLY_PROP_CHARGE_NOW, to
expose the coulomb counter based charge.

Change-Id: I43e26a2932ab3e3d9d79bb5af7daf2364ca133b7
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
2012-10-25 15:14:49 -07:00
Linux Build Service Account ea7617139e Merge "power: pm8921-charger: support battery less hardware" 2012-10-25 14:04:22 -07:00
Kuirong Wang dcc392eead ASoC: wcd9xxx: Add fix to prevent same RX port added to same virtual port
There is big chance that application could add the same RX port
to same active virtual port. It can cause the linked list tracking
the RX ports to an AIF playback invalid. Add fix to prevent it happening.

Change-Id: I20661a51181d04233d75b964a50a0259dceb9f7d
Signed-off-by: Kuirong Wang <kuirongw@codeaurora.org>
2012-10-22 08:43:40 -07:00
Linux Build Service Account 78097fcb96 Merge "power: pm8921-charger: resume charging based on SOC" 2012-10-19 12:22:25 -07:00
Rohit Vaswani 750bee118d msm: 8974: Create a common board-dt and cleanup 8974
MSM DT targets will use a per SoC machine macro.
Create a 8974 specific machine macro and create a
common board-dt.c file.
Make the naming consistent for 8974.

Change-Id: I8ecfe840f614e7a60cf8430088c43c8e08be75ec
Signed-off-by: Rohit Vaswani <rvaswani@codeaurora.org>
2012-10-18 11:51:48 -07:00
Abhijeet Dharmapurikar bbaef5991f power: pm8921-charger: support battery less hardware
There are hardware configurations where a battery is not present. Such
hardware runs from a external power adapter.

Do not invoke BMS api for reporting charge percentage instead report
100%. Also report a favourable battery temperature.

Change-Id: I4f14b7419f7a90813650601638f6563422c13ae4
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
2012-10-17 09:46:53 -07:00
Xiaozhe Shi 14e8fa1e42 power: pm8921-charger: resume charging based on SOC
At EOC, the battery is disconnected from the charger and starts
discharging. This can result in SOC dropping to around 93% before
charging starts again.

Manually set the CHG_VBAT_DET threshold high to restart charging once SOC
drops below keep_charge_percent.

CRs-Fixed: 404909
Change-Id: I07577d1aa57bfa4bee40b52c18b5bfcb1cdb7070
Signed-off-by: Xiaozhe Shi <xiaozhes@codeaurora.org>
2012-10-15 17:39:39 -07:00
Joonwoo Park a889026d71 ASoC: wcd9xxx: refactor common components out of wcd9xxx CODEC drivers
The wcd9xxx codec hardwares have few common hardware blocks that can be
driven by a same software driver.  The MBHC driver which is taking big
portion of wcd9xxx codec drivers is one of example.
Factor out MBHC driver from codec driver along with resource manager
driver which manages common resources for codec and MBHC driver.

Change-Id: I51362fccc0931853b0f6a15f9991ad6398efa8d6
Signed-off-by: Joonwoo Park <joonwoop@codeaurora.org>
2012-10-15 16:01:35 -07:00
Kuirong Wang 906ac476d3 ASoC: wcd9xxx codecs: Add dynamic SLIMBUS ports/DAI mapping support
wcd9xxx series CODECs have hardware limitation that not all microphone
inputs can be routed to all decimators and not all decimators can be
routed to all SIMBUS TX ports. Currently, CODEC DAIs are defined based
on use cases and SLIMBUS ports are preallocated per CODEC DAI based on
microphone placements on the reference design. As concurrency use
cases grow and inflexibilty to establishing SLIMBUS port/DAI mapping,
concept of virtual port is introduced to allow run-time mapping.
At the same time, assignment of SLIMBUS shared data channel is being
rearranged to top-down approach which machine driver assigns share
data channel number to CPU DAI and CODEC DAI.

Change-Id: I43f0da5a7eff372379e159ceb99892b97f461c64
Signed-off-by: Kuirong Wang <kuirongw@codeaurora.org>
2012-10-12 16:22:40 -07:00
Linux Build Service Account a0fd4060f1 Merge "mfd: wcd9xxx: Introduce wcd9xxx interrupt controller driver" 2012-10-11 16:07:04 -07:00
Linux Build Service Account 2dc913a57b Merge "mfd: pm8038: Enable the battery alarm module" 2012-10-11 14:05:15 -07:00
Linux Build Service Account 6d63a271a1 Merge "ASoC: wcd9304: Include all registers to debugfs dump." 2012-10-11 00:26:01 -07:00
Joonwoo Park f6574c7b5c mfd: wcd9xxx: Introduce wcd9xxx interrupt controller driver
The wcd9xxx codec hardwares have multiple interrupt sources that share
one phycial interrupt line which is usually a gpio.
Convert the current wcd9xxx interrupt controller implementation to a driver
that registers itself to irq domain so codec drivers can utilize
interrupts without worrying about gpio source and system interrupt number.

Change-Id: I35381b90f0db49dbdcd70811d4adc16e40dd7ba2
Signed-off-by: Joonwoo Park <joonwoop@codeaurora.org>
2012-10-10 17:34:30 -07:00
Abhijeet Dharmapurikar 6d538144cb mfd: pm8038: Enable the battery alarm module
The battery alarm module provides interrupts when the battery
falls below or rises above a programmed threshold. This feature
is useful to wakeup the device when the battery is in low voltage
situations.

CRs-Fixed: 372690
Change-Id: Ia227cae58cc5f28fdd0dd81b11c9640c442b2f21
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
2012-10-10 09:28:57 -07:00
Linux Build Service Account 56a43f898e Merge "power: pm8921-charger: enable battery alarm" 2012-10-05 09:42:53 -07:00
Linux Build Service Account 9fc5bdbe90 Merge "power: pm8921-bms: split batterydata interpolation into a new file" 2012-10-02 15:32:33 -07:00
Xiaozhe Shi 5ee95197f9 power: pm8921-bms: split batterydata interpolation into a new file
Split off the battery data lookup table interpolation into
batterydata-lib.c. This allows different BMS to share the batterydata
interpolation code.

Change-Id: I67c2ac422b0ba1e5eca11ffccfe7e112c2e65a3d
Signed-off-by: Xiaozhe Shi <xiaozhes@codeaurora.org>
2012-09-28 12:17:22 -07:00
Linux Build Service Account 22dda7914e Merge "WCD9320: Fix HS playback after first HS playback" 2012-09-27 13:54:04 -07:00
Linux Build Service Account 74a1b69230 Merge "WCD9320: Update reg values in codec reset value table." 2012-09-27 13:54:01 -07:00
Kiran Kandi 7b7d2ff3df WCD9320: Fix HS playback after first HS playback
Fix HS playbacks after first HS playback by doing Following.

1. Override PA enable from analog.
2. Do not enable LDO for Headset.
3. Run PRE_PMD and POST_PMD seq only if compander is enabled.
4. Set Some Buck and NCP reg values to Taiko 2.0 reset values.
5. When Bandgap is disabled leave the Badgap reg at reset value.

Change-Id: I1e0db2d4bde706ac230bad91c63c03d0a24e4c74
Signed-off-by: Kiran Kandi <kkandi@codeaurora.org>
2012-09-26 10:52:45 -07:00
Asish Bhattacharya b8d02c6206 ASoC: wcd9304: Include all registers to debugfs dump.
The current dumps only include a small set of registers usefull
in most use cases. Make it exhautive by including the complete
register set.

CRs-Fixed: 402905
Change-Id: I4f826dc53f3cf9c8e0d520d7f1eb872f71c357de
Signed-off-by: Asish Bhattacharya <asishb@codeaurora.org>
2012-09-26 08:52:24 +05:30
Kiran Kandi 460ee170e3 WCD9320: Update reg values in codec reset value table.
change the codec reg values in codec reset value table to
match the actual codec core reset values.

Change-Id: Ib274865195594f7c18ba8c2f6d46c87449bb44b5
Signed-off-by: Kiran Kandi <kkandi@codeaurora.org>
2012-09-24 19:07:27 -07:00
David Keitel 8b079fb38a power: pm8921-charger: enable battery alarm
During UVLO events the charger hardware may lock up
if it is in hardware clock switching mode.

To fix this add a battery alarm with a lower threshold
that disables hardware clock switching.

When the system is awake the resume callback ensures
that the charger is running off of the 19.2 MhZ clock
which does not allow the charger to lock up. Therefore
if the battery alarm wakes up the device before hitting
UVLO the charger hardware will not be in hardware clock
switching mode.

CRs-Fixed: 374607
Change-Id: I11938c569a25b026ee6b7b5125cec930676ec01d
Signed-off-by: David Keitel <dkeitel@codeaurora.org>
2012-09-20 16:37:41 -07:00
Linux Build Service Account 8b6442bf53 Merge "thermal: pm8xxx-tm: Add configuration option for allowing shutdown override" 2012-09-15 13:54:19 -07:00
Linux Build Service Account b4ebb9ea0f Merge "mfd: wcd9xxx: Check for wcd9xxx_read error" 2012-09-14 13:53:49 -07:00
David Collins 8f6d8a8e7e thermal: pm8xxx-tm: Add configuration option for allowing shutdown override
Add a field to the PMIC thermal alarm core data named
allow_software_override which is used to control whether or not
userspace may switch the mode of a PMIC thermal device to
"enabled" in order to enable software override of PMIC automatic
over temperature shutdown.

allow_software_override -
true:  writing "enabled" to thermalfs mode file results in
       software override of PMIC automatic over temperature
       shutdown.
false: PMIC automatic over temperature shutdown is always
       enabled.  mode file cannot be set to "enabled".

Change-Id: I4c47fdf0c0c4704008591755296118ad7fac95ae
Signed-off-by: David Collins <collinsd@codeaurora.org>
2012-09-13 00:46:35 -07:00
Venkat Sudhir ee6c50044b mfd: wcd9xxx: Check for wcd9xxx_read error
Check for for wcd9xx read error properly during probe.
Move the determination of codec type to function and
check for interface error during read operation for
I2C. Since slimbus master is changed the slim porbe
may be called later to I2C probe. Handle proper
releasing of reset gpio in case there was error
for I2C read.

Change-Id: I6e8e271861e5bf7fee5df63b5ac265b7976f83d2
Signed-off-by: Venkat Sudhir <vsudhir@codeaurora.org>
2012-09-12 11:22:06 -07:00
Asish Bhattacharya 59442e223d mfd: pm8xxx-spk: Fix settings for the class D audio amplifier
Test results based on noise gate recommended the following settings

0x254=0xC8 (Threshold=110, preamp bias=01)
0x255=0xC1 (Hold=110, max attn=0000, mute=1)
0x256=0xB0 (decay=101, attack=10, delay=0)

CRs-Fixed: 385187
Change-Id: I7276a6d0689ffb475aa8c58214fd2b00fe62f81c
Signed-off-by: Asish Bhattacharya <asishb@codeaurora.org>
2012-09-12 11:45:36 +05:30
Linux Build Service Account 52acdd41d3 Merge "mfd: pm8821-core: Add support for PMIC thermal alarm" into msm-3.4 2012-09-02 02:13:11 -07:00
Linux Build Service Account b215e95d6a Merge changes I2e8fcb4a,I0bbad22c,I22d2dbda,I3e5e92e3 into msm-3.4
* changes:
  power: pm8921-bms: use restart reason for usb detection
  mfd: pm8xxx: provide api to read restart reason
  power: pm8921-bms: report higher soc even when called within a second
  power: pm8921-bms: use consistent temperature units
2012-09-01 13:37:05 -07:00
David Collins 1604779c47 mfd: pm8821-core: Add support for PMIC thermal alarm
Add a pm8xxx-tm subdevice into pm8821-core.  The pm8xxx-tm device
can be used to receive an interrupt when critical temperature
thresholds are reached.  Since PM8821 does not have an ADC, it is
not possible to read a real time PM8821 die temperature using
this pm8xxx-tm device.

Change-Id: I3720c79a0546e8bc69044166f70dd4c313e84daa
Signed-off-by: David Collins <collinsd@codeaurora.org>
2012-08-30 16:43:38 -07:00
David Keitel a3cf943ef8 power: pm8921-charger: report DC online for some platforms
Some hardware platforms can supply VPH_PWR without battery
or charger being present.

To avoid shutting down due to no connected power sources
from the perspective of software set a flag that forces
the DC supply to be online for this type of platform.

Change-Id: I325ea00d2103da229bfb7a854ebb7f7fd556c16b
Signed-off-by: David Keitel <dkeitel@codeaurora.org>
2012-08-29 11:10:12 -07:00