aboutsummaryrefslogtreecommitdiffstats
path: root/audio
diff options
context:
space:
mode:
authorZiyan <jaraidaniel@gmail.com>2015-08-20 16:45:24 +0200
committerAndreas Blaesius <skate4life@gmx.de>2015-08-29 01:53:07 -0700
commit39023ada602b2bf8bf6bdab72d9a58bdbdc3ae05 (patch)
tree8940d39f2ce105be41890438db95f025bc94271b /audio
parent78912aa06300fe430d7fd643ddb7c3dbd8e4a11c (diff)
downloaddevice_samsung_espressowifi-39023ada602b2bf8bf6bdab72d9a58bdbdc3ae05.zip
device_samsung_espressowifi-39023ada602b2bf8bf6bdab72d9a58bdbdc3ae05.tar.gz
device_samsung_espressowifi-39023ada602b2bf8bf6bdab72d9a58bdbdc3ae05.tar.bz2
espresso-common: audio: dynamically choose default incall device
If the device doesn't have an earpiece (P5100), let's use the speaker as the default incall device. This commit makes it possible to use a common audio HAL for all variants. Change-Id: I2acb0ad03025688602f973734bcbabd3a4ba7820
Diffstat (limited to 'audio')
-rw-r--r--audio/audio_hw.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/audio/audio_hw.c b/audio/audio_hw.c
index 1a6e4bd..377c5fb 100644
--- a/audio/audio_hw.c
+++ b/audio/audio_hw.c
@@ -194,6 +194,8 @@ struct espresso_dev_cfg {
unsigned int off_len;
};
+static bool device_has_earpiece = false;
+
/**
* NOTE: when multiple mutexes have to be acquired, always respect the following order:
* hw device > in stream > out stream
@@ -513,7 +515,11 @@ static void set_incall_device(struct espresso_audio_device *adev)
}
break;
default:
- device_type = SOUND_AUDIO_PATH_HANDSET;
+ if (device_has_earpiece) {
+ device_type = SOUND_AUDIO_PATH_HANDSET;
+ } else {
+ device_type = SOUND_AUDIO_PATH_SPEAKER;
+ }
break;
}
@@ -2867,6 +2873,10 @@ static void adev_config_start(void *data, const XML_Char *elem,
return;
}
+ if (strcmp(name, "earpiece") == 0) {
+ device_has_earpiece = true;
+ }
+
s->dev = &dev_cfg[s->adev->num_dev_cfgs];
memset(s->dev, 0, sizeof(*s->dev));
s->dev->mask = dev_names[i].mask;