Increase sansa volume range at the lower end. This seems to be necessary

now after the audio improvement: -40.5dB ... +6dB => -73.5 ... +6dB


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13447 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Antonius Hellmann 2007-05-20 19:09:15 +00:00
parent c4da23ab0e
commit 731d7a16c3
3 changed files with 29 additions and 15 deletions

View file

@ -55,16 +55,11 @@ static void as3514_write(int reg, int value)
/* convert tenth of dB volume to master volume register value */
int tenthdb2master(int db)
{
/* +6 to -40.43dB in 1.5dB steps == 32 levels = 5 bits */
/* 11111 == +6dB (0x1f) = 31) */
/* 11110 == -4.5dB (0x1e) = 30) */
/* 00001 == -39dB (0x01) */
/* 00000 == -40.5dB (0x00) */
/* +6 to -73.5dB in 1.5dB steps == 53 levels */
if (db < VOLUME_MIN) {
return 0x0;
} else if (db >= VOLUME_MAX) {
return 0x1f;
return 0x35;
} else {
return((db-VOLUME_MIN)/15); /* VOLUME_MIN is negative */
}
@ -147,16 +142,35 @@ void audiohw_enable_output(bool enable)
int audiohw_set_master_vol(int vol_l, int vol_r)
{
vol_l &= 0x1f;
vol_r &= 0x1f;
int hph_r = as3514_regs[HPH_OUT_R] & ~0x1f;
int hph_l = as3514_regs[HPH_OUT_L] & ~0x1f;
/* we are controling dac volume instead of headphone volume,
as the volume is bigger.
HDP: 1.07 dB gain
DAC: 6 dB gain
*/
as3514_write(DAC_R, vol_r);
as3514_write(DAC_L, 0x40 | vol_l);
if(vol_r <= 0x16)
{
as3514_write(DAC_R, vol_r);
as3514_write(HPH_OUT_R, hph_r); /* set 0 */
}
else
{
as3514_write(DAC_R, 0x16);
as3514_write(HPH_OUT_R, hph_r + (vol_r - 0x16));
}
if(vol_l <= 0x16)
{
as3514_write(DAC_L, 0x40 + vol_l);
as3514_write(HPH_OUT_L, hph_l); /* set 0 */
}
else
{
as3514_write(DAC_L, 0x40 + 0x16);
as3514_write(HPH_OUT_L, hph_l + (vol_l - 0x16));
}
return 0;
}

View file

@ -69,9 +69,9 @@ extern void audiohw_set_monitor(int enable);
#define ADC_0 0x2e
#define ADC_1 0x2f
/* Headphone volume goes from -40.5 - 6dB */
#define VOLUME_MIN -405
#define VOLUME_MAX 60
/* Headphone volume goes from -73.5 ... +6dB */
#define VOLUME_MIN -735
#define VOLUME_MAX 60
#ifdef SANSA_E200
#define AS3514_I2C_ADDR 0x46

View file

@ -81,7 +81,7 @@ static const struct sound_settings_info sound_settings_table[] = {
#elif (CONFIG_CPU == PNX0101)
[SOUND_VOLUME] = {"dB", 0, 1, -48, 15, 0, sound_set_volume},
#elif defined(HAVE_AS3514)
[SOUND_VOLUME] = {"dB", 0, 1, -40, 6, -25, sound_set_volume},
[SOUND_VOLUME] = {"dB", 0, 1, -74, 6, -25, sound_set_volume},
#else /* MAS3507D */
[SOUND_VOLUME] = {"dB", 0, 1, -78, 18, -18, sound_set_volume},
[SOUND_BASS] = {"dB", 0, 1, -15, 15, 7, sound_set_bass},