ASoC: msm: qdsp6v2: Add support to connect LSM to ADM
LSM will connect to ADM to apply preprocessing and improve detection performance. LSM can also directly connect to AFE similar to the existing mechanism. MAD polling will be disabled in case of LSM connects to ADM. Add EC reference end channel, bit format and sample rate control to configure far end params for Echo Cancellation. Change-Id: I4684ae346884d656e95350b7a63929b91a843512 Signed-off-by: Chaithanya Krishna Bacharaju <chaithan@codeaurora.org> Signed-off-by: Revathi Uddaraju <revathiu@codeaurora.org>
This commit is contained in:
parent
4605d00310
commit
6df96093b3
9 changed files with 1170 additions and 432 deletions
|
@ -42,6 +42,8 @@ struct param_outband {
|
||||||
#define ADM_MATRIX_ID_AUDIO_TX 1
|
#define ADM_MATRIX_ID_AUDIO_TX 1
|
||||||
|
|
||||||
#define ADM_MATRIX_ID_COMPRESSED_AUDIO_RX 2
|
#define ADM_MATRIX_ID_COMPRESSED_AUDIO_RX 2
|
||||||
|
|
||||||
|
#define ADM_MATRIX_ID_LISTEN_TX 4
|
||||||
/* Enumeration for an audio Tx matrix ID.*/
|
/* Enumeration for an audio Tx matrix ID.*/
|
||||||
#define ADM_MATRIX_ID_AUDIOX 1
|
#define ADM_MATRIX_ID_AUDIOX 1
|
||||||
|
|
||||||
|
@ -9056,6 +9058,10 @@ struct asm_aptx_dec_fmt_blk_v2 {
|
||||||
#define LSM_PARAM_ID_LAB_ENABLE (0x00012C09)
|
#define LSM_PARAM_ID_LAB_ENABLE (0x00012C09)
|
||||||
#define LSM_PARAM_ID_LAB_CONFIG (0x00012C0A)
|
#define LSM_PARAM_ID_LAB_CONFIG (0x00012C0A)
|
||||||
#define LSM_MODULE_ID_FRAMEWORK (0x00012C0E)
|
#define LSM_MODULE_ID_FRAMEWORK (0x00012C0E)
|
||||||
|
#define LSM_PARAM_ID_SWMAD_CFG (0x00012C18)
|
||||||
|
#define LSM_PARAM_ID_SWMAD_MODEL (0x00012C19)
|
||||||
|
#define LSM_PARAM_ID_SWMAD_ENABLE (0x00012C1A)
|
||||||
|
#define LSM_PARAM_ID_POLLING_ENABLE (0x00012C1B)
|
||||||
|
|
||||||
/* HW MAD specific */
|
/* HW MAD specific */
|
||||||
#define AFE_MODULE_HW_MAD (0x00010230)
|
#define AFE_MODULE_HW_MAD (0x00010230)
|
||||||
|
@ -10172,6 +10178,7 @@ enum {
|
||||||
COMPRESSED_PASSTHROUGH,
|
COMPRESSED_PASSTHROUGH,
|
||||||
COMPRESSED_PASSTHROUGH_CONVERT,
|
COMPRESSED_PASSTHROUGH_CONVERT,
|
||||||
COMPRESSED_PASSTHROUGH_DSD,
|
COMPRESSED_PASSTHROUGH_DSD,
|
||||||
|
LISTEN,
|
||||||
};
|
};
|
||||||
|
|
||||||
#define AUDPROC_MODULE_ID_COMPRESSED_MUTE 0x00010770
|
#define AUDPROC_MODULE_ID_COMPRESSED_MUTE 0x00010770
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
|
/* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License version 2 and
|
* it under the terms of the GNU General Public License version 2 and
|
||||||
|
@ -96,7 +96,7 @@ int adm_unmap_rtac_block(uint32_t *mem_map_handle);
|
||||||
int adm_close(int port, int topology, int perf_mode);
|
int adm_close(int port, int topology, int perf_mode);
|
||||||
|
|
||||||
int adm_matrix_map(int path, struct route_payload payload_map,
|
int adm_matrix_map(int path, struct route_payload payload_map,
|
||||||
int perf_mode);
|
int perf_mode, uint32_t passthr_mode);
|
||||||
|
|
||||||
int adm_connect_afe_port(int mode, int session_id, int port_id);
|
int adm_connect_afe_port(int mode, int session_id, int port_id);
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2013-2015, Linux Foundation. All rights reserved.
|
* Copyright (c) 2013-2016, Linux Foundation. All rights reserved.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License version 2 and
|
* it under the terms of the GNU General Public License version 2 and
|
||||||
|
@ -21,6 +21,8 @@
|
||||||
|
|
||||||
#define MAX_NUM_CONFIDENCE 20
|
#define MAX_NUM_CONFIDENCE 20
|
||||||
|
|
||||||
|
#define ADM_LSM_PORT_ID 0xADCB
|
||||||
|
|
||||||
typedef void (*lsm_app_cb)(uint32_t opcode, uint32_t token,
|
typedef void (*lsm_app_cb)(uint32_t opcode, uint32_t token,
|
||||||
uint32_t *payload, void *priv);
|
uint32_t *payload, void *priv);
|
||||||
|
|
||||||
|
@ -81,6 +83,9 @@ struct lsm_client {
|
||||||
struct lsm_lab_buffer *lab_buffer;
|
struct lsm_lab_buffer *lab_buffer;
|
||||||
struct lsm_lab_hw_params hw_params;
|
struct lsm_lab_hw_params hw_params;
|
||||||
bool use_topology;
|
bool use_topology;
|
||||||
|
int session_state;
|
||||||
|
bool poll_enable;
|
||||||
|
int perf_mode;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct lsm_stream_cmd_open_tx {
|
struct lsm_stream_cmd_open_tx {
|
||||||
|
@ -134,6 +139,12 @@ struct lsm_param_connect_to_port {
|
||||||
uint16_t reserved;
|
uint16_t reserved;
|
||||||
} __packed;
|
} __packed;
|
||||||
|
|
||||||
|
struct lsm_param_poll_enable {
|
||||||
|
struct lsm_param_payload_common common;
|
||||||
|
uint32_t minor_version;
|
||||||
|
/* indicates to voice wakeup that HW MAD/SW polling is enabled or not */
|
||||||
|
uint32_t polling_enable;
|
||||||
|
} __packed;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This param cannot be sent in this format.
|
* This param cannot be sent in this format.
|
||||||
|
@ -163,11 +174,22 @@ struct lsm_cmd_set_params_conf {
|
||||||
struct lsm_param_min_confidence_levels conf_payload;
|
struct lsm_param_min_confidence_levels conf_payload;
|
||||||
} __packed;
|
} __packed;
|
||||||
|
|
||||||
struct lsm_cmd_set_opmode_connectport {
|
struct lsm_cmd_set_params_opmode {
|
||||||
struct apr_hdr msg_hdr;
|
struct apr_hdr msg_hdr;
|
||||||
struct lsm_set_params_hdr params_hdr;
|
struct lsm_set_params_hdr params_hdr;
|
||||||
struct lsm_param_connect_to_port connect_to_port;
|
struct lsm_param_op_mode op_mode;
|
||||||
struct lsm_param_op_mode op_mode;
|
} __packed;
|
||||||
|
|
||||||
|
struct lsm_cmd_set_connectport {
|
||||||
|
struct apr_hdr msg_hdr;
|
||||||
|
struct lsm_set_params_hdr params_hdr;
|
||||||
|
struct lsm_param_connect_to_port connect_to_port;
|
||||||
|
} __packed;
|
||||||
|
|
||||||
|
struct lsm_cmd_poll_enable {
|
||||||
|
struct apr_hdr msg_hdr;
|
||||||
|
struct lsm_set_params_hdr params_hdr;
|
||||||
|
struct lsm_param_poll_enable poll_enable;
|
||||||
} __packed;
|
} __packed;
|
||||||
|
|
||||||
struct lsm_param_epd_thres {
|
struct lsm_param_epd_thres {
|
||||||
|
@ -278,4 +300,5 @@ int q6lsm_set_one_param(struct lsm_client *client,
|
||||||
void q6lsm_sm_set_param_data(struct lsm_client *client,
|
void q6lsm_sm_set_param_data(struct lsm_client *client,
|
||||||
struct lsm_params_info *p_info,
|
struct lsm_params_info *p_info,
|
||||||
size_t *offset);
|
size_t *offset);
|
||||||
|
int q6lsm_set_port_connected(struct lsm_client *client);
|
||||||
#endif /* __Q6LSM_H__ */
|
#endif /* __Q6LSM_H__ */
|
||||||
|
|
|
@ -88,6 +88,11 @@ struct lsm_priv {
|
||||||
int dma_write;
|
int dma_write;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum { /* lsm session states */
|
||||||
|
IDLE = 0,
|
||||||
|
RUNNING,
|
||||||
|
};
|
||||||
|
|
||||||
static int msm_lsm_queue_lab_buffer(struct lsm_priv *prtd, int i)
|
static int msm_lsm_queue_lab_buffer(struct lsm_priv *prtd, int i)
|
||||||
{
|
{
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
@ -641,6 +646,54 @@ err_ret:
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int msm_lsm_set_poll_enable(struct snd_pcm_substream *substream,
|
||||||
|
struct lsm_params_info *p_info)
|
||||||
|
{
|
||||||
|
struct snd_pcm_runtime *runtime = substream->runtime;
|
||||||
|
struct lsm_priv *prtd = runtime->private_data;
|
||||||
|
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
||||||
|
struct snd_lsm_poll_enable poll_enable;
|
||||||
|
int rc = 0;
|
||||||
|
|
||||||
|
if (p_info->param_size != sizeof(poll_enable)) {
|
||||||
|
dev_err(rtd->dev,
|
||||||
|
"%s: Invalid param_size %d\n",
|
||||||
|
__func__, p_info->param_size);
|
||||||
|
rc = -EINVAL;
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (copy_from_user(&poll_enable, p_info->param_data,
|
||||||
|
sizeof(poll_enable))) {
|
||||||
|
dev_err(rtd->dev,
|
||||||
|
"%s: copy_from_user failed, size = %zd\n",
|
||||||
|
__func__, sizeof(poll_enable));
|
||||||
|
rc = -EFAULT;
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (prtd->lsm_client->poll_enable == poll_enable.poll_en) {
|
||||||
|
dev_dbg(rtd->dev,
|
||||||
|
"%s: Polling for session %d already %s\n",
|
||||||
|
__func__, prtd->lsm_client->session,
|
||||||
|
(poll_enable.poll_en ? "enabled" : "disabled"));
|
||||||
|
rc = 0;
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
rc = q6lsm_set_one_param(prtd->lsm_client, p_info,
|
||||||
|
&poll_enable, LSM_POLLING_ENABLE);
|
||||||
|
if (!rc) {
|
||||||
|
prtd->lsm_client->poll_enable = poll_enable.poll_en;
|
||||||
|
} else {
|
||||||
|
dev_err(rtd->dev,
|
||||||
|
"%s: Failed to set poll enable, err = %d\n",
|
||||||
|
__func__, rc);
|
||||||
|
}
|
||||||
|
done:
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
static int msm_lsm_process_params(struct snd_pcm_substream *substream,
|
static int msm_lsm_process_params(struct snd_pcm_substream *substream,
|
||||||
struct snd_lsm_module_params *p_data,
|
struct snd_lsm_module_params *p_data,
|
||||||
void *params)
|
void *params)
|
||||||
|
@ -681,6 +734,9 @@ static int msm_lsm_process_params(struct snd_pcm_substream *substream,
|
||||||
case LSM_CUSTOM_PARAMS:
|
case LSM_CUSTOM_PARAMS:
|
||||||
rc = msm_lsm_set_custom(substream, p_info);
|
rc = msm_lsm_set_custom(substream, p_info);
|
||||||
break;
|
break;
|
||||||
|
case LSM_POLLING_ENABLE:
|
||||||
|
rc = msm_lsm_set_poll_enable(substream, p_info);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
dev_err(rtd->dev,
|
dev_err(rtd->dev,
|
||||||
"%s: Invalid param_type %d\n",
|
"%s: Invalid param_type %d\n",
|
||||||
|
@ -1035,6 +1091,12 @@ static int msm_lsm_ioctl_shared(struct snd_pcm_substream *substream,
|
||||||
prtd->lsm_client->lab_started = false;
|
prtd->lsm_client->lab_started = false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case SNDRV_LSM_SET_PORT:
|
||||||
|
dev_dbg(rtd->dev, "%s: set LSM port\n", __func__);
|
||||||
|
rc = q6lsm_set_port_connected(prtd->lsm_client);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
dev_dbg(rtd->dev,
|
dev_dbg(rtd->dev,
|
||||||
"%s: Falling into default snd_lib_ioctl cmd 0x%x\n",
|
"%s: Falling into default snd_lib_ioctl cmd 0x%x\n",
|
||||||
|
@ -1640,6 +1702,10 @@ static int msm_lsm_open(struct snd_pcm_substream *substream)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
prtd->lsm_client->opened = false;
|
prtd->lsm_client->opened = false;
|
||||||
|
prtd->lsm_client->session_state = IDLE;
|
||||||
|
prtd->lsm_client->poll_enable = true;
|
||||||
|
prtd->lsm_client->perf_mode = 0;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1648,6 +1714,7 @@ static int msm_lsm_prepare(struct snd_pcm_substream *substream)
|
||||||
struct snd_pcm_runtime *runtime = substream->runtime;
|
struct snd_pcm_runtime *runtime = substream->runtime;
|
||||||
struct lsm_priv *prtd = runtime->private_data;
|
struct lsm_priv *prtd = runtime->private_data;
|
||||||
struct snd_soc_pcm_runtime *rtd;
|
struct snd_soc_pcm_runtime *rtd;
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
if (!substream->private_data) {
|
if (!substream->private_data) {
|
||||||
pr_err("%s: Invalid private_data", __func__);
|
pr_err("%s: Invalid private_data", __func__);
|
||||||
|
@ -1661,9 +1728,26 @@ static int msm_lsm_prepare(struct snd_pcm_substream *substream)
|
||||||
"%s: LSM client data ptr is NULL\n", __func__);
|
"%s: LSM client data ptr is NULL\n", __func__);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (prtd->lsm_client->session_state == IDLE) {
|
||||||
|
ret = msm_pcm_routing_reg_phy_compr_stream(
|
||||||
|
rtd->dai_link->be_id,
|
||||||
|
prtd->lsm_client->perf_mode,
|
||||||
|
prtd->lsm_client->session,
|
||||||
|
SNDRV_PCM_STREAM_CAPTURE,
|
||||||
|
LISTEN);
|
||||||
|
if (ret) {
|
||||||
|
dev_err(rtd->dev,
|
||||||
|
"%s: register phy compr stream failed %d\n",
|
||||||
|
__func__, ret);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
prtd->lsm_client->session_state = RUNNING;
|
||||||
prtd->lsm_client->started = false;
|
prtd->lsm_client->started = false;
|
||||||
runtime->private_data = prtd;
|
runtime->private_data = prtd;
|
||||||
return 0;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int msm_lsm_close(struct snd_pcm_substream *substream)
|
static int msm_lsm_close(struct snd_pcm_substream *substream)
|
||||||
|
@ -1712,6 +1796,9 @@ static int msm_lsm_close(struct snd_pcm_substream *substream)
|
||||||
__func__);
|
__func__);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
msm_pcm_routing_dereg_phy_stream(rtd->dai_link->be_id,
|
||||||
|
SNDRV_PCM_STREAM_CAPTURE);
|
||||||
|
|
||||||
if (prtd->lsm_client->opened) {
|
if (prtd->lsm_client->opened) {
|
||||||
q6lsm_close(prtd->lsm_client);
|
q6lsm_close(prtd->lsm_client);
|
||||||
prtd->lsm_client->opened = false;
|
prtd->lsm_client->opened = false;
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
|
/* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License version 2 and
|
* it under the terms of the GNU General Public License version 2 and
|
||||||
|
@ -392,6 +392,7 @@ enum {
|
||||||
#define ADM_PP_PARAM_LATENCY_ID 1
|
#define ADM_PP_PARAM_LATENCY_ID 1
|
||||||
#define ADM_PP_PARAM_LATENCY_BIT 2
|
#define ADM_PP_PARAM_LATENCY_BIT 2
|
||||||
#define BE_DAI_PORT_SESSIONS_IDX_MAX 4
|
#define BE_DAI_PORT_SESSIONS_IDX_MAX 4
|
||||||
|
#define BE_DAI_FE_SESSIONS_IDX_MAX 2
|
||||||
|
|
||||||
struct msm_pcm_routing_evt {
|
struct msm_pcm_routing_evt {
|
||||||
void (*event_func)(enum msm_pcm_routing_event, void *);
|
void (*event_func)(enum msm_pcm_routing_event, void *);
|
||||||
|
@ -401,7 +402,9 @@ struct msm_pcm_routing_evt {
|
||||||
struct msm_pcm_routing_bdai_data {
|
struct msm_pcm_routing_bdai_data {
|
||||||
u16 port_id; /* AFE port ID */
|
u16 port_id; /* AFE port ID */
|
||||||
u8 active; /* track if this backend is enabled */
|
u8 active; /* track if this backend is enabled */
|
||||||
unsigned long fe_sessions; /* Front-end sessions */
|
|
||||||
|
/* Front-end sessions */
|
||||||
|
unsigned long fe_sessions[BE_DAI_FE_SESSIONS_IDX_MAX];
|
||||||
/*
|
/*
|
||||||
* Track Tx BE ports -> Rx BE ports.
|
* Track Tx BE ports -> Rx BE ports.
|
||||||
* port_sessions[0] used to track BE 0 to BE 63.
|
* port_sessions[0] used to track BE 0 to BE 63.
|
||||||
|
@ -415,7 +418,7 @@ struct msm_pcm_routing_bdai_data {
|
||||||
unsigned int channel;
|
unsigned int channel;
|
||||||
unsigned int format;
|
unsigned int format;
|
||||||
unsigned int adm_override_ch;
|
unsigned int adm_override_ch;
|
||||||
u32 compr_passthr_mode;
|
u32 passthr_mode;
|
||||||
char *name;
|
char *name;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -2574,7 +2574,6 @@ int adm_open(int port_id, int path, int rate, int channel_mode, int topology,
|
||||||
return copp_idx;
|
return copp_idx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void adm_copp_mfc_cfg(int port_id, int copp_idx, int dst_sample_rate)
|
void adm_copp_mfc_cfg(int port_id, int copp_idx, int dst_sample_rate)
|
||||||
{
|
{
|
||||||
struct audproc_mfc_output_media_fmt mfc_cfg;
|
struct audproc_mfc_output_media_fmt mfc_cfg;
|
||||||
|
@ -2677,8 +2676,43 @@ fail_cmd:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void route_set_opcode_matrix_id(
|
||||||
|
struct adm_cmd_matrix_map_routings_v5 **route_addr,
|
||||||
|
int path, uint32_t passthr_mode)
|
||||||
|
{
|
||||||
|
struct adm_cmd_matrix_map_routings_v5 *route = *route_addr;
|
||||||
|
|
||||||
int adm_matrix_map(int path, struct route_payload payload_map, int perf_mode)
|
switch (path) {
|
||||||
|
case ADM_PATH_PLAYBACK:
|
||||||
|
route->hdr.opcode = ADM_CMD_MATRIX_MAP_ROUTINGS_V5;
|
||||||
|
route->matrix_id = ADM_MATRIX_ID_AUDIO_RX;
|
||||||
|
break;
|
||||||
|
case ADM_PATH_LIVE_REC:
|
||||||
|
if (passthr_mode == LISTEN) {
|
||||||
|
route->hdr.opcode =
|
||||||
|
ADM_CMD_STREAM_DEVICE_MAP_ROUTINGS_V5;
|
||||||
|
route->matrix_id = ADM_MATRIX_ID_LISTEN_TX;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
/* fall through to set matrix id for non-listen case */
|
||||||
|
case ADM_PATH_NONLIVE_REC:
|
||||||
|
route->hdr.opcode = ADM_CMD_MATRIX_MAP_ROUTINGS_V5;
|
||||||
|
route->matrix_id = ADM_MATRIX_ID_AUDIO_TX;
|
||||||
|
break;
|
||||||
|
case ADM_PATH_COMPRESSED_RX:
|
||||||
|
route->hdr.opcode = ADM_CMD_STREAM_DEVICE_MAP_ROUTINGS_V5;
|
||||||
|
route->matrix_id = ADM_MATRIX_ID_COMPRESSED_AUDIO_RX;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
pr_err("%s: Wrong path set[%d]\n", __func__, path);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
pr_debug("%s: opcode 0x%x, matrix id %d\n",
|
||||||
|
__func__, route->hdr.opcode, route->matrix_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
int adm_matrix_map(int path, struct route_payload payload_map, int perf_mode,
|
||||||
|
uint32_t passthr_mode)
|
||||||
{
|
{
|
||||||
struct adm_cmd_matrix_map_routings_v5 *route;
|
struct adm_cmd_matrix_map_routings_v5 *route;
|
||||||
struct adm_session_map_node_v5 *node;
|
struct adm_session_map_node_v5 *node;
|
||||||
|
@ -2711,32 +2745,9 @@ int adm_matrix_map(int path, struct route_payload payload_map, int perf_mode)
|
||||||
route->hdr.dest_domain = APR_DOMAIN_ADSP;
|
route->hdr.dest_domain = APR_DOMAIN_ADSP;
|
||||||
route->hdr.dest_port = 0; /* Ignored */;
|
route->hdr.dest_port = 0; /* Ignored */;
|
||||||
route->hdr.token = 0;
|
route->hdr.token = 0;
|
||||||
if (path == ADM_PATH_COMPRESSED_RX) {
|
|
||||||
pr_debug("%s: ADM_CMD_STREAM_DEVICE_MAP_ROUTINGS_V5 0x%x\n",
|
|
||||||
__func__, ADM_CMD_STREAM_DEVICE_MAP_ROUTINGS_V5);
|
|
||||||
route->hdr.opcode = ADM_CMD_STREAM_DEVICE_MAP_ROUTINGS_V5;
|
|
||||||
} else {
|
|
||||||
pr_debug("%s: DM_CMD_MATRIX_MAP_ROUTINGS_V5 0x%x\n",
|
|
||||||
__func__, ADM_CMD_MATRIX_MAP_ROUTINGS_V5);
|
|
||||||
route->hdr.opcode = ADM_CMD_MATRIX_MAP_ROUTINGS_V5;
|
|
||||||
}
|
|
||||||
route->num_sessions = 1;
|
route->num_sessions = 1;
|
||||||
|
route_set_opcode_matrix_id(&route, path, passthr_mode);
|
||||||
|
|
||||||
switch (path) {
|
|
||||||
case ADM_PATH_PLAYBACK:
|
|
||||||
route->matrix_id = ADM_MATRIX_ID_AUDIO_RX;
|
|
||||||
break;
|
|
||||||
case ADM_PATH_LIVE_REC:
|
|
||||||
case ADM_PATH_NONLIVE_REC:
|
|
||||||
route->matrix_id = ADM_MATRIX_ID_AUDIO_TX;
|
|
||||||
break;
|
|
||||||
case ADM_PATH_COMPRESSED_RX:
|
|
||||||
route->matrix_id = ADM_MATRIX_ID_COMPRESSED_AUDIO_RX;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
pr_err("%s: Wrong path set[%d]\n", __func__, path);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
payload = ((u8 *)matrix_map +
|
payload = ((u8 *)matrix_map +
|
||||||
sizeof(struct adm_cmd_matrix_map_routings_v5));
|
sizeof(struct adm_cmd_matrix_map_routings_v5));
|
||||||
node = (struct adm_session_map_node_v5 *)payload;
|
node = (struct adm_session_map_node_v5 *)payload;
|
||||||
|
|
|
@ -8343,14 +8343,17 @@ int q6asm_get_apr_service_id(int session_id)
|
||||||
|
|
||||||
int q6asm_get_asm_topology(int session_id)
|
int q6asm_get_asm_topology(int session_id)
|
||||||
{
|
{
|
||||||
int topology;
|
int topology = -EINVAL;
|
||||||
|
|
||||||
if (session_id <= 0 || session_id > ASM_ACTIVE_STREAMS_ALLOWED) {
|
if (session_id <= 0 || session_id > ASM_ACTIVE_STREAMS_ALLOWED) {
|
||||||
pr_err("%s: invalid session_id = %d\n", __func__, session_id);
|
pr_err("%s: invalid session_id = %d\n", __func__, session_id);
|
||||||
topology = -EINVAL;
|
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
if (session[session_id] == NULL) {
|
||||||
|
pr_err("%s: session not created for session id = %d\n",
|
||||||
|
__func__, session_id);
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
topology = session[session_id]->topology;
|
topology = session[session_id]->topology;
|
||||||
done:
|
done:
|
||||||
return topology;
|
return topology;
|
||||||
|
@ -8358,14 +8361,17 @@ done:
|
||||||
|
|
||||||
int q6asm_get_asm_app_type(int session_id)
|
int q6asm_get_asm_app_type(int session_id)
|
||||||
{
|
{
|
||||||
int app_type;
|
int app_type = -EINVAL;
|
||||||
|
|
||||||
if (session_id <= 0 || session_id > ASM_ACTIVE_STREAMS_ALLOWED) {
|
if (session_id <= 0 || session_id > ASM_ACTIVE_STREAMS_ALLOWED) {
|
||||||
pr_err("%s: invalid session_id = %d\n", __func__, session_id);
|
pr_err("%s: invalid session_id = %d\n", __func__, session_id);
|
||||||
app_type = -EINVAL;
|
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
if (session[session_id] == NULL) {
|
||||||
|
pr_err("%s: session not created for session id = %d\n",
|
||||||
|
__func__, session_id);
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
app_type = session[session_id]->app_type;
|
app_type = session[session_id]->app_type;
|
||||||
done:
|
done:
|
||||||
return app_type;
|
return app_type;
|
||||||
|
|
|
@ -707,29 +707,28 @@ static int q6lsm_send_confidence_levels(
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int q6lsm_send_params(struct lsm_client *client,
|
static int q6lsm_send_param_opmode(struct lsm_client *client,
|
||||||
struct lsm_module_param_ids *opmode_ids,
|
struct lsm_module_param_ids *opmode_ids,
|
||||||
struct lsm_module_param_ids *connectport_ids,
|
|
||||||
u32 set_param_opcode)
|
u32 set_param_opcode)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
struct lsm_cmd_set_opmode_connectport opmode_connectport;
|
struct lsm_cmd_set_params_opmode opmode_params;
|
||||||
struct apr_hdr *msg_hdr;
|
struct apr_hdr *msg_hdr;
|
||||||
struct lsm_param_connect_to_port *connect_to_port;
|
|
||||||
struct lsm_param_op_mode *op_mode;
|
struct lsm_param_op_mode *op_mode;
|
||||||
u32 data_payload_size, param_size;
|
u32 data_payload_size, param_size;
|
||||||
|
|
||||||
msg_hdr = &opmode_connectport.msg_hdr;
|
msg_hdr = &opmode_params.msg_hdr;
|
||||||
q6lsm_add_hdr(client, msg_hdr,
|
q6lsm_add_hdr(client, msg_hdr,
|
||||||
sizeof(opmode_connectport), true);
|
sizeof(opmode_params), true);
|
||||||
msg_hdr->opcode = set_param_opcode;
|
msg_hdr->opcode = set_param_opcode;
|
||||||
data_payload_size = sizeof(opmode_connectport) -
|
data_payload_size = sizeof(opmode_params) -
|
||||||
sizeof(*msg_hdr) -
|
sizeof(*msg_hdr) -
|
||||||
sizeof(opmode_connectport.params_hdr);
|
sizeof(opmode_params.params_hdr);
|
||||||
q6lsm_set_param_hdr_info(&opmode_connectport.params_hdr,
|
q6lsm_set_param_hdr_info(&opmode_params.params_hdr,
|
||||||
data_payload_size, 0, 0, 0);
|
data_payload_size, 0, 0, 0);
|
||||||
connect_to_port = &opmode_connectport.connect_to_port;
|
op_mode = &opmode_params.op_mode;
|
||||||
op_mode = &opmode_connectport.op_mode;
|
|
||||||
|
|
||||||
param_size = sizeof(struct lsm_param_op_mode) -
|
param_size = sizeof(struct lsm_param_op_mode) -
|
||||||
sizeof(op_mode->common);
|
sizeof(op_mode->common);
|
||||||
|
@ -741,18 +740,8 @@ static int q6lsm_send_params(struct lsm_client *client,
|
||||||
op_mode->reserved = 0;
|
op_mode->reserved = 0;
|
||||||
pr_debug("%s: mode = 0x%x", __func__, op_mode->mode);
|
pr_debug("%s: mode = 0x%x", __func__, op_mode->mode);
|
||||||
|
|
||||||
param_size = (sizeof(struct lsm_param_connect_to_port) -
|
|
||||||
sizeof(connect_to_port->common));
|
|
||||||
q6lsm_set_param_common(&connect_to_port->common,
|
|
||||||
connectport_ids, param_size,
|
|
||||||
set_param_opcode);
|
|
||||||
connect_to_port->minor_version = QLSM_PARAM_ID_MINOR_VERSION;
|
|
||||||
connect_to_port->port_id = client->connect_to_port;
|
|
||||||
connect_to_port->reserved = 0;
|
|
||||||
pr_debug("%s: port= %d", __func__, connect_to_port->port_id);
|
|
||||||
|
|
||||||
rc = q6lsm_apr_send_pkt(client, client->apr,
|
rc = q6lsm_apr_send_pkt(client, client->apr,
|
||||||
&opmode_connectport, true, NULL);
|
&opmode_params, true, NULL);
|
||||||
if (rc)
|
if (rc)
|
||||||
pr_err("%s: Failed set_params opcode 0x%x, rc %d\n",
|
pr_err("%s: Failed set_params opcode 0x%x, rc %d\n",
|
||||||
__func__, msg_hdr->opcode, rc);
|
__func__, msg_hdr->opcode, rc);
|
||||||
|
@ -766,17 +755,106 @@ void set_lsm_port(int lsm_port)
|
||||||
lsm_afe_port = lsm_port;
|
lsm_afe_port = lsm_port;
|
||||||
}
|
}
|
||||||
|
|
||||||
int get_lsm_port()
|
int get_lsm_port(void)
|
||||||
{
|
{
|
||||||
return lsm_afe_port;
|
return lsm_afe_port;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int q6lsm_set_port_connected(struct lsm_client *client)
|
||||||
|
{
|
||||||
|
int rc;
|
||||||
|
struct lsm_cmd_set_connectport connectport;
|
||||||
|
struct lsm_module_param_ids connectport_ids;
|
||||||
|
struct apr_hdr *msg_hdr;
|
||||||
|
struct lsm_param_connect_to_port *connect_to_port;
|
||||||
|
u32 data_payload_size, param_size, set_param_opcode;
|
||||||
|
|
||||||
|
if (client->use_topology) {
|
||||||
|
set_param_opcode = LSM_SESSION_CMD_SET_PARAMS_V2;
|
||||||
|
connectport_ids.module_id = LSM_MODULE_ID_FRAMEWORK;
|
||||||
|
connectport_ids.param_id = LSM_PARAM_ID_CONNECT_TO_PORT;
|
||||||
|
} else {
|
||||||
|
set_param_opcode = LSM_SESSION_CMD_SET_PARAMS;
|
||||||
|
connectport_ids.module_id = LSM_MODULE_ID_VOICE_WAKEUP;
|
||||||
|
connectport_ids.param_id = LSM_PARAM_ID_CONNECT_TO_PORT;
|
||||||
|
}
|
||||||
|
client->connect_to_port = get_lsm_port();
|
||||||
|
|
||||||
|
msg_hdr = &connectport.msg_hdr;
|
||||||
|
q6lsm_add_hdr(client, msg_hdr,
|
||||||
|
sizeof(connectport), true);
|
||||||
|
msg_hdr->opcode = set_param_opcode;
|
||||||
|
data_payload_size = sizeof(connectport) -
|
||||||
|
sizeof(*msg_hdr) -
|
||||||
|
sizeof(connectport.params_hdr);
|
||||||
|
q6lsm_set_param_hdr_info(&connectport.params_hdr,
|
||||||
|
data_payload_size, 0, 0, 0);
|
||||||
|
connect_to_port = &connectport.connect_to_port;
|
||||||
|
|
||||||
|
param_size = (sizeof(struct lsm_param_connect_to_port) -
|
||||||
|
sizeof(connect_to_port->common));
|
||||||
|
q6lsm_set_param_common(&connect_to_port->common,
|
||||||
|
&connectport_ids, param_size,
|
||||||
|
set_param_opcode);
|
||||||
|
connect_to_port->minor_version = QLSM_PARAM_ID_MINOR_VERSION;
|
||||||
|
connect_to_port->port_id = client->connect_to_port;
|
||||||
|
connect_to_port->reserved = 0;
|
||||||
|
pr_debug("%s: port= %d", __func__, connect_to_port->port_id);
|
||||||
|
|
||||||
|
rc = q6lsm_apr_send_pkt(client, client->apr,
|
||||||
|
&connectport, true, NULL);
|
||||||
|
if (rc)
|
||||||
|
pr_err("%s: Failed set_params opcode 0x%x, rc %d\n",
|
||||||
|
__func__, msg_hdr->opcode, rc);
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
static int q6lsm_send_param_polling_enable(struct lsm_client *client,
|
||||||
|
bool poll_en,
|
||||||
|
struct lsm_module_param_ids *poll_enable_ids,
|
||||||
|
u32 set_param_opcode)
|
||||||
|
{
|
||||||
|
int rc = 0;
|
||||||
|
struct lsm_cmd_poll_enable cmd;
|
||||||
|
struct apr_hdr *msg_hdr;
|
||||||
|
struct lsm_param_poll_enable *poll_enable;
|
||||||
|
u32 data_payload_size, param_size;
|
||||||
|
|
||||||
|
msg_hdr = &cmd.msg_hdr;
|
||||||
|
q6lsm_add_hdr(client, msg_hdr,
|
||||||
|
sizeof(struct lsm_cmd_poll_enable), true);
|
||||||
|
msg_hdr->opcode = set_param_opcode;
|
||||||
|
data_payload_size = sizeof(struct lsm_cmd_poll_enable) -
|
||||||
|
sizeof(struct apr_hdr) -
|
||||||
|
sizeof(struct lsm_set_params_hdr);
|
||||||
|
q6lsm_set_param_hdr_info(&cmd.params_hdr,
|
||||||
|
data_payload_size, 0, 0, 0);
|
||||||
|
poll_enable = &cmd.poll_enable;
|
||||||
|
|
||||||
|
param_size = (sizeof(struct lsm_param_poll_enable) -
|
||||||
|
sizeof(poll_enable->common));
|
||||||
|
q6lsm_set_param_common(&poll_enable->common,
|
||||||
|
poll_enable_ids, param_size,
|
||||||
|
set_param_opcode);
|
||||||
|
poll_enable->minor_version = QLSM_PARAM_ID_MINOR_VERSION;
|
||||||
|
poll_enable->polling_enable = (poll_en) ? 1 : 0;
|
||||||
|
pr_debug("%s: poll enable= %d", __func__, poll_enable->polling_enable);
|
||||||
|
|
||||||
|
rc = q6lsm_apr_send_pkt(client, client->apr,
|
||||||
|
&cmd, true, NULL);
|
||||||
|
if (rc)
|
||||||
|
pr_err("%s: Failed set_params opcode 0x%x, rc %d\n",
|
||||||
|
__func__, msg_hdr->opcode, rc);
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
int q6lsm_set_data(struct lsm_client *client,
|
int q6lsm_set_data(struct lsm_client *client,
|
||||||
enum lsm_detection_mode mode,
|
enum lsm_detection_mode mode,
|
||||||
bool detectfailure)
|
bool detectfailure)
|
||||||
{
|
{
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
struct lsm_module_param_ids opmode_ids, connectport_ids;
|
struct lsm_module_param_ids opmode_ids;
|
||||||
struct lsm_module_param_ids conf_levels_ids;
|
struct lsm_module_param_ids conf_levels_ids;
|
||||||
|
|
||||||
if (!client->confidence_levels) {
|
if (!client->confidence_levels) {
|
||||||
|
@ -800,16 +878,12 @@ int q6lsm_set_data(struct lsm_client *client,
|
||||||
goto err_ret;
|
goto err_ret;
|
||||||
}
|
}
|
||||||
client->mode |= detectfailure << 2;
|
client->mode |= detectfailure << 2;
|
||||||
client->connect_to_port = get_lsm_port();
|
|
||||||
|
|
||||||
opmode_ids.module_id = LSM_MODULE_ID_VOICE_WAKEUP;
|
opmode_ids.module_id = LSM_MODULE_ID_VOICE_WAKEUP;
|
||||||
opmode_ids.param_id = LSM_PARAM_ID_OPERATION_MODE;
|
opmode_ids.param_id = LSM_PARAM_ID_OPERATION_MODE;
|
||||||
|
|
||||||
connectport_ids.module_id = LSM_MODULE_ID_VOICE_WAKEUP;
|
rc = q6lsm_send_param_opmode(client, &opmode_ids,
|
||||||
connectport_ids.param_id = LSM_PARAM_ID_CONNECT_TO_PORT;
|
LSM_SESSION_CMD_SET_PARAMS);
|
||||||
|
|
||||||
rc = q6lsm_send_params(client, &opmode_ids, &connectport_ids,
|
|
||||||
LSM_SESSION_CMD_SET_PARAMS);
|
|
||||||
if (rc) {
|
if (rc) {
|
||||||
pr_err("%s: Failed to set lsm config params %d\n",
|
pr_err("%s: Failed to set lsm config params %d\n",
|
||||||
__func__, rc);
|
__func__, rc);
|
||||||
|
@ -1409,7 +1483,6 @@ int q6lsm_set_one_param(struct lsm_client *client,
|
||||||
case LSM_OPERATION_MODE: {
|
case LSM_OPERATION_MODE: {
|
||||||
struct snd_lsm_detect_mode *det_mode = data;
|
struct snd_lsm_detect_mode *det_mode = data;
|
||||||
struct lsm_module_param_ids opmode_ids;
|
struct lsm_module_param_ids opmode_ids;
|
||||||
struct lsm_module_param_ids connectport_ids;
|
|
||||||
|
|
||||||
if (det_mode->mode == LSM_MODE_KEYWORD_ONLY_DETECTION) {
|
if (det_mode->mode == LSM_MODE_KEYWORD_ONLY_DETECTION) {
|
||||||
client->mode = 0x01;
|
client->mode = 0x01;
|
||||||
|
@ -1422,16 +1495,12 @@ int q6lsm_set_one_param(struct lsm_client *client,
|
||||||
}
|
}
|
||||||
|
|
||||||
client->mode |= det_mode->detect_failure << 2;
|
client->mode |= det_mode->detect_failure << 2;
|
||||||
client->connect_to_port = get_lsm_port();
|
|
||||||
|
|
||||||
opmode_ids.module_id = p_info->module_id;
|
opmode_ids.module_id = p_info->module_id;
|
||||||
opmode_ids.param_id = p_info->param_id;
|
opmode_ids.param_id = p_info->param_id;
|
||||||
|
|
||||||
connectport_ids.module_id = LSM_MODULE_ID_FRAMEWORK;
|
rc = q6lsm_send_param_opmode(client, &opmode_ids,
|
||||||
connectport_ids.param_id = LSM_PARAM_ID_CONNECT_TO_PORT;
|
LSM_SESSION_CMD_SET_PARAMS_V2);
|
||||||
|
|
||||||
rc = q6lsm_send_params(client, &opmode_ids, &connectport_ids,
|
|
||||||
LSM_SESSION_CMD_SET_PARAMS_V2);
|
|
||||||
if (rc)
|
if (rc)
|
||||||
pr_err("%s: OPERATION_MODE failed, rc %d\n",
|
pr_err("%s: OPERATION_MODE failed, rc %d\n",
|
||||||
__func__, rc);
|
__func__, rc);
|
||||||
|
@ -1458,6 +1527,20 @@ int q6lsm_set_one_param(struct lsm_client *client,
|
||||||
pr_err("%s: CONFIDENCE_LEVELS cmd failed, rc %d\n",
|
pr_err("%s: CONFIDENCE_LEVELS cmd failed, rc %d\n",
|
||||||
__func__, rc);
|
__func__, rc);
|
||||||
break;
|
break;
|
||||||
|
case LSM_POLLING_ENABLE: {
|
||||||
|
struct snd_lsm_poll_enable *lsm_poll_enable =
|
||||||
|
(struct snd_lsm_poll_enable *) data;
|
||||||
|
ids.module_id = p_info->module_id;
|
||||||
|
ids.param_id = p_info->param_id;
|
||||||
|
rc = q6lsm_send_param_polling_enable(client,
|
||||||
|
lsm_poll_enable->poll_en, &ids,
|
||||||
|
LSM_SESSION_CMD_SET_PARAMS_V2);
|
||||||
|
if (rc)
|
||||||
|
pr_err("%s: POLLING ENABLE cmd failed, rc %d\n",
|
||||||
|
__func__, rc);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case LSM_REG_SND_MODEL: {
|
case LSM_REG_SND_MODEL: {
|
||||||
struct lsm_cmd_set_params model_param;
|
struct lsm_cmd_set_params model_param;
|
||||||
u32 payload_size;
|
u32 payload_size;
|
||||||
|
|
Loading…
Add table
Reference in a new issue