aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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;