Commit Graph
839 Commits
Author SHA1 Message Date
Bhalchandra Gajare 9b4eb3bca1 mfd: wcd9xxx: Refactor codec core driver and irq driver
IRQ driver can be used by codecs that do not use the core driver.
Refactor the drivers so that codec drivers that are not children
of the core driver can also request/access the interrupt routines
provided by the IRQ driver.

Change-Id: I3086be02839fd735db2d32665abf7b984958dc2b
Signed-off-by: Bhalchandra Gajare <gajare@codeaurora.org>
(cherry picked from commit c68ed369921e8d08f4254b9243872785a3a5cf2f)
2013-08-29 15:57:11 -07:00
Joonwoo Park c98049a153 ASoC: wcd9xxx: reinitialize codec irq after subsystem restart
During subsystem restart, it's possible codec's upstream irq is disabled
if irq handler tried to access codec register when it's inaccessible.
Reinitialize codec irq handler after subsystem restart to be able to
bring codec interrupts back to work again.

CRs-fixed: 520754
Change-Id: Iaa6fa8da25cdf6ed6746754385ad895db8dcea9a
Signed-off-by: Joonwoo Park <joonwoop@codeaurora.org>
(cherry picked from commit 3e026864473b23c95a241ebcdf2d152c9973efec)
2013-08-29 15:57:03 -07:00
Joonwoo Park 8ffa28169d ASoC: wcd9xxx: Update sound card's online/offline state
Update sound card's state when it went to online/offline so application
can monitor and wait for card's online prior to issue command.

Change-Id: I7cfb120e56e97cf743782a8b4b2fcbad242b227b
Signed-off-by: Joonwoo Park <joonwoop@codeaurora.org>
(cherry picked from commit 4aee97adf03305b3896f8e74977ef917c2fd9a32)
2013-08-29 15:56:54 -07:00
Phani Kumar Uppalapati 71ba8881e3 ASoC: wcd9xxx: Add run-time detection of wcd9306/wcd9302
Tapan codec has two variants wcd9306 and wcd9302. Wcd9302
is derived from wcd9306 while few hardware blocks are not
available. Add support to detect the codec variant at run
time.

Change-Id: Idb5b39aec2b8262391aea475a261ee5c0fcd1ede
Signed-off-by: Phani Kumar Uppalapati <phaniu@codeaurora.org>
2013-08-23 20:09:19 -07:00
Xiaozhe Shi 7ef86d94d9 of: batterydata: Introduce DT support for battery data
Add the of_batterydata driver to parse device tree battery data.

Battery data contains battery profile information and is used by the
charger and the BMS drivers.

Change-Id: Ibe03800be0d51e82194c9385c6348c5a6c92711d
Signed-off-by: Xiaozhe Shi <xiaozhes@codeaurora.org>
2013-07-12 14:09:22 -07:00
Joonwoo Park b755e9e371 ASoC: wcd9xxx: introduce headphone impedance detection support
Different headphones have different impedance that results in volume level
difference on ears as lower impedance headphone will have higher
volume with the same gain on PAs.
Provide impedance of headphones to be able to adjust gain according to
impedance so user can have consistent volume level with different
headphones.

Change-Id: I707f34344cd0068507bdd8a0192eb7afea1147f2
Signed-off-by: Joonwoo Park <joonwoop@codeaurora.org>
2013-07-01 11:51:08 -07:00
Anirudh Ghayal a221d91f8d power: pm8921-bms: Fix variable naming
The max_fcc_learning_cycles variable actually indicates
the minimum number of FCC cycles required to update a new FCC,
name it accordingly.

Change-Id: I510d3a05eed736a9ee560c936faa20ed2d3c5bd1
Signed-off-by: Anirudh Ghayal <aghayal@codeaurora.org>
2013-06-18 05:45:00 +05:30
Linux Build Service Account 1058332ba1 Merge "power: qpnp-bms: Add qrd 4v2 1300mah battery data" 2013-06-12 18:12:31 -07:00
Linux Build Service Account 4d362fe184 Merge "leds: pm8xxx: Enable PWM LPG banks based on max current" 2013-06-11 01:45:45 -07:00
Joonwoo Park 055ae4fdc1 ASoC: wcd9xxx: don't clear pending mbhc interrupt
Clear mbhc irq before dispatching it to avoid lost irq when the same
irq asserts while driver is handling previous one.

CRs-fixed: 488535
Change-Id: I43ff7553258c0e8b260f233bbb064a5b8f118120
Signed-off-by: Joonwoo Park <joonwoop@codeaurora.org>
2013-06-07 00:29:17 +05:30
tingting f50326f971 power: qpnp-bms: Add qrd 4v2 1300mah battery data
currently there is no battery data for qrd 4v2 1300mah

add qrd 4v2 1300mah battery data

Change-Id: Ie5bf0cafb2f50e85d45976178bb13d8b79017bb5
Signed-off-by: tingting <tingting@codeaurora.org>
2013-06-06 19:43:43 +08:00
Prasad Sodagudi 5af8792bd5 leds: pm8xxx: Enable PWM LPG banks based on max current
The current design enables PWM LPG high bank with out
checking the max current. So enable PWM LPG low bank when max
current configured as 4mA and enable PWM LPG high bank when
the max current configured as 8mA. Enabled both PWM LPG low bank
and PWM LPG high bank when max current configure as 12mA.

CRs-Fixed: 486318
Change-Id: Ib7177aafc63c4c33b8c144d665a11d5aaf0ef584
Signed-off-by: Prasad Sodagudi <psodagud@codeaurora.org>
2013-06-06 11:35:57 +05:30
Anirudh Ghayal 0f9116d896 power: pm8921-bms: Update the FCC learning algorithm
1. Add configurable parameters to
	- enable/disable fcc learning
	- minimum soc to start FCC learning
	- minimum ocv (pc) to start FCC learning
	- minimum cycles to update fcc vs temp. table

2. New FCC is calculated using the cc count-
	FCC_NEW = (cc_end - cc_start) / (soc2 - soc1)
	cc_end = CC count when charing ends
	cc_start = CC count when charging starts
	soc1, soc2 = starting and ending SOC_rbatt value

3. Add a new sysfs entries to update the learnt fcc values
   to userspace. These values are restored back on
   reboot.

CRs-Fixed: 417288
Change-Id: I0dc713d59ef9c45f96b9f0b5844252758bd09320
Signed-off-by: Anirudh Ghayal <aghayal@codeaurora.org>
2013-05-30 08:42:15 +05:30
Wu Fenglin 2ac88aad46 bms: qpnp-bms: Add QRD 4.35v 2000mAh battery data
Add data for QRD 4.35V 2000mAh battery. In pmic8x26 V1.0, batt_id pin
is connect to ground, so can't identify the battery using ADC, add
a battery type for QRD.

Change-Id: Ib54873210b6dce476c93c8e48942921e305b5d82
Signed-off-by: Wu Fenglin <fenglinw@codeaurora.org>
2013-05-16 14:44:15 +08:00
Asish Bhattacharya 286239bd48 ASoC: msm: Fix the register address of TX4 registers
The TX4 register address are not correct and needs to be fixed to
correct offset.

Change-Id: Iacb4a57a8c0a8508a68d057d0d431715e617eba5
Signed-off-by: Asish Bhattacharya <asishb@codeaurora.org>
2013-05-09 14:14:48 +05:30
Joonwoo Park 88bfa848c3 ASoC: wcd9320: Allow micbias 2 sharing
Currently wcd9320 driver assumes micbias 2 is dedicated to headset and ANC
microphones on headset.  Allow different microphones share the micbias 2 to
support hardware that have shared micbias configuration.

If micbias 2 is shared by mic biases other than headset mic, MBHC's ext
cable feature will be compromized and also headset removal can make more
pop noise.  If hardware has dedicated micbias 2 for headset, it's
recommanded to disable this feature.

Change-Id: I5d5e5c2feb406212dad6d211f49de49e64e1a888
Signed-off-by: Joonwoo Park <joonwoop@codeaurora.org>
2013-05-03 16:21:07 -07:00
Joonwoo Park 1c958f1a6a mfd: wcd9xxx: Fix interrupt request flooding
The wcd9320 and wcd9306 codec have additional interrupt bits which are not
currently masked.  Therefore it's possible those interrupts assert and
never be cleared by driver.  Mask additional interrupt mask bits in order
to prevent irq flooding.

Additionally enhance irq handler to clear unhandled nested irq so even
buggy driver cannot make irq flooding.

CRs-fixed: 478185
Change-Id: I6d7c0fad8baceefd0fb8c2ee0498ca09b56a56a8
Signed-off-by: Joonwoo Park <joonwoop@codeaurora.org>
2013-04-24 17:09:11 -07:00
Anirudh Ghayal d37bc1fb63 power: pm8921-charger: BTC override fixes
- Monitor battery health when charger is not connected
- Add configurable temperature hysteresis and enable the
  same for BTC override
- Avoid releasing wakelock when charging is not in progress
  and BTC override is enabled
- check temperature thresholds when fully charged, to handle
  temperature restrictions while restarting charging

CRs-Fixed: 466525
Change-Id: I8cad3f8bcf65844fc1048625d9b387ede132d3e0
Signed-off-by: Anirudh Ghayal <aghayal@codeaurora.org>
2013-04-17 19:38:37 -07:00
Linux Build Service Account 09e3653593 Merge "ASoC: wcd9320: Add support on-demand spkdrv supply" 2013-04-16 00:27:35 -07:00
Linux Build Service Account fc67fce1a4 Merge "ASoC: wcd9xxx: Add support on-demand supplies" 2013-04-16 00:27:34 -07:00
Joonwoo Park 1277cb68e4 mfd: wcd9xxx: Enhance codec detection logic to be forward compatible
So far driver claims detection only when major and major chip id are
matching with predefined table.  Amend the detection logic to support
possible unknown version of hardware by checking only chip id major when
driver doesn't have exact matching chip id table for both of major and
minor.

This will give us a capability of supporting hardware with minor changes
without software changes.

Change-Id: I7c5d1bce0c8542664b979a0fb2280ffa01f2279a
Signed-off-by: Joonwoo Park <joonwoop@codeaurora.org>
2013-04-15 14:09:12 -07:00
Joonwoo Park 448a8fc333 ASoC: wcd9320: Add support on-demand spkdrv supply
The wcd9320 codec requires enabled spkdrv supply during playback on the
speaker path.  Enable supply only when it's needed.

Change-Id: Ib06300396efdf5628ad92499ae17683e05165d39
Signed-off-by: Joonwoo Park <joonwoop@codeaurora.org>
2013-04-10 15:51:06 -07:00
Joonwoo Park 5d170a408b ASoC: wcd9xxx: Add support on-demand supplies
There are supplies only need to be enabled on-demand based on the codec's
functional activity.  Discriminate on-demand supplies from static ones and
pass list of supplies to codec driver in order for driver can enable only
when the supplies are needed.

Change-Id: I91b3356e33fa89fb3ba12f36688f207c9e7a8e02
Signed-off-by: Joonwoo Park <joonwoop@codeaurora.org>
2013-04-10 15:50:55 -07:00
Linux Build Service Account 6d2cb09b7e Merge "power: qpnp-bms: introduce configurable corrections" 2013-04-08 10:32:28 -07:00
Xiaozhe Shi 0ac7a009aa power: qpnp-bms: introduce configurable corrections
There are situations when the corrections can cause linearity issues.
Provide a scheme to limit the corrections via a configurable parameters.
The corrections were introduced to prevent battery dipping below UVLO.
If the battery were in the flat portion of the SOC curve a small error
in OCV measurement could drift the SOC by a large amount. Corrections
are important if the OCV falls in this range. Hence introduce two
parameters to limit the corrections based on a OCV threshold - one when
it is above 3.8 volts, where corrections could be low and the other
when the OCV is lower and 3.8 (flat portion) where corrections should be
high.

Also there are instances when the SOC appears stuck at 1% for a long
time. This is because the algorithm doesn't allow the soc to drop to 0%
if the estimated soc is high. Provide a configurable level for the
estimated SOC below which, the calculated soc can go to 0%.

Change-Id: Ie77b52ed59ba138efca86b840dbd60a38ca81d86
Signed-off-by: Xiaozhe Shi <xiaozhes@codeaurora.org>
2013-04-05 10:37:30 -07:00
Linux Build Service Account 0b6c17a92e Merge "ASoC: wcd9320: Set DMIC sample rate in the codec" 2013-04-02 23:49:43 -07:00
Linux Build Service Account db6850932b Merge "power: pm8xxx-ccadc: implement quick calibration" 2013-04-02 20:53:21 -07:00
Linux Build Service Account 1d27691ce0 Merge "ASoC: wcd9xxx: Cleanup userspace exported header's marking" 2013-04-02 20:50:29 -07:00
Joonwoo Park 59da0dadc4 ASoC: wcd9xxx: Cleanup userspace exported header's marking
Remove marking from userspace exported header.

Change-Id: Ie10877784212ae05a9308db5f11fdddb476143b9
Signed-off-by: Joonwoo Park <joonwoop@codeaurora.org>
2013-04-02 15:37:22 -07:00
Damir Didjusto 1a353ce3e0 ASoC: wcd9320: Set DMIC sample rate in the codec
Set the correct clock frequency divider values in codec registers
based on MCLK and DMIC sample rate.  Set the ANC DMIC X2 based on
the sample rate.

Change-Id: I23bb38112a3f2045e1844224545a3c2a0fdd8446
Signed-off-by: Damir Didjusto <damird@codeaurora.org>
2013-04-02 11:45:47 -07:00
Linux Build Service Account ef5f89222f Merge "power: pm8921-bms: api for battery insertion/removal" 2013-04-01 06:44:28 -07:00
Anirudh Ghayal 769ebada4a mfd: pm8xxx-misc: Add API to read PMIC registers
This API reads the PMIC registers at runtime and can be called
from process/interrupt context. It is currently enabled for PM8921.

Change-Id: I63a80293e37725569d075de814f27f67382976ca
Signed-off-by: Anirudh Ghayal <aghayal@codeaurora.org>
2013-03-29 16:30:52 +05:30
Abhijeet Dharmapurikar 5389ebc8d0 power: pm8xxx-ccadc: implement quick calibration
There are certain systems that wakeup every so often to do some
housekeeping work. We don't want to run a full calibration
when the system wakeups.

For such systems runs a quick calibration with just two samples.
Use the periodic_wakeup flag to indicate such a system.

CRs-Fixed: 454221
Change-Id: Ifc86414f7fab4d0921e3289d6e52b9e077a1f625
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
2013-03-28 21:28:21 -07:00
Abhijeet Dharmapurikar bd5e508c0a power: pm8921-bms: api for battery insertion/removal
Provide api to clean up the history values the driver remembers to
report the soc. These apis will be called when the battery is removed.
Similarly provide api to initiate battery SOC calculations upon battery
insertion.

Change-Id: Ie9f3f5f45c789efc2ba6d39226401691912c764c
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
2013-03-28 21:28:13 -07:00
Abhijeet Dharmapurikar 487076194e power: pm8921-bms: introduce configurable corrections
There are situations when the corrections can cause linearity issues.
Provide a scheme to limit the corrections via a configurable parameters.
The corrections were introduced to prevent battery dipping below UVLO.
If the battery were in the flat portion of the SOC curve a small error
in OCV measurement could drift the SOC by a large amount. Corrections
are important if the OCV falls in this range. Hence introduce two
parameters to limit the corrections based on a OCV threshold - one when
it is above 3.8 volts, where corrections could be low and the other
when the OCV is lower and 3.8 (flat portion) where corrections should be
high.

Also there are instances when the SOC appears stuck at 1% for a long
time. This is because the algorithm doesn't allow the soc to drop to 0%
if the estimated soc is high. Provide a configurable level for the
estimated SOC below which, the calculated soc can go to 0%.

Change-Id: I265e1ea41681813ec6add6eea2a440c6e239a5dc
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
2013-03-27 10:20:16 -07:00
Anirudh Ghayal 0c7c2bcff1 power: bms: Report zero SOC if voltage is below cutoff
If the battery voltage remains below the cutoff threshold
for a specific period (determined by a platform data -
vbatt_cutoff_retries) report the SOC as 0. This allows
the userspace to perform a graceful shutdown. Also, provide
a platform data entry (low_voltage_detect) to enable this
functionality.
Enable 'low_voltage_detect' and set 'vbatt_cutoff_retries'
as required to enable the full functionality.

CRs-Fixed: 450387
Change-Id: I668d391cab3d0424fe5f370df0c1169124c34f5e
Signed-off-by: Anirudh Ghayal <aghayal@codeaurora.org>
2013-03-24 22:04:25 -07:00
Bhalchandra Gajare ea89874a1a ASoC: wcd9306: Pull in changes from WCD9320
Cleanup wcd9306 codec driver, pull in fixes done for WCD9320 that
are also required for WCD9306.

Change-Id: Ib0bf6c7baa32877c03ebc7a138af087438b8694b
Signed-off-by: Bhalchandra Gajare <gajare@codeaurora.org>
2013-03-14 13:55:04 -07:00
Bhalchandra Gajare 750d12d88f ASoC: wcd9xxx: Add support for wcd9306 v2.0
WCD9306 v2.0 has enumeration address different for slimbus PGD and
interface devices, add this new enumeration address to supported codecs
over slimbus. Provide macro to identify codec version.

Change-Id: I197db5e634daceb5c7b7d91b1dc356b9c226ca18
Signed-off-by: Bhalchandra Gajare <gajare@codeaurora.org>
2013-03-11 15:43:18 -07:00
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