From 5f377c2613b54acc752902fa7531b9d25b03863e Mon Sep 17 00:00:00 2001 From: Dana Conrad Date: Mon, 29 Apr 2024 20:33:26 -0500 Subject: Eros Q Native: Add Stereo SW behavior setting Hopefully this should cover our bases so we can change the behavior of the stereo switch to keep line out working when they change the hardware on us! Change-Id: Ic36bcb3778d5681a5f3f158c689df9c1420c1d7e --- apps/lang/english.lang | 56 +++++++++++++++++++++++++++++ apps/menus/sound_menu.c | 7 ++++ apps/settings.h | 3 ++ apps/settings_list.c | 5 +++ firmware/drivers/audio/eros_qn_codec.c | 6 +++- manual/configure_rockbox/sound_settings.tex | 18 ++++++++++ 6 files changed, 94 insertions(+), 1 deletion(-) diff --git a/apps/lang/english.lang b/apps/lang/english.lang index 6bba65f6a9..c299a9dac8 100644 --- a/apps/lang/english.lang +++ b/apps/lang/english.lang @@ -16935,3 +16935,59 @@ *: "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" + + \ No newline at end of file diff --git a/apps/menus/sound_menu.c b/apps/menus/sound_menu.c index d72e3c7fa7..fcb0dff080 100644 --- a/apps/menus/sound_menu.c +++ b/apps/menus/sound_menu.c @@ -135,6 +135,10 @@ MENUITEM_SETTING(depth_3d, &global_settings.depth_3d, NULL); MENUITEM_SETTING(roll_off, &global_settings.roll_off, NULL); #endif +#ifdef HAVE_EROS_QN_CODEC +MENUITEM_SETTING(stereosw_mode, &global_settings.stereosw_mode,NULL); +#endif + #ifdef AUDIOHW_HAVE_POWER_MODE MENUITEM_SETTING(power_mode, &global_settings.power_mode, NULL); #endif @@ -253,6 +257,9 @@ MAKE_MENU(sound_settings, ID2P(LANG_SOUND_SETTINGS), NULL, Icon_Audio, #ifdef AUDIOHW_HAVE_FILTER_ROLL_OFF ,&roll_off #endif +#ifdef HAVE_EROS_QN_CODEC + ,&stereosw_mode +#endif #ifdef AUDIOHW_HAVE_POWER_MODE ,&power_mode #endif diff --git a/apps/settings.h b/apps/settings.h index e3b11430cd..1df1e0b418 100644 --- a/apps/settings.h +++ b/apps/settings.h @@ -899,6 +899,9 @@ struct user_settings (CONFIG_KEYPAD == IRIVER_H10_PAD) bool clear_settings_on_hold; #endif +#if defined(HAVE_EROS_QN_CODEC) + int stereosw_mode; /* indicates normal, reverse, always 0, always 1 operation */ +#endif }; /** global variables **/ diff --git a/apps/settings_list.c b/apps/settings_list.c index dc33c27c95..d60fa510d8 100644 --- a/apps/settings_list.c +++ b/apps/settings_list.c @@ -2295,6 +2295,11 @@ const struct settings_list settings[] = { OFFON_SETTING(0, clear_settings_on_hold, LANG_CLEAR_SETTINGS_ON_HOLD, 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", sound_settings_apply, 4, + ID2P(LANG_NORMAL), ID2P(LANG_REVERSE), ID2P(LANG_ALWAYS_ZERO), ID2P(LANG_ALWAYS_ONE)), +#endif }; const int nb_settings = sizeof(settings)/sizeof(*settings); diff --git a/firmware/drivers/audio/eros_qn_codec.c b/firmware/drivers/audio/eros_qn_codec.c index 095b3b5305..1d6753eb3a 100644 --- a/firmware/drivers/audio/eros_qn_codec.c +++ b/firmware/drivers/audio/eros_qn_codec.c @@ -51,10 +51,14 @@ int eros_qn_get_volume_limit(void) void eros_qn_switch_output(int select) { - if (select == 0) + /* 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) { gpio_set_level(GPIO_STEREOSW_SEL, 0); } + /* normal operation 1, reverse operation 0, or always 1 */ else { gpio_set_level(GPIO_STEREOSW_SEL, 1); diff --git a/manual/configure_rockbox/sound_settings.tex b/manual/configure_rockbox/sound_settings.tex index 951eded31c..fd69d63317 100644 --- a/manual/configure_rockbox/sound_settings.tex +++ b/manual/configure_rockbox/sound_settings.tex @@ -193,6 +193,24 @@ change to customise your listening experience. the effect of widening the stereo field. A value of 100\% will leave the stereo field unaltered. +\opt{erosqnative}{ + \section{Stereo Switch Mode} + The Eros Q and related devices contain a stereo switch in the audio path. + This may be connected differently depending on the hardware revision. 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: + \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. + \end{description} +} + \opt{dac_power_mode}{ \opt{fiiom3k}{ \section{DAC Power Mode} -- cgit v1.2.3