msm_fb: display: alloc/free writeback buffer done at do_blt()

To avoid double freeing writeback at end of blt mode, let
both alloc and free writeback buffer done at do_blt().

Change-Id: Ida5d24589c19be8f6f655eca6add00badca356b2
Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>
Signed-off-by: Siddhartha Agrawal <agrawals@codeaurora.org>
msm_fb: display: add mdp blt mode and switch control

Switching mdp blt mode is done in isr or by turning on/off timing
generator. Add other options: by polling, always-on or always-off. And
add support for external dtv blt mode.

CRs-fixed: 390953
Signed-off-by: Huaibin Yang <huaibiny@codeaurora.org>
(cherry picked from commit f8e389593cd695957834a2de6db769264c0237a9)

Conflicts:

	drivers/video/msm/mdp4_overlay_dsi_video.c
	drivers/video/msm/mdp4_overlay_dtv.c

Change-Id: I34f95d64ece1d776d9499942e0e075c4992fab77
Signed-off-by: Sivasri Kumar Vanka <sivasri@codeaurora.org>
msm_serial_hs : handle uart_flush_buffer

Serial core allocates circular buffer for uart tx transfer.
Circular buffer head and tail is updated in serial core and
circular buffer tail is updated in uart driver.While uart
transfer is happening, uart client bluetooth hci_ldisc,calls
uart_flush_buffer in serial core and sets circular buffer
head and tail to zero.As uart driver does not know when
uart_flush_buffer is called in serial core by uart client,it
updates circular buffer tail for the previous ADM Tx completion.
This leads to queueing Tx command to ADM although no data is
there in circular buffer.Because of this,uart client is not
functional.

Hence adding msm_hs_flush_buffer api which notifies to uart driver
that uart_flush_buffer is called in serial core by uart client and
set tty_flush_receive flag to true.In uart interrupt handler ,do
not update circular buffer tail if uart_flush_buffer is already
called in serial core by uart client else update circular buffer
tail on ADM Tx completion.

CRs-Fixed: 419054
Signed-off-by: Saket Saurabh <ssaurabh@codeaurora.org>
(cherry picked from commit ce39410ad3db5b9fb446bf5da126585d58fa872a)

Change-Id: I91feb551ee74b8d12993de045176e30d24859f8c
Signed-off-by: Sivasri Kumar Vanka <sivasri@codeaurora.org>
msm_serial_hs: Don't configure gpios into UART Mode always

UARTDM device is used as interface to connect external devices through
GPIOs. Currently those GPIOs are configured in active mode once driver's
probe() is called and configured in suspend mode once its remove() is
called. Probe() is called once only and remove is not called until UARTDM
platform device is removed. With this current implementation, although
external device (ex. Bluetooth SoC) is not operational mode, used UARTDM
GPIOs are configured in active mode which is causing more leakage current
and more power consumption.

Hence configure those UARTDM GPIOs in active mode only when used UARTDM
device is opened and under used. Configure UARTDM GPIOs back to suspend
mode when UARTDM device is closed and under not used.

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

Change-Id: Iace76a2cc7ed4d23523ee744b2fb81598eaefada
Signed-off-by: Sivasri Kumar Vanka <sivasri@codeaurora.org>
mmc: sdio: fix resume failure

If SDIO keep power flag (MMC_PM_KEEP_POWER) is not set, card would
be reinitialized during resume but as we are not resetting
(CMD52 reset) the SDIO card during this reinitialization, card may
fail to respond back to subsequent commands (CMD5 etc...).

This change resets the card before the reinitialization of card
during resume.

CRs-Fixed: 424805
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
(cherry picked from commit 2679307563a616af7ab189706604a245c6a3be92)

Change-Id: I9043483d7b4b43bbc3ea550d3820a20502f72c5b
Signed-off-by: Sivasri Kumar Vanka <sivasri@codeaurora.org>
msm_fb: display: remove video_vsync message log

replace pr_info with pr_debug to prevent video_sync log
flooding kernel log.

Change-Id: I6db2af9978c990f87c9b53a0edea5275f3c6da3d
Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>
msm: msm_bus: Explicitly clear client requests before removal

Clients can potentially leave non-zero requests before
unregistering. Such requests persist and cause instability
and severe power and performance impact.

Protect the system against such clients by explicitly
clearing the client requests before unregistration.

CRs-Fixed: 407057
Signed-off-by: Gagan Mac <gmac@codeaurora.org>
(cherry picked from commit e33fc2c1f0ce7a237d06609230746c6340792c1e)

Change-Id: Idf684d1d58a887b670731bd6ead0fe40bd518ae8
Signed-off-by: Sivasri Kumar Vanka <sivasri@codeaurora.org>
staging: android: lowmemorykiller: Add config option to support oom_adj values

The conversion to use oom_score_adj instead of the deprecated oom_adj
values breaks existing user-space code. Add a config option to convert
oom_adj values written to oom_score_adj values if they appear to be
valid oom_adj values.

CRs-Fixed: 389463
Signed-off-by: Arve Hjønnevåg <arve@android.com>
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
(cherry picked from commit 227b6bec898e8785600dea68bcfffaa283063c37)

Change-Id: Ibed828f2f1339da3a92a1315d63f532b567f8de3
Signed-off-by: Sivasri Kumar Vanka <sivasri@codeaurora.org>
defconfig: Enable lowmemorykiller autodetect option

Recent ABI changes have made the lowmemorykiller less effective.
Enable ANDROID_LOW_MEMORY_KILLER_AUTODETECT_OOM_ADJ_VALUE to
detect when the old ABI is being used and convert it to the new
ABI.

Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
(cherry picked from commit d9375ffa8639b72a7b54e2d03ebd25a35d24e6a9)

Change-Id: Ibae526bb768e8b9dc7a44b8c77633e606a371e91
Signed-off-by: Sivasri Kumar Vanka <sivasri@codeaurora.org>
msm_fb: display: add checking y direction for alpha drop

Alpha is dropped when scaling with non repeat pixel method.
Both x and y direction of scaling need to be cehcked for
alpha dropped.

Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>
(cherry picked from commit f0d08071a4e97c9018b8e8def498e07720201da8)

Change-Id: I8cb1ef4e32aa1b862d5608e2db3040842fcbd71f
Signed-off-by: Sivasri Kumar Vanka <sivasri@codeaurora.org>
msm: 8064: fix build error when CONFIG_KS8851 disabled

The #ifdef CONFIG_KS8851 check is not in the right places and causing
build error when CONFIG_KS8851 disabled.

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

Change-Id: Id5aeade9dfedbb451dc333f5a1600da5474feb8c
Signed-off-by: Sivasri Kumar Vanka <sivasri@codeaurora.org>
USB: ci13xxx_udc: Add timeout of 100ms for endpoint flush loop

Currently completion of endpoint flush operation is checked after
setting that endpoint bit with ENDPTFLUSH register and polling the
same to get it clear. It has been observed that sometime this flush
operation takes huge amount of time which results into watchdog
timeout issue due to this busy loop without any time-out. Hence add
time-out of 100ms for endpoint flush operation completion and also
add 100us delay before checking ENDPTFLUSH register for endpoint bit
clear or not.

Also print important usb status register and flushed endpoint dtds
at the time of issue.

(cherry picked from commit bdcbfe5c45aceadf187c7cd1260d6258c3a44869)

Change-Id: I83c40d451fa8ae209554c13cd206aeed2c420847
CRs-Fixed: 409382
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
msm: acpuclock-krait: NULL terminate L2 table for find_cur_l2_level()

find_cur_l2_level() assumes that the L2 table is NULL terminated
when it has never been terminated. Therefore, if the rate that is
read from the hardware during boot is not found in the table we
will run off the end of the table and read potential junk values.
NULL terminate all the L2 tables so that the loop in
find_cur_l2_level() is guaranteed to terminate.

Change-Id: Ia5d0213000b44def35e388fd3cadf0293344257b
Reported-by: Laura Abbot <lauraa@codeaurora.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
msm: acpuclock-8960ab: Set power collapse rate

This line was somehow left out when initially copying the
acpuclock-8960 file over to the acpuclock-8960ab file.

Without this line, power collapse leaves the Krait PLL enabled,
causing failures upon resume.

Change-Id: I1339192d59d8b7f4135b32dcb5807bfc4dababfc
Signed-off-by: Patrick Daly <pdaly@codeaurora.org>
(cherry picked from commit 05686c3d40c93dd14ec089d9b79f9e94939b5c13)
msm: acpuclock-8960ab: Add frequencies up to 1.7 GHz.

The 8960ab application processors are able to run up to 1.7 GHz.
Update the frequency table to enable this.

Change-Id: I99f9250748f15eea2897f9d0e83c88d79d3b2ad9
Signed-off-by: Patrick Daly <pdaly@codeaurora.org>
(cherry picked from commit c3a19dadf921a19a2f5c2f5c5ab0ae9170653b90)
Bluetooth: hci_ath: Configure GPIOs as part of bluetooth on.

Configuration of GPIOs should not be part of module init process
as gpios can be shared with other module.
Moved the configuration of gpios as part of driver open and releasing
them as part of driver close, so that there will not be any conflict
between different modules.

Change-Id: Iac507dd1e07e2cd4adb4c28058800fa4f51c9b52
Signed-off-by: Ram Mohan Korukonda <rkorukon@codeaurora.org>
(cherry picked from commit e359d865fd343481f86abeff5120d573493a72cc)
msm: kgsl: Set 8960PRO GPU chip id

There are two versions of 8960.  Set the 8960PRO chip id correctly.
Ensure 8960 clock values do not get changed when the device is 8960PRO.

Change-Id: I818de1badf090b1e11bd03bed2f410a36c3749e9
Signed-off-by: Carter Cooper <ccooper@codeaurora.org>
board-8960: kgsl: Fix the nominal clock rate on 8960PRO

Set the nominal clock rate to 325MHz for the GPU on 8960PRO.

Change-Id: I94cb7c192fceb85cad0f1ac8430ad8ab7a02a448
Signed-off-by: Carter Cooper <ccooper@codeaurora.org>
msm: kgsl: Enable GPU to use multiple IOMMU devices

Set the defualt IOMMU count to two for the GPU.
If the device is 8960 (ie not 8960PRO), set the IOMMU
count to one and let kgsl take care of initializing only
one IOMMU device.

(cherry picked from commit a4a7ed2dcb30fbf81b58a72d0b010b4092ab2c96)

Change-Id: I4580a32d5494fdce6d6da7a5806ebeb239514867
Signed-off-by: Carter Cooper <ccooper@codeaurora.org>
mmc: msm_sdcc: remove the check for dml busy

dml busy status is supposed to be checked for during bam-to-bam mode
and not in bam-to-system mode. So removing the check for dml busy status
since the driver does not support bam-to-bam mode.

Change-Id: I1496ac441d70dd5efc831768f5ed3bfa11a3f94c
Signed-off-by: Krishna Konda <kkonda@codeaurora.org>
(cherry picked from commit 7a05d53e4aec382db2ce646805f6a69756337fdc)