summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Gmeiner <christian.gmeiner@gmail.com>2008-05-14 21:35:19 +0000
committerChristian Gmeiner <christian.gmeiner@gmail.com>2008-05-14 21:35:19 +0000
commit05e8488ad8f3ff849ab63f2273e44132c64fbfcd (patch)
tree334b360767aecc3050d1d7b0fd80f51e47d893d7
parent955d889a15e6d61e9cbd9b2f35af48ec7b6f3bac (diff)
downloadrockbox-05e8488ad8f3ff849ab63f2273e44132c64fbfcd.zip
rockbox-05e8488ad8f3ff849ab63f2273e44132c64fbfcd.tar.gz
rockbox-05e8488ad8f3ff849ab63f2273e44132c64fbfcd.tar.bz2
rockbox-05e8488ad8f3ff849ab63f2273e44132c64fbfcd.tar.xz
Introduce PRESCALER_CAP and move some driver specific code to the correct place.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17516 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/drivers/audio/mas35xx.c7
-rw-r--r--firmware/drivers/audio/uda1380.c5
-rw-r--r--firmware/export/audiohw.h15
-rw-r--r--firmware/export/mas35xx.h2
-rw-r--r--firmware/export/uda1380.h2
-rw-r--r--firmware/sound.c8
6 files changed, 32 insertions, 7 deletions
diff --git a/firmware/drivers/audio/mas35xx.c b/firmware/drivers/audio/mas35xx.c
index 403ce07..1a0d2af 100644
--- a/firmware/drivers/audio/mas35xx.c
+++ b/firmware/drivers/audio/mas35xx.c
@@ -161,6 +161,13 @@ void audiohw_set_bass(int val)
#endif
}
+#if CONFIG_CODEC == MAS3507D
+void audiohw_set_prescaler(int val)
+{
+ mas_writereg(MAS_REG_KPRESCALE, prescale_table[val/10]);
+}
+#endif
+
void audiohw_set_treble(int val)
{
#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
diff --git a/firmware/drivers/audio/uda1380.c b/firmware/drivers/audio/uda1380.c
index f6a7c73..388e59b 100644
--- a/firmware/drivers/audio/uda1380.c
+++ b/firmware/drivers/audio/uda1380.c
@@ -282,6 +282,11 @@ void audiohw_postinit(void)
audiohw_mute(false);
}
+void audiohw_set_prescaler(int val)
+{
+ audiohw_set_mixer_vol(tenthdb2mixer(-val), tenthdb2mixer(-val));
+}
+
/* Nice shutdown of UDA1380 codec */
void audiohw_close(void)
{
diff --git a/firmware/export/audiohw.h b/firmware/export/audiohw.h
index d11a3b5..4c9271e 100644
--- a/firmware/export/audiohw.h
+++ b/firmware/export/audiohw.h
@@ -28,6 +28,7 @@
#define BASS_CAP (1 << 1)
#define BALANCE_CAP (1 << 2)
#define CLIPPING_CAP (1 << 3)
+#define PRESCALER_CAP (1 << 4)
#ifdef HAVE_UDA1380
#include "uda1380.h"
@@ -72,6 +73,10 @@
#if (AUDIOHW_CAPS & CLIPPING_CAP)
#define AUDIOHW_HAVE_CLIPPING
#endif
+
+#if (AUDIOHW_CAPS & PRESCALER_CAP)
+#define AUDIOHW_HAVE_PRESCALER
+#endif
#endif /* AUDIOHW_CAPS */
enum {
@@ -164,6 +169,16 @@ void audiohw_close(void);
void audiohw_set_volume(int val);
#endif
+#ifdef AUDIOHW_HAVE_PRESCALER
+/**
+ * Set new prescaler value.
+ * @param val to set.
+ * NOTE: AUDIOHW_CAPS need to contain
+ * PRESCALER_CAP
+ */
+void audiohw_set_prescaler(int val);
+#endif
+
#ifdef AUDIOHW_HAVE_BALANCE
/**
* Set new balance value
diff --git a/firmware/export/mas35xx.h b/firmware/export/mas35xx.h
index d28db0f..a0da03d 100644
--- a/firmware/export/mas35xx.h
+++ b/firmware/export/mas35xx.h
@@ -28,7 +28,7 @@
#define VOLUME_MIN -780
#define VOLUME_MAX 180
-#define AUDIOHW_CAPS (BASS_CAP | TREBLE_CAP)
+#define AUDIOHW_CAPS (BASS_CAP | TREBLE_CAP | PRESCALER_CAP)
#else /* CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F */
diff --git a/firmware/export/uda1380.h b/firmware/export/uda1380.h
index c23f952..e0125d8 100644
--- a/firmware/export/uda1380.h
+++ b/firmware/export/uda1380.h
@@ -24,7 +24,7 @@
#define VOLUME_MIN -840
#define VOLUME_MAX 0
-#define AUDIOHW_CAPS (BASS_CAP | TREBLE_CAP)
+#define AUDIOHW_CAPS (BASS_CAP | TREBLE_CAP | PRESCALER_CAP)
extern int tenthdb2master(int db);
extern int tenthdb2mixer(int db);
diff --git a/firmware/sound.c b/firmware/sound.c
index 8282dec..5c6a821 100644
--- a/firmware/sound.c
+++ b/firmware/sound.c
@@ -264,12 +264,10 @@ static void set_prescaled_volume(void)
prescale = VOLUME_MAX - current_volume;
#endif
-#if defined(HAVE_SW_TONE_CONTROLS)
+#if defined(AUDIOHW_HAVE_PRESCALER)
+ audiohw_set_prescaler(prescale);
+#else
dsp_callback(DSP_CALLBACK_SET_PRESCALE, prescale);
-#elif CONFIG_CODEC == MAS3507D
- mas_writereg(MAS_REG_KPRESCALE, prescale_table[prescale/10]);
-#elif defined(HAVE_UDA1380)
- audiohw_set_mixer_vol(tenthdb2mixer(-prescale), tenthdb2mixer(-prescale));
#endif
if (current_volume == VOLUME_MIN)