diff options
Diffstat (limited to 'dsp')
-rw-r--r-- | dsp/audio_slimslave.c | 4 | ||||
-rw-r--r-- | dsp/q6adm.c | 118 | ||||
-rw-r--r-- | dsp/q6afe.c | 6 |
3 files changed, 71 insertions, 57 deletions
diff --git a/dsp/audio_slimslave.c b/dsp/audio_slimslave.c index 25866d12..55982f33 100644 --- a/dsp/audio_slimslave.c +++ b/dsp/audio_slimslave.c @@ -1,4 +1,4 @@ -/* 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 @@ -167,7 +167,7 @@ int __init audio_slimslave_init(void) void audio_slimslave_exit(void) { - + slim_driver_unregister(&audio_slimslave_driver); } /* Module information */ diff --git a/dsp/q6adm.c b/dsp/q6adm.c index dc900edb..f8aef943 100644 --- a/dsp/q6adm.c +++ b/dsp/q6adm.c @@ -1440,10 +1440,68 @@ int adm_get_multi_ch_map(char *channel_map, int path) } EXPORT_SYMBOL(adm_get_multi_ch_map); +static void adm_reset_data(void) +{ + int i, j; + + apr_reset(this_adm.apr); + for (i = 0; i < AFE_MAX_PORTS; i++) { + for (j = 0; j < MAX_COPPS_PER_PORT; j++) { + atomic_set(&this_adm.copp.id[i][j], + RESET_COPP_ID); + atomic_set(&this_adm.copp.cnt[i][j], 0); + atomic_set( + &this_adm.copp.topology[i][j], 0); + atomic_set(&this_adm.copp.mode[i][j], + 0); + atomic_set(&this_adm.copp.stat[i][j], + 0); + atomic_set(&this_adm.copp.rate[i][j], + 0); + atomic_set( + &this_adm.copp.channels[i][j], + 0); + atomic_set( + &this_adm.copp.bit_width[i][j], 0); + atomic_set( + &this_adm.copp.app_type[i][j], 0); + atomic_set( + &this_adm.copp.acdb_id[i][j], 0); + this_adm.copp.adm_status[i][j] = + ADM_STATUS_CALIBRATION_REQUIRED; + } + } + this_adm.apr = NULL; + cal_utils_clear_cal_block_q6maps(ADM_MAX_CAL_TYPES, + this_adm.cal_data); + mutex_lock(&this_adm.cal_data + [ADM_CUSTOM_TOP_CAL]->lock); + this_adm.set_custom_topology = 1; + mutex_unlock(&this_adm.cal_data[ + ADM_CUSTOM_TOP_CAL]->lock); + rtac_clear_mapping(ADM_RTAC_CAL); + /* + * Free the ION memory and clear the map handles + * for Source Tracking + */ + if (this_adm.sourceTrackingData.memmap.paddr != 0) { + msm_audio_ion_free( + this_adm.sourceTrackingData.dma_buf); + this_adm.sourceTrackingData.dma_buf = NULL; + this_adm.sourceTrackingData.memmap.size = 0; + this_adm.sourceTrackingData.memmap.kvaddr = + NULL; + this_adm.sourceTrackingData.memmap.paddr = 0; + this_adm.sourceTrackingData.apr_cmd_status = -1; + atomic_set(&this_adm.mem_map_handles[ + ADM_MEM_MAP_INDEX_SOURCE_TRACKING], 0); + } +} + static int32_t adm_callback(struct apr_client_data *data, void *priv) { uint32_t *payload; - int i, j, port_idx, copp_idx, idx, client_id; + int i, port_idx, copp_idx, idx, client_id; if (data == NULL) { pr_err("%s: data parameter is null\n", __func__); @@ -1456,60 +1514,8 @@ static int32_t adm_callback(struct apr_client_data *data, void *priv) pr_debug("%s: Reset event is received: %d %d apr[%pK]\n", __func__, data->reset_event, data->reset_proc, this_adm.apr); - if (this_adm.apr) { - apr_reset(this_adm.apr); - for (i = 0; i < AFE_MAX_PORTS; i++) { - for (j = 0; j < MAX_COPPS_PER_PORT; j++) { - atomic_set(&this_adm.copp.id[i][j], - RESET_COPP_ID); - atomic_set(&this_adm.copp.cnt[i][j], 0); - atomic_set( - &this_adm.copp.topology[i][j], 0); - atomic_set(&this_adm.copp.mode[i][j], - 0); - atomic_set(&this_adm.copp.stat[i][j], - 0); - atomic_set(&this_adm.copp.rate[i][j], - 0); - atomic_set( - &this_adm.copp.channels[i][j], - 0); - atomic_set( - &this_adm.copp.bit_width[i][j], 0); - atomic_set( - &this_adm.copp.app_type[i][j], 0); - atomic_set( - &this_adm.copp.acdb_id[i][j], 0); - this_adm.copp.adm_status[i][j] = - ADM_STATUS_CALIBRATION_REQUIRED; - } - } - this_adm.apr = NULL; - cal_utils_clear_cal_block_q6maps(ADM_MAX_CAL_TYPES, - this_adm.cal_data); - mutex_lock(&this_adm.cal_data - [ADM_CUSTOM_TOP_CAL]->lock); - this_adm.set_custom_topology = 1; - mutex_unlock(&this_adm.cal_data[ - ADM_CUSTOM_TOP_CAL]->lock); - rtac_clear_mapping(ADM_RTAC_CAL); - /* - * Free the ION memory and clear the map handles - * for Source Tracking - */ - if (this_adm.sourceTrackingData.memmap.paddr != 0) { - msm_audio_ion_free( - this_adm.sourceTrackingData.dma_buf); - this_adm.sourceTrackingData.dma_buf = NULL; - this_adm.sourceTrackingData.memmap.size = 0; - this_adm.sourceTrackingData.memmap.kvaddr = - NULL; - this_adm.sourceTrackingData.memmap.paddr = 0; - this_adm.sourceTrackingData.apr_cmd_status = -1; - atomic_set(&this_adm.mem_map_handles[ - ADM_MEM_MAP_INDEX_SOURCE_TRACKING], 0); - } - } + if (this_adm.apr) + adm_reset_data(); return 0; } @@ -5256,6 +5262,8 @@ int __init adm_init(void) void adm_exit(void) { + if (this_adm.apr) + adm_reset_data(); mutex_destroy(&dts_srs_lock); adm_delete_cal_data(); } diff --git a/dsp/q6afe.c b/dsp/q6afe.c index f926efbd..60e8e27b 100644 --- a/dsp/q6afe.c +++ b/dsp/q6afe.c @@ -7636,6 +7636,12 @@ int __init afe_init(void) void afe_exit(void) { + if (this_afe.apr) { + apr_reset(this_afe.apr); + atomic_set(&this_afe.state, 0); + this_afe.apr = NULL; + rtac_set_afe_handle(this_afe.apr); + } afe_delete_cal_data(); config_debug_fs_exit(); |