diff --git a/apps/lang/english.lang b/apps/lang/english.lang index 49960e727c..8fef9cae85 100644 --- a/apps/lang/english.lang +++ b/apps/lang/english.lang @@ -3136,3 +3136,9 @@ desc: in onplay menu. insert a track/playlist randomly into dynamic playlist eng: "Insert shuffled" voice: new: + +id: LANG_SPDIF_ENABLE +desc: in playback settings menu. enable/disable the optical out +eng: "Optical output" +voice: +new: diff --git a/apps/settings.c b/apps/settings.c index d40223bd78..3b0d68709d 100644 --- a/apps/settings.c +++ b/apps/settings.c @@ -400,7 +400,11 @@ static const struct bit_entry hd_bits[] = {3, S_O(backlight_fade_out), 3, "backlight fade out", "off,500ms,1s,2s,3s,4s,5s,10s"}, #endif - + +#ifdef HAVE_SPDIF_POWER + {1, S_O(spdif_enable), false, "spdif enable", off_on}, +#endif + /* new stuff to be added at the end */ /* Sum of all bit sizes must not grow beyond 0xB8*8 = 1472 */ @@ -840,6 +844,10 @@ void settings_apply(void) #if CONFIG_HWCODEC == MASNONE && !defined(SIMULATOR) pcm_crossfade_enable(global_settings.crossfade); #endif + +#ifdef HAVE_SPDIF_POWER + spdif_power_enable(global_settings.spdif_enable); +#endif } diff --git a/apps/settings.h b/apps/settings.h index d630db7f35..1a49a460d5 100644 --- a/apps/settings.h +++ b/apps/settings.h @@ -204,6 +204,10 @@ struct user_settings int battery_capacity; /* in mAh */ int battery_type; /* for units which can take multiple types (Ondio). */ +#ifdef HAVE_SPDIF_POWER + bool spdif_enable; /* S/PDIF power on/off */ +#endif + /* resume settings */ bool resume; /* resume option: 0=off, 1=on */ diff --git a/apps/settings_menu.c b/apps/settings_menu.c index 5dcf66789f..6050da6eb0 100644 --- a/apps/settings_menu.c +++ b/apps/settings_menu.c @@ -45,6 +45,8 @@ #include "talk.h" #include "timefuncs.h" #include "misc.h" +#include "power.h" + #ifdef HAVE_LCD_BITMAP #include "peakmeter.h" #endif @@ -659,6 +661,18 @@ static bool resume(void) return set_bool( str(LANG_RESUME), &global_settings.resume); } +#ifdef HAVE_SPDIF_POWER +static bool spdif(void) +{ + bool rc = set_bool_options(str(LANG_SPDIF_ENABLE), + &global_settings.spdif_enable, + STR(LANG_ON), + STR(LANG_OFF), + spdif_power_enable); + return rc; +} +#endif + static bool autocreatebookmark(void) { bool retval = false; @@ -1120,6 +1134,9 @@ static bool playback_settings_menu(void) { ID2P(LANG_FADE_ON_STOP), set_fade_on_stop }, #if CONFIG_HWCODEC == MASNONE { ID2P(LANG_CROSSFADE), crossfade }, +#endif +#ifdef HAVE_SPDIF_POWER + { ID2P(LANG_SPDIF_ENABLE), spdif }, #endif { ID2P(LANG_ID3_ORDER), id3_order }, }; diff --git a/firmware/drivers/power.c b/firmware/drivers/power.c index 32a420056d..fecc79a465 100644 --- a/firmware/drivers/power.c +++ b/firmware/drivers/power.c @@ -71,7 +71,7 @@ void power_init(void) GPIO_ENABLE |= 0x80000000; GPIO_FUNCTION |= 0x80000000; #ifdef HAVE_SPDIF_POWER - spdif_power_enable(true); + spdif_power_enable(false); #endif #else #ifdef HAVE_POWEROFF_ON_PB5 diff --git a/firmware/export/config-h100.h b/firmware/export/config-h100.h index 5c161ae7a0..c61c528190 100644 --- a/firmware/export/config-h100.h +++ b/firmware/export/config-h100.h @@ -79,7 +79,7 @@ #define BOOTFILE_EXT ".iriver" #define BOOTFILE "rockbox" BOOTFILE_EXT +#endif + /* Define this if you can control the S/PDIF power */ #define HAVE_SPDIF_POWER - -#endif