Audio: DLKM support for all audio modules

Switch to DLKM for all audio kernel modules.

Change-Id: I6a96023a21f655f873531af9ace81f2b01eb0f58
Signed-off-by: Laxminath Kasam <lkasam@codeaurora.org>
Cette révision appartient à :
Laxminath Kasam
2017-10-05 01:44:16 +05:30
Parent 97c9da7a1e
révision 8b1366a648
115 fichiers modifiés avec 5347 ajouts et 353 suppressions

Voir le fichier

@@ -293,6 +293,15 @@ static int q6lsm_mmap_apr_dereg(void)
return 0;
}
/**
* q6lsm_client_alloc -
* Allocate session for LSM client
*
* @cb: callback fn
* @priv: private data
*
* Returns LSM client handle on success or NULL on failure
*/
struct lsm_client *q6lsm_client_alloc(lsm_app_cb cb, void *priv)
{
struct lsm_client *client;
@@ -341,7 +350,15 @@ fail:
q6lsm_client_free(client);
return NULL;
}
EXPORT_SYMBOL(q6lsm_client_alloc);
/**
* q6lsm_client_free -
* Performs LSM client free
*
* @client: LSM client handle
*
*/
void q6lsm_client_free(struct lsm_client *client)
{
if (!client)
@@ -358,6 +375,7 @@ void q6lsm_client_free(struct lsm_client *client)
kfree(client);
client = NULL;
}
EXPORT_SYMBOL(q6lsm_client_free);
/*
* q6lsm_apr_send_pkt : If wait == true, hold mutex to prevent from preempting
@@ -593,6 +611,15 @@ done:
}
/**
* q6lsm_sm_set_param_data -
* Update sound model param data
*
* @client: LSM client handle
* @p_info: param info
* @offset: pointer to retrieve size
*
*/
void q6lsm_sm_set_param_data(struct lsm_client *client,
struct lsm_params_info *p_info,
size_t *offset)
@@ -606,7 +633,17 @@ void q6lsm_sm_set_param_data(struct lsm_client *client,
param->p_size.param_size = client->sound_model.size;
*offset = sizeof(*param);
}
EXPORT_SYMBOL(q6lsm_sm_set_param_data);
/**
* q6lsm_open -
* command to open LSM session
*
* @client: LSM client handle
* @app_id: App ID for LSM
*
* Returns 0 on success or error on failure
*/
int q6lsm_open(struct lsm_client *client, uint16_t app_id)
{
int rc = 0;
@@ -654,6 +691,7 @@ done:
pr_debug("%s: leave %d\n", __func__, rc);
return rc;
}
EXPORT_SYMBOL(q6lsm_open);
static int q6lsm_send_confidence_levels(
struct lsm_client *client,
@@ -760,16 +798,30 @@ static int q6lsm_send_param_opmode(struct lsm_client *client,
return rc;
}
/**
* set_lsm_port -
* Update LSM AFE port
*
*/
void set_lsm_port(int lsm_port)
{
lsm_afe_port = lsm_port;
}
EXPORT_SYMBOL(set_lsm_port);
int get_lsm_port(void)
{
return lsm_afe_port;
}
/**
* q6lsm_set_port_connected -
* command to set LSM port connected
*
* @client: LSM client handle
*
* Returns 0 on success or error on failure
*/
int q6lsm_set_port_connected(struct lsm_client *client)
{
int rc;
@@ -819,6 +871,8 @@ int q6lsm_set_port_connected(struct lsm_client *client)
return rc;
}
EXPORT_SYMBOL(q6lsm_set_port_connected);
static int q6lsm_send_param_polling_enable(struct lsm_client *client,
bool poll_en,
struct lsm_module_param_ids *poll_enable_ids,
@@ -859,6 +913,15 @@ static int q6lsm_send_param_polling_enable(struct lsm_client *client,
return rc;
}
/**
* q6lsm_set_fwk_mode_cfg -
* command to set LSM fwk mode cfg
*
* @client: LSM client handle
* @event_mode: mode for fwk cfg
*
* Returns 0 on success or error on failure
*/
int q6lsm_set_fwk_mode_cfg(struct lsm_client *client,
uint32_t event_mode)
{
@@ -906,6 +969,7 @@ int q6lsm_set_fwk_mode_cfg(struct lsm_client *client,
__func__, msg_hdr->opcode, rc);
return rc;
}
EXPORT_SYMBOL(q6lsm_set_fwk_mode_cfg);
static int q6lsm_arrange_mch_map(struct lsm_param_media_fmt *media_fmt,
int channel_count)
@@ -941,6 +1005,14 @@ static int q6lsm_arrange_mch_map(struct lsm_param_media_fmt *media_fmt,
return rc;
}
/**
* q6lsm_set_media_fmt_params -
* command to set LSM media fmt params
*
* @client: LSM client handle
*
* Returns 0 on success or error on failure
*/
int q6lsm_set_media_fmt_params(struct lsm_client *client)
{
int rc = 0;
@@ -998,7 +1070,18 @@ int q6lsm_set_media_fmt_params(struct lsm_client *client)
err_ret:
return rc;
}
EXPORT_SYMBOL(q6lsm_set_media_fmt_params);
/**
* q6lsm_set_data -
* Command to set LSM data
*
* @client: LSM client handle
* @mode: LSM detection mode value
* @detectfailure: flag for detect failure
*
* Returns 0 on success or error on failure
*/
int q6lsm_set_data(struct lsm_client *client,
enum lsm_detection_mode mode,
bool detectfailure)
@@ -1061,7 +1144,16 @@ int q6lsm_set_data(struct lsm_client *client,
err_ret:
return rc;
}
EXPORT_SYMBOL(q6lsm_set_data);
/**
* q6lsm_register_sound_model -
* Register LSM snd model
*
* @client: LSM client handle
*
* Returns 0 on success or error on failure
*/
int q6lsm_register_sound_model(struct lsm_client *client,
enum lsm_detection_mode mode,
bool detectfailure)
@@ -1098,7 +1190,16 @@ int q6lsm_register_sound_model(struct lsm_client *client,
return rc;
}
EXPORT_SYMBOL(q6lsm_register_sound_model);
/**
* q6lsm_deregister_sound_model -
* De-register LSM snd model
*
* @client: LSM client handle
*
* Returns 0 on success or error on failure
*/
int q6lsm_deregister_sound_model(struct lsm_client *client)
{
int rc;
@@ -1134,6 +1235,7 @@ int q6lsm_deregister_sound_model(struct lsm_client *client)
return rc;
}
EXPORT_SYMBOL(q6lsm_deregister_sound_model);
static void q6lsm_add_mmaphdr(struct lsm_client *client, struct apr_hdr *hdr,
u32 pkt_size, u32 cmd_flg, u32 token)
@@ -1285,7 +1387,14 @@ done:
return rc;
}
/**
* q6lsm_snd_model_buf_free -
* Free memory for LSM snd model
*
* @client: LSM client handle
*
* Returns 0 on success or error on failure
*/
int q6lsm_snd_model_buf_free(struct lsm_client *client)
{
int rc;
@@ -1316,6 +1425,7 @@ int q6lsm_snd_model_buf_free(struct lsm_client *client)
mutex_unlock(&client->cmd_lock);
return rc;
}
EXPORT_SYMBOL(q6lsm_snd_model_buf_free);
static struct lsm_client *q6lsm_get_lsm_client(int session_id)
{
@@ -1420,6 +1530,16 @@ static int q6lsm_mmapcallback(struct apr_client_data *data, void *priv)
return 0;
}
/**
* q6lsm_snd_model_buf_alloc -
* Allocate memory for LSM snd model
*
* @client: LSM client handle
* @len: size of sound model
* @allocate_module_data: flag to allocate for set_param payload
*
* Returns 0 on success or error on failure
*/
int q6lsm_snd_model_buf_alloc(struct lsm_client *client, size_t len,
bool allocate_module_data)
{
@@ -1523,6 +1643,7 @@ exit:
q6lsm_snd_model_buf_free(client);
return rc;
}
EXPORT_SYMBOL(q6lsm_snd_model_buf_alloc);
static int q6lsm_cmd(struct lsm_client *client, int opcode, bool wait)
{
@@ -1613,6 +1734,17 @@ static int q6lsm_send_param_gain(
return rc;
}
/**
* q6lsm_set_one_param -
* command for LSM set params
*
* @client: LSM client handle
* p_info: Params info
* data: payload based on param type
* param_type: LSM param type
*
* Returns 0 on success or error on failure
*/
int q6lsm_set_one_param(struct lsm_client *client,
struct lsm_params_info *p_info, void *data,
uint32_t param_type)
@@ -1798,23 +1930,60 @@ int q6lsm_set_one_param(struct lsm_client *client,
return rc;
}
EXPORT_SYMBOL(q6lsm_set_one_param);
/**
* q6lsm_start -
* command for LSM start
*
* @client: LSM client handle
*
* Returns 0 on success or error on failure
*/
int q6lsm_start(struct lsm_client *client, bool wait)
{
return q6lsm_cmd(client, LSM_SESSION_CMD_START, wait);
}
EXPORT_SYMBOL(q6lsm_start);
/**
* q6lsm_stop -
* command for LSM stop
*
* @client: LSM client handle
*
* Returns 0 on success or error on failure
*/
int q6lsm_stop(struct lsm_client *client, bool wait)
{
return q6lsm_cmd(client, LSM_SESSION_CMD_STOP, wait);
}
EXPORT_SYMBOL(q6lsm_stop);
/**
* q6lsm_close -
* command for LSM close
*
* @client: LSM client handle
*
* Returns 0 on success or error on failure
*/
int q6lsm_close(struct lsm_client *client)
{
return q6lsm_cmd(client, LSM_SESSION_CMD_CLOSE_TX, true);
}
EXPORT_SYMBOL(q6lsm_close);
/**
* q6lsm_lab_control -
* command to set LSM LAB control params
*
* @client: LSM client handle
* @enable: bool flag to enable or disable LAB on DSP
*
* Returns 0 on success or error on failure
*/
int q6lsm_lab_control(struct lsm_client *client, u32 enable)
{
int rc = 0;
@@ -1876,7 +2045,16 @@ int q6lsm_lab_control(struct lsm_client *client, u32 enable)
exit:
return rc;
}
EXPORT_SYMBOL(q6lsm_lab_control);
/**
* q6lsm_stop_lab -
* command to stop LSM LAB
*
* @client: LSM client handle
*
* Returns 0 on success or error on failure
*/
int q6lsm_stop_lab(struct lsm_client *client)
{
int rc = 0;
@@ -1890,7 +2068,17 @@ int q6lsm_stop_lab(struct lsm_client *client)
pr_err("%s: Lab stop failed %d\n", __func__, rc);
return rc;
}
EXPORT_SYMBOL(q6lsm_stop_lab);
/**
* q6lsm_read -
* command for LSM read
*
* @client: LSM client handle
* @lsm_cmd_read: LSM read command
*
* Returns 0 on success or error on failure
*/
int q6lsm_read(struct lsm_client *client, struct lsm_cmd_read *read)
{
int rc = 0;
@@ -1910,7 +2098,17 @@ int q6lsm_read(struct lsm_client *client, struct lsm_cmd_read *read)
pr_err("%s: read buffer call failed rc %d\n", __func__, rc);
return rc;
}
EXPORT_SYMBOL(q6lsm_read);
/**
* q6lsm_lab_buffer_alloc -
* Lab buffer allocation or de-alloc
*
* @client: LSM client handle
* @alloc: Allocate or free ion memory
*
* Returns 0 on success or error on failure
*/
int q6lsm_lab_buffer_alloc(struct lsm_client *client, bool alloc)
{
int ret = 0, i = 0;
@@ -2000,6 +2198,7 @@ int q6lsm_lab_buffer_alloc(struct lsm_client *client, bool alloc)
}
return ret;
}
EXPORT_SYMBOL(q6lsm_lab_buffer_alloc);
static int get_cal_type_index(int32_t cal_type)
{
@@ -2155,7 +2354,7 @@ err:
return ret;
}
static int __init q6lsm_init(void)
int __init q6lsm_init(void)
{
int i = 0;
@@ -2177,10 +2376,7 @@ static int __init q6lsm_init(void)
return 0;
}
static void __exit q6lsm_exit(void)
void __exit q6lsm_exit(void)
{
lsm_delete_cal_data();
}
device_initcall(q6lsm_init);
__exitcall(q6lsm_exit);