summaryrefslogtreecommitdiff
path: root/firmware/drivers/audio/rk27xx_codec.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/drivers/audio/rk27xx_codec.c')
-rw-r--r--firmware/drivers/audio/rk27xx_codec.c19
1 files changed, 3 insertions, 16 deletions
diff --git a/firmware/drivers/audio/rk27xx_codec.c b/firmware/drivers/audio/rk27xx_codec.c
index 6f71214df4..aada17cc0a 100644
--- a/firmware/drivers/audio/rk27xx_codec.c
+++ b/firmware/drivers/audio/rk27xx_codec.c
@@ -27,21 +27,6 @@
27#include "system.h" 27#include "system.h"
28#include "i2c-rk27xx.h" 28#include "i2c-rk27xx.h"
29 29
30const struct sound_settings_info audiohw_settings[] = {
31 [SOUND_VOLUME] = {"dB", 0, 1, -34, 4, -25},
32 /* HAVE_SW_TONE_CONTROLS */
33 [SOUND_BASS] = {"dB", 0, 1, -24, 24, 0},
34 [SOUND_TREBLE] = {"dB", 0, 1, -24, 24, 0},
35 [SOUND_BALANCE] = {"%", 0, 1,-100, 100, 0},
36 [SOUND_CHANNELS] = {"", 0, 1, 0, 5, 0},
37 [SOUND_STEREO_WIDTH] = {"%", 0, 5, 0, 250, 100},
38#ifdef HAVE_RECORDING /* disabled for now */
39 [SOUND_LEFT_GAIN] = {"dB", 2, 75, -1725, 3000, 0},
40 [SOUND_RIGHT_GAIN] = {"dB", 2, 75, -1725, 3000, 0},
41 [SOUND_MIC_GAIN] = {"dB", 0, 1, 0, 20, 20},
42#endif
43};
44
45/* private functions to read/write codec registers */ 30/* private functions to read/write codec registers */
46static int codec_write(uint8_t reg, uint8_t val) 31static int codec_write(uint8_t reg, uint8_t val)
47{ 32{
@@ -66,7 +51,7 @@ static void audiohw_mute(bool mute)
66} 51}
67 52
68/* public functions */ 53/* public functions */
69int tenthdb2master(int tdb) 54static int vol_tenthdb2hw(int tdb)
70{ 55{
71 /* we lie here a bit and present 0.5dB gain steps 56 /* we lie here a bit and present 0.5dB gain steps
72 * but codec has 'variable' gain steps (0.5, 1.0, 2.0) 57 * but codec has 'variable' gain steps (0.5, 1.0, 2.0)
@@ -150,6 +135,8 @@ void audiohw_set_frequency(int fsel)
150 135
151void audiohw_set_master_vol(int vol_l, int vol_r) 136void audiohw_set_master_vol(int vol_l, int vol_r)
152{ 137{
138 vol_l = vol_tenthdb2hw(vol_l);
139 vol_r = vol_tenthdb2hw(vol_r);
153 140
154 if (vol_l > 31 || vol_r > 31) 141 if (vol_l > 31 || vol_r > 31)
155 { 142 {