diff options
| author | able_liao <able_liao@asus.com> | 2012-10-23 20:48:52 +0800 |
|---|---|---|
| committer | Ramanan Rajeswaran <ramanan@google.com> | 2012-10-23 20:53:09 -0700 |
| commit | 04c837728127f93077d300a1b8b15cc7a037153c (patch) | |
| tree | 0e30d0d6398a7c426664747631926c43539cf20d /audio | |
| parent | bd95548a02dc7dd704d3519d48fe67101e80b20d (diff) | |
Audio: Dock: fix speaker silent issue after inserting and removing headset rapidly.
1. Design "AUX" and "speaker" dapm mixer control for dock feature in HAL instead of kernel.
The previous kernel design could cause speaker silent after inserting and removing headphone rapidly,
or even just normally insert and remove headphone during system suspend.
2. For dock feature, original speaker output scenario must be separated into dock path and speaker path.
Thus we have to update the current state of speaker and dock respectively to make sure speaker and dock
output paths can be enabled/disabled as expected.
Bug: 7388692
Change-Id: I6e75cf63cdd8134e34ab22fb818a17ec8c4bdce5
Signed-off-by: able_liao <able_liao@asus.com>
Diffstat (limited to 'audio')
| -rw-r--r-- | audio/audio_hw.c | 2 | ||||
| -rw-r--r-- | audio/audio_route.c | 32 | ||||
| -rw-r--r-- | audio/audio_route.h | 2 |
3 files changed, 36 insertions, 0 deletions
diff --git a/audio/audio_hw.c b/audio/audio_hw.c index dd8769d..122f408 100644 --- a/audio/audio_hw.c +++ b/audio/audio_hw.c @@ -190,6 +190,8 @@ static void select_devices(struct audio_device *adev) main_mic_on = adev->in_device & AUDIO_DEVICE_IN_BUILTIN_MIC; reset_mixer_state(adev->ar); + audio_route_update_path(adev->ar, "dock"); + audio_route_update_path(adev->ar, "speaker"); if (speaker_on) { if(is_dock_in()) diff --git a/audio/audio_route.c b/audio/audio_route.c index 7a13de4..9358df4 100644 --- a/audio/audio_route.c +++ b/audio/audio_route.c @@ -397,6 +397,38 @@ void audio_route_apply_path(struct audio_route *ar, const char *name) path_apply(ar, path); } +void audio_route_update_path(struct audio_route *ar, const char *name) +{ + + unsigned int i; + unsigned int j; + struct mixer_path *path; + + if (!ar) { + ALOGE("invalid audio_route"); + return; + } + + path = path_get_by_name(ar, name); + if (!path) { + ALOGE("unable to find path '%s'", name); + return; + } + + for (i = 0; i < path->length; i++) { + struct mixer_ctl *ctl = path->setting[i].ctl; + + /* locate the mixer ctl in the list */ + for (j = 0; j < ar->num_mixer_ctls; j++) { + if (ar->mixer_state[j].ctl == ctl) + break; + } + + /* update the current value */ + ar->mixer_state[j].old_value = mixer_ctl_get_value(ar->mixer_state[j].ctl, 0); + } +} + struct audio_route *audio_route_init(void) { struct config_parse_state state; diff --git a/audio/audio_route.h b/audio/audio_route.h index 31355dd..f0554d0 100644 --- a/audio/audio_route.h +++ b/audio/audio_route.h @@ -30,4 +30,6 @@ void reset_mixer_state(struct audio_route *ar); /* Updates the mixer with any changed values */ void update_mixer_state(struct audio_route *ar); +void audio_route_update_path(struct audio_route *ar, const char *name); + #endif |
