forked from len0rd/rockbox
* 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
This commit is contained in:
parent
e7075db2a7
commit
cdbf33adf7
22 changed files with 336 additions and 133 deletions
|
@ -207,6 +207,8 @@ drivers/audio/wm8731l.c
|
||||||
drivers/audio/as3514.c
|
drivers/audio/as3514.c
|
||||||
#elif defined(HAVE_TLV320)
|
#elif defined(HAVE_TLV320)
|
||||||
drivers/audio/tlv320.c
|
drivers/audio/tlv320.c
|
||||||
|
#elif defined(HAVE_MAS35XX)
|
||||||
|
drivers/audio/mas35xx.c
|
||||||
#endif /* defined(HAVE_*) */
|
#endif /* defined(HAVE_*) */
|
||||||
#endif /* SIMULATOR */
|
#endif /* SIMULATOR */
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,16 @@
|
||||||
#include "i2s.h"
|
#include "i2s.h"
|
||||||
#include "i2c-pp.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 */
|
/* Shadow registers */
|
||||||
int as3514_regs[0x1E]; /* last audio register: PLLMODE 0x1d */
|
int as3514_regs[0x1E]; /* last audio register: PLLMODE 0x1d */
|
||||||
|
|
||||||
|
|
54
firmware/drivers/audio/mas35xx.c
Normal file
54
firmware/drivers/audio/mas35xx.c
Normal file
|
@ -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
|
||||||
|
};
|
|
@ -24,6 +24,19 @@
|
||||||
#include "i2c-coldfire.h"
|
#include "i2c-coldfire.h"
|
||||||
#include "tlv320.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 */
|
/* convert tenth of dB volume (-840..0) to master volume register value */
|
||||||
int tenthdb2master(int db)
|
int tenthdb2master(int db)
|
||||||
{
|
{
|
||||||
|
|
|
@ -26,6 +26,18 @@
|
||||||
#include "uda1380.h"
|
#include "uda1380.h"
|
||||||
#include "pcf50606.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 */
|
/* convert tenth of dB volume (-840..0) to master volume register value */
|
||||||
int tenthdb2master(int db)
|
int tenthdb2master(int db)
|
||||||
{
|
{
|
||||||
|
|
|
@ -37,6 +37,19 @@
|
||||||
/* use zero crossing to reduce clicks during volume changes */
|
/* use zero crossing to reduce clicks during volume changes */
|
||||||
#define VOLUME_ZC_WAIT (1<<7)
|
#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 */
|
/* convert tenth of dB volume (-730..60) to master volume register value */
|
||||||
int tenthdb2master(int db)
|
int tenthdb2master(int db)
|
||||||
{
|
{
|
||||||
|
|
|
@ -29,6 +29,15 @@
|
||||||
#include "audio.h"
|
#include "audio.h"
|
||||||
#include "sound.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 */
|
/* Flags used in combination with settings */
|
||||||
|
|
||||||
/* use zero crossing to reduce clicks during volume changes */
|
/* use zero crossing to reduce clicks during volume changes */
|
||||||
|
|
|
@ -31,6 +31,18 @@
|
||||||
#include "wm8758.h"
|
#include "wm8758.h"
|
||||||
#include "i2s.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 */
|
/* convert tenth of dB volume (-57..6) to master volume register value */
|
||||||
int tenthdb2master(int db)
|
int tenthdb2master(int db)
|
||||||
{
|
{
|
||||||
|
|
|
@ -35,7 +35,17 @@
|
||||||
/* use zero crossing to reduce clicks during volume changes */
|
/* use zero crossing to reduce clicks during volume changes */
|
||||||
#define VOLUME_ZC_WAIT (1<<7)
|
#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 */
|
/* convert tenth of dB volume (-730..60) to master volume register value */
|
||||||
int tenthdb2master(int db)
|
int tenthdb2master(int db)
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#define _AS3514_H
|
#define _AS3514_H
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
#include "audiohw.h"
|
||||||
|
|
||||||
extern int tenthdb2master(int db);
|
extern int tenthdb2master(int db);
|
||||||
|
|
||||||
|
|
73
firmware/export/audiohw.h
Normal file
73
firmware/export/audiohw.h
Normal file
|
@ -0,0 +1,73 @@
|
||||||
|
/***************************************************************************
|
||||||
|
* __________ __ ___.
|
||||||
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||||
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||||
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||||
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||||
|
* \/ \/ \/ \/ \/
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef _AUDIOHW_H_
|
||||||
|
#define _AUDIOHW_H_
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
enum {
|
||||||
|
SOUND_VOLUME = 0,
|
||||||
|
SOUND_BASS,
|
||||||
|
SOUND_TREBLE,
|
||||||
|
SOUND_BALANCE,
|
||||||
|
SOUND_CHANNELS,
|
||||||
|
SOUND_STEREO_WIDTH,
|
||||||
|
#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
|
||||||
|
SOUND_LOUDNESS,
|
||||||
|
SOUND_AVC,
|
||||||
|
SOUND_MDB_STRENGTH,
|
||||||
|
SOUND_MDB_HARMONICS,
|
||||||
|
SOUND_MDB_CENTER,
|
||||||
|
SOUND_MDB_SHAPE,
|
||||||
|
SOUND_MDB_ENABLE,
|
||||||
|
SOUND_SUPERBASS,
|
||||||
|
#endif
|
||||||
|
#if CONFIG_CODEC == MAS3587F || defined(HAVE_UDA1380) || defined(HAVE_TLV320)\
|
||||||
|
|| defined(HAVE_WM8975) || defined(HAVE_WM8758) || defined(HAVE_WM8731)
|
||||||
|
SOUND_LEFT_GAIN,
|
||||||
|
SOUND_RIGHT_GAIN,
|
||||||
|
SOUND_MIC_GAIN,
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
enum Channel {
|
||||||
|
SOUND_CHAN_STEREO,
|
||||||
|
SOUND_CHAN_MONO,
|
||||||
|
SOUND_CHAN_CUSTOM,
|
||||||
|
SOUND_CHAN_MONO_LEFT,
|
||||||
|
SOUND_CHAN_MONO_RIGHT,
|
||||||
|
SOUND_CHAN_KARAOKE,
|
||||||
|
SOUND_CHAN_NUM_MODES,
|
||||||
|
};
|
||||||
|
|
||||||
|
struct sound_settings_info {
|
||||||
|
const char *unit;
|
||||||
|
int numdecimals;
|
||||||
|
int steps;
|
||||||
|
int minval;
|
||||||
|
int maxval;
|
||||||
|
int defaultval;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* This struct is used by every driver to export its min/max/default values for
|
||||||
|
* its audio settings. Keep in mind that the order must be correct! */
|
||||||
|
extern const struct sound_settings_info audiohw_settings[];
|
||||||
|
|
||||||
|
#endif /* _AUDIOHW_H_ */
|
|
@ -253,6 +253,11 @@
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Add one HAVE_ define for all mas35xx targets */
|
||||||
|
#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3507D) || (CONFIG_CODEC == MAS3539F)
|
||||||
|
#define HAVE_MAS35XX
|
||||||
|
#endif
|
||||||
|
|
||||||
#if CONFIG_CODEC == SWCODEC && !defined(BOOTLOADER)
|
#if CONFIG_CODEC == SWCODEC && !defined(BOOTLOADER)
|
||||||
#define HAVE_EXTENDED_MESSAGING_AND_NAME
|
#define HAVE_EXTENDED_MESSAGING_AND_NAME
|
||||||
#endif
|
#endif
|
||||||
|
|
27
firmware/export/mas35xx.h
Normal file
27
firmware/export/mas35xx.h
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
/***************************************************************************
|
||||||
|
* __________ __ ___.
|
||||||
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||||
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||||
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||||
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||||
|
* \/ \/ \/ \/ \/
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* Implementation of MAS35xx audiohw api driver.
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef _MAS35XX_H
|
||||||
|
#define _MAS35XX_H
|
||||||
|
|
||||||
|
#include "audiohw.h"
|
||||||
|
|
||||||
|
#endif /* _MAS35XX_H */
|
|
@ -34,45 +34,12 @@
|
||||||
#include "tlv320.h"
|
#include "tlv320.h"
|
||||||
#elif defined(HAVE_AS3514)
|
#elif defined(HAVE_AS3514)
|
||||||
#include "as3514.h"
|
#include "as3514.h"
|
||||||
|
#elif defined(HAVE_MAS35XX)
|
||||||
|
#include "mas35xx.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern void audiohw_postinit(void);
|
extern void audiohw_postinit(void);
|
||||||
|
|
||||||
enum {
|
|
||||||
SOUND_VOLUME = 0,
|
|
||||||
SOUND_BASS,
|
|
||||||
SOUND_TREBLE,
|
|
||||||
SOUND_BALANCE,
|
|
||||||
SOUND_CHANNELS,
|
|
||||||
SOUND_STEREO_WIDTH,
|
|
||||||
#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
|
|
||||||
SOUND_LOUDNESS,
|
|
||||||
SOUND_AVC,
|
|
||||||
SOUND_MDB_STRENGTH,
|
|
||||||
SOUND_MDB_HARMONICS,
|
|
||||||
SOUND_MDB_CENTER,
|
|
||||||
SOUND_MDB_SHAPE,
|
|
||||||
SOUND_MDB_ENABLE,
|
|
||||||
SOUND_SUPERBASS,
|
|
||||||
#endif
|
|
||||||
#if CONFIG_CODEC == MAS3587F || defined(HAVE_UDA1380) || defined(HAVE_TLV320)\
|
|
||||||
|| defined(HAVE_WM8975) || defined(HAVE_WM8758) || defined(HAVE_WM8731)
|
|
||||||
SOUND_LEFT_GAIN,
|
|
||||||
SOUND_RIGHT_GAIN,
|
|
||||||
SOUND_MIC_GAIN,
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
|
|
||||||
enum {
|
|
||||||
SOUND_CHAN_STEREO = 0,
|
|
||||||
SOUND_CHAN_MONO,
|
|
||||||
SOUND_CHAN_CUSTOM,
|
|
||||||
SOUND_CHAN_MONO_LEFT,
|
|
||||||
SOUND_CHAN_MONO_RIGHT,
|
|
||||||
SOUND_CHAN_KARAOKE,
|
|
||||||
SOUND_CHAN_NUM_MODES
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef void sound_set_type(int value);
|
typedef void sound_set_type(int value);
|
||||||
|
|
||||||
const char *sound_unit(int setting);
|
const char *sound_unit(int setting);
|
||||||
|
|
|
@ -23,6 +23,8 @@
|
||||||
#define VOLUME_MIN -730
|
#define VOLUME_MIN -730
|
||||||
#define VOLUME_MAX 60
|
#define VOLUME_MAX 60
|
||||||
|
|
||||||
|
#include "audiohw.h"
|
||||||
|
|
||||||
extern int tenthdb2master(int db);
|
extern int tenthdb2master(int db);
|
||||||
|
|
||||||
/*** definitions ***/
|
/*** definitions ***/
|
||||||
|
|
|
@ -20,6 +20,8 @@
|
||||||
#ifndef _UDA1380_H
|
#ifndef _UDA1380_H
|
||||||
#define _UDA1380_H
|
#define _UDA1380_H
|
||||||
|
|
||||||
|
#include "audiohw.h"
|
||||||
|
|
||||||
/* volume/balance/treble/bass interdependency */
|
/* volume/balance/treble/bass interdependency */
|
||||||
#define VOLUME_MIN -840
|
#define VOLUME_MIN -840
|
||||||
#define VOLUME_MAX 0
|
#define VOLUME_MAX 0
|
||||||
|
|
|
@ -24,6 +24,8 @@
|
||||||
#define VOLUME_MIN -730
|
#define VOLUME_MIN -730
|
||||||
#define VOLUME_MAX 60
|
#define VOLUME_MAX 60
|
||||||
|
|
||||||
|
#include "audiohw.h"
|
||||||
|
|
||||||
extern int tenthdb2master(int db);
|
extern int tenthdb2master(int db);
|
||||||
extern int tenthdb2mixer(int db);
|
extern int tenthdb2mixer(int db);
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,8 @@
|
||||||
#define VOLUME_MIN -730
|
#define VOLUME_MIN -730
|
||||||
#define VOLUME_MAX 60
|
#define VOLUME_MAX 60
|
||||||
|
|
||||||
|
#include "audiohw.h"
|
||||||
|
|
||||||
extern int tenthdb2master(int db);
|
extern int tenthdb2master(int db);
|
||||||
extern int tenthdb2mixer(int db);
|
extern int tenthdb2mixer(int db);
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,8 @@
|
||||||
#define VOLUME_MIN -570
|
#define VOLUME_MIN -570
|
||||||
#define VOLUME_MAX 60
|
#define VOLUME_MAX 60
|
||||||
|
|
||||||
|
#include "audiohw.h"
|
||||||
|
|
||||||
extern int tenthdb2master(int db);
|
extern int tenthdb2master(int db);
|
||||||
extern int tenthdb2mixer(int db);
|
extern int tenthdb2mixer(int db);
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,8 @@
|
||||||
#define VOLUME_MIN -730
|
#define VOLUME_MIN -730
|
||||||
#define VOLUME_MAX 60
|
#define VOLUME_MAX 60
|
||||||
|
|
||||||
|
#include "audiohw.h"
|
||||||
|
|
||||||
extern int tenthdb2master(int db);
|
extern int tenthdb2master(int db);
|
||||||
extern int tenthdb2mixer(int db);
|
extern int tenthdb2mixer(int db);
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
#include "dac.h"
|
#include "dac.h"
|
||||||
#include "system.h"
|
#include "system.h"
|
||||||
#endif
|
#endif
|
||||||
|
#include "audiohw.h"
|
||||||
|
|
||||||
/* hacking into mpeg.c, recording is still there */
|
/* hacking into mpeg.c, recording is still there */
|
||||||
#if CONFIG_CODEC == MAS3587F
|
#if CONFIG_CODEC == MAS3587F
|
||||||
|
|
176
firmware/sound.c
176
firmware/sound.c
|
@ -8,6 +8,7 @@
|
||||||
* $Id$
|
* $Id$
|
||||||
*
|
*
|
||||||
* Copyright (C) 2005 by Linus Nielsen Feltzing
|
* Copyright (C) 2005 by Linus Nielsen Feltzing
|
||||||
|
* Copyright (C) 2007 by Christian Gmeiner
|
||||||
*
|
*
|
||||||
* All files in this archive are subject to the GNU General Public License.
|
* 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.
|
* See the file COPYING in the source tree root for full license agreement.
|
||||||
|
@ -43,132 +44,113 @@ extern unsigned shadow_codec_reg0;
|
||||||
#endif
|
#endif
|
||||||
#endif /* SIMULATOR */
|
#endif /* SIMULATOR */
|
||||||
|
|
||||||
struct sound_settings_info {
|
#ifdef SIMULATOR
|
||||||
const char *unit;
|
/* dummy for sim */
|
||||||
int numdecimals;
|
const struct sound_settings_info audiohw_settings[] = {
|
||||||
int steps;
|
[SOUND_VOLUME] = {"dB", 0, 1, -40, 6, -25},
|
||||||
int minval;
|
[SOUND_BASS] = {"dB", 0, 1, -24, 24, 0},
|
||||||
int maxval;
|
[SOUND_TREBLE] = {"dB", 0, 1, -24, 24, 0},
|
||||||
int defaultval;
|
[SOUND_BALANCE] = {"%", 0, 1,-100, 100, 0},
|
||||||
sound_set_type *setfn;
|
[SOUND_CHANNELS] = {"", 0, 1, 0, 5, 0},
|
||||||
|
[SOUND_STEREO_WIDTH] = {"%", 0, 1, 0, 255, 100},
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct sound_settings_info sound_settings_table[] = {
|
|
||||||
#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
|
|
||||||
[SOUND_VOLUME] = {"dB", 0, 1,-100, 12, -25, sound_set_volume},
|
|
||||||
[SOUND_BASS] = {"dB", 0, 1, -12, 12, 6, sound_set_bass},
|
|
||||||
[SOUND_TREBLE] = {"dB", 0, 1, -12, 12, 6, sound_set_treble},
|
|
||||||
#elif defined(HAVE_UDA1380)
|
|
||||||
[SOUND_VOLUME] = {"dB", 0, 1, -84, 0, -25, sound_set_volume},
|
|
||||||
[SOUND_BASS] = {"dB", 0, 2, 0, 24, 0, sound_set_bass},
|
|
||||||
[SOUND_TREBLE] = {"dB", 0, 2, 0, 6, 0, sound_set_treble},
|
|
||||||
#elif defined(HAVE_TLV320)
|
|
||||||
[SOUND_VOLUME] = {"dB", 0, 1, -73, 6, -20, sound_set_volume},
|
|
||||||
#elif defined(HAVE_WM8751)
|
|
||||||
[SOUND_VOLUME] = {"dB", 0, 1, -74, 6, -25, sound_set_volume},
|
|
||||||
[SOUND_BASS] = {"dB", 1, 15, -60, 90, 0, sound_set_bass},
|
|
||||||
[SOUND_TREBLE] = {"dB", 1, 15, -60, 90, 0, sound_set_treble},
|
|
||||||
#elif defined(HAVE_WM8975)
|
|
||||||
[SOUND_VOLUME] = {"dB", 0, 1, -74, 6, -25, sound_set_volume},
|
|
||||||
[SOUND_BASS] = {"dB", 0, 1, -6, 9, 0, sound_set_bass},
|
|
||||||
[SOUND_TREBLE] = {"dB", 0, 1, -6, 9, 0, sound_set_treble},
|
|
||||||
#elif defined(HAVE_WM8758)
|
|
||||||
[SOUND_VOLUME] = {"dB", 0, 1, -58, 6, -25, sound_set_volume},
|
|
||||||
[SOUND_BASS] = {"dB", 0, 1, -6, 9, 0, sound_set_bass},
|
|
||||||
[SOUND_TREBLE] = {"dB", 0, 1, -6, 9, 0, sound_set_treble},
|
|
||||||
#elif defined(HAVE_WM8731) || defined(HAVE_WM8721)
|
|
||||||
[SOUND_VOLUME] = {"dB", 0, 1, -74, 6, -25, sound_set_volume},
|
|
||||||
#elif (CONFIG_CPU == PNX0101)
|
|
||||||
[SOUND_VOLUME] = {"dB", 0, 1, -48, 15, 0, sound_set_volume},
|
|
||||||
#elif defined(HAVE_AS3514)
|
|
||||||
[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},
|
|
||||||
[SOUND_TREBLE] = {"dB", 0, 1, -15, 15, 7, sound_set_treble},
|
|
||||||
#endif
|
#endif
|
||||||
/* Override any other potentially existing treble/bass controllers if wanted */
|
|
||||||
#ifdef HAVE_SW_TONE_CONTROLS
|
|
||||||
[SOUND_BASS] = {"dB", 0, 1, -24, 24, 0, sound_set_bass},
|
|
||||||
[SOUND_TREBLE] = {"dB", 0, 1, -24, 24, 0, sound_set_treble},
|
|
||||||
#endif
|
|
||||||
[SOUND_BALANCE] = {"%", 0, 1,-100, 100, 0, sound_set_balance},
|
|
||||||
[SOUND_CHANNELS] = {"", 0, 1, 0, 5, 0, sound_set_channels},
|
|
||||||
[SOUND_STEREO_WIDTH] = {"%", 0, 1, 0, 255, 100, sound_set_stereo_width},
|
|
||||||
#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
|
|
||||||
[SOUND_LOUDNESS] = {"dB", 0, 1, 0, 17, 0, sound_set_loudness},
|
|
||||||
[SOUND_AVC] = {"", 0, 1, -1, 4, 0, sound_set_avc},
|
|
||||||
[SOUND_MDB_STRENGTH] = {"dB", 0, 1, 0, 127, 48, sound_set_mdb_strength},
|
|
||||||
[SOUND_MDB_HARMONICS] = {"%", 0, 1, 0, 100, 50, sound_set_mdb_harmonics},
|
|
||||||
[SOUND_MDB_CENTER] = {"Hz", 0, 10, 20, 300, 60, sound_set_mdb_center},
|
|
||||||
[SOUND_MDB_SHAPE] = {"Hz", 0, 10, 50, 300, 90, sound_set_mdb_shape},
|
|
||||||
[SOUND_MDB_ENABLE] = {"", 0, 1, 0, 1, 0, sound_set_mdb_enable},
|
|
||||||
[SOUND_SUPERBASS] = {"", 0, 1, 0, 1, 0, sound_set_superbass},
|
|
||||||
#endif
|
|
||||||
#if CONFIG_CODEC == MAS3587F
|
|
||||||
[SOUND_LEFT_GAIN] = {"dB", 1, 1, 0, 15, 8, NULL},
|
|
||||||
[SOUND_RIGHT_GAIN] = {"dB", 1, 1, 0, 15, 8, NULL},
|
|
||||||
[SOUND_MIC_GAIN] = {"dB", 1, 1, 0, 15, 2, NULL},
|
|
||||||
#elif defined(HAVE_UDA1380)
|
|
||||||
[SOUND_LEFT_GAIN] = {"dB", 1, 1,-128, 96, 0, NULL},
|
|
||||||
[SOUND_RIGHT_GAIN] = {"dB", 1, 1,-128, 96, 0, NULL},
|
|
||||||
[SOUND_MIC_GAIN] = {"dB", 1, 1,-128, 108, 16, NULL},
|
|
||||||
#elif defined(HAVE_TLV320)
|
|
||||||
[SOUND_LEFT_GAIN] = {"dB", 1, 1, 0, 31, 23, NULL},
|
|
||||||
[SOUND_RIGHT_GAIN] = {"dB", 1, 1, 0, 31, 23, NULL},
|
|
||||||
[SOUND_MIC_GAIN] = {"dB", 1, 1, 0, 1, 1, NULL},
|
|
||||||
#elif defined(HAVE_WM8975)
|
|
||||||
[SOUND_LEFT_GAIN] = {"dB", 1, 1,-128, 96, 0, NULL},
|
|
||||||
[SOUND_RIGHT_GAIN] = {"dB", 1, 1,-128, 96, 0, NULL},
|
|
||||||
[SOUND_MIC_GAIN] = {"dB", 1, 1,-128, 108, 16, NULL},
|
|
||||||
#elif defined(HAVE_WM8758)
|
|
||||||
[SOUND_LEFT_GAIN] = {"dB", 1, 1,-128, 96, 0, NULL},
|
|
||||||
[SOUND_RIGHT_GAIN] = {"dB", 1, 1,-128, 96, 0, NULL},
|
|
||||||
[SOUND_MIC_GAIN] = {"dB", 1, 1,-128, 108, 16, NULL},
|
|
||||||
#elif defined(HAVE_WM8731)
|
|
||||||
[SOUND_LEFT_GAIN] = {"dB", 1, 1,-128, 96, 0, NULL},
|
|
||||||
[SOUND_RIGHT_GAIN] = {"dB", 1, 1,-128, 96, 0, NULL},
|
|
||||||
[SOUND_MIC_GAIN] = {"dB", 1, 1,-128, 108, 16, NULL},
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
|
|
||||||
const char *sound_unit(int setting)
|
const char *sound_unit(int setting)
|
||||||
{
|
{
|
||||||
return sound_settings_table[setting].unit;
|
return audiohw_settings[setting].unit;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sound_numdecimals(int setting)
|
int sound_numdecimals(int setting)
|
||||||
{
|
{
|
||||||
return sound_settings_table[setting].numdecimals;
|
return audiohw_settings[setting].numdecimals;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sound_steps(int setting)
|
int sound_steps(int setting)
|
||||||
{
|
{
|
||||||
return sound_settings_table[setting].steps;
|
return audiohw_settings[setting].steps;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sound_min(int setting)
|
int sound_min(int setting)
|
||||||
{
|
{
|
||||||
return sound_settings_table[setting].minval;
|
return audiohw_settings[setting].minval;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sound_max(int setting)
|
int sound_max(int setting)
|
||||||
{
|
{
|
||||||
return sound_settings_table[setting].maxval;
|
return audiohw_settings[setting].maxval;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sound_default(int setting)
|
int sound_default(int setting)
|
||||||
{
|
{
|
||||||
return sound_settings_table[setting].defaultval;
|
return audiohw_settings[setting].defaultval;
|
||||||
}
|
}
|
||||||
|
|
||||||
sound_set_type* sound_get_fn(int setting)
|
sound_set_type* sound_get_fn(int setting)
|
||||||
{
|
{
|
||||||
if ((unsigned)setting < (sizeof(sound_settings_table)
|
sound_set_type* result = NULL;
|
||||||
/ sizeof(struct sound_settings_info)))
|
|
||||||
return sound_settings_table[setting].setfn;
|
switch (setting) {
|
||||||
else
|
case SOUND_VOLUME:
|
||||||
return NULL;
|
result = sound_set_volume;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SOUND_BASS:
|
||||||
|
result = sound_set_bass;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SOUND_TREBLE:
|
||||||
|
result = sound_set_treble;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SOUND_BALANCE:
|
||||||
|
result = sound_set_balance;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SOUND_CHANNELS:
|
||||||
|
result = sound_set_channels;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SOUND_STEREO_WIDTH:
|
||||||
|
result = sound_set_stereo_width;
|
||||||
|
break;
|
||||||
|
|
||||||
|
#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
|
||||||
|
case SOUND_LOUDNESS:
|
||||||
|
result = sound_set_loudness;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SOUND_AVC:
|
||||||
|
result = sound_set_avc;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SOUND_MDB_STRENGTH:
|
||||||
|
result = sound_set_mdb_strength;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SOUND_MDB_HARMONICS:
|
||||||
|
result = sound_set_mdb_harmonics;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SOUND_MDB_CENTER:
|
||||||
|
result = sound_set_mdb_center;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SOUND_MDB_SHAPE:
|
||||||
|
result = sound_set_mdb_shape;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SOUND_MDB_ENABLE:
|
||||||
|
result = sound_set_mdb_enable;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SOUND_SUPERBASS:
|
||||||
|
result = sound_set_superbass;
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if CONFIG_CODEC == SWCODEC
|
#if CONFIG_CODEC == SWCODEC
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue