diff --git a/apps/lang/english.lang b/apps/lang/english.lang index f88864efcc..00efef667d 100644 --- a/apps/lang/english.lang +++ b/apps/lang/english.lang @@ -16357,62 +16357,6 @@ *: "Expert" - - id: LANG_STEREOSW_MODE - desc: Stereo Switch Mode - user: core - - *: "Stereo Switch Mode" - - - *: "Stereo Switch Mode" - - - *: "Stereo Switch Mode" - - - - id: LANG_REVERSE - desc: in settings_menu - user: core - - *: "Reverse" - - - *: "Reverse" - - - *: "Reverse" - - - - id: LANG_ALWAYS_ZERO - desc: in settings_menu - user: core - - *: "Always 0" - - - *: "Always 0" - - - *: "Always 0" - - - - id: LANG_ALWAYS_ONE - desc: in settings_menu - user: core - - *: "Always 1" - - - *: "Always 1" - - - *: "Always 1" - - id: LANG_LEGAL_NOTICES desc: in system menu @@ -16581,3 +16525,45 @@ *: "View Album Art" + + id: LANG_HP_LO_SELECT + desc: Output Select + user: core + + *: "Output Select" + + + *: "Output Select" + + + *: "Output Select" + + + + id: LANG_HEADPHONE + desc: in settings_menu + user: core + + *: "Headphone" + + + *: "Headphone" + + + *: "Headphone" + + + + id: LANG_LINEOUT + desc: in settings_menu + user: core + + *: "Lineout" + + + *: "Lineout" + + + *: "Lineout" + + \ No newline at end of file diff --git a/apps/menus/sound_menu.c b/apps/menus/sound_menu.c index fcb0dff080..f736c4934f 100644 --- a/apps/menus/sound_menu.c +++ b/apps/menus/sound_menu.c @@ -136,7 +136,7 @@ MENUITEM_SETTING(roll_off, &global_settings.roll_off, NULL); #endif #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 #ifdef AUDIOHW_HAVE_POWER_MODE @@ -258,7 +258,7 @@ MAKE_MENU(sound_settings, ID2P(LANG_SOUND_SETTINGS), NULL, Icon_Audio, ,&roll_off #endif #ifdef HAVE_EROS_QN_CODEC - ,&stereosw_mode + ,&hp_lo_select #endif #ifdef AUDIOHW_HAVE_POWER_MODE ,&power_mode diff --git a/apps/settings.h b/apps/settings.h index b04152d508..4f43c4f771 100644 --- a/apps/settings.h +++ b/apps/settings.h @@ -909,7 +909,7 @@ struct user_settings bool clear_settings_on_hold; #endif #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 }; diff --git a/apps/settings_list.c b/apps/settings_list.c index 1ca9197c5f..c68a7e3114 100644 --- a/apps/settings_list.c +++ b/apps/settings_list.c @@ -819,7 +819,7 @@ static void volume_limit_set_default(void* setting, void* defaultval) } #if defined(HAVE_EROS_QN_CODEC) -static void stereosw_apply(int arg) +static void hp_lo_select_apply(int arg) { (void)arg; @@ -2312,9 +2312,9 @@ const struct settings_list settings[] = { true, "clear settings on hold", NULL), #endif #if defined(HAVE_EROS_QN_CODEC) - CHOICE_SETTING(0, stereosw_mode, LANG_STEREOSW_MODE, 0, "stereo switch mode", - "normal,reverse,always0,always1", stereosw_apply, 4, - ID2P(LANG_NORMAL), ID2P(LANG_REVERSE), ID2P(LANG_ALWAYS_ZERO), ID2P(LANG_ALWAYS_ONE)), + CHOICE_SETTING(0, hp_lo_select, LANG_HP_LO_SELECT, 0, "headphone lineout select", + "auto,headphone,lineout", hp_lo_select_apply, 3, + ID2P(LANG_AUTO), ID2P(LANG_HEADPHONE), ID2P(LANG_LINEOUT)), #endif }; diff --git a/firmware/drivers/audio/eros_qn_codec.c b/firmware/drivers/audio/eros_qn_codec.c index c9d01c5ed4..741f3fb24f 100644 --- a/firmware/drivers/audio/eros_qn_codec.c +++ b/firmware/drivers/audio/eros_qn_codec.c @@ -58,14 +58,12 @@ int eros_qn_get_volume_limit(void) void eros_qn_switch_output(int select) { - /* normal operation 0, reverse operation 1, or always 0 */ - if ((select == 0 && global_settings.stereosw_mode == 0) \ - || (select == 1 && global_settings.stereosw_mode == 1) \ - || global_settings.stereosw_mode == 2) + /* normal operation 0 */ + if (select == 0) { gpio_set_level(GPIO_STEREOSW_SEL, 0); } - /* normal operation 1, reverse operation 0, or always 1 */ + /* normal operation 1 */ else { gpio_set_level(GPIO_STEREOSW_SEL, 1); diff --git a/firmware/target/mips/ingenic_x1000/erosqnative/button-erosqnative.c b/firmware/target/mips/ingenic_x1000/erosqnative/button-erosqnative.c index 3fa825fcdc..cc157cccf4 100644 --- a/firmware/target/mips/ingenic_x1000/erosqnative/button-erosqnative.c +++ b/firmware/target/mips/ingenic_x1000/erosqnative/button-erosqnative.c @@ -34,6 +34,7 @@ #include "devicedata.h" #ifndef BOOTLOADER +# include "settings.h" # include "lcd.h" # include "font.h" #endif @@ -166,7 +167,20 @@ bool headphones_inserted(void) eros_qn_set_outputs(); #endif } - return hp_detect_reg & 0x10 ? false : true; +#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; + } } bool lineout_inserted(void) @@ -182,7 +196,20 @@ bool lineout_inserted(void) eros_qn_set_outputs(); #endif } - return hp_detect_reg & 0x20 ? false : true; +#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; + } } /* Rockbox interface */ diff --git a/manual/configure_rockbox/sound_settings.tex b/manual/configure_rockbox/sound_settings.tex index 0aeada59b2..ae2dccf0d3 100644 --- a/manual/configure_rockbox/sound_settings.tex +++ b/manual/configure_rockbox/sound_settings.tex @@ -190,19 +190,24 @@ change to customise your listening experience. stereo field unaltered. \opt{erosqnative}{ - \section{Stereo Switch Mode} - The Eros Q and related devices contain a stereo switch in the audio path. - This setting allows the behavior of the stereo switch to be changed if one of - the two outputs (Headphones or Line Out) is not working. There are four modes: + \section{Output Select} + The \dap{} has two output ports: Headphones and Line Out. This setting selects + either automatic detection, or forces the player to use Headphone output or + 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} - \item[Normal.] - Headphones output uses a value of 0, and Line Out uses a value of 1. - \item[Reverse.] - Headphones output uses a value of 1, and Line Out uses a value of 0. - \item[Always 0.] - Both outputs use a value of 0. - \item[Always 1.] - Both outputs use a value of 1. + \item[Automatic.] + Automatically detect which output to use. If both outputs are plugged in, + headphones will take precedence. Jack detection is enabled. + \item[Headphone.] + Force the headphone output to be active. Jack detection is disabled. Automatic + play/pause jack detection will not work. + \item[Lineout.] + Force the line output to be active. Jack detection is disabled. Automatic + play/pause jack detection will not work. \end{description} \section{DAC filter roll-off}