Commit Graph
783 Commits
Author SHA1 Message Date
Linux Build Service Account 52383656c1 Merge "power: pm8921-bms: implement max current indication" 2013-01-04 03:17:42 -08:00
Abhijeet Dharmapurikar eca7b3effc power: pm8921-bms: implement max current indication
It will be nice to have the BMS also report an approximate max current
that can be drawn from a battery before it falls below the cutoff
voltage. This value can be estimated by calculating the voltage
delta between noload voltage(ocv) and the lowest voltage allowed
(cutoff). Dividing this voltage delta by the estimated resistance
gives us the max current the battery can provide, above which the
battery will likely dip below the cutoff voltage.

The open circuit voltage estimate and the battery resistance
that help in calculate the max current are available when state of
charge (SOC) is being calculated.  So, calculate and save the max current
every time SOC is calculated and report this value via a public api.

This max current is used in the Battery Current Limiting (BCL) driver.
Consequently, remove the api that returns battery resistance and
clean up the charger driver from calculating the max current.

Change-Id: I8882575084eefa6a23bd59b8d2a54a53d793298e
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
2013-01-02 12:27:21 -08:00
Linux Build Service Account 5a69a5a2a2 Merge "power: pm8921-charger: charging time expiry fixes" 2012-12-27 17:27:38 -08:00
Linux Build Service Account 8c0971432e Merge "ASoC: WCD9XXX: Add support for WCD9306 codec in codec core driver" 2012-12-26 20:46:08 -08:00
Banajit Goswami 4d6d891b4c ASoC: WCD9XXX: Add support for WCD9306 codec in codec core driver
WCD9XXX core driver enumerates the codec to slimbus and passes
control to individual codec drivers. Add logic to register
devices for WCD9306 codec driver

Change-Id: Ib5689d77ba677af5a5d78273fc89ba7b53a7c08d
Signed-off-by: Banajit Goswami <bgoswa@codeaurora.org>
2012-12-26 16:39:35 -08:00
Bhalchandra Gajare dcf09f8c6e ASoC: WCD9306: Add initial driver for WCD9306 codec
Add codec driver for WCD9306. WCD9306 is a superset for
WCD9302 codec. Same driver will be used for both WCD9302
and WCD9306. The codec driver is ALSA compliant.

Change-Id: I50a098883de657d7272a084ede8fbd16ed03f2c4
Signed-off-by: Bhalchandra Gajare <gajare@codeaurora.org>
2012-12-26 16:29:46 -08:00
Xiaozhe Shi d035f6aabc power: pm8921-bms: account for sleep time in ADC calibration
Currently, the system calibrates the CCADC and HKADC every 10 minutes of
kernel time. However, this does not count sleep time, which could make
calibration much more infrequent.

Fix this by saving the time of the last calibration for both ADCs and
immediately calibrate upon resume if the elapsed time is longer than the
calibration period.

Change-Id: I34f51c6202cbaa805c496360e8dbd391890decc6
Signed-off-by: Xiaozhe Shi <xiaozhes@codeaurora.org>
2012-12-19 10:31:40 -08:00
Abhijeet Dharmapurikar f8a66e9a59 power: pm8921-charger: charging time expiry fixes
When the charger timer expires charger h/w raises an interrupt and sets
the charger failed bit. Once the charger failed bit is set to 0 by s/w
the charger hardware resumes charging.

The current charging driver resets the charge failed bit periodically.
This is not safe. Update the code to reset failed bit only when the
charger failed interrupt happens and only if a configurable parameter
is enabled.

CRs-Fixed: 428877
Change-Id: If58279329f6c76978223369a2d08d47a7b1e3579
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
2012-12-14 18:58:38 -08:00
Venkat Sudhir a50a376f71 ASoC: wcd9xxx: Add codec clock rate in device tree
-Wcd9xxx codec can run with different master clock
 rate. Codec needs to know the master clock rate
 at init to update default register values. Master
 clock rate is added to device tree.
-Remove use of static variable in codec I2C probe.

Change-Id: I6ba2821092e2f7e7814216ee49042845bcfdfe79
Signed-off-by: Venkat Sudhir <vsudhir@codeaurora.org>
2012-12-10 17:57:04 -08:00
Abhijeet Dharmapurikar 2f45e2c93e power: pm8921-charger: support temperature less configurations
There could be configurations where the voltage that appears on
the batt_therm line is out of specification and makes the battery
temperature comparators (btc) useless i.e. the  comparators could
trigger when the battery is not really cold or hot.

Add software support to monitor battery temperature. While charging
start a worker which polls the temperature every few (configurable) ms.
If the temperature is hot or cold override btc to force hot or cold
which in turn feeds in to the charging FSM and disables charging.
When the temperature comes back to normal override btc to force normal
temperature. Note that when the temperature goes out of range while
charging the end of charge worker still runs, we can run the btc worker
piggy backed on that wakelock.

Change-Id: I1293ecc2974bae4ad530ecb775cd19072e413c72
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
2012-12-03 20:35:28 -08:00
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