Merge "hal: Send temperature initialization mixer control" into audio-hal.lnx.4.0
diff --git a/configs/sdm660/audio_policy_configuration.xml b/configs/sdm660/audio_policy_configuration.xml
index f0528c6..5cb77df 100644
--- a/configs/sdm660/audio_policy_configuration.xml
+++ b/configs/sdm660/audio_policy_configuration.xml
@@ -117,15 +117,6 @@
<profile name="" format="AUDIO_FORMAT_AAC_HE_V2"
samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000"
channelMasks="AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_MONO"/>
- <profile name="" format="AUDIO_FORMAT_AC3"
- samplingRates="32000,44100,48000"
- channelMasks="AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_2POINT1,AUDIO_CHANNEL_OUT_QUAD,AUDIO_CHANNEL_OUT_PENTA,AUDIO_CHANNEL_OUT_5POINT1"/>
- <profile name="" format="AUDIO_FORMAT_E_AC3"
- samplingRates="32000,44100,48000"
- channelMasks="AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_2POINT1,AUDIO_CHANNEL_OUT_QUAD,AUDIO_CHANNEL_OUT_PENTA,AUDIO_CHANNEL_OUT_5POINT1,AUDIO_CHANNEL_OUT_6POINT1,AUDIO_CHANNEL_OUT_7POINT1"/>
- <profile name="" format="AUDIO_FORMAT_E_AC3_JOC"
- samplingRates="32000,44100,48000"
- channelMasks="AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_2POINT1,AUDIO_CHANNEL_OUT_QUAD,AUDIO_CHANNEL_OUT_PENTA,AUDIO_CHANNEL_OUT_5POINT1,AUDIO_CHANNEL_OUT_6POINT1,AUDIO_CHANNEL_OUT_7POINT1"/>
<profile name="" format="AUDIO_FORMAT_DTS"
samplingRates="32000,44100,48000"
channelMasks="AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_2POINT1,AUDIO_CHANNEL_OUT_QUAD,AUDIO_CHANNEL_OUT_PENTA,AUDIO_CHANNEL_OUT_5POINT1"/>
diff --git a/hal/audio_extn/audio_defs.h b/hal/audio_extn/audio_defs.h
index 3921f49..1b34c53 100755
--- a/hal/audio_extn/audio_defs.h
+++ b/hal/audio_extn/audio_defs.h
@@ -117,6 +117,10 @@
/* MAX SECTORS for sourcetracking feature */
#define MAX_SECTORS 8
+/* Max length for license string */
+#define AUDIO_PRODUCT_STR_MAX_LENGTH (64)
+#define AUDIO_LICENSE_STR_MAX_LENGTH (64)
+
struct source_tracking_param {
uint8_t vad[MAX_SECTORS];
uint16_t doa_speech;
@@ -255,6 +259,13 @@
uint32_t mixer_coeffs[AUDIO_CHANNEL_COUNT_MAX][AUDIO_CHANNEL_COUNT_MAX];
} mix_matrix_params_t;
+
+typedef struct audio_license_params {
+ char product[AUDIO_PRODUCT_STR_MAX_LENGTH + 1];
+ int key;
+ char license[AUDIO_LICENSE_STR_MAX_LENGTH + 1];
+} audio_license_params_t;
+
typedef union {
struct source_tracking_param st_params;
struct sound_focus_param sf_params;
@@ -268,6 +279,7 @@
struct audio_out_channel_map_param channel_map_param;
struct audio_device_cfg_param device_cfg;
struct mix_matrix_params mm_params;
+ struct audio_license_params license_params;
} audio_extn_param_payload;
typedef enum {
@@ -288,7 +300,9 @@
/* Pan/scale params to be set on ASM */
AUDIO_EXTN_PARAM_OUT_MIX_MATRIX_PARAMS,
/* Downmix params to be set on ADM */
- AUDIO_EXTN_PARAM_CH_MIX_MATRIX_PARAMS
+ AUDIO_EXTN_PARAM_CH_MIX_MATRIX_PARAMS,
+ /* License information */
+ AUDIO_EXTN_PARAM_LICENSE_PARAMS,
} 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 292e516..c6c0924 100755
--- a/hal/audio_extn/audio_extn.c
+++ b/hal/audio_extn/audio_extn.c
@@ -300,6 +300,74 @@
ALOGV("%s: Setting custom stereo state success", __func__);
}
}
+
+void audio_extn_send_dual_mono_mixing_coefficients(struct stream_out *out)
+{
+ struct audio_device *adev = out->dev;
+ struct mixer_ctl *ctl;
+ char mixer_ctl_name[128];
+ int cust_ch_mixer_cfg[128], len = 0;
+ int ip_channel_cnt = audio_channel_count_from_out_mask(out->channel_mask);
+ int pcm_device_id = platform_get_pcm_device_id(out->usecase, PCM_PLAYBACK);
+ int op_channel_cnt= 2;
+ int i, j, err;
+
+ ALOGV("%s", __func__);
+ if (!out->started) {
+ out->set_dual_mono = true;
+ goto exit;
+ }
+
+ ALOGD("%s: i/p channel count %d, o/p channel count %d, pcm id %d", __func__,
+ ip_channel_cnt, op_channel_cnt, pcm_device_id);
+
+ snprintf(mixer_ctl_name, sizeof(mixer_ctl_name),
+ "Audio Stream %d Channel Mix Cfg", pcm_device_id);
+ ctl = mixer_get_ctl_by_name(adev->mixer, mixer_ctl_name);
+ if (!ctl) {
+ ALOGE("%s: ERROR. Could not get ctl for mixer cmd - %s",
+ __func__, mixer_ctl_name);
+ goto exit;
+ }
+
+ /* Output channel count corresponds to backend configuration channels.
+ * Input channel count corresponds to ASM session channels.
+ * Set params is called with channels that need to be selected from
+ * input to generate output.
+ * ex: "8,2" to downmix from 8 to 2 i.e. to downmix from 8 to 2,
+ *
+ * This mixer control takes values in the following sequence:
+ * - input channel count(m)
+ * - output channel count(n)
+ * - weight coeff for [out ch#1, in ch#1]
+ * ....
+ * - weight coeff for [out ch#1, in ch#m]
+ *
+ * - weight coeff for [out ch#2, in ch#1]
+ * ....
+ * - weight coeff for [out ch#2, in ch#m]
+ *
+ * - weight coeff for [out ch#n, in ch#1]
+ * ....
+ * - weight coeff for [out ch#n, in ch#m]
+ *
+ * To get dualmono ouptu weightage coeff is calculated as Unity gain
+ * divided by number of input channels.
+ */
+ cust_ch_mixer_cfg[len++] = ip_channel_cnt;
+ cust_ch_mixer_cfg[len++] = op_channel_cnt;
+ for (i = 0; i < op_channel_cnt; i++) {
+ for (j = 0; j < ip_channel_cnt; j++) {
+ cust_ch_mixer_cfg[len++] = Q14_GAIN_UNITY/ip_channel_cnt;
+ }
+ }
+
+ err = mixer_ctl_set_array(ctl, cust_ch_mixer_cfg, len);
+ if (err)
+ ALOGE("%s: ERROR. Mixer ctl set failed", __func__);
+exit:
+ return;
+}
#endif /* CUSTOM_STEREO_ENABLED */
#ifndef DTS_EAGLE
@@ -1261,7 +1329,15 @@
if (ssr_supported) {
return audio_extn_ssr_set_usecase(in, config, update_params);
} else if (audio_extn_ffv_check_usecase(in)) {
- return audio_extn_ffv_set_usecase(in);
+ char ffv_lic[LICENSE_STR_MAX_LEN + 1] = {0};
+ int ffv_key = 0;
+ if(platform_get_license_by_product(adev->platform, PRODUCT_FFV, &ffv_key, ffv_lic))
+ {
+ ALOGD("%s: Valid licence not availble for %s ", __func__, PRODUCT_FFV);
+ return -EINVAL;
+ }
+ ALOGD("%s: KEY: %d LICENSE: %s ", __func__, ffv_key, ffv_lic);
+ return audio_extn_ffv_set_usecase(in, ffv_key, ffv_lic);
} else {
return audio_extn_set_multichannel_mask(adev, in, config,
update_params);
@@ -1488,70 +1564,4 @@
return 0;
}
-void audio_extn_send_dual_mono_mixing_coefficients(struct stream_out *out)
-{
- struct audio_device *adev = out->dev;
- struct mixer_ctl *ctl;
- char mixer_ctl_name[128];
- int cust_ch_mixer_cfg[128], len = 0;
- int ip_channel_cnt = audio_channel_count_from_out_mask(out->channel_mask);
- int pcm_device_id = platform_get_pcm_device_id(out->usecase, PCM_PLAYBACK);
- int op_channel_cnt= 2;
- int i, j, err;
- ALOGV("%s", __func__);
- if (!out->started) {
- out->set_dual_mono = true;
- goto exit;
- }
-
- ALOGD("%s: i/p channel count %d, o/p channel count %d, pcm id %d", __func__,
- ip_channel_cnt, op_channel_cnt, pcm_device_id);
-
- snprintf(mixer_ctl_name, sizeof(mixer_ctl_name),
- "Audio Stream %d Channel Mix Cfg", pcm_device_id);
- ctl = mixer_get_ctl_by_name(adev->mixer, mixer_ctl_name);
- if (!ctl) {
- ALOGE("%s: ERROR. Could not get ctl for mixer cmd - %s",
- __func__, mixer_ctl_name);
- goto exit;
- }
-
- /* Output channel count corresponds to backend configuration channels.
- * Input channel count corresponds to ASM session channels.
- * Set params is called with channels that need to be selected from
- * input to generate output.
- * ex: "8,2" to downmix from 8 to 2 i.e. to downmix from 8 to 2,
- *
- * This mixer control takes values in the following sequence:
- * - input channel count(m)
- * - output channel count(n)
- * - weight coeff for [out ch#1, in ch#1]
- * ....
- * - weight coeff for [out ch#1, in ch#m]
- *
- * - weight coeff for [out ch#2, in ch#1]
- * ....
- * - weight coeff for [out ch#2, in ch#m]
- *
- * - weight coeff for [out ch#n, in ch#1]
- * ....
- * - weight coeff for [out ch#n, in ch#m]
- *
- * To get dualmono ouptu weightage coeff is calculated as Unity gain
- * divided by number of input channels.
- */
- cust_ch_mixer_cfg[len++] = ip_channel_cnt;
- cust_ch_mixer_cfg[len++] = op_channel_cnt;
- for (i = 0; i < op_channel_cnt; i++) {
- for (j = 0; j < ip_channel_cnt; j++) {
- cust_ch_mixer_cfg[len++] = Q14_GAIN_UNITY/ip_channel_cnt;
- }
- }
-
- err = mixer_ctl_set_array(ctl, cust_ch_mixer_cfg, len);
- if (err)
- ALOGE("%s: ERROR. Mixer ctl set failed", __func__);
-exit:
- return;
-}
diff --git a/hal/audio_extn/audio_extn.h b/hal/audio_extn/audio_extn.h
index 46c09a9..2b55648 100755
--- a/hal/audio_extn/audio_extn.h
+++ b/hal/audio_extn/audio_extn.h
@@ -1000,8 +1000,8 @@
#define audio_extn_ffv_init(adev) (0)
#define audio_extn_ffv_deinit() (0)
#define audio_extn_ffv_check_usecase(in) (0)
-#define audio_extn_ffv_set_usecase(in) (0)
-#define audio_extn_ffv_stream_init(in) (0)
+#define audio_extn_ffv_set_usecase(in, key, lic) (0)
+#define audio_extn_ffv_stream_init(in, key, lic) (0)
#define audio_extn_ffv_stream_deinit() (0)
#define audio_extn_ffv_update_enabled() (0)
#define audio_extn_ffv_get_enabled() (0)
@@ -1018,8 +1018,8 @@
int32_t audio_extn_ffv_init(struct audio_device *adev);
int32_t audio_extn_ffv_deinit();
bool audio_extn_ffv_check_usecase(struct stream_in *in);
-int audio_extn_ffv_set_usecase(struct stream_in *in);
-int32_t audio_extn_ffv_stream_init(struct stream_in *in);
+int audio_extn_ffv_set_usecase( struct stream_in *in, int key, char* lic);
+int32_t audio_extn_ffv_stream_init(struct stream_in *in, int key, char* lic);
int32_t audio_extn_ffv_stream_deinit();
void audio_extn_ffv_update_enabled();
bool audio_extn_ffv_get_enabled();
@@ -1043,4 +1043,5 @@
#else
void audio_extn_send_dual_mono_mixing_coefficients(struct stream_out *out);
#endif
+int audio_extn_utils_get_license_params(const struct audio_device *adev, struct audio_license_params *lic_params);
#endif /* AUDIO_EXTN_H */
diff --git a/hal/audio_extn/ffv.c b/hal/audio_extn/ffv.c
old mode 100644
new mode 100755
index 596f49b..54ce30c
--- a/hal/audio_extn/ffv.c
+++ b/hal/audio_extn/ffv.c
@@ -114,7 +114,8 @@
static FfvStatusType (*ffv_init_fn)(void** handle, int num_tx_in_ch,
int num_out_ch, int num_ec_ref_ch, int frame_len, int sample_rate,
const char *config_file_name, char *svaModelBuffer,
- uint32_t svaModelSize, int* totMemSize);
+ uint32_t svaModelSize, int* totMemSize,
+ int product_id, const char* prduct_license);
static void (*ffv_deinit_fn)(void* handle);
static void (*ffv_process_fn)(void *handle, const int16_t *in_pcm,
int16_t *out_pcm, const int16_t *ec_ref_pcm);
@@ -379,12 +380,12 @@
return ret;
}
-int audio_extn_ffv_set_usecase(struct stream_in *in)
+int audio_extn_ffv_set_usecase(struct stream_in *in, int ffv_key, char* ffv_lic)
{
int ret = -EINVAL;
if (audio_extn_ffv_check_usecase(in)) {
- if (!audio_extn_ffv_stream_init(in)) {
+ if (!audio_extn_ffv_stream_init(in, ffv_key, ffv_lic)) {
ALOGD("%s: Created FFV session succesfully", __func__);
ret = 0;
} else {
@@ -428,7 +429,7 @@
return 0;
}
-int32_t audio_extn_ffv_stream_init(struct stream_in *in)
+int32_t audio_extn_ffv_stream_init(struct stream_in *in, int key, char* lic)
{
uint32_t ret = -EINVAL;
int num_tx_in_ch, num_out_ch, num_ec_ref_ch;
@@ -487,7 +488,7 @@
ALOGD("%s: config file path %s", __func__, config_file_path);
status_type = ffv_init_fn(&ffvmod.handle, num_tx_in_ch, num_out_ch, num_ec_ref_ch,
frame_len, sample_rate, config_file_path, sm_buffer, 0,
- &total_mem_size);
+ &total_mem_size, key, lic);
if (status_type) {
ALOGE("%s: ERROR. ffv_init returned %d", __func__, status_type);
ret = -EINVAL;
diff --git a/hal/audio_extn/utils.c b/hal/audio_extn/utils.c
old mode 100644
new mode 100755
index d4c6351..c968c56
--- a/hal/audio_extn/utils.c
+++ b/hal/audio_extn/utils.c
@@ -2486,3 +2486,15 @@
return -EINVAL;
}
+
+int audio_extn_utils_get_license_params
+(
+const struct audio_device *adev,
+struct audio_license_params *license_params
+)
+{
+ if(!license_params)
+ return -EINVAL;
+ return platform_get_license_by_product(adev->platform, (const char*)license_params->product, &license_params->key, license_params->license);
+}
+
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index 3eef21f..7b0e02a 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -2020,6 +2020,10 @@
struct stream_out stream_out;
audio_usecase_t hfp_ucid;
int status = 0;
+ audio_devices_t audio_device;
+ audio_channel_mask_t channel_mask;
+ int sample_rate;
+ int acdb_id;
ALOGD("%s for use case (%s)", __func__, use_case_table[uc_id]);
@@ -2260,14 +2264,11 @@
usecase->stream.out->app_type_cfg.sample_rate = DEFAULT_OUTPUT_SAMPLING_RATE;
}
- /* Notify device change info to effect clients registered */
- pthread_mutex_unlock(&adev->lock);
- audio_extn_gef_notify_device_config(
- usecase->stream.out->devices,
- usecase->stream.out->channel_mask,
- usecase->stream.out->app_type_cfg.sample_rate,
- platform_get_snd_device_acdb_id(usecase->out_snd_device));
- pthread_mutex_lock(&adev->lock);
+ /* Cache stream information to be notified to gef clients */
+ audio_device = usecase->stream.out->devices;
+ channel_mask = usecase->stream.out->channel_mask;
+ sample_rate = usecase->stream.out->app_type_cfg.sample_rate;
+ acdb_id = platform_get_snd_device_acdb_id(usecase->out_snd_device);
}
enable_audio_route(adev, usecase);
@@ -2324,6 +2325,16 @@
}
}
+ /* Notify device change info to effect clients registered
+ * NOTE: device lock has to be unlock temporarily here.
+ * To the worst case, we notify stale info to clients.
+ */
+ if (usecase->type == PCM_PLAYBACK) {
+ pthread_mutex_unlock(&adev->lock);
+ audio_extn_gef_notify_device_config(audio_device, channel_mask, sample_rate, acdb_id);
+ pthread_mutex_lock(&adev->lock);
+ }
+
ALOGD("%s: done",__func__);
return status;
diff --git a/hal/audio_hw_extn_api.c b/hal/audio_hw_extn_api.c
old mode 100644
new mode 100755
index 4e49a83..550a06b
--- a/hal/audio_hw_extn_api.c
+++ b/hal/audio_hw_extn_api.c
@@ -140,6 +140,10 @@
ret = audio_extn_get_sourcetrack_data(dev,
(struct source_tracking_param*)payload);
break;
+ case AUDIO_EXTN_PARAM_LICENSE_PARAMS:
+ ret = audio_extn_utils_get_license_params(dev,
+ (struct audio_license_params *)(payload));
+ break;
default:
ALOGE("%s::INVALID PARAM ID:%d\n",__func__,param_id);
ret = -EINVAL;
diff --git a/hal/msm8916/hw_info.c b/hal/msm8916/hw_info.c
index b88572f..40e39a2 100644
--- a/hal/msm8916/hw_info.c
+++ b/hal/msm8916/hw_info.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014-2017, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2014-2018, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -118,6 +118,9 @@
strlcpy(hw_info->name, "msm8952", sizeof(hw_info->name));
} else if (!strcmp(snd_card_name, "msm8952-snd-card-mtp")) {
strlcpy(hw_info->name, "msm8952", sizeof(hw_info->name));
+ } else if (!strcmp(snd_card_name, "sdm439-sku1-snd-card")) {
+ hw_info->is_stereo_spkr = false;
+ strlcpy(hw_info->name, "msm8952", sizeof(hw_info->name));
} else if (!strcmp(snd_card_name, "sdm439-snd-card-mtp")) {
strlcpy(hw_info->name, "msm8952", sizeof(hw_info->name));
} else if (!strcmp(snd_card_name, "msm8952-tomtom-snd-card")) {
diff --git a/hal/msm8916/platform.c b/hal/msm8916/platform.c
old mode 100644
new mode 100755
index e74353e..63fb207
--- a/hal/msm8916/platform.c
+++ b/hal/msm8916/platform.c
@@ -1239,6 +1239,13 @@
msm_device_to_be_id = msm_device_to_be_id_internal_codec;
msm_be_id_array_len =
sizeof(msm_device_to_be_id_internal_codec) / sizeof(msm_device_to_be_id_internal_codec[0]);
+ } else if (!strncmp(snd_card_name, "sdm439-sku1-snd-card",
+ sizeof("sdm439-sku1-snd-card"))) {
+ strlcpy(mixer_xml_path, MIXER_XML_PATH_SDM439_PM8953,
+ sizeof(MIXER_XML_PATH_SDM439_PM8953));
+ msm_device_to_be_id = msm_device_to_be_id_internal_codec;
+ msm_be_id_array_len =
+ sizeof(msm_device_to_be_id_internal_codec) / sizeof(msm_device_to_be_id_internal_codec[0]);
} else if (!strncmp(snd_card_name, "msm8952-tomtom-snd-card",
sizeof("msm8952-tomtom-snd-card"))) {
strlcpy(mixer_xml_path, MIXER_XML_PATH_WCD9330,
@@ -2060,6 +2067,10 @@
sizeof("msm8953-snd-card-mtp")) ||
(!strncmp(snd_card_name, "msm8953-sku4-snd-card",
sizeof("msm8953-sku4-snd-card"))) ||
+ (!strncmp(snd_card_name, "sdm439-sku1-snd-card",
+ sizeof("sdm439-sku1-snd-card"))) ||
+ (!strncmp(snd_card_name, "sdm439-snd-card-mtp",
+ sizeof("sdm439-snd-card-mtp"))) ||
(!strncmp(snd_card_name, "msm8952-skum-snd-card",
sizeof("msm8952-skum-snd-card"))))) {
*is_wsa_combo_supported = true;
@@ -2722,6 +2733,17 @@
return my_data;
}
+void platform_release_acdb_metainfo_key(void *platform)
+{
+ struct platform_data *my_data = (struct platform_data *)platform;
+ struct listnode *node, *tempnode;
+
+ list_for_each_safe(node, tempnode, &my_data->acdb_meta_key_list) {
+ list_remove(node);
+ free(node_to_item(node, struct meta_key_list, list));
+ }
+}
+
void platform_deinit(void *platform)
{
struct platform_data *my_data = (struct platform_data *)platform;
@@ -2770,6 +2792,28 @@
my_data->adev->mixer = NULL;
}
+ int32_t idx;
+
+ for (idx = 0; idx < MAX_CODEC_BACKENDS; idx++) {
+ if (my_data->current_backend_cfg[idx].bitwidth_mixer_ctl) {
+ free(my_data->current_backend_cfg[idx].bitwidth_mixer_ctl);
+ my_data->current_backend_cfg[idx].bitwidth_mixer_ctl = NULL;
+ }
+
+ if (my_data->current_backend_cfg[idx].samplerate_mixer_ctl) {
+ free(my_data->current_backend_cfg[idx].samplerate_mixer_ctl);
+ my_data->current_backend_cfg[idx].samplerate_mixer_ctl = NULL;
+ }
+
+ if (my_data->current_backend_cfg[idx].channels_mixer_ctl) {
+ free(my_data->current_backend_cfg[idx].channels_mixer_ctl);
+ my_data->current_backend_cfg[idx].channels_mixer_ctl = NULL;
+ }
+ }
+
+ /* free acdb_meta_key_list */
+ platform_release_acdb_metainfo_key(platform);
+
free(platform);
/* deinit usb */
audio_extn_usb_deinit();
@@ -3091,6 +3135,59 @@
return 0;
}
+int platform_get_license_by_product
+(
+ void *platform,
+ const char* product_name,
+ int* product_id,
+ char* product_license
+)
+{
+ int ret = 0;
+ int id = 0;
+ acdb_audio_cal_cfg_t cal;
+ uint32_t param_len = LICENSE_STR_MAX_LEN;
+ struct platform_data *my_data = (struct platform_data *)platform;
+
+ if ((NULL == platform) || (NULL == product_name) || (NULL == product_id)) {
+ ALOGE("[%s] Invalid input parameters",__func__);
+ ret = -EINVAL;
+ goto on_error;
+ }
+
+ id = platform_get_meta_info_key_from_list(platform, (char*)product_name);
+ if(0 == id)
+ {
+ ALOGE("%s:Id not found for %s", __func__, product_name);
+ ret = -EINVAL;
+ goto on_error;
+ }
+
+ ALOGD("%s: Found Id[%d] for %s", __func__, id, product_name);
+ if(NULL == my_data->acdb_get_audio_cal){
+ ALOGE("[%s] acdb_get_audio_cal is NULL.",__func__);
+ ret = -ENOSYS;
+ goto on_error;
+ }
+
+ memset(&cal, 0, sizeof(cal));
+ cal.persist = 1;
+ cal.cal_type = AUDIO_CORE_METAINFO_CAL_TYPE;
+ cal.acdb_dev_id = (uint32_t) id;
+ ret = my_data->acdb_get_audio_cal((void*)&cal, (void*)product_license, ¶m_len);
+
+ if (0 == ret) {
+ ALOGD("%s: Got Length[%d] License[%s]", __func__, param_len, product_license );
+ *product_id = id;
+ return 0;
+ }
+ ALOGD("%s: License not found for %s", __func__, product_name);
+
+on_error:
+ *product_id = 0;
+ return ret;
+}
+
int platform_get_meta_info_key_from_list(void *platform, char *mod_name)
{
struct listnode *node;
diff --git a/hal/msm8960/platform.c b/hal/msm8960/platform.c
old mode 100644
new mode 100755
index 43aeaed..f4132c2
--- a/hal/msm8960/platform.c
+++ b/hal/msm8960/platform.c
@@ -1374,3 +1374,8 @@
{
return -ENOSYS;
}
+
+int platform_get_license_by_product(void *platform, const char* product_name, int *product_id, char* product_license)
+{
+ return -ENOSYS;
+}
diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c
old mode 100644
new mode 100755
index 9a5d647..a126b37
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.c
@@ -2531,6 +2531,17 @@
return my_data;
}
+void platform_release_acdb_metainfo_key(void *platform)
+{
+ struct platform_data *my_data = (struct platform_data *)platform;
+ struct listnode *node, *tempnode;
+
+ list_for_each_safe(node, tempnode, &my_data->acdb_meta_key_list) {
+ list_remove(node);
+ free(node_to_item(node, struct meta_key_list, list));
+ }
+}
+
void platform_deinit(void *platform)
{
struct platform_data *my_data = (struct platform_data *)platform;
@@ -2578,6 +2589,28 @@
my_data->adev->mixer = NULL;
}
+ int32_t idx;
+
+ for (idx = 0; idx < MAX_CODEC_BACKENDS; idx++) {
+ if (my_data->current_backend_cfg[idx].bitwidth_mixer_ctl) {
+ free(my_data->current_backend_cfg[idx].bitwidth_mixer_ctl);
+ my_data->current_backend_cfg[idx].bitwidth_mixer_ctl = NULL;
+ }
+
+ if (my_data->current_backend_cfg[idx].samplerate_mixer_ctl) {
+ free(my_data->current_backend_cfg[idx].samplerate_mixer_ctl);
+ my_data->current_backend_cfg[idx].samplerate_mixer_ctl = NULL;
+ }
+
+ if (my_data->current_backend_cfg[idx].channels_mixer_ctl) {
+ free(my_data->current_backend_cfg[idx].channels_mixer_ctl);
+ my_data->current_backend_cfg[idx].channels_mixer_ctl = NULL;
+ }
+ }
+
+ /* free acdb_meta_key_list */
+ platform_release_acdb_metainfo_key(platform);
+
free(platform);
/* deinit usb */
audio_extn_usb_deinit();
@@ -7927,3 +7960,8 @@
return id_string;
}
+
+int platform_get_license_by_product(void *platform, const char* product_name, int *product_id, char* product_license)
+{
+ return -ENOSYS;
+}
diff --git a/hal/platform_api.h b/hal/platform_api.h
old mode 100644
new mode 100755
index 0fec452..2bacf6d
--- a/hal/platform_api.h
+++ b/hal/platform_api.h
@@ -31,6 +31,9 @@
#define SAMPLE_RATE_11025 11025
#define sample_rate_multiple(sr, base) ((sr % base)== 0?true:false)
#define MAX_VOLUME_CAL_STEPS 15
+#define LICENSE_STR_MAX_LEN (64)
+#define PRODUCT_FFV "ffv"
+#define PRODUCT_ALLPLAY "allplay"
typedef enum {
PLATFORM,
@@ -108,6 +111,7 @@
effect_type_t effect_type);
int platform_get_snd_device_bit_width(snd_device_t snd_device);
int platform_set_acdb_metainfo_key(void *platform, char *name, int key);
+void platform_release_acdb_metainfo_key(void *platform);
int platform_get_meta_info_key_from_list(void *platform, char *mod_name);
int platform_set_native_support(int na_mode);
int platform_get_native_support();
@@ -261,4 +265,5 @@
int *fd, uint32_t *size);
int platform_get_ec_ref_loopback_snd_device(int channel_count);
const char * platform_get_snd_card_name_for_acdb_loader(const char *snd_card_name);
+int platform_get_license_by_product(void *platform, const char* product_name, int *product_id, char* product_license);
#endif // AUDIO_PLATFORM_API_H
diff --git a/qahw/inc/qahw_defs.h b/qahw/inc/qahw_defs.h
old mode 100644
new mode 100755
index c13a1a4..e67c91e
--- a/qahw/inc/qahw_defs.h
+++ b/qahw/inc/qahw_defs.h
@@ -354,6 +354,14 @@
float mixer_coeffs[AUDIO_CHANNEL_COUNT_MAX][AUDIO_CHANNEL_COUNT_MAX];
} qahw_mix_matrix_params_t;
+#define QAHW_LICENCE_STR_MAX_LENGTH (64)
+#define QAHW_PRODUCT_STR_MAX_LENGTH (64)
+typedef struct qahw_license_params {
+ char product[QAHW_PRODUCT_STR_MAX_LENGTH + 1];
+ int key;
+ char license[QAHW_LICENCE_STR_MAX_LENGTH + 1];
+} qahw_license_params_t;
+
typedef union {
struct qahw_source_tracking_param st_params;
struct qahw_sound_focus_param sf_params;
@@ -367,6 +375,7 @@
struct qahw_out_channel_map_param channel_map_params;
struct qahw_device_cfg_param device_cfg_params;
struct qahw_mix_matrix_params mix_matrix_params;
+ struct qahw_license_params license_params;
} qahw_param_payload;
typedef enum {
@@ -385,6 +394,7 @@
QAHW_PARAM_DEVICE_CONFIG, /* PARAM to set device config */
QAHW_PARAM_OUT_MIX_MATRIX_PARAMS,
QAHW_PARAM_CH_MIX_MATRIX_PARAMS,
+ QAHW_PARAM_LICENSE_PARAMS,
} qahw_param_id;
__END_DECLS
diff --git a/qahw_api/inc/qahw_defs.h b/qahw_api/inc/qahw_defs.h
old mode 100644
new mode 100755
index a33caf6..c708ce0
--- a/qahw_api/inc/qahw_defs.h
+++ b/qahw_api/inc/qahw_defs.h
@@ -354,6 +354,15 @@
float mixer_coeffs[AUDIO_CHANNEL_COUNT_MAX][AUDIO_CHANNEL_COUNT_MAX];
} qahw_mix_matrix_params_t;
+
+#define QAHW_LICENCE_STR_MAX_LENGTH (64)
+#define QAHW_PRODUCT_STR_MAX_LENGTH (64)
+typedef struct qahw_license_params {
+ char product[QAHW_PRODUCT_STR_MAX_LENGTH + 1];
+ int key;
+ char license[QAHW_LICENCE_STR_MAX_LENGTH + 1];
+} qahw_license_params_t;
+
typedef union {
struct qahw_source_tracking_param st_params;
struct qahw_sound_focus_param sf_params;
@@ -367,6 +376,7 @@
struct qahw_out_channel_map_param channel_map_params;
struct qahw_device_cfg_param device_cfg_params;
struct qahw_mix_matrix_params mix_matrix_params;
+ struct qahw_license_params license_params;
} qahw_param_payload;
typedef enum {
@@ -385,6 +395,7 @@
QAHW_PARAM_DEVICE_CONFIG, /* PARAM to set device config */
QAHW_PARAM_OUT_MIX_MATRIX_PARAMS,
QAHW_PARAM_CH_MIX_MATRIX_PARAMS,
+ QAHW_PARAM_LICENSE_PARAMS,
} qahw_param_id;
__END_DECLS