Merge "msm: audio: qdsp6v2: Fix noise issue while SSR" into ics_chocolate
Merge "USB: gadget: u_ether: Fix data stall issue in RNDIS tethering mode" into ics_chocolate
Merge changes I11e7a63d,I2dc8e6d8 into ics_chocolate

* changes:
  ASoC: msm: Add the support to detect the WCD9310 version.
  ASoC: wcd9310: Add the support to instantiate codec driver.
msm: pil: Synchronize request_firmware() with suspend

Calling request_firmware() during suspend/resume operations is
buggy and error prone. Therefore a check exists in
request_firmware() to see if a suspend/resume operation is in
progress. In testing we've seen that a wakeup interrupt can come
in during suspend and trigger subsystem restart to call
pil_force_boot() before userspace has fully thawed. Since this is
not allowed the request_firmware() call from pil_force_boot()
fails with -EBUSY and the processor is never rebooted.

Register for PM notifiers to avoid calling request_firmware()
when suspend/resume is in progress. Within the notifier
synchronize any request firmware calls with suspend using a
rwsem. In the case where pil is called before suspend, the
suspend notifier should block on the down_write() during
PM_SUSPEND_PREPARE. When suspend is initiated before pil any pil
operations should block on the down_read() until suspend
finishes. Doing this should fix races between suspend/resume and
request_firmware() within PIL.

Change-Id: Id12d128a3729680b36845de7228bf3919c32a672
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Merge "msm: pm-8x60: Add clock debug to idle code path." into ics_chocolate
Merge changes I49512bcd,I5fd3c784 into ics_chocolate

* changes:
  ASoC: msm: Add the support to detect the WCD9310 version.
  ASoC: wcd9310: Add the support to instantiate codec driver.
msm: spm: Do not set the core voltage during driver initilization

The initial voltage value for the cores are setup by bootloaders for
Core 0. The voltages for the secondary cores are set by Core 0 before
bringing them out of reset. When the cores are out of reset, the SAW
regulator takes care of setting core voltage. Thereby we need not set
the voltage for the cores during SPM driver initialization.

Additionally the commit also reorders the SPM register enums to prevent
initiliazation of status registers.

CRs-fixed: 336256
(cherry picked from commit d740fabec659e29ef056faaffa324bfda2c6c97e)

Conflicts:

	arch/arm/mach-msm/board-8064.c

Change-Id: I641c4c2a8e358298d416f778345fb632052b424a
Signed-off-by: Zhoulu Luo <zluo@codeaurora.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org>
msm: acpuclock-8960: Initialize regulators and bus_bw earlier

The init code assumes that the regulators have already been set
up to support the max CPU frequency. While this is true, the
fewer assumptions we make, the better. So, switch the ordering to
initialize the regulators before switching the frequency. This
also has the nice side-effect of not running the regulators at a
higher than required voltage for fast parts.

While we are at it, also change the bus init ordering so that we
can pick the bus bandwidth that corresponds to the freq the L2
will be initialized to instead of picking the max bandwidth
defined in the bandwidth table.

(cherry picked from commit cfe192bebeb2eaa82b483735e5f8ee5da8c097af)

Change-Id: Ic197d515fb52a25b49c4c2aea32e846bbce9fde2
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
mmc: msm_sdcc: Fix scatterlist processing in PIO mode

sg_miter_next() does not place byte alignment restrictions on
sgl lengths. However, SDCC FIFO must be accessed in multiples
of 4 bytes, requiring rounding which can cause data corruption.

For example, an sgl of length 481 is decribed below:
	struct scatterlist sgl;
	sgl.page_link = 0xXXXX_XXXX;
	sgl.length    = 481;
	sgl.offset    = 3821;

First call to sg_miter_next():
	Sgl length returned = (PAGE_SIZE - 3821) = 275 bytes
	Driver rounds this length to multiple of 4 = 276 bytes

Next call to sg_miter_next():
	Sgl length returned = (481 - 275) = 206 bytes
	Driver rounds this length to 208 bytes

On a write, the extra byte written to the FIFO during the first
276 byte chunk is assumed valid. The next call writes 208 bytes,
but the last 3 bytes (276 + 208 - 481) including 1 valid byte,
are ignored, as the controller uses the MCI_DATA_LENGTH register
to figure out that it only needs to write a total of 481 bytes.

To fix the data corruption in cases as above, a 4 byte bounce
buffer is used realign buffer access to the FIFO, such that 4 byte
multiples are written until the last buffer chunk.

Note that in a simple case where all 481 bytes lie within a page,
the driver rounds the length to 484, but the MCI_DATA_LENGTH
register enusres only 481 bytes are actually written.

CRs-Fixed: 338102
Change-Id: Ia3438652c24c4f67981154bae250533a4c7986d3
Signed-off-by: Oluwafemi Adeyemi <aadeyemi@codeaurora.org>
Bluetooth: Set security level based on remote device features.

Connection security level is modified based on remote device's
extended feature. Deciding SSP capability of remote device
by EIR response is incorrect, because few BT2.1 devices do not
send EIR and few BT2.1 devices which send EIR do not support
SSP. SSP capability of remote device has to be decided based on
remote_extended_features event. This patch makes sure that
MEDIUM_SECURITY is set for non ssp devices' pairing process.

CRs-fixed: 339166
Signed-off-by: Prabhakaran Mc <prabhakaranmc@codeaurora.org>
(cherry picked from commit 453651c5db2cba83b07331199ce5e35a0f6f057b)

Change-Id: I3c6c90f5e0a8ea2eb5737456ecc07b24a2c44e38
Signed-off-by: Ram Kumar Chakravarthy Chebathini <rcheba@codeaurora.org>
Merge changes Ic197d515,Ida2ee603 into ics_chocolate

* changes:
  msm: acpuclock-8960: Initialize regulators and bus_bw earlier
  msm: spm: Do not set the core voltage during driver initilization
msm: kgsl: Poke regularly in adreno_idle

Poking once during adreno_idle is not enough; a GPU hang may still happen.
Seen on 7x27A. Write a few times during the wait timeout, to ensure that
the WPTR is updated properly.

CRs-fixed: 340123
Signed-off-by: Lynus Vaz <lvaz@codeaurora.org>
(cherry picked from commit 284d10404f81d05a59655dd03b72c80fae112b9d)

Change-Id: I7281fc1f02f38380a3f3e8ad16a7298f5bf4c1de
Signed-off-by: Srivalli Oguri <oguri@codeaurora.org>
clk: added tsif clocks

Added tsif_pclk and tsif_ref_clk to the clock list.  These are required
by both the TSIF driver and the TSPP driver on 8960.

Change-Id: I5438a3679e18c8a8ef0a19ee3aea2e9dc2819be9
Signed-off-by: Joel Nider <jnider@codeaurora.org>

Conflicts:

	arch/arm/mach-msm/clock-8960.c

Signed-off-by: Praveena Pachipulusu <pveena@codeaurora.org>
msm_serial_hs_lite: Fix hardware bug by using dummy read of UARTDM register

UARTDM hardware doesn't work if data is transferred immediately after
programming NO_CHARS_FOR_TX register. Hence read out UART Status
Register which introduces one AHB clock cycle delay after programming
NO_CHARS_FOR_TX register.

CRs-Fixed: 340339
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
(cherry picked from commit ec41e9351875484e5c1e83005c20689c3b3ed2cc)

Change-Id: I292a83e760038451129daeeb5de8cb9ffbd77bac
Signed-off-by: Ram Kumar Chakravarthy Chebathini <rcheba@codeaurora.org>
msm_serial_hs_lite: Save UART registers if stuck

Preserve and attempt to print out relevant UARTDM core
registers, followed by panicing the system, if the
polling-mode serial console fails to print a character as a
result of the TX buffer remaining full for more than 100
character transmit times. This information is useful for
troubleshooting extremely rare cases where the serial
console unexpectedly stops producing output.

CRs-Fixed: 340339
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
(cherry picked from commit 1d4731ee979106d1f661418bf0f5544634d26b8e)

Change-Id: If45e8449f65eca2ebfb217d2ee680fa69b108ce7
Signed-off-by: Ram Kumar Chakravarthy Chebathini <rcheba@codeaurora.org>
Bluetooth: Fix L2CAP connection establishment

In hci_conn_security ( which is used during L2CAP connection
establishment ) test for HCI_CONN_ENCRYPT_PEND state also
sets this state, which is bogus and leads to connection time-out
on L2CAP sockets in certain situations (especially when
using non-ssp devices )

Signed-off-by: Ilia Kolomisnky <iliak@ti.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
[mathewm@codeaurora.org: Resolved conflict]
CRs-fixed: 343392
Signed-off-by: Mat Martineau <mathewm@codeaurora.org>
(cherry picked from commit edc44dd5059f7f16a63af462cd1fc48532b8933e)

Change-Id: I9ef864c81eed5b0aaa37683c7dee7f20535ed9e4
Signed-off-by: Ram Kumar Chakravarthy Chebathini <rcheba@codeaurora.org>
Bluetooth: Fix l2cap conn failures for ssp devices

Commit 330605423c fixed l2cap conn establishment for non-ssp remote
devices by not setting HCI_CONN_ENCRYPT_PEND every time conn security
is tested (which was always returning failure on any subsequent
security checks).

However, this broke l2cap conn establishment for ssp remote devices
when an ACL link was already established at SDP-level security. This
fix ensures that encryption must be pending whenever authentication
is also pending.

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Tested-by: Daniel Wagner <daniel.wagner@bmw-carit.de>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
CRs-fixed: 343392
Signed-off-by: Mat Martineau <mathewm@codeaurora.org>
(cherry picked from commit a5e5b0823a45f66a21ef4ef8a5f4b1b8639d828d)

Change-Id: I2ca7894e8c692ea058b14a54a9e47bcefa7add51
Signed-off-by: Ram Kumar Chakravarthy Chebathini <rcheba@codeaurora.org>
msm: camera: optimize csiphy setting

Remove csiphy configuration of phy data lane control
registers and phy clock lane control registers that sets
default value. Tune csiphy configuration of phy data lane
control 2 for reducing LP CLK positioning

The change is to set back to default values, which is
recommended. Also, MIPI clk and data setting is matched in
this patch. Although the discrepancy won't hurt the current
POR camera sensors and most of camera sensors, this patch is
recommended in order to avoid future issue.

Signed-off-by: Hody Hung <hhung@codeaurora.org>
(cherry picked from commit fe282e9d62d3190ba4d8b5ded4f386e451f1a0b9)

Change-Id: Ib080bd62a0e90d168f369cb6df3b89f900e98570
Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org>
defconfig: msm8960: sync up perf defconfig

Sync up msm8960-perf_defconfig with msm8960_defconfig by adding changes
missed in the orignal commit 69d8273 and the 8064 machine type commit
82b7e3f.

Signed-off-by: Jin Hong <jinh@codeaurora.org>
(cherry picked from commit d0a18a682efe4cab6905386e34953856a56b14f8)

Change-Id: Ic3e7ea3a1ca97622824208f2b84601558f4e7cbd
Signed-off-by: Zhoulu Luo <zluo@codeaurora.org>
msm: rtb: Macroize more of the readl/writel code

Most of the readl/writel macros for logging to the RTB
very similar. Create a dedicated macro to use for all of them
to make the code more readable and easier to maintain.

Change-Id: I87cccc092a630abb1c52bcf24c9c55a75d38b1d1
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>