ASoc: msm: Add ASM function q6asm_get_audio_client
Add function to get the ASM audio client from a session
ID. Allow the ability to get audio client information
used by the ASM interface when only a session ID is
available.
Change-Id: Id9be30954c1a839648194c4a0120cccd341afae4
Signed-off-by: Ben Romberger <bromberg@codeaurora.org>
diff --git a/include/sound/q6asm.h b/include/sound/q6asm.h
index f146684..16439e8 100644
--- a/include/sound/q6asm.h
+++ b/include/sound/q6asm.h
@@ -147,6 +147,8 @@
struct audio_client *q6asm_audio_client_alloc(app_cb cb, void *priv);
+struct audio_client *q6asm_get_audio_client(int session_id);
+
int q6asm_audio_client_buf_alloc(unsigned int dir/* 1:Out,0:In */,
struct audio_client *ac,
unsigned int bufsz,
diff --git a/sound/soc/msm/qdsp6/q6asm.c b/sound/soc/msm/qdsp6/q6asm.c
index eb55f77..268d2e5 100644
--- a/sound/soc/msm/qdsp6/q6asm.c
+++ b/sound/soc/msm/qdsp6/q6asm.c
@@ -440,6 +440,23 @@
return NULL;
}
+struct audio_client *q6asm_get_audio_client(int session_id)
+{
+ if ((session_id <= 0) || (session_id > SESSION_MAX)) {
+ pr_err("%s: invalid session: %d\n", __func__, session_id);
+ goto err;
+ }
+
+ if (!session[session_id]) {
+ pr_err("%s: session not active: %d\n", __func__, session_id);
+ goto err;
+ }
+
+ return session[session_id];
+err:
+ return NULL;
+}
+
int q6asm_audio_client_buf_alloc(unsigned int dir,
struct audio_client *ac,
unsigned int bufsz,