summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvivek mehta <mvivek@codeaurora.org>2015-08-19 15:42:16 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-08-19 15:42:16 +0000
commit8c2013a24dfa4d6bfba45b7872e00523fdf8901f (patch)
tree06c19135f8f836157739c91ce11f50b162324c69
parent94305123622d7b6a10ede1fb3348b070cde691f4 (diff)
parentb65064161c19b4c688f8a436ed002264d9f49055 (diff)
downloadhardware_qcom_audio-8c2013a24dfa4d6bfba45b7872e00523fdf8901f.tar.gz
hardware_qcom_audio-8c2013a24dfa4d6bfba45b7872e00523fdf8901f.tar.bz2
hardware_qcom_audio-8c2013a24dfa4d6bfba45b7872e00523fdf8901f.zip
am b6506416: hal: enable setting gain in case of combo device
* commit 'b65064161c19b4c688f8a436ed002264d9f49055': hal: enable setting gain in case of combo device
-rw-r--r--hal/audio_hw.c3
-rw-r--r--hal/msm8960/platform.c5
-rw-r--r--hal/msm8974/platform.c37
-rw-r--r--hal/platform_api.h3
4 files changed, 48 insertions, 0 deletions
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index c66f7ec8..7c017fd3 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -346,6 +346,7 @@ int enable_snd_device(struct audio_device *adev,
for (i = 0; i < num_devices; i++) {
enable_snd_device(adev, new_snd_devices[i]);
}
+ platform_set_speaker_gain_in_combo(adev, snd_device, true);
} else {
const char * dev_path = platform_get_snd_device_name(snd_device);
ALOGD("%s: snd_device(%d: %s)", __func__, snd_device, dev_path);
@@ -384,12 +385,14 @@ int disable_snd_device(struct audio_device *adev,
for (i = 0; i < num_devices; i++) {
disable_snd_device(adev, new_snd_devices[i]);
}
+ platform_set_speaker_gain_in_combo(adev, snd_device, false);
} else {
audio_route_reset_and_update_path(adev->audio_route, dev_path);
}
audio_extn_sound_trigger_update_device_status(snd_device,
ST_EVENT_SND_DEVICE_FREE);
}
+
return 0;
}
diff --git a/hal/msm8960/platform.c b/hal/msm8960/platform.c
index 06663a4a..c75efbe6 100644
--- a/hal/msm8960/platform.c
+++ b/hal/msm8960/platform.c
@@ -547,6 +547,11 @@ int platform_stop_voice_call(void *platform, uint32_t vsid __unused)
return ret;
}
+void platform_set_speaker_gain_in_combo(struct audio_device *adev __unused,
+ snd_device_t snd_device,
+ bool enable __unused) {
+}
+
int platform_set_voice_volume(void *platform, int volume)
{
struct platform_data *my_data = (struct platform_data *)platform;
diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c
index 6e8a9bb5..90349d15 100644
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.c
@@ -1500,6 +1500,43 @@ int platform_get_sample_rate(void *platform, uint32_t *rate)
return ret;
}
+void platform_set_speaker_gain_in_combo(struct audio_device *adev,
+ snd_device_t snd_device,
+ bool enable)
+{
+ const char* name;
+ switch (snd_device) {
+ case SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES:
+ if (enable)
+ name = "spkr-gain-in-headphone-combo";
+ else
+ name = "speaker-gain-default";
+ break;
+ case SND_DEVICE_OUT_SPEAKER_AND_LINE:
+ if (enable)
+ name = "spkr-gain-in-line-combo";
+ else
+ name = "speaker-gain-default";
+ break;
+ case SND_DEVICE_OUT_SPEAKER_SAFE_AND_HEADPHONES:
+ if (enable)
+ name = "spkr-safe-gain-in-headphone-combo";
+ else
+ name = "speaker-safe-gain-default";
+ break;
+ case SND_DEVICE_OUT_SPEAKER_SAFE_AND_LINE:
+ if (enable)
+ name = "spkr-safe-gain-in-line-combo";
+ else
+ name = "speaker-safe-gain-default";
+ break;
+ default:
+ return;
+ }
+
+ audio_route_apply_and_update_path(adev->audio_route, name);
+}
+
int platform_set_voice_volume(void *platform, int volume)
{
struct platform_data *my_data = (struct platform_data *)platform;
diff --git a/hal/platform_api.h b/hal/platform_api.h
index 569577e4..1e413587 100644
--- a/hal/platform_api.h
+++ b/hal/platform_api.h
@@ -41,6 +41,9 @@ int platform_switch_voice_call_usecase_route_post(void *platform,
int platform_start_voice_call(void *platform, uint32_t vsid);
int platform_stop_voice_call(void *platform, uint32_t vsid);
int platform_set_voice_volume(void *platform, int volume);
+void platform_set_speaker_gain_in_combo(struct audio_device *adev,
+ snd_device_t snd_device,
+ bool enable);
int platform_set_mic_mute(void *platform, bool state);
int platform_get_sample_rate(void *platform, uint32_t *rate);
int platform_set_device_mute(void *platform, bool state, char *dir);