audio: enable headphone jack handling in HAL
Now that Android is aware of the headphone jack, we can no longer hard
code the speaker output. Automatically output on port 1 when headphones
are attached.
diff --git a/audio/audio_hw.c b/audio/audio_hw.c
index 7513456..05eb800 100644
--- a/audio/audio_hw.c
+++ b/audio/audio_hw.c
@@ -70,6 +70,11 @@
static int get_audio_output_port(audio_devices_t devices) {
/* Default to internal speaker */
int port = PORT_INTERNAL_SPEAKER;
+ if (devices & AUDIO_DEVICE_OUT_WIRED_HEADSET) {
+ port = PORT_HEADSET;
+ }
+
+ ALOGV("%s: port = %d", __func__, port);
return port;
}
diff --git a/audio/audio_hw.h b/audio/audio_hw.h
index f6649ce..a7163e0 100644
--- a/audio/audio_hw.h
+++ b/audio/audio_hw.h
@@ -24,6 +24,7 @@
#define CARD_OUT 0
#define PORT_INTERNAL_SPEAKER 0
+#define PORT_HEADSET 1
#define CARD_IN 0
#define PORT_BUILTIN_MIC 3