summaryrefslogtreecommitdiff
path: root/firmware/sound.c
diff options
context:
space:
mode:
authorMarcoen Hirschberg <marcoen@gmail.com>2006-12-06 13:34:15 +0000
committerMarcoen Hirschberg <marcoen@gmail.com>2006-12-06 13:34:15 +0000
commit1b967f41df90cd183c42e96d40acaeea671c1016 (patch)
tree8b529db9c07a630b61d3483568b4cfe66f8ed600 /firmware/sound.c
parent3e24665c417c2dd7dc292c9f12efae4e6544aa11 (diff)
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/sound.c')
-rw-r--r--firmware/sound.c168
1 files changed, 2 insertions, 166 deletions
diff --git a/firmware/sound.c b/firmware/sound.c
index 0c4c153797..09fa3dac94 100644
--- a/firmware/sound.c
+++ b/firmware/sound.c
@@ -24,17 +24,7 @@
#ifndef SIMULATOR
#include "i2c.h"
#include "mas.h"
-#ifdef HAVE_UDA1380
-#include "uda1380.h"
-#elif defined(HAVE_WM8975) || defined(HAVE_WM8751)
-#include "wm8975.h"
-#elif defined(HAVE_WM8758)
-#include "wm8758.h"
-#elif defined(HAVE_WM8731) || defined(HAVE_WM8721)
-#include "wm8731l.h"
-#elif defined(HAVE_TLV320)
-#include "tlv320.h"
-#elif CONFIG_CPU == PNX0101
+#if CONFIG_CPU == PNX0101
#include "pnx0101.h"
#endif
#include "dac.h"
@@ -269,161 +259,7 @@ static int tenthdb2reg(int db)
}
#endif
-#ifdef HAVE_UDA1380 /* volume/balance/treble/bass interdependency */
-#define VOLUME_MIN -840
-#define VOLUME_MAX 0
-
-/* convert tenth of dB volume (-840..0) to master volume register value */
-static int tenthdb2master(int db)
-{
- if (db < -720) /* 1.5 dB steps */
- return (2940 - db) / 15;
- else if (db < -660) /* 0.75 dB steps */
- return (1110 - db) * 2 / 15;
- else if (db < -520) /* 0.5 dB steps */
- return (520 - db) / 5;
- else /* 0.25 dB steps */
- return -db * 2 / 5;
-}
-
-/* convert tenth of dB volume (-780..0) to mixer volume register value */
-static int tenthdb2mixer(int db)
-{
- if (db < -660) /* 1.5 dB steps */
- return (2640 - db) / 15;
- else if (db < -600) /* 0.75 dB steps */
- return (990 - db) * 2 / 15;
- else if (db < -460) /* 0.5 dB steps */
- return (460 - db) / 5;
- else /* 0.25 dB steps */
- return -db * 2 / 5;
-}
-
-#elif defined(HAVE_TLV320)
-#define VOLUME_MIN -730
-#define VOLUME_MAX 60
-
-/* convert tenth of dB volume (-840..0) to master volume register value */
-static int tenthdb2master(int db)
-{
- /* +6 to -73dB 1dB steps (plus mute == 80levels) 7bits */
- /* 1111111 == +6dB (0x7f) */
- /* 1111001 == 0dB (0x79) */
- /* 0110000 == -73dB (0x30 */
- /* 0101111 == mute (0x2f) */
-
- if (db < VOLUME_MIN) {
- return 0x2f;
- } else {
- return((db/10)+73+0x30);
- }
-}
-
-#elif defined(HAVE_WM8975) || defined(HAVE_WM8751)
-/* volume/balance/treble/bass interdependency */
-#define VOLUME_MIN -730
-#define VOLUME_MAX 60
-
-/* convert tenth of dB volume (-730..60) to master volume register value */
-static int tenthdb2master(int db)
-{
- /* +6 to -73dB 1dB steps (plus mute == 80levels) 7bits */
- /* 1111111 == +6dB (0x7f) */
- /* 1111001 == 0dB (0x79) */
- /* 0110000 == -73dB (0x30 */
- /* 0101111 == mute (0x2f) */
-
- if (db < VOLUME_MIN) {
- return 0x0;
- } else {
- return((db/10)+73+0x30);
- }
-}
-
-/* convert tenth of dB volume (-780..0) to mixer volume register value */
-static int tenthdb2mixer(int db)
-{
- if (db < -660) /* 1.5 dB steps */
- return (2640 - db) / 15;
- else if (db < -600) /* 0.75 dB steps */
- return (990 - db) * 2 / 15;
- else if (db < -460) /* 0.5 dB steps */
- return (460 - db) / 5;
- else /* 0.25 dB steps */
- return -db * 2 / 5;
-}
-
-#elif defined(HAVE_WM8758)
-/* volume/balance/treble/bass interdependency */
-#define VOLUME_MIN -570
-#define VOLUME_MAX 60
-
-/* convert tenth of dB volume (-57..6) to master volume register value */
-static int tenthdb2master(int db)
-{
- /* +6 to -57dB in 1dB steps == 64 levels = 6 bits */
- /* 0111111 == +6dB (0x3f) = 63) */
- /* 0111001 == 0dB (0x39) = 57) */
- /* 0000001 == -56dB (0x01) = */
- /* 0000000 == -57dB (0x00) */
-
- /* 1000000 == Mute (0x40) */
-
- if (db < VOLUME_MIN) {
- return 0x40;
- } else {
- return((db/10)+57);
- }
-}
-
-/* convert tenth of dB volume (-780..0) to mixer volume register value */
-static int tenthdb2mixer(int db)
-{
- if (db < -660) /* 1.5 dB steps */
- return (2640 - db) / 15;
- else if (db < -600) /* 0.75 dB steps */
- return (990 - db) * 2 / 15;
- else if (db < -460) /* 0.5 dB steps */
- return (460 - db) / 5;
- else /* 0.25 dB steps */
- return -db * 2 / 5;
-}
-
-#elif defined(HAVE_WM8731) || defined(HAVE_WM8721)
-/* volume/balance/treble/bass interdependency */
-#define VOLUME_MIN -730
-#define VOLUME_MAX 60
-
-/* convert tenth of dB volume (-730..60) to master volume register value */
-static int tenthdb2master(int db)
-{
- /* +6 to -73dB 1dB steps (plus mute == 80levels) 7bits */
- /* 1111111 == +6dB (0x7f) */
- /* 1111001 == 0dB (0x79) */
- /* 0110000 == -73dB (0x30 */
- /* 0101111 == mute (0x2f) */
-
- if (db < VOLUME_MIN) {
- return 0x2f;
- } else {
- return((db/10)+0x30+73);
- }
-}
-
-/* convert tenth of dB volume (-780..0) to mixer volume register value */
-static int tenthdb2mixer(int db)
-{
- if (db < -660) /* 1.5 dB steps */
- return (2640 - db) / 15;
- else if (db < -600) /* 0.75 dB steps */
- return (990 - db) * 2 / 15;
- else if (db < -460) /* 0.5 dB steps */
- return (460 - db) / 5;
- else /* 0.25 dB steps */
- return -db * 2 / 5;
-}
-
-#elif defined(HAVE_PP5024_CODEC)
+#if defined(HAVE_PP5024_CODEC)
/* TODO: Work out volume/balance/treble/bass interdependency */
#define VOLUME_MIN 0
#define VOLUME_MAX 1