From: saratoga Date: Thu, 24 Jun 2010 01:11:51 +0000 (+0000) Subject: Commit FS#11364 by me. Increases the A3525v2 volume range by 7.5dB. Each volume... X-Git-Url: https://repo.or.cz/w/kugel-rb.git/commitdiff_plain/97da936a1d8bce56220b3cdf58d8b33f8dd5bbe7 Commit FS#11364 by me. Increases the A3525v2 volume range by 7.5dB. Each volume setting gets 7.5dB louder (if you listened before at 0dB, you would have to set it to about -7.5dB to get the same volume). As a result, the new 0dB actually is pretty close to max line level for a full scale voltage, so positive dB may clip, whereas before they did not because the scale was off. Thanks to dfkt and Tim Graf for help figuring this out. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27101 a1c6a512-1295-4272-9138-f99709370657 --- diff --git a/docs/CREDITS b/docs/CREDITS index ec0d676b9..dab61f7e7 100644 --- a/docs/CREDITS +++ b/docs/CREDITS @@ -550,6 +550,7 @@ Hinrik Örn Sigurðsson Stephen Carroll Joe Balough Jérôme Heil +Tim Graf The libmad team The wavpack team diff --git a/firmware/drivers/audio/as3514.c b/firmware/drivers/audio/as3514.c index 3b0a7cf08..34dc9ad29 100644 --- a/firmware/drivers/audio/as3514.c +++ b/firmware/drivers/audio/as3514.c @@ -64,7 +64,7 @@ #endif const struct sound_settings_info audiohw_settings[] = { - [SOUND_VOLUME] = {"dB", 0, 1, -73, 6, -25}, + [SOUND_VOLUME] = {"dB", 0, 1, VOLUME_MIN/10, 6, -25}, /* HAVE_SW_TONE_CONTROLS */ [SOUND_BASS] = {"dB", 0, 1, -24, 24, 0}, [SOUND_TREBLE] = {"dB", 0, 1, -24, 24, 0}, @@ -114,11 +114,11 @@ static void as3514_write_masked(unsigned int reg, unsigned int bits, /* convert tenth of dB volume to master volume register value */ int tenthdb2master(int db) { - /* +6 to -73.5dB in 1.5dB steps == 53 levels */ + /* +6 to -73.5dB (or -81.0 dB) in 1.5dB steps == 53 (or 58) levels */ if (db < VOLUME_MIN) { return 0x0; - } else if (db >= VOLUME_MAX) { - return 0x35; + } else if (db > VOLUME_MAX) { + return (VOLUME_MAX-VOLUME_MIN)/15; } else { return((db-VOLUME_MIN)/15); /* VOLUME_MIN is negative */ } @@ -250,23 +250,34 @@ void audiohw_set_master_vol(int vol_l, int vol_r) return; } - /* We combine the mixer channel volume range with the headphone volume + /* We combine the mixer/DAC channel volume range with the headphone volume range - keep first stage as loud as possible */ - if (vol_r <= 0x16) { + +/*AS3543 mixer can go a little louder then the as3514, although + * it might be possible to go louder on the as3514 as well */ + +#if CONFIG_CPU == AS3525v2 +#define MIXER_MAX_VOLUME 0x1b +#else /* lets leave the AS3514 alone until its better tested*/ +#define MIXER_MAX_VOLUME 0x16 +#endif + + if (vol_r <= MIXER_MAX_VOLUME) { mix_r = vol_r; hph_r = 0; } else { - mix_r = 0x16; - hph_r = vol_r - 0x16; + mix_r = MIXER_MAX_VOLUME; + hph_r = vol_r - MIXER_MAX_VOLUME; } - if (vol_l <= 0x16) { + if (vol_l <= MIXER_MAX_VOLUME) { mix_l = vol_l; hph_l = 0; } else { - mix_l = 0x16; - hph_l = vol_l - 0x16; - } + mix_l = MIXER_MAX_VOLUME; + hph_l = vol_l - MIXER_MAX_VOLUME; + } + as3514_write_masked(AS3514_DAC_R, mix_r, AS3514_VOL_MASK); as3514_write_masked(AS3514_DAC_L, mix_l, AS3514_VOL_MASK); diff --git a/firmware/export/as3514.h b/firmware/export/as3514.h index 31253724a..ffcf9186e 100644 --- a/firmware/export/as3514.h +++ b/firmware/export/as3514.h @@ -119,8 +119,14 @@ extern void audiohw_set_lineout_vol(int vol_l, int vol_r); #define AS3514_UID_0 0x30 +/*different volume ranges for different AMS chips*/ +#if CONFIG_CPU == AS3525v2 +/* Headphone volume goes from -81.0 ... +6dB */ +#define VOLUME_MIN -810 +#else /* Headphone volume goes from -73.5 ... +6dB */ #define VOLUME_MIN -735 +#endif #define VOLUME_MAX 60 /*** Audio Registers ***/