mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-12 07:37:31 -04:00
Merge "ASoC: dsp: Update audio effects driver to support Instance ID"
This commit is contained in:
commit
ca201420ca
9 changed files with 1260 additions and 1586 deletions
File diff suppressed because it is too large
Load diff
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2013-2017, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2013-2018, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* 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
|
||||
|
|
@ -17,6 +17,7 @@
|
|||
#include <sound/control.h>
|
||||
#include <dsp/q6adm-v2.h>
|
||||
#include <dsp/q6core.h>
|
||||
#include <dsp/q6common.h>
|
||||
|
||||
#include "msm-ds2-dap-config.h"
|
||||
#include "msm-pcm-routing-v2.h"
|
||||
|
|
@ -196,18 +197,23 @@ static void msm_ds2_dap_check_and_update_ramp_wait(int port_id, int copp_idx,
|
|||
int32_t *update_params_value = NULL;
|
||||
uint32_t params_length = SOFT_VOLUME_PARAM_SIZE * sizeof(uint32_t);
|
||||
uint32_t param_payload_len = PARAM_PAYLOAD_SIZE * sizeof(uint32_t);
|
||||
struct param_hdr_v3 param_hdr;
|
||||
int rc = 0;
|
||||
|
||||
update_params_value = kzalloc(params_length + param_payload_len,
|
||||
GFP_KERNEL);
|
||||
if (!update_params_value)
|
||||
if (!update_params_value) {
|
||||
pr_err("%s: params memory alloc failed\n", __func__);
|
||||
goto end;
|
||||
}
|
||||
|
||||
rc = adm_get_params(port_id, copp_idx,
|
||||
AUDPROC_MODULE_ID_VOL_CTRL,
|
||||
AUDPROC_PARAM_ID_SOFT_VOL_STEPPING_PARAMETERS,
|
||||
params_length + param_payload_len,
|
||||
(char *) update_params_value);
|
||||
memset(¶m_hdr, 0, sizeof(param_hdr));
|
||||
param_hdr.module_id = AUDPROC_MODULE_ID_VOL_CTRL;
|
||||
param_hdr.instance_id = INSTANCE_ID_0;
|
||||
param_hdr.param_id = AUDPROC_PARAM_ID_SOFT_VOL_STEPPING_PARAMETERS;
|
||||
param_hdr.param_size = params_length + param_payload_len;
|
||||
rc = adm_get_pp_params(port_id, copp_idx, ADM_CLIENT_ID_DEFAULT, NULL,
|
||||
¶m_hdr, (char *) update_params_value);
|
||||
if (rc == 0) {
|
||||
pr_debug("%s: params_value [0x%x, 0x%x, 0x%x]\n",
|
||||
__func__, update_params_value[0],
|
||||
|
|
@ -227,12 +233,13 @@ end:
|
|||
static int msm_ds2_dap_set_vspe_vdhe(int dev_map_idx,
|
||||
bool is_custom_stereo_enabled)
|
||||
{
|
||||
int32_t *update_params_value = NULL;
|
||||
int32_t *param_val = NULL;
|
||||
int idx, i, j, rc = 0, cdev;
|
||||
uint32_t params_length = (TOTAL_LENGTH_DOLBY_PARAM +
|
||||
2 * DOLBY_PARAM_PAYLOAD_SIZE) *
|
||||
sizeof(uint32_t);
|
||||
u8 *packed_param_data = NULL;
|
||||
u8 *param_data = NULL;
|
||||
struct param_hdr_v3 param_hdr;
|
||||
u32 packed_param_size = 0;
|
||||
u32 param_size = 0;
|
||||
int cdev;
|
||||
int rc = 0;
|
||||
|
||||
if (dev_map_idx < 0 || dev_map_idx >= DS2_DEVICES_ALL) {
|
||||
pr_err("%s: invalid dev map index %d\n", __func__, dev_map_idx);
|
||||
|
|
@ -260,74 +267,95 @@ static int msm_ds2_dap_set_vspe_vdhe(int dev_map_idx,
|
|||
goto end;
|
||||
}
|
||||
|
||||
update_params_value = kzalloc(params_length, GFP_KERNEL);
|
||||
if (!update_params_value) {
|
||||
rc = -ENOMEM;
|
||||
/* Allocate the max space needed */
|
||||
packed_param_size = (TOTAL_LENGTH_DOLBY_PARAM * sizeof(uint32_t)) +
|
||||
(2 * sizeof(union param_hdrs));
|
||||
packed_param_data = kzalloc(packed_param_size, GFP_KERNEL);
|
||||
if (!packed_param_data)
|
||||
return -ENOMEM;
|
||||
|
||||
packed_param_size = 0;
|
||||
memset(¶m_hdr, 0, sizeof(param_hdr));
|
||||
|
||||
/* Set common values */
|
||||
cdev = dev_map[dev_map_idx].cache_dev;
|
||||
param_hdr.module_id = DOLBY_BUNDLE_MODULE_ID;
|
||||
param_hdr.instance_id = INSTANCE_ID_0;
|
||||
|
||||
/* Pack VDHE header + data */
|
||||
param_hdr.param_id = DOLBY_PARAM_ID_VDHE;
|
||||
param_size = DOLBY_PARAM_VDHE_LENGTH * sizeof(uint32_t);
|
||||
param_hdr.param_size = param_size;
|
||||
|
||||
if (is_custom_stereo_enabled)
|
||||
param_data = NULL;
|
||||
else
|
||||
param_data = (u8 *) &ds2_dap_params[cdev]
|
||||
.params_val[DOLBY_PARAM_VDHE_OFFSET];
|
||||
|
||||
rc = q6common_pack_pp_params(packed_param_data, ¶m_hdr, param_data,
|
||||
¶m_size);
|
||||
if (rc) {
|
||||
pr_err("%s: Failed to pack params for dolby vdhe, error %d\n",
|
||||
__func__, rc);
|
||||
goto end;
|
||||
}
|
||||
params_length = 0;
|
||||
param_val = update_params_value;
|
||||
cdev = dev_map[dev_map_idx].cache_dev;
|
||||
/* for VDHE and VSPE DAP params at index 0 and 1 in table */
|
||||
for (i = 0; i < 2; i++) {
|
||||
*update_params_value++ = DOLBY_BUNDLE_MODULE_ID;
|
||||
*update_params_value++ = ds2_dap_params_id[i];
|
||||
*update_params_value++ = ds2_dap_params_length[i] *
|
||||
sizeof(uint32_t);
|
||||
idx = ds2_dap_params_offset[i];
|
||||
for (j = 0; j < ds2_dap_params_length[i]; j++) {
|
||||
if (is_custom_stereo_enabled)
|
||||
*update_params_value++ = 0;
|
||||
else
|
||||
*update_params_value++ =
|
||||
ds2_dap_params[cdev].params_val[idx+j];
|
||||
}
|
||||
params_length += (DOLBY_PARAM_PAYLOAD_SIZE +
|
||||
ds2_dap_params_length[i]) *
|
||||
sizeof(uint32_t);
|
||||
}
|
||||
packed_param_size += param_size;
|
||||
|
||||
pr_debug("%s: valid param length: %d\n", __func__, params_length);
|
||||
if (params_length) {
|
||||
rc = adm_dolby_dap_send_params(dev_map[dev_map_idx].port_id,
|
||||
dev_map[dev_map_idx].copp_idx,
|
||||
(char *)param_val,
|
||||
params_length);
|
||||
if (rc) {
|
||||
pr_err("%s: send vdhe/vspe params failed with rc=%d\n",
|
||||
__func__, rc);
|
||||
rc = -EINVAL;
|
||||
goto end;
|
||||
}
|
||||
/* Pack VSPE header + data */
|
||||
param_hdr.param_id = DOLBY_PARAM_ID_VSPE;
|
||||
param_size = DOLBY_PARAM_VSPE_LENGTH * sizeof(uint32_t);
|
||||
param_hdr.param_size = param_size;
|
||||
|
||||
if (is_custom_stereo_enabled)
|
||||
param_data = NULL;
|
||||
else
|
||||
param_data = (u8 *) &ds2_dap_params[cdev]
|
||||
.params_val[DOLBY_PARAM_VSPE_OFFSET];
|
||||
|
||||
rc = q6common_pack_pp_params(packed_param_data + packed_param_size,
|
||||
¶m_hdr, param_data, ¶m_size);
|
||||
if (rc) {
|
||||
pr_err("%s: Failed to pack params for dolby vspe, error %d\n",
|
||||
__func__, rc);
|
||||
goto end;
|
||||
}
|
||||
packed_param_size += param_size;
|
||||
|
||||
rc = adm_set_pp_params(dev_map[dev_map_idx].port_id,
|
||||
dev_map[dev_map_idx].copp_idx, NULL,
|
||||
packed_param_data, packed_param_size);
|
||||
if (rc) {
|
||||
pr_err("%s: send vdhe/vspe params failed with rc=%d\n",
|
||||
__func__, rc);
|
||||
rc = -EINVAL;
|
||||
goto end;
|
||||
}
|
||||
end:
|
||||
kfree(param_val);
|
||||
kfree(packed_param_data);
|
||||
return rc;
|
||||
}
|
||||
|
||||
int qti_set_custom_stereo_on(int port_id, int copp_idx,
|
||||
bool is_custom_stereo_on)
|
||||
{
|
||||
|
||||
struct custom_stereo_param custom_stereo;
|
||||
struct param_hdr_v3 param_hdr;
|
||||
uint16_t op_FL_ip_FL_weight;
|
||||
uint16_t op_FL_ip_FR_weight;
|
||||
uint16_t op_FR_ip_FL_weight;
|
||||
uint16_t op_FR_ip_FR_weight;
|
||||
|
||||
int32_t *update_params_value32 = NULL, rc = 0;
|
||||
int32_t *param_val = NULL;
|
||||
int16_t *update_params_value16 = 0;
|
||||
uint32_t params_length_bytes = CUSTOM_STEREO_PAYLOAD_SIZE *
|
||||
sizeof(uint32_t);
|
||||
uint32_t avail_length = params_length_bytes;
|
||||
int rc = 0;
|
||||
|
||||
if ((port_id != SLIMBUS_0_RX) &&
|
||||
(port_id != RT_PROXY_PORT_001_RX)) {
|
||||
pr_debug("%s:No Custom stereo for port:0x%x\n",
|
||||
__func__, port_id);
|
||||
goto skip_send_cmd;
|
||||
return 0;
|
||||
}
|
||||
|
||||
memset(&custom_stereo, 0, sizeof(custom_stereo));
|
||||
memset(¶m_hdr, 0, sizeof(param_hdr));
|
||||
pr_debug("%s: port 0x%x, copp_idx %d, is_custom_stereo_on %d\n",
|
||||
__func__, port_id, copp_idx, is_custom_stereo_on);
|
||||
if (is_custom_stereo_on) {
|
||||
|
|
@ -346,76 +374,50 @@ int qti_set_custom_stereo_on(int port_id, int copp_idx,
|
|||
op_FR_ip_FR_weight = Q14_GAIN_UNITY;
|
||||
}
|
||||
|
||||
update_params_value32 = kzalloc(params_length_bytes, GFP_KERNEL);
|
||||
if (!update_params_value32) {
|
||||
rc = -ENOMEM;
|
||||
goto skip_send_cmd;
|
||||
}
|
||||
param_val = update_params_value32;
|
||||
if (avail_length < 2 * sizeof(uint32_t))
|
||||
goto skip_send_cmd;
|
||||
*update_params_value32++ = MTMX_MODULE_ID_DEFAULT_CHMIXER;
|
||||
*update_params_value32++ = DEFAULT_CHMIXER_PARAM_ID_COEFF;
|
||||
avail_length = avail_length - (2 * sizeof(uint32_t));
|
||||
param_hdr.module_id = MTMX_MODULE_ID_DEFAULT_CHMIXER;
|
||||
param_hdr.instance_id = INSTANCE_ID_0;
|
||||
param_hdr.param_id = DEFAULT_CHMIXER_PARAM_ID_COEFF;
|
||||
param_hdr.param_size = sizeof(struct custom_stereo_param);
|
||||
|
||||
update_params_value16 = (int16_t *)update_params_value32;
|
||||
if (avail_length < 10 * sizeof(uint16_t))
|
||||
goto skip_send_cmd;
|
||||
*update_params_value16++ = CUSTOM_STEREO_CMD_PARAM_SIZE;
|
||||
/* for alignment only*/
|
||||
*update_params_value16++ = 0;
|
||||
/* index is 32-bit param in little endian*/
|
||||
*update_params_value16++ = CUSTOM_STEREO_INDEX_PARAM;
|
||||
*update_params_value16++ = 0;
|
||||
custom_stereo.index = CUSTOM_STEREO_INDEX_PARAM;
|
||||
custom_stereo.reserved = 0;
|
||||
/* for stereo mixing num out ch*/
|
||||
*update_params_value16++ = CUSTOM_STEREO_NUM_OUT_CH;
|
||||
custom_stereo.num_out_ch = CUSTOM_STEREO_NUM_OUT_CH;
|
||||
/* for stereo mixing num in ch*/
|
||||
*update_params_value16++ = CUSTOM_STEREO_NUM_IN_CH;
|
||||
custom_stereo.num_in_ch = CUSTOM_STEREO_NUM_IN_CH;
|
||||
|
||||
/* Out ch map FL/FR*/
|
||||
*update_params_value16++ = PCM_CHANNEL_FL;
|
||||
*update_params_value16++ = PCM_CHANNEL_FR;
|
||||
custom_stereo.out_fl = PCM_CHANNEL_FL;
|
||||
custom_stereo.out_fr = PCM_CHANNEL_FR;
|
||||
|
||||
/* In ch map FL/FR*/
|
||||
*update_params_value16++ = PCM_CHANNEL_FL;
|
||||
*update_params_value16++ = PCM_CHANNEL_FR;
|
||||
avail_length = avail_length - (10 * sizeof(uint16_t));
|
||||
custom_stereo.in_fl = PCM_CHANNEL_FL;
|
||||
custom_stereo.in_fr = PCM_CHANNEL_FR;
|
||||
|
||||
/* weighting coefficients as name suggests,
|
||||
* mixing will be done according to these coefficients
|
||||
*/
|
||||
if (avail_length < 4 * sizeof(uint16_t))
|
||||
goto skip_send_cmd;
|
||||
*update_params_value16++ = op_FL_ip_FL_weight;
|
||||
*update_params_value16++ = op_FL_ip_FR_weight;
|
||||
*update_params_value16++ = op_FR_ip_FL_weight;
|
||||
*update_params_value16++ = op_FR_ip_FR_weight;
|
||||
avail_length = avail_length - (4 * sizeof(uint16_t));
|
||||
if (params_length_bytes != 0) {
|
||||
rc = adm_dolby_dap_send_params(port_id, copp_idx,
|
||||
(char *)param_val,
|
||||
params_length_bytes);
|
||||
if (rc) {
|
||||
pr_err("%s: send params failed rc=%d\n", __func__, rc);
|
||||
rc = -EINVAL;
|
||||
goto skip_send_cmd;
|
||||
}
|
||||
custom_stereo.op_FL_ip_FL_weight = op_FL_ip_FL_weight;
|
||||
custom_stereo.op_FL_ip_FR_weight = op_FL_ip_FR_weight;
|
||||
custom_stereo.op_FR_ip_FL_weight = op_FR_ip_FL_weight;
|
||||
custom_stereo.op_FR_ip_FR_weight = op_FR_ip_FR_weight;
|
||||
rc = adm_pack_and_set_one_pp_param(port_id, copp_idx, param_hdr,
|
||||
(u8 *) &custom_stereo);
|
||||
if (rc) {
|
||||
pr_err("%s: send params failed rc=%d\n", __func__, rc);
|
||||
return -EINVAL;
|
||||
}
|
||||
kfree(param_val);
|
||||
|
||||
return 0;
|
||||
skip_send_cmd:
|
||||
pr_err("%s: insufficient memory, send cmd failed\n",
|
||||
__func__);
|
||||
kfree(param_val);
|
||||
return rc;
|
||||
}
|
||||
static int dap_set_custom_stereo_onoff(int dev_map_idx,
|
||||
bool is_custom_stereo_enabled)
|
||||
{
|
||||
uint32_t enable = is_custom_stereo_enabled ? 1 : 0;
|
||||
struct param_hdr_v3 param_hdr;
|
||||
int rc = 0;
|
||||
|
||||
int32_t *update_params_value = NULL, rc = 0;
|
||||
int32_t *param_val = NULL;
|
||||
uint32_t params_length_bytes = (TOTAL_LENGTH_DOLBY_PARAM +
|
||||
DOLBY_PARAM_PAYLOAD_SIZE) * sizeof(uint32_t);
|
||||
if ((dev_map[dev_map_idx].port_id != SLIMBUS_0_RX) &&
|
||||
(dev_map[dev_map_idx].port_id != RT_PROXY_PORT_001_RX)) {
|
||||
pr_debug("%s:No Custom stereo for port:0x%x\n",
|
||||
|
|
@ -429,41 +431,25 @@ static int dap_set_custom_stereo_onoff(int dev_map_idx,
|
|||
goto end;
|
||||
}
|
||||
|
||||
memset(¶m_hdr, 0, sizeof(param_hdr));
|
||||
|
||||
/* DAP custom stereo */
|
||||
msm_ds2_dap_set_vspe_vdhe(dev_map_idx,
|
||||
is_custom_stereo_enabled);
|
||||
update_params_value = kzalloc(params_length_bytes, GFP_KERNEL);
|
||||
if (!update_params_value) {
|
||||
pr_err("%s: params memory alloc failed\n", __func__);
|
||||
rc = -ENOMEM;
|
||||
goto end;
|
||||
}
|
||||
params_length_bytes = 0;
|
||||
param_val = update_params_value;
|
||||
*update_params_value++ = DOLBY_BUNDLE_MODULE_ID;
|
||||
*update_params_value++ = DOLBY_ENABLE_CUSTOM_STEREO;
|
||||
*update_params_value++ = sizeof(uint32_t);
|
||||
if (is_custom_stereo_enabled)
|
||||
*update_params_value++ = 1;
|
||||
else
|
||||
*update_params_value++ = 0;
|
||||
params_length_bytes += (DOLBY_PARAM_PAYLOAD_SIZE + 1) *
|
||||
sizeof(uint32_t);
|
||||
pr_debug("%s: valid param length: %d\n", __func__, params_length_bytes);
|
||||
if (params_length_bytes) {
|
||||
rc = adm_dolby_dap_send_params(dev_map[dev_map_idx].port_id,
|
||||
dev_map[dev_map_idx].copp_idx,
|
||||
(char *)param_val,
|
||||
params_length_bytes);
|
||||
if (rc) {
|
||||
pr_err("%s: custom stereo param failed with rc=%d\n",
|
||||
__func__, rc);
|
||||
rc = -EINVAL;
|
||||
goto end;
|
||||
}
|
||||
param_hdr.module_id = DOLBY_BUNDLE_MODULE_ID;
|
||||
param_hdr.instance_id = INSTANCE_ID_0;
|
||||
param_hdr.param_id = DOLBY_ENABLE_CUSTOM_STEREO;
|
||||
param_hdr.param_size = sizeof(enable);
|
||||
|
||||
rc = adm_pack_and_set_one_pp_param(dev_map[dev_map_idx].port_id,
|
||||
dev_map[dev_map_idx].copp_idx,
|
||||
param_hdr, (u8 *) &enable);
|
||||
if (rc) {
|
||||
pr_err("%s: set custom stereo enable failed with rc=%d\n",
|
||||
__func__, rc);
|
||||
rc = -EINVAL;
|
||||
}
|
||||
end:
|
||||
kfree(param_val);
|
||||
return rc;
|
||||
|
||||
}
|
||||
|
|
@ -652,8 +638,11 @@ static int msm_ds2_dap_init_modules_in_topology(int dev_map_idx)
|
|||
{
|
||||
int rc = 0, i = 0, port_id, copp_idx;
|
||||
/* Account for 32 bit integer allocation */
|
||||
int32_t param_sz = (ADM_GET_TOPO_MODULE_LIST_LENGTH / sizeof(uint32_t));
|
||||
int32_t param_sz =
|
||||
(ADM_GET_TOPO_MODULE_INSTANCE_LIST_LENGTH / sizeof(uint32_t));
|
||||
int32_t *update_param_val = NULL;
|
||||
struct module_instance_info mod_inst_info;
|
||||
int mod_inst_info_sz = 0;
|
||||
|
||||
if (dev_map_idx < 0 || dev_map_idx >= DS2_DEVICES_ALL) {
|
||||
pr_err("%s: invalid dev map index %d\n", __func__, dev_map_idx);
|
||||
|
|
@ -661,10 +650,12 @@ static int msm_ds2_dap_init_modules_in_topology(int dev_map_idx)
|
|||
goto end;
|
||||
}
|
||||
|
||||
memset(&mod_inst_info, 0, sizeof(mod_inst_info));
|
||||
port_id = dev_map[dev_map_idx].port_id;
|
||||
copp_idx = dev_map[dev_map_idx].copp_idx;
|
||||
pr_debug("%s: port_id 0x%x copp_idx %d\n", __func__, port_id, copp_idx);
|
||||
update_param_val = kzalloc(ADM_GET_TOPO_MODULE_LIST_LENGTH, GFP_KERNEL);
|
||||
update_param_val =
|
||||
kzalloc(ADM_GET_TOPO_MODULE_INSTANCE_LIST_LENGTH, GFP_KERNEL);
|
||||
if (!update_param_val) {
|
||||
pr_err("%s, param memory alloc failed\n", __func__);
|
||||
rc = -ENOMEM;
|
||||
|
|
@ -673,9 +664,10 @@ static int msm_ds2_dap_init_modules_in_topology(int dev_map_idx)
|
|||
|
||||
if (!ds2_dap_params_states.dap_bypass) {
|
||||
/* get modules from dsp */
|
||||
rc = adm_get_pp_topo_module_list(port_id, copp_idx,
|
||||
ADM_GET_TOPO_MODULE_LIST_LENGTH,
|
||||
(char *)update_param_val);
|
||||
rc = adm_get_pp_topo_module_list_v2(
|
||||
port_id, copp_idx,
|
||||
ADM_GET_TOPO_MODULE_INSTANCE_LIST_LENGTH,
|
||||
update_param_val);
|
||||
if (rc < 0) {
|
||||
pr_err("%s:topo list port %d, err %d,copp_idx %d\n",
|
||||
__func__, port_id, copp_idx, rc);
|
||||
|
|
@ -689,11 +681,15 @@ static int msm_ds2_dap_init_modules_in_topology(int dev_map_idx)
|
|||
rc = -EINVAL;
|
||||
goto end;
|
||||
}
|
||||
|
||||
mod_inst_info_sz = sizeof(struct module_instance_info) /
|
||||
sizeof(uint32_t);
|
||||
/* Turn off modules */
|
||||
for (i = 1; i < update_param_val[0]; i++) {
|
||||
for (i = 1; i < update_param_val[0] * mod_inst_info_sz;
|
||||
i += mod_inst_info_sz) {
|
||||
if (!msm_ds2_dap_can_enable_module(
|
||||
update_param_val[i]) ||
|
||||
(update_param_val[i] == DS2_MODULE_ID)) {
|
||||
update_param_val[i]) ||
|
||||
(update_param_val[i] == DS2_MODULE_ID)) {
|
||||
pr_debug("%s: Do not enable/disable %d\n",
|
||||
__func__, update_param_val[i]);
|
||||
continue;
|
||||
|
|
@ -701,15 +697,21 @@ static int msm_ds2_dap_init_modules_in_topology(int dev_map_idx)
|
|||
|
||||
pr_debug("%s: param disable %d\n",
|
||||
__func__, update_param_val[i]);
|
||||
adm_param_enable(port_id, copp_idx, update_param_val[i],
|
||||
MODULE_DISABLE);
|
||||
memcpy(&mod_inst_info, &update_param_val[i],
|
||||
sizeof(mod_inst_info));
|
||||
adm_param_enable_v2(port_id, copp_idx,
|
||||
mod_inst_info,
|
||||
MODULE_DISABLE);
|
||||
}
|
||||
} else {
|
||||
msm_ds2_dap_send_cal_data(dev_map_idx);
|
||||
|
||||
}
|
||||
adm_param_enable(port_id, copp_idx, DS2_MODULE_ID,
|
||||
!ds2_dap_params_states.dap_bypass);
|
||||
|
||||
mod_inst_info.module_id = DS2_MODULE_ID;
|
||||
mod_inst_info.instance_id = INSTANCE_ID_0;
|
||||
adm_param_enable_v2(port_id, copp_idx, mod_inst_info,
|
||||
!ds2_dap_params_states.dap_bypass);
|
||||
end:
|
||||
kfree(update_param_val);
|
||||
return rc;
|
||||
|
|
@ -885,17 +887,22 @@ static int msm_ds2_dap_handle_bypass(struct dolby_param_data *dolby_data)
|
|||
{
|
||||
int rc = 0, i = 0, j = 0;
|
||||
/*Account for 32 bit integer allocation */
|
||||
int32_t param_sz = (ADM_GET_TOPO_MODULE_LIST_LENGTH / sizeof(uint32_t));
|
||||
int32_t param_sz =
|
||||
(ADM_GET_TOPO_MODULE_INSTANCE_LIST_LENGTH / sizeof(uint32_t));
|
||||
int32_t *mod_list = NULL;
|
||||
int port_id = 0, copp_idx = -1;
|
||||
bool cs_onoff = ds2_dap_params_states.custom_stereo_onoff;
|
||||
int ramp_wait = DOLBY_SOFT_VOLUME_PERIOD;
|
||||
struct module_instance_info mod_inst_info;
|
||||
int mod_inst_info_sz = 0;
|
||||
|
||||
pr_debug("%s: bypass type %d bypass %d custom stereo %d\n", __func__,
|
||||
ds2_dap_params_states.dap_bypass_type,
|
||||
ds2_dap_params_states.dap_bypass,
|
||||
ds2_dap_params_states.custom_stereo_onoff);
|
||||
mod_list = kzalloc(ADM_GET_TOPO_MODULE_LIST_LENGTH, GFP_KERNEL);
|
||||
memset(&mod_inst_info, 0, sizeof(mod_inst_info));
|
||||
mod_list =
|
||||
kzalloc(ADM_GET_TOPO_MODULE_INSTANCE_LIST_LENGTH, GFP_KERNEL);
|
||||
if (!mod_list) {
|
||||
pr_err("%s: param memory alloc failed\n", __func__);
|
||||
rc = -ENOMEM;
|
||||
|
|
@ -922,9 +929,10 @@ static int msm_ds2_dap_handle_bypass(struct dolby_param_data *dolby_data)
|
|||
}
|
||||
|
||||
/* getmodules from dsp */
|
||||
rc = adm_get_pp_topo_module_list(port_id, copp_idx,
|
||||
ADM_GET_TOPO_MODULE_LIST_LENGTH,
|
||||
(char *)mod_list);
|
||||
rc = adm_get_pp_topo_module_list_v2(
|
||||
port_id, copp_idx,
|
||||
ADM_GET_TOPO_MODULE_INSTANCE_LIST_LENGTH,
|
||||
mod_list);
|
||||
if (rc < 0) {
|
||||
pr_err("%s:adm get topo list port %d",
|
||||
__func__, port_id);
|
||||
|
|
@ -976,8 +984,11 @@ static int msm_ds2_dap_handle_bypass(struct dolby_param_data *dolby_data)
|
|||
/* if dap bypass is set */
|
||||
if (ds2_dap_params_states.dap_bypass) {
|
||||
/* Turn off dap module */
|
||||
adm_param_enable(port_id, copp_idx,
|
||||
DS2_MODULE_ID, MODULE_DISABLE);
|
||||
mod_inst_info.module_id = DS2_MODULE_ID;
|
||||
mod_inst_info.instance_id = INSTANCE_ID_0;
|
||||
adm_param_enable_v2(port_id, copp_idx,
|
||||
mod_inst_info,
|
||||
MODULE_DISABLE);
|
||||
/*
|
||||
* If custom stereo is on at the time of bypass,
|
||||
* switch off custom stereo on dap and turn on
|
||||
|
|
@ -1000,8 +1011,13 @@ static int msm_ds2_dap_handle_bypass(struct dolby_param_data *dolby_data)
|
|||
copp_idx, rc);
|
||||
}
|
||||
}
|
||||
|
||||
mod_inst_info_sz =
|
||||
sizeof(struct module_instance_info) /
|
||||
sizeof(uint32_t);
|
||||
/* Turn on qti modules */
|
||||
for (j = 1; j < mod_list[0]; j++) {
|
||||
for (j = 1; j < mod_list[0] * mod_inst_info_sz;
|
||||
j += mod_inst_info_sz) {
|
||||
if (!msm_ds2_dap_can_enable_module(
|
||||
mod_list[j]) ||
|
||||
mod_list[j] ==
|
||||
|
|
@ -1009,9 +1025,11 @@ static int msm_ds2_dap_handle_bypass(struct dolby_param_data *dolby_data)
|
|||
continue;
|
||||
pr_debug("%s: param enable %d\n",
|
||||
__func__, mod_list[j]);
|
||||
adm_param_enable(port_id, copp_idx,
|
||||
mod_list[j],
|
||||
MODULE_ENABLE);
|
||||
memcpy(&mod_inst_info, &mod_list[j],
|
||||
sizeof(mod_inst_info));
|
||||
adm_param_enable_v2(port_id, copp_idx,
|
||||
mod_inst_info,
|
||||
MODULE_ENABLE);
|
||||
}
|
||||
|
||||
/* Add adm api to resend calibration on port */
|
||||
|
|
@ -1026,7 +1044,8 @@ static int msm_ds2_dap_handle_bypass(struct dolby_param_data *dolby_data)
|
|||
}
|
||||
} else {
|
||||
/* Turn off qti modules */
|
||||
for (j = 1; j < mod_list[0]; j++) {
|
||||
for (j = 1; j < mod_list[0] * mod_inst_info_sz;
|
||||
j += mod_inst_info_sz) {
|
||||
if (!msm_ds2_dap_can_enable_module(
|
||||
mod_list[j]) ||
|
||||
mod_list[j] ==
|
||||
|
|
@ -1034,15 +1053,20 @@ static int msm_ds2_dap_handle_bypass(struct dolby_param_data *dolby_data)
|
|||
continue;
|
||||
pr_debug("%s: param disable %d\n",
|
||||
__func__, mod_list[j]);
|
||||
adm_param_enable(port_id, copp_idx,
|
||||
mod_list[j],
|
||||
MODULE_DISABLE);
|
||||
memcpy(&mod_inst_info, &mod_list[j],
|
||||
sizeof(mod_inst_info));
|
||||
adm_param_enable_v2(port_id, copp_idx,
|
||||
mod_inst_info,
|
||||
MODULE_DISABLE);
|
||||
}
|
||||
|
||||
/* Enable DAP modules */
|
||||
pr_debug("%s:DS2 param enable\n", __func__);
|
||||
adm_param_enable(port_id, copp_idx,
|
||||
DS2_MODULE_ID, MODULE_ENABLE);
|
||||
mod_inst_info.module_id = DS2_MODULE_ID;
|
||||
mod_inst_info.instance_id = INSTANCE_ID_0;
|
||||
adm_param_enable_v2(port_id, copp_idx,
|
||||
mod_inst_info,
|
||||
MODULE_ENABLE);
|
||||
/*
|
||||
* If custom stereo is on at the time of dap on,
|
||||
* switch off custom stereo on qti channel mixer
|
||||
|
|
@ -1101,19 +1125,19 @@ end:
|
|||
|
||||
static int msm_ds2_dap_send_end_point(int dev_map_idx, int endp_idx)
|
||||
{
|
||||
int rc = 0;
|
||||
int32_t *update_params_value = NULL, *params_value = NULL;
|
||||
uint32_t params_length = (DOLBY_PARAM_INT_ENDP_LENGTH +
|
||||
DOLBY_PARAM_PAYLOAD_SIZE) * sizeof(uint32_t);
|
||||
uint32_t offset = 0;
|
||||
struct param_hdr_v3 param_hdr;
|
||||
int cache_device = 0;
|
||||
struct ds2_dap_params_s *ds2_ap_params_obj = NULL;
|
||||
int32_t *modified_param = NULL;
|
||||
int rc = 0;
|
||||
|
||||
if (dev_map_idx < 0 || dev_map_idx >= DS2_DEVICES_ALL) {
|
||||
pr_err("%s: invalid dev map index %d\n", __func__, dev_map_idx);
|
||||
rc = -EINVAL;
|
||||
goto end;
|
||||
}
|
||||
memset(¶m_hdr, 0, sizeof(param_hdr));
|
||||
cache_device = dev_map[dev_map_idx].cache_dev;
|
||||
|
||||
ds2_ap_params_obj = &ds2_dap_params[cache_device];
|
||||
|
|
@ -1122,12 +1146,6 @@ static int msm_ds2_dap_send_end_point(int dev_map_idx, int endp_idx)
|
|||
pr_debug("%s: endp - %pK %pK\n", __func__,
|
||||
&ds2_dap_params[cache_device], ds2_ap_params_obj);
|
||||
|
||||
params_value = kzalloc(params_length, GFP_KERNEL);
|
||||
if (!params_value) {
|
||||
rc = -ENOMEM;
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (dev_map[dev_map_idx].port_id == DOLBY_INVALID_PORT_ID) {
|
||||
pr_err("%s: invalid port\n", __func__);
|
||||
rc = -EINVAL;
|
||||
|
|
@ -1141,21 +1159,20 @@ static int msm_ds2_dap_send_end_point(int dev_map_idx, int endp_idx)
|
|||
goto end;
|
||||
}
|
||||
|
||||
update_params_value = params_value;
|
||||
*update_params_value++ = DOLBY_BUNDLE_MODULE_ID;
|
||||
*update_params_value++ = DOLBY_PARAM_ID_INIT_ENDP;
|
||||
*update_params_value++ = DOLBY_PARAM_INT_ENDP_LENGTH * sizeof(uint32_t);
|
||||
*update_params_value++ = ds2_ap_params_obj->params_val[
|
||||
ds2_dap_params_offset[endp_idx]];
|
||||
param_hdr.module_id = DOLBY_BUNDLE_MODULE_ID;
|
||||
param_hdr.instance_id = INSTANCE_ID_0;
|
||||
param_hdr.param_id = DOLBY_PARAM_ID_INIT_ENDP;
|
||||
param_hdr.param_size = sizeof(offset);
|
||||
offset = ds2_ap_params_obj->params_val[ds2_dap_params_offset[endp_idx]];
|
||||
pr_debug("%s: off %d, length %d\n", __func__,
|
||||
ds2_dap_params_offset[endp_idx],
|
||||
ds2_dap_params_length[endp_idx]);
|
||||
pr_debug("%s: param 0x%x, param val %d\n", __func__,
|
||||
ds2_dap_params_id[endp_idx], ds2_ap_params_obj->
|
||||
params_val[ds2_dap_params_offset[endp_idx]]);
|
||||
rc = adm_dolby_dap_send_params(dev_map[dev_map_idx].port_id,
|
||||
dev_map[dev_map_idx].copp_idx,
|
||||
(char *)params_value, params_length);
|
||||
rc = adm_pack_and_set_one_pp_param(dev_map[dev_map_idx].port_id,
|
||||
dev_map[dev_map_idx].copp_idx,
|
||||
param_hdr, (u8 *) &offset);
|
||||
if (rc) {
|
||||
pr_err("%s: send dolby params failed rc %d\n", __func__, rc);
|
||||
rc = -EINVAL;
|
||||
|
|
@ -1172,19 +1189,17 @@ static int msm_ds2_dap_send_end_point(int dev_map_idx, int endp_idx)
|
|||
ds2_ap_params_obj->dap_params_modified[endp_idx] = 0x00010001;
|
||||
|
||||
end:
|
||||
kfree(params_value);
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int msm_ds2_dap_send_cached_params(int dev_map_idx,
|
||||
int commit)
|
||||
{
|
||||
int32_t *update_params_value = NULL, *params_value = NULL;
|
||||
uint32_t idx, i, j, ret = 0;
|
||||
uint32_t params_length = (TOTAL_LENGTH_DOLBY_PARAM +
|
||||
(MAX_DS2_PARAMS - 1) *
|
||||
DOLBY_PARAM_PAYLOAD_SIZE) *
|
||||
sizeof(uint32_t);
|
||||
uint8_t *packed_params = NULL;
|
||||
uint32_t packed_params_size = 0;
|
||||
uint32_t param_size = 0;
|
||||
struct param_hdr_v3 param_hdr;
|
||||
uint32_t idx, i, ret = 0;
|
||||
int cache_device = 0;
|
||||
struct ds2_dap_params_s *ds2_ap_params_obj = NULL;
|
||||
int32_t *modified_param = NULL;
|
||||
|
|
@ -1194,6 +1209,7 @@ static int msm_ds2_dap_send_cached_params(int dev_map_idx,
|
|||
ret = -EINVAL;
|
||||
goto end;
|
||||
}
|
||||
memset(¶m_hdr, 0, sizeof(param_hdr));
|
||||
cache_device = dev_map[dev_map_idx].cache_dev;
|
||||
|
||||
/* Use off profile cache in only for soft bypass */
|
||||
|
|
@ -1207,12 +1223,16 @@ static int msm_ds2_dap_send_cached_params(int dev_map_idx,
|
|||
pr_debug("%s: cached param - %pK %pK, cache_device %d\n", __func__,
|
||||
&ds2_dap_params[cache_device], ds2_ap_params_obj,
|
||||
cache_device);
|
||||
params_value = kzalloc(params_length, GFP_KERNEL);
|
||||
if (!params_value) {
|
||||
pr_err("%s: params memory alloc failed\n", __func__);
|
||||
ret = -ENOMEM;
|
||||
goto end;
|
||||
}
|
||||
|
||||
/*
|
||||
* Allocate the max space needed. This is enough space to hold the
|
||||
* header for each param plus the total size of all the params.
|
||||
*/
|
||||
packed_params_size = (sizeof(param_hdr) * (MAX_DS2_PARAMS - 1)) +
|
||||
(TOTAL_LENGTH_DOLBY_PARAM * sizeof(uint32_t));
|
||||
packed_params = kzalloc(packed_params_size, GFP_KERNEL);
|
||||
if (!packed_params)
|
||||
return -ENOMEM;
|
||||
|
||||
if (dev_map[dev_map_idx].port_id == DOLBY_INVALID_PORT_ID) {
|
||||
pr_err("%s: invalid port id\n", __func__);
|
||||
|
|
@ -1227,8 +1247,7 @@ static int msm_ds2_dap_send_cached_params(int dev_map_idx,
|
|||
goto end;
|
||||
}
|
||||
|
||||
update_params_value = params_value;
|
||||
params_length = 0;
|
||||
packed_params_size = 0;
|
||||
for (i = 0; i < (MAX_DS2_PARAMS-1); i++) {
|
||||
/*get the pointer to the param modified array in the cache*/
|
||||
modified_param = ds2_ap_params_obj->dap_params_modified;
|
||||
|
|
@ -1241,28 +1260,33 @@ static int msm_ds2_dap_send_cached_params(int dev_map_idx,
|
|||
if (!msm_ds2_dap_check_is_param_modified(modified_param, i,
|
||||
commit))
|
||||
continue;
|
||||
*update_params_value++ = DOLBY_BUNDLE_MODULE_ID;
|
||||
*update_params_value++ = ds2_dap_params_id[i];
|
||||
*update_params_value++ = ds2_dap_params_length[i] *
|
||||
sizeof(uint32_t);
|
||||
|
||||
param_hdr.module_id = DOLBY_BUNDLE_MODULE_ID;
|
||||
param_hdr.instance_id = INSTANCE_ID_0;
|
||||
param_hdr.param_id = ds2_dap_params_id[i];
|
||||
param_hdr.param_size =
|
||||
ds2_dap_params_length[i] * sizeof(uint32_t);
|
||||
|
||||
idx = ds2_dap_params_offset[i];
|
||||
for (j = 0; j < ds2_dap_params_length[i]; j++) {
|
||||
*update_params_value++ =
|
||||
ds2_ap_params_obj->params_val[idx+j];
|
||||
pr_debug("%s: id 0x%x,val %d\n", __func__,
|
||||
ds2_dap_params_id[i],
|
||||
ds2_ap_params_obj->params_val[idx+j]);
|
||||
ret = q6common_pack_pp_params(
|
||||
packed_params + packed_params_size, ¶m_hdr,
|
||||
(u8 *) &ds2_ap_params_obj->params_val[idx],
|
||||
¶m_size);
|
||||
if (ret) {
|
||||
pr_err("%s: Failed to pack params, error %d\n",
|
||||
__func__, ret);
|
||||
goto end;
|
||||
}
|
||||
params_length += (DOLBY_PARAM_PAYLOAD_SIZE +
|
||||
ds2_dap_params_length[i]) * sizeof(uint32_t);
|
||||
|
||||
packed_params_size += param_size;
|
||||
}
|
||||
|
||||
pr_debug("%s: valid param length: %d\n", __func__, params_length);
|
||||
if (params_length) {
|
||||
ret = adm_dolby_dap_send_params(dev_map[dev_map_idx].port_id,
|
||||
dev_map[dev_map_idx].copp_idx,
|
||||
(char *)params_value,
|
||||
params_length);
|
||||
pr_debug("%s: total packed param length: %d\n", __func__,
|
||||
packed_params_size);
|
||||
if (packed_params_size) {
|
||||
ret = adm_set_pp_params(dev_map[dev_map_idx].port_id,
|
||||
dev_map[dev_map_idx].copp_idx, NULL,
|
||||
packed_params, packed_params_size);
|
||||
if (ret) {
|
||||
pr_err("%s: send dolby params failed ret %d\n",
|
||||
__func__, ret);
|
||||
|
|
@ -1285,7 +1309,7 @@ static int msm_ds2_dap_send_cached_params(int dev_map_idx,
|
|||
}
|
||||
}
|
||||
end:
|
||||
kfree(params_value);
|
||||
kfree(packed_params);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -1523,11 +1547,12 @@ static int msm_ds2_dap_get_param(u32 cmd, void *arg)
|
|||
{
|
||||
int rc = 0, i, port_id = 0, copp_idx = -1;
|
||||
struct dolby_param_data *dolby_data = (struct dolby_param_data *)arg;
|
||||
int32_t *update_params_value = NULL, *params_value = NULL;
|
||||
int32_t *params_value = NULL;
|
||||
uint32_t params_length = DOLBY_MAX_LENGTH_INDIVIDUAL_PARAM *
|
||||
sizeof(uint32_t);
|
||||
uint32_t param_payload_len =
|
||||
DOLBY_PARAM_PAYLOAD_SIZE * sizeof(uint32_t);
|
||||
struct param_hdr_v3 param_hdr;
|
||||
|
||||
/* Return error on get param in soft or hard bypass */
|
||||
if (ds2_dap_params_states.dap_bypass == true) {
|
||||
|
|
@ -1573,17 +1598,15 @@ static int msm_ds2_dap_get_param(u32 cmd, void *arg)
|
|||
|
||||
params_value = kzalloc(params_length + param_payload_len,
|
||||
GFP_KERNEL);
|
||||
if (!params_value) {
|
||||
rc = -ENOMEM;
|
||||
goto end;
|
||||
}
|
||||
if (!params_value)
|
||||
return -ENOMEM;
|
||||
|
||||
memset(¶m_hdr, 0, sizeof(param_hdr));
|
||||
if (dolby_data->param_id == DOLBY_PARAM_ID_VER) {
|
||||
rc = adm_get_params(port_id, copp_idx,
|
||||
DOLBY_BUNDLE_MODULE_ID,
|
||||
DOLBY_PARAM_ID_VER,
|
||||
params_length + param_payload_len,
|
||||
(char *)params_value);
|
||||
param_hdr.module_id = DOLBY_BUNDLE_MODULE_ID;
|
||||
param_hdr.instance_id = INSTANCE_ID_0;
|
||||
param_hdr.param_id = DOLBY_PARAM_ID_VER;
|
||||
param_hdr.param_size = params_length + param_payload_len;
|
||||
} else {
|
||||
for (i = 0; i < MAX_DS2_PARAMS; i++)
|
||||
if (ds2_dap_params_id[i] ==
|
||||
|
|
@ -1596,25 +1619,25 @@ static int msm_ds2_dap_get_param(u32 cmd, void *arg)
|
|||
goto end;
|
||||
} else {
|
||||
params_length =
|
||||
ds2_dap_params_length[i] * sizeof(uint32_t);
|
||||
ds2_dap_params_length[i] * sizeof(uint32_t);
|
||||
|
||||
rc = adm_get_params(port_id, copp_idx,
|
||||
DOLBY_BUNDLE_MODULE_ID,
|
||||
ds2_dap_params_id[i],
|
||||
params_length +
|
||||
param_payload_len,
|
||||
(char *)params_value);
|
||||
param_hdr.module_id = DOLBY_BUNDLE_MODULE_ID;
|
||||
param_hdr.instance_id = INSTANCE_ID_0;
|
||||
param_hdr.param_id = ds2_dap_params_id[i];
|
||||
param_hdr.param_size =
|
||||
params_length + param_payload_len;
|
||||
}
|
||||
}
|
||||
rc = adm_get_pp_params(port_id, copp_idx, ADM_CLIENT_ID_DEFAULT, NULL,
|
||||
¶m_hdr, (u8 *) params_value);
|
||||
if (rc) {
|
||||
pr_err("%s: get parameters failed rc %d\n", __func__, rc);
|
||||
rc = -EINVAL;
|
||||
goto end;
|
||||
}
|
||||
update_params_value = params_value;
|
||||
if (copy_to_user((void *)dolby_data->data,
|
||||
&update_params_value[DOLBY_PARAM_PAYLOAD_SIZE],
|
||||
(dolby_data->length * sizeof(uint32_t)))) {
|
||||
if (copy_to_user((void __user *) dolby_data->data,
|
||||
¶ms_value[DOLBY_PARAM_PAYLOAD_SIZE],
|
||||
(dolby_data->length * sizeof(uint32_t)))) {
|
||||
pr_err("%s: error getting param\n", __func__);
|
||||
rc = -EFAULT;
|
||||
goto end;
|
||||
|
|
@ -1633,6 +1656,7 @@ static int msm_ds2_dap_param_visualizer_control_get(u32 cmd, void *arg)
|
|||
uint32_t offset, length, params_length;
|
||||
uint32_t param_payload_len =
|
||||
DOLBY_PARAM_PAYLOAD_SIZE * sizeof(uint32_t);
|
||||
struct param_hdr_v3 param_hdr;
|
||||
|
||||
for (i = 0; i < DS2_DEVICES_ALL; i++) {
|
||||
if ((dev_map[i].active)) {
|
||||
|
|
@ -1651,6 +1675,7 @@ static int msm_ds2_dap_param_visualizer_control_get(u32 cmd, void *arg)
|
|||
goto end;
|
||||
}
|
||||
|
||||
memset(¶m_hdr, 0, sizeof(param_hdr));
|
||||
length = ds2_dap_params[cache_dev].params_val[DOLBY_PARAM_VCNB_OFFSET];
|
||||
|
||||
if (length > DOLBY_PARAM_VCNB_MAX_LENGTH || length <= 0) {
|
||||
|
|
@ -1665,6 +1690,7 @@ static int msm_ds2_dap_param_visualizer_control_get(u32 cmd, void *arg)
|
|||
|
||||
visualizer_data = kzalloc(params_length, GFP_KERNEL);
|
||||
if (!visualizer_data) {
|
||||
pr_err("%s: params memory alloc failed\n", __func__);
|
||||
ret = -ENOMEM;
|
||||
dolby_data->length = 0;
|
||||
goto end;
|
||||
|
|
@ -1682,11 +1708,13 @@ static int msm_ds2_dap_param_visualizer_control_get(u32 cmd, void *arg)
|
|||
|
||||
offset = 0;
|
||||
params_length = length * sizeof(uint32_t);
|
||||
ret = adm_get_params(port_id, copp_idx,
|
||||
DOLBY_BUNDLE_MODULE_ID,
|
||||
DOLBY_PARAM_ID_VCBG,
|
||||
params_length + param_payload_len,
|
||||
(((char *)(visualizer_data)) + offset));
|
||||
param_hdr.module_id = DOLBY_BUNDLE_MODULE_ID;
|
||||
param_hdr.instance_id = INSTANCE_ID_0;
|
||||
param_hdr.param_id = DOLBY_PARAM_ID_VCBG;
|
||||
param_hdr.param_size = length * sizeof(uint32_t) + param_payload_len;
|
||||
ret = adm_get_pp_params(port_id, copp_idx, ADM_CLIENT_ID_DEFAULT, NULL,
|
||||
¶m_hdr,
|
||||
(((char *) (visualizer_data)) + offset));
|
||||
if (ret) {
|
||||
pr_err("%s: get parameters failed ret %d\n", __func__, ret);
|
||||
ret = -EINVAL;
|
||||
|
|
@ -1694,11 +1722,13 @@ static int msm_ds2_dap_param_visualizer_control_get(u32 cmd, void *arg)
|
|||
goto end;
|
||||
}
|
||||
offset = length * sizeof(uint32_t);
|
||||
ret = adm_get_params(port_id, copp_idx,
|
||||
DOLBY_BUNDLE_MODULE_ID,
|
||||
DOLBY_PARAM_ID_VCBE,
|
||||
params_length + param_payload_len,
|
||||
(((char *)(visualizer_data)) + offset));
|
||||
param_hdr.module_id = DOLBY_BUNDLE_MODULE_ID;
|
||||
param_hdr.instance_id = INSTANCE_ID_0;
|
||||
param_hdr.param_id = DOLBY_PARAM_ID_VCBE;
|
||||
param_hdr.param_size = length * sizeof(uint32_t) + param_payload_len;
|
||||
ret = adm_get_pp_params(port_id, copp_idx, ADM_CLIENT_ID_DEFAULT, NULL,
|
||||
¶m_hdr,
|
||||
(((char *) (visualizer_data)) + offset));
|
||||
if (ret) {
|
||||
pr_err("%s: get parameters failed ret %d\n", __func__, ret);
|
||||
ret = -EINVAL;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2013-2014, 2017 The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2013-2014, 2017-2018 The Linux Foundation. All rights reserved.
|
||||
* 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
|
||||
* only version 2 as published by the Free Software Foundation.
|
||||
|
|
@ -33,7 +33,6 @@ struct dolby_param_license32 {
|
|||
compat_uptr_t license_key;
|
||||
};
|
||||
|
||||
|
||||
#define SNDRV_DEVDEP_DAP_IOCTL_SET_PARAM32\
|
||||
_IOWR('U', 0x10, struct dolby_param_data32)
|
||||
#define SNDRV_DEVDEP_DAP_IOCTL_GET_PARAM32\
|
||||
|
|
@ -63,6 +62,34 @@ enum {
|
|||
DAP_CMD_SET_BYPASS_TYPE = 5,
|
||||
};
|
||||
|
||||
struct custom_stereo_param {
|
||||
/* Index is 32-bit param in little endian */
|
||||
u16 index;
|
||||
u16 reserved;
|
||||
|
||||
/* For stereo mixing, the number of out channels */
|
||||
u16 num_out_ch;
|
||||
/* For stereo mixing, the number of in channels */
|
||||
u16 num_in_ch;
|
||||
|
||||
/* Out channel map FL/FR*/
|
||||
u16 out_fl;
|
||||
u16 out_fr;
|
||||
|
||||
/* In channel map FL/FR*/
|
||||
u16 in_fl;
|
||||
u16 in_fr;
|
||||
|
||||
/*
|
||||
* Weighting coefficients. Mixing will be done according to
|
||||
* these coefficients.
|
||||
*/
|
||||
u16 op_FL_ip_FL_weight;
|
||||
u16 op_FL_ip_FR_weight;
|
||||
u16 op_FR_ip_FL_weight;
|
||||
u16 op_FR_ip_FR_weight;
|
||||
};
|
||||
|
||||
#define DOLBY_PARAM_INT_ENDP_LENGTH 1
|
||||
#define DOLBY_PARAM_INT_ENDP_OFFSET (DOLBY_PARAM_PSTG_OFFSET + \
|
||||
DOLBY_PARAM_PSTG_LENGTH)
|
||||
|
|
|
|||
51
dsp/q6adm.c
51
dsp/q6adm.c
|
|
@ -789,26 +789,6 @@ set_stereo_to_custom_stereo_return:
|
|||
}
|
||||
EXPORT_SYMBOL(adm_set_stereo_to_custom_stereo);
|
||||
|
||||
/**
|
||||
* adm_dolby_dap_send_params -
|
||||
* command to send dolby dap params
|
||||
*
|
||||
* @port_id: Port ID number
|
||||
* @copp_idx: copp index of ADM copp
|
||||
* @params: params pointer
|
||||
* @param_length: length of params
|
||||
*
|
||||
* Returns 0 on success or error on failure
|
||||
*/
|
||||
int adm_dolby_dap_send_params(int port_id, int copp_idx, char *params,
|
||||
uint32_t params_length)
|
||||
{
|
||||
/* Use as wrapper for adm_set_pp_params until no longer used */
|
||||
return adm_set_pp_params(port_id, copp_idx, NULL, params,
|
||||
params_length);
|
||||
}
|
||||
EXPORT_SYMBOL(adm_dolby_dap_send_params);
|
||||
|
||||
/*
|
||||
* With pre-packed data, only the opcode differes from V5 and V6.
|
||||
* Use q6common_pack_pp_params to pack the data correctly.
|
||||
|
|
@ -941,29 +921,6 @@ done:
|
|||
}
|
||||
EXPORT_SYMBOL(adm_pack_and_set_one_pp_param);
|
||||
|
||||
int adm_get_params_v2(int port_id, int copp_idx, uint32_t module_id,
|
||||
uint32_t param_id, uint32_t params_length, char *params,
|
||||
uint32_t client_id)
|
||||
{
|
||||
struct param_hdr_v3 param_hdr;
|
||||
|
||||
memset(¶m_hdr, 0, sizeof(param_hdr));
|
||||
param_hdr.module_id = module_id;
|
||||
param_hdr.instance_id = INSTANCE_ID_0;
|
||||
param_hdr.param_id = param_id;
|
||||
param_hdr.param_size = params_length;
|
||||
|
||||
return adm_get_pp_params(port_id, copp_idx, client_id, NULL, ¶m_hdr,
|
||||
params);
|
||||
}
|
||||
|
||||
int adm_get_params(int port_id, int copp_idx, uint32_t module_id,
|
||||
uint32_t param_id, uint32_t params_length, char *params)
|
||||
{
|
||||
return adm_get_params_v2(port_id, copp_idx, module_id, param_id,
|
||||
params_length, params, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Only one parameter can be requested at a time. Therefore, packing and sending
|
||||
* the request can be handled locally.
|
||||
|
|
@ -1082,14 +1039,6 @@ done:
|
|||
}
|
||||
EXPORT_SYMBOL(adm_get_pp_params);
|
||||
|
||||
int adm_get_pp_topo_module_list(int port_id, int copp_idx, int32_t param_length,
|
||||
char *params)
|
||||
{
|
||||
return adm_get_pp_topo_module_list_v2(port_id, copp_idx, param_length,
|
||||
(int32_t *) params);
|
||||
}
|
||||
EXPORT_SYMBOL(adm_get_pp_topo_module_list);
|
||||
|
||||
int adm_get_pp_topo_module_list_v2(int port_id, int copp_idx,
|
||||
int32_t param_length,
|
||||
int32_t *returned_params)
|
||||
|
|
|
|||
807
dsp/q6asm.c
807
dsp/q6asm.c
File diff suppressed because it is too large
Load diff
|
|
@ -730,15 +730,6 @@ struct adm_cmd_set_pp_params_v5 {
|
|||
*/
|
||||
} __packed;
|
||||
|
||||
struct audproc_mfc_output_media_fmt {
|
||||
struct adm_cmd_set_pp_params_v5 params;
|
||||
struct param_hdr_v1 data;
|
||||
uint32_t sampling_rate;
|
||||
uint16_t bits_per_sample;
|
||||
uint16_t num_channels;
|
||||
uint16_t channel_type[8];
|
||||
} __packed;
|
||||
|
||||
struct audproc_mfc_param_media_fmt {
|
||||
uint32_t sampling_rate;
|
||||
uint16_t bits_per_sample;
|
||||
|
|
@ -6610,55 +6601,27 @@ struct asm_stream_cmd_open_transcode_loopback_t {
|
|||
#define ASM_STREAM_CMD_SET_PP_PARAMS_V2 0x00010DA1
|
||||
#define ASM_STREAM_CMD_SET_PP_PARAMS_V3 0x0001320D
|
||||
|
||||
struct asm_stream_cmd_set_pp_params_v2 {
|
||||
u32 data_payload_addr_lsw;
|
||||
/* LSW of parameter data payload address. Supported values: any. */
|
||||
u32 data_payload_addr_msw;
|
||||
/* MSW of Parameter data payload address. Supported values: any.
|
||||
* - Must be set to zero for in-band data.
|
||||
* - In the case of 32 bit Shared memory address, msw field must be
|
||||
* - set to zero.
|
||||
* - In the case of 36 bit shared memory address, bit 31 to bit 4 of
|
||||
* msw
|
||||
*
|
||||
* - must be set to zero.
|
||||
*/
|
||||
u32 mem_map_handle;
|
||||
/* Supported Values: Any.
|
||||
* memory map handle returned by DSP through
|
||||
* ASM_CMD_SHARED_MEM_MAP_REGIONS
|
||||
* command.
|
||||
* if mmhandle is NULL, the ParamData payloads are within the
|
||||
* message payload (in-band).
|
||||
* If mmhandle is non-NULL, the ParamData payloads begin at the
|
||||
* address specified in the address msw and lsw (out-of-band).
|
||||
/*
|
||||
* Structure for the ASM Stream Set PP Params command. Parameter data must be
|
||||
* pre-packed with the correct header for either V2 or V3 when sent in-band.
|
||||
* Use q6core_pack_pp_params to pack the header and data correctly depending on
|
||||
* Instance ID support.
|
||||
*/
|
||||
struct asm_stream_cmd_set_pp_params {
|
||||
/* APR Header */
|
||||
struct apr_hdr apr_hdr;
|
||||
|
||||
u32 data_payload_size;
|
||||
/* Size in bytes of the variable payload accompanying the
|
||||
* message, or in shared memory. This field is used for parsing the
|
||||
* parameter payload.
|
||||
*/
|
||||
} __packed;
|
||||
/* The memory mapping header to be used when sending out of band */
|
||||
struct mem_mapping_hdr mem_hdr;
|
||||
|
||||
/* The total size of the payload, including the parameter header */
|
||||
u32 payload_size;
|
||||
|
||||
struct asm_stream_param_data_v2 {
|
||||
u32 module_id;
|
||||
/* Unique module ID. */
|
||||
|
||||
u32 param_id;
|
||||
/* Unique parameter ID. */
|
||||
|
||||
u16 param_size;
|
||||
/* Data size of the param_id/module_id combination. This is
|
||||
* a multiple of 4 bytes.
|
||||
*/
|
||||
|
||||
u16 reserved;
|
||||
/* Reserved for future enhancements. This field must be set to
|
||||
* zero.
|
||||
*/
|
||||
|
||||
/* The parameter data to be filled when sent inband. Parameter data
|
||||
* must be pre-packed with parameter header and then copied here. Use
|
||||
* q6core_pack_pp_params to pack the header and param data correctly.
|
||||
*/
|
||||
u32 param_data[0];
|
||||
} __packed;
|
||||
|
||||
#define ASM_STREAM_CMD_GET_PP_PARAMS_V2 0x00010DA2
|
||||
|
|
@ -8082,9 +8045,6 @@ struct audproc_topology_module_id_info_t {
|
|||
|
||||
|
||||
struct asm_volume_ctrl_master_gain {
|
||||
struct apr_hdr hdr;
|
||||
struct asm_stream_cmd_set_pp_params_v2 param;
|
||||
struct asm_stream_param_data_v2 data;
|
||||
uint16_t master_gain;
|
||||
/* Linear gain in Q13 format. */
|
||||
|
||||
|
|
@ -8094,10 +8054,6 @@ struct asm_volume_ctrl_master_gain {
|
|||
|
||||
|
||||
struct asm_volume_ctrl_lr_chan_gain {
|
||||
struct apr_hdr hdr;
|
||||
struct asm_stream_cmd_set_pp_params_v2 param;
|
||||
struct asm_stream_param_data_v2 data;
|
||||
|
||||
uint16_t l_chan_gain;
|
||||
/*< Linear gain in Q13 format for the left channel. */
|
||||
|
||||
|
|
@ -8117,9 +8073,6 @@ struct asm_volume_ctrl_lr_chan_gain {
|
|||
|
||||
|
||||
struct asm_volume_ctrl_mute_config {
|
||||
struct apr_hdr hdr;
|
||||
struct asm_stream_cmd_set_pp_params_v2 param;
|
||||
struct asm_stream_param_data_v2 data;
|
||||
uint32_t mute_flag;
|
||||
/*< Specifies whether mute is disabled (0) or enabled (nonzero).*/
|
||||
|
||||
|
|
@ -8147,9 +8100,6 @@ struct asm_volume_ctrl_mute_config {
|
|||
* parameters used by the Volume Control module.
|
||||
*/
|
||||
struct asm_soft_step_volume_params {
|
||||
struct apr_hdr hdr;
|
||||
struct asm_stream_cmd_set_pp_params_v2 param;
|
||||
struct asm_stream_param_data_v2 data;
|
||||
uint32_t period;
|
||||
/*< Period in milliseconds.
|
||||
* Supported values: 0 to 15000
|
||||
|
|
@ -8179,9 +8129,6 @@ struct asm_soft_step_volume_params {
|
|||
|
||||
|
||||
struct asm_soft_pause_params {
|
||||
struct apr_hdr hdr;
|
||||
struct asm_stream_cmd_set_pp_params_v2 param;
|
||||
struct asm_stream_param_data_v2 data;
|
||||
uint32_t enable_flag;
|
||||
/*< Specifies whether soft pause is disabled (0) or enabled
|
||||
* (nonzero).
|
||||
|
|
@ -8271,10 +8218,7 @@ struct asm_volume_ctrl_channeltype_gain_pair {
|
|||
|
||||
|
||||
struct asm_volume_ctrl_multichannel_gain {
|
||||
struct apr_hdr hdr;
|
||||
struct asm_stream_cmd_set_pp_params_v2 param;
|
||||
struct asm_stream_param_data_v2 data;
|
||||
uint32_t num_channels;
|
||||
uint32_t num_channels;
|
||||
/*
|
||||
* Number of channels for which gain values are provided. Any
|
||||
* channels present in the data for which gain is not provided are
|
||||
|
|
@ -8299,9 +8243,6 @@ struct asm_volume_ctrl_multichannel_gain {
|
|||
|
||||
|
||||
struct asm_volume_ctrl_channelype_mute_pair {
|
||||
struct apr_hdr hdr;
|
||||
struct asm_stream_cmd_set_pp_params_v2 param;
|
||||
struct asm_stream_param_data_v2 data;
|
||||
uint8_t channelype;
|
||||
/*< Channel type for which the mute setting is to be applied.
|
||||
* Supported values:
|
||||
|
|
@ -8350,9 +8291,6 @@ struct asm_volume_ctrl_channelype_mute_pair {
|
|||
|
||||
|
||||
struct asm_volume_ctrl_multichannel_mute {
|
||||
struct apr_hdr hdr;
|
||||
struct asm_stream_cmd_set_pp_params_v2 param;
|
||||
struct asm_stream_param_data_v2 data;
|
||||
uint32_t num_channels;
|
||||
/*< Number of channels for which mute configuration is
|
||||
* provided. Any channels present in the data for which mute
|
||||
|
|
@ -8797,9 +8735,6 @@ struct asm_eq_per_band_params {
|
|||
} __packed;
|
||||
|
||||
struct asm_eq_params {
|
||||
struct apr_hdr hdr;
|
||||
struct asm_stream_cmd_set_pp_params_v2 param;
|
||||
struct asm_stream_param_data_v2 data;
|
||||
uint32_t enable_flag;
|
||||
/*< Specifies whether the equalizer module is disabled (0) or enabled
|
||||
* (nonzero).
|
||||
|
|
@ -9463,16 +9398,6 @@ struct srs_trumedia_params {
|
|||
#define ASM_STREAM_POSTPROC_TOPO_ID_DTS_HPX 0x00010DED
|
||||
#define ASM_STREAM_POSTPROC_TOPO_ID_HPX_PLUS 0x10015000
|
||||
#define ASM_STREAM_POSTPROC_TOPO_ID_HPX_MASTER 0x10015001
|
||||
struct asm_dts_eagle_param {
|
||||
struct apr_hdr hdr;
|
||||
struct asm_stream_cmd_set_pp_params_v2 param;
|
||||
struct asm_stream_param_data_v2 data;
|
||||
} __packed;
|
||||
|
||||
struct asm_dts_eagle_param_get {
|
||||
struct apr_hdr hdr;
|
||||
struct asm_stream_cmd_get_pp_params_v2 param;
|
||||
} __packed;
|
||||
|
||||
/* Opcode to set BT address and license for aptx decoder */
|
||||
#define APTX_DECODER_BT_ADDRESS 0x00013201
|
||||
|
|
@ -10759,7 +10684,7 @@ union asm_session_mtmx_strtr_param_config {
|
|||
struct asm_mtmx_strtr_params {
|
||||
struct apr_hdr hdr;
|
||||
struct asm_session_cmd_set_mtmx_strstr_params_v2 param;
|
||||
struct asm_stream_param_data_v2 data;
|
||||
struct param_hdr_v1 data;
|
||||
union asm_session_mtmx_strtr_param_config config;
|
||||
} __packed;
|
||||
|
||||
|
|
@ -10869,7 +10794,7 @@ struct asm_mtmx_strtr_get_params {
|
|||
|
||||
struct asm_mtmx_strtr_get_params_cmdrsp {
|
||||
uint32_t err_code;
|
||||
struct asm_stream_param_data_v2 param_info;
|
||||
struct param_hdr_v1 param_info;
|
||||
union asm_session_mtmx_strtr_data_type param_data;
|
||||
} __packed;
|
||||
|
||||
|
|
|
|||
|
|
@ -93,9 +93,6 @@ int adm_dts_eagle_get(int port_id, int copp_idx, int param_id,
|
|||
|
||||
void adm_copp_mfc_cfg(int port_id, int copp_idx, int dst_sample_rate);
|
||||
|
||||
int adm_get_params(int port_id, int copp_idx, uint32_t module_id,
|
||||
uint32_t param_id, uint32_t params_length, char *params);
|
||||
|
||||
int adm_get_pp_params(int port_id, int copp_idx, uint32_t client_id,
|
||||
struct mem_mapping_hdr *mem_hdr,
|
||||
struct param_hdr_v3 *param_hdr, u8 *returned_param_data);
|
||||
|
|
@ -103,9 +100,6 @@ int adm_get_pp_params(int port_id, int copp_idx, uint32_t client_id,
|
|||
int adm_send_params_v5(int port_id, int copp_idx, char *params,
|
||||
uint32_t params_length);
|
||||
|
||||
int adm_dolby_dap_send_params(int port_id, int copp_idx, char *params,
|
||||
uint32_t params_length);
|
||||
|
||||
int adm_set_pp_params(int port_id, int copp_idx,
|
||||
struct mem_mapping_hdr *mem_hdr, u8 *param_data,
|
||||
u32 params_size);
|
||||
|
|
|
|||
|
|
@ -264,6 +264,17 @@ int q6asm_audio_client_buf_alloc_contiguous(unsigned int dir
|
|||
int q6asm_audio_client_buf_free_contiguous(unsigned int dir,
|
||||
struct audio_client *ac);
|
||||
|
||||
int q6asm_set_pp_params(struct audio_client *ac,
|
||||
struct mem_mapping_hdr *mem_hdr, u8 *param_data,
|
||||
u32 param_size);
|
||||
|
||||
int q6asm_pack_and_set_pp_param_in_band(struct audio_client *ac,
|
||||
struct param_hdr_v3 param_hdr,
|
||||
u8 *param_data);
|
||||
|
||||
int q6asm_set_soft_volume_module_instance_ids(int instance,
|
||||
struct param_hdr_v3 *param_hdr);
|
||||
|
||||
int q6asm_open_read(struct audio_client *ac, uint32_t format
|
||||
/*, uint16_t bits_per_sample*/);
|
||||
|
||||
|
|
@ -624,9 +635,6 @@ int q6asm_get_session_time(struct audio_client *ac, uint64_t *tstamp);
|
|||
|
||||
int q6asm_get_session_time_legacy(struct audio_client *ac, uint64_t *tstamp);
|
||||
|
||||
int q6asm_send_audio_effects_params(struct audio_client *ac, char *params,
|
||||
uint32_t params_length);
|
||||
|
||||
int q6asm_send_stream_cmd(struct audio_client *ac,
|
||||
struct msm_adsp_event_data *data);
|
||||
|
||||
|
|
|
|||
|
|
@ -145,8 +145,12 @@
|
|||
#define PBE_ENABLE_PARAM_LEN 1
|
||||
#define PBE_CONFIG_PARAM_LEN 28
|
||||
|
||||
/* Command Payload length and size for Non-IID commands */
|
||||
#define COMMAND_PAYLOAD_LEN 3
|
||||
#define COMMAND_PAYLOAD_SZ (COMMAND_PAYLOAD_LEN * sizeof(uint32_t))
|
||||
/* Command Payload length and size for IID commands */
|
||||
#define COMMAND_IID_PAYLOAD_LEN 4
|
||||
#define COMMAND_IID_PAYLOAD_SZ (COMMAND_IID_PAYLOAD_LEN * sizeof(uint32_t))
|
||||
#define MAX_INBAND_PARAM_SZ 4096
|
||||
#define Q27_UNITY (1 << 27)
|
||||
#define Q8_UNITY (1 << 8)
|
||||
|
|
|
|||
Loading…
Reference in a new issue