Audio Packet Router (APR) is used by multiple audio services
to communicate between APSS and ADSP. These audio services
registers for service level APR communication (port 0xFFFFFFFF),
or for session level APR communication (using port 0x101 etc.).
The services might choose to call apr_register for any port at
random. The expectation is that the refcounting for the number
of ports registered with APR for any specific service, is handled
irrespective of the order in which registrations are done. The
current logic fails to handle the refcounting when apr_register
is called for 0xFFFFFFFF before other session based ports. Fix
this correctly using the service count (svc_cnt) variable in apr_svc.
CRs-fixed: 2022490
Change-Id: I2fcd1269facf24d509db0d90314e0d2545a2ad67
Signed-off-by: Banajit Goswami <bgoswami@codeaurora.org>
Glink will return failure if there are no intents available
at the remote endpoint. Remove the GLINK_TX_REQ_INTENT flag
so that glink returns EAGAIN error code so that apr_tal
can retry.
CRs-Fixed: 2002511
Signed-off-by: Surendar karka <sukark@codeaurora.org>
Change-Id: I494bd26ed48ea2d80b1f76c8ee871ec76d428e4c
Audio_notifier_late_init registers clients dependent on PDR to
correct service if registration to PDR on init fails.
There is a possible race condition when audio_notifier_late_init
and audio_notifier_register is called at same time. This may
cause manipulation of the same lists and critical data at the
same time. Add mutex lock to protect critical data.
CRs-Fixed: 2016927
Change-Id: Iec5190a93b390d46f47fd67fd79b1b83d7fe4b29
Signed-off-by: Rohit Kumar <rohitkr@codeaurora.org>
Add size check to ensure the payload fits inside the declared payload
size to prevent loss of data when copying.
CRs-Fixed: 2009224
Signed-off-by: Siena Richard <sienar@codeaurora.org>
Change-Id: I4275c626605272941143b54a7b8861b25f8e750a
When pil loading done through user space helper, there is a possibility
that signal could be pending on thread that initiated the pil, which would
lead to pil failure. To avoid this issue, move pil loading for ADSP, SLPI
and CDSP to separate workqueue in respective loader drivers.
Change-Id: Ie60a7eba7c52ac1565ce166d0e367379cce0b03e
Signed-off-by: Satya Durga Srinivasu Prabhala <satyap@codeaurora.org>
APR client waits in a waitqueue for glink to queue intents.
On receiving notification about availability of intent, wake_up
should be called on the waitqueue to wake up any waiting APR
client.
CRs-Fixed: 1096481
Change-Id: I5a2b902fa831709092be1a9a3073b8d784adba81
Signed-off-by: Vikram Panduranga <vpandura@codeaurora.org>
While notifier de_register, we access the list which is not initialized.
Hence can result in access of uninitialized variable.
Update the loop to use correct list variable.
CRs-Fixed: 2002748
Change-Id: Ibff56477ed3fba90c8ff704ea7dbe3c472f59836
Signed-off-by: Vatsal Bucha <vbucha@codeaurora.org>
Add a mutex to prevent two threads from processing the same response
at the same time. This ensures responses are processed completely and
sequentially.
CRs-Fixed: 1116015
Change-Id: Id2ef32edb939f8af2850b54bd6f6f447939c0732
Signed-off-by: Siena Richard <sienar@codeaurora.org>
It is not always guaranteed that glink will ack all
tx buffers intime and hence apr might run out of tx
buffers for apr message transactions. Create TX buffers
dynamically instead of preallocating fixed number of
buffers.
Change-Id: I53c9529d1e84a88cc2e0b161a8a5047d5a475620
Signed-off-by: Shiv Maliyappanahalli <smaliyap@codeaurora.org>
The glink buffers used to send commands to adsp using
glink_tx() will be freed by glink using notify_tx_abort()
during remote subsystem restart. Implement notify_tx_abort()
so that the buffers can be reclaimed by APR.
Change-Id: Ibc9ce23d4ba15d0e3faa9db3e760965a7439aed8
Signed-off-by: Shiv Maliyappanahalli <smaliyap@codeaurora.org>
Add the ability to log source address, dest address, opcode, token,
and possibly return value in APR IPC logging to better assist
with debugging issues.
CRs-fixed: 1064187
Change-Id: I86976ac6139b8c76d9239acae073f03fbc5e0a38
Signed-off-by: Siena Richard <sienar@codeaurora.org>
Add size checks to validate minimum size is met. Update log messages
to include only relevant information to ensure logs are accurate and
useful.
Change-Id: Idf76a7d964ec6989a0474d49895e54103f17938b
CRs-fixed: 1073129
Signed-off-by: Siena Richard <sienar@codeaurora.org>
Update the error handling when APR sends packet failed so that audio
driver can perform proper error recovery.
CRs-Fixed: 1050605
Change-Id: I6210e244e6299ec747836f40d03e92c15c6e53ee
Signed-off-by: Kuirong Wang <kuirongw@codeaurora.org>
The DOMAIN_ATTR_COHERENT_HTW_DISABLE IOMMU domain attribute is being
removed. SMMU coherency will be configured through the SMMU device tree
nodes moving forward. Remove the obsolete option.
Change-Id: I6ae3cebd4f3a1f3abc8d84ab407d2e256d55309a
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
Initialize return variable to default invalid handle before
it is used. During an error condition it sets correct
error code to avoid returning uninitialized return value.
Change-Id: Ibad70b1bb364b60439c4988e318105a733396db8
Signed-off-by: Vikram Panduranga <vpandura@codeaurora.org>
CRs-Fixed: 1059495
Modify APR driver to use audio notifier framework.
Audio notifier framework connects to best available
subsystem for remote notifications.
Change-Id: I783b7df9c7e0253e5dc88bd60e0b5300e26fba56
CRs-Fixed: 1054000
Signed-off-by: Ben Romberger <bromberg@codeaurora.org>
The audio PDR driver is used to control the process
domain restart recovery mechanism. The audio SSR
driver is used to control the Subsystem Restart
recovery mechanism. Both are controlled through the
Audio Notifier driver which determines whether PDR
or SSR is used and provides the core interface to
all audio drivers.
Change-Id: I15325c1385eaa0f0cca2c07130f2b4a997d98e1f
CRs-Fixed: 1054000
Signed-off-by: Ben Romberger <bromberg@codeaurora.org>
Set APR to use SMEM for the Glink transport
type instead of smd_trans. SMEM is used for all
Glink transport. The transport smd_trans is no
longer used and use of it as a transport causes
Glink to take a very long time to establish a
connection.
Change-Id: Ie65f79051bfc452c63067c21efcfd9d98429bb15
CRs-Fixed: 1050763
Signed-off-by: Ben Romberger <bromberg@codeaurora.org>
After sub system restart, opening glink channel while
lpass transport is not up results in failure and returns
error pointer. APR glink client although returns error for
the first glink command, does not set the apr handle to NULL
and incorrectly assumes err pointer as a valid handle when
opening the channel again.
Fix this by updating the apr handle to NULL when glink_open()
fails.
Change-Id: I53a219b1ebed5bc3593d500d80d580aac6431ab5
Signed-off-by: Shiv Maliyappanahalli <smaliyap@codeaurora.org>
Change all qdsp6v2 audio driver to use %pK instead
of %p. %pK hides addresses when the users doesn't
have kernel permissions. If address information
is needed echo 0 > /proc/sys/kernel/kptr_restrict.
Change-Id: I7baa9f127266726fecf9238167a1e0128a258847
Signed-off-by: Ben Romberger <bromberg@codeaurora.org>
Currently ADSP SSR notifications to APR come much earlier
than ADSP SSR notifications to SLIMbus. This causes audio
playback resume to take more time than expected, as code in WCD
codec driver has dependency on the sequence at which SSR
notifications are received. Add a priority to the notifier
block for APR, so that the APR has lower priority compared
to SLIMbus.
CRs-fixed: 989828
Change-Id: Idb089ec8d036d441e32bc927d7294121a1d2735d
Signed-off-by: Banajit Goswami <bgoswami@codeaurora.org>
APR is required not to send any packet until the far end queues
at least one intent. Add the wait during client registration time.
Change-Id: Ie29ddda4527ae7a70afff2c595d6e3c76500a8af
Signed-off-by: Deven Patel <cdevenp@codeaurora.org>
Signed-off-by: Josh Kirsch <jkirsch@codeaurora.org>
Remove unused variable in the function and avoid typecast
const pointer to non-const ones.
CRs-fixed: 987841
Change-Id: Iaf59087f9d68e134125621afe42d92d49b6b90fc
Signed-off-by: Deven Patel <cdevenp@codeaurora.org>
The transport "smd_trans" is required if far end is running SMD
instead of Glink. If far end is already running Glink, this property
is ignored in Glink layer and communication will be through Glink.
CRs-fixed: 986398
Change-Id: I76b59a9782ab77e1ee3b37afb1db6ec01340ea33
Signed-off-by: Deven Patel <cdevenp@codeaurora.org>
When underlying channel fails to send the APR buffer to the remote
end, APR should put the Tx buffer back into queue to avoid memory
leak.
CRs-fixed: 979283
Change-Id: I4f94daa3c9be748a30d532cf9cc8f3aa2284c060
Signed-off-by: Deven Patel <cdevenp@codeaurora.org>
There's a possible null pointer deference if APR open fails.
Add the fix to handle error case cleanup gracefully.
CRs-fixed: 979283
Change-Id: I4c0cc05bf08d2eae5c27a1dba0a33f4183f81cf3
Signed-off-by: Deven Patel <cdevenp@codeaurora.org>
APR driver was using SMD as the underlying transport layer. In order
to provide a unified IPC solution, G-link is introduced as the replacement
which APR adapts as the new transport layer for audio packet routing.
Change-Id: I60d96e39ce665b808498d1130e371df8288e370a
Signed-off-by: Helen Zeng <xiaoyunz@codeaurora.org>
Signed-off-by: Deven Patel <cdevenp@codeaurora.org>
Add NULL check for the pointer to make sure memory is
allocated. Add array boundary check for the index
before using the same array.
Change-Id: Ifd35ca0c0a1cbeee18d7797ea6b43ea31be0eeba
Signed-off-by: Viraja Kommaraju <virajak@codeaurora.org>
As audio DSP can be running in lpass or modem
based on chipset, add API to get the subsys state
from apr_v2(lpass) and apr_v3(modem) accordingly.
Change-Id: I7a2b6f12574edcc5f609ce8ddf684a840f86d676
Signed-off-by: Laxminath Kasam <lkasam@codeaurora.org>
APSS is unable to open apr_voice_svc channel with destination processor
as MODEM. This is due to MODEM is no longer opening that channel, also
none of the clients on apps are using this channel. Hence, don't request
for the SMD channels when the destination is MODEM, but ensure that apr
clients should be able to receive SSR notifications from MODEM subsystem.
Change-Id: I566dd065ccd75956ab8fd594bb94e09b699258dd
Signed-off-by: Venkata Narendra Kumar Gutta <vgutta@codeaurora.org>
In audio ion driver, append msm_audio_ to API
populate_upper_32bits to maintain consistency
across other API names in this driver.
Change-Id: I72aace56bf8e80c6dd83f768876253d2c7f334bb
Signed-off-by: Laxminath Kasam <lkasam@codeaurora.org>
Add snapshot for audio drivers for MSM targets. The code is
migrated from msm-3.18 kernel at the below commit/AU level -
AU_LINUX_ANDROID_LA.HB.1.3.1.06.00.00.187.056
(e70ad0cd5efdd9dc91a77dcdac31d6132e1315c1)
(Promotion of kernel.lnx.3.18-151201.)
Signed-off-by: Sudheer Papothi <spapothi@codeaurora.org>