From 6be80976517709e16d587e3e30f020e41610be42 Mon Sep 17 00:00:00 2001 From: Andrew Ryabinin Date: Fri, 12 Apr 2013 10:08:37 +0400 Subject: hm60x/hm801: Fix balance by enabling sw volume control. Change-Id: I8760b58d5b801409f35370d812d72f8d578d2889 --- firmware/drivers/audio/dummy_codec.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'firmware/drivers') diff --git a/firmware/drivers/audio/dummy_codec.c b/firmware/drivers/audio/dummy_codec.c index ca51d95265..94ba04b56a 100644 --- a/firmware/drivers/audio/dummy_codec.c +++ b/firmware/drivers/audio/dummy_codec.c @@ -23,9 +23,11 @@ #include "config.h" #include "audio.h" #include "audiohw.h" +#include "system.h" +#include "pcm_sw_volume.h" const struct sound_settings_info audiohw_settings[] = { - [SOUND_VOLUME] = {"dB", 0, 1, -1, 0, 0}, + [SOUND_VOLUME] = {"dB", 0, 1, VOLUME_MIN/10, VOLUME_MAX/10, 0}, /* HAVE_SW_TONE_CONTROLS */ [SOUND_BASS] = {"dB", 0, 1, -24, 24, 0}, [SOUND_TREBLE] = {"dB", 0, 1, -24, 24, 0}, @@ -44,3 +46,13 @@ void audiohw_set_frequency(int fsel) { (void)fsel; } + +#ifdef HAVE_SW_VOLUME_CONTROL +void audiohw_set_master_vol(int vol_l, int vol_r) +{ + /* SW volume for <= 1.0 gain, HW at unity, < VOLUME_MIN == MUTE */ + int sw_volume_l = vol_l < VOLUME_MIN ? PCM_MUTE_LEVEL : MIN(vol_l, 0); + int sw_volume_r = vol_r < VOLUME_MIN ? PCM_MUTE_LEVEL : MIN(vol_r, 0); + pcm_set_master_volume(sw_volume_l, sw_volume_r); +} +#endif /* HAVE_SW_VOLUME_CONTROL */ -- cgit v1.2.3