diff --git a/azbox/Makefile.am b/azbox/Makefile.am index 0e6b74f..7e8b5a7 100644 --- a/azbox/Makefile.am +++ b/azbox/Makefile.am @@ -1,7 +1,8 @@ noinst_LTLIBRARIES = libazbox.la AM_CPPFLAGS = \ - -I$(top_srcdir)/common + -I$(top_srcdir)/common \ + -I$(top_srcdir)/include AM_CXXFLAGS = -fno-rtti -fno-exceptions -fno-strict-aliasing AM_LDFLAGS = -lpthread @@ -13,6 +14,5 @@ libazbox_la_SOURCES = \ audio.cpp \ init.cpp \ playback.cpp \ - pwrmngr.cpp \ record.cpp diff --git a/azbox/pwrmngr.cpp b/azbox/pwrmngr.cpp deleted file mode 120000 index cee9acb..0000000 --- a/azbox/pwrmngr.cpp +++ /dev/null @@ -1 +0,0 @@ -../libspark/pwrmngr.cpp \ No newline at end of file diff --git a/azbox/pwrmngr.h b/azbox/pwrmngr.h deleted file mode 120000 index e63e97b..0000000 --- a/azbox/pwrmngr.h +++ /dev/null @@ -1 +0,0 @@ -../libspark/pwrmngr.h \ No newline at end of file diff --git a/common/Makefile.am b/common/Makefile.am index 0fb4902..17395fc 100644 --- a/common/Makefile.am +++ b/common/Makefile.am @@ -32,4 +32,5 @@ endif libcommon_la_SOURCES += \ lt_debug.cpp \ - proc_tools.c + proc_tools.c \ + pwrmngr.cpp diff --git a/common/pwrmngr.cpp b/common/pwrmngr.cpp new file mode 100644 index 0000000..7aac8a3 --- /dev/null +++ b/common/pwrmngr.cpp @@ -0,0 +1,179 @@ +/* + * (C) 2010-2013 Stefan Seyfried + * + * 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 program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#include + +#include "pwrmngr.h" +#include "lt_debug.h" + +#include +#include + +#include +#include +#include +#include +#include + +#if HAVE_TRIPLEDRAGON +#include +#include +#endif + +#define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_PWRMNGR, this, args) +#define lt_info(args...) _lt_info(TRIPLE_DEBUG_PWRMNGR, this, args) + +/* cpufreqmanager */ +void cCpuFreqManager::Up(void) +{ + lt_debug("%s\n", __func__); +} + +void cCpuFreqManager::Down(void) +{ + lt_debug("%s\n", __func__); +} + +void cCpuFreqManager::Reset(void) +{ + lt_debug("%s\n", __func__); +} + +/* those function dummies return true or "harmless" values */ +bool cCpuFreqManager::SetDelta(unsigned long) +{ + lt_debug("%s\n", __func__); + return true; +} + +unsigned long cCpuFreqManager::GetDelta(void) +{ + lt_debug("%s\n", __func__); + return 0; +} + +#if HAVE_SPARK_HARDWARE || HAVE_DUCKBOX_HARDWARE +unsigned long cCpuFreqManager::GetCpuFreq(void) { + int freq = 0; + if (FILE *pll0 = fopen("/proc/cpu_frequ/pll0_ndiv_mdiv", "r")) { + char buffer[120]; + while(fgets(buffer, sizeof(buffer), pll0)) { + if (1 == sscanf(buffer, "SH4 = %d MHZ", &freq)) + break; + } + fclose(pll0); + return 1000 * 1000 * (unsigned long) freq; + } + return 0; +} +#else +unsigned long cCpuFreqManager::GetCpuFreq(void) +{ + lt_debug("%s\n", __func__); + return 0; +} +#endif + +bool cCpuFreqManager::SetCpuFreq(unsigned long f) +{ + lt_info("%s(%lu) => set standby = %s\n", __func__, f, f?"true":"false"); +#if HAVE_TRIPLEDRAGON + /* actually SetCpuFreq is used to determine if the system is in standby + this is an "elegant" hack, because: + * during a recording, cpu freq is kept "high", even if the box is sent to standby + * the "SetStandby" call is made even if a recording is running + On the TD, setting standby disables the frontend, so we must not do it + if a recording is running. + For now, the values in neutrino are hardcoded: + * f == 0 => max => not standby + * f == 50000000 => min => standby + */ + int fd = open("/dev/stb/tdsystem", O_RDONLY); + if (fd < 0) + { + perror("open tdsystem"); + return false; + } + if (f) + { + ioctl(fd, IOC_AVS_SET_VOLUME, 31); /* mute AVS to avoid ugly noise */ + ioctl(fd, IOC_AVS_STANDBY_ENTER); + if (getenv("TRIPLE_LCDBACKLIGHT")) + { + lt_info("%s: TRIPLE_LCDBACKLIGHT is set: keeping LCD backlight on\n", __func__); + close(fd); + fd = open("/dev/stb/tdlcd", O_RDONLY); + if (fd < 0) + lt_info("%s: open tdlcd error: %m\n", __func__); + else + ioctl(fd, IOC_LCD_BACKLIGHT_ON); + } + } + else + { + ioctl(fd, IOC_AVS_SET_VOLUME, 31); /* mute AVS to avoid ugly noise */ + ioctl(fd, IOC_AVS_STANDBY_LEAVE); + /* unmute will be done by cAudio::do_mute(). Ugly, but prevents pops */ + // ioctl(fd, IOC_AVS_SET_VOLUME, 0); /* max gain */ + } + + close(fd); +#elif HAVE_SPARK_HARDWARE || HAVE_DUCKBOX_HARDWARE + if (f) { + FILE *pll0 = fopen ("/proc/cpu_frequ/pll0_ndiv_mdiv", "w"); + if (pll0) { + f /= 1000000; + fprintf(pll0, "%lu\n", (f/10 << 8) | 3); + fclose (pll0); + return false; + } + } +#endif + return true; +} + +cCpuFreqManager::cCpuFreqManager(void) +{ + lt_debug("%s\n", __func__); +} + +/* powermanager */ +bool cPowerManager::Open(void) +{ + lt_debug("%s\n", __func__); + return true; +} + +void cPowerManager::Close(void) +{ + lt_debug("%s\n", __func__); +} + +bool cPowerManager::SetStandby(bool Active, bool Passive) +{ + lt_debug("%s(%d, %d)\n", __func__, Active, Passive); + return true; +} + +cPowerManager::cPowerManager(void) +{ + lt_debug("%s\n", __func__); +} + +cPowerManager::~cPowerManager() +{ + lt_debug("%s\n", __func__); +} diff --git a/generic-pc/Makefile.am b/generic-pc/Makefile.am index fdab1bf..baf15da 100644 --- a/generic-pc/Makefile.am +++ b/generic-pc/Makefile.am @@ -1,6 +1,7 @@ noinst_LTLIBRARIES = libgeneric.la -AM_CPPFLAGS = \ +AM_CPPFLAGS = -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS +AM_CPPFLAGS += \ -I$(top_srcdir)/common \ -I$(top_srcdir)/include @@ -21,7 +22,6 @@ libgeneric_la_SOURCES = \ audio.cpp \ glfb.cpp \ init.cpp \ - pwrmngr.cpp \ record.cpp if ENABLE_GSTREAMER_01 @@ -43,5 +43,3 @@ libgeneric_la_SOURCES += \ playback.cpp endif endif - -AM_CPPFLAGS += -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS diff --git a/generic-pc/pwrmngr.cpp b/generic-pc/pwrmngr.cpp deleted file mode 120000 index cee9acb..0000000 --- a/generic-pc/pwrmngr.cpp +++ /dev/null @@ -1 +0,0 @@ -../libspark/pwrmngr.cpp \ No newline at end of file diff --git a/generic-pc/pwrmngr.h b/generic-pc/pwrmngr.h deleted file mode 120000 index e63e97b..0000000 --- a/generic-pc/pwrmngr.h +++ /dev/null @@ -1 +0,0 @@ -../libspark/pwrmngr.h \ No newline at end of file diff --git a/include/pwrmngr.h b/include/pwrmngr.h index 74fc806..167929a 100644 --- a/include/pwrmngr.h +++ b/include/pwrmngr.h @@ -1,20 +1,47 @@ -#include -#if HAVE_TRIPLEDRAGON -#include "../libtriple/pwrmngr.h" -#elif HAVE_DUCKBOX_HARDWARE -#include "../libduckbox/pwrmngr.h" -#elif HAVE_SPARK_HARDWARE -#include "../libspark/pwrmngr.h" -#elif HAVE_ARM_HARDWARE -#include "../libarmbox/pwrmngr.h" -#elif HAVE_AZBOX_HARDWARE -#include "../azbox/pwrmngr.h" -#elif HAVE_GENERIC_HARDWARE -#if BOXMODEL_RASPI -#include "../raspi/pwrmngr.h" -#else -#include "../generic-pc/pwrmngr.h" -#endif -#else -#error neither HAVE_TRIPLEDRAGON nor HAVE_SPARK_HARDWARE defined +/* + * (C) 2010-2013 Stefan Seyfried + * + * 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 program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef __pwrmngr_hal__ +#define __pwrmngr_hal__ + +class cCpuFreqManager +{ +public: + cCpuFreqManager(void); + void Up(void); + void Down(void); + void Reset(void); + + bool SetCpuFreq(unsigned long CpuFreq); + bool SetDelta(unsigned long Delta); + unsigned long GetCpuFreq(void); + unsigned long GetDelta(void); +}; + +class cPowerManager +{ +public: + cPowerManager(void); + virtual ~cPowerManager(); + + bool Open(void); + void Close(void); + + bool SetStandby(bool Active, bool Passive); +}; + #endif diff --git a/libarmbox/Makefile.am b/libarmbox/Makefile.am index 227f506..4d5c162 100644 --- a/libarmbox/Makefile.am +++ b/libarmbox/Makefile.am @@ -20,7 +20,6 @@ libarmbox_la_SOURCES = \ video.cpp \ audio.cpp \ init.cpp \ - pwrmngr.cpp \ record.cpp if ENABLE_GSTREAMER_10 diff --git a/libarmbox/pwrmngr.cpp b/libarmbox/pwrmngr.cpp deleted file mode 100644 index f4eff66..0000000 --- a/libarmbox/pwrmngr.cpp +++ /dev/null @@ -1,32 +0,0 @@ -#include - -#include "pwrmngr.h" -#include "lt_debug.h" -#include -#include -#include -#include -#include - -#define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_PWRMNGR, this, args) -void cCpuFreqManager::Up(void) { lt_debug("%s\n", __FUNCTION__); } -void cCpuFreqManager::Down(void) { lt_debug("%s\n", __FUNCTION__); } -void cCpuFreqManager::Reset(void) { lt_debug("%s\n", __FUNCTION__); } -/* those function dummies return true or "harmless" values */ -bool cCpuFreqManager::SetDelta(unsigned long) { lt_debug("%s\n", __FUNCTION__); return true; } -unsigned long cCpuFreqManager::GetCpuFreq(void) { lt_debug("%s\n", __FUNCTION__); return 0; } -unsigned long cCpuFreqManager::GetDelta(void) { lt_debug("%s\n", __FUNCTION__); return 0; } -// -cCpuFreqManager::cCpuFreqManager(void) { lt_debug("%s\n", __FUNCTION__); } - -bool cPowerManager::SetState(PWR_STATE) { lt_debug("%s\n", __FUNCTION__); return true; } - -bool cPowerManager::Open(void) { lt_debug("%s\n", __FUNCTION__); return true; } -void cPowerManager::Close(void) { lt_debug("%s\n", __FUNCTION__); } -// -bool cPowerManager::SetStandby(bool Active, bool Passive) { lt_debug("%s(%d, %d)\n", __FUNCTION__, Active, Passive); return true; } -bool cCpuFreqManager::SetCpuFreq(unsigned long f) { lt_debug("%s(%lu) => set standby = %s\n", __FUNCTION__, f, f?"true":"false"); return true; } -// -cPowerManager::cPowerManager(void) { lt_debug("%s\n", __FUNCTION__); } -cPowerManager::~cPowerManager() { lt_debug("%s\n", __FUNCTION__); } - diff --git a/libarmbox/pwrmngr.h b/libarmbox/pwrmngr.h deleted file mode 100644 index 55dc984..0000000 --- a/libarmbox/pwrmngr.h +++ /dev/null @@ -1,53 +0,0 @@ -#ifndef __PWRMNGR_H__ -#define __PWRMNGR_H__ - -// -- cCpuFreqManager ---------------------------------------------------------- - -class cCpuFreqManager { -private: - unsigned long startCpuFreq; - unsigned long delta; -public: - void Up(void); - void Down(void); - void Reset(void); - // - bool SetCpuFreq(unsigned long CpuFreq); - bool SetDelta(unsigned long Delta); - unsigned long GetCpuFreq(void); - unsigned long GetDelta(void); - // - cCpuFreqManager(void); - -}; - -// -- cPowerManageger ---------------------------------------------------------- - -typedef enum -{ - PWR_INIT = 1, - PWR_FULL_ACTIVE, /* all devices/clocks up */ - PWR_ACTIVE_STANDBY, - PWR_PASSIVE_STANDBY, - PWR_INVALID -} PWR_STATE; - -class cPowerManager { -private: - bool init; - bool opened; - PWR_STATE powerState; - // - static void ApplicationCallback(void *, void *, signed long, void *, void *) {} - bool SetState(PWR_STATE PowerState); -public: - bool Open(void); - void Close(void); - // - bool SetStandby(bool Active, bool Passive); - // - cPowerManager(void); - virtual ~cPowerManager(); -}; - -#endif // __PWRMNGR_H__ diff --git a/libduckbox/Makefile.am b/libduckbox/Makefile.am index 2568f0b..5b47cab 100644 --- a/libduckbox/Makefile.am +++ b/libduckbox/Makefile.am @@ -22,7 +22,6 @@ libduckbox_la_SOURCES = \ audio_mixer.cpp \ init.cpp \ playback_libeplayer3.cpp \ - pwrmngr.cpp \ record.cpp AM_CPPFLAGS += -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS diff --git a/libduckbox/pwrmngr.cpp b/libduckbox/pwrmngr.cpp deleted file mode 120000 index cee9acb..0000000 --- a/libduckbox/pwrmngr.cpp +++ /dev/null @@ -1 +0,0 @@ -../libspark/pwrmngr.cpp \ No newline at end of file diff --git a/libduckbox/pwrmngr.h b/libduckbox/pwrmngr.h deleted file mode 120000 index e63e97b..0000000 --- a/libduckbox/pwrmngr.h +++ /dev/null @@ -1 +0,0 @@ -../libspark/pwrmngr.h \ No newline at end of file diff --git a/libspark/Makefile.am b/libspark/Makefile.am index 4864195..74f9837 100644 --- a/libspark/Makefile.am +++ b/libspark/Makefile.am @@ -6,7 +6,6 @@ AM_CPPFLAGS = \ -I$(top_srcdir)/libeplayer3/include AM_CXXFLAGS = -fno-rtti -fno-exceptions -fno-strict-aliasing - AM_LDFLAGS = \ -lOpenThreads \ @AVFORMAT_LIBS@ \ @@ -23,7 +22,6 @@ libspark_la_SOURCES = \ audio_mixer.cpp \ init.cpp \ playback_libeplayer3.cpp \ - pwrmngr.cpp \ record.cpp AM_CPPFLAGS += -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS diff --git a/libspark/pwrmngr.cpp b/libspark/pwrmngr.cpp deleted file mode 100644 index b5ab30a..0000000 --- a/libspark/pwrmngr.cpp +++ /dev/null @@ -1,102 +0,0 @@ -#include - -#include "pwrmngr.h" -#include "lt_debug.h" -#include -#include -#include -#include -#include - -#define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_PWRMNGR, this, args) -void cCpuFreqManager::Up(void) { lt_debug("%s\n", __FUNCTION__); } -void cCpuFreqManager::Down(void) { lt_debug("%s\n", __FUNCTION__); } -void cCpuFreqManager::Reset(void) { lt_debug("%s\n", __FUNCTION__); } -/* those function dummies return true or "harmless" values */ -bool cCpuFreqManager::SetDelta(unsigned long) { lt_debug("%s\n", __FUNCTION__); return true; } -#if HAVE_SPARK_HARDWARE || HAVE_DUCKBOX_HARDWARE -unsigned long cCpuFreqManager::GetCpuFreq(void) { - int freq = 0; - if (FILE *pll0 = fopen("/proc/cpu_frequ/pll0_ndiv_mdiv", "r")) { - char buffer[120]; - while(fgets(buffer, sizeof(buffer), pll0)) { - if (1 == sscanf(buffer, "SH4 = %d MHZ", &freq)) - break; - } - fclose(pll0); - return 1000 * 1000 * (unsigned long) freq; - } - return 0; -} -#else -unsigned long cCpuFreqManager::GetCpuFreq(void) { lt_debug("%s\n", __FUNCTION__); return 0; } -#endif -unsigned long cCpuFreqManager::GetDelta(void) { lt_debug("%s\n", __FUNCTION__); return 0; } -// -cCpuFreqManager::cCpuFreqManager(void) { lt_debug("%s\n", __FUNCTION__); } - -bool cPowerManager::SetState(PWR_STATE) { lt_debug("%s\n", __FUNCTION__); return true; } - -bool cPowerManager::Open(void) { lt_debug("%s\n", __FUNCTION__); return true; } -void cPowerManager::Close(void) { lt_debug("%s\n", __FUNCTION__); } -// -bool cPowerManager::SetStandby(bool Active, bool Passive) -{ - lt_debug("%s(%d, %d)\n", __FUNCTION__, Active, Passive); - return true; -} - -bool cCpuFreqManager::SetCpuFreq(unsigned long f) -{ -#if HAVE_SPARK_HARDWARE || HAVE_DUCKBOX_HARDWARE - if (f) { - FILE *pll0 = fopen ("/proc/cpu_frequ/pll0_ndiv_mdiv", "w"); - if (pll0) { - f /= 1000000; - fprintf(pll0, "%lu\n", (f/10 << 8) | 3); - fclose (pll0); - return false; - } - } -#else - /* actually SetCpuFreq is used to determine if the system is in standby - this is an "elegant" hack, because: - * during a recording, cpu freq is kept "high", even if the box is sent to standby - * the "SetStandby" call is made even if a recording is running - On the TD, setting standby disables the frontend, so we must not do it - if a recording is running. - For now, the values in neutrino are hardcoded: - * f == 0 => max => not standby - * f == 50000000 => min => standby - */ - lt_debug("%s(%lu) => set standby = %s\n", __FUNCTION__, f, f?"true":"false"); -#if 0 - int fd = open("/dev/stb/tdsystem", O_RDONLY); - if (fd < 0) - { - perror("open tdsystem"); - return false; - } - if (f) - { - ioctl(fd, IOC_AVS_SET_VOLUME, 31); /* mute AVS to avoid ugly noise */ - ioctl(fd, IOC_AVS_STANDBY_ENTER); - } - else - { - ioctl(fd, IOC_AVS_SET_VOLUME, 31); /* mute AVS to avoid ugly noise */ - ioctl(fd, IOC_AVS_STANDBY_LEAVE); - /* unmute will be done by cAudio::do_mute(). Ugly, but prevents pops */ - // ioctl(fd, IOC_AVS_SET_VOLUME, 0); /* max gain */ - } - - close(fd); -#endif -#endif - return true; -} - -// -cPowerManager::cPowerManager(void) { lt_debug("%s\n", __FUNCTION__); } -cPowerManager::~cPowerManager() { lt_debug("%s\n", __FUNCTION__); } - diff --git a/libspark/pwrmngr.h b/libspark/pwrmngr.h deleted file mode 100644 index 55dc984..0000000 --- a/libspark/pwrmngr.h +++ /dev/null @@ -1,53 +0,0 @@ -#ifndef __PWRMNGR_H__ -#define __PWRMNGR_H__ - -// -- cCpuFreqManager ---------------------------------------------------------- - -class cCpuFreqManager { -private: - unsigned long startCpuFreq; - unsigned long delta; -public: - void Up(void); - void Down(void); - void Reset(void); - // - bool SetCpuFreq(unsigned long CpuFreq); - bool SetDelta(unsigned long Delta); - unsigned long GetCpuFreq(void); - unsigned long GetDelta(void); - // - cCpuFreqManager(void); - -}; - -// -- cPowerManageger ---------------------------------------------------------- - -typedef enum -{ - PWR_INIT = 1, - PWR_FULL_ACTIVE, /* all devices/clocks up */ - PWR_ACTIVE_STANDBY, - PWR_PASSIVE_STANDBY, - PWR_INVALID -} PWR_STATE; - -class cPowerManager { -private: - bool init; - bool opened; - PWR_STATE powerState; - // - static void ApplicationCallback(void *, void *, signed long, void *, void *) {} - bool SetState(PWR_STATE PowerState); -public: - bool Open(void); - void Close(void); - // - bool SetStandby(bool Active, bool Passive); - // - cPowerManager(void); - virtual ~cPowerManager(); -}; - -#endif // __PWRMNGR_H__ diff --git a/libtriple/pwrmngr.cpp b/libtriple/pwrmngr.cpp deleted file mode 100644 index e526246..0000000 --- a/libtriple/pwrmngr.cpp +++ /dev/null @@ -1,87 +0,0 @@ -#include -#include - -#include "pwrmngr.h" -#include "lt_debug.h" -#include -#include -#include -#include -#include - -#include -#include - -#define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_PWRMNGR, this, args) -#define lt_info(args...) _lt_info(TRIPLE_DEBUG_PWRMNGR, this, args) -void cCpuFreqManager::Up(void) { lt_debug("%s\n", __FUNCTION__); } -void cCpuFreqManager::Down(void) { lt_debug("%s\n", __FUNCTION__); } -void cCpuFreqManager::Reset(void) { lt_debug("%s\n", __FUNCTION__); } -/* those function dummies return true or "harmless" values */ -bool cCpuFreqManager::SetDelta(unsigned long) { lt_debug("%s\n", __FUNCTION__); return true; } -unsigned long cCpuFreqManager::GetCpuFreq(void) { lt_debug("%s\n", __FUNCTION__); return 0; } -unsigned long cCpuFreqManager::GetDelta(void) { lt_debug("%s\n", __FUNCTION__); return 0; } -// -cCpuFreqManager::cCpuFreqManager(void) { lt_debug("%s\n", __FUNCTION__); } - -bool cPowerManager::SetState(PWR_STATE) { lt_debug("%s\n", __FUNCTION__); return true; } - -bool cPowerManager::Open(void) { lt_debug("%s\n", __FUNCTION__); return true; } -void cPowerManager::Close(void) { lt_debug("%s\n", __FUNCTION__); } -// -bool cPowerManager::SetStandby(bool Active, bool Passive) -{ - lt_debug("%s(%d, %d)\n", __FUNCTION__, Active, Passive); - return true; -} - -bool cCpuFreqManager::SetCpuFreq(unsigned long f) -{ - /* actually SetCpuFreq is used to determine if the system is in standby - this is an "elegant" hack, because: - * during a recording, cpu freq is kept "high", even if the box is sent to standby - * the "SetStandby" call is made even if a recording is running - On the TD, setting standby disables the frontend, so we must not do it - if a recording is running. - For now, the values in neutrino are hardcoded: - * f == 0 => max => not standby - * f == 50000000 => min => standby - */ - lt_debug("%s(%lu) => set standby = %s\n", __FUNCTION__, f, f?"true":"false"); - int fd = open("/dev/stb/tdsystem", O_RDONLY); - if (fd < 0) - { - perror("open tdsystem"); - return false; - } - if (f) - { - ioctl(fd, IOC_AVS_SET_VOLUME, 31); /* mute AVS to avoid ugly noise */ - ioctl(fd, IOC_AVS_STANDBY_ENTER); - if (getenv("TRIPLE_LCDBACKLIGHT")) - { - lt_info("%s: TRIPLE_LCDBACKLIGHT is set: keeping LCD backlight on\n", __func__); - close(fd); - fd = open("/dev/stb/tdlcd", O_RDONLY); - if (fd < 0) - lt_info("%s: open tdlcd error: %m\n", __func__); - else - ioctl(fd, IOC_LCD_BACKLIGHT_ON); - } - } - else - { - ioctl(fd, IOC_AVS_SET_VOLUME, 31); /* mute AVS to avoid ugly noise */ - ioctl(fd, IOC_AVS_STANDBY_LEAVE); - /* unmute will be done by cAudio::do_mute(). Ugly, but prevents pops */ - // ioctl(fd, IOC_AVS_SET_VOLUME, 0); /* max gain */ - } - - close(fd); - return true; -} - -// -cPowerManager::cPowerManager(void) { lt_debug("%s\n", __FUNCTION__); } -cPowerManager::~cPowerManager() { lt_debug("%s\n", __FUNCTION__); } - diff --git a/libtriple/pwrmngr.h b/libtriple/pwrmngr.h deleted file mode 100644 index 55dc984..0000000 --- a/libtriple/pwrmngr.h +++ /dev/null @@ -1,53 +0,0 @@ -#ifndef __PWRMNGR_H__ -#define __PWRMNGR_H__ - -// -- cCpuFreqManager ---------------------------------------------------------- - -class cCpuFreqManager { -private: - unsigned long startCpuFreq; - unsigned long delta; -public: - void Up(void); - void Down(void); - void Reset(void); - // - bool SetCpuFreq(unsigned long CpuFreq); - bool SetDelta(unsigned long Delta); - unsigned long GetCpuFreq(void); - unsigned long GetDelta(void); - // - cCpuFreqManager(void); - -}; - -// -- cPowerManageger ---------------------------------------------------------- - -typedef enum -{ - PWR_INIT = 1, - PWR_FULL_ACTIVE, /* all devices/clocks up */ - PWR_ACTIVE_STANDBY, - PWR_PASSIVE_STANDBY, - PWR_INVALID -} PWR_STATE; - -class cPowerManager { -private: - bool init; - bool opened; - PWR_STATE powerState; - // - static void ApplicationCallback(void *, void *, signed long, void *, void *) {} - bool SetState(PWR_STATE PowerState); -public: - bool Open(void); - void Close(void); - // - bool SetStandby(bool Active, bool Passive); - // - cPowerManager(void); - virtual ~cPowerManager(); -}; - -#endif // __PWRMNGR_H__ diff --git a/raspi/pwrmngr.cpp b/raspi/pwrmngr.cpp deleted file mode 120000 index cee9acb..0000000 --- a/raspi/pwrmngr.cpp +++ /dev/null @@ -1 +0,0 @@ -../libspark/pwrmngr.cpp \ No newline at end of file diff --git a/raspi/pwrmngr.h b/raspi/pwrmngr.h deleted file mode 120000 index e63e97b..0000000 --- a/raspi/pwrmngr.h +++ /dev/null @@ -1 +0,0 @@ -../libspark/pwrmngr.h \ No newline at end of file