Commit Graph

153 Commits

Author SHA1 Message Date
Dilip Kota e4cf4f803e slim-msm: Synchronize SSR callbacks
Subsystem will restart within short timeframe.
Synchronise subsytem up/down callback notifications
to avoid functionality failures.
Use mutex locks to achieve synchronization.

Change-Id: I5881c7d468507bb8402a2e9f8178b9c31e57e8a5
Signed-off-by: Dilip Kota <dkota@codeaurora.org>
2017-05-05 19:20:28 +00:00
LuK1337 fc9499e55a Import latest Samsung release
* Package version: T713XXU2BQCO

Change-Id: I293d9e7f2df458c512d59b7a06f8ca6add610c99
2017-04-18 03:43:52 +02:00
Dilip Kota 9a5cd01d7b slim-msm-ngd:Avoid using stale pipe handle
Make sure to use pipe handle from the TX
endpoint rather than using a stored handle.
The stored handle may become invalid if SSR
happens between storing of that handle
and locking the mutex.

Change-Id: I53e8f860c2d50061b6c4e6ce2f944c1e2ed8dff2
Signed-off-by: Dilip Kota <dkota@codeaurora.org>
2016-07-04 05:32:48 -07:00
Sagar Dharia 4881556669 slim: msm: Improve bulk message timeout error handling
If a bulk message times out due to interrupt starvation, a late
coming interrupt may access structures that are not valid.
Improve timeout error handling by resetting variables, and changing
relevant logging.

Change-Id: Ie0ee2fd9c2ce1628c69e1975fe713a2a26d9e716
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
2016-02-16 22:50:46 -08:00
Linux Build Service Account cbb9b47740 Merge "slimbus: Reset data channels for a controller when framer reboots" 2016-02-09 02:52:12 -08:00
Linux Build Service Account 7587ddd6e4 Merge "slim: msm: Fix the instance number being sent to ADSP" 2016-02-08 13:43:40 -08:00
Sagar Dharia a404cc5d84 slimbus: Reset data channels for a controller when framer reboots
Framer is responsible for clocking slimbus, and when it reboots, state
of all associated data channels is reset to be consistent with HW
state.

Change-Id: Ie74ace2b20ad6c255440ff6ce593f7d5503bf388
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
2016-02-08 01:29:48 -08:00
Sagar Dharia d12db1dea9 slim: msm: Fix the instance number being sent to ADSP
Every bus instance can have 2 NGD devices. Fix the instance number
determination based on NGD device-id.

Change-Id: I515f4f09d58a7abc0c0322ca714b88fb847a0909
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
2016-02-08 01:29:35 -08:00
Sagar Dharia 7e1d0cce12 slim: msm: Return success for ch-remove type of messages during SSR
During SSR, all channels are removed and ports are disconnected since
slimbus HW is not functional. Return success to clients for such
calls so that client can mark channel/port state constistent with HW

Change-Id: I9b18f8e7ffe233090c9612d0811a7d36645d0329
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
2016-02-07 23:13:30 -08:00
Sagar Dharia c98b1ff7ad slim: msm: Set Device state to sleep in case of a suspend-timeout
If low-power mode is not entered due to timeout, it is possible that
HW has actually been turned off by ADSP but the response was not
received by driver on apps on time.
Change device state to sleep to make sure HW is woken up for
subsequent runtime-resume operation.

Change-Id: I4e454f7e90e1244985c86286b95202eecfc50a7e
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
2016-01-04 23:12:54 -08:00
Sagar Dharia 61b972d477 slim_msm: Gracefully handle QMI timeout failures
QMI timeout can happen if other processor doesn't respond within the
time expected by slimbus driver on apps. It has been noticed that QMI
call to power-on slimbus rarely takes more than 500msec. Timeout
is increased to allow that possibility. Additionally, QMI channel is
drained out of left-over messages and runtime-PM state check is
modified to allow graceful handling of timeout if at all any timeout
still happens.

Change-Id: I392a4fa761735135a261fb543815823cee5eba41
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
2015-12-17 02:14:01 -08:00
Linux Build Service Account ab7c5d37ad Merge "slim-msm: Optimize descriptor reading in the rx path" 2015-10-30 16:36:12 -07:00
Dilip Kota 74bf41c4f7 slim-msm: Optimize QMI response timeout
For a Slimbus transaction through QMI, timeout
if there is no response within 500ms and return
timeout to the slimbus client.
Transactions through QMI will complete within milli
seconds. So it is better to timeout for 500ms
instead of 5 seconds.

Change-Id: I818b7c6ff7941d183e1975b21a092f37a0d94264
Signed-off-by: Dilip Kota <dkota@codeaurora.org>
2015-10-29 03:56:41 -07:00
Naveen Kaje 102b8cb6fe slim-msm: Optimize descriptor reading in the rx path
Read and process as many RX DMA descriptors as possible
in a single callback. Handle the case where partial messages
are received and process them later when the complete message
arrives.

Change-Id: I40beb701874d1d2fafc3acf69c144b654ebae74b
Signed-off-by: Naveen Kaje <nkaje@codeaurora.org>
2015-10-29 03:38:06 -07:00
Naveen Kaje b2afdcea82 slimbus: msm: Deinit/Reinit BAM pipe after SSR
If SSR happens, deinitialize and reinitialize BAM pipes used for
TX and RX messaging.

Change-Id: Ia025aafac9072eac887603bccb1acf5465dfb805
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
Signed-off-by: Naveen Kaje <nkaje@codeaurora.org>
2015-10-26 00:41:08 -07:00
Linux Build Service Account 997791127a Merge "slimbus:ratelimit the warning and errors" 2015-09-22 15:32:56 -07:00
Linux Build Service Account 8ecc331c39 Merge "slimbus: ngd: Rely on HW status for capability negotiation message" 2015-09-21 07:11:03 -07:00
Linux Build Service Account 31220f7305 Merge "slim_msm: Handle BAM resources" 2015-09-21 07:11:02 -07:00
Ramesh Gupta Guntha 8ba5afc391 slimbus:ratelimit the warning and errors
NO MERGE
This is to avoid the NS WDT issues because of the
excessive logging from tasha codec write failures.

Change-Id: I3502c21de6f4147fb47b1e2224d5a074143747ce
Signed-off-by: Ramesh Gupta Guntha <rgguntha@codeaurora.org>
2015-09-21 19:10:35 +05:30
Sagar Dharia 198210a222 slimbus: ngd: Rely on HW status for capability negotiation message
HW status in config register will provide consistent information
in case HW status changes due to unexpected noise on the lines.
Use that status to initiate capability negotiation rather than
SW status.
This means the negotiation may take place during runtime if HW
experiences noise. Ensure completion objects don't get re-initialized
accidentally due to this since thread responsible for exchanging this
capability can be waiting on it.

Change-Id: Ifee39473b7b4b63de44a392bb4040bcd9b98e2ff
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
Signed-off-by: Dilip Kota <dkota@codeaurora.org>
2015-09-16 12:24:02 +05:30
Sagar Dharia 870f6f29c2 slimbus: ngd: Optimize bulk write transactions
Allocate bulk-write transactions in advance for most-commonly
used bulk sizes, and reallocate only if size greater than that is
requested by client.

Change-Id: Ib5a80f3713fe5b94bd6dcf45ffe61e498fada192
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
Signed-off-by: Dilip Kota <dkota@codeaurora.org>
2015-09-15 23:51:39 -07:00
Dilip Kota 84ef44bd3c slim_msm: Handle BAM resources
Make sure BAM resources are initialized
before de-initialization.

Change-Id: I32d5de5abc90995b9732bf565eca35efe0915004
Signed-off-by: Dilip Kota <dkota@codeaurora.org>
2015-09-15 23:50:55 -07:00
Linux Build Service Account c4efea8690 Merge "slim_ngd: Serialize shutdown sequence during SSR down" 2015-08-01 20:09:03 -07:00
Sagar Dharia 56b3d9e2f2 slimbus: Use irq-safe methods for transaction lock
Slimbus transactions are process-completed in interrupt context.
This involves signaling appropriate transaction from transaction table
and/or invalidating transaction in error case. Due to this, the
transaction need to be accessed from interrupt context as well. Use
irq-safe methods to avoid interrupt accessing the lock while thread
has acquired it.

Change-Id: Ibe800a64a7594cc435d229e05dda91baea8c9b6e
Signed-off-by: Naveen Kaje <nkaje@codeaurora.org>
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
2015-07-19 10:44:19 -07:00
Dilip Kota bd4ffadb36 slim_ngd: Serialize shutdown sequence during SSR down
During SSR down, work is queued for shutdown
sequence. Sometimes work is getting scheduled
on one CPU while SSR up sequence is running
on other CPU. This is leading to unexpecpted
scenarios and ending with crash.
To overcome this, serialize shutdown sequence
by doing function call instead of workqueue.
And remove ctrl_up signal reset in the shutdown
sequence as it is affecting the transactions
initiated by client.

Change-Id: If73999ad19441e2090c4ad181dbc90e62ad3d9d4
Signed-off-by: Dilip Kota <dkota@codeaurora.org>
2015-07-18 03:49:22 -07:00
Linux Build Service Account 369dfc05f2 Merge "slim_msm: Optimize RX path for slimbus" 2015-07-06 21:52:00 -07:00
Linux Build Service Account 9d81827781 Merge "slimbus: Support multiple message transactions per call" 2015-07-05 02:35:39 -07:00
Sagar Dharia 159728155d slimbus: Support multiple message transactions per call
Bandwidth intensive operations (such as firmware download) need
lot of messages to be sent over the bus. This API adds support to
queue multiple messages to HW and provides controller implementation
using BAM.
The API can also be used in places where slimbus slaves have strict
ordering/timing restrictions (e.g. send 2 specific register-writes
back-to-back).

Change-Id: I9a0779e0c4b957d4f4e3b31567b983457d367193
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
2015-07-03 02:26:49 -07:00
Naveen Kaje bb3f71b37f slim-msm-ngd: Change the NGD interrupt to be an ISR
NGD interrupt can be handled in the interrupt
context as an ISR to process the rx messages faster.

Change-Id: Iaf615520617448160901d0b5de03efc9708d8437
Signed-off-by: Naveen Kaje <nkaje@codeaurora.org>
2015-07-03 12:59:58 +05:30
Sagar Dharia f7011a0df4 slim_msm: Optimize RX path for slimbus
Optimize RX path by handling small message responses, and
satellite acknowledgements in interrupt context to avoid multiple
context switches.

Change-Id: I111c7ad81e8023a811854632f165185b06157822
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
2015-07-01 16:52:28 +05:30
Linux Build Service Account 18913d03d5 Merge "slim-msm: Add support to set port config and options" 2015-06-30 23:48:37 -07:00
Linux Build Service Account bf93fd8312 Merge "slim-msm: manage TX message queue pointer" 2015-06-29 17:51:51 -07:00
Naveen Kaje 24dd407b57 slim-msm: Add support to set port config and options
Add support to let the client specify the slimbus port
configuration.

Change-Id: I314a5b8562d098b8eeb504e89ebdc3f83c64b975
Signed-off-by: Naveen Kaje <nkaje@codeaurora.org>
2015-06-29 11:53:18 -06:00
Naveen Kaje 69824ab8e5 slim-msm: manage TX message queue pointer
In the TX message queue handler, update the TX head such that
it correctly points to the next message to be processed. Fix
the logic such that all the processed IO vectors are handled, even
when the packets arrive out of order.

Change-Id: Iee45c5acb45f9a8eb475667cc4a87d13b62adc7a
Signed-off-by: Naveen Kaje <nkaje@codeaurora.org>
2015-06-24 15:02:50 -06:00
Naveen Kaje 393dd75ca9 slim-msm: reset port interrrupt status register when disconnected
When the port is disconnected, reset the interrupt enable
status bit corresponding to that port.

Change-Id: I3cff18ea205e9ce9a992cfa2b90bddf5da1d361a
Signed-off-by: Naveen Kaje <nkaje@codeaurora.org>
2015-06-24 14:18:26 -06:00
Dilip Kota 9d1a97fab0 slim-msm: Configure push pull protocol on MSM Controller
Configures push pull protocol parameters on
MSM controller. It makes sure to program the
push pull protocol per channel in the framework.
Irresepective of client request, configure to
ISO protocol if channel frequency is multiple
of super frame frequency.

Change-Id: I7f9fc4d7af682d27f617d0220bab2d9b79ade6c8
Signed-off-by: Dilip Kota <dkota@codeaurora.org>
2015-06-16 20:16:00 +05:30
Linux Build Service Account 646ee15ff3 Merge "slim_msm: Reorganise Rx/Tx tear-down during DSP-SSR" 2015-06-12 00:05:14 -07:00
Linux Build Service Account 8001c627f9 Merge "slimbus: Add support to specify port config and options" 2015-06-11 13:07:53 -07:00
Dilip Kota 4bff71fc33 slim_msm: Reorganise Rx/Tx tear-down during DSP-SSR
Rx/Tx pipe resources are freed during DSP down.
Simultaneously BAM ISR due to Rx/Tx interrupt
may access the Rx/Tx pipe resources leading to
pagingfault.
To overcome this, Rx/Tx activity is reorganised by
disabling the interrupt during ADSP down and
freeing, allocating resources during ADSP up.

Change-Id: Id1b77a05a042ef9ca194f78e700670edf6146db6
Signed-off-by: Dilip Kota <dkota@codeaurora.org>
2015-06-10 08:27:50 +05:30
Sagar Dharia e577f13f94 slimbus: Protect transaction-id assignment
Transaction ID is used by slimbus for reply-information or
reply-value messages. Ensure transaction ID assignment is protected
to avoid race condition between 2 or more transactions.

Change-Id: Ie8943de0bcbb9d7fddc22025af051d74e6c9901a
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
2015-05-15 16:06:55 -07:00
Sagar Dharia d382ee5e19 slimbus: Add support to specify port config and options
Client should be able to specify port configuration if it differs
from the default configuration

Change-Id: Iecc019de0b10c6931f5c1e521efd4f6fee178fe9
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
2015-05-01 15:07:53 -06:00
Naveen Kaje 84db5256a6 slim-msm: send port disconnect messages over slimbus
Ensure that master-side port disconnection messages are
sent over the slimbus rather than only disabling the port
itself.

Change-Id: Ica2351a325245531349af7b62b2e9d691c569ff2
Signed-off-by: Naveen Kaje <nkaje@codeaurora.org>
2015-04-29 12:35:15 -06:00
Sagar Dharia e95bc325be slim_ngd: Send data-length instead of segment for defining channel
Master component expects data-length instead of segment length and
those two may differ for some protocols.

Change-Id: Idf48f856f7c58d80304f9f13b642d1bccdb09e83
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
2015-04-16 11:48:07 -06:00
Linux Build Service Account 8e5e13cc24 Merge "slimbus: Optimize transaction handling in the framework" 2015-03-29 10:44:53 -07:00
Matt Wagantall b9e225f00a slim-msm: Don't truncate sps_iovec addresses to 32-bits
The 'addr' member of the sps_iovec struct only contains the bottom
32 bits of the physical address.  Use the DESC_FULL_ADDR() macro to
extract the full address (the upper 4 bits of which are encoded in the
'flags' struct member).

Change-Id: I47e4a72df7b39888680e4f8931d030da576d03e2
Signed-off-by: Matt Wagantall <mattw@codeaurora.org>
2015-03-16 20:19:27 -07:00
Sagar Dharia 68e2f99712 slimbus: Optimize transaction handling in the framework
Avoid overhead of allocating/freeing structure for transaction
if that transaction is synchronous. For synchronous transactions,
structure is defined on stack using a macro for simplicity. Since
structure is not allocated per transaction and locking is required
only for a few simple instructons, spinlock can be
used to protect the transaction table.

Change-Id: I79ea64b98907ab71fd727d76cf78a2d6feaf0eb0
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
2015-02-13 15:59:21 -07:00
Sagar Dharia 7fcbb4b6f7 slim_msm: Do not deregister BAM if command-only pipes fail to init
Command only BAM pipes may fail to initialize post-SSR. We can still
use register-interface for sending commands to/from Slimbus.
In that case, do not deregister BAM handle since it is possible that
other BAM usecases (e.g. apps channels) will still need BAM.

Change-Id: I6c74394402c45933b4cde694e998c0d88e126114
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
2015-02-11 17:09:57 -07:00
Linux Build Service Account 2fe5bd6ef7 Merge "slimbus: Support push-pull data channel protocol" 2015-01-15 23:26:24 -08:00
Sagar Dharia 6b4bbcba3a slimbus: Support push-pull data channel protocol
Start supporting push-pull data channel protocol in slimbus driver
since the slimbus HW supports it now.

Change-Id: If6b26a696cd2a459a5c5215588711ea037e778ac
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
2014-12-16 12:34:21 -07:00
Dilip Kota e291556030 slim_ngd: Increase Rx throughput
Read complete message at a time instead of
4bytes of a message.Hardware Rx timeout
feature helps to achieve it.

Change-Id: I42d4dc63438816c8ce800c86f359e93cddd5bad3
Signed-off-by: Dilip Kota <c_dkota@codeaurora.org>
2014-12-09 20:39:08 -08:00