summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Ryabinin <ryabinin.a.a@gmail.com>2013-04-12 10:08:37 +0400
committerAndrew Ryabinin <ryabinin.a.a@gmail.com>2013-04-12 10:11:54 +0400
commit6be80976517709e16d587e3e30f020e41610be42 (patch)
tree0b4794ff23e06ba9df7bf701935adbdcba0efcd4
parent2dd1f37a109792b262a4000c050f7a48a145f1c4 (diff)
downloadrockbox-6be80976517709e16d587e3e30f020e41610be42.tar.gz
rockbox-6be80976517709e16d587e3e30f020e41610be42.zip
hm60x/hm801: Fix balance by enabling sw volume control.
Change-Id: I8760b58d5b801409f35370d812d72f8d578d2889
-rw-r--r--firmware/drivers/audio/dummy_codec.c14
-rw-r--r--firmware/export/config/hifimanhm60x.h2
-rw-r--r--firmware/export/config/hifimanhm801.h2
-rw-r--r--firmware/export/dummy_codec.h3
4 files changed, 19 insertions, 2 deletions
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 @@
23#include "config.h" 23#include "config.h"
24#include "audio.h" 24#include "audio.h"
25#include "audiohw.h" 25#include "audiohw.h"
26#include "system.h"
27#include "pcm_sw_volume.h"
26 28
27const struct sound_settings_info audiohw_settings[] = { 29const struct sound_settings_info audiohw_settings[] = {
28 [SOUND_VOLUME] = {"dB", 0, 1, -1, 0, 0}, 30 [SOUND_VOLUME] = {"dB", 0, 1, VOLUME_MIN/10, VOLUME_MAX/10, 0},
29 /* HAVE_SW_TONE_CONTROLS */ 31 /* HAVE_SW_TONE_CONTROLS */
30 [SOUND_BASS] = {"dB", 0, 1, -24, 24, 0}, 32 [SOUND_BASS] = {"dB", 0, 1, -24, 24, 0},
31 [SOUND_TREBLE] = {"dB", 0, 1, -24, 24, 0}, 33 [SOUND_TREBLE] = {"dB", 0, 1, -24, 24, 0},
@@ -44,3 +46,13 @@ void audiohw_set_frequency(int fsel)
44{ 46{
45 (void)fsel; 47 (void)fsel;
46} 48}
49
50#ifdef HAVE_SW_VOLUME_CONTROL
51void audiohw_set_master_vol(int vol_l, int vol_r)
52{
53 /* SW volume for <= 1.0 gain, HW at unity, < VOLUME_MIN == MUTE */
54 int sw_volume_l = vol_l < VOLUME_MIN ? PCM_MUTE_LEVEL : MIN(vol_l, 0);
55 int sw_volume_r = vol_r < VOLUME_MIN ? PCM_MUTE_LEVEL : MIN(vol_r, 0);
56 pcm_set_master_volume(sw_volume_l, sw_volume_r);
57}
58#endif /* HAVE_SW_VOLUME_CONTROL */
diff --git a/firmware/export/config/hifimanhm60x.h b/firmware/export/config/hifimanhm60x.h
index 088cc12b09..f5b768defe 100644
--- a/firmware/export/config/hifimanhm60x.h
+++ b/firmware/export/config/hifimanhm60x.h
@@ -53,6 +53,8 @@
53#define CONFIG_NAND NAND_RK27XX 53#define CONFIG_NAND NAND_RK27XX
54#define HAVE_SW_TONE_CONTROLS 54#define HAVE_SW_TONE_CONTROLS
55 55
56#define HAVE_SW_VOLUME_CONTROL
57
56/* commented for now */ 58/* commented for now */
57/* #define HAVE_HOTSWAP */ 59/* #define HAVE_HOTSWAP */
58 60
diff --git a/firmware/export/config/hifimanhm801.h b/firmware/export/config/hifimanhm801.h
index e253fa0051..bcbf5e82f5 100644
--- a/firmware/export/config/hifimanhm801.h
+++ b/firmware/export/config/hifimanhm801.h
@@ -50,6 +50,8 @@
50#define CONFIG_NAND NAND_RK27XX 50#define CONFIG_NAND NAND_RK27XX
51#define HAVE_SW_TONE_CONTROLS 51#define HAVE_SW_TONE_CONTROLS
52 52
53#define HAVE_SW_VOLUME_CONTROL
54
53/* commented for now */ 55/* commented for now */
54/* #define HAVE_HOTSWAP */ 56/* #define HAVE_HOTSWAP */
55 57
diff --git a/firmware/export/dummy_codec.h b/firmware/export/dummy_codec.h
index b85ec8fb0e..122b55ef2f 100644
--- a/firmware/export/dummy_codec.h
+++ b/firmware/export/dummy_codec.h
@@ -22,8 +22,9 @@
22#ifndef __DUMMY_CODEC_H_ 22#ifndef __DUMMY_CODEC_H_
23#define __DUMMY_CODEC_H_ 23#define __DUMMY_CODEC_H_
24 24
25#define VOLUME_MIN -1 25#define VOLUME_MIN -730
26#define VOLUME_MAX 0 26#define VOLUME_MAX 0
27 27
28void audiohw_set_master_vol(int vol_l, int vol_r);
28 29
29#endif /* __DUMMY_CODEC_H_ */ 30#endif /* __DUMMY_CODEC_H_ */