From cdbf33adf719a54221f4f5aac4b15b0dfe54d24d Mon Sep 17 00:00:00 2001 From: Christian Gmeiner Date: Tue, 22 May 2007 15:56:05 +0000 Subject: * move audio settings into audio codec drivers * add mas35xx driver for all mas35xx targets. Later mas35xx code from sound.c will move to this new driver git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13464 a1c6a512-1295-4272-9138-f99709370657 --- firmware/drivers/audio/as3514.c | 10 ++++++++ firmware/drivers/audio/mas35xx.c | 54 ++++++++++++++++++++++++++++++++++++++++ firmware/drivers/audio/tlv320.c | 13 ++++++++++ firmware/drivers/audio/uda1380.c | 12 +++++++++ firmware/drivers/audio/wm8731l.c | 13 ++++++++++ firmware/drivers/audio/wm8751.c | 9 +++++++ firmware/drivers/audio/wm8758.c | 12 +++++++++ firmware/drivers/audio/wm8975.c | 12 ++++++++- 8 files changed, 134 insertions(+), 1 deletion(-) create mode 100644 firmware/drivers/audio/mas35xx.c (limited to 'firmware/drivers/audio') diff --git a/firmware/drivers/audio/as3514.c b/firmware/drivers/audio/as3514.c index d068e08081..98e3e439a0 100644 --- a/firmware/drivers/audio/as3514.c +++ b/firmware/drivers/audio/as3514.c @@ -27,6 +27,16 @@ #include "i2s.h" #include "i2c-pp.h" +const struct sound_settings_info audiohw_settings[] = { + [SOUND_VOLUME] = {"dB", 0, 1, -74, 6, -25}, + /* HAVE_SW_TONE_CONTROLS */ + [SOUND_BASS] = {"dB", 0, 1, -24, 24, 0}, + [SOUND_TREBLE] = {"dB", 0, 1, -24, 24, 0}, + [SOUND_BALANCE] = {"%", 0, 1,-100, 100, 0}, + [SOUND_CHANNELS] = {"", 0, 1, 0, 5, 0}, + [SOUND_STEREO_WIDTH] = {"%", 0, 1, 0, 255, 100}, +}; + /* Shadow registers */ int as3514_regs[0x1E]; /* last audio register: PLLMODE 0x1d */ diff --git a/firmware/drivers/audio/mas35xx.c b/firmware/drivers/audio/mas35xx.c new file mode 100644 index 0000000000..6a9d290049 --- /dev/null +++ b/firmware/drivers/audio/mas35xx.c @@ -0,0 +1,54 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id: wm8975.c 13453 2007-05-20 23:10:15Z christian $ + * + * Driver for MAS35xx audio codec + * + * + * Copyright (c) 2007 by Christian Gmeiner + * + * All files in this archive are subject to the GNU General Public License. + * See the file COPYING in the source tree root for full license agreement. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +#include "config.h" +#include "mas35xx.h" + +const struct sound_settings_info audiohw_settings[] = { +#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) + [SOUND_VOLUME] = {"dB", 0, 1,-100, 12, -25}, + [SOUND_BASS] = {"dB", 0, 1, -12, 12, 6}, + [SOUND_TREBLE] = {"dB", 0, 1, -12, 12, 6}, +#else /* MAS3507D */ + [SOUND_VOLUME] = {"dB", 0, 1, -78, 18, -18}, + [SOUND_BASS] = {"dB", 0, 1, -15, 15, 7}, + [SOUND_TREBLE] = {"dB", 0, 1, -15, 15, 7}, +#endif + [SOUND_BALANCE] = {"%", 0, 1,-100, 100, 0}, + [SOUND_CHANNELS] = {"", 0, 1, 0, 5, 0}, + [SOUND_STEREO_WIDTH] = {"%", 0, 1, 0, 255, 100}, +#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) + [SOUND_LOUDNESS] = {"dB", 0, 1, 0, 17, 0}, + [SOUND_AVC] = {"", 0, 1, -1, 4, 0}, + [SOUND_MDB_STRENGTH] = {"dB", 0, 1, 0, 127, 48}, + [SOUND_MDB_HARMONICS] = {"%", 0, 1, 0, 100, 50}, + [SOUND_MDB_CENTER] = {"Hz", 0, 10, 20, 300, 60}, + [SOUND_MDB_SHAPE] = {"Hz", 0, 10, 50, 300, 90}, + [SOUND_MDB_ENABLE] = {"", 0, 1, 0, 1, 0}, + [SOUND_SUPERBASS] = {"", 0, 1, 0, 1, 0}, +#endif +#if CONFIG_CODEC == MAS3587F + [SOUND_LEFT_GAIN] = {"dB", 1, 1, 0, 15, 8}, + [SOUND_RIGHT_GAIN] = {"dB", 1, 1, 0, 15, 8}, + [SOUND_MIC_GAIN] = {"dB", 1, 1, 0, 15, 2}, +#endif +}; diff --git a/firmware/drivers/audio/tlv320.c b/firmware/drivers/audio/tlv320.c index 90587fc23a..95945883bf 100644 --- a/firmware/drivers/audio/tlv320.c +++ b/firmware/drivers/audio/tlv320.c @@ -24,6 +24,19 @@ #include "i2c-coldfire.h" #include "tlv320.h" +const struct sound_settings_info audiohw_settings[] = { + [SOUND_VOLUME] = {"dB", 0, 1, -73, 6, -20}, + /* HAVE_SW_TONE_CONTROLS */ + [SOUND_BASS] = {"dB", 0, 1, -24, 24, 0}, + [SOUND_TREBLE] = {"dB", 0, 1, -24, 24, 0}, + [SOUND_BALANCE] = {"%", 0, 1,-100, 100, 0}, + [SOUND_CHANNELS] = {"", 0, 1, 0, 5, 0}, + [SOUND_STEREO_WIDTH] = {"%", 0, 1, 0, 255, 100}, + [SOUND_LEFT_GAIN] = {"dB", 1, 1, 0, 31, 23}, + [SOUND_RIGHT_GAIN] = {"dB", 1, 1, 0, 31, 23}, + [SOUND_MIC_GAIN] = {"dB", 1, 1, 0, 1, 1}, +}; + /* convert tenth of dB volume (-840..0) to master volume register value */ int tenthdb2master(int db) { diff --git a/firmware/drivers/audio/uda1380.c b/firmware/drivers/audio/uda1380.c index ae0d1e841d..6ee35fab4d 100644 --- a/firmware/drivers/audio/uda1380.c +++ b/firmware/drivers/audio/uda1380.c @@ -26,6 +26,18 @@ #include "uda1380.h" #include "pcf50606.h" +const struct sound_settings_info audiohw_settings[] = { + [SOUND_VOLUME] = {"dB", 0, 1, -84, 0, -25}, + [SOUND_BASS] = {"dB", 0, 2, 0, 24, 0}, + [SOUND_TREBLE] = {"dB", 0, 2, 0, 6, 0}, + [SOUND_BALANCE] = {"%", 0, 1,-100, 100, 0}, + [SOUND_CHANNELS] = {"", 0, 1, 0, 5, 0}, + [SOUND_STEREO_WIDTH] = {"%", 0, 1, 0, 255, 100}, + [SOUND_LEFT_GAIN] = {"dB", 1, 1,-128, 96, 0}, + [SOUND_RIGHT_GAIN] = {"dB", 1, 1,-128, 96, 0}, + [SOUND_MIC_GAIN] = {"dB", 1, 1,-128, 108, 16}, +}; + /* convert tenth of dB volume (-840..0) to master volume register value */ int tenthdb2master(int db) { diff --git a/firmware/drivers/audio/wm8731l.c b/firmware/drivers/audio/wm8731l.c index ffed5c9347..dcf7c4eca0 100644 --- a/firmware/drivers/audio/wm8731l.c +++ b/firmware/drivers/audio/wm8731l.c @@ -37,6 +37,19 @@ /* use zero crossing to reduce clicks during volume changes */ #define VOLUME_ZC_WAIT (1<<7) +const struct sound_settings_info audiohw_settings[] = { + [SOUND_VOLUME] = {"dB", 0, 1, -74, 6, -25}, + /* HAVE_SW_TONE_CONTROLS */ + [SOUND_BASS] = {"dB", 0, 1, -24, 24, 0}, + [SOUND_TREBLE] = {"dB", 0, 1, -24, 24, 0}, + [SOUND_BALANCE] = {"%", 0, 1,-100, 100, 0}, + [SOUND_CHANNELS] = {"", 0, 1, 0, 5, 0}, + [SOUND_STEREO_WIDTH] = {"%", 0, 1, 0, 255, 100}, + [SOUND_LEFT_GAIN] = {"dB", 1, 1,-128, 96, 0}, + [SOUND_RIGHT_GAIN] = {"dB", 1, 1,-128, 96, 0}, + [SOUND_MIC_GAIN] = {"dB", 1, 1,-128, 108, 16}, +}; + /* convert tenth of dB volume (-730..60) to master volume register value */ int tenthdb2master(int db) { diff --git a/firmware/drivers/audio/wm8751.c b/firmware/drivers/audio/wm8751.c index 2f79f27c7c..bb2b40bbbd 100644 --- a/firmware/drivers/audio/wm8751.c +++ b/firmware/drivers/audio/wm8751.c @@ -29,6 +29,15 @@ #include "audio.h" #include "sound.h" +const struct sound_settings_info audiohw_settings[] = { + [SOUND_VOLUME] = {"dB", 0, 1, -74, 6, -25}, + [SOUND_BASS] = {"dB", 1, 15, -60, 90, 0}, + [SOUND_TREBLE] = {"dB", 1, 15, -60, 90, 0}, + [SOUND_BALANCE] = {"%", 0, 1,-100, 100, 0}, + [SOUND_CHANNELS] = {"", 0, 1, 0, 5, 0}, + [SOUND_STEREO_WIDTH] = {"%", 0, 1, 0, 255, 100}, +}; + /* Flags used in combination with settings */ /* use zero crossing to reduce clicks during volume changes */ diff --git a/firmware/drivers/audio/wm8758.c b/firmware/drivers/audio/wm8758.c index b8e220753c..34f95a989d 100644 --- a/firmware/drivers/audio/wm8758.c +++ b/firmware/drivers/audio/wm8758.c @@ -31,6 +31,18 @@ #include "wm8758.h" #include "i2s.h" +const struct sound_settings_info audiohw_settings[] = { + [SOUND_VOLUME] = {"dB", 0, 1, -58, 6, -25}, + [SOUND_BASS] = {"dB", 0, 1, -6, 9, 0}, + [SOUND_TREBLE] = {"dB", 0, 1, -6, 9, 0}, + [SOUND_BALANCE] = {"%", 0, 1,-100, 100, 0}, + [SOUND_CHANNELS] = {"", 0, 1, 0, 5, 0}, + [SOUND_STEREO_WIDTH] = {"%", 0, 1, 0, 255, 100}, + [SOUND_LEFT_GAIN] = {"dB", 1, 1,-128, 96, 0}, + [SOUND_RIGHT_GAIN] = {"dB", 1, 1,-128, 96, 0}, + [SOUND_MIC_GAIN] = {"dB", 1, 1,-128, 108, 16}, +}; + /* convert tenth of dB volume (-57..6) to master volume register value */ int tenthdb2master(int db) { diff --git a/firmware/drivers/audio/wm8975.c b/firmware/drivers/audio/wm8975.c index 3d870a8f90..4b018b985b 100644 --- a/firmware/drivers/audio/wm8975.c +++ b/firmware/drivers/audio/wm8975.c @@ -35,7 +35,17 @@ /* use zero crossing to reduce clicks during volume changes */ #define VOLUME_ZC_WAIT (1<<7) - +const struct sound_settings_info audiohw_settings[] = { + [SOUND_VOLUME] = {"dB", 0, 1, -74, 6, -25}, + [SOUND_BASS] = {"dB", 0, 1, -6, 9, 0}, + [SOUND_TREBLE] = {"dB", 0, 1, -6, 9, 0}, + [SOUND_BALANCE] = {"%", 0, 1,-100, 100, 0}, + [SOUND_CHANNELS] = {"", 0, 1, 0, 5, 0}, + [SOUND_STEREO_WIDTH] = {"%", 0, 1, 0, 255, 100}, + [SOUND_LEFT_GAIN] = {"dB", 1, 1,-128, 96, 0}, + [SOUND_RIGHT_GAIN] = {"dB", 1, 1,-128, 96, 0}, + [SOUND_MIC_GAIN] = {"dB", 1, 1,-128, 108, 16}, +}; /* convert tenth of dB volume (-730..60) to master volume register value */ int tenthdb2master(int db) -- cgit v1.2.3