summaryrefslogtreecommitdiffstats
path: root/audio
diff options
context:
space:
mode:
authorSimon Wilson <simonwilson@google.com>2011-09-27 12:20:23 -0700
committerSimon Wilson <simonwilson@google.com>2011-10-05 21:02:37 -0700
commitcc4b5c96d7d30ca4a77b0b452fed5862fee43e2a (patch)
tree7d6f8ee9b0e1105472fe9d1d21f752f3d42f8673 /audio
parent116bf444e5568fc539f394e51703113c2d403cf2 (diff)
downloaddevice_samsung_tuna-cc4b5c96d7d30ca4a77b0b452fed5862fee43e2a.zip
device_samsung_tuna-cc4b5c96d7d30ca4a77b0b452fed5862fee43e2a.tar.gz
device_samsung_tuna-cc4b5c96d7d30ca4a77b0b452fed5862fee43e2a.tar.bz2
audio: route to S/PDIF when digital dock detected
Change-Id: Ia571fca8e0ce384283a15024b6b271231bf86479
Diffstat (limited to 'audio')
-rwxr-xr-xaudio/audio_hw.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/audio/audio_hw.c b/audio/audio_hw.c
index 9f5bff9..77b3dec 100755
--- a/audio/audio_hw.c
+++ b/audio/audio_hw.c
@@ -108,6 +108,8 @@
#define PORT_VIBRA 4
#define PORT_MODEM 5
#define PORT_MM_LP 6
+#define PORT_SPDIF 9
+#define PORT_HDMI 0
#define RESAMPLER_BUFFER_SIZE 8192
@@ -973,6 +975,7 @@ static int start_output_stream(struct tuna_stream_out *out)
{
struct tuna_audio_device *adev = out->dev;
unsigned int card = CARD_TUNA_DEFAULT;
+ unsigned int port = PORT_MM;
adev->active_output = out;
@@ -980,10 +983,15 @@ static int start_output_stream(struct tuna_stream_out *out)
/* FIXME: only works if only one output can be active at a time */
select_output_device(adev);
}
- /* in the case of multiple devices, this will cause use of HDMI only */
- if(adev->devices & AUDIO_DEVICE_OUT_AUX_DIGITAL)
+ /* S/PDIF takes priority over HDMI audio. In the case of multiple
+ * devices, this will cause use of S/PDIF or HDMI only */
+ if (adev->devices & AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET)
+ port = PORT_SPDIF;
+ else if(adev->devices & AUDIO_DEVICE_OUT_AUX_DIGITAL) {
card = CARD_OMAP4_HDMI;
- out->pcm = pcm_open(card, PORT_MM, PCM_OUT, &out->config);
+ port = PORT_HDMI;
+ }
+ out->pcm = pcm_open(card, port, PCM_OUT, &out->config);
if (!pcm_is_ready(out->pcm)) {
LOGE("cannot open pcm_out driver: %s", pcm_get_error(out->pcm));
pcm_close(out->pcm);
@@ -1237,9 +1245,11 @@ static int out_set_parameters(struct audio_stream *stream, const char *kvpairs)
force_input_standby = true;
}
/* force standby if moving to/from HDMI */
- if ((val & AUDIO_DEVICE_OUT_AUX_DIGITAL) ^
- (adev->devices & AUDIO_DEVICE_OUT_AUX_DIGITAL))
- do_output_standby(out);
+ if (((val & AUDIO_DEVICE_OUT_AUX_DIGITAL) ^
+ (adev->devices & AUDIO_DEVICE_OUT_AUX_DIGITAL)) ||
+ ((val & AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET) ^
+ (adev->devices & AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET)))
+ do_output_standby(out);
}
adev->devices &= ~AUDIO_DEVICE_OUT_ALL;
adev->devices |= val;