gpu: ion: enable the kmalloc heap

There are some Ion clients who would like to use the kmalloc
heap. Enable it.

Change-Id: Ie818be9e1211d52d489ad2cb63d94e2fddfc0f01
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
ion: Update ION_SECURE and ION_FORCE_CONTIGUOUS flags

Rename ION_SECURE and ION_FORCE CONTIGUOUS to ION_FLAG_SECURE
and ION_FLAG_FORCE_CONTIGUOUS respectively, but leave the old
ones intact for backwards compatability.

Change-Id: I31ee3088ed202f60e14c10ac66d775c64c01c4e3
Signed-off-by: Adrian Alexei <aalexei@codeaurora.org>
msm: 8960: Track all reservations for memory map

Generate memory map for each reservations for 8960,
8930 and 8064.
Change-Id: I9d5bc8174160ffa410062282f76b15b671219576
Signed-off-by: Chitti Babu Theegala <ctheegal@codeaurora.org>
Merge "msm: 8960: Track all reservations for memory map"
Merge "ion: Update ION_SECURE and ION_FORCE_CONTIGUOUS flags"
Merge "gpu: ion: enable the kmalloc heap"
power: pm8921-bms: fix SOC jumps while entering suspend/resume

The last_soc is being set to -EINVAL when entering suspend. This
causes SOC to jump while coming out of resume.

Instead remember
If we are reporting for the first time after suspend.
The calculated_soc at the time we went to suspend.

Soc should not increase because we cannot suspend while
charging. If the calculated_soc has increased continue reporting
the lower last_soc.

If the calculated soc has dropped check if it has dropped since
suspend. If so decrease the reported soc by the amount it dropped
since suspend.

If the calculated soc has dropped but it has increased since suspend
continue to report the last_soc.

Change-Id: I9040feceaa3e829d11bec0b21e61951f2ed1180b
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
Signed-off-by: Xiaozhe Shi <xiaozhes@codeaurora.org>
power: pm8921-bms: Cancel/schedule work across suspend/resume

Clean up the work before going into suspend to avoid any
race during resume.

While at it, fix the timing comparison during resume
and use the de-referenced chip pointer.

Change-Id: I9e6dbe49e6ad5ebf1cdf9a3cd0ec7f57aa6495c6
Signed-off-by: Anirudh Ghayal <aghayal@codeaurora.org>
power: pm8921-bms: Fine tune SOC reporting during suspend/resume

Report SOC based on the time for which the system was suspended.

Remember -
1. If we recalculated the SOC in resume
2. The last_soc before going into suspend

Two cases arise - if we had a short suspend or if the suspend
was significant to case a drop in SOC. For the former do not
report a change in SOC and for the latter, report the
newly calculated_soc. In either of the cases, soc should not
increase because we cannot suspend while charging.

There is a possibility that the report_soc may be called
before BMS resume (update_power_supply), causing the driver
to report the old SOC. Handle this case by setting state
variables before recalculating the soc in resume.

CRs-Fixed: 482611
Change-Id: Ic21a24a1126800011f5e7e4531c1953436812811
Signed-off-by: Anirudh Ghayal <aghayal@codeaurora.org>
Merge "power: pm8921-bms: fix SOC jumps while entering suspend/resume"
Merge "power: pm8921-bms: Cancel/schedule work across suspend/resume"
msm_serial_hs: Fix synchronization between ADM and UART Cores

With current UART Core programming sequence, it is seen that ADM
and UART Core are going out of sync in few usecases with regression.
It is fixed by using Force RxStale feature of UART Core from
set_termios() and sending discard flush to ADM which would terminate
currently queued UART RX CMD to ADM. Add termios_in_progress check
to make decision about what kind flush to send on receiving RxStale
interrupt. It makes set_termios() more reboust and also keeps ADM
and UART Core in-sync.

Add dma_in_flight to keep check of UART Rx CMD status and BUG_ON if
UART driver is trying to queue one more UART RX CMD to ADM as UART
driver re-uses same UART RX CMD.

This change also adds check of currently set uartclk rate and next
required uartclk rate for new baud rate. If both are same it would
not call clk_set_rate() to set same uartclk rate again.

UART baud rate change request (i.e. executing set_termios()) can come
asynchronously and time to program ADM hardware with queued CMD by ADM
driver is non-deterministic. It is required by UART driver to confirm
that queued RX CMD is programmed with ADM hardware before going with
requested baud rate change operation. Hence this change wait in
set_termios() for ADM driver to program queued RX CMD before going ahead
with baud rate. Otherwise ADM may encounter data bus error with UART RX
channel which is unrecoverable.

Change-Id: I678e91420b33a49ce8b6a5a29c6309f9ff6f5c4a
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
Merge "power: pm8921-bms: Fine tune SOC reporting during suspend/resume"
msm_serial_hs: Disable UART RxStale before Force RxStale in set_termios

There is possible race for handling normal RxStale event and Force
Rxstale event with UART Core, when Force RxStale is issued from
set_termios(). Hence on baud rate change request disable RxStale event
mechanism, and invoke Force RxStale. With RxStale event mechanism
disabled, Force RxStale still generates interrupt.

Fix possible race condition if before completion of previous UART RX CMD
flush, set_termios() request is received. With this case it is quite
possible that rx_tlet() queues one UART RX CMD with ADM driver and also
set_termios() queues one more UART RX CMD which would results with
queueing same UART RX CMD twice with ADM driver. With this device would
crash as the ADM driver will not be able to de-reference the second UART
RX CMD work. Hence add check in set_termios with rx.flush value as
FLUSH_DATA_READY which confirms that flush is initiated but it is not
completed and wait for rx.flush to become FLUSH_NONE which would happen
only once flush is completed and new UART RX CMD is being queued with ADM
driver.

Reduce waiting time for discard flush completion as it is already waited
for queued UART Rx CMD to be programmed with ADM hardware. Hence change
wait time out from 300 jiffies to 50 mseconds.

Add an API to get important UART core registers values which can be called
from error condition. Use the same when discard flush timeout happens with
set_termios(), when rx.dma_in_flight is not set with set_termios() and when
multiple UART RX CMD queueing condition is seen in msm_hs_start_rx_locked()
API.

CRs-Fixed: 486260
Change-Id: I9fd17e453fad619609e76e8b3a72a4f47210cff9
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
msm_serial_hs: Improve UART Shutdown path

For uart port close operation, serial core calls msm_hs_stop_rx_locked()
which sends discard flush request to ADM driver after changing rx.flush
state machine from FLUSH_NONE to FLUSH_STOP value. Next serial core
calls msm_hs_shutdown()and it waits for discard flush completion with
rx.flush state machine to be set as FLUSH_SHUTDOWN to complete uart
port close operation. With this approach, transfer termination is not
known by UART Core which may still allow UART core to make CRCI request
with ADM Core if new data is being received from remote uart. Hence
invoke Force RxStale from msm_hs_stop_rx_locked() which informs UART
core to terminate current Rx transfer and do not make any new CRCI
request with ADM core for any new incoming data. On receiving RxStale
interrupt, it sends discard flush request to ADM driver to terminate
transfer with ADM hardware.

This new programming sequence is required to get both UART and ADM
hardwares in-sync for termination of transfer.

CRs-Fixed: 475230
Change-Id: I802a456294d4fd2fa51a5f4e918a4f4f22bc5ee3
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
Merge "msm_serial_hs: Fix synchronization between ADM and UART Cores"
Merge "msm_serial_hs: Disable UART RxStale before Force RxStale in set_termios"
Merge "msm_serial_hs: Improve UART Shutdown path"
ASoC: msm: Fix the register address of TX4 registers

The TX4 register address are not correct and needs to be fixed to
correct offset.

CRS-fixed: 486923
Change-Id: Iacb4a57a8c0a8508a68d057d0d431715e617eba5
Signed-off-by: Asish Bhattacharya <asishb@codeaurora.org>
Merge "ASoC: msm: Fix the register address of TX4 registers"