audio: use same card and device for PCM amd compress offload path
Bug: 16683770
Change-Id: I6fe056db6ea1ed3a7be7341873b8b2c3876fb935
diff --git a/audio/hal/audio_hw.c b/audio/hal/audio_hw.c
index 2557619..4273dc1 100644
--- a/audio/hal/audio_hw.c
+++ b/audio/hal/audio_hw.c
@@ -50,7 +50,7 @@
#define MIXER_CTL_COMPRESS_PLAYBACK_VOLUME "Compress Playback Volume"
/* TODO: the following PCM device profiles could be read from a config file */
-struct pcm_device_profile pcm_device_playback_hs = {
+struct pcm_device_profile pcm_device_playback = {
.config = {
.channels = PLAYBACK_DEFAULT_CHANNEL_COUNT,
.rate = PLAYBACK_DEFAULT_SAMPLING_RATE,
@@ -63,9 +63,10 @@
.avail_min = PLAYBACK_AVAILABLE_MIN,
},
.card = SOUND_CARD,
- .id = 0,
+ .id = 9,
.type = PCM_PLAYBACK,
- .devices = AUDIO_DEVICE_OUT_WIRED_HEADSET|AUDIO_DEVICE_OUT_WIRED_HEADPHONE,
+ .devices = AUDIO_DEVICE_OUT_WIRED_HEADSET|AUDIO_DEVICE_OUT_WIRED_HEADPHONE|
+ AUDIO_DEVICE_OUT_SPEAKER,
};
struct pcm_device_profile pcm_device_capture = {
@@ -104,24 +105,6 @@
.devices = SND_DEVICE_IN_LOOPBACK_AEC,
};
-struct pcm_device_profile pcm_device_playback_spk = {
- .config = {
- .channels = PLAYBACK_DEFAULT_CHANNEL_COUNT,
- .rate = PLAYBACK_DEFAULT_SAMPLING_RATE,
- .period_size = PLAYBACK_PERIOD_SIZE,
- .period_count = PLAYBACK_PERIOD_COUNT,
- .format = PCM_FORMAT_S16_LE,
- .start_threshold = PLAYBACK_START_THRESHOLD,
- .stop_threshold = PLAYBACK_STOP_THRESHOLD,
- .silence_threshold = 0,
- .avail_min = PLAYBACK_AVAILABLE_MIN,
- },
- .card = SOUND_CARD,
- .id = 1,
- .type = PCM_PLAYBACK,
- .devices = AUDIO_DEVICE_OUT_SPEAKER,
-};
-
struct pcm_device_profile pcm_device_playback_sco = {
.config = {
.channels = SCO_DEFAULT_CHANNEL_COUNT,
@@ -179,9 +162,8 @@
};
struct pcm_device_profile *pcm_devices[] = {
- &pcm_device_playback_hs,
+ &pcm_device_playback,
&pcm_device_capture,
- &pcm_device_playback_spk,
&pcm_device_playback_sco,
&pcm_device_capture_sco,
&pcm_device_capture_loopback_aec,
@@ -4332,13 +4314,7 @@
struct pcm_device_profile *profile = NULL;
memset(&config, 0, sizeof(struct pcm_config));
- if (adev->dummybuf_thread_devices == AUDIO_DEVICE_OUT_WIRED_HEADPHONE) {
- profile = &pcm_device_playback_hs;
- mixer = mixer_open(profile->card);
- }
- else
- profile = &pcm_device_playback_spk;
-
+ profile = &pcm_device_playback;
memcpy(&config, &profile->config, sizeof(struct pcm_config));
/* Use large value for stop_threshold so that automatic
trigger for stop is avoided, when this thread fails to write data */
@@ -4354,6 +4330,9 @@
ALOGD("pcm_open: card=%d, id=%d", profile->card, profile->id);
}
+ if (adev->dummybuf_thread_devices == AUDIO_DEVICE_OUT_WIRED_HEADPHONE)
+ mixer = mixer_open(profile->card);
+
if (mixer) {
ctl = mixer_get_ctl_by_name(mixer, mixer_ctl_name);
if (ctl != NULL)
diff --git a/audio/hal/audio_hw.h b/audio/hal/audio_hw.h
index 15ed4bd..9923d77 100644
--- a/audio/hal/audio_hw.h
+++ b/audio/hal/audio_hw.h
@@ -167,8 +167,8 @@
#define CAPTURE_DEFAULT_SAMPLING_RATE 48000
#define CAPTURE_START_THRESHOLD 1
-#define COMPRESS_CARD 2
-#define COMPRESS_DEVICE 0
+#define COMPRESS_CARD 0
+#define COMPRESS_DEVICE 5
#define COMPRESS_OFFLOAD_FRAGMENT_SIZE (32 * 1024)
#define COMPRESS_OFFLOAD_NUM_FRAGMENTS 4
/* ToDo: Check and update a proper value in msec */
diff --git a/mixer_paths_0.xml b/mixer_paths_0.xml
index f7b15df..168cbff 100644
--- a/mixer_paths_0.xml
+++ b/mixer_paths_0.xml
@@ -11,13 +11,17 @@
<!-- TODO other defaults -->
<path name="speaker">
+ <ctl name="SPK VMixer SPK Switch" value="1"/>
</path>
<path name="headphones">
<ctl name="Headphone Jack Switch" value="1"/>
+ <ctl name="Codec VMixer Codec Switch" value="1"/>
</path>
<path name="speaker-and-headphones">
+ <ctl name="SPK VMixer SPK Switch" value="1"/>
+ <ctl name="Codec VMixer Codec Switch" value="1"/>
<ctl name="Headphone Jack Switch" value="1"/>
</path>