1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Christian Gmeiner 2008-05-14 21:35:19 +00:00
parent 955d889a15
commit 05e8488ad8
6 changed files with 32 additions and 7 deletions

View file

@ -161,6 +161,13 @@ void audiohw_set_bass(int val)
#endif #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) void audiohw_set_treble(int val)
{ {
#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) #if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)

View file

@ -282,6 +282,11 @@ void audiohw_postinit(void)
audiohw_mute(false); audiohw_mute(false);
} }
void audiohw_set_prescaler(int val)
{
audiohw_set_mixer_vol(tenthdb2mixer(-val), tenthdb2mixer(-val));
}
/* Nice shutdown of UDA1380 codec */ /* Nice shutdown of UDA1380 codec */
void audiohw_close(void) void audiohw_close(void)
{ {

View file

@ -28,6 +28,7 @@
#define BASS_CAP (1 << 1) #define BASS_CAP (1 << 1)
#define BALANCE_CAP (1 << 2) #define BALANCE_CAP (1 << 2)
#define CLIPPING_CAP (1 << 3) #define CLIPPING_CAP (1 << 3)
#define PRESCALER_CAP (1 << 4)
#ifdef HAVE_UDA1380 #ifdef HAVE_UDA1380
#include "uda1380.h" #include "uda1380.h"
@ -72,6 +73,10 @@
#if (AUDIOHW_CAPS & CLIPPING_CAP) #if (AUDIOHW_CAPS & CLIPPING_CAP)
#define AUDIOHW_HAVE_CLIPPING #define AUDIOHW_HAVE_CLIPPING
#endif #endif
#if (AUDIOHW_CAPS & PRESCALER_CAP)
#define AUDIOHW_HAVE_PRESCALER
#endif
#endif /* AUDIOHW_CAPS */ #endif /* AUDIOHW_CAPS */
enum { enum {
@ -164,6 +169,16 @@ void audiohw_close(void);
void audiohw_set_volume(int val); void audiohw_set_volume(int val);
#endif #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 #ifdef AUDIOHW_HAVE_BALANCE
/** /**
* Set new balance value * Set new balance value

View file

@ -28,7 +28,7 @@
#define VOLUME_MIN -780 #define VOLUME_MIN -780
#define VOLUME_MAX 180 #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 */ #else /* CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F */

View file

@ -24,7 +24,7 @@
#define VOLUME_MIN -840 #define VOLUME_MIN -840
#define VOLUME_MAX 0 #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 tenthdb2master(int db);
extern int tenthdb2mixer(int db); extern int tenthdb2mixer(int db);

View file

@ -264,12 +264,10 @@ static void set_prescaled_volume(void)
prescale = VOLUME_MAX - current_volume; prescale = VOLUME_MAX - current_volume;
#endif #endif
#if defined(HAVE_SW_TONE_CONTROLS) #if defined(AUDIOHW_HAVE_PRESCALER)
audiohw_set_prescaler(prescale);
#else
dsp_callback(DSP_CALLBACK_SET_PRESCALE, prescale); 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 #endif
if (current_volume == VOLUME_MIN) if (current_volume == VOLUME_MIN)