dsp: q6adm: add ADM_LSM_AUDPROC_PERSISTENT cal type

ADM supports certain modules that can have very large calibration sizes,
in such cases the calibration is expected to be persistent in memory.
Add new cal type for this purpose.

Change-Id: Ieb2e941036595b7dff4b8bfb341f2ec152cf648a
Signed-off-by: Bhalchandra Gajare <gajare@codeaurora.org>
This commit is contained in:
Bhalchandra Gajare 2018-05-10 14:16:49 -07:00
parent 54b7fb7bce
commit bbb641427b
3 changed files with 34 additions and 5 deletions

View file

@ -63,6 +63,7 @@ size_t get_cal_info_size(int32_t cal_type)
break;
case ADM_AUDPROC_CAL_TYPE:
case ADM_LSM_AUDPROC_CAL_TYPE:
case ADM_LSM_AUDPROC_PERSISTENT_CAL_TYPE:
size = sizeof(struct audio_cal_info_audproc);
break;
case ADM_AUDVOL_CAL_TYPE:
@ -213,6 +214,7 @@ size_t get_user_cal_type_size(int32_t cal_type)
break;
case ADM_AUDPROC_CAL_TYPE:
case ADM_LSM_AUDPROC_CAL_TYPE:
case ADM_LSM_AUDPROC_PERSISTENT_CAL_TYPE:
size = sizeof(struct audio_cal_type_audproc);
break;
case ADM_AUDVOL_CAL_TYPE:

View file

@ -2000,7 +2000,8 @@ static struct cal_block_data *adm_find_cal_by_path(int cal_index, int path)
continue;
if (cal_index == ADM_AUDPROC_CAL ||
cal_index == ADM_LSM_AUDPROC_CAL) {
cal_index == ADM_LSM_AUDPROC_CAL ||
cal_index == ADM_LSM_AUDPROC_PERSISTENT_CAL) {
audproc_cal_info = cal_block->cal_info;
if ((audproc_cal_info->path == path) &&
(cal_block->cal_data.size > 0))
@ -2037,7 +2038,8 @@ static struct cal_block_data *adm_find_cal_by_app_type(int cal_index, int path,
continue;
if (cal_index == ADM_AUDPROC_CAL ||
cal_index == ADM_LSM_AUDPROC_CAL) {
cal_index == ADM_LSM_AUDPROC_CAL ||
cal_index == ADM_LSM_AUDPROC_PERSISTENT_CAL) {
audproc_cal_info = cal_block->cal_info;
if ((audproc_cal_info->path == path) &&
(audproc_cal_info->app_type == app_type) &&
@ -2077,7 +2079,8 @@ static struct cal_block_data *adm_find_cal(int cal_index, int path,
continue;
if (cal_index == ADM_AUDPROC_CAL ||
cal_index == ADM_LSM_AUDPROC_CAL) {
cal_index == ADM_LSM_AUDPROC_CAL ||
cal_index == ADM_LSM_AUDPROC_PERSISTENT_CAL) {
audproc_cal_info = cal_block->cal_info;
if ((audproc_cal_info->path == path) &&
(audproc_cal_info->app_type == app_type) &&
@ -2165,12 +2168,18 @@ static void send_adm_cal(int port_id, int copp_idx, int path, int perf_mode,
{
pr_debug("%s: port id 0x%x copp_idx %d\n", __func__, port_id, copp_idx);
if (passthr_mode != LISTEN)
if (passthr_mode != LISTEN) {
send_adm_cal_type(ADM_AUDPROC_CAL, path, port_id, copp_idx,
perf_mode, app_type, acdb_id, sample_rate);
else
} else {
send_adm_cal_type(ADM_LSM_AUDPROC_CAL, path, port_id, copp_idx,
perf_mode, app_type, acdb_id, sample_rate);
send_adm_cal_type(ADM_LSM_AUDPROC_PERSISTENT_CAL, path,
port_id, copp_idx, perf_mode, app_type,
acdb_id, sample_rate);
}
send_adm_cal_type(ADM_AUDVOL_CAL, path, port_id, copp_idx, perf_mode,
app_type, acdb_id, sample_rate);
}
@ -3297,6 +3306,9 @@ static int get_cal_type_index(int32_t cal_type)
case ADM_RTAC_AUDVOL_CAL_TYPE:
ret = ADM_RTAC_AUDVOL_CAL;
break;
case ADM_LSM_AUDPROC_PERSISTENT_CAL_TYPE:
ret = ADM_LSM_AUDPROC_PERSISTENT_CAL;
break;
default:
pr_err("%s: invalid cal type %d!\n", __func__, cal_type);
}
@ -3518,6 +3530,12 @@ static int adm_init_cal_data(void)
adm_set_cal, NULL, NULL} },
{adm_map_cal_data, adm_unmap_cal_data,
cal_utils_match_buf_num} },
{{ADM_LSM_AUDPROC_PERSISTENT_CAL_TYPE,
{adm_alloc_cal, adm_dealloc_cal, NULL,
adm_set_cal, NULL, NULL} },
{adm_map_cal_data, adm_unmap_cal_data,
cal_utils_match_buf_num} },
};
pr_debug("%s:\n", __func__);
@ -3987,6 +4005,13 @@ int adm_store_cal_data(int port_id, int copp_idx, int path, int perf_mode,
rc = -ENOMEM;
goto unlock;
}
} else if (cal_index == ADM_LSM_AUDPROC_PERSISTENT_CAL) {
if (cal_block->cal_data.size > AUD_PROC_PERSIST_BLOCK_SIZE) {
pr_err("%s:persist invalid size exp/actual[%zd, %d]\n",
__func__, cal_block->cal_data.size, *size);
rc = -ENOMEM;
goto unlock;
}
} else if (cal_index == ADM_AUDVOL_CAL) {
if (cal_block->cal_data.size > AUD_VOL_BLOCK_SIZE) {
pr_err("%s:aud_vol:invalid size exp/actual[%zd, %d]\n",

View file

@ -29,6 +29,7 @@
((MAX_MODULES_IN_TOPO + 1) * 2 * sizeof(uint32_t))
#define AUD_PROC_BLOCK_SIZE 4096
#define AUD_VOL_BLOCK_SIZE 4096
#define AUD_PROC_PERSIST_BLOCK_SIZE (2 * 1024 * 1020)
#define AUDIO_RX_CALIBRATION_SIZE (AUD_PROC_BLOCK_SIZE + \
AUD_VOL_BLOCK_SIZE)
enum {
@ -40,6 +41,7 @@ enum {
ADM_RTAC_APR_CAL,
ADM_SRS_TRUMEDIA,
ADM_RTAC_AUDVOL_CAL,
ADM_LSM_AUDPROC_PERSISTENT_CAL,
ADM_MAX_CAL_TYPES
};