diff options
author | Marcoen Hirschberg <marcoen@gmail.com> | 2006-12-06 13:34:15 +0000 |
---|---|---|
committer | Marcoen Hirschberg <marcoen@gmail.com> | 2006-12-06 13:34:15 +0000 |
commit | 1b967f41df90cd183c42e96d40acaeea671c1016 (patch) | |
tree | 8b529db9c07a630b61d3483568b4cfe66f8ed600 /firmware/drivers/tlv320.c | |
parent | 3e24665c417c2dd7dc292c9f12efae4e6544aa11 (diff) | |
download | rockbox-1b967f41df90cd183c42e96d40acaeea671c1016.tar.gz rockbox-1b967f41df90cd183c42e96d40acaeea671c1016.zip |
move some audio driver specific code to the correspoding files
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11675 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/drivers/tlv320.c')
-rw-r--r-- | firmware/drivers/tlv320.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/firmware/drivers/tlv320.c b/firmware/drivers/tlv320.c index c9ab094ef3..a88eae5f26 100644 --- a/firmware/drivers/tlv320.c +++ b/firmware/drivers/tlv320.c | |||
@@ -33,6 +33,22 @@ | |||
33 | #include "i2c-coldfire.h" | 33 | #include "i2c-coldfire.h" |
34 | #include "tlv320.h" | 34 | #include "tlv320.h" |
35 | 35 | ||
36 | /* convert tenth of dB volume (-840..0) to master volume register value */ | ||
37 | int tenthdb2master(int db) | ||
38 | { | ||
39 | /* +6 to -73dB 1dB steps (plus mute == 80levels) 7bits */ | ||
40 | /* 1111111 == +6dB (0x7f) */ | ||
41 | /* 1111001 == 0dB (0x79) */ | ||
42 | /* 0110000 == -73dB (0x30 */ | ||
43 | /* 0101111 == mute (0x2f) */ | ||
44 | |||
45 | if (db < VOLUME_MIN) { | ||
46 | return 0x2f; | ||
47 | } else { | ||
48 | return((db/10)+73+0x30); | ||
49 | } | ||
50 | } | ||
51 | |||
36 | /* local functions and definations */ | 52 | /* local functions and definations */ |
37 | #define TLV320_ADDR 0x34 | 53 | #define TLV320_ADDR 0x34 |
38 | 54 | ||