summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--firmware/drivers/audio/rk27xx_codec.c19
-rw-r--r--firmware/export/rk27xx_codec.h4
2 files changed, 14 insertions, 9 deletions
diff --git a/firmware/drivers/audio/rk27xx_codec.c b/firmware/drivers/audio/rk27xx_codec.c
index ebc6c476a3..c2b5980021 100644
--- a/firmware/drivers/audio/rk27xx_codec.c
+++ b/firmware/drivers/audio/rk27xx_codec.c
@@ -28,7 +28,7 @@
28#include "i2c-rk27xx.h" 28#include "i2c-rk27xx.h"
29 29
30const struct sound_settings_info audiohw_settings[] = { 30const struct sound_settings_info audiohw_settings[] = {
31 [SOUND_VOLUME] = {"dB", 1, 5,-335, 45,-255}, 31 [SOUND_VOLUME] = {"dB", 0, 1, -34, 4, -25},
32 /* HAVE_SW_TONE_CONTROLS */ 32 /* HAVE_SW_TONE_CONTROLS */
33 [SOUND_BASS] = {"dB", 0, 1, -24, 24, 0}, 33 [SOUND_BASS] = {"dB", 0, 1, -24, 24, 0},
34 [SOUND_TREBLE] = {"dB", 0, 1, -24, 24, 0}, 34 [SOUND_TREBLE] = {"dB", 0, 1, -24, 24, 0},
@@ -72,7 +72,7 @@ int tenthdb2master(int tdb)
72 */ 72 */
73 73
74 if (tdb < VOLUME_MIN) 74 if (tdb < VOLUME_MIN)
75 return 31; 75 return 32;
76 else if (tdb < -115) 76 else if (tdb < -115)
77 return -(((tdb + 115)/20) - 20); /* 2.0 dB steps */ 77 return -(((tdb + 115)/20) - 20); /* 2.0 dB steps */
78 else if (tdb < 5) 78 else if (tdb < 5)
@@ -150,11 +150,16 @@ void audiohw_set_frequency(int fsel)
150 150
151void audiohw_set_master_vol(int vol_l, int vol_r) 151void audiohw_set_master_vol(int vol_l, int vol_r)
152{ 152{
153 uint8_t val;
154 153
155 val = (uint8_t)(vol_r & 0x1f); 154 if (vol_l > 31 || vol_r > 31)
156 codec_write(CGR9, val); 155 {
156 audiohw_mute(true);
157 }
158 else
159 {
160 audiohw_mute(false);
157 161
158 val = (uint8_t)(vol_l & 0x1f); 162 codec_write(CGR9, vol_r);
159 codec_write(CGR8, val); 163 codec_write(CGR8, vol_l);
164 }
160} 165}
diff --git a/firmware/export/rk27xx_codec.h b/firmware/export/rk27xx_codec.h
index e770e476a2..5fdf0a0061 100644
--- a/firmware/export/rk27xx_codec.h
+++ b/firmware/export/rk27xx_codec.h
@@ -24,8 +24,8 @@
24#ifndef _RK27XX_CODEC_H_ 24#ifndef _RK27XX_CODEC_H_
25#define _RK27XX_CODEC_H_ 25#define _RK27XX_CODEC_H_
26 26
27#define VOLUME_MIN -335 27#define VOLUME_MIN -330
28#define VOLUME_MAX 45 28#define VOLUME_MAX 40
29#define AUDIOHW_CAPS (BASS_CAP | TREBLE_CAP) 29#define AUDIOHW_CAPS (BASS_CAP | TREBLE_CAP)
30 30
31extern int tenthdb2master(int db); 31extern int tenthdb2master(int db);