hal: Add API to support device configuration
Add new API to set device configuration from Client.
Currently the device config is set from edid.
New API overwrites the default device config with
client provided values.
CRs-fixed: 2071954
Change-Id: I1f0918acf0a420f9c9d8a17bc070637199cb7105
diff --git a/hal/audio_extn/audio_defs.h b/hal/audio_extn/audio_defs.h
index 6bedc25..dfe8c61 100644
--- a/hal/audio_extn/audio_defs.h
+++ b/hal/audio_extn/audio_defs.h
@@ -221,6 +221,21 @@
uint8_t channel_map[AUDIO_CHANNEL_COUNT_MAX]; /* Input Channel Map */
};
+struct audio_device_cfg_param {
+ uint32_t sample_rate;
+ uint32_t channels;
+ uint32_t bit_width;
+ audio_format_t format;
+ audio_devices_t device;
+ uint8_t channel_map[AUDIO_CHANNEL_COUNT_MAX];
+ uint16_t channel_allocation;
+};
+
+struct audio_device_config_param {
+ bool use_client_dev_cfg;
+ struct audio_device_cfg_param dev_cfg_params;
+};
+
typedef union {
struct source_tracking_param st_params;
struct sound_focus_param sf_params;
@@ -232,6 +247,7 @@
struct audio_out_correct_drift drift_correction_param;
struct audio_adsp_event adsp_event_params;
struct audio_out_channel_map_param channel_map_param;
+ struct audio_device_cfg_param device_cfg;
} audio_extn_param_payload;
typedef enum {
@@ -247,7 +263,8 @@
AUDIO_EXTN_PARAM_OUT_CORRECT_DRIFT,
AUDIO_EXTN_PARAM_ADSP_STREAM_CMD,
/* param to set input channel map for playback stream */
- AUDIO_EXTN_PARAM_OUT_CHANNEL_MAP
+ AUDIO_EXTN_PARAM_OUT_CHANNEL_MAP,
+ AUDIO_EXTN_PARAM_DEVICE_CONFIG
} audio_extn_param_id;
#endif /* AUDIO_DEFS_H */
diff --git a/hal/audio_extn/audio_extn.c b/hal/audio_extn/audio_extn.c
index 14b67c9..804027b 100644
--- a/hal/audio_extn/audio_extn.c
+++ b/hal/audio_extn/audio_extn.c
@@ -1418,3 +1418,53 @@
return ret;
}
+
+int audio_extn_set_device_cfg_params(struct audio_device *adev,
+ struct audio_device_cfg_param *payload)
+{
+ struct audio_device_cfg_param *device_cfg_params = payload;
+ int ret = -EINVAL;
+ struct stream_out out;
+ uint32_t snd_device = 0, backend_idx = 0;
+ struct audio_device_config_param *adev_device_cfg_ptr = adev->device_cfg_params;
+
+ ALOGV("%s", __func__);
+
+ if (!device_cfg_params || !adev) {
+ ALOGE("%s:: Invalid Param", __func__);
+ return ret;
+ }
+
+ /* Config is not supported for combo devices */
+ if (popcount(device_cfg_params->device) != 1) {
+ ALOGE("%s:: Invalid Device (%#x) - Config is ignored", __func__, device_cfg_params->device);
+ return ret;
+ }
+
+ /* Create an out stream to get snd device from audio device */
+ out.devices = device_cfg_params->device;
+ out.sample_rate = device_cfg_params->sample_rate;
+ snd_device = platform_get_output_snd_device(adev->platform, &out);
+ backend_idx = platform_get_backend_index(snd_device);
+
+ ALOGV("%s:: device %d sample_rate %d snd_device %d backend_idx %d",
+ __func__, out.devices, out.sample_rate, snd_device, backend_idx);
+
+ ALOGV("%s:: Device Config Params from Client samplerate %d channels %d"
+ " bit_width %d format %d device %d channel_map[0] %d channel_map[1] %d"
+ " channel_map[2] %d channel_map[3] %d channel_map[4] %d channel_map[5] %d"
+ " channel_allocation %d\n", __func__, device_cfg_params->sample_rate,
+ device_cfg_params->channels, device_cfg_params->bit_width,
+ device_cfg_params->format, device_cfg_params->device,
+ device_cfg_params->channel_map[0], device_cfg_params->channel_map[1],
+ device_cfg_params->channel_map[2], device_cfg_params->channel_map[3],
+ device_cfg_params->channel_map[4], device_cfg_params->channel_map[5],
+ device_cfg_params->channel_allocation);
+
+ /* Copy the config values into adev structure variable */
+ adev_device_cfg_ptr += backend_idx;
+ adev_device_cfg_ptr->use_client_dev_cfg = true;
+ memcpy(&adev_device_cfg_ptr->dev_cfg_params, device_cfg_params, sizeof(struct audio_device_cfg_param));
+
+ return 0;
+}
diff --git a/hal/audio_extn/audio_extn.h b/hal/audio_extn/audio_extn.h
index 8772302..6325ab6 100644
--- a/hal/audio_extn/audio_extn.h
+++ b/hal/audio_extn/audio_extn.h
@@ -867,7 +867,8 @@
int audio_extn_out_get_param_data(struct stream_out *out,
audio_extn_param_id param_id,
audio_extn_param_payload *payload);
-
+int audio_extn_set_device_cfg_params(struct audio_device *adev,
+ struct audio_device_cfg_param *payload);
int audio_extn_utils_get_avt_device_drift(
struct audio_usecase *usecase,
struct audio_avt_device_drift_param *drift_param);
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index 9e7b1ce..662032f 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -5538,6 +5538,10 @@
audio_extn_adsp_hdlr_deinit();
audio_extn_snd_mon_deinit();
audio_extn_loopback_deinit(adev);
+ if (adev->device_cfg_params) {
+ free(adev->device_cfg_params);
+ adev->device_cfg_params = NULL;
+ }
free(device);
adev = NULL;
}
@@ -5838,6 +5842,12 @@
adev->card_status = CARD_STATUS_ONLINE;
pthread_mutex_unlock(&adev->lock);
audio_extn_sound_trigger_init(adev); /* dependent on snd_mon_init() */
+ /* Allocate memory for Device config params */
+ adev->device_cfg_params = (struct audio_device_config_param*)
+ calloc(platform_get_max_codec_backend(),
+ sizeof(struct audio_device_config_param));
+ if (adev->device_cfg_params == NULL)
+ ALOGE("%s: Memory allocation failed for Device config params", __func__);
ALOGV("%s: exit", __func__);
return 0;
diff --git a/hal/audio_hw.h b/hal/audio_hw.h
index 4c9f83f..91bf954 100644
--- a/hal/audio_hw.h
+++ b/hal/audio_hw.h
@@ -471,6 +471,7 @@
qahwi_device_t qahwi_dev;
bool vr_audio_mode_enabled;
bool bt_sco_on;
+ struct audio_device_config_param *device_cfg_params;
};
int select_devices(struct audio_device *adev,
diff --git a/hal/audio_hw_extn_api.c b/hal/audio_hw_extn_api.c
index 20a27e8..09d83f4 100644
--- a/hal/audio_hw_extn_api.c
+++ b/hal/audio_hw_extn_api.c
@@ -173,6 +173,11 @@
case AUDIO_EXTN_PARAM_APTX_DEC:
audio_extn_set_aptx_dec_params((struct aptx_dec_param *)payload);
break;
+ case AUDIO_EXTN_PARAM_DEVICE_CONFIG:
+ ALOGV("%s:: Calling audio_extn_set_device_cfg_params", __func__);
+ audio_extn_set_device_cfg_params(dev,
+ (struct audio_device_cfg_param *)payload);
+ break;
default:
ALOGE("%s::INVALID PARAM ID:%d\n",__func__,param_id);
ret = -EINVAL;
diff --git a/hal/msm8916/platform.c b/hal/msm8916/platform.c
index b0a4f85..3fb82c6 100644
--- a/hal/msm8916/platform.c
+++ b/hal/msm8916/platform.c
@@ -2429,6 +2429,8 @@
strdup("SLIM_0_RX Format");
my_data->current_backend_cfg[DEFAULT_CODEC_BACKEND].samplerate_mixer_ctl =
strdup("SLIM_0_RX SampleRate");
+ my_data->current_backend_cfg[DEFAULT_CODEC_BACKEND].channels_mixer_ctl =
+ strdup("SLIM_0_RX Channels");
my_data->current_backend_cfg[DSD_NATIVE_BACKEND].bitwidth_mixer_ctl =
strdup("SLIM_2_RX Format");
@@ -5232,7 +5234,7 @@
static int platform_set_codec_backend_cfg(struct audio_device* adev,
snd_device_t snd_device, struct audio_backend_cfg backend_cfg)
{
- int ret = 0;
+ int ret = -EINVAL;
int backend_idx = DEFAULT_CODEC_BACKEND;
struct platform_data *my_data = (struct platform_data *)adev->platform;
unsigned int bit_width = backend_cfg.bit_width;
@@ -5240,11 +5242,28 @@
unsigned int channels = backend_cfg.channels;
audio_format_t format = backend_cfg.format;
bool passthrough_enabled = backend_cfg.passthrough_enabled;
+ struct audio_device_config_param *adev_device_cfg_ptr = adev->device_cfg_params;
backend_idx = platform_get_backend_index(snd_device);
- ALOGI("%s:becf: afe: bitwidth %d, samplerate %d channels %d, backend_idx %d device (%s)",
- __func__, bit_width, sample_rate, channels,backend_idx,
+ /* Override the config params if client has already set them */
+ adev_device_cfg_ptr += backend_idx;
+ if (adev_device_cfg_ptr->use_client_dev_cfg) {
+ ALOGV("%s::: Updating with the config set by client "
+ "bitwidth %d, samplerate %d, channels %d format %d",
+ __func__, adev_device_cfg_ptr->dev_cfg_params.bit_width,
+ adev_device_cfg_ptr->dev_cfg_params.sample_rate,
+ adev_device_cfg_ptr->dev_cfg_params.channels,
+ adev_device_cfg_ptr->dev_cfg_params.format);
+
+ bit_width = adev_device_cfg_ptr->dev_cfg_params.bit_width;
+ sample_rate = adev_device_cfg_ptr->dev_cfg_params.sample_rate;
+ channels = adev_device_cfg_ptr->dev_cfg_params.channels;
+ format = adev_device_cfg_ptr->dev_cfg_params.format;
+ }
+
+ ALOGI("%s:becf: afe: bitwidth %d, samplerate %d channels %d format %d, backend_idx %d device (%s)",
+ __func__, bit_width, sample_rate, channels, format, backend_idx,
platform_get_snd_device_name(snd_device));
if ((my_data->current_backend_cfg[backend_idx].bitwidth_mixer_ctl) &&
@@ -5274,6 +5293,7 @@
ALOGD("%s:becf: afe: %s mixer set to %d bit for %x format", __func__,
my_data->current_backend_cfg[backend_idx].bitwidth_mixer_ctl,
bit_width, format);
+ ret = 0;
}
/*
@@ -5286,11 +5306,11 @@
*/
// TODO: This has to be more dynamic based on policy file
- if (passthrough_enabled || ((my_data->current_backend_cfg[backend_idx].samplerate_mixer_ctl) &&
- (sample_rate != my_data->current_backend_cfg[(int)backend_idx].sample_rate) &&
+ if ((my_data->current_backend_cfg[backend_idx].samplerate_mixer_ctl) &&
+ (((sample_rate != my_data->current_backend_cfg[(int)backend_idx].sample_rate) &&
(my_data->hifi_audio ||
backend_idx == USB_AUDIO_RX_BACKEND ||
- backend_idx == USB_AUDIO_TX_BACKEND))) {
+ backend_idx == USB_AUDIO_TX_BACKEND)) || passthrough_enabled)) {
/*
* sample rate update is needed only for hifi audio enabled platforms
*/
@@ -5357,6 +5377,7 @@
rate_str);
mixer_ctl_set_enum_by_string(ctl, rate_str);
my_data->current_backend_cfg[backend_idx].sample_rate = sample_rate;
+ ret = 0;
}
if ((my_data->current_backend_cfg[backend_idx].channels_mixer_ctl) &&
(channels != my_data->current_backend_cfg[backend_idx].channels)) {
@@ -5399,6 +5420,7 @@
ALOGD("%s:becf: afe: %s set to %s", __func__,
my_data->current_backend_cfg[backend_idx].channels_mixer_ctl, channel_cnt_str);
+ ret = 0;
}
bool set_ext_disp_format = false;
@@ -5429,6 +5451,7 @@
ALOGD("%s: Ext display PCM format", __func__);
mixer_ctl_set_enum_by_string(ctl, "LPCM");
}
+ ret = 0;
}
return ret;
}
@@ -5542,6 +5565,7 @@
struct platform_data *my_data = (struct platform_data *)adev->platform;
int na_mode = platform_get_native_support();
bool channels_updated = false;
+ struct audio_device_config_param *adev_device_cfg_ptr = adev->device_cfg_params;
/*BT devices backend is not configured from HAL hence skip*/
if (snd_device == SND_DEVICE_OUT_BT_A2DP ||
@@ -5754,6 +5778,14 @@
backend_cfg->bit_width, backend_cfg->sample_rate, backend_cfg->channels);
}
+ // Force routing if the client sends config params for this backend
+ adev_device_cfg_ptr += backend_idx;
+ if (adev_device_cfg_ptr->use_client_dev_cfg) {
+ ALOGV("%s: Codec backend needs to be updated as Client provided "
+ "config params", __func__);
+ backend_change = true;
+ }
+
if (snd_device == SND_DEVICE_OUT_HEADPHONES || snd_device ==
SND_DEVICE_OUT_HEADPHONES_44_1) {
if (sample_rate > 48000 ||
@@ -5821,9 +5853,13 @@
platform_get_snd_device_name(new_snd_devices[i]));
if (platform_check_codec_backend_cfg(adev, usecase, new_snd_devices[i],
&backend_cfg)) {
- platform_set_codec_backend_cfg(adev, new_snd_devices[i],
+ ret = platform_set_codec_backend_cfg(adev, new_snd_devices[i],
backend_cfg);
- ret = true;
+ if (!ret) {
+ ret = true;
+ } else {
+ ret = false;
+ }
}
}
@@ -6483,13 +6519,16 @@
int platform_set_edid_channels_configuration(void *platform, int channels) {
struct platform_data *my_data = (struct platform_data *)platform;
+ struct audio_device *adev = my_data->adev;
edid_audio_info *info = NULL;
int channel_count = 2;
int i, ret;
char default_channelMap[MAX_CHANNELS_SUPPORTED] = {0};
+ struct audio_device_config_param *adev_device_cfg_ptr = adev->device_cfg_params;
ret = platform_get_edid_info(platform);
info = (edid_audio_info *)my_data->edid_info;
+ adev_device_cfg_ptr += HDMI_RX_BACKEND;
if(ret == 0 && info != NULL) {
if (channels > 2) {
@@ -6508,11 +6547,29 @@
* though the input channel count set on adm is less than or equal to
* max supported channel count
*/
- platform_set_channel_map(platform, channel_count, info->channel_map, -1);
- platform_set_channel_allocation(platform, info->channel_allocation);
+ if (adev_device_cfg_ptr->use_client_dev_cfg) {
+ platform_set_channel_map(platform, adev_device_cfg_ptr->dev_cfg_params.channels,
+ (char *)adev_device_cfg_ptr->dev_cfg_params.channel_map, -1);
+ } else {
+ platform_set_channel_map(platform, channel_count, info->channel_map, -1);
+ }
+
+ if (adev_device_cfg_ptr->use_client_dev_cfg) {
+ ALOGV("%s:: Setting client selected CA %d", __func__,
+ adev_device_cfg_ptr->dev_cfg_params.channel_allocation);
+ platform_set_channel_allocation(platform,
+ adev_device_cfg_ptr->dev_cfg_params.channel_allocation);
+ } else {
+ platform_set_channel_allocation(platform, info->channel_allocation);
+ }
} else {
- default_channelMap[0] = PCM_CHANNEL_FL;
- default_channelMap[1] = PCM_CHANNEL_FR;
+ if (adev_device_cfg_ptr->use_client_dev_cfg) {
+ default_channelMap[0] = adev_device_cfg_ptr->dev_cfg_params.channel_map[0];
+ default_channelMap[1] = adev_device_cfg_ptr->dev_cfg_params.channel_map[1];
+ } else {
+ default_channelMap[0] = PCM_CHANNEL_FL;
+ default_channelMap[1] = PCM_CHANNEL_FR;
+ }
platform_set_channel_map(platform,2,default_channelMap,-1);
platform_set_channel_allocation(platform,0);
}
@@ -7098,3 +7155,8 @@
{
return 0;
}
+
+int platform_get_max_codec_backend() {
+
+ return MAX_CODEC_BACKENDS;
+}
diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c
index 3ffacb8..0eb31ec 100644
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.c
@@ -2211,6 +2211,8 @@
strdup("SLIM_0_RX Format");
my_data->current_backend_cfg[DEFAULT_CODEC_BACKEND].samplerate_mixer_ctl =
strdup("SLIM_0_RX SampleRate");
+ my_data->current_backend_cfg[DEFAULT_CODEC_BACKEND].channels_mixer_ctl =
+ strdup("SLIM_0_RX Channels");
my_data->current_backend_cfg[DSD_NATIVE_BACKEND].bitwidth_mixer_ctl =
strdup("SLIM_2_RX Format");
@@ -5117,7 +5119,7 @@
static int platform_set_codec_backend_cfg(struct audio_device* adev,
snd_device_t snd_device, struct audio_backend_cfg backend_cfg)
{
- int ret = 0;
+ int ret = -EINVAL;
int backend_idx = platform_get_backend_index(snd_device);
struct platform_data *my_data = (struct platform_data *)adev->platform;
backend_idx = platform_get_backend_index(snd_device);
@@ -5126,6 +5128,23 @@
unsigned int channels = backend_cfg.channels;
audio_format_t format = backend_cfg.format;
bool passthrough_enabled = backend_cfg.passthrough_enabled;
+ struct audio_device_config_param *adev_device_cfg_ptr = adev->device_cfg_params;
+
+ /* Override the config params if client has already set them */
+ adev_device_cfg_ptr += backend_idx;
+ if (adev_device_cfg_ptr->use_client_dev_cfg) {
+ ALOGV("%s::: Updating with the config set by client "
+ "bitwidth %d, samplerate %d, channels %d format %d",
+ __func__, adev_device_cfg_ptr->dev_cfg_params.bit_width,
+ adev_device_cfg_ptr->dev_cfg_params.sample_rate,
+ adev_device_cfg_ptr->dev_cfg_params.channels,
+ adev_device_cfg_ptr->dev_cfg_params.format);
+
+ bit_width = adev_device_cfg_ptr->dev_cfg_params.bit_width;
+ sample_rate = adev_device_cfg_ptr->dev_cfg_params.sample_rate;
+ channels = adev_device_cfg_ptr->dev_cfg_params.channels;
+ format = adev_device_cfg_ptr->dev_cfg_params.format;
+ }
ALOGI("%s:becf: afe: bitwidth %d, samplerate %d channels %d"
", backend_idx %d device (%s)", __func__, bit_width,
@@ -5167,8 +5186,8 @@
ret = 0;
}
- if (passthrough_enabled || ((my_data->current_backend_cfg[backend_idx].samplerate_mixer_ctl) &&
- (sample_rate != my_data->current_backend_cfg[backend_idx].sample_rate))) {
+ if ((my_data->current_backend_cfg[backend_idx].samplerate_mixer_ctl) &&
+ (passthrough_enabled || (sample_rate != my_data->current_backend_cfg[backend_idx].sample_rate))) {
char *rate_str = NULL;
struct mixer_ctl *ctl = NULL;
@@ -5230,6 +5249,7 @@
my_data->current_backend_cfg[backend_idx].samplerate_mixer_ctl, rate_str);
mixer_ctl_set_enum_by_string(ctl, rate_str);
my_data->current_backend_cfg[backend_idx].sample_rate = sample_rate;
+ ret = 0;
}
if ((my_data->current_backend_cfg[backend_idx].channels_mixer_ctl) &&
(channels != my_data->current_backend_cfg[backend_idx].channels)) {
@@ -5270,9 +5290,10 @@
if (backend_idx == HDMI_RX_BACKEND)
platform_set_edid_channels_configuration(adev->platform, channels);
- ALOGD("%s:becf: afe: %s set to %s", __func__,
+ ALOGD("%s:becf: afe: %s set to %s ", __func__,
my_data->current_backend_cfg[backend_idx].channels_mixer_ctl,
channel_cnt_str);
+ ret = 0;
}
bool set_ext_disp_format = false;
@@ -5303,6 +5324,7 @@
ALOGD("%s: Ext display PCM format", __func__);
mixer_ctl_set_enum_by_string(ctl, "LPCM");
}
+ ret = 0;
}
return ret;
}
@@ -5413,6 +5435,7 @@
struct platform_data *my_data = (struct platform_data *)adev->platform;
int na_mode = platform_get_native_support();
bool channels_updated = false;
+ struct audio_device_config_param *adev_device_cfg_ptr = adev->device_cfg_params;
/*BT devices backend is not configured from HAL hence skip*/
if (snd_device == SND_DEVICE_OUT_BT_A2DP ||
@@ -5585,7 +5608,6 @@
channels_updated = true;
}
-
ALOGI("%s:becf: afe: Codec selected backend: %d updated bit width: %d and sample rate: %d",
__func__, backend_idx , bit_width, sample_rate);
@@ -5604,6 +5626,14 @@
__func__, backend_cfg->bit_width, backend_cfg->sample_rate, backend_cfg->channels);
}
+ // Force routing if the client sends config params for this backend
+ adev_device_cfg_ptr += backend_idx;
+ if (adev_device_cfg_ptr->use_client_dev_cfg) {
+ ALOGV("%s: Codec backend needs to be updated as Client provided "
+ "config params", __func__);
+ backend_change = true;
+ }
+
if (snd_device == SND_DEVICE_OUT_HEADPHONES || snd_device ==
SND_DEVICE_OUT_HEADPHONES_44_1) {
if (sample_rate > 48000 ||
@@ -5671,9 +5701,13 @@
ALOGI("%s: new_snd_devices[%d] is %d", __func__, i, new_snd_devices[i]);
if ((platform_check_codec_backend_cfg(adev, usecase, new_snd_devices[i],
&backend_cfg))) {
- platform_set_codec_backend_cfg(adev, new_snd_devices[i],
+ ret = platform_set_codec_backend_cfg(adev, new_snd_devices[i],
backend_cfg);
- ret = true;
+ if (!ret) {
+ ret = true;
+ } else {
+ ret = false;
+ }
}
}
return ret;
@@ -6349,13 +6383,16 @@
int platform_set_edid_channels_configuration(void *platform, int channels) {
struct platform_data *my_data = (struct platform_data *)platform;
+ struct audio_device *adev = my_data->adev;
edid_audio_info *info = NULL;
int channel_count = 2;
int i, ret;
char default_channelMap[MAX_CHANNELS_SUPPORTED] = {0};
+ struct audio_device_config_param *adev_device_cfg_ptr = adev->device_cfg_params;
ret = platform_get_edid_info(platform);
info = (edid_audio_info *)my_data->edid_info;
+ adev_device_cfg_ptr += HDMI_RX_BACKEND;
if(ret == 0 && info != NULL) {
if (channels > 2) {
@@ -6374,11 +6411,29 @@
* though the input channel count set on adm is less than or equal to
* max supported channel count
*/
- platform_set_channel_map(platform, channel_count, info->channel_map, -1);
- platform_set_channel_allocation(platform, info->channel_allocation);
+ if (adev_device_cfg_ptr->use_client_dev_cfg) {
+ platform_set_channel_map(platform, adev_device_cfg_ptr->dev_cfg_params.channels,
+ (char *)adev_device_cfg_ptr->dev_cfg_params.channel_map, -1);
+ } else {
+ platform_set_channel_map(platform, channel_count, info->channel_map, -1);
+ }
+
+ if (adev_device_cfg_ptr->use_client_dev_cfg) {
+ ALOGV("%s:: Setting client selected CA %d", __func__,
+ adev_device_cfg_ptr->dev_cfg_params.channel_allocation);
+ platform_set_channel_allocation(platform,
+ adev_device_cfg_ptr->dev_cfg_params.channel_allocation);
+ } else {
+ platform_set_channel_allocation(platform, info->channel_allocation);
+ }
} else {
- default_channelMap[0] = PCM_CHANNEL_FL;
- default_channelMap[1] = PCM_CHANNEL_FR;
+ if (adev_device_cfg_ptr->use_client_dev_cfg) {
+ default_channelMap[0] = adev_device_cfg_ptr->dev_cfg_params.channel_map[0];
+ default_channelMap[1] = adev_device_cfg_ptr->dev_cfg_params.channel_map[1];
+ } else {
+ default_channelMap[0] = PCM_CHANNEL_FL;
+ default_channelMap[1] = PCM_CHANNEL_FR;
+ }
platform_set_channel_map(platform,2,default_channelMap,-1);
platform_set_channel_allocation(platform,0);
}
@@ -6880,3 +6935,8 @@
return num_gain_tbl_entry;
}
+
+int platform_get_max_codec_backend() {
+
+ return MAX_CODEC_BACKENDS;
+}
diff --git a/hal/platform_api.h b/hal/platform_api.h
index 56e56d0..c7787a2 100644
--- a/hal/platform_api.h
+++ b/hal/platform_api.h
@@ -228,4 +228,5 @@
int platform_get_max_mic_count(void *platform);
void platform_check_and_update_copp_sample_rate(void *platform, snd_device_t snd_device,
unsigned int stream_sr,int *sample_rate);
+int platform_get_max_codec_backend();
#endif // AUDIO_PLATFORM_API_H
diff --git a/qahw_api/inc/qahw_defs.h b/qahw_api/inc/qahw_defs.h
index 3adddf1..23e51cb 100644
--- a/qahw_api/inc/qahw_defs.h
+++ b/qahw_api/inc/qahw_defs.h
@@ -313,6 +313,16 @@
uint8_t channel_map[AUDIO_CHANNEL_COUNT_MAX]; /* Input Channel Map */
};
+struct qahw_device_cfg_param {
+ uint32_t sample_rate;
+ uint32_t channels;
+ uint32_t bit_width;
+ audio_format_t format;
+ audio_devices_t device;
+ uint8_t channel_map[AUDIO_CHANNEL_COUNT_MAX];
+ uint16_t channel_allocation;
+};
+
typedef union {
struct qahw_source_tracking_param st_params;
struct qahw_sound_focus_param sf_params;
@@ -324,6 +334,7 @@
struct qahw_out_correct_drift drift_correction_param;
struct qahw_adsp_event adsp_event_params;
struct qahw_out_channel_map_param channel_map_params;
+ struct qahw_device_cfg_param device_cfg_params;
} qahw_param_payload;
typedef enum {
@@ -338,7 +349,8 @@
/* param to set drift value to be adjusted by dsp */
QAHW_PARAM_OUT_CORRECT_DRIFT,
QAHW_PARAM_ADSP_STREAM_CMD,
- QAHW_PARAM_OUT_CHANNEL_MAP /* PARAM to set i/p channel map */
+ QAHW_PARAM_OUT_CHANNEL_MAP, /* PARAM to set i/p channel map */
+ QAHW_PARAM_DEVICE_CONFIG /* PARAM to set device config */
} qahw_param_id;
__END_DECLS