From 0c7b7873984e04941c9f21fa272638018fdb9a16 Mon Sep 17 00:00:00 2001 From: Michael Sevakis Date: Fri, 12 Apr 2013 23:35:47 -0400 Subject: 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 --- firmware/drivers/audio/rk27xx_codec.c | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) (limited to 'firmware/drivers/audio/rk27xx_codec.c') 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 @@ #include "system.h" #include "i2c-rk27xx.h" -const struct sound_settings_info audiohw_settings[] = { - [SOUND_VOLUME] = {"dB", 0, 1, -34, 4, -25}, - /* HAVE_SW_TONE_CONTROLS */ - [SOUND_BASS] = {"dB", 0, 1, -24, 24, 0}, - [SOUND_TREBLE] = {"dB", 0, 1, -24, 24, 0}, - [SOUND_BALANCE] = {"%", 0, 1,-100, 100, 0}, - [SOUND_CHANNELS] = {"", 0, 1, 0, 5, 0}, - [SOUND_STEREO_WIDTH] = {"%", 0, 5, 0, 250, 100}, -#ifdef HAVE_RECORDING /* disabled for now */ - [SOUND_LEFT_GAIN] = {"dB", 2, 75, -1725, 3000, 0}, - [SOUND_RIGHT_GAIN] = {"dB", 2, 75, -1725, 3000, 0}, - [SOUND_MIC_GAIN] = {"dB", 0, 1, 0, 20, 20}, -#endif -}; - /* private functions to read/write codec registers */ static int codec_write(uint8_t reg, uint8_t val) { @@ -66,7 +51,7 @@ static void audiohw_mute(bool mute) } /* public functions */ -int tenthdb2master(int tdb) +static int vol_tenthdb2hw(int tdb) { /* we lie here a bit and present 0.5dB gain steps * but codec has 'variable' gain steps (0.5, 1.0, 2.0) @@ -150,6 +135,8 @@ void audiohw_set_frequency(int fsel) void audiohw_set_master_vol(int vol_l, int vol_r) { + vol_l = vol_tenthdb2hw(vol_l); + vol_r = vol_tenthdb2hw(vol_r); if (vol_l > 31 || vol_r > 31) { -- cgit v1.2.3