diff options
author | Simon Wilson <simonwilson@google.com> | 2011-07-21 14:58:26 -0700 |
---|---|---|
committer | Simon Wilson <simonwilson@google.com> | 2011-07-21 14:58:26 -0700 |
commit | b1695f85e6d4a0baaf8bd3d190d02fe20d537824 (patch) | |
tree | bed569c26c02be84aa1a72b60e5e16e885c6bd93 /audio | |
parent | 2a5b783f99994f6a096d67b2bcd1a0952fb0d43a (diff) | |
download | device_samsung_tuna-b1695f85e6d4a0baaf8bd3d190d02fe20d537824.zip device_samsung_tuna-b1695f85e6d4a0baaf8bd3d190d02fe20d537824.tar.gz device_samsung_tuna-b1695f85e6d4a0baaf8bd3d190d02fe20d537824.tar.bz2 |
audio: disable output stage when going into standby
This should eliminate random clicks and pops heard when audio
enters standby since the output stage is disabled before closing
the PCM. In addition, this should provide a power savings in
standby.
Change-Id: Ief0a193e0b31e9ee2f03a58641eaebd2a0d344cb
Diffstat (limited to 'audio')
-rw-r--r-- | audio/audio_hw.c | 59 |
1 files changed, 33 insertions, 26 deletions
diff --git a/audio/audio_hw.c b/audio/audio_hw.c index 9f7442e..3a08e9f 100644 --- a/audio/audio_hw.c +++ b/audio/audio_hw.c @@ -152,18 +152,6 @@ struct route_setting defaults[] = { .intval = MIXER_ABE_GAIN_0DB, }, { - .ctl_name = MIXER_HEADSET_PLAYBACK_VOLUME, - .intval = 13, - }, - { - .ctl_name = MIXER_EARPHONE_PLAYBACK_VOLUME, - .intval = 15, - }, - { - .ctl_name = MIXER_HANDSFREE_PLAYBACK_VOLUME, - .intval = 26, /* max for no distortion */ - }, - { .ctl_name = MIXER_AUDUL_VOICE_UL_VOLUME, .intval = MIXER_ABE_GAIN_0DB, }, @@ -175,25 +163,33 @@ struct route_setting defaults[] = { .ctl_name = MIXER_CAPTURE_VOLUME, .intval = 4, }, + { + .ctl_name = MIXER_SIDETONE_MIXER_PLAYBACK, + .intval = 1, + }, + { + .ctl_name = MIXER_DL1_PDM_SWITCH, + .intval = 1, + }, - /* speaker */ + /* bt */ { - .ctl_name = MIXER_HF_LEFT_PLAYBACK, - .strval = MIXER_PLAYBACK_HF_DAC, + .ctl_name = MIXER_BT_UL_VOLUME, + .intval = MIXER_ABE_GAIN_MINUS1DB, }, { - .ctl_name = MIXER_HF_RIGHT_PLAYBACK, - .strval = MIXER_PLAYBACK_HF_DAC, + .ctl_name = NULL, }, +}; - /* headset */ +struct route_setting output_stage[] = { { - .ctl_name = MIXER_SIDETONE_MIXER_PLAYBACK, - .intval = 1, + .ctl_name = MIXER_HF_LEFT_PLAYBACK, + .strval = MIXER_PLAYBACK_HF_DAC, }, { - .ctl_name = MIXER_DL1_PDM_SWITCH, - .intval = 1, + .ctl_name = MIXER_HF_RIGHT_PLAYBACK, + .strval = MIXER_PLAYBACK_HF_DAC, }, { .ctl_name = MIXER_HS_LEFT_PLAYBACK, @@ -203,11 +199,17 @@ struct route_setting defaults[] = { .ctl_name = MIXER_HS_RIGHT_PLAYBACK, .strval = MIXER_PLAYBACK_HS_DAC, }, - - /* bt */ { - .ctl_name = MIXER_BT_UL_VOLUME, - .intval = MIXER_ABE_GAIN_MINUS1DB, + .ctl_name = MIXER_HEADSET_PLAYBACK_VOLUME, + .intval = 13, + }, + { + .ctl_name = MIXER_EARPHONE_PLAYBACK_VOLUME, + .intval = 15, + }, + { + .ctl_name = MIXER_HANDSFREE_PLAYBACK_VOLUME, + .intval = 26, /* max for no distortion */ }, { .ctl_name = NULL, @@ -482,6 +484,9 @@ static void select_output_device(struct tuna_audio_device *adev) static int start_output_stream(struct tuna_stream_out *out) { + struct tuna_audio_device *adev = out->dev; + + set_route_by_array(adev->mixer, output_stage, 1); out->pcm = pcm_open(0, PORT_MM, PCM_OUT, &out->config); if (!pcm_is_ready(out->pcm)) { LOGE("cannot open pcm_out driver: %s", pcm_get_error(out->pcm)); @@ -554,8 +559,10 @@ static int out_set_format(struct audio_stream *stream, int format) static int out_standby(struct audio_stream *stream) { struct tuna_stream_out *out = (struct tuna_stream_out *)stream; + struct tuna_audio_device *adev = out->dev; pthread_mutex_lock(&out->lock); + set_route_by_array(adev->mixer, output_stage, 0); if (!out->standby) { pcm_close(out->pcm); out->pcm = NULL; |