Commit Graph

630 Commits

Author SHA1 Message Date
sam_chen
4095062f42 Audio: soc: wcd9310: workaround for d-mic noise on flo hardware revision C.
On flo hardware revision C, micbias1 is not grounded with external
capacity, so it should set micbias1 capless setting as 1
(no external bypass capacity) to avoid noise.

Bug:8611206

Change-Id: I82644a9123d092490ccc0acf6cdfa68964ef9c22
Signed-off-by: sam_chen <sam_chen@asus.com>
2013-04-18 16:09:24 -07:00
yetta_wu
3d143f532a Display: SR1 mipi panel porting
1. port LG and panasonic panel
2. remove the choice "LCD Panel" in Kconfig because we need to config multiple mipi panels in one code base
3. pwm and LCD_BL_EN power source change to L17

Change-Id: I793114db222ed7712662495cd7106f1d0d41ddd3
Reviewed-on: http://mcrd1-5.corpnet.asus/code-review/master/67830
Reviewed-by: Warlock Tai <warlock_tai@asus.com>
Tested-by: Warlock Tai <warlock_tai@asus.com>
2013-04-18 16:07:51 -07:00
Devin Kim
2b64f6b785 pm8xxx-adc: add the functions to set tuning parameters
We need to tune the board specific adcmap parameters
So need functions to set specific parameters.

void pm8xxx_set_adcmap_btm_threshold(void *pts, int size)
void pm8xxx_set_adcmap_pa_therm(void *pts, int size)
void pm8xxx_set_adcmap_ntcg_104ef_104fb(void *pts, int size)

Change-Id: Ie78c11f5fb998ecc456defa3c8e3e7a3e0b9b45f
2013-03-15 17:13:28 -07:00
choongryeol.lee
1819bd4e44 power: pm8921-bms: fix soc rising from 99% to 100% during discharging
We observed that SoC suddenly increase from 98% or 99% to 100%
right after charger removal. This issue caused by charging adjusting
algorithm which adjust SoC to sync 100% with end of charging.
During charging adjustment, the adjusted SoC could be smaller than
original SoC. So when we remove charger, charging adjusting algorithm
stop adjusting SoC and then bms report original SoC which is larger
than before.

Previously, bms driver considered most of this case by using previous
SoC when SoC increase during discharging. But if SoC is 100%, previous
patch doesn't work.
So this patch add SoC 100% case by checking if charger is enabled.

Change-Id: I70945d391c9d821eaf875f1bcd1e8787077b98da
2013-03-15 17:13:26 -07:00
Iliyan Malchev
491b58e1ca Revert "msm: power: Revert LGE power patches"
This reverts commit 2f24cb771c.
2013-03-15 17:13:25 -07:00
Iliyan Malchev
b8c65bc60a Revert "msm: power: update power drivers to msm-3.4 tip"
This reverts commit fae0afd7be.
2013-03-15 17:13:24 -07:00
Iliyan Malchev
2625e4584b Revert "msm: power: update copyright markings"
This reverts commit 3f9f19a7c50fe47e1b963c25c68cc3ed89dd25a8.
2013-03-15 17:13:23 -07:00
David Collins
b536bcacc5 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>
(cherry picked from commit 8f6d8a8e7e1d149687819af7f9abbb24a8459cc0)
2013-03-15 17:08:32 -07:00
Duy Truong
04e554807c Update copyright to The Linux Foundation
Change-Id: Ibead64ce2e901dede2ddd1b86088b88f2350ce92
Signed-off-by: Duy Truong <dtruong@codeaurora.org>
2013-03-15 17:07:39 -07:00
David Collins
56468a5ad1 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>
(cherry picked from commit 1604779c47df4bf003211c35e356210e689676d5)
2013-03-15 17:07:33 -07:00
Uma Maheshwari Bhiram
11e349fac2 Revert "pm8xxx-adc: add the functions to set tuning parameters"
This reverts commit b19ebbc8e9ae70752e7e03b345d8a480b9ca8afa.

Change-Id: Idf994d04e69387a4e86c28e97e3ee5be80bcbd93
Signed-off-by: Uma Maheshwari Bhiram <ubhira@codeaurora.org>
2013-03-15 17:06:22 -07:00
Xiaozhe Shi
12f91c6f59 msm: power: update copyright markings
In cherry-picking patches from tip, the LTC charger driver and pm8921
BMS driver header were updated without updating the copyright
marking from "Code Aurora Forum" to "The Linux Foundation".

Fix this by updating the copyrights now

Change-Id: I3a24feaa6af5acbdca4fc6499398205a1c93dcfe
Signed-off-by: Xiaozhe Shi <xiaozhes@codeaurora.org>
2013-03-15 17:05:46 -07:00
Kuirong Wang
54898d0cd6 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-03-15 17:05:16 -07:00
Abhijeet Dharmapurikar
fae0afd7be msm: power: update power drivers to msm-3.4 tip
This branch is currently very outdated. Cherry pick the following
changes in order to bring recent fixes to this branch.

Change-Ids
Ib99cd49623698d0295bc3c3cf880225495d530cb
Ifba2bd1248e8bb47a0700dec4d321d32db4f2066
I0fc1e116c0f5a5648f99df967bdbb41fe5a07cbc
I8e3e9068e7b9a3bfd24c07a00bb3953180ce0741
I2bf31a23199f942a9ac843b9940a0f7377256238
I96b47c8603a291c41c5769fab9483d83fefb6084
If3c5f00f4b75d03838ee556235697369fd2e47dd
I32d50caf7b7a84db2654b69baafb40a441f46bf0
Ibd1020113de05e8214d41ffb975d4c95d3bb1ccf
I67c2ac422b0ba1e5eca11ffccfe7e112c2e65a3d
I2c149e6edd7c194e7f31ece95e2003ffde935806
I1f4b65cba149480fb4a8f91667ce45a876dff2f0
I2605afc2d6f9f3569ec783b2d23881f31cc9038a
I77b40f9cb8295cff1d4a24dfc7d85b0e57262f6e
I8ec5a68cad573218a0b0bd0073277b76978417ff
I9eaf7f21c73dd1ceaf97589cbf82b722706c48c2
I089725e20ae20956530e570d918a87b72e59626e
Ifa70a4daf01414dfafed7830e3a6a682c42e9364
Iaace5bc1d0611619f11b760ea6986eadb7346da1
I415d7831f15c0d690fd118ff190cd710a31368c6
I1e55bbfe37c7cc6f62581af11280a565ed648c06
I11938c569a25b026ee6b7b5125cec930676ec01d
I07577d1aa57bfa4bee40b52c18b5bfcb1cdb7070
Icdb0a28b5f9456135c60badf726c367b02f6d762
I4f14b7419f7a90813650601638f6563422c13ae4
I016a33c358be2e7a2d26202f2e9b168dd54b6d34
I43e26a2932ab3e3d9d79bb5af7daf2364ca133b7
I333c810568cdc656d2e13f0eeb9511857335b834
I830bf2e679e76efe7ed9d8bb30a8d459d8b9a09a
I08d8d319d096c050ae53d90eeac293c9b1bab2bf
I445676d558e05a6c5e9dd1e76e80ba2f5e8cd6c1
I9f38515f35fcddfbdc34ae4f59ffcfc6682033d4
Ia32e581c11954163bc8ff20a7b32432a843a17b2
I07c346475fb4a294bc8eb8da8c2048cc23394e20
Ic3f2c4e5bafd3a1556412005564fc0b549e6813c
Ic68717f4410170814d3e3b141de77b35eca12f7b
Ifad79991298e9d779b38a33a270af5197d2fc060
I3060c5ba31b59666aedfafad430e21329c4479d4
I9c87282ba5819a76a6f6697a5e9de6c92d74a665
I8144e2b83748a96ab83ba14894bfa5bd59995895
I8cac84296ddb1e323f28e2476f78d0190f4a1b73
Icef2b7fa70f274f671bd1b9469eb6a333ab462f9
Idc4ceb7973d1a424834f8c2a4bc5916ef7b1e961
I1bc779e5890f6994442c562ee5abf37c06dc6d3d
Ib1161d3d8c4a9378eabf44f9de1eae9556d82643
I11a17fc105dea398140abc1a59e6355e9e55b322
I0aa523321f1eed4a0a5461b1a894452f77e6ff99
I827bd74e9892969bb4891b31af1515789fa76c1c
I1bb658339e5a6f0adb07fda3ee0bc6c03670cc09
I135261c851067a25b20b30482764b5a61145f186
I4971d605c3475949be64372dc6bd3355ed258527
I08f6a7830c4b9ad44fb96f6d304ce257a899e287
I96886f8d0f3f03905163d93c4f8f3e637d98127f
Idf2cf7f40780cf46ba95228764790b818bc72db5
Ib046fd7149d71fc62c8f2df7a9747d6b54e95138
I546ff57d76e50ad86eb5853782fdcc1f348c9f0e
I1293ecc2974bae4ad530ecb775cd19072e413c72
I8db5a202a2e63ca0a3e355a6083d426acb7342cb
I71482f9a4430a8bbcd02c954a415ff3fab2a0c8f
I0c5656798444764b52f4d9d8889f831d674a1610
I2ac4ccd967a7a47284573c9b645055ebeca4635c
I93b830d42e7d44435c790832c11d5d38861015e0
If24985f47cc9fcd6c2eb84a73165878559008120
I39b908451f4b678ed63b872ffc46590e2c728b2c
If7e5622067c77c4c8d64ee466d1c62e4dcb0e53f
If58279329f6c76978223369a2d08d47a7b1e3579
I3621a0a204360343ba684e2217a68a6ef51a7850
I358909c38b0771fe0283386841b6123ddb2931a6
I2e8fcb4a15af3a66331a921d378bfd5d2dfe4533
I0bbad22c5fed8c32dd7de387194e94c8d4b9ad75
I34f51c6202cbaa805c496360e8dbd391890decc6
Iaab82ea254444bba233cd9ebad93d38426154ca4
Ica2565031546a8281820c17edc95d258ad31ba65
Ic282fff7167a8224ec1a1e0f7c247a9c8d73f390
Icdc707a9438adae5c8bb2d9b97af95e65c4bc2a1
I26c4e1fb971f22ec721e1dddcce6b301f5db6608
I8882575084eefa6a23bd59b8d2a54a53d793298e
Ic1e7cf4da4d2bf73d889aee7bac6cf260b26d532
I472b9da10e9f45b3c254f8440526f3f9d5116931
I1560e0df1c89be1db1e1d1aeaaeef2e6da5f85c1
Ie2842b28648084d8970329d7c76fcf0d0666a847
I2dccaedb559fc5e9865b137f980024e068bdafa3
I61a3d44f81d829f1ef22fd3044c65e4b3518b92b
I0d657c2e0d47af32cc35cd66b902be72952e5438
I22d2dbdae5c9c859d4baca2bdb7bea71da09b85b
I8c99fcbbf2f7229728236ae1059f4c9cb8dbb065
I1bb841e463658c8db42eb15ecc1687262df86a2f

Change-Id: Ib04f801b0085e7d5da3d73594bbc41c281b06026
Signed-off-by: Xiaozhe Shi <xiaozhes@codeaurora.org>
2013-03-07 15:25:37 -08:00
Xiaozhe Shi
2f24cb771c msm: power: Revert LGE power patches
Revert the following customer changes in order to clean up this
branch.

This reverts commit 33ddf5a9eaa031c00b00846458f2ba534e6807b8.
This reverts commit f17df2402b795faf2c03de6d8a5b12378674f3be.
This reverts commit 0a488464c03806e1f775c35d7b2c83650eaab4ef.
This reverts commit 23d2a7cd02b081e1cf2578c02b7ecd3a65319d4e.
This reverts commit 90e32fa7cb701d922825e40b82b566e4af843ea2.
This reverts commit 7346d0fbd3c338d55330766e0f1867f19b364fed.
This reverts commit eb59bf66db9f2ca6e79552f4f72aa56f8c6abd27.
This reverts commit 9c56de000bb2390191fa2ddaea738e6d3e8f5d4f.
This reverts commit 7a72ca62c3f64c7b914edd8d9dbb75933b3c845e.
This reverts commit 76048dac5085eca4459ee5ea5dd4876a1f518cfa.
This reverts commit bfafe7ec7cdeef5b44b32f9aa6ee03beba2020e0.
This reverts commit e346f7a7b8ead1bbb106f4eb1e766c49407bffde.
This reverts commit 1265899c012a463cb0521ed73f2abe057692a9db
This reverts commit 1ff608a341b87defa586ca4a24d0bd89abfdfbb3
This reverts commit 5f030effc8c1af159ad13e77d4c169f037d6c9e4.
This reverts commit 19c87ddde66fd6aad61a60e466a75af235fca7f9.
This reverts commit 905eac978c30c96c5d12a81c1f6968d8c57a645f.
This reverts commit 1bd7c8643cdd8fdc7cf649ec465cc454315a6753.
This reverts commit 69f1730e0d249bad3b4f0fc0f94d917c16c3df19.
This reverts commit 2073afb7ee8b3f80f1f3184bd7ac99ead581adee
This reverts commit 8126554cf049d13f4dd2d815d86ea289efdc6f3a.
This reverts commit 45ccbb53cfc227fd3811e71b0bd813432c96ee9e
This reverts commit 325995993eb806285a35381e803ed5432fe5a93a.
This reverts commit 84cf5a3959bcf412c4b48f8a29b8255c18602d1b.
This reverts commit 839d5a50c761787ded6b8558fa37696be81196fe.
This reverts commit d4b1fb57463d04aeca5ae9bfd2181faa016f97c2.
This reverts commit 2ab04b0deb912a5a52899a50ced73e36974a6a00.
This reverts commit 3a3de0ee621625c8767e0d3c7106c52fcf834499.
This reverts commit f278add027723a90b11c9a97f6d1b09c1aaec795.
This reverts commit 1a749b700752efcc8d832f7b83554df2771dce53.

Change-Id: I21863586360b6bc57dd6d631c34725bea963cffa
Signed-off-by: Xiaozhe Shi <xiaozhes@codeaurora.org>
2013-03-07 15:25:37 -08:00
Amy Maloche
258d6bf0bf 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: I190840eee4862ac82c5120501748b795e6d0c760
Signed-off-by: Amy Maloche <amaloche@codeaurora.org>
Signed-off-by: Neha Pandey <nehap@codeaurora.org>
2013-03-07 15:24:27 -08:00
Venkat Sudhir
4b5af6ccec 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>
2013-03-07 15:20:19 -08:00
David Keitel
e7fa36ee06 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.

Signed-off-by: David Keitel <dkeitel@codeaurora.org>
(cherry picked from commit a3cf943ef8c91435e2cb94b8e8bcc482dc65cb27)

Conflicts:

	drivers/power/pm8921-charger.c

Change-Id: I565edb1ab797384481ce5e37aee73ee0a8e80428
Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org>
2013-03-07 15:20:14 -08:00
Abhijeet Dharmapurikar
092d7c8abb 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.

(cherry picked from commit 6d538144cb02933cf27f425ad721541d80377b43)

Change-Id: I5d17bacf363cab165156b62730ccf9c23c633b3c
CRs-Fixed: 372690
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
(cherry picked from commit 16f56979ee6876ce64f6dba8928a782825ff1275)
2013-03-07 15:20:10 -08:00
Asish Bhattacharya
b9d5cf5f7a 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>
(cherry picked from commit 59442e223dcd616d7a244c85d8e0acccf4df9651)
2013-03-07 15:17:51 -08:00
choongryeol.lee
cf0acb5176 power: pm8921-bms: use fixed ibat_avg instead of shutdown ibat_avg
Using stored average ibat(shutdown ibat_avg) which came from
previous boot sometimes cause SoC sudden drop in boot up time.
So this patch use fixed ibat_avg value instead of shutdown ibat_avg
during 1st SoC calculation.

Change-Id: I9675652c3b4918529be40a8d6f8ee29b6dee1359
Signed-off-by: Iliyan Malchev <malchev@google.com>
2013-03-04 12:48:03 -08:00
SathishKumar Mani
b502df8c7c ASoC: wcd9310: force slimbus ports to disconnect during error cases
With shared data channel architecture, SLIMBUS driver
only removes slimbus channel when all clients vote to
have channel removed. In case of subsystem restart,
client such as MDM can go down without withdrawing
vote. During CODEC path shutdown, CODEC driver will
receive slimbus slave interrupt in time indicating
port disconnection because slimbus channel has not
be been voted off. Then, CODEC driver blindly
shutdown rest of CODEC path. This results in
overflow error on Rx path and underflow error on
Tx path. In case of time out waiting for port disconnect
interrupts to arrive, force ports to disconnect

Signed-off-by: SathishKumar Mani <smani@codeaurora.org>
BUG-ID: 7313016
2013-03-04 12:47:36 -08:00
choongryeol.lee
6d5eafbcdf power: pm8921-bms: support wireless charger bms
Since WLC(wireless charger) supply power to battery without PM8921 charger,
the SoC value is not accurate. This patch adjust OCV(open circuit voltage)
and max CV(constant voltage) value to compensate difference between
WLC and pm8921-charger.

Change-Id: I8fa368f706866d93451c2f663da69c010f9b2a35
2013-03-04 12:47:20 -08:00
choongryeol.lee
9309bccb81 mfd: pm8xxx: provide api to read restart reason
The BMS driver needs to know the restart reason of the pmic. Add
an api in the pm8xxx design to provide the restart reason.

Change-Id: I0bbad22c5fed8c32dd7de387194e94c8d4b9ad75
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
2013-03-04 12:47:18 -08:00
choongryeol.lee
0338875786 power: pm8921-charger: prevent recharging when batt is overheat
When battery is forced to stop charging by overheat, re-charging
should not be initiated even if re-charging condition is satisfied.

Change-Id: I0070039a186ccf3f12c0e79a8696a7aa3c61e538
2013-03-04 12:46:23 -08:00
choongryeol.lee
a81a841921 power: pm8921-charger: use SoC % value for charging stop and resume
Current pm8921 charger code doesn't consider the SoC % to determine
end of charging and recharging state. This can cause weird UI display
on SoC % and charging state.
For example, charging is completed when SoC % is not reached 100% or
charging is not completed even if SoC % is already 100%.
So this patch change how to determine end of charging and recharging.

Change-Id: Ice658488744d71117fedb64e0fa0eb7ad34c6573
2013-03-04 12:45:35 -08:00
choongryeol.lee
4e4f4dabfd power: pm8921: consideration of ibat max overwrite
The thermal mitigation and battery temp control can overwrite
the ibat max value each other. So this patch remove the possibility
of overwrite ibat max value by mitigation and battery temp control.

Change-Id: Ib0f7bf2b8bd2e474d1d9c76bd5100b05310cb048
2013-03-04 12:44:44 -08:00
Devin Kim
5d51c40a8d power: battery: add battery temperature control
The battery temperature should be controlled for safty.
So this patch indroduce battery temperature control.

Change-Id: Ia00e7ce5bf697591be2da94f9a7c2960738642d5
2013-03-04 12:44:22 -08:00
Devin Kim
7024f83d08 pm8xxx-adc: add the functions to set tuning parameters
We need to tune the board specific adcmap parameters
So need functions to set specific parameters.

void pm8xxx_set_adcmap_btm_threshold(void *pts, int size)
void pm8xxx_set_adcmap_pa_therm(void *pts, int size)
void pm8xxx_set_adcmap_ntcg_104ef_104fb(void *pts, int size)

Change-Id: Ie78c11f5fb998ecc456defa3c8e3e7a3e0b9b45f
2013-03-04 12:44:20 -08:00
Ajay Dudani
51edcc2511 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
Signed-off-by: David Keitel <dkeitel@codeaurora.org>
Signed-off-by: Ajay Dudani <adudani@codeaurora.org>

Change-Id: I1bb20b2e7ff1a11f032b12b4abd4804ed130fe4a
2013-03-04 12:43:59 -08:00
kyungtae.oh
935c9a4c10 power: add wirelesscharger(WLC) bq51051b driver
Change-Id: I61c4b9c3d648e8f709ec78708271f807ceed1715
2013-03-04 12:43:29 -08:00
Devin Kim
9710588005 cradle: add hall ic driver
support hall ic (BU52031NVX) for cradle

Change-Id: I1de44a0c1d5ab1359fc1a02eb674b08be8590100
2013-03-04 09:12:07 -08:00
roy.park
0f8e962294 power: support LGE battery 2100mAh
Add battery 2100mAh profile and update Battery mornitoring system(BMS)

Change-Id: Iea118f1665241c7e4192a77db791b80426a01b60
2013-03-04 09:11:48 -08:00
Abhijeet Dharmapurikar
2acc8a93ff power: pm8921-bms: charging curve adjustments
It was observed that while charging the reported soc sometimes reaches
100% before end of charging happens. At other times it does not reach
100% at end of charge and a abrupt jump to 100% soc happens.

Fix this by linearly increasing soc based on battery charge current
after constant voltage phase is reached. Constant voltage phase is
reached when battery voltage reaches the max value.

Also once constant voltage phase is reached and the voltage or charge
current decreases keep reporting the earlier soc. This could be because
of a transient system load.

Change-Id: I14c2f42d7897041db038ce85ce1124cf1ef261af
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
2013-02-27 18:21:22 -08:00
Abhijeet Dharmapurikar
fbb8dc031a power: pm8921-bms: limit voltage correction
The "adjust_soc" algorithm where we change the open circuit voltage
(ocv) in steps so that the state of charge (soc) starts approaching
the estimated soc, causes nonlinearity in the soc curves if an incorrect
resistance value is fed to the algorithm.

As battery ages and temperature changes, it is hard to estimate the
exact battery resistance.

So to fix the nonlinearity, limit the amount by which the ocv is
changed. Make it proportional to the current, i.e. change ocv by
small amounts in light load and let it change by proportionally
large amounts in heavy load situations.

Also, make the point where the soc is adjusted configurable via platform
data instead of forcing it to 25%.

Change-Id: Idc141e6bf3172dab278afe1900f5a1f9cdd624dd
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
2013-02-27 18:21:12 -08:00
Abhijeet Dharmapurikar
e10943c916 power: pm8921-bms: provide option to ignore shutdown soc
Few platforms do not want to use the shutdown soc. Provide a option to
selectively disable it.

Change-Id: Ie57d474f4e81e4ce2e7e7a4a92cda20d4c8dd184
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
2013-02-27 18:21:10 -08:00
Abhijeet Dharmapurikar
e59243486f power: pm8921-bms: use shutdown soc if it is within limits
When a strong battery is removed, it was seen that the battery voltage
lines on the phone take about five to six seconds to go below 2.1volts
where the pmic resets all the battery backed registers.

If a new battery is plugged in within this time the driver will force
the shutdown soc on this battery which is incorrect.

Compare the shutdown soc with the calculated soc and if they are
different than a configurable limit, simply discard the shutdown soc
and use the calculated soc.

Change-Id: I02e7c78eb5e9df0127ce7e78b0bd9792a8141039
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
2013-02-27 18:21:00 -08:00
Abhijeet Dharmapurikar
d2f418d0b8 power: pm8921-bms: remove Dynamic Unusable Charge algorithm
The dynamic UUC algorithm changes the UUC as load, state of charge and
temperature changes. This uncontrolled behaviour causes unacceptable
jumps in state of charge numbers.

Replace the dynamic UUC algorithm with a simple average current based
UUC. The average current is calculated by remembering the load for last
few (16) samples. Also to maintain a reasonable UUC while charging, a
load of 300mA is assumed.

Note that the first time UUC is calculated we don't have load samples
and in that case the instantaneous current is used.

Since we now don't change the UUC with respect to max possible load
(itest), the usage of this value is removed.  Also instead of failure
voltage we introduce cutoff voltage which represents the loaded voltage
by which the battery should be reported 0%.

Change-Id: Ia640164ee2c9690537308d4e840953824ba15b58
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
2013-02-27 18:20:58 -08:00
Abhijeet Dharmapurikar
1d78857112 power: pm8921-bms: dont use override mode if batfet is open
If the battery fet is open, the current sourced or sinked from the
battery is very low. There is a high chance that an open circuit
voltage(OCV) happens. Putting the BMS in override mode resets the timer
whose expiry causes an OCV.

Avoid putting the BMS in override mode if battery fet is open.

Change-Id: Idc463bcc55b51cf188cc8ee440a66f763654f174
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
2013-02-27 18:20:54 -08:00
Kiran Kandi
6a05c9e1d4 msm: wcd9xxx: add device tree support for codec slimbus component
Read the codec specific data from device tree instead of board file.

Change-Id: Iad382b89692903d2434b63d34c7121fe0b4b9dda
Signed-off-by: Kiran Kandi <kkandi@codeaurora.org>
2013-02-27 18:20:08 -08:00
Joonwoo Park
7ad053abe0 ASoC: wcd9xxx: Add wcd9320 codec slimbus slave support
Update slimbus slave driver to use updated address depending on discovered
The wcd9320 Taiko codec introduced a new register address map to configure
slimbus slave device.

Change-Id: I41e9ebabd1d375a1904b6033e46736b2fb6365f9
Signed-off-by: Joonwoo Park <joonwoop@codeaurora.org>
2013-02-27 18:19:20 -08:00
David Keitel
1218989c85 power: pm8921-charger: add dc_unplug_check option
Add a configuration option to enable or disable
the reverse boost fix for the DC charging path.

Some board designs do not utilize the DC_IN path
on the PMIC, however they do use the presence
detection of DC_IN to enable the auto switching
and interrupt features. In these particular configurations
the PMIC does not control the DC OVP FETs.
Hence add an option to enable or disable the DC path workaround
and leave the workaround disabled by default.

Change-Id: I1e55bbfe37c7cc6f62581af11280a565ed648c06
Signed-off-by: David Keitel <dkeitel@codeaurora.org>
2013-02-27 18:18:38 -08:00
Asish Bhattacharya
57e874b720 mfd: wcd9xxx: use codec device id to register the device.
The current code registers multiple devices for i2c clients. This
results in code repetition. instead its better to register single
i2c client and register codec based on device id.

Change-Id: Ifb4adbd47b7a2bf7d32be637fd0641545cd84286
Signed-off-by: Asish Bhattacharya <asishb@codeaurora.org>
2013-02-27 18:15:57 -08:00
David Keitel
bd7ad44689 power: pm8921-charger: add UVD threshold API
PM8917 has a new register which allows configuring
the falling USB under voltage detection (UVD) threshold
from 3.85V to 4.35V in 100 mV steps.

Add an API that allows to set this value per default and
also only do this for PM8917 chips.

Change-Id: I9b4259b43f148762ac72af40bdc79b895d9b4fc2
Signed-off-by: David Keitel <dkeitel@codeaurora.org>
2013-02-27 18:15:21 -08:00
Bhalchandra Gajare
56b1a21666 ASoC: WCD9xxx: Add Micbias capless mode to platform data
Microphone Bias may or may not have an external bypass capacitor
depending on the board configurations. Add the microphone bias
capless mode setting to the platform data for codec

CRs-fixed: 363941
Change-Id: Ia949d240b3b3122bc4bd6aca02ee5b6cd785d246
Signed-off-by: Bhalchandra Gajare <gajare@codeaurora.org>
2013-02-27 18:15:21 -08:00
Asish Bhattacharya
29f60b149b ASoC: wcd9304: Fix IIR filter controls
Add IIR2 filter interface for the wcd9304 codec.
Control the two 5 band IIR filters in the audio
codec through mixer controls. Enable individual
IIR filter bands and set band coefficients.

Change the IIR filter code to use snd_soc_write
instead of snd_soc_update_bits. If update bits
is used the IIR registers may not be correctly
updated.

Change-Id: I92fc147641e9eb270d8176f20445371fe5cc2f92
Signed-off-by: Asish Bhattacharya <asishb@codeaurora.org>
2013-02-27 18:15:17 -08:00
Abhijeet Dharmapurikar
501681e442 power: pm8xxx-ccadc: remove support for pm8921 v1.0 and v1.1
This ccadc module is reused in multiple pmics. It is now unnecessary
to check for 8921 versions in the driver. As a result of this change
older 8921 versions are not supported.

CRs-Fixed: 372679
Change-Id: I2114f9428e2ba1a29c2bc9caaaa75106caf1dfc3
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
2013-02-27 18:14:17 -08:00
Abhijeet Dharmapurikar
e9db898b3c power: pm8921-bms: remember soc between restarts
Currently the code does not have a mechanism to remember the soc
reported just before shutting down and upon restarting the new
soc reported is off from the previous soc value reported.

This change introduces
- a method to save soc in an unused coincell back register: ssbi address
  0x107 is not used on 8921 and serves the purpose of storing the soc.
  The driver reads this value and uses it to scale the reported soc.
- a method to detect that a battery was removed and perhaps replaced by a
  different one. If the battery is found replaced the driver is notified
  of the change and it disregards the soc value it read from the backup
  register. The charger driver has a battery backed bit (force vref
  therm) which it sets in its initialization sequence. Once set the
  value remains between restarts, unless the battery is removed. The
  default value of this bit is 0. Hence if a zero is detected before
  writing to it, battery was removed between restarts - this mechanism
  is used to notify the BMS to disregard the soc read from the backup
  register.

Note that for this to work correctly the bootloader needs to be updated to
not overwrite register 0x107 upon restart.

CRs-Fixed: 370287
Change-Id: If7d098552d36eb27a396ee7d37f78d3629861f6e
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
2013-02-27 18:14:05 -08:00
Swaminathan Sathappan
97ab0481b2 ASoC: Handle slimbus port disconnection before opening another
Problem Description:
Open and close the same set of slimbus ports after
certain iterations will fail port open, as that port
was not disconnected successfully.

Fix Description:
Handle sequence of closing slimbus ports. Store
the channel masks associated with each codec dai
and reset them after they are closed from slimbus
Then, release the close slimbus port event, after
all the channels are closed completely

Change-Id: Ie14b9f0920b37f905151b48f18df181503acc21d
CRs-fixed: 370761
Signed-off-by: Swaminathan Sathappan <Swami@codeaurora.org>
2013-02-27 18:13:52 -08:00
David Collins
5f1b9eef24 mfd: pm8038-core: Add support for PMIC thermal alarm
Add pm8xxx-tm subdevice into pm8038-core.  The pm8xxx-tm device
can be used to access the real-time PMIC die temperature.  It
can also be used to trigger an interrupt when critical
temperature thresholds are reached.

Change-Id: I4b8bda1d51cafaa6b77408da4c183bdb2dc4327a
Signed-off-by: David Collins <collinsd@codeaurora.org>
2013-02-27 18:12:12 -08:00