summaryrefslogtreecommitdiff
path: root/firmware/drivers/audio/ak4537.c
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2013-04-12 23:35:47 -0400
committerMichael Sevakis <jethead71@rockbox.org>2013-04-15 12:02:05 -0400
commit0c7b7873984e04941c9f21fa272638018fdb9a16 (patch)
treefb6afca45d2bef0a2c91732a39ffc0b965f5c557 /firmware/drivers/audio/ak4537.c
parentfd9e2568908f91b5bcf7378dc28f6ec070d6027a (diff)
downloadrockbox-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/ak4537.c')
-rw-r--r--firmware/drivers/audio/ak4537.c27
1 files changed, 3 insertions, 24 deletions
diff --git a/firmware/drivers/audio/ak4537.c b/firmware/drivers/audio/ak4537.c
index c3ce02a3af..4a9010d4e7 100644
--- a/firmware/drivers/audio/ak4537.c
+++ b/firmware/drivers/audio/ak4537.c
@@ -80,7 +80,7 @@ static void codec_set_active(int active)
80#endif 80#endif
81 81
82/* convert tenth of dB volume (-1270..0) to master volume register value */ 82/* convert tenth of dB volume (-1270..0) to master volume register value */
83int tenthdb2master(int db) 83static int vol_tenthdb2hw(int db)
84{ 84{
85 if (db < VOLUME_MIN) 85 if (db < VOLUME_MIN)
86 return 0xff; /* mute */ 86 return 0xff; /* mute */
@@ -90,29 +90,6 @@ int tenthdb2master(int db)
90 return ((-db)/5); 90 return ((-db)/5);
91} 91}
92 92
93int sound_val2phys(int setting, int value)
94{
95 int result;
96
97 switch(setting)
98 {
99#ifdef HAVE_RECORDING
100 case SOUND_LEFT_GAIN:
101 case SOUND_RIGHT_GAIN:
102 result = (value - 23) * 15; /* fix */
103 break;
104 case SOUND_MIC_GAIN:
105 result = value * 200; /* fix */
106 break;
107#endif
108 default:
109 result = value;
110 break;
111 }
112
113 return result;
114}
115
116/*static void audiohw_mute(bool mute) 93/*static void audiohw_mute(bool mute)
117{ 94{
118 if (mute) 95 if (mute)
@@ -232,6 +209,8 @@ void audiohw_close(void)
232 209
233void audiohw_set_master_vol(int vol_l, int vol_r) 210void audiohw_set_master_vol(int vol_l, int vol_r)
234{ 211{
212 vol_l = vol_tenthdb2hw(vol_l);
213 vol_r = vol_tenthdb2hw(vol_r);
235 akc_write(AK4537_ATTL, vol_l & 0xff); 214 akc_write(AK4537_ATTL, vol_l & 0xff);
236 akc_write(AK4537_ATTR, vol_r & 0xff); 215 akc_write(AK4537_ATTR, vol_r & 0xff);
237} 216}