ASoC: msm8930: Fix to correct the enablement of 5V speaker boost

The 5V speaker boost is not applicable only for 8930 CDP platform.
For all other platfoms, the speaker boost GPIO is needed. Instead
of checking all platforms that need speaker boost, fixed the check
to enable 5V speaker boost for all platforms other than 8930 CDP.

CRs-fixed: 416216
Change-Id: Ia12e7e7149497e3927c1a309733e7e5a6f5c54fe
Signed-off-by: Bhalchandra Gajare <gajare@codeaurora.org>
ASoC: msm: Fix for improper volume ramp up in lpa playback

-A disturbance was heard when switching from one song
to the other, or when the song is paused for greater
than 3 seconds and then resumed
-This was due to the previous value of the track
volume being used in the lpa driver
-This was fixed by setting 0 as the initial volume

Change-Id: I0f82702152c98c46b37ae40a91bbbaa4fb80f5e1
CRs-fixed: 428015
CRs-fixed: 425722
Signed-off-by: Alexy Joseph <alexyj@codeaurora.org>
ASoC: audio: fix unlock Null pointer issue

-In afe_open, trying to unlock mutex on variable
that is already freed.
-correct the sequence by unlock mutex first then
free the variable.

CRs-Fixed: 423196
Change-Id: If7df0e0f46c7d16843c6d52ae821974cc74539ff
Signed-off-by: Laxminath Kasam <lkasam@codeaurora.org>
arm/dt: msm9625: Enable usb otg mode on 9x25

Enable usb otg mode on 9x25

Change-Id: I096431b49ee441206d1b87a54160456522e4ff53
Signed-off-by: Bar Weiner <bweiner@codeaurora.org>
mmc: msm_sdcc: Fix SDCC-BAM, DML reset sequence

Resetting SDCC-BAM after reset of SDCC-DML causes
interface disconnect between SDCC-BAM and SDCC-DML
and lead to hang when SDCC driver initiates data
transfer in BAM mode. Modify the SDCC reset sequence
to reset SDCC-DML after reset of SDCC-BAM.

CRs-Fixed: 423399
Change-Id: Ia31d40e30cbf95befba3b1133a525a81903789f2
Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org>
mmc: core: Reduce the time to check for BKOPS need on idle

In order to allow the card to perform BKOPS as early as possible without
causing degradation to a flow of requests, we reduce the time of the
BKOPS delayed work to 200ms.
Based on experience, 200ms will allow requests to be performed without
a delay of checking the BKOPS.
This patch also allows the host controller to set any other time if
required.

Change-Id: I1e56bfd0c9471abf4da50befe6d14fe0199129e7
Signed-off-by: Maya Erez <merez@codeaurora.org>
USB: ci13xxx_udc: Don't flush and disable all endpoints during disconnect

Flushing and disabling all endpoints during disconnect in controller
driver is simply wasteful and unnecessary.  Flushing endpoints before
notifying disconnect to composite driver will have side effects too.
The active endpoints will be disabled by function drivers when they
notified about disconnect.

The current code use 100 msec timeout for flush operation.  If controller
driver flush and disable all endpoints, the worst case timeout will be
added up to several seconds.  This is leading to watch dog timeout.

CRs-Fixed: 431623
Change-Id: If6a2e87006cda367c2eb4def616e9672e13eadf5
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
mmc: core: disable the cache before suspend only after stopping BKOPS

mmc_cache_ctrl was called in runtime suspend before MMC interrupted
BKOPS in case it is still running on the card. This caused the cache
disable to timeout.
Therefore, mmc_cache_ctrl has to move to mmc_suspend where we are sure
that the card can go into suspend and there is no pending activity.

CRs-Fixed: 436805
Change-Id: I76281a766f48ccacc24685a64067df4e60cfe1d8
Signed-off-by: Maya Erez <merez@codeaurora.org>
USB: gadget: diag: Take spin lock while freeing requests

Freeing USB requests and retiring pending requests can happen in
parallel.  Take spin lock while freeing requests to prevent list
corruption.  Ensure all stale requests are freed before allocating
new requests upon next cable connection.

CRs-Fixed: 436769
Change-Id: Ia5d00844c864c007727a848dc726ec04df137cb9
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
touchscreen: atmel_mxt_ts: Set proper delay for power on and reset

The touch controllers have different delay requirements after power on and
after a software reset. The driver has power on delay and software reset
delay mixed up in definitions. Here we define separate sets of delays for
power on and software reset for various touch controllers and make sure
that each controller's specific delay is applied properly.

CRs-fixed: 435092
Change-Id: I27493e7db38253eda194e9d6a86d5be84921ed04
Signed-off-by: Jing Lin <jinglin@codeaurora.org>
power: pm8921-bms: hold a wakelock while calculating capacity

It was observed that the system goes to suspend when the SOC calculation
is half way through. Prevent it from going to suspend when SOC
calculation is in progress.

Change-Id: I26c4e1fb971f22ec721e1dddcce6b301f5db6608
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
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>
power: pm8921-bms: Relax UUC delta restriction based on time

Previously, the Unusuable Charge calculation was restricted
to changing by 1% every time it was recalculated in order to
meet linearity demands.

However, if the phone is asleep, it might take much longer
than 20 seconds for the UUC to be recalculated, in which it
could have drifted a lot more than 1% due to temperature
changes.

Fix this by allowing UUC to change by an additional 1% for
every 60 real seconds between successive UUC calculations.

Change-Id: Ic1e7cf4da4d2bf73d889aee7bac6cf260b26d532
Signed-off-by: Xiaozhe Shi <xiaozhes@codeaurora.org>
power: pm8921-bms: set minimum average current for UUC

The current code accepts a very low current value when UUC is
calculated. This causes the UUC value to stay very low when the
phone is left idle. This is also the cause that prevents SOC
from going low as the temperature decreases.

Set the minimum average current to 250mA.

Change-Id: I472b9da10e9f45b3c254f8440526f3f9d5116931
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
power: pm8921-bms: fix issues with reading 0 for OCV

There are cases when the OCV value in the register is 0. Most likely
the pmic did not go through a PON sequence or it was disabled while
PON happened.

There are couple of issues with reading 0 in the OCV register
- The driver jumps to end of charge condition when the register read is 0.
- The driver assumes that it never took an OCV and behaves as if it is
  reading the PON OCV on every calculation. Since it sees a value of 0,
  it estimates OCV on every calculation.

Fix this case by initializing ocv_reading_at_100 and
prev_last_good_ocv_raw to an impossibly high value to differentiate
it from the 0 OCV case.

Change-Id: I1560e0df1c89be1db1e1d1aeaaeef2e6da5f85c1
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
defconfig: 8974: Enable LOCALVERSION_AUTO for informative versions

The kernel version is currently just 3.4.0+ which is not very
indicative of what version of software is in the build. Enable
LOCALVERSION_AUTO so that we get the -gXXXXX appended to the
kernel version so we can easily match which build we're on.

Change-Id: I4c3a40ec4268bdc4cdb682700ba765afdf843c0c
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
msm: pil: Fix L2 errors with 32 bit writes to IMEM

IMEM on 8974 requires 32 bit reads and writes, otherwise the
accesses fail and an L2 error occurs. Unfortunately, memcpy_toio
uses a writeb() in a loop, causing problems, so switch to
__iowrite32_copy() which will do 32 bit writes in a loop.

Change-Id: If5f721eec489e595edb63c2f5f52f8eb6ffb506d
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
defconfig: 9x25: Enable EXT3

EXT3 file support is needed for Ext3 SD card

Change-Id: I0e6ac471b5211a3bdc44360f6757880dd32e26d3
Signed-off-by: Smita Ghosh <smitag@codeaurora.org>
mmc: queue: amend buffer swap for non-blocking transfer

In case both 'req' and 'mq->mqrq_prev->req' are null, there is no request
to be processed. That means there is no need to switch buffer.
Switching buffer is required only after finishing 'issue_fn'.

Signed-off-by: Seungwon Jeon <tgih.jun@samsung.com>
Reviewed-by: Per Forlin <per.forlin@stericsson.com>
Tested-by: Johan Rudholm <johan.rudholm@stericsson.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
Signed-off-by: Konstantin Dorfman <kdorfman@codeaurora.org>
msm: clock-8974: Add correct clocks for IOMMU access

The IOMMU driver needs to turn on certain clocks to
access IOMMU registers. Add the correct clocks needed
for IOMMU register access.

Change-Id: Ia1192d0e06ff333f2483fdc4c892c73455e495b8
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>