Merge "hal: update compress offload pcm device ID" into av-userspace.lnx.1.0-dev.1.0
diff --git a/Android.mk b/Android.mk
index 58cf834..b081de0 100644
--- a/Android.mk
+++ b/Android.mk
@@ -1,4 +1,4 @@
-ifneq ($(filter mpq8092 msm8960 msm8226 msm8x26 msm8610 msm8974 msm8x74 apq8084 msm8916 msm8994 msm8992 msm8909 msm8996 msm8952 msm8937 thorium titanium msmgold,$(TARGET_BOARD_PLATFORM)),)
+ifneq ($(filter mpq8092 msm8960 msm8226 msm8x26 msm8610 msm8974 msm8x74 apq8084 msm8916 msm8994 msm8992 msm8909 msm8996 msm8952 msm8937 thorium msm8953 msmgold,$(TARGET_BOARD_PLATFORM)),)
MY_LOCAL_PATH := $(call my-dir)
diff --git a/hal/Android.mk b/hal/Android.mk
index ea54bd5..4f0affa 100644
--- a/hal/Android.mk
+++ b/hal/Android.mk
@@ -32,7 +32,7 @@
endif
endif
-ifneq ($(filter msm8916 msm8909 msm8952 msm8937 thorium titanium msmgold,$(TARGET_BOARD_PLATFORM)),)
+ifneq ($(filter msm8916 msm8909 msm8952 msm8937 thorium msm8953 msmgold,$(TARGET_BOARD_PLATFORM)),)
AUDIO_PLATFORM = msm8916
MULTIPLE_HW_VARIANTS_ENABLED := true
LOCAL_CFLAGS := -DPLATFORM_MSM8916
@@ -282,6 +282,8 @@
LOCAL_SHARED_LIBRARIES += libperipheral_client
endif
+LOCAL_CFLAGS += -Wall -Werror
+
LOCAL_COPY_HEADERS_TO := mm-audio
LOCAL_COPY_HEADERS := audio_extn/audio_defs.h
diff --git a/hal/audio_extn/audio_extn.c b/hal/audio_extn/audio_extn.c
index b8b8b85..db91b51 100644
--- a/hal/audio_extn/audio_extn.c
+++ b/hal/audio_extn/audio_extn.c
@@ -222,7 +222,7 @@
#else
void audio_extn_source_track_set_parameters(struct audio_device *adev,
struct str_parms *parms);
-void audio_extn_source_track_get_parameters(struct audio_device *adev,
+void audio_extn_source_track_get_parameters(const struct audio_device *adev,
struct str_parms *query,
struct str_parms *reply);
#endif
@@ -764,6 +764,7 @@
audio_extn_hpx_set_parameters(adev, parms);
audio_extn_pm_set_parameters(parms);
audio_extn_source_track_set_parameters(adev, parms);
+ audio_extn_fbsp_set_parameters(parms);
check_and_set_hdmi_connection_status(parms);
if (adev->offload_effects_set_parameters != NULL)
adev->offload_effects_set_parameters(parms);
@@ -781,6 +782,7 @@
audio_extn_dts_eagle_get_parameters(adev, query, reply);
audio_extn_hpx_get_parameters(query, reply);
audio_extn_source_track_get_parameters(adev, query, reply);
+ audio_extn_fbsp_get_parameters(query, reply);
if (adev->offload_effects_get_parameters != NULL)
adev->offload_effects_get_parameters(query, reply);
@@ -1110,7 +1112,8 @@
{
if (!perf_lock_opts || !size || !perf_lock_acq || !handle) {
- ALOGE("%s: Invalid arguments", __func__);
+ ALOGE("%s: Incorrect params, Failed to acquire perf lock, err ",
+ __func__);
return;
}
/*
diff --git a/hal/audio_extn/audio_extn.h b/hal/audio_extn/audio_extn.h
index 123752a..8980026 100644
--- a/hal/audio_extn/audio_extn.h
+++ b/hal/audio_extn/audio_extn.h
@@ -298,6 +298,8 @@
#define audio_extn_spkr_prot_stop_processing(snd_device) (0)
#define audio_extn_spkr_prot_is_enabled() (false)
#define audio_extn_spkr_prot_set_parameters(parms, value, len) (0)
+#define audio_extn_fbsp_set_parameters(parms) (0)
+#define audio_extn_fbsp_get_parameters(query, reply) (0)
#else
void audio_extn_spkr_prot_init(void *adev);
int audio_extn_spkr_prot_start_processing(snd_device_t snd_device);
@@ -306,6 +308,9 @@
void audio_extn_spkr_prot_calib_cancel(void *adev);
void audio_extn_spkr_prot_set_parameters(struct str_parms *parms,
char *value, int len);
+int audio_extn_fbsp_set_parameters(struct str_parms *parms);
+int audio_extn_fbsp_get_parameters(struct str_parms *query,
+ struct str_parms *reply);
#endif
#ifndef COMPRESS_CAPTURE_ENABLED
diff --git a/hal/audio_extn/dolby.c b/hal/audio_extn/dolby.c
index c8bf543..115057c 100644
--- a/hal/audio_extn/dolby.c
+++ b/hal/audio_extn/dolby.c
@@ -655,7 +655,8 @@
ds2extnmod.dap_hal_set_hw_info(SND_CARD, (void*)(&snd_card));
ALOGV("%s Sound card number is:%d",__func__,snd_card);
- platform_get_device_to_be_id_map(&device_be_id_map.device_id_to_be_id, &device_be_id_map.len);
+ platform_get_device_to_be_id_map((int**)&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);
ret = 0;
@@ -771,8 +772,9 @@
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__);
+ ALOGE("%s: dap_hal_set_hw_info is NULL", __func__);
}
+ return;
}
diff --git a/hal/audio_extn/soundtrigger.c b/hal/audio_extn/soundtrigger.c
index 3c16c88..8882b90 100644
--- a/hal/audio_extn/soundtrigger.c
+++ b/hal/audio_extn/soundtrigger.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2013-2014, 2016 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
@@ -174,7 +174,7 @@
struct sound_trigger_info *st_ses_info = NULL;
audio_event_info_t event;
- if (!st_dev || !in)
+ if (!st_dev || !in || !in->is_st_session_active)
return;
pthread_mutex_lock(&st_dev->lock);
@@ -184,6 +184,7 @@
event.u.ses_info = st_ses_info->st_ses;
ALOGV("%s: AUDIO_EVENT_STOP_LAB pcm %p", __func__, st_ses_info->st_ses.pcm);
st_dev->st_callback(AUDIO_EVENT_STOP_LAB, &event);
+ in->is_st_session_active = false;
}
}
void audio_extn_sound_trigger_check_and_get_session(struct stream_in *in)
diff --git a/hal/audio_extn/source_track.c b/hal/audio_extn/source_track.c
index 316e52d..8bf4c67 100644
--- a/hal/audio_extn/source_track.c
+++ b/hal/audio_extn/source_track.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2015-2016, 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
@@ -91,8 +91,8 @@
#define MAX_SECTORS 8
#define MAX_STR_SIZE 2048
-struct audio_device_to_audio_interface audio_device_to_interface_table[];
-int audio_device_to_interface_table_len;
+extern struct audio_device_to_audio_interface audio_device_to_interface_table[];
+extern int audio_device_to_interface_table_len;
struct sound_focus_param {
uint16_t start_angle[MAX_SECTORS];
@@ -203,7 +203,7 @@
return in_device;
}
-static int derive_mixer_ctl_from_usecase_intf(struct audio_device *adev,
+static int derive_mixer_ctl_from_usecase_intf(const struct audio_device *adev,
char *mixer_ctl_name) {
struct audio_usecase *usecase = NULL;
audio_devices_t in_device;
@@ -330,7 +330,7 @@
return ret;
}
-static int get_soundfocus_sourcetracking_data(struct audio_device *adev,
+static int get_soundfocus_sourcetracking_data(const struct audio_device *adev,
const int bitmask,
struct sound_focus_param *sound_focus_data,
struct source_tracking_param *source_tracking_data)
@@ -496,7 +496,7 @@
}
}
-void audio_extn_source_track_get_parameters(struct audio_device *adev,
+void audio_extn_source_track_get_parameters(const struct audio_device *adev,
struct str_parms *query,
struct str_parms *reply)
{
diff --git a/hal/audio_extn/spkr_protection.c b/hal/audio_extn/spkr_protection.c
index 2a246cd..1335ee9 100644
--- a/hal/audio_extn/spkr_protection.c
+++ b/hal/audio_extn/spkr_protection.c
@@ -103,6 +103,12 @@
#define AUDIO_PARAMETER_KEY_SPKR_TZ_1 "spkr_1_tz_name"
#define AUDIO_PARAMETER_KEY_SPKR_TZ_2 "spkr_2_tz_name"
+#define AUDIO_PARAMETER_KEY_FBSP_TRIGGER_SPKR_CAL "trigger_spkr_cal"
+#define AUDIO_PARAMETER_KEY_FBSP_GET_SPKR_CAL "get_spkr_cal"
+#define AUDIO_PARAMETER_KEY_FBSP_CFG_WAIT_TIME "fbsp_cfg_wait_time"
+#define AUDIO_PARAMETER_KEY_FBSP_CFG_FTM_TIME "fbsp_cfg_ftm_time"
+#define AUDIO_PARAMETER_KEY_FBSP_GET_FTM_PARAM "get_ftm_param"
+
/*Modes of Speaker Protection*/
enum speaker_protection_mode {
SPKR_PROTECTION_DISABLED = -1,
@@ -138,6 +144,9 @@
bool wsa_found;
int spkr_1_tzn;
int spkr_2_tzn;
+ bool trigger_cal;
+ pthread_mutex_t cal_wait_cond_mutex;
+ pthread_cond_t cal_wait_condition;
};
static struct pcm_config pcm_config_skr_prot = {
@@ -274,14 +283,15 @@
ALOGE("%s: Invalid params", __func__);
return true;
}
- if (handle.spkr_in_use) {
+ if (handle.spkr_in_use) {
*sec = 0;
- return true;
- } else {
- clock_gettime(CLOCK_BOOTTIME, &temp);
- *sec = temp.tv_sec - handle.spkr_last_time_used.tv_sec;
- return false;
- }
+ handle.trigger_cal = false;
+ return true;
+ } else {
+ clock_gettime(CLOCK_BOOTTIME, &temp);
+ *sec = temp.tv_sec - handle.spkr_last_time_used.tv_sec;
+ return false;
+ }
}
@@ -448,6 +458,8 @@
uc_info_rx->out_snd_device = SND_DEVICE_OUT_SPEAKER_PROTECTED;
disable_rx = true;
list_add_tail(&adev->usecase_list, &uc_info_rx->list);
+ platform_check_and_set_codec_backend_cfg(adev, uc_info_rx,
+ uc_info_rx->out_snd_device);
if (audio_extn_is_vbat_enabled())
enable_snd_device(adev, SND_DEVICE_OUT_SPEAKER_PROTECTED_VBAT);
else
@@ -537,15 +549,6 @@
ALOGD("%s: spkr_prot_thread calib Success R0 %d %d",
__func__, status.r0[SP_V2_SPKR_1], status.r0[SP_V2_SPKR_2]);
FILE *fp;
-
- vi_feed_no_channels = vi_feed_get_channels(adev);
- ALOGD("%s: vi_feed_no_channels %d", __func__, vi_feed_no_channels);
- if (vi_feed_no_channels < 0) {
- ALOGE("%s: no of channels negative !!", __func__);
- /* limit the number of channels to 2*/
- vi_feed_no_channels = 2;
- }
-
fp = fopen(CALIB_FILE,"wb");
if (!fp) {
ALOGE("%s: spkr_prot_thread File open failed %s",
@@ -636,6 +639,19 @@
return status.status;
}
+static void spkr_calibrate_wait()
+{
+ struct timespec ts;
+
+ clock_gettime(CLOCK_REALTIME, &ts);
+ ts.tv_sec += WAKEUP_MIN_IDLE_CHECK;
+ ts.tv_nsec = 0;
+ pthread_mutex_lock(&handle.cal_wait_cond_mutex);
+ pthread_cond_timedwait(&handle.cal_wait_condition,
+ &handle.cal_wait_cond_mutex, &ts);
+ pthread_mutex_unlock(&handle.cal_wait_cond_mutex);
+}
+
static void* spkr_calibration_thread()
{
unsigned long sec = 0;
@@ -689,14 +705,6 @@
if (fp) {
int i;
bool spkr_calibrated = true;
- /* HAL for speaker protection is always calibrating for stereo usecase*/
- vi_feed_no_channels = vi_feed_get_channels(adev);
- ALOGD("%s: vi_feed_no_channels %d", __func__, vi_feed_no_channels);
- if (vi_feed_no_channels < 0) {
- ALOGE("%s: no of channels negative !!", __func__);
- /* limit the number of channels to 2*/
- vi_feed_no_channels = 2;
- }
for (i = 0; i < vi_feed_no_channels; i++) {
fread(&protCfg.r0[i], sizeof(protCfg.r0[i]), 1, fp);
fread(&protCfg.t0[i], sizeof(protCfg.t0[i]), 1, fp);
@@ -741,13 +749,13 @@
if (is_speaker_in_use(&sec)) {
ALOGV("%s: WSA Speaker in use retry calibration", __func__);
pthread_mutex_unlock(&adev->lock);
- sleep(WAKEUP_MIN_IDLE_CHECK);
+ spkr_calibrate_wait();
continue;
} else {
ALOGD("%s: wsa speaker idle %ld,minimum time %ld", __func__, sec, min_idle_time);
- if (sec < min_idle_time) {
+ if (!(sec > min_idle_time || handle.trigger_cal)) {
pthread_mutex_unlock(&adev->lock);
- sleep(WAKEUP_MIN_IDLE_CHECK);
+ spkr_calibrate_wait();
continue;
}
goahead = true;
@@ -755,7 +763,7 @@
if (!list_empty(&adev->usecase_list)) {
ALOGD("%s: Usecase active re-try calibration", __func__);
pthread_mutex_unlock(&adev->lock);
- sleep(WAKEUP_MIN_IDLE_CHECK);
+ spkr_calibrate_wait();
continue;
}
if (goahead) {
@@ -776,7 +784,7 @@
if (t0_spk_1 < TZ_TEMP_MIN_THRESHOLD ||
t0_spk_1 > TZ_TEMP_MAX_THRESHOLD) {
pthread_mutex_unlock(&adev->lock);
- sleep(WAKEUP_MIN_IDLE_CHECK);
+ spkr_calibrate_wait();
continue;
}
ALOGD("%s: temp T0 for spkr1 %d\n", __func__, t0_spk_1);
@@ -799,7 +807,7 @@
if (t0_spk_2 < TZ_TEMP_MIN_THRESHOLD ||
t0_spk_2 > TZ_TEMP_MAX_THRESHOLD) {
pthread_mutex_unlock(&adev->lock);
- sleep(WAKEUP_MIN_IDLE_CHECK);
+ spkr_calibrate_wait();
continue;
}
ALOGD("%s: temp T0 for spkr2 %d\n", __func__, t0_spk_2);
@@ -836,12 +844,12 @@
if (is_speaker_in_use(&sec)) {
ALOGV("%s: Speaker in use retry calibration", __func__);
pthread_mutex_unlock(&adev->lock);
- sleep(WAKEUP_MIN_IDLE_CHECK);
+ spkr_calibrate_wait();
continue;
} else {
- if (sec < min_idle_time) {
+ if (!(sec > min_idle_time || handle.trigger_cal)) {
pthread_mutex_unlock(&adev->lock);
- sleep(WAKEUP_MIN_IDLE_CHECK);
+ spkr_calibrate_wait();
continue;
}
goahead = true;
@@ -850,7 +858,7 @@
ALOGD("%s: Usecase active re-try calibration", __func__);
goahead = false;
pthread_mutex_unlock(&adev->lock);
- sleep(WAKEUP_MIN_IDLE_CHECK);
+ spkr_calibrate_wait();
continue;
}
if (goahead) {
@@ -923,6 +931,319 @@
tz_names.spkr_1_name, tz_names.spkr_2_name);
}
+static int spkr_vi_channels(struct audio_device *adev)
+{
+ int vi_channels;
+
+ vi_channels = vi_feed_get_channels(adev);
+ ALOGD("%s: vi_channels %d", __func__, vi_channels);
+ if (vi_channels < 0 || vi_channels > SP_V2_NUM_MAX_SPKRS) {
+ /* limit the number of channels to SP_V2_NUM_MAX_SPKRS */
+ vi_channels = SP_V2_NUM_MAX_SPKRS;
+ }
+ return vi_channels;
+}
+
+static void get_spkr_prot_thermal_cal(char *param)
+{
+ int i, status = 0;
+ int r0[SP_V2_NUM_MAX_SPKRS] = {0}, t0[SP_V2_NUM_MAX_SPKRS] = {0};
+ double dr0[SP_V2_NUM_MAX_SPKRS] = {0}, dt0[SP_V2_NUM_MAX_SPKRS] = {0};
+
+ FILE *fp = fopen(CALIB_FILE,"rb");
+ if (fp) {
+ for (i = 0; i < vi_feed_no_channels; i++) {
+ fread(&r0[i], sizeof(int), 1, fp);
+ fread(&t0[i], sizeof(int), 1, fp);
+ /* Convert from ADSP format to readable format */
+ dr0[i] = ((double)r0[i])/(1 << 24);
+ dt0[i] = ((double)t0[i])/(1 << 6);
+ }
+ ALOGV("%s: R0= %lf, %lf, T0= %lf, %lf",
+ __func__, dr0[0], dr0[1], dt0[0], dt0[1]);
+ fclose(fp);
+ } else {
+ ALOGE("%s: failed to open cal file\n", __func__);
+ status = -EINVAL;
+ }
+ sprintf(param, "SpkrCalStatus: %d; R0: %lf, %lf; T0: %lf, %lf",
+ status, dr0[SP_V2_SPKR_1], dr0[SP_V2_SPKR_2],
+ dt0[SP_V2_SPKR_1], dt0[SP_V2_SPKR_2]);
+ ALOGD("%s:: param = %s\n", __func__, param);
+
+ return;
+}
+
+#ifdef MSM_SPKR_PROT_IN_FTM_MODE
+
+static int set_spkr_prot_ftm_cfg(int wait_time, int ftm_time)
+{
+ int ret = 0;
+ struct audio_cal_sp_th_vi_ftm_cfg th_cal_data;
+ struct audio_cal_sp_ex_vi_ftm_cfg ex_cal_data;
+
+ int cal_fd = open("/dev/msm_audio_cal",O_RDWR | O_NONBLOCK);
+ if (cal_fd < 0) {
+ ALOGE("%s: open msm_acdb failed", __func__);
+ ret = -ENODEV;
+ goto done;
+ }
+
+ memset(&th_cal_data, 0, sizeof(th_cal_data));
+ th_cal_data.hdr.data_size = sizeof(th_cal_data);
+ th_cal_data.hdr.version = VERSION_0_0;
+ th_cal_data.hdr.cal_type = AFE_FB_SPKR_PROT_TH_VI_CAL_TYPE;
+ th_cal_data.hdr.cal_type_size = sizeof(th_cal_data.cal_type);
+ th_cal_data.cal_type.cal_hdr.version = VERSION_0_0;
+ th_cal_data.cal_type.cal_hdr.buffer_number = 0;
+ th_cal_data.cal_type.cal_info.wait_time[SP_V2_SPKR_1] = wait_time;
+ th_cal_data.cal_type.cal_info.wait_time[SP_V2_SPKR_2] = wait_time;
+ th_cal_data.cal_type.cal_info.ftm_time[SP_V2_SPKR_1] = ftm_time;
+ th_cal_data.cal_type.cal_info.ftm_time[SP_V2_SPKR_2] = ftm_time;
+ th_cal_data.cal_type.cal_info.mode = MSM_SPKR_PROT_IN_FTM_MODE; // FTM mode
+ th_cal_data.cal_type.cal_data.mem_handle = -1;
+
+ if (ioctl(cal_fd, AUDIO_SET_CALIBRATION, &th_cal_data))
+ ALOGE("%s: failed to set TH VI FTM_CFG, errno = %d", __func__, errno);
+
+ memset(&ex_cal_data, 0, sizeof(ex_cal_data));
+ ex_cal_data.hdr.data_size = sizeof(ex_cal_data);
+ ex_cal_data.hdr.version = VERSION_0_0;
+ ex_cal_data.hdr.cal_type = AFE_FB_SPKR_PROT_EX_VI_CAL_TYPE;
+ ex_cal_data.hdr.cal_type_size = sizeof(ex_cal_data.cal_type);
+ ex_cal_data.cal_type.cal_hdr.version = VERSION_0_0;
+ ex_cal_data.cal_type.cal_hdr.buffer_number = 0;
+ ex_cal_data.cal_type.cal_info.wait_time[SP_V2_SPKR_1] = wait_time;
+ ex_cal_data.cal_type.cal_info.wait_time[SP_V2_SPKR_2] = wait_time;
+ ex_cal_data.cal_type.cal_info.ftm_time[SP_V2_SPKR_1] = ftm_time;
+ ex_cal_data.cal_type.cal_info.ftm_time[SP_V2_SPKR_2] = ftm_time;
+ ex_cal_data.cal_type.cal_info.mode = MSM_SPKR_PROT_IN_FTM_MODE; // FTM mode
+ ex_cal_data.cal_type.cal_data.mem_handle = -1;
+
+ if (ioctl(cal_fd, AUDIO_SET_CALIBRATION, &ex_cal_data))
+ ALOGE("%s: failed to set EX VI FTM_CFG, ret = %d", __func__, errno);
+
+ if (cal_fd > 0)
+ close(cal_fd);
+done:
+ return ret;
+}
+
+static void get_spkr_prot_ftm_param(char *param)
+{
+ struct audio_cal_sp_th_vi_param th_vi_cal_data;
+ struct audio_cal_sp_ex_vi_param ex_vi_cal_data;
+ int i;
+ int ftm_status[SP_V2_NUM_MAX_SPKRS];
+ double rdc[SP_V2_NUM_MAX_SPKRS], temp[SP_V2_NUM_MAX_SPKRS];
+ double f[SP_V2_NUM_MAX_SPKRS], r[SP_V2_NUM_MAX_SPKRS], q[SP_V2_NUM_MAX_SPKRS];
+
+ int cal_fd = open("/dev/msm_audio_cal",O_RDWR | O_NONBLOCK);
+ if (cal_fd < 0) {
+ ALOGE("%s: open msm_acdb failed", __func__);
+ goto done;
+ }
+
+ memset(&th_vi_cal_data, 0, sizeof(th_vi_cal_data));
+ th_vi_cal_data.cal_type.cal_info.status[SP_V2_SPKR_1] = -EINVAL;
+ th_vi_cal_data.cal_type.cal_info.status[SP_V2_SPKR_2] = -EINVAL;
+ th_vi_cal_data.hdr.data_size = sizeof(th_vi_cal_data);
+ th_vi_cal_data.hdr.version = VERSION_0_0;
+ th_vi_cal_data.hdr.cal_type = AFE_FB_SPKR_PROT_TH_VI_CAL_TYPE;
+ th_vi_cal_data.hdr.cal_type_size = sizeof(th_vi_cal_data.cal_type);
+ th_vi_cal_data.cal_type.cal_hdr.version = VERSION_0_0;
+ th_vi_cal_data.cal_type.cal_hdr.buffer_number = 0;
+ th_vi_cal_data.cal_type.cal_data.mem_handle = -1;
+
+ if (ioctl(cal_fd, AUDIO_GET_CALIBRATION, &th_vi_cal_data))
+ ALOGE("%s: Error %d in getting th_vi_cal_data", __func__, errno);
+
+ memset(&ex_vi_cal_data, 0, sizeof(ex_vi_cal_data));
+ ex_vi_cal_data.cal_type.cal_info.status[SP_V2_SPKR_1] = -EINVAL;
+ ex_vi_cal_data.cal_type.cal_info.status[SP_V2_SPKR_2] = -EINVAL;
+ ex_vi_cal_data.hdr.data_size = sizeof(ex_vi_cal_data);
+ ex_vi_cal_data.hdr.version = VERSION_0_0;
+ ex_vi_cal_data.hdr.cal_type = AFE_FB_SPKR_PROT_EX_VI_CAL_TYPE;
+ ex_vi_cal_data.hdr.cal_type_size = sizeof(ex_vi_cal_data.cal_type);
+ ex_vi_cal_data.cal_type.cal_hdr.version = VERSION_0_0;
+ ex_vi_cal_data.cal_type.cal_hdr.buffer_number = 0;
+ ex_vi_cal_data.cal_type.cal_data.mem_handle = -1;
+
+ if (ioctl(cal_fd, AUDIO_GET_CALIBRATION, &ex_vi_cal_data))
+ ALOGE("%s: Error %d in getting ex_vi_cal_data", __func__, errno);
+
+ for (i = 0; i < vi_feed_no_channels; i++) {
+ /* Convert from ADSP format to readable format */
+ rdc[i] = ((double)th_vi_cal_data.cal_type.cal_info.r_dc_q24[i])/(1<<24);
+ temp[i] = ((double)th_vi_cal_data.cal_type.cal_info.temp_q22[i])/(1<<22);
+ f[i] = ((double)ex_vi_cal_data.cal_type.cal_info.freq_q20[i])/(1<<20);
+ r[i] = ((double)ex_vi_cal_data.cal_type.cal_info.resis_q24[i])/(1<<24);
+ q[i] = ((double)ex_vi_cal_data.cal_type.cal_info.qmct_q24[i])/(1<<24);
+
+ if (th_vi_cal_data.cal_type.cal_info.status[i] == 0 &&
+ ex_vi_cal_data.cal_type.cal_info.status[i] == 0) {
+ ftm_status[i] = 0;
+ } else if (th_vi_cal_data.cal_type.cal_info.status[i] == -EAGAIN &&
+ ex_vi_cal_data.cal_type.cal_info.status[i] == -EAGAIN) {
+ ftm_status[i] = -EAGAIN;
+ } else {
+ ftm_status[i] = -EINVAL;
+ }
+ }
+ sprintf(param, "SpkrParamStatus: %d, %d; Rdc: %lf, %lf; Temp: %lf, %lf;"
+ " Freq: %lf, %lf; Rect: %lf, %lf; Qmct: %lf, %lf",
+ ftm_status[SP_V2_SPKR_1], ftm_status[SP_V2_SPKR_2],
+ rdc[SP_V2_SPKR_1], rdc[SP_V2_SPKR_2], temp[SP_V2_SPKR_1],
+ temp[SP_V2_SPKR_2], f[SP_V2_SPKR_1], f[SP_V2_SPKR_2],
+ r[SP_V2_SPKR_1], r[SP_V2_SPKR_2], q[SP_V2_SPKR_1], q[SP_V2_SPKR_2]);
+ ALOGD("%s:: param = %s\n", __func__, param);
+
+ if (cal_fd > 0)
+ close(cal_fd);
+done:
+ return;
+}
+
+#else
+
+static void get_spkr_prot_ftm_param(char *param __unused)
+{
+
+ ALOGD("%s: not supported", __func__);
+ return;
+}
+
+static int set_spkr_prot_ftm_cfg(int wait_time __unused, int ftm_time __unused)
+{
+ ALOGD("%s: not supported", __func__);
+ return -ENOSYS;
+}
+#endif
+
+static void spkr_calibrate_signal()
+{
+ pthread_mutex_lock(&handle.cal_wait_cond_mutex);
+ pthread_cond_signal(&handle.cal_wait_condition);
+ pthread_mutex_unlock(&handle.cal_wait_cond_mutex);
+}
+
+int audio_extn_fbsp_set_parameters(struct str_parms *parms)
+{
+ int ret= 0 , err;
+ char *str;
+ char *value = NULL;
+ int val, len, i;
+ char *test_r = NULL;
+ char *cfg_str;
+ int wait_time, ftm_time;
+ char *kv_pairs = str_parms_to_str(parms);
+
+ if(kv_pairs == NULL) {
+ ret = -ENOMEM;
+ ALOGE("[%s] key-value pair is NULL",__func__);
+ goto done;
+ }
+ ALOGV_IF(kv_pairs != NULL, "%s: enter: %s", __func__, kv_pairs);
+
+ len = strlen(kv_pairs);
+ value = (char*)calloc(len, sizeof(char));
+ if(value == NULL) {
+ ret = -ENOMEM;
+ ALOGE("[%s] failed to allocate memory",__func__);
+ goto done;
+ }
+ if (!handle.spkr_prot_enable) {
+ ALOGD("%s: Speaker protection disabled", __func__);
+ goto done;
+ }
+
+ err = str_parms_get_str(parms, AUDIO_PARAMETER_KEY_FBSP_TRIGGER_SPKR_CAL, value,
+ len);
+ if (err >= 0) {
+ str_parms_del(parms, AUDIO_PARAMETER_KEY_FBSP_TRIGGER_SPKR_CAL);
+ if ((strcmp(value, "true") == 0) || (strcmp(value, "yes") == 0)) {
+ handle.trigger_cal = true;
+ spkr_calibrate_signal();
+ }
+ goto done;
+ }
+
+ /* Expected key value pair is in below format:
+ * AUDIO_PARAM_FBSP_CFG_WAIT_TIME=waittime;AUDIO_PARAM_FBSP_CFG_FTM_TIME=ftmtime;
+ * Parse waittime and ftmtime from it.
+ */
+ err = str_parms_get_str(parms, AUDIO_PARAMETER_KEY_FBSP_CFG_WAIT_TIME,
+ value, len);
+ if (err >= 0) {
+ str_parms_del(parms, AUDIO_PARAMETER_KEY_FBSP_CFG_WAIT_TIME);
+ cfg_str = strtok_r(value, ";", &test_r);
+ if (cfg_str == NULL) {
+ ALOGE("%s: incorrect wait time cfg_str", __func__);
+ ret = -EINVAL;
+ goto done;
+ }
+ wait_time = atoi(cfg_str);
+ ALOGV(" %s: cfg_str = %s, wait_time = %d", __func__, cfg_str, wait_time);
+
+ err = str_parms_get_str(parms, AUDIO_PARAMETER_KEY_FBSP_CFG_FTM_TIME,
+ value, len);
+ if (err >= 0) {
+ str_parms_del(parms, AUDIO_PARAMETER_KEY_FBSP_CFG_FTM_TIME);
+ cfg_str = strtok_r(value, ";", &test_r);
+ if (cfg_str == NULL) {
+ ALOGE("%s: incorrect ftm time cfg_str", __func__);
+ ret = -EINVAL;
+ goto done;
+ }
+ ftm_time = atoi(cfg_str);
+ ALOGV(" %s: cfg_str = %s, ftm_time = %d", __func__, cfg_str, ftm_time);
+
+ ret = set_spkr_prot_ftm_cfg(wait_time, ftm_time);
+ if (ret < 0) {
+ ALOGE("%s: set_spkr_prot_ftm_cfg failed", __func__);
+ goto done;
+ }
+ }
+ }
+
+done:
+ ALOGV("%s: exit with code(%d)", __func__, ret);
+
+ if(kv_pairs != NULL)
+ free(kv_pairs);
+ if(value != NULL)
+ free(value);
+
+ return ret;
+}
+
+int audio_extn_fbsp_get_parameters(struct str_parms *query,
+ struct str_parms *reply)
+{
+ int err = 0;
+ char value[1024] = {0};
+
+ if (!handle.spkr_prot_enable) {
+ ALOGD("%s: Speaker protection disabled", __func__);
+ return -EINVAL;
+ }
+
+ err = str_parms_get_str(query, AUDIO_PARAMETER_KEY_FBSP_GET_SPKR_CAL, value,
+ sizeof(value));
+ if (err >= 0) {
+ get_spkr_prot_thermal_cal(value);
+ str_parms_add_str(reply, AUDIO_PARAMETER_KEY_FBSP_GET_SPKR_CAL, value);
+ }
+ err = str_parms_get_str(query, AUDIO_PARAMETER_KEY_FBSP_GET_FTM_PARAM, value,
+ sizeof(value));
+ if (err >= 0) {
+ get_spkr_prot_ftm_param(value);
+ str_parms_add_str(reply, AUDIO_PARAMETER_KEY_FBSP_GET_FTM_PARAM, value);
+ }
+done:
+ return err;
+}
+
void audio_extn_spkr_prot_init(void *adev)
{
char value[PROPERTY_VALUE_MAX];
@@ -944,6 +1265,11 @@
handle.spkr_prot_mode = MSM_SPKR_PROT_DISABLED;
handle.spkr_processing_state = SPKR_PROCESSING_IN_IDLE;
handle.spkr_prot_t0 = -1;
+ handle.trigger_cal = false;
+ /* HAL for speaker protection is always calibrating for stereo usecase*/
+ vi_feed_no_channels = spkr_vi_channels(adev);
+ pthread_cond_init(&handle.cal_wait_condition, NULL);
+ pthread_mutex_init(&handle.cal_wait_cond_mutex, NULL);
if (is_wsa_present()) {
if (platform_spkr_prot_is_wsa_analog_mode(adev) == 1) {
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index e4b8a37..f18d4cf 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -714,13 +714,15 @@
specified usecase to new snd devices */
list_for_each(node, &adev->usecase_list) {
usecase = node_to_item(node, struct audio_usecase, list);
- /* Update the out_snd_device only for the usecases that are enabled here */
- if (switch_device[usecase->id] && (usecase->type != VOICE_CALL)) {
- usecase->out_snd_device = snd_device;
+ /* Update the out_snd_device only before enabling the audio route */
+ if (switch_device[usecase->id]) {
+ usecase->out_snd_device = snd_device;
+ if (usecase->type != VOICE_CALL) {
ALOGD("%s:becf: enabling usecase (%s) on (%s)", __func__,
- use_case_table[usecase->id],
- platform_get_snd_device_name(usecase->out_snd_device));
+ use_case_table[usecase->id],
+ platform_get_snd_device_name(usecase->out_snd_device));
enable_audio_route(adev, usecase);
+ }
}
}
}
@@ -754,7 +756,8 @@
usecase != uc_info &&
usecase->in_snd_device != snd_device &&
((uc_info->devices & AUDIO_DEVICE_OUT_ALL_CODEC_BACKEND) &&
- ((usecase->devices & ~AUDIO_DEVICE_BIT_IN) & AUDIO_DEVICE_IN_ALL_CODEC_BACKEND)) &&
+ (((usecase->devices & ~AUDIO_DEVICE_BIT_IN) & AUDIO_DEVICE_IN_ALL_CODEC_BACKEND) ||
+ (usecase->type == VOICE_CALL))) &&
(usecase->id != USECASE_AUDIO_SPKR_CALIB_TX)) {
ALOGV("%s: Usecase (%s) is active on (%s) - disabling ..",
__func__, use_case_table[usecase->id],
@@ -834,7 +837,7 @@
return ret;
}
-audio_usecase_t get_usecase_id_from_usecase_type(struct audio_device *adev,
+audio_usecase_t get_usecase_id_from_usecase_type(const struct audio_device *adev,
usecase_type_t type)
{
struct audio_usecase *usecase;
@@ -850,7 +853,7 @@
return USECASE_INVALID;
}
-struct audio_usecase *get_usecase_from_list(struct audio_device *adev,
+struct audio_usecase *get_usecase_from_list(const struct audio_device *adev,
audio_usecase_t uc_id)
{
struct audio_usecase *usecase;
@@ -912,7 +915,9 @@
if (is_offload_usecase(usecase->id) &&
(usecase->stream.out) &&
- (usecase->stream.out->sample_rate == OUTPUT_SAMPLING_RATE_44100)) {
+ (usecase->stream.out->sample_rate == OUTPUT_SAMPLING_RATE_44100) &&
+ (usecase->stream.out->devices == AUDIO_DEVICE_OUT_WIRED_HEADSET ||
+ usecase->stream.out->devices == AUDIO_DEVICE_OUT_WIRED_HEADPHONE)) {
is_it_true_mode = (NATIVE_AUDIO_MODE_TRUE_44_1 == platform_get_native_support()? true : false);
if ((is_it_true_mode && !adev->native_playback_enabled) ||
(!is_it_true_mode && adev->native_playback_enabled)){
@@ -1338,7 +1343,7 @@
{
audio_usecase_t ret_uc = USECASE_INVALID;
unsigned int offload_uc_index;
- int num_usecase = sizeof(offload_usecases)/sizeof(offload_usecases[0]);
+ unsigned int num_usecase = sizeof(offload_usecases)/sizeof(offload_usecases[0]);
if (!adev->multi_offload_enable) {
if (is_direct_pcm)
ret_uc = USECASE_AUDIO_PLAYBACK_OFFLOAD2;
@@ -1370,7 +1375,7 @@
audio_usecase_t uc_id)
{
unsigned int offload_uc_index;
- int num_usecase = sizeof(offload_usecases)/sizeof(offload_usecases[0]);
+ unsigned int num_usecase = sizeof(offload_usecases)/sizeof(offload_usecases[0]);
if (!adev->multi_offload_enable)
return;
@@ -2346,7 +2351,7 @@
}
if (adev->is_channel_status_set == false && (out->devices & AUDIO_DEVICE_OUT_AUX_DIGITAL)){
- audio_utils_set_hdmi_channel_status(out, buffer, bytes);
+ audio_utils_set_hdmi_channel_status(out, (void *)buffer, bytes);
adev->is_channel_status_set = true;
}
@@ -2426,7 +2431,7 @@
if (ret != 0) {
if (out->pcm)
- ALOGE("%s: error %zu - %s", __func__, ret, pcm_get_error(out->pcm));
+ ALOGE("%s: error %d, %s", __func__, (int)ret, pcm_get_error(out->pcm));
if (out->usecase == USECASE_COMPRESS_VOIP_CALL) {
pthread_mutex_lock(&adev->lock);
voice_extn_compress_voip_close_output_stream(&out->stream.common);
@@ -3128,7 +3133,7 @@
}
if (out->usecase == USECASE_INVALID) {
- ALOGE("%s: Max allowed OFFLOAD usecase reached ... ");
+ ALOGE("%s, Max allowed OFFLOAD usecase reached ... ", __func__);
ret = -EEXIST;
goto error_open;
}
@@ -3429,6 +3434,8 @@
struct audio_usecase *usecase;
ALOGD("Received sound card OFFLINE status");
set_snd_card_state(adev,SND_CARD_STATE_OFFLINE);
+ //close compress sessions on OFFLINE status
+ close_compress_sessions(adev);
} else if (strstr(snd_card_status, "ONLINE")) {
ALOGD("Received sound card ONLINE status");
set_snd_card_state(adev,SND_CARD_STATE_ONLINE);
@@ -3829,6 +3836,10 @@
audio_extn_compr_cap_format_supported(in->config.format))
audio_extn_compr_cap_deinit();
+ if (in->is_st_session) {
+ ALOGV("%s: sound trigger pcm stop lab", __func__);
+ audio_extn_sound_trigger_stop_lab(in);
+ }
free(stream);
return;
}
diff --git a/hal/audio_hw.h b/hal/audio_hw.h
index 47c9070..a7d4483 100644
--- a/hal/audio_hw.h
+++ b/hal/audio_hw.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2016, The Linux Foundation. All rights reserved.
* Not a contribution.
*
* Copyright (C) 2013 The Android Open Source Project
@@ -373,7 +373,7 @@
int enable_audio_route(struct audio_device *adev,
struct audio_usecase *usecase);
-struct audio_usecase *get_usecase_from_list(struct audio_device *adev,
+struct audio_usecase *get_usecase_from_list(const struct audio_device *adev,
audio_usecase_t uc_id);
bool is_offload_usecase(audio_usecase_t uc_id);
@@ -383,7 +383,7 @@
int pcm_ioctl(struct pcm *pcm, int request, ...);
int get_snd_card_state(struct audio_device *adev);
-audio_usecase_t get_usecase_id_from_usecase_type(struct audio_device *adev,
+audio_usecase_t get_usecase_id_from_usecase_type(const struct audio_device *adev,
usecase_type_t type);
#define LITERAL_TO_STRING(x) #x
diff --git a/hal/msm8916/platform.c b/hal/msm8916/platform.c
index 2f9c2e8..fe502da 100644
--- a/hal/msm8916/platform.c
+++ b/hal/msm8916/platform.c
@@ -1303,7 +1303,7 @@
backend_table[SND_DEVICE_OUT_VOICE_SPEAKER_VBAT] = strdup("vbat-voice-speaker");
/*remove ALAC & APE from DSP decoder list based on software decoder availability*/
- for (count = 0; count < sizeof(dsp_only_decoders_mime)/sizeof(dsp_only_decoders_mime[0]);
+ for (count = 0; count < (int32_t) (sizeof(dsp_only_decoders_mime)/sizeof(dsp_only_decoders_mime[0]));
count++) {
if (!strncmp(MEDIA_MIMETYPE_AUDIO_ALAC, dsp_only_decoders_mime[count],
@@ -1619,10 +1619,10 @@
/* update wsa combo supported flag based on sound card name */
/* wsa combo flag needs to be set to true only for hardware
combinations which has support for both wsa and non-wsa speaker */
- if (snd_card_name && (!strncmp(snd_card_name, "msm8953-snd-card-mtp",
+ if (snd_card_name && ((!strncmp(snd_card_name, "msm8953-snd-card-mtp",
sizeof("msm8953-snd-card-mtp"))) ||
- !strncmp(snd_card_name, "msm8952-skum-snd-card",
- sizeof("msm8952-skum-snd-card"))) {
+ (!strncmp(snd_card_name, "msm8952-skum-snd-card",
+ sizeof("msm8952-skum-snd-card"))))) {
*is_wsa_combo_supported = true;
} else {
*is_wsa_combo_supported = false;
@@ -1763,7 +1763,7 @@
}
}
- if (check_and_get_wsa_info(snd_card_name, &wsaCount, &is_wsa_combo_supported)) {
+ if (check_and_get_wsa_info((char *)snd_card_name, &wsaCount, &is_wsa_combo_supported)) {
/*Set ACDB ID of Stereo speaker if two WSAs are present*/
/*Default ACDB ID for wsa speaker is that for mono*/
if (wsaCount == 2) {
@@ -2359,7 +2359,7 @@
OUTPUT_SAMPLING_RATE_44100 == usecase->stream.out->sample_rate) {
ALOGD("%s:napb: triggering dynamic device switch for usecase(%d: %s)"
" stream(%p), device(%d)", __func__, usecase->id,
- use_case_table[usecase->id], usecase->stream,
+ use_case_table[usecase->id], (void*) usecase->stream.out,
usecase->stream.out->devices);
select_devices(platform->adev, usecase->id);
}
@@ -3467,7 +3467,7 @@
static void set_audiocal(void *platform, struct str_parms *parms, char *value, int len) {
struct platform_data *my_data = (struct platform_data *)platform;
- struct stream_out out={0};
+ struct stream_out out;
acdb_audio_cal_cfg_t cal={0};
uint8_t *dptr = NULL;
int32_t dlen;
@@ -3708,7 +3708,7 @@
static void get_audiocal(void *platform, void *keys, void *pReply) {
struct platform_data *my_data = (struct platform_data *)platform;
- struct stream_out out={0};
+ struct stream_out out;
struct str_parms *query = (struct str_parms *)keys;
struct str_parms *reply=(struct str_parms *)pReply;
acdb_audio_cal_cfg_t cal={0};
@@ -3857,7 +3857,7 @@
//check if unsupported mime type or not
if(decoder_mime_type) {
- int i = 0;
+ unsigned int i = 0;
for (i = 0; i < sizeof(dsp_only_decoders_mime)/sizeof(dsp_only_decoders_mime[0]); i++) {
if (!strncmp(decoder_mime_type, dsp_only_decoders_mime[i],
strlen(dsp_only_decoders_mime[i]))) {
@@ -4439,7 +4439,7 @@
void platform_get_device_to_be_id_map(int **device_to_be_id, int *length)
{
- *device_to_be_id = msm_device_to_be_id;
+ *device_to_be_id = (int*) msm_device_to_be_id;
*length = msm_be_id_array_len;
}
int platform_set_stream_channel_map(void *platform, audio_channel_mask_t channel_mask, int snd_id)
@@ -5019,7 +5019,7 @@
* corresponding entry in audio_platform_info.xml file.
*/
struct speaker_device_to_tz_names speaker_device_tz_names = {
- {SND_DEVICE_OUT_SPEAKER, "", ""},
+ SND_DEVICE_OUT_SPEAKER, "", ""
};
const char *platform_get_spkr_1_tz_name(snd_device_t snd_device)
@@ -5050,7 +5050,7 @@
goto done;
}
if (index != speaker_device_tz_names.snd_device) {
- ALOGE("%s: not matching speaker device\n");
+ ALOGE("%s: not matching speaker device\n", __func__);
ret = -EINVAL;
goto done;
}
@@ -5071,7 +5071,7 @@
int platform_spkr_prot_is_wsa_analog_mode(void *adev)
{
struct audio_device *adev_h = adev;
- char *snd_card_name;
+ const char *snd_card_name;
/*
* wsa analog mode is decided based on the sound card name
diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c
index 516179a..d9e7745 100644
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.c
@@ -1067,7 +1067,7 @@
/*remove ALAC & APE from DSP decoder list based on software decoder availability*/
- for (count = 0; count < sizeof(dsp_only_decoders_mime)/sizeof(dsp_only_decoders_mime[0]);
+ for (count = 0; count < (int32_t)(sizeof(dsp_only_decoders_mime)/sizeof(dsp_only_decoders_mime[0]));
count++) {
if (!strncmp(MEDIA_MIMETYPE_AUDIO_ALAC, dsp_only_decoders_mime[count],
@@ -1300,7 +1300,7 @@
char value[PROPERTY_VALUE_MAX];
struct platform_data *my_data = NULL;
int retry_num = 0, snd_card_num = 0, key = 0;
- const char *snd_card_name = NULL, *snd_card_name_t = NULL;
+ char *snd_card_name = NULL, *snd_card_name_t = NULL;
char *cvd_version = NULL;
char *snd_internal_name = NULL;
char *tmp = NULL;
@@ -1399,9 +1399,12 @@
if (!adev->audio_route) {
ALOGE("%s: Failed to init audio route controls, aborting.",
__func__);
- free(my_data);
- free(snd_card_name);
- free(snd_card_name_t);
+ if (my_data)
+ free(my_data);
+ if (snd_card_name)
+ free(snd_card_name);
+ if (snd_card_name_t)
+ free(snd_card_name_t);
mixer_close(adev->mixer);
return NULL;
}
@@ -1416,11 +1419,13 @@
if (snd_card_num >= MAX_SND_CARD) {
ALOGE("%s: Unable to find correct sound card, aborting.", __func__);
- free(my_data);
+ if (my_data)
+ free(my_data);
if (snd_card_name)
free(snd_card_name);
if (snd_card_name_t)
free(snd_card_name_t);
+ mixer_close(adev->mixer);
return NULL;
}
@@ -1891,6 +1896,7 @@
int platform_get_default_app_type_v2(void *platform, usecase_type_t type)
{
+ ALOGV("%s: Platform: %p, type: %d", __func__, platform, type);
if(type == PCM_CAPTURE)
return DEFAULT_APP_TYPE_TX_PATH;
else
@@ -2035,9 +2041,10 @@
(usecase->stream.out->devices & AUDIO_DEVICE_OUT_WIRED_HEADPHONE ||
usecase->stream.out->devices & AUDIO_DEVICE_OUT_WIRED_HEADSET) &&
OUTPUT_SAMPLING_RATE_44100 == usecase->stream.out->sample_rate) {
- ALOGD("%s:napb: triggering dynamic device switch for usecase(%d: %s)"
- " stream(%p), device(%d)", __func__, usecase->id,
- use_case_table[usecase->id], usecase->stream,
+ ALOGD("%s:napb: triggering dynamic device switch for usecase %d, %s"
+ " stream %p, device (%u)", __func__, usecase->id,
+ use_case_table[usecase->id],
+ (void*) usecase->stream.out,
usecase->stream.out->devices);
select_devices(platform->adev, usecase->id);
}
@@ -3540,7 +3547,7 @@
//check if unsupported mime type or not
if(decoder_mime_type) {
- int i = 0;
+ unsigned int i = 0;
for (i = 0; i < sizeof(dsp_only_decoders_mime)/sizeof(dsp_only_decoders_mime[0]); i++) {
if (!strncmp(decoder_mime_type, dsp_only_decoders_mime[i],
strlen(dsp_only_decoders_mime[i]))) {
@@ -3995,7 +4002,7 @@
void platform_get_device_to_be_id_map(int **device_to_be_id, int *length)
{
- *device_to_be_id = msm_device_to_be_id;
+ *device_to_be_id = (int*) msm_device_to_be_id;
*length = msm_be_id_array_len;
}
int platform_set_stream_channel_map(void *platform, audio_channel_mask_t channel_mask, int snd_id)
diff --git a/hal/voice.c b/hal/voice.c
index b10de17..d1db987 100644
--- a/hal/voice.c
+++ b/hal/voice.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2016, The Linux Foundation. All rights reserved.
* Not a contribution.
*
* Copyright (C) 2013 The Android Open Source Project
@@ -276,12 +276,12 @@
return call_state;
}
-bool voice_is_in_call(struct audio_device *adev)
+bool voice_is_in_call(const struct audio_device *adev)
{
return adev->voice.in_call;
}
-bool voice_is_in_call_rec_stream(struct stream_in *in)
+bool voice_is_in_call_rec_stream(const struct stream_in *in)
{
bool in_call_rec = false;
diff --git a/hal/voice.h b/hal/voice.h
index 7cb9e1a..efe48d8 100644
--- a/hal/voice.h
+++ b/hal/voice.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2016, The Linux Foundation. All rights reserved.
* Not a contribution.
*
* Copyright (C) 2013 The Android Open Source Project
@@ -81,8 +81,8 @@
void voice_get_parameters(struct audio_device *adev, struct str_parms *query,
struct str_parms *reply);
void voice_init(struct audio_device *adev);
-bool voice_is_in_call(struct audio_device *adev);
-bool voice_is_in_call_rec_stream(struct stream_in *in);
+bool voice_is_in_call(const struct audio_device *adev);
+bool voice_is_in_call_rec_stream(const struct stream_in *in);
int voice_set_mic_mute(struct audio_device *dev, bool state);
bool voice_get_mic_mute(struct audio_device *dev);
int voice_set_volume(struct audio_device *adev, float volume);
diff --git a/hal/voice_extn/compress_voip.c b/hal/voice_extn/compress_voip.c
index 1dcf865..61a7f3e 100644
--- a/hal/voice_extn/compress_voip.c
+++ b/hal/voice_extn/compress_voip.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2016, The Linux Foundation. All rights reserved.
* Not a contribution.
*
* Copyright (C) 2013 The Android Open Source Project
@@ -689,7 +689,7 @@
return false;
}
-bool voice_extn_compress_voip_is_active(struct audio_device *adev)
+bool voice_extn_compress_voip_is_active(const struct audio_device *adev)
{
struct audio_usecase *voip_usecase = NULL;
voip_usecase = get_usecase_from_list(adev, USECASE_COMPRESS_VOIP_CALL);
diff --git a/hal/voice_extn/voice_extn.h b/hal/voice_extn/voice_extn.h
index af0ad08..989ee79 100644
--- a/hal/voice_extn/voice_extn.h
+++ b/hal/voice_extn/voice_extn.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2014, 2016, The Linux Foundation. All rights reserved.
* Not a contribution.
*
* Copyright (C) 2013 The Android Open Source Project
@@ -142,7 +142,7 @@
struct str_parms *query,
struct str_parms *reply);
bool voice_extn_compress_voip_pcm_prop_check();
-bool voice_extn_compress_voip_is_active(struct audio_device *adev);
+bool voice_extn_compress_voip_is_active(const struct audio_device *adev);
bool voice_extn_compress_voip_is_format_supported(audio_format_t format);
bool voice_extn_compress_voip_is_config_supported(struct audio_config *config);
bool voice_extn_compress_voip_is_started(struct audio_device *adev);
diff --git a/policy_hal/Android.mk b/policy_hal/Android.mk
index 70814d8..811c2c9 100644
--- a/policy_hal/Android.mk
+++ b/policy_hal/Android.mk
@@ -27,6 +27,8 @@
LOCAL_STATIC_LIBRARIES := \
libmedia_helper \
+LOCAL_CFLAGS += -Wall -Werror
+
ifeq ($(strip $(AUDIO_FEATURE_ENABLED_VOICE_CONCURRENCY)),true)
LOCAL_CFLAGS += -DVOICE_CONCURRENCY
endif
diff --git a/policy_hal/AudioPolicyManager.cpp b/policy_hal/AudioPolicyManager.cpp
index dee4e8b..34527cb 100644
--- a/policy_hal/AudioPolicyManager.cpp
+++ b/policy_hal/AudioPolicyManager.cpp
@@ -656,7 +656,7 @@
/// Opens: can these line be executed after the switch of volume curves???
// if leaving call state, handle special case of active streams
// pertaining to sonification strategy see handleIncallSonification()
- if (isInCall()) {
+ if (isStateInCall(oldState)) {
ALOGV("setPhoneState() in call state management: new state is %d", state);
for (size_t j = 0; j < mOutputs.size(); j++) {
audio_io_handle_t curOutput = mOutputs.keyAt(j);
@@ -668,7 +668,7 @@
}
}
- // force reevaluating accessibility routing when call starts
+ // force reevaluating accessibility routing when call stops
mpClientInterface->invalidateStream(AUDIO_STREAM_ACCESSIBILITY);
}
@@ -944,6 +944,9 @@
handleIncallSonification((audio_stream_type_t)stream, true, true, curOutput);
}
}
+
+ // force reevaluating accessibility routing when call starts
+ mpClientInterface->invalidateStream(AUDIO_STREAM_ACCESSIBILITY);
}
// Flag that ringtone volume must be limited to music volume until we exit MODE_RINGTONE
@@ -1622,16 +1625,22 @@
// FIXME: We should check the audio session here but we do not have it in this context.
// This may prevent offloading in rare situations where effects are left active by apps
// in the background.
-
- if (((flags & AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD) == 0) &&
- !mEffects.isNonOffloadableEffectEnabled()) {
- profile = getProfileForDirectOutput(device,
- samplingRate,
- format,
- channelMask,
- (audio_output_flags_t)flags);
+ //
+ // Supplementary annotation:
+ // For sake of track offload introduced, we need a rollback for both compress offload
+ // and track offload use cases.
+ if ((flags & (AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD|AUDIO_OUTPUT_FLAG_DIRECT_PCM)) &&
+ mEffects.isNonOffloadableEffectEnabled()) {
+ ALOGD("non offloadable effect is enabled, try with non direct output");
+ goto non_direct_output;
}
+ profile = getProfileForDirectOutput(device,
+ samplingRate,
+ format,
+ channelMask,
+ (audio_output_flags_t)flags);
+
if (profile != 0) {
if (!(flags & AUDIO_OUTPUT_FLAG_DIRECT_PCM) &&
diff --git a/post_proc/Android.mk b/post_proc/Android.mk
index 527406b..e5f0824 100644
--- a/post_proc/Android.mk
+++ b/post_proc/Android.mk
@@ -81,7 +81,7 @@
################################################################################
-ifneq ($(filter msm8992 msm8994 msm8996 msm8952 msm8937 thorium titanium msmgold,$(TARGET_BOARD_PLATFORM)),)
+ifneq ($(filter msm8992 msm8994 msm8996 msm8952 msm8937 thorium msm8953 msmgold,$(TARGET_BOARD_PLATFORM)),)
include $(CLEAR_VARS)