diff options
author | Marcin Bukat <marcin.bukat@gmail.com> | 2012-07-10 20:09:21 +0200 |
---|---|---|
committer | Marcin Bukat <marcin.bukat@gmail.com> | 2012-07-10 20:09:21 +0200 |
commit | 676f72a0f41847b5356d514b31d981154ad125bb (patch) | |
tree | 2fafb52c772ba5168ca3ff87f3111d5acd30d70f | |
parent | 9f13f881b32bebad9486bfaa1e543cbd6f64ae36 (diff) | |
download | rockbox-676f72a0f41847b5356d514b31d981154ad125bb.tar.gz rockbox-676f72a0f41847b5356d514b31d981154ad125bb.zip |
rk27xx codec: Fix volume setting
Change-Id: If57e0225fed4a9f87dff9661b21b2e06fa3d341e
-rw-r--r-- | firmware/drivers/audio/rk27xx_codec.c | 19 | ||||
-rw-r--r-- | firmware/export/rk27xx_codec.h | 4 |
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 | ||
30 | const struct sound_settings_info audiohw_settings[] = { | 30 | const 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 | ||
151 | void audiohw_set_master_vol(int vol_l, int vol_r) | 151 | void 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 | ||
31 | extern int tenthdb2master(int db); | 31 | extern int tenthdb2master(int db); |