msm: qdspv2: apr cleanup
Subsystems (3)
cover msm: qdspv2: apr cleanup
From: Eero Nurkkala <[email protected]>
After this set, the apr.c should be far less complex and have less code. Everything should work as always after every commit.
Patch 6/7 makes an assumption that all voice goes to (comes from) modem - thus PATCH/RFC. But that's how it looks:
(but certainly it could break things if there's clients not included in the open source code)
if (hdr->src_domain == APR_DOMAIN_MODEM) {
src = APR_DEST_MODEM;
if (svc == APR_SVC_MVS || svc == APR_SVC_MVM ||
svc == APR_SVC_CVS || svc == APR_SVC_CVP ||
svc == APR_SVC_TEST_CLIENT)
-> clnt = APR_CLIENT_VOICE;
else {
pr_err("APR: Wrong svc :%d\n", svc);
return;
}
} else if (hdr->src_domain == APR_DOMAIN_ADSP) {
src = APR_DEST_QDSP6;
if (svc == APR_SVC_AFE || svc == APR_SVC_ASM ||
svc == APR_SVC_ADM || svc == APR_SVC_ADSP_CORE ||
svc == APR_SVC_TEST_CLIENT || svc == APR_SVC_ADSP_MVM ||
svc == APR_SVC_ADSP_CVS || svc == APR_SVC_ADSP_CVP)
-> clnt = APR_CLIENT_AUDIO;
else {
pr_err("APR: Wrong svc :%d\n", svc);
return;
}
} else {Applies to android-msm-2.6.35 -branch.
Summary:
arch/arm/mach-msm/include/mach/qdsp6v2/apr.h | 35 +++- arch/arm/mach-msm/qdsp6v2/apr.c | 284 +++++--------------------- arch/arm/mach-msm/qdsp6v2/apr_tal.c | 2 +- arch/arm/mach-msm/qdsp6v2/apr_tal.h | 69 ------- arch/arm/mach-msm/qdsp6v2/apr_tal_debug.c | 21 ++- arch/arm/mach-msm/qdsp6v2/q6adm.c | 10 +- arch/arm/mach-msm/qdsp6v2/q6afe.c | 4 +- arch/arm/mach-msm/qdsp6v2/q6asm.c | 4 +- arch/arm/mach-msm/qdsp6v2/q6voice.c | 15 +- 9 files changed, 123 insertions(+), 321 deletions(-)
PATCH 1/7 msm: qdspv2: apr: remove unused load_q6()
From: Eero Nurkkala <[email protected]>
Remove this unused function load_q6().
Moreover, it contains unusual use of svc_idx: (not initialized):
static int svc_idx;
...mutex_lock(&client[dest_id][client_id].svc[svc_idx].m_lock); mutex_unlock(&client[dest_id][client_id].svc[svc_idx].m_lock);
--- arch/arm/mach-msm/qdsp6v2/apr.c | 46 --------------------------------------- 1 files changed, 0 insertions(+), 46 deletions(-)
arch/arm/mach-msm/qdsp6v2/apr.c +0 -46
@@ -464,52 +464,6 @@ void change_q6_state(int state)mutex_unlock (&q6.lock); } -void load_q6 (void ) -{ -static int client_id =APR_CLIENT_AUDIO ; -static int dest_id =APR_DEST_QDSP6 ; -static int svc_idx; -int delay_cnt =0 ; - -mutex_lock (&q6.lock); -if (q6.state ==APR_Q6_NOIMG ) { - q6.pil =pil_get ("q6" ); -if (!q6.pil) { -pr_info ("APR: Unable to load q6 image\n" ); - goto q6_unlock; - } - q6.state =APR_Q6_LOADING ; - } -pr_info ("Q6 loading done: Waiting for apr_init\n" ); -mutex_lock (&client[dest_id][client_id].svc[svc_idx].m_lock); -do { - client[dest_id][client_id].handle =apr_tal_open (client_id, - dest_id,APR_DL_SMD , apr_cb_func,NULL ); -if (!client[dest_id][client_id].handle) { -if (q6.state ==APR_Q6_LOADED ) { -pr_info ("APR: Unable to open handle\n" ); - goto unlock; - } -udelay (5 ); -if (delay_cnt++ <400000 ) -continue ; - }else if (q6.state ==APR_Q6_LOADING ) { - q6.state =APR_Q6_LOADED ; -pr_info ("apr_init done\n" ); -msleep (50 ); -pr_info ("Audio init done\n" ); - } -break ; - }while (1 ); - -if (delay_cnt >=400000 ) -pr_info ("Q6 Init not yet done in 2 secs\n" ); -unlock: -mutex_unlock (&client[dest_id][client_id].svc[svc_idx].m_lock); -q6_unlock: -mutex_unlock (&q6.lock); -} -int adsp_state (int state) {pr_info ("dsp state = %d\n" , state);
Signature · 1 line
1.7.0.4
PATCH 2/7 msm: qdspv2: apr: remove unused apr_fill_hdr()
In reply to [email protected]From: Eero Nurkkala <[email protected]>
Remove the unused function to make things more readable.
--- arch/arm/mach-msm/qdsp6v2/apr.c | 48 --------------------------------------- 1 files changed, 0 insertions(+), 48 deletions(-)
arch/arm/mach-msm/qdsp6v2/apr.c +0 -48
@@ -41,54 +41,6 @@struct apr_q6 q6;struct apr_client client[APR_DEST_MAX ][APR_CLIENT_MAX ]; -inline int apr_fill_hdr (void *handle,uint32_t *buf,uint16_t src_port, -uint16_t msg_type,uint16_t dest_port, -uint32_t token,uint32_t opcode,uint16_t h_len) -{ -struct apr_svc *svc = handle; -struct apr_client *clnt; -struct apr_hdr *hdr; -uint16_t dest_id; -uint16_t client_id; -uint16_t type; -uint16_t hdr_len; -uint16_t ver; - -if (!handle || !buf || h_len <APR_HDR_SIZE ) { -pr_err ("APR: Wrong parameters\n" ); -return -EINVAL ; - } - dest_id = svc->dest_id; - client_id = svc->client_id; - clnt = &client[dest_id][client_id]; - -if (!client[dest_id][client_id].handle) { -pr_err ("APR: Still service is not yet opened\n" ); -return -EINVAL ; - } - - hdr = (struct apr_hdr *)buf; - hdr_len = h_len >>2 ; - hdr->pkt_size = h_len; - hdr->src_domain =APR_DOMAIN_APPS ; - hdr->src_svc = svc->id; - hdr->dest_svc = svc->id; -if (dest_id ==APR_DEST_MODEM ) - hdr->dest_domain =APR_DOMAIN_MODEM ; -else if (dest_id ==APR_DEST_QDSP6 ) - hdr->dest_domain =APR_DOMAIN_ADSP ; - - hdr->src_port = src_port; - hdr->dest_port = dest_port; - hdr->token = token; - hdr->opcode = opcode; - ver =APR_PKT_VER ; - type = msg_type; - hdr->hdr_field = ((msg_type &0x0003 ) <<0x8 ) | - ((hdr_len &0x000F ) <<0x4 ) | (ver &0x000F ); -return 0 ; -} -int apr_send_pkt (void *handle,uint32_t *buf) {struct apr_svc *svc = handle;
Signature · 1 line
1.7.0.4
PATCH 3/7 msm: qdspv2: apr: drop apr_tal.h
In reply to [email protected]From: Eero Nurkkala <[email protected]>
Drop apr_tal.h, and merge it with the apr.h. It simplifies things later, as there will be no need to include apr_tal.h in:
- apr_tal_debug.c
- q6adm.c
- q6afe.c
- q6asm.c
- q6voice.c
--- arch/arm/mach-msm/include/mach/qdsp6v2/apr.h | 33 ++++++++++++ arch/arm/mach-msm/qdsp6v2/apr.c | 1 - arch/arm/mach-msm/qdsp6v2/apr_tal.c | 2 +- arch/arm/mach-msm/qdsp6v2/apr_tal.h | 69 -------------------------- 4 files changed, 34 insertions(+), 71 deletions(-) delete mode 100644 arch/arm/mach-msm/qdsp6v2/apr_tal.h
arch/arm/mach-msm/include/mach/qdsp6v2/apr.h +33 -0
@@ -175,4 +175,37 @@ int apr_deregister(void *handle);void change_q6_state (int state);void q6audio_dsp_not_responding (void ); +/* APR Client IDs */ +#define APR_CLIENT_AUDIO 0x0 +#define APR_CLIENT_VOICE 0x1 +#define APR_CLIENT_MAX 0x2 + +#define APR_DL_SMD 0 +#define APR_DL_MAX 1 + +#define APR_DEST_MODEM 0 +#define APR_DEST_QDSP6 1 +#define APR_DEST_MAX 2 + +#define APR_MAX_BUF 8192 + +typedef void (*apr_svc_cb_fn )(void *buf,int len,void *priv); +struct apr_svc_ch_dev *apr_tal_open (uint32_t svc,uint32_t dest, +uint32_t dl,apr_svc_cb_fn func,void *priv); +int apr_tal_write (struct apr_svc_ch_dev *apr_ch,void *data,int len); +int apr_tal_close (struct apr_svc_ch_dev *apr_ch); +struct apr_svc_ch_dev { +struct smd_channel *ch; +spinlock_t lock; +spinlock_t w_lock; +struct mutex m_lock; +apr_svc_cb_fn func; +char data[APR_MAX_BUF ]; +wait_queue_head_t wait; +void *priv; +uint32_t smd_state; +wait_queue_head_t dest; +uint32_t dest_state; +}; +#endif
arch/arm/mach-msm/qdsp6v2/apr.c +0 -1
@@ -35,7 +35,6 @@#include <mach/msm_smd.h> #include <mach/qdsp6v2/apr.h> -#include "apr_tal.h" #include "dsp_debug.h" struct apr_q6 q6;
arch/arm/mach-msm/qdsp6v2/apr_tal.c +1 -1
@@ -30,8 +30,8 @@#include <linux/platform_device.h> #include <linux/delay.h> #include <mach/msm_smd.h> +#include <mach/qdsp6v2/apr.h> -#include "apr_tal.h" #include "../clock-8x60.h" static char *svc_names[APR_DEST_MAX ][APR_CLIENT_MAX ] = {
arch/arm/mach-msm/qdsp6v2/apr_tal.h deleted +0 -69
69 lines not on this page · raw message
Signature · 1 line
1.7.0.4
PATCH 4/7 msm: qdspv2: apr: declare locals as static
In reply to [email protected]From: Eero Nurkkala <[email protected]>
Declare the globals as static as they're only referenced in this particular file
--- arch/arm/mach-msm/qdsp6v2/apr.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-msm/qdsp6v2/apr.c +2 -2
@@ -37,8 +37,8 @@#include "dsp_debug.h" -struct apr_q6 q6; -struct apr_client client[APR_DEST_MAX ][APR_CLIENT_MAX ]; +static struct apr_q6 q6; +static struct apr_client client[APR_DEST_MAX ][APR_CLIENT_MAX ];int apr_send_pkt (void *handle,uint32_t *buf) {
Signature · 1 line
1.7.0.4
PATCH 5/7 msm: qdspv2: apr: rework apr_register()
In reply to [email protected]From: Eero Nurkkala <[email protected]>
apr_register() reminds of an AT modem interface, except that it's apparently not. Drop the passing of strings to simplify the code. In addition, renice some apr_register() internals.
--- arch/arm/mach-msm/include/mach/qdsp6v2/apr.h | 2 +- arch/arm/mach-msm/qdsp6v2/apr.c | 118 +++++--------------------- arch/arm/mach-msm/qdsp6v2/apr_tal_debug.c | 21 +++-- arch/arm/mach-msm/qdsp6v2/q6adm.c | 10 ++- arch/arm/mach-msm/qdsp6v2/q6afe.c | 4 +- arch/arm/mach-msm/qdsp6v2/q6asm.c | 4 +- arch/arm/mach-msm/qdsp6v2/q6voice.c | 15 ++-- 7 files changed, 57 insertions(+), 117 deletions(-)
arch/arm/mach-msm/include/mach/qdsp6v2/apr.h +1 -1
@@ -164,7 +164,7 @@ struct adsp_power_collapse {uint32_t power_collapse; }; -struct apr_svc *apr_register (char *dest,char *svc_name,apr_fn svc_fn, +struct apr_svc *apr_register (int dest_id,int svc_id,apr_fn svc_fn,uint32_t src_port,void *priv); inline int apr_fill_hdr(void *handle, uint32_t *buf, uint16_t src_port, uint16_t msg_type, uint16_t dest_port,
arch/arm/mach-msm/qdsp6v2/apr.c +23 -95
158 lines not on this page · raw message
arch/arm/mach-msm/qdsp6v2/apr_tal_debug.c +14 -7
@@ -140,12 +140,16 @@ static ssize_t apr_debug_write(struct file *file, const char __user *buf, len--; }if (!strncmp (l_buf +20 ,"open_q" ,64 )) { - apr_handle_q =apr_register ("ADSP" ,"TEST" , aprv2_debug_fn_q, -0xFFFFFFFF ,NULL ); + apr_handle_q =apr_register (APR_DEST_QDSP6 , +APR_SVC_TEST_CLIENT , + aprv2_debug_fn_q, +0xFFFFFFFF ,NULL );pr_info ("Open_q %p\n" , apr_handle_q); }else if (!strncmp (l_buf +20 ,"open_m" ,64 )) { - apr_handle_m =apr_register ("MODEM" ,"TEST" , aprv2_debug_fn_m, -0xFFFFFFFF ,NULL ); + apr_handle_m =apr_register (APR_DEST_MODEM , +APR_SVC_TEST_CLIENT , + aprv2_debug_fn_m, +0xFFFFFFFF ,NULL );pr_info ("Open_m %p\n" , apr_handle_m); }else if (!strncmp (l_buf +20 ,"write_q" ,64 )) {struct apr_hdr *hdr;
@@ -221,7 +225,8 @@ static ssize_t apr_debug_write(struct file *file, const char __user *buf, }else if (!strncmp (l_buf +20 ,"dsp_ver" ,64 )) {struct apr_hdr *hdr; - apr_handle_q =apr_register ("ADSP" ,"CORE" , aprv2_core_fn_q, + apr_handle_q =apr_register (APR_DEST_QDSP6 ,APR_SVC_ADSP_CORE , + aprv2_core_fn_q,0xFFFFFFFF ,NULL );pr_info ("Open_q %p\n" , apr_handle_q);if (apr_handle_q) {
@@ -241,7 +246,8 @@ static ssize_t apr_debug_write(struct file *file, const char __user *buf, }else if (!strncmp (l_buf +20 ,"en_pwr_col" ,64 )) {struct adsp_power_collapse pc; - apr_handle_q =apr_register ("ADSP" ,"CORE" , aprv2_core_fn_q, + apr_handle_q =apr_register (APR_DEST_QDSP6 ,APR_SVC_ADSP_CORE , + aprv2_core_fn_q,0xFFFFFFFF ,NULL );pr_info ("Open_q %p\n" , apr_handle_q);if (apr_handle_q) {
@@ -260,7 +266,8 @@ static ssize_t apr_debug_write(struct file *file, const char __user *buf, }else if (!strncmp (l_buf +20 ,"dis_pwr_col" ,64 )) {struct adsp_power_collapse pc; - apr_handle_q =apr_register ("ADSP" ,"CORE" , aprv2_core_fn_q, + apr_handle_q =apr_register (APR_DEST_QDSP6 ,APR_SVC_ADSP_CORE , + aprv2_core_fn_q,0xFFFFFFFF ,NULL );pr_info ("Open_q %p\n" , apr_handle_q);if (apr_handle_q) {
arch/arm/mach-msm/qdsp6v2/q6adm.c +6 -4
@@ -178,8 +178,9 @@ int adm_open(int port_id, int session_id , int path, }if (this_adm.apr ==NULL ) { - this_adm.apr =apr_register ("ADSP" ,"ADM" , adm_callback, -0xFFFFFFFF , &this_adm); + this_adm.apr =apr_register (APR_DEST_QDSP6 ,APR_SVC_ADM , + adm_callback,0xFFFFFFFF , + &this_adm);if (this_adm.apr ==NULL ) {pr_err ("%s: Unable to register ADM\n" , __func__); ret = -ENODEV ;
@@ -305,8 +306,9 @@ int adm_memory_map_regions(uint32_t *buf_add, uint32_t mempool_id,pr_info ("%s\n" , __func__);if (this_adm.apr ==NULL ) { - this_adm.apr =apr_register ("ADSP" ,"ADM" , adm_callback, -0xFFFFFFFF , &this_adm); + this_adm.apr =apr_register (APR_DEST_QDSP6 ,APR_SVC_ADM , + adm_callback,0xFFFFFFFF , + &this_adm);if (this_adm.apr ==NULL ) {pr_err ("%s: Unable to register ADM\n" , __func__); ret = -ENODEV ;
arch/arm/mach-msm/qdsp6v2/q6afe.c +2 -2
@@ -75,8 +75,8 @@ int afe_open(u16 port_id, union afe_port_config *afe_config, int rate)pr_info ("%s: %d %d\n" , __func__, port_id, rate);if (this_afe.apr ==NULL ) { - this_afe.apr =apr_register ("ADSP" ,"AFE" , afe_callback, -0xFFFFFFFF , &this_afe); + this_afe.apr =apr_register (APR_DEST_QDSP6 ,APR_SVC_AFE , + afe_callback,0xFFFFFFFF , &this_afe);pr_info ("%s: Register AFE\n" , __func__);if (this_afe.apr ==NULL ) {pr_err ("%s: Unable to register AFE\n" , __func__);
arch/arm/mach-msm/qdsp6v2/q6asm.c +2 -2
@@ -210,7 +210,7 @@ struct audio_client *q6asm_audio_client_alloc(app_cb cb, void *priv) ac->cb = cb; ac->priv = priv; ac->io_mode =SYNC_IO_MODE ; - ac->apr =apr_register ("ADSP" ,"ASM" , \ + ac->apr =apr_register (APR_DEST_QDSP6 ,APR_SVC_ASM , \ (apr_fn )q6asm_callback,\ ((ac->session) <<8 |0x0001 ),\ ac);
@@ -221,7 +221,7 @@ struct audio_client *q6asm_audio_client_alloc(app_cb cb, void *priv) }pr_debug ("%s Registering the common port with APR\n" , __func__);if (atomic_read (&this_mmap.ref_cnt) ==0 ) { - this_mmap.apr =apr_register ("ADSP" ,"ASM" , \ + this_mmap.apr =apr_register (APR_DEST_QDSP6 ,APR_SVC_ASM , \ (apr_fn )q6asm_mmapcallback,\0x0FFFFFFFF , &this_mmap);if (this_mmap.apr ==NULL ) {
arch/arm/mach-msm/qdsp6v2/q6voice.c +9 -6
@@ -279,11 +279,12 @@ static int voice_apr_register(struct voice_data *v)pr_debug ("start to register MVM callback\n" );if (v->voc_path ==VOC_PATH_PASSIVE ) { - apr_mvm =apr_register ("MODEM" ,"MVM" , + apr_mvm =apr_register (APR_DEST_MODEM ,APR_SVC_MVM , modem_mvm_callback,0xFFFFFFFF , v); }else { - apr_mvm =apr_register ("ADSP" ,"MVM" , + apr_mvm =apr_register (APR_DEST_QDSP6 , +APR_SVC_ADSP_MVM , modem_mvm_callback,0xFFFFFFFF , v); }
@@ -301,11 +302,12 @@ static int voice_apr_register(struct voice_data *v)pr_debug ("start to register CVS callback\n" );if (v->voc_path ==VOC_PATH_PASSIVE ) { - apr_cvs =apr_register ("MODEM" ,"CVS" , + apr_cvs =apr_register (APR_DEST_MODEM ,APR_SVC_CVS , modem_cvs_callback,0xFFFFFFFF , v); }else { - apr_cvs =apr_register ("ADSP" ,"CVS" , + apr_cvs =apr_register (APR_DEST_QDSP6 , +APR_SVC_ADSP_CVS , modem_cvs_callback,0xFFFFFFFF , v); }
@@ -323,11 +325,12 @@ static int voice_apr_register(struct voice_data *v)pr_debug ("start to register CVP callback\n" );if (v->voc_path ==VOC_PATH_PASSIVE ) { - apr_cvp =apr_register ("MODEM" ,"CVP" , + apr_cvp =apr_register (APR_DEST_MODEM ,APR_SVC_CVP , modem_cvp_callback,0xFFFFFFFF , v); }else { - apr_cvp =apr_register ("ADSP" ,"CVP" , + apr_cvp =apr_register (APR_DEST_QDSP6 , +APR_SVC_ADSP_CVP , modem_cvp_callback,0xFFFFFFFF , v); }
Signature · 1 line
1.7.0.4
PATCH 6/7 msm: qdspv2: apr: simplify client array
In reply to [email protected]From: Eero Nurkkala <[email protected]>
There appears to be either audio or voice service, where all voice goes to (comes from) modem. Thus, drop the client[APR_DEST_MAX] array altogether.
--- arch/arm/mach-msm/qdsp6v2/apr.c | 70 ++++++++++++++++++--------------------- 1 files changed, 32 insertions(+), 38 deletions(-)
arch/arm/mach-msm/qdsp6v2/apr.c +32 -38
@@ -38,14 +38,13 @@#include "dsp_debug.h" static struct apr_q6 q6; -static struct apr_client client[APR_DEST_MAX ][APR_CLIENT_MAX ]; +static struct apr_client client[APR_CLIENT_MAX ];int apr_send_pkt (void *handle,uint32_t *buf) {struct apr_svc *svc = handle;struct apr_client *clnt;struct apr_hdr *hdr; -uint16_t dest_id;uint16_t client_id;uint16_t w_len;unsigned long flags;
@@ -56,11 +55,10 @@ int apr_send_pkt(void *handle, uint32_t *buf) }spin_lock_irqsave (&svc->w_lock, flags); - dest_id = svc->dest_id; client_id = svc->client_id; - clnt = &client[dest_id][client_id]; + clnt = &client[client_id]; -if (!client[dest_id][client_id].handle) { +if (!client[client_id].handle) {pr_err ("APR: Still service is not yet opened\n" );spin_unlock_irqrestore (&svc->w_lock, flags);return -EINVAL ;
@@ -69,9 +67,9 @@ int apr_send_pkt(void *handle, uint32_t *buf) hdr->src_domain =APR_DOMAIN_APPS ; hdr->src_svc = svc->id; -if (dest_id ==APR_DEST_MODEM ) +if (client_id ==APR_CLIENT_VOICE ) hdr->dest_domain =APR_DOMAIN_MODEM ; -else if (dest_id ==APR_DEST_QDSP6 ) +else if (client_id ==APR_CLIENT_AUDIO ) hdr->dest_domain =APR_DOMAIN_ADSP ; hdr->dest_svc = svc->id;
@@ -178,7 +176,7 @@ static void apr_cb_func(void *buf, int len, void *priv) }pr_debug ("src =%d clnt = %d\n" , src, clnt); - apr_client = &client[src][clnt]; + apr_client = &client[clnt];for (i =0 ; i <APR_SVC_MAX ; i++)if (apr_client->svc[i].id == svc) {pr_debug ("%d\n" , apr_client->svc[i].id);
@@ -252,21 +250,21 @@ struct apr_svc *apr_register(int dest_id, int svc_id, apr_fn svc_fn, q6.state =APR_Q6_LOADED ; }mutex_unlock (&q6.lock); -mutex_lock (&client[dest_id][client_id].m_lock); -if (!client[dest_id][client_id].handle) { - client[dest_id][client_id].handle =apr_tal_open (client_id, +mutex_lock (&client[client_id].m_lock); +if (!client[client_id].handle) { + client[client_id].handle =apr_tal_open (client_id, dest_id,APR_DL_SMD , apr_cb_func,NULL ); -if (!client[dest_id][client_id].handle) { +if (!client[client_id].handle) { svc =NULL ;pr_err ("APR: Unable to open handle\n" ); -mutex_unlock (&client[dest_id][client_id].m_lock); +mutex_unlock (&client[client_id].m_lock); goto done; } } -mutex_unlock (&client[dest_id][client_id].m_lock); - svc = &client[dest_id][client_id].svc[svc_idx]; +mutex_unlock (&client[client_id].m_lock); + svc = &client[client_id].svc[svc_idx];mutex_lock (&svc->m_lock); - client[dest_id][client_id].id = client_id; + client[client_id].id = client_id; svc->priv = priv; svc->id = svc_id; svc->dest_id = dest_id;
@@ -275,14 +273,14 @@ struct apr_svc *apr_register(int dest_id, int svc_id, apr_fn svc_fn, temp_port = ((src_port >>8 ) *8 ) + (src_port &0xFF );pr_info ("port = %d t_port = %d\n" , src_port, temp_port);if (!svc->port_cnt && !svc->svc_cnt) - client[dest_id][client_id].svc_cnt++; + client[client_id].svc_cnt++; svc->port_cnt++; svc->port_fn[temp_port] = svc_fn; svc->port_priv[temp_port] = priv; }else {if (!svc->fn) {if (!svc->port_cnt && !svc->svc_cnt) - client[dest_id][client_id].svc_cnt++; + client[client_id].svc_cnt++; svc->fn = svc_fn;if (svc->port_cnt) svc->svc_cnt++;
@@ -298,16 +296,14 @@ int apr_deregister(void *handle) {struct apr_svc *svc = handle;struct apr_client *clnt; -uint16_t dest_id;uint16_t client_id;if (!handle)return -EINVAL ;mutex_lock (&svc->m_lock); - dest_id = svc->dest_id; client_id = svc->client_id; - clnt = &client[dest_id][client_id]; + clnt = &client[client_id];if (svc->port_cnt >0 || svc->svc_cnt >0 ) {if (svc->port_cnt)
@@ -315,21 +311,20 @@ int apr_deregister(void *handle)else if (svc->svc_cnt) svc->svc_cnt--;if (!svc->port_cnt && !svc->svc_cnt) - client[dest_id][client_id].svc_cnt--; - }else if (client[dest_id][client_id].svc_cnt >0 ) - client[dest_id][client_id].svc_cnt--; + client[client_id].svc_cnt--; + }else if (client[client_id].svc_cnt >0 ) + client[client_id].svc_cnt--;if (!svc->port_cnt && !svc->svc_cnt) { svc->priv =NULL ; svc->id =0 ; svc->fn =NULL ; - svc->dest_id =0 ; svc->client_id =0 ; } -if (client[dest_id][client_id].handle && - !client[dest_id][client_id].svc_cnt) { -apr_tal_close (client[dest_id][client_id].handle); - client[dest_id][client_id].handle =NULL ; +if (client[client_id].handle && + !client[client_id].svc_cnt) { +apr_tal_close (client[client_id].handle); + client[client_id].handle =NULL ; }mutex_unlock (&svc->m_lock);
@@ -351,16 +346,15 @@ int adsp_state(int state)static int __init apr_init (void ) { -int i, j, k; - -for (i =0 ; i <APR_DEST_MAX ; i++) -for (j =0 ; j <APR_CLIENT_MAX ; j++) { -mutex_init (&client[i][j].m_lock); -for (k =0 ; k <APR_SVC_MAX ; k++) { -mutex_init (&client[i][j].svc[k].m_lock); -spin_lock_init (&client[i][j].svc[k].w_lock); - } +int j, k; + +for (j =0 ; j <APR_CLIENT_MAX ; j++) { +mutex_init (&client[j].m_lock); +for (k =0 ; k <APR_SVC_MAX ; k++) { +mutex_init (&client[j].svc[k].m_lock); +spin_lock_init (&client[j].svc[k].w_lock); } + }mutex_init (&q6.lock);dsp_debug_register (adsp_state);return 0 ;
Signature · 1 line
1.7.0.4
PATCH 7/7 msm: qdspv2: apr: remove unused service IDs
In reply to [email protected]From: Eero Nurkkala <[email protected]>
Originally VSM and VPM were always taking the APR_CLIENT_VOICE path:
..
} else if (!strcmp(svc_name, "VSM")) {
client_id = APR_CLIENT_VOICE;
svc_idx = 0;
svc_id = APR_SVC_VSM;
} else if (!strcmp(svc_name, "VPM")) {
client_id = APR_CLIENT_VOICE;
svc_idx = 1;
svc_id = APR_SVC_VPM;..
Thus, it's not possible they appear from QDSP6 under the APR_DOMAIN_ADSP.
--- arch/arm/mach-msm/qdsp6v2/apr.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
arch/arm/mach-msm/qdsp6v2/apr.c +0 -1
@@ -161,7 +161,6 @@ static void apr_cb_func(void *buf, int len, void *priv) }else if (hdr->src_domain ==APR_DOMAIN_ADSP ) { src =APR_DEST_QDSP6 ;if (svc ==APR_SVC_AFE || svc ==APR_SVC_ASM || - svc ==APR_SVC_VSM || svc ==APR_SVC_VPM || svc ==APR_SVC_ADM || svc ==APR_SVC_ADSP_CORE || svc ==APR_SVC_TEST_CLIENT || svc ==APR_SVC_ADSP_MVM || svc ==APR_SVC_ADSP_CVS || svc ==APR_SVC_ADSP_CVP )
Signature · 1 line
1.7.0.4