audio: Move hosted audio "codec" drivers into their respective target dirs

They are nearly entirely generic wrappers around ALSA controls, unique
per target, and are ripe for further consolidation.

Change-Id: I05e4a450e3e89e03616906601c4f8fa46200dff5
This commit is contained in:
Solomon Peachy 2025-11-30 11:21:37 -05:00
parent d376e0afb7
commit a79bdaf462
20 changed files with 62 additions and 43 deletions

View file

@ -223,9 +223,10 @@ struct sound_settings_info
#include "es9018.h"
#elif defined(HAVE_ES9218)
#include "es9218.h"
#elif ((CONFIG_PLATFORM & (PLATFORM_ANDROID | PLATFORM_MAEMO \
| PLATFORM_PANDORA | PLATFORM_SDL | PLATFORM_CTRU)) | defined(RG_NANO))
#include "hosted_codec.h"
#elif (CONFIG_PLATFORM & PLATFORM_ANDROID)
#include "android_codec.h"
#elif ((CONFIG_PLATFORM & (PLATFORM_MAEMO | PLATFORM_PANDORA | PLATFORM_SDL | PLATFORM_CTRU)) | defined(RG_NANO))
#include "sdl_codec.h"
#elif defined(DX50)
#include "codec-dx50.h"
#elif defined(DX90)

View file

@ -1,55 +0,0 @@
/***************************************************************************
* __________ __ ___
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
*
* Copyright (C) 2014 by Ilia Sergachev: Initial Rockbox port to iBasso DX50
* Copyright (C) 2014 by Mario Basister: iBasso DX90 port
* Copyright (C) 2014 by Simon Rothen: Initial Rockbox repository submission, additional features
* Copyright (C) 2014 by Udo Schläpfer: Code clean up, additional features
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
****************************************************************************/
#ifndef _CODEC_DX50_H_
#define _CODEC_DX50_H_
#define AUDIOHW_CAPS (MONO_VOL_CAP | FILTER_ROLL_OFF_CAP)
/*
http://www.wolfsonmicro.com/media/76425/WM8740.pdf
0.5 * ( x - 255 ) = ydB 1 <= x <= 255
mute x = 0
x = 255 -> 0dB
.
.
.
x = 2 -> -126.5dB
x = 1 -> -127dB
x = 0 -> -128dB
See audiohw.h, sound.c.
*/
AUDIOHW_SETTING(VOLUME, "dB", 0, 1, -128, 0, -30)
/* 1: slow roll off, 0: sharp roll off, sharp roll off default */
AUDIOHW_SETTING(FILTER_ROLL_OFF, "", 0, 1, 0, 1, 0)
#endif

View file

@ -1,35 +0,0 @@
/***************************************************************************
* __________ __ ___
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
*
* Copyright (C) 2014 by Ilia Sergachev: Initial Rockbox port to iBasso DX50
* Copyright (C) 2014 by Mario Basister: iBasso DX90 port
* Copyright (C) 2014 by Simon Rothen: Initial Rockbox repository submission, additional features
* Copyright (C) 2014 by Udo Schläpfer: Code clean up, additional features
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
****************************************************************************/
#ifndef _CODEC_DX90_H_
#define _CODEC_DX90_H_
#define AUDIOHW_CAPS MONO_VOL_CAP
AUDIOHW_SETTING(VOLUME, "", 0, 1, -255, 0, -128)
#endif

View file

@ -1,23 +0,0 @@
#ifndef __EROSQLINUX_CODEC__
#define __EROSQLINUX_CODEC__
#define AUDIOHW_CAPS (LINEOUT_CAP)
/* a small DC offset prevents play/pause clicking due to the DAC auto-muting */
#define PCM_DC_OFFSET_VALUE -1
/*
* Note: Maximum volume is set one step below unity in order to
* avoid overflowing pcm samples due to our DC Offset.
*
* The DAC's output is hot enough this should not be an issue.
*/
AUDIOHW_SETTING(VOLUME, "dB", 0, 2, -74, -2, -40)
//#define AUDIOHW_NEEDS_INITIAL_UNMUTE
void audiohw_mute(int mute);
void erosq_set_output(int ps);
int erosq_get_outputs(void);
#endif

View file

@ -1,12 +0,0 @@
#ifndef __FIIOLINUX_CODEC__
#define __FIIOLINUX_CODEC__
#define AUDIOHW_CAPS (FILTER_ROLL_OFF_CAP)
#define AUDIOHW_HAVE_SHORT2_ROLL_OFF
AUDIOHW_SETTING(VOLUME, "dB", 0, 1, -100, 0, -30)
AUDIOHW_SETTING(FILTER_ROLL_OFF, "", 0, 1, 0, 4, 0)
#endif
#define AUDIOHW_MUTE_ON_STOP
void audiohw_mute(int mute);

View file

@ -1,54 +0,0 @@
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id$
*
* Copyright (C) 2010 by Thomas Martitz
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
****************************************************************************/
#ifndef HOSTED_CODEC_H
#define HOSTED_CODEC_H
#if (defined(HAVE_SDL_AUDIO) \
&& !(CONFIG_PLATFORM & PLATFORM_MAEMO5)) \
|| (CONFIG_PLATFORM & PLATFORM_CTRU)
AUDIOHW_SETTING(VOLUME, "dB", 0, 1, -80, 0, 0)
#else
#define AUDIOHW_CAPS (MONO_VOL_CAP)
AUDIOHW_SETTING(VOLUME, "dB", 0, 1, -99, 0, 0)
#endif /* CONFIG_PLATFORM & PLATFORM_SDL */
#if (CONFIG_PLATFORM & PLATFORM_ANDROID)
/* Bass and treble tone controls */
#ifdef AUDIOHW_HAVE_BASS
AUDIOHW_SETTING(BASS, "dB", 0, 1, -24, 24, 0)
#endif
#ifdef AUDIOHW_HAVE_TREBLE
AUDIOHW_SETTING(TREBLE, "dB", 0, 1, -24, 24, 0)
#endif
#if defined(HAVE_RECORDING)
AUDIOHW_SETTING(LEFT_GAIN, "dB", 1, 1,-128, 96, 0)
AUDIOHW_SETTING(RIGHT_GAIN, "dB", 1, 1,-128, 96, 0)
AUDIOHW_SETTING(MIC_GAIN, "dB", 1, 1,-128, 108, 16)
#endif
#if defined(AUDIOHW_HAVE_BASS_CUTOFF)
AUDIOHW_SETTING(BASS_CUTOFF, "", 0, 1, 1, 4, 1)
#endif
#if defined(AUDIOHW_HAVE_TREBLE_CUTOFF)
AUDIOHW_SETTING(TREBLE_CUTOFF, "", 0, 1, 1, 4, 1)
#endif
#endif /* CONFIG_PLATFORM & PLATFORM_ANDROID */
#endif /* HOSTED_CODEC_H */

View file

@ -1,45 +0,0 @@
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
*
* Copyright (C) 2016 by Amaury Pouly
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
****************************************************************************/
#ifndef __NWZLINUX_CODEC_H__
#define __NWZLINUX_CODEC_H__
#define AUDIOHW_CAPS 0
/* Ranges from -100dB to 4dB */
AUDIOHW_SETTING(VOLUME, "dB", 0, 1, -100, 4, -10)
enum nwz_src_t
{
NWZ_PLAYBACK,
NWZ_RADIO,
NWZ_MIC,
};
/* enable/disable Sony's "acoustic" mode */
bool audiohw_acoustic_enabled(void);
void audiohw_enable_acoustic(bool en);
/* enable/disable Sony's "cuerev" mode */
bool audiohw_cuerev_enabled(void);
void audiohw_enable_cuerev(bool en);
/* select playback source */
void audiohw_set_playback_src(enum nwz_src_t src);
#endif /* __NWZLINUX_CODEC_H__ */

View file

@ -1,13 +0,0 @@
#ifndef __ROCKER_CODEC__
#define __ROCKER_CODEC__
#define AUDIOHW_CAPS 0
AUDIOHW_SETTING(VOLUME, "dB", 1, 5, -115*10, 0, -30*10)
#endif
//#define AUDIOHW_MUTE_ON_STOP
//#define AUDIOHW_NEEDS_INITIAL_UNMUTE
/* Note: Due to Kernel bug, we can't use MUTE_ON_PAUSE with backlight fading */
void audiohw_mute(int mute);

View file

@ -1,17 +0,0 @@
#ifndef __SURFANSLINUX_CODEC__
#define __SURFANSLINUX_CODEC__
#define AUDIOHW_CAPS (FILTER_ROLL_OFF_CAP)
AUDIOHW_SETTING(VOLUME, "dB", 1, 5, -102*10, 0, -30*10)
#endif
//#define AUDIOHW_MUTE_ON_STOP
#define AUDIOHW_MUTE_ON_SRATE_CHANGE
//#define AUDIOHW_NEEDS_INITIAL_UNMUTE
AUDIOHW_SETTING(FILTER_ROLL_OFF, "", 0, 1, 0, 4, 0)
#define AUDIOHW_HAVE_SHORT2_ROLL_OFF
void audiohw_mute(int mute);
void surfans_set_output(int ps);
int surfans_get_outputs(void);

View file

@ -1,26 +0,0 @@
#ifndef __XDUOOLINUX_CODEC__
#define __XDUOOLINUX_CODEC__
#define AUDIOHW_CAPS (LINEOUT_CAP | FILTER_ROLL_OFF_CAP)
AUDIOHW_SETTING(VOLUME, "dB", 1, 5, -102*10, 0, -30*10)
#endif
// We want this, but the codec takes over a second to unmute!
//#define AUDIOHW_MUTE_ON_STOP
#if defined(XDUOO_X3II)
/* The AK4490 glitches when switching sample rates */
#define AUDIOHW_MUTE_ON_SRATE_CHANGE
AUDIOHW_SETTING(FILTER_ROLL_OFF, "", 0, 1, 0, 5, 0)
#define AUDIOHW_HAVE_SS_ROLL_OFF
#endif
#if defined(XDUOO_X20)
//#define AUDIOHW_NEEDS_INITIAL_UNMUTE
AUDIOHW_SETTING(FILTER_ROLL_OFF, "", 0, 1, 0, 4, 0)
#define AUDIOHW_HAVE_SHORT2_ROLL_OFF
#endif
void audiohw_mute(int mute);
void xduoo_set_output(int ps);
int xduoo_get_outputs(void);