Commit Graph
801 Commits
Author SHA1 Message Date
Anirudh Ghayal 80c729b513 power: pm8921-charger: Make charger removal detection workaround optional
On some platforms such as MPQ8064 the charger removal detection
workarounds - reverse boost fix and OVP FET stuck do not work
as expected as the SMBC module is disconnected from USBout. On
these targets the USB interface is not used for charging but merely
to indicate the USB driver of the insertion/removal.

Add a platform data variable to make this optional and enable
the same for MPQ8064

Change-Id: I3fca1b357f8fc280483302f72ffbc61fb50109a7
Signed-off-by: Anirudh Ghayal <aghayal@codeaurora.org>
2013-03-05 19:49:32 -08:00
Linux Build Service Account 26cae1caa4 Merge "ASoC: WCD9XXX: Add support for class H PA controller" 2013-02-22 02:18:03 -08:00
Bhalchandra Gajare 87fef4c2e2 ASoC: WCD9XXX: Add support for class H PA controller
Class H PA controller analyzes the signal which will be sent to
the PA's (EAR or HPHL/HPHR) in order to adjust the supply voltage
of the PA to make the system as efficient as possible.

Add support for class H PA controller as common code for multiple
audio codecs.

CRs-fixed: 410528
Change-Id: I878a801fcd89f7aa89f1da3d5c8887ec9d7e4d39
Signed-off-by: Bhalchandra Gajare <gajare@codeaurora.org>
2013-02-21 22:05:10 -08:00
Abhijeet Dharmapurikar 03c6c23af4 power: pm8921-bms: add capacitive resistance
The current code only accounts for the series resistance via a lookup
table. Add a configurable parameter to account for capacitive resistance.

Change-Id: I6a844b51970a6bdf40cfc1340fa31f580efc1c9e
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
2013-02-19 23:35:31 -08:00
Joonwoo Park 559a5bfc7b ASoC: wcd9320: Add wcd9320 codec hardware v2 support
The wcd9320 hardware v2 has different chip ID along with several
different registers' default value compare to v1.  Add this new codec
hardware support.

Change-Id: I326fb066b37a1dec6c9efc224f6f362eef9fa323
Signed-off-by: Joonwoo Park <joonwoop@codeaurora.org>
2013-02-15 14:46:36 -08:00
Joonwoo Park 3cf3a94c10 mfd: wcd9xxx: Pass slimbus slave address type to slimbus slave driver
There are slimbus slave address differences among the different wcd9xxx
codec hardwares.  Fix core driver to pass this information to slimbus
slave driver in order to avoid slimbus slave device determines interface
type by itself.

Currently when new codec hardware support introduced the same change has
to be made in both of core and slimslave driver.
This change removes slimslave change requirement.

Change-Id: Ie36cfb1139ce2360be1bd66ddfc22b283f948561
Signed-off-by: Joonwoo Park <joonwoop@codeaurora.org>
2013-02-14 20:23:24 -08:00
Joonwoo Park 20bc9da1fc ASoC: wcd9xxx: Avoid vddio switch during plug type detection
When MBHC detects new plug type, MBHC driver turns on vddio switch in order
to check if plug is fully inserted.  But utilizing vddio switch can lead to
plug type detection failure when plugged headset behaves differently
between with and without vddio switch.

The HPHL status register can replace the vddio switch so driver can check
if plug is fully inserted by reading the HPHL status register.  Hence
replace vddio switch with HPHL status register.

CRs-fixed: 440803
Change-Id: I5c23cb38459e806266c806e391f8f8f2e7c65a5d
Signed-off-by: Joonwoo Park <joonwoop@codeaurora.org>
[smuckle@codeaurora.org: backported to msm-3.7]
Signed-off-by: Steve Muckle <smuckle@codeaurora.org>
2013-02-14 10:49:52 -08:00
Xiaozhe Shi 77a5b058c2 power: qpnp-bms: introduce custom oem battery data
By default, there are only palladium and desay battery profile data in
the current implementation. However, OEMs may want to maintain their own
battery profile data for other battery types.

Introduce battery type "BATT_OEM" and the corresponding profile table as
"bms-battery-data-oem.c".

Default functionality should not be impacted. The bms will still
default to palladium 1500 to maintain backwards functionality.

CRs-Fixed: 431640
Change-Id: I97d21ecacda92ae18f0aaa0f2256f62f3de1daa5
Signed-off-by: Xiaozhe Shi <xiaozhes@codeaurora.org>
2013-02-14 10:48:32 -08:00
Duy Truong 790f06d941 Update copyright to The Linux Foundation
Change-Id: I9d411a9c00b37d0907066dbfa6db3a78c108646f
Signed-off-by: Duy Truong <dtruong@codeaurora.org>
2013-02-13 16:38:12 -08:00
Damir Didjusto 9841061097 ASoC: wcd9xxx: Export wcd9320_registers.h to user space
Add the additional file to Kbuild to export the registers
to userspace.

Change-Id: I25800f94851004994346b0b563ea9ef0fe37cee2
Signed-off-by: Damir Didjusto <damird@codeaurora.org>
2013-02-11 18:45:09 -08:00
Anirudh Ghayal 6fe4ffa666 power: pm8921-bms: Enable batt alarm
Set the batt alarm to wake up the system if the
battery voltage falls below a threshold. This is to
make sure that the device does not shutdown abruptly
without any notification.

Hold the low voltage wakelock to prevent the device
from going to sleep immediately after the low voltage
notification.

Change-Id: Ifaeeeb27bd85f9c95f026ac3565681432e247b02
Signed-off-by: Anirudh Ghayal <aghayal@codeaurora.org>
2013-02-06 08:13:16 +05:30
Abhijeet Dharmapurikar 1939ede393 power: pm8921-bms: disable ocv updates for flat portion of the curve
An issue is observed when an OCV is updated while the device is
sleeping. When it wakes up the SOC calculations are run on the new OCV
which result in a drastically different SOC than previously reported.
The root cause of this issue is PON OCV likely was unsettled.

Provide a feature where OCV updates can be disabled between certain
SOC range.

Change-Id: I54a75a7e9d05ff2c8ccd484850f02a0190d6a3b7
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
2013-01-25 13:34:30 -08:00
Linux Build Service Account e7f1ab2526 Merge "ASoC: wcd9310: Update wcd9310 compander configuration" 2013-01-12 14:04:28 -08:00
Linux Build Service Account 4712e6dd1d Merge "ASoC: wcd9xxx: Handle ADSP Subsystem Restart" 2013-01-11 13:32:45 -08:00
Linux Build Service Account d10084071f Merge "ASoC: wcd9xxx: Fix MBHC irq handler deadlock scenario" 2013-01-10 19:00:36 -08:00
Ravishankar Sarawadi 839fcf3283 ASoC: wcd9xxx: Handle ADSP Subsystem Restart
Exercise codec reset as part of ADSP subsystem restart handling
and also update codec and ASoC cache registers to defaults. This
is required to clean up codec state post ADSP restart. Add flag
to avoid codec reset during device bootup.

If the software workaround to prevent leakage on the spkdrv is
enabled, handle the workaround post subsystem restart by turning
on PA and bandgap again.

Change-Id: Ieb7f9892b45bc01f0e2ea38485c4f63298f83999
Signed-off-by: Ravishankar Sarawadi <crsaraw@codeaurora.org>
2013-01-10 17:01:33 -08:00
Joonwoo Park 1f9d7fddb0 ASoC: wcd9xxx: Fix MBHC irq handler deadlock scenario
There is a chance to encounter deadlock when either electrical mbhc irq
or mechanical mbhc irq releases resource lock to let polling thread finish
its job.  This is due to the possibility of one irq handler can preempt
already running the other type of irq handler.
Introduce a new mutex to avoid this preemption.

CRs-fixed: 428653
Change-Id: Idf24c62224026c9c061de12c31e248c05b47de9d
Signed-off-by: Joonwoo Park <joonwoop@codeaurora.org>
2013-01-09 16:08:41 -08:00
Kuirong Wang 678e417f30 ASoC: wcd9310: Update wcd9310 compander configuration
Update the Compander register settings to remain the default
settings after the system bootup and optimize compander
configuration sequence.

Change-Id: Ib475f3bb84414546b4ead1d3f013dc173317e1b3
Signed-off-by: Kuirong Wang <kuirongw@codeaurora.org>
2013-01-08 17:15:09 -08:00
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