diff options
author | Michael Sevakis <jethead71@rockbox.org> | 2013-04-12 23:35:47 -0400 |
---|---|---|
committer | Michael Sevakis <jethead71@rockbox.org> | 2013-04-15 12:02:05 -0400 |
commit | 0c7b7873984e04941c9f21fa272638018fdb9a16 (patch) | |
tree | fb6afca45d2bef0a2c91732a39ffc0b965f5c557 /firmware/drivers/audio/rk27xx_codec.c | |
parent | fd9e2568908f91b5bcf7378dc28f6ec070d6027a (diff) | |
download | rockbox-0c7b7873984e04941c9f21fa272638018fdb9a16.tar.gz rockbox-0c7b7873984e04941c9f21fa272638018fdb9a16.zip |
Straighten out the mad twisted state of sound.c and related areas.
This is going right in since it's long overdue. If anything is goofed,
drop me a line or just tweak it yourself if you know what's wrong. :-)
Make HW/SW codec interface more uniform when emulating HW functionality
on SWCODEC for functions such as "audiohw_set_pitch". The firmware-to-
DSP plumbing is in firmware/drivers/audiohw-swcodec.c. "sound_XXX"
APIs are all in sound.c with none in DSP code any longer.
Reduce number of settings definitions needed by each codec by providing
defaults for common ones like balance, channels and SW tone controls.
Remove need for separate SIM code and tables and add virtual codec header
for hosted targets.
Change-Id: I3f23702bca054fc9bda40f49824ce681bb7f777b
Diffstat (limited to 'firmware/drivers/audio/rk27xx_codec.c')
-rw-r--r-- | firmware/drivers/audio/rk27xx_codec.c | 19 |
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 | ||
30 | const 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 */ |
46 | static int codec_write(uint8_t reg, uint8_t val) | 31 | static 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 */ |
69 | int tenthdb2master(int tdb) | 54 | static 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 | ||
151 | void audiohw_set_master_vol(int vol_l, int vol_r) | 136 | void 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 | { |