MRobe100, HD200, Gigabeat F/X (anything with wm8750 or wm8751). Properly prescale bass and treble controls to avoid clipping.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25940 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
7d21e5ab32
commit
8ce5b01ec7
3 changed files with 21 additions and 8 deletions
|
@ -61,6 +61,8 @@ const struct sound_settings_info audiohw_settings[] = {
|
|||
/* We use linear treble control with 4 kHz cutoff */
|
||||
#define TREBCTRL_BITS (TREBCTRL_TC)
|
||||
|
||||
static int prescaler = 0;
|
||||
|
||||
/* convert tenth of dB volume (-730..60) to master volume register value */
|
||||
int tenthdb2master(int db)
|
||||
{
|
||||
|
@ -173,6 +175,10 @@ void audiohw_postinit(void)
|
|||
PWRMGMT2_ROUT2);
|
||||
#endif
|
||||
|
||||
/* Full -0dB on the DACS */
|
||||
wmcodec_write(LEFTGAIN, 0xff);
|
||||
wmcodec_write(RIGHTGAIN, RIGHTGAIN_RDVU | 0xff);
|
||||
|
||||
wmcodec_write(ADDITIONAL1, ADDITIONAL1_TSDEN | ADDITIONAL1_TOEN |
|
||||
ADDITIONAL1_DMONOMIX_LLRR | ADDITIONAL1_VSEL_DEFAULT);
|
||||
|
||||
|
@ -249,6 +255,14 @@ void audiohw_set_treble(int value)
|
|||
TREBCTRL_TREB(tone_tenthdb2hw(value)));
|
||||
}
|
||||
|
||||
void audiohw_set_prescaler(int value)
|
||||
{
|
||||
prescaler = 2 * value;
|
||||
wmcodec_write(LEFTGAIN, 0xff - (prescaler & LEFTGAIN_LDACVOL));
|
||||
wmcodec_write(RIGHTGAIN, RIGHTGAIN_RDVU |
|
||||
(0xff - (prescaler & RIGHTGAIN_RDACVOL)));
|
||||
}
|
||||
|
||||
/* Nice shutdown of WM8751 codec */
|
||||
void audiohw_close(void)
|
||||
{
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#define VOLUME_MIN -730
|
||||
#define VOLUME_MAX 60
|
||||
|
||||
#define AUDIOHW_CAPS (BASS_CAP | TREBLE_CAP)
|
||||
#define AUDIOHW_CAPS (BASS_CAP | TREBLE_CAP | PRESCALER_CAP)
|
||||
|
||||
extern int tenthdb2master(int db);
|
||||
|
||||
|
@ -96,12 +96,12 @@ void audiohw_set_recsrc(int source, bool recording);
|
|||
#define CLOCKING_BCLK_DIV2 (1 << 7)
|
||||
|
||||
#define LEFTGAIN 0x0a
|
||||
#define LEFTGAIN_LDACVOL(x) ((x) & 0xff)
|
||||
#define LEFTGAIN_LDACVOL 0xff
|
||||
#define LEFTGAIN_LDVU (1 << 8)
|
||||
|
||||
#define RIGHTGAIN 0x0b
|
||||
#define RIGHTGAIN_LDACVOL(x) ((x) & 0xff)
|
||||
#define RIGHTGAIN_LDVU (1 << 8)
|
||||
#define RIGHTGAIN_RDACVOL 0xff
|
||||
#define RIGHTGAIN_RDVU (1 << 8)
|
||||
|
||||
#define BASSCTRL 0x0c
|
||||
#define BASSCTRL_BASS(x) ((x) & 0xf)
|
||||
|
|
|
@ -189,8 +189,7 @@ static void set_prescaled_volume(void)
|
|||
*/
|
||||
#if defined(HAVE_SW_TONE_CONTROLS) || !(defined(HAVE_WM8975) \
|
||||
|| defined(HAVE_WM8711) || defined(HAVE_WM8721) || defined(HAVE_WM8731) \
|
||||
|| defined(HAVE_WM8751) || defined(HAVE_WM8758) || defined(HAVE_WM8985) \
|
||||
|| defined(HAVE_UDA1341))
|
||||
|| defined(HAVE_WM8758) || defined(HAVE_WM8985) || defined(HAVE_UDA1341))
|
||||
|
||||
prescale = MAX(current_bass, current_treble);
|
||||
if (prescale < 0)
|
||||
|
@ -297,7 +296,7 @@ void sound_set_bass(int value)
|
|||
|
||||
#if !defined(AUDIOHW_HAVE_CLIPPING)
|
||||
#if defined(HAVE_WM8750) || defined(HAVE_WM8751)
|
||||
current_bass = value;
|
||||
current_bass = value / 15;
|
||||
#else
|
||||
current_bass = value * 10;
|
||||
#endif
|
||||
|
@ -321,7 +320,7 @@ void sound_set_treble(int value)
|
|||
|
||||
#if !defined(AUDIOHW_HAVE_CLIPPING)
|
||||
#if defined(HAVE_WM8750) || defined(HAVE_WM8751)
|
||||
current_treble = value;
|
||||
current_treble = value / 15;
|
||||
#else
|
||||
current_treble = value * 10;
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue