msm: kgsl: Update pagetable on context destruction for A20x

Ensure that pagetable is updated during context destruction. This
resolves stability issues during Camera launch/exit scenarios. Applies
only to A20x GPUs. This change is already done for Z180 device.

Change-Id: I955c7220aa8234009f5bca0a273093e47147279d
Signed-off-by: Rammohan Basavaraju <rammoh@codeaurora.org>
Bluetooth: Send Disconnection reason to Bluez

Send device disconnection reason to bluez on receiving the
diconnection complete event so that low energy profiles
such as proximity can decide to reconnect if the reason
is link loss.

CRs-Fixed: 378240
Signed-off-by: Archana Ramachandran <archanar@codeaurora.org>
(cherry picked from commit da09d26a75ee1c7c1911dcfbe0128fd09f6631f4)

Change-Id: I4c1ec29e4b6c73e4376c9f7cac12e44df7a05699
Signed-off-by: Srivalli Oguri <oguri@codeaurora.org>
mmc: block: add eMMC hardware reset support

For cards that support hardware reset (just eMMC), try a reset and
retry before returning an I/O error.  However this is not done for
ECC errors and is never done twice for the same operation type
(READ, WRITE, DISCARD, SECURE DISCARD) until that type of operation
again succeeds.

Change-Id: I2683983102dc6fe9c76fccc24466f8c6a41560a5
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
Signed-off-by: Konstantin Dorfman <kdorfman@codeaurora.org>
[asutoshd@codeaurora.org: Fixed merge conflicts]
Signed-off-by: Asutosh Das <asutoshd@codeaurora.org>
mmc: core: power-cycle sd card on error

Hardware reset is not implemented in SD card. To circumvent this,
a power-cycle is issued to the card & it is reinitialized.
This would help recovering from 'card stuck in programming state'
situations.

mmc_can_reset:	Added check for SD card.

CRs-fixed: 375869
Change-Id: I8bd7dc071f3569898371d5becca06ec2fe937d4a
Signed-off-by: Asutosh Das <asutoshd@codeaurora.org>
mmc: msm_sdcc: Added hardware reset functionality for SD cards

In error situations, sometimes the card doesn't respond to commands.
To recover from such situations, a power-cycle is issued to the card
and it is reinitialized.

msmsdcc_hw_reset:	Defined in mmc host operations 'hw_reset'.
			This function power-cycles the card.

CRs-fixed: 375869
Change-Id: I2b02649ae3befe700a7a2401b93eb69c8014a4ce
Signed-off-by: Asutosh Das <asutoshd@codeaurora.org>

Conflicts:

	drivers/mmc/host/msm_sdcc.c
ASoc: msm: Multi channel AAC clips don't play

Send channel mapping command to DSP; This command
is used to identify the output PCM buffers's
upsampling/downsampling sequence.

CRs-fixed: 351804
CRs-fixed: 351817 392479
Signed-off-by: Swaminathan Sathappan <Swami@codeaurora.org>
(cherry picked from commit 6f53088ba27a28dc4b894180695538dfffaa7ef7)

Change-Id: I7e5792e07ad35ae33137d8cf0e2644449960ebab
Signed-off-by: Srivalli Oguri <oguri@codeaurora.org>
USB: msm72k_udc: Check if the ep is not disabled before queuing it

Queuing a request on a disabled endpoint during composition switch leads
to prime failure. Hence return -EINVAL if a request is queued on a disabled
endpoint.

Also, in f_mtp, block queuing a request in OUT ep in receive_file_work, if
the device state is STATE_OFFLINE.

CRs-Fixed: 378207
Change-Id: Ic319c854a2149c5bc7b7f8ee8af3e921f609f018
Signed-off-by: Rajkumar Raghupathy <raghup@codeaurora.org>
Rndis: Don't request Host to send aggregated RNDIS packets

Currently MaxPacketsPerTransfer is set to 3 due to which
Windows 7 Host is sending aggregated RNDIS packets. RNDIS driver
is not having de-aggregation support and due to that multi-packet
RNDIS data are not getting decoded properly and those packets are
being discarded. This is leading to degradation in TCP UPLINK
throughput. Hence set MaxPacketsPerTransfer to 1 and accordingly
set MaxTransferSize for accepting 1 RNDIS packet.

CRs-Fixed: 392052
Change-Id: I026148165bc41f017cd9580a0641dfcf2a15005b
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
Signed-off-by: Chiranjeevi Velempati <cvelempa@codeaurora.org>
msm: wfd: Add error handling for input buffer ion map failure

Target reset happens when trying to do a ion_unmap_iommu
on the above fd, which was never mapped. Added a check for
non-zero virtual address.

Change-Id: Ifed884dd9dab6b727845bb22a5d2d19b609e3696
CRs-Fixed: 394779
Signed-off-by: Srinu Gorle <sgorle@codeaurora.org>
Signed-off-by: Srivalli Oguri <oguri@codeaurora.org>
mmc: msm_sdcc: Print data line status in case of errors

The MCI_TEST_INPUT register of the SDC controller depicts the status
of the data lines (if pulled down or not). Print its state in cases of
errors to isolate any device specific issues.

CRs-Fixed: 392889
Signed-off-by: Pratibhasagar V <pratibha@codeaurora.org>
(cherry picked from commit 74bff7cf272ebebc04de8e99a216c32519df52fa)

Conflicts:

	drivers/mmc/host/msm_sdcc.c

Change-Id: I1298eb8242b0f10bc5d80adce5c05ccfe70b7984
Signed-off-by: Srivalli Oguri <oguri@codeaurora.org>
msm: vidc: Enable turbo mode based on client request.

- video core is bumped up to turbo mode, if more performance
  level required from multiple clients.

- Enable turbo mode atleast one of client set turbo mode.

CRs-Fixed: 385454
Signed-off-by: Srinu Gorle <sgorle@codeaurora.org>
(cherry picked from commit 1356b5826e2f9c75ac3feef61ff31fa272a97232)

Conflicts:

	drivers/video/msm/vidc/common/vcd/vcd_core.h

Change-Id: I114f41b3f1166fbc707ae598d61f63326bf6427f
Signed-off-by: Srivalli Oguri <oguri@codeaurora.org>
msm: usb: Tune USB PHY squelch threshold settings

Currently, USB PHY squelch threshold settings(SQRXTUNE) is having
the power on reset value(0x3), due to which enumeration failures
are observed, if amplitude of the USB signal received is less than
threshold. Fix this issue by updating the SQRXTUNE value using
OVERRIDE B register from 6 to 3.

CRs-Fixed: 386598
Signed-off-by: Chiranjeevi Velempati <cvelempa@codeaurora.org>
(cherry picked from commit f983aebfe0b774a22a31b8f75d8d13347b6b25a5)

Conflicts:

	arch/arm/mach-msm/board-8064.c
	arch/arm/mach-msm/board-8930.c
	arch/arm/mach-msm/board-8960.c
	arch/arm/mach-msm/board-9615.c

Change-Id: I3b56cd7d87d1cbb53300fe07e3b6a29e03b18f87
Signed-off-by: Srivalli Oguri <oguri@codeaurora.org>
msm: gpio-v2: Dont re-enable the interrupt and clear the status

If a gpio interrupt is already enabled, do not re-enable it again
and do not clear the interrupt status.
Before this patch:
If an edge interrupt is marked as wakeup, the gpio sys suspend will
clear the status and enable it.
On Resume - the gpio sys resume would clear the intr_status of the wakeup
irq.
Thus, if this particular wakeup irq triggered and woke us up, we lose its
intr_status before calling the gpio summary handler.
Now, when the summary handler is finally called, the irq handler for the
wakeup interrupt is never called.

With this change:
1) Not clearing the intr_status on sys-resume, ensures that it is marked as
pending in the gpio layer.
2) Not re-enabling it again, makes sure that when the irq framework unmasks
all irqs on resume, it does not clear the intr_status either.

Change-Id: I7289522c8c9c97c6f4210433814013160678d130
CRs-Fixed: 400562
Signed-off-by: Rohit Vaswani <rvaswani@codeaurora.org>

Conflicts:

	arch/arm/mach-msm/gpio-v2.c
msm_fb: display: Add timeout for waiting on update

Content Adaptive BackLight userspace algo waits on UPDATE_NOTIFY to
get the screen updates. When turning off CABL, this blocking ioctl
causes the CABL threads to wait until next screen update, which may
take indefinite time.

Add timeout value to the wait_for_completion call, to make ioctl
call blocking for at most timeout value.

CRs-Fixed: 384026
Signed-off-by: Kinjal Bhavsar <kbhavsar@codeaurora.org>
(cherry picked from commit 1b6843a3a56e60e73305c66369f8ad806353e22d)

Change-Id: Ie550f650f399ec15eaedb3814aac6a8562b5bd46
Signed-off-by: Srivalli Oguri <oguri@codeaurora.org>
power: pm8921-charger: Fix liquid 8960 charging LEDs report

LiQUID orange charging LED should be immediately on/off
after external charger start/stop charging (i.e. DC insert/remove).
The green charging LED is on after End-Of-Charging detected.
The blue LED should be used for message notification
and not for dc-online report.

Change-Id: Id53829072ab213c3e594a539c57372bc9db3d340
Signed-off-by: Amir Samuelov <amirs@codeaurora.org>
msm: 8960: Make connector resistance value consistent

The BMS and charger platform data do not reflect
consistent connector resistance.

Fix this by using the rconn_mohm value from the
charger platform data which was the measured value, rather
than the BMS value which was picked for debug purposes.

Change-Id: I50c8a3bc672cc1d62e75d04707bb90342946b17c
Signed-off-by: David Keitel <dkeitel@codeaurora.org>