hal: Update DS2 implementation to support ACDB based license mechanism

-Add ACDB based licenese mechanism for Dolby DS2 implementation.
-Add device to back end mapping for MSM8916

Change-Id: I0de4bd67fbfc26c21c4751e32ae2c45278a226d0
This commit is contained in:
Ashish Jain 2014-10-16 13:56:28 +05:30 committed by Gerrit - the friendly Code Review server
parent 1a89642366
commit edb6a91d76
5 changed files with 73 additions and 8 deletions

View File

@ -150,6 +150,10 @@ ifeq ($(strip $(AUDIO_FEATURE_ENABLED_RECORD_PLAY_CONCURRENCY)),true)
LOCAL_CFLAGS += -DRECORD_PLAY_CONCURRENCY
endif
ifeq ($(strip $(AUDIO_FEATURE_ENABLED_ACDB_LICENSE)), true)
LOCAL_CFLAGS += -DDOLBY_ACDB_LICENSE
endif
ifeq ($(strip $(AUDIO_FEATURE_ENABLED_DS2_DOLBY_DAP)),true)
LOCAL_CFLAGS += -DDS2_DOLBY_DAP_ENABLED
ifneq ($(strip $(DOLBY_DDP)),true)

View File

@ -461,6 +461,7 @@ void audio_extn_set_parameters(struct audio_device *adev,
audio_extn_listen_set_parameters(adev, parms);
audio_extn_hfp_set_parameters(adev, parms);
audio_extn_ddp_set_parameters(adev, parms);
audio_extn_ds2_set_parameters(adev, parms);
audio_extn_customstereo_set_parameters(adev, parms);
audio_extn_pm_set_parameters(parms);
}

View File

@ -253,9 +253,14 @@ void audio_extn_compr_cap_deinit();
#if defined(DS1_DOLBY_DDP_ENABLED) || defined(DS1_DOLBY_DAP_ENABLED)
void audio_extn_dolby_set_dmid(struct audio_device *adev);
void audio_extn_dolby_set_license(struct audio_device *adev);
#else
#define audio_extn_dolby_set_dmid(adev) (0)
#endif
#if defined(DS1_DOLBY_DDP_ENABLED) || defined(DS1_DOLBY_DAP_ENABLED) || defined(DS2_DOLBY_DAP_ENABLED)
void audio_extn_dolby_set_license(struct audio_device *adev);
#else
#define audio_extn_dolby_set_license(adev) (0)
#endif
@ -354,12 +359,16 @@ int audio_extn_dap_hal_deinit();
void audio_extn_dolby_ds2_set_endpoint(struct audio_device *adev);
int audio_extn_ds2_enable(struct audio_device *adev);
int audio_extn_dolby_set_dap_bypass(struct audio_device *adev, int state);
void audio_extn_ds2_set_parameters(struct audio_device *adev,
struct str_parms *parms);
#else
#define audio_extn_dap_hal_init(snd_card) (0)
#define audio_extn_dap_hal_deinit() (0)
#define audio_extn_dolby_ds2_set_endpoint(adev) (0)
#define audio_extn_ds2_enable(adev) (0)
#define audio_extn_dolby_set_dap_bypass(adev, state) (0)
#define audio_extn_ds2_set_parameters(adev, parms); (0)
#endif
typedef enum {
DAP_STATE_ON = 0,

View File

@ -18,7 +18,7 @@
*/
#define LOG_TAG "audio_hw_dolby"
/*#define LOG_NDEBUG 0*/
#define LOG_NDEBUG 0
#define LOG_NDDEBUG 0
#include <errno.h>
@ -33,6 +33,7 @@
#include "platform_api.h"
#include "audio_extn.h"
#include "sound/compress_params.h"
#include "sound/devdep_params.h"
#ifdef DS1_DOLBY_DDP_ENABLED
@ -479,6 +480,7 @@ void audio_extn_dolby_set_dmid(struct audio_device *adev)
return;
}
#ifndef DS2_DOLBY_DAP_ENABLED
void audio_extn_dolby_set_license(struct audio_device *adev)
{
int ret, key=0;
@ -494,8 +496,11 @@ void audio_extn_dolby_set_license(struct audio_device *adev)
}
property_get("audio.ds1.metainfo.key",value,"0");
#ifdef DOLBY_ACDB_LICENSE
key = atoi(value);
#else
key = 0;
#endif
ALOGV("%s Setting DS1 License, key:0x%x",__func__, key);
ret = mixer_ctl_set_value(ctl, 0, key);
if (ret)
@ -503,6 +508,7 @@ void audio_extn_dolby_set_license(struct audio_device *adev)
return;
}
#endif
#endif /* DS1_DOLBY_DDP_ENABLED || DS1_DOLBY_DAP_ENABLED */
#ifdef DS2_DOLBY_DAP_ENABLED
@ -538,11 +544,6 @@ int audio_extn_dap_hal_init(int snd_card) {
ds2extnmod.dap_hal_set_hw_info(SND_CARD, (void*)(&snd_card));
ALOGV("%s Sound card number is:%d",__func__,snd_card);
property_get("dmid",c_dmid,"0");
i_dmid = atoi(c_dmid);
ds2extnmod.dap_hal_set_hw_info(DMID, (void*)(&i_dmid));
ALOGV("%s Dolby device manufacturer id is:%d",__func__,i_dmid);
platform_get_device_to_be_id_map(&device_be_id_map.device_id_to_be_id, &device_be_id_map.len);
ds2extnmod.dap_hal_set_hw_info(DEVICE_BE_ID_MAP, (void*)(&device_be_id_map));
ALOGV("%s Set be id map len:%d",__func__,device_be_id_map.len);
@ -635,4 +636,50 @@ int audio_extn_dolby_set_dap_bypass(struct audio_device *adev, int state) {
}
return 0;
}
void audio_extn_dolby_set_license(struct audio_device *adev)
{
int i_key=0;
char c_key[128] = {0};
char c_dmid[128] = {0};
int i_dmid, ret = -EINVAL;
struct dolby_param_license dolby_license;
#ifdef DOLBY_ACDB_LICENSE
property_get("audio.ds1.metainfo.key",c_key,"0");
i_key = atoi(c_key);
#else
/* As ACDB based license mechanism is disabled, force set the license key to 0*/
i_key = 0;
#endif
property_get("dmid",c_dmid,"0");
i_dmid = atoi(c_dmid);
ALOGV("%s Setting DS1 License, key:0x%x dmid %d",__func__, i_key,i_dmid);
dolby_license.dmid = i_dmid;
dolby_license.license_key = i_key;
if (ds2extnmod.dap_hal_set_hw_info) {
ds2extnmod.dap_hal_set_hw_info(DMID, (void*)(&dolby_license.dmid));
} else {
ALOGV("%s: dap_hal_set_hw_info is NULL", __func__);
return ret;
}
return 0;
}
void audio_extn_ds2_set_parameters(struct audio_device *adev,
struct str_parms *parms)
{
int val, ret;
char value[32]={0};
ret = str_parms_get_str(parms, AUDIO_PARAMETER_KEY_SND_CARD_STATUS, value,
sizeof(value));
if (ret >= 0) {
char *snd_card_status = value + 2;
if (strncmp(snd_card_status, "ONLINE", sizeof("ONLINE")) == 0){
audio_extn_dolby_set_license(adev);
}
}
}
#endif

View File

@ -1090,6 +1090,9 @@ acdb_init_fail:
audio_extn_ssr_update_enabled();
audio_extn_spkr_prot_init(adev);
/* init dap hal */
audio_extn_dap_hal_init(adev->snd_card);
audio_extn_dolby_set_license(adev);
audio_hwdep_send_cal(my_data);
@ -1106,6 +1109,7 @@ void platform_deinit(void *platform)
free(platform);
/* deinit usb */
audio_extn_usb_deinit();
audio_extn_dap_hal_deinit();
}
const char *platform_get_snd_device_name(snd_device_t snd_device)