Merge "hal: Add support for Native Audio(44.1kHz)"
diff --git a/hal/audio_extn/audio_extn.c b/hal/audio_extn/audio_extn.c
index ca5fd59..67d30ca 100644
--- a/hal/audio_extn/audio_extn.c
+++ b/hal/audio_extn/audio_extn.c
@@ -179,6 +179,7 @@
if (adev->offload_effects_set_hpx_state != NULL)
adev->offload_effects_set_hpx_state(hpx_state);
+ audio_extn_dts_eagle_fade(adev, aextnmod.hpx_enabled, NULL);
/* set HPX state on device pp */
ctl = mixer_get_ctl_by_name(adev->mixer, mixer_ctl_name);
if (ctl)
diff --git a/hal/audio_extn/audio_extn.h b/hal/audio_extn/audio_extn.h
index 98b2672..1f1058e 100644
--- a/hal/audio_extn/audio_extn.h
+++ b/hal/audio_extn/audio_extn.h
@@ -292,6 +292,7 @@
#define audio_extn_dts_eagle_set_parameters(adev, parms) (0)
#define audio_extn_dts_eagle_get_parameters(adev, query, reply) (0)
#define audio_extn_dts_eagle_fade(adev, fade_in, out) (0)
+#define audio_extn_dts_eagle_send_lic() (0)
#define audio_extn_dts_create_state_notifier_node(stream_out) (0)
#define audio_extn_dts_notify_playback_state(stream_out, has_video, sample_rate, \
channels, is_playing) (0)
@@ -303,6 +304,7 @@
int audio_extn_dts_eagle_get_parameters(const struct audio_device *adev,
struct str_parms *query, struct str_parms *reply);
int audio_extn_dts_eagle_fade(const struct audio_device *adev, bool fade_in, const struct stream_out *out);
+void audio_extn_dts_eagle_send_lic();
void audio_extn_dts_create_state_notifier_node(int stream_out);
void audio_extn_dts_notify_playback_state(int stream_out, int has_video, int sample_rate,
int channels, int is_playing);
diff --git a/hal/audio_extn/dts_eagle.c b/hal/audio_extn/dts_eagle.c
index 52d7abb..71bfea6 100644
--- a/hal/audio_extn/dts_eagle.c
+++ b/hal/audio_extn/dts_eagle.c
@@ -190,6 +190,28 @@
return 0;
}
+void audio_extn_dts_eagle_send_lic() {
+ char prop[PROPERTY_VALUE_MAX] = {0};
+ bool enabled;
+ property_get("use.dts_eagle", prop, "0");
+ enabled = !strncmp("true", prop, sizeof("true")) || atoi(prop);
+ if (!enabled)
+ return;
+ int fd = open(DEVICE_NODE, O_RDWR);
+ int index = 1;
+ if (fd >= 0) {
+ if (ioctl(fd, DTS_EAGLE_IOCTL_SEND_LICENSE, &index) < 0) {
+ ALOGE("DTS_EAGLE_HAL: error sending license after adsp ssr");
+ } else {
+ ALOGD("DTS_EAGLE_HAL: sent license after adsp ssr");
+ }
+ close(fd);
+ } else {
+ ALOGE("DTS_EAGLE_HAL: error opening eagle");
+ }
+ return;
+}
+
void audio_extn_dts_eagle_set_parameters(struct audio_device *adev, struct str_parms *parms) {
int ret, val;
char value[32] = { 0 }, prop[PROPERTY_VALUE_MAX];
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index 266dbd9..a07b01e 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -3144,6 +3144,8 @@
} else if (strstr(snd_card_status, "ONLINE")) {
ALOGD("Received sound card ONLINE status");
set_snd_card_state(adev,SND_CARD_STATE_ONLINE);
+ //send dts hpx license if enabled
+ audio_extn_dts_eagle_send_lic();
}
}
diff --git a/hal/msm8916/platform.c b/hal/msm8916/platform.c
index b9b0e28..4b970bd 100644
--- a/hal/msm8916/platform.c
+++ b/hal/msm8916/platform.c
@@ -3290,8 +3290,7 @@
// To have same PCM samples for all channels, the buffer size requires to
// be multiple of (number of channels * bytes per sample)
// For writes to succeed, the buffer must be written at address which is multiple of 32
- // Alignment of 96 satsfies both of the above requirements
- fragment_size = ALIGN(fragment_size, 96);
+ fragment_size = ALIGN(fragment_size, ((bits_per_sample >> 3)* popcount(info->channel_mask) * 32));
ALOGI("PCM offload Fragment size to %d bytes", fragment_size);
return fragment_size;
diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c
index 7b8f2d3..09dbd01 100644
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.c
@@ -3047,15 +3047,14 @@
* info->sample_rate
* (bits_per_sample >> 3)
* popcount(info->channel_mask))/1000;
- // To have same PCM samples for all channels, the buffer size requires to
- // be multiple of (number of channels * bytes per sample)
- // For writes to succeed, the buffer must be written at address which is multiple of 32
- // Alignment of 96 satsfies both of the above requirements
- fragment_size = ALIGN(fragment_size, 96);
if(fragment_size < MIN_PCM_OFFLOAD_FRAGMENT_SIZE)
fragment_size = MIN_PCM_OFFLOAD_FRAGMENT_SIZE;
else if(fragment_size > MAX_PCM_OFFLOAD_FRAGMENT_SIZE)
fragment_size = MAX_PCM_OFFLOAD_FRAGMENT_SIZE;
+ // To have same PCM samples for all channels, the buffer size requires to
+ // be multiple of (number of channels * bytes per sample)
+ // For writes to succeed, the buffer must be written at address which is multiple of 32
+ fragment_size = ALIGN(fragment_size, ((bits_per_sample >> 3)* popcount(info->channel_mask) * 32));
ALOGI("PCM offload Fragment size to %d bytes", fragment_size);
return fragment_size;