1
0
Fork 0
forked from len0rd/rockbox

erosqnative: Repurpose stereosw_select setting for output select

Turns out they did not swap the stereo switch lines on us,
so this setting isn't really useful. Repurpose it to allow
the user to force the device into headphone or line output mode.

Note that settings other than "Automatic" will cause jack detection
to not work.

Default Automatic.

Change-Id: If94499fbb8f0d92111811fe51f6107ce213b66ad
This commit is contained in:
Dana Conrad 2024-11-30 21:48:16 +00:00 committed by Solomon Peachy
parent a29b570ac4
commit 5ed0db6e90
7 changed files with 98 additions and 82 deletions

View file

@ -16357,62 +16357,6 @@
*: "Expert" *: "Expert"
</voice> </voice>
</phrase> </phrase>
<phrase>
id: LANG_STEREOSW_MODE
desc: Stereo Switch Mode
user: core
<source>
*: "Stereo Switch Mode"
</source>
<dest>
*: "Stereo Switch Mode"
</dest>
<voice>
*: "Stereo Switch Mode"
</voice>
</phrase>
<phrase>
id: LANG_REVERSE
desc: in settings_menu
user: core
<source>
*: "Reverse"
</source>
<dest>
*: "Reverse"
</dest>
<voice>
*: "Reverse"
</voice>
</phrase>
<phrase>
id: LANG_ALWAYS_ZERO
desc: in settings_menu
user: core
<source>
*: "Always 0"
</source>
<dest>
*: "Always 0"
</dest>
<voice>
*: "Always 0"
</voice>
</phrase>
<phrase>
id: LANG_ALWAYS_ONE
desc: in settings_menu
user: core
<source>
*: "Always 1"
</source>
<dest>
*: "Always 1"
</dest>
<voice>
*: "Always 1"
</voice>
</phrase>
<phrase> <phrase>
id: LANG_LEGAL_NOTICES id: LANG_LEGAL_NOTICES
desc: in system menu desc: in system menu
@ -16581,3 +16525,45 @@
*: "View Album Art" *: "View Album Art"
</voice> </voice>
</phrase> </phrase>
<phrase>
id: LANG_HP_LO_SELECT
desc: Output Select
user: core
<source>
*: "Output Select"
</source>
<dest>
*: "Output Select"
</dest>
<voice>
*: "Output Select"
</voice>
</phrase>
<phrase>
id: LANG_HEADPHONE
desc: in settings_menu
user: core
<source>
*: "Headphone"
</source>
<dest>
*: "Headphone"
</dest>
<voice>
*: "Headphone"
</voice>
</phrase>
<phrase>
id: LANG_LINEOUT
desc: in settings_menu
user: core
<source>
*: "Lineout"
</source>
<dest>
*: "Lineout"
</dest>
<voice>
*: "Lineout"
</voice>
</phrase>

View file

@ -136,7 +136,7 @@ MENUITEM_SETTING(roll_off, &global_settings.roll_off, NULL);
#endif #endif
#ifdef HAVE_EROS_QN_CODEC #ifdef HAVE_EROS_QN_CODEC
MENUITEM_SETTING(stereosw_mode, &global_settings.stereosw_mode,NULL); MENUITEM_SETTING(hp_lo_select, &global_settings.hp_lo_select,NULL);
#endif #endif
#ifdef AUDIOHW_HAVE_POWER_MODE #ifdef AUDIOHW_HAVE_POWER_MODE
@ -258,7 +258,7 @@ MAKE_MENU(sound_settings, ID2P(LANG_SOUND_SETTINGS), NULL, Icon_Audio,
,&roll_off ,&roll_off
#endif #endif
#ifdef HAVE_EROS_QN_CODEC #ifdef HAVE_EROS_QN_CODEC
,&stereosw_mode ,&hp_lo_select
#endif #endif
#ifdef AUDIOHW_HAVE_POWER_MODE #ifdef AUDIOHW_HAVE_POWER_MODE
,&power_mode ,&power_mode

View file

@ -909,7 +909,7 @@ struct user_settings
bool clear_settings_on_hold; bool clear_settings_on_hold;
#endif #endif
#if defined(HAVE_EROS_QN_CODEC) #if defined(HAVE_EROS_QN_CODEC)
int stereosw_mode; /* indicates normal, reverse, always 0, always 1 operation */ int hp_lo_select; /* indicates automatic, headphone-only, or lineout-only operation */
#endif #endif
}; };

View file

@ -819,7 +819,7 @@ static void volume_limit_set_default(void* setting, void* defaultval)
} }
#if defined(HAVE_EROS_QN_CODEC) #if defined(HAVE_EROS_QN_CODEC)
static void stereosw_apply(int arg) static void hp_lo_select_apply(int arg)
{ {
(void)arg; (void)arg;
@ -2312,9 +2312,9 @@ const struct settings_list settings[] = {
true, "clear settings on hold", NULL), true, "clear settings on hold", NULL),
#endif #endif
#if defined(HAVE_EROS_QN_CODEC) #if defined(HAVE_EROS_QN_CODEC)
CHOICE_SETTING(0, stereosw_mode, LANG_STEREOSW_MODE, 0, "stereo switch mode", CHOICE_SETTING(0, hp_lo_select, LANG_HP_LO_SELECT, 0, "headphone lineout select",
"normal,reverse,always0,always1", stereosw_apply, 4, "auto,headphone,lineout", hp_lo_select_apply, 3,
ID2P(LANG_NORMAL), ID2P(LANG_REVERSE), ID2P(LANG_ALWAYS_ZERO), ID2P(LANG_ALWAYS_ONE)), ID2P(LANG_AUTO), ID2P(LANG_HEADPHONE), ID2P(LANG_LINEOUT)),
#endif #endif
}; };

View file

@ -58,14 +58,12 @@ int eros_qn_get_volume_limit(void)
void eros_qn_switch_output(int select) void eros_qn_switch_output(int select)
{ {
/* normal operation 0, reverse operation 1, or always 0 */ /* normal operation 0 */
if ((select == 0 && global_settings.stereosw_mode == 0) \ if (select == 0)
|| (select == 1 && global_settings.stereosw_mode == 1) \
|| global_settings.stereosw_mode == 2)
{ {
gpio_set_level(GPIO_STEREOSW_SEL, 0); gpio_set_level(GPIO_STEREOSW_SEL, 0);
} }
/* normal operation 1, reverse operation 0, or always 1 */ /* normal operation 1 */
else else
{ {
gpio_set_level(GPIO_STEREOSW_SEL, 1); gpio_set_level(GPIO_STEREOSW_SEL, 1);

View file

@ -34,6 +34,7 @@
#include "devicedata.h" #include "devicedata.h"
#ifndef BOOTLOADER #ifndef BOOTLOADER
# include "settings.h"
# include "lcd.h" # include "lcd.h"
# include "font.h" # include "font.h"
#endif #endif
@ -166,8 +167,21 @@ bool headphones_inserted(void)
eros_qn_set_outputs(); eros_qn_set_outputs();
#endif #endif
} }
#if !defined(BOOTLOADER)
if (global_settings.hp_lo_select == 1) // force headphones
{
return true;
}
else if (global_settings.hp_lo_select == 2) // force lineout
{
return false;
}
else // automatic
#endif
{
return hp_detect_reg & 0x10 ? false : true; return hp_detect_reg & 0x10 ? false : true;
} }
}
bool lineout_inserted(void) bool lineout_inserted(void)
{ {
@ -182,8 +196,21 @@ bool lineout_inserted(void)
eros_qn_set_outputs(); eros_qn_set_outputs();
#endif #endif
} }
#if !defined(BOOTLOADER)
if (global_settings.hp_lo_select == 1) // force headphones
{
return false;
}
else if (global_settings.hp_lo_select == 2) // force lineout
{
return true;
}
else // automatic
#endif
{
return hp_detect_reg & 0x20 ? false : true; return hp_detect_reg & 0x20 ? false : true;
} }
}
/* Rockbox interface */ /* Rockbox interface */
void button_init_device(void) void button_init_device(void)

View file

@ -190,19 +190,24 @@ change to customise your listening experience.
stereo field unaltered. stereo field unaltered.
\opt{erosqnative}{ \opt{erosqnative}{
\section{Stereo Switch Mode} \section{Output Select}
The Eros Q and related devices contain a stereo switch in the audio path. The \dap{} has two output ports: Headphones and Line Out. This setting selects
This setting allows the behavior of the stereo switch to be changed if one of either automatic detection, or forces the player to use Headphone output or
the two outputs (Headphones or Line Out) is not working. There are four modes: Line output.
\note{The headphone jack will only detect a pair of headphones or similar devices with low impedance.
An amplifier or other high-impedance device will not be detected. The lineout jack
will detect a high-impedance device.}
\note{Line output volume is fixed to Volume Limit value. Please see \setting{Volume} section.}
\begin{description} \begin{description}
\item[Normal.] \item[Automatic.]
Headphones output uses a value of 0, and Line Out uses a value of 1. Automatically detect which output to use. If both outputs are plugged in,
\item[Reverse.] headphones will take precedence. Jack detection is enabled.
Headphones output uses a value of 1, and Line Out uses a value of 0. \item[Headphone.]
\item[Always 0.] Force the headphone output to be active. Jack detection is disabled. Automatic
Both outputs use a value of 0. play/pause jack detection will not work.
\item[Always 1.] \item[Lineout.]
Both outputs use a value of 1. Force the line output to be active. Jack detection is disabled. Automatic
play/pause jack detection will not work.
\end{description} \end{description}
\section{DAC filter roll-off} \section{DAC filter roll-off}