use g_info.hw_caps->can_cpufreq to control the cpu frequency

Origin commit data
------------------
Commit: 474e66e129
Author: vanhofen <vanhofen@gmx.de>
Date: 2020-08-30 (Sun, 30 Aug 2020)

Origin message was:
------------------
- use g_info.hw_caps->can_cpufreq to control the cpu frequency
This commit is contained in:
vanhofen
2020-08-30 22:49:37 +02:00
parent e4594292a5
commit e2f62205b5
4 changed files with 21 additions and 29 deletions

View File

@@ -211,7 +211,6 @@ const CMenuOptionChooser::keyval CHANNELLIST_NEW_ZAP_MODE_OPTIONS[CHANNELLIST_NE
{ 2, LOCALE_CHANNELLIST_NEW_ZAP_MODE_ACTIVE } { 2, LOCALE_CHANNELLIST_NEW_ZAP_MODE_ACTIVE }
}; };
#ifdef CPU_FREQ
#define CPU_FREQ_OPTION_COUNT 13 #define CPU_FREQ_OPTION_COUNT 13
const CMenuOptionChooser::keyval_ext CPU_FREQ_OPTIONS[CPU_FREQ_OPTION_COUNT] = const CMenuOptionChooser::keyval_ext CPU_FREQ_OPTIONS[CPU_FREQ_OPTION_COUNT] =
{ {
@@ -229,7 +228,6 @@ const CMenuOptionChooser::keyval_ext CPU_FREQ_OPTIONS[CPU_FREQ_OPTION_COUNT] =
{ 550, NONEXISTANT_LOCALE, "550 Mhz"}, { 550, NONEXISTANT_LOCALE, "550 Mhz"},
{ 600, NONEXISTANT_LOCALE, "600 Mhz"} { 600, NONEXISTANT_LOCALE, "600 Mhz"}
}; };
#endif /*CPU_FREQ*/
const CMenuOptionChooser::keyval EPG_SCAN_OPTIONS[] = const CMenuOptionChooser::keyval EPG_SCAN_OPTIONS[] =
{ {
@@ -335,12 +333,13 @@ int CMiscMenue::showMiscSettingsMenu()
mf->setHint("", LOCALE_MENU_HINT_MISC_ONLINESERVICES); mf->setHint("", LOCALE_MENU_HINT_MISC_ONLINESERVICES);
misc_menue.addItem(mf); misc_menue.addItem(mf);
#ifdef CPU_FREQ
//CPU //CPU
CMenuWidget misc_menue_cpu("CPU", NEUTRINO_ICON_SETTINGS, width); if (g_info.hw_caps->can_cpufreq)
showMiscSettingsMenuCPUFreq(&misc_menue_cpu); {
misc_menue.addItem( new CMenuForwarder("CPU", true, NULL, &misc_menue_cpu, NULL, CRCInput::convertDigitToKey(shortcut++))); CMenuWidget misc_menue_cpu("CPU", NEUTRINO_ICON_SETTINGS, width);
#endif /*CPU_FREQ*/ showMiscSettingsMenuCPUFreq(&misc_menue_cpu);
misc_menue.addItem( new CMenuForwarder("CPU", true, NULL, &misc_menue_cpu, NULL, CRCInput::convertDigitToKey(shortcut++)));
}
// Infoicons Setup // Infoicons Setup
CInfoIconsSetup infoicons_setup; CInfoIconsSetup infoicons_setup;
@@ -770,7 +769,6 @@ int CMiscMenue::showMiscSettingsSelectWeatherLocation()
return res; return res;
} }
#ifdef CPU_FREQ
//CPU //CPU
void CMiscMenue::showMiscSettingsMenuCPUFreq(CMenuWidget *ms_cpu) void CMiscMenue::showMiscSettingsMenuCPUFreq(CMenuWidget *ms_cpu)
{ {
@@ -780,7 +778,6 @@ void CMiscMenue::showMiscSettingsMenuCPUFreq(CMenuWidget *ms_cpu)
ms_cpu->addItem(new CMenuOptionChooser(LOCALE_CPU_FREQ_NORMAL, &g_settings.cpufreq, CPU_FREQ_OPTIONS, CPU_FREQ_OPTION_COUNT, true, cpuNotifier)); ms_cpu->addItem(new CMenuOptionChooser(LOCALE_CPU_FREQ_NORMAL, &g_settings.cpufreq, CPU_FREQ_OPTIONS, CPU_FREQ_OPTION_COUNT, true, cpuNotifier));
ms_cpu->addItem(new CMenuOptionChooser(LOCALE_CPU_FREQ_STANDBY, &g_settings.standby_cpufreq, CPU_FREQ_OPTIONS, CPU_FREQ_OPTION_COUNT, true)); ms_cpu->addItem(new CMenuOptionChooser(LOCALE_CPU_FREQ_STANDBY, &g_settings.standby_cpufreq, CPU_FREQ_OPTIONS, CPU_FREQ_OPTION_COUNT, true));
} }
#endif /*CPU_FREQ*/
bool CMiscMenue::changeNotify(const neutrino_locale_t OptionName, void * /*data*/) bool CMiscMenue::changeNotify(const neutrino_locale_t OptionName, void * /*data*/)
{ {

View File

@@ -33,8 +33,6 @@
#include <string> #include <string>
//#define CPU_FREQ
class CMiscMenue : public CMenuTarget, CChangeObserver class CMiscMenue : public CMenuTarget, CChangeObserver
{ {
private: private:
@@ -79,9 +77,7 @@ class CMiscMenue : public CMenuTarget, CChangeObserver
int showMiscSettingsMenuOnlineServices(); int showMiscSettingsMenuOnlineServices();
int showMiscSettingsSelectWeatherLocation(); int showMiscSettingsSelectWeatherLocation();
int showMiscSettingsMenuPlugins(); int showMiscSettingsMenuPlugins();
#ifdef CPU_FREQ
void showMiscSettingsMenuCPUFreq(CMenuWidget *ms_cpu); void showMiscSettingsMenuCPUFreq(CMenuWidget *ms_cpu);
#endif /*CPU_FREQ*/
public: public:
CMiscMenue(); CMiscMenue();
~CMiscMenue(); ~CMiscMenue();

View File

@@ -486,13 +486,8 @@ int CNeutrinoApp::loadSetup(const char * fname)
g_settings.zappingmode = configfile.getInt32( "zappingmode", 0); g_settings.zappingmode = configfile.getInt32( "zappingmode", 0);
#endif #endif
#ifdef CPU_FREQ g_settings.cpufreq = g_info.hw_caps->can_cpufreq ? configfile.getInt32("cpufreq", 0) : 0;
g_settings.cpufreq = configfile.getInt32("cpufreq", 0); g_settings.standby_cpufreq = g_info.hw_caps->can_cpufreq ? configfile.getInt32("standby_cpufreq", 100) : 50;
g_settings.standby_cpufreq = configfile.getInt32("standby_cpufreq", 100);
#else
g_settings.cpufreq = 0;
g_settings.standby_cpufreq = 50;
#endif
// ci-settings // ci-settings
g_settings.ci_standby_reset = configfile.getInt32("ci_standby_reset", 0); g_settings.ci_standby_reset = configfile.getInt32("ci_standby_reset", 0);
@@ -2895,8 +2890,9 @@ TIMER_START();
powerManager = new cPowerManager; powerManager = new cPowerManager;
powerManager->Open(); powerManager->Open();
cpuFreq = new cCpuFreqManager(); cpuFreq = g_info.hw_caps->can_cpufreq ? new cCpuFreqManager() : NULL;
cpuFreq->SetCpuFreq(g_settings.cpufreq * 1000 * 1000); if (cpuFreq)
cpuFreq->SetCpuFreq(g_settings.cpufreq * 1000 * 1000);
//fan speed //fan speed
if (g_info.hw_caps->has_fan) if (g_info.hw_caps->has_fan)
@@ -3644,7 +3640,8 @@ bool CNeutrinoApp::wakeupFromStandby(void)
CStreamManager::getInstance()->StreamStatus(); CStreamManager::getInstance()->StreamStatus();
if ((mode == NeutrinoModes::mode_standby) && !alive) { if ((mode == NeutrinoModes::mode_standby) && !alive) {
cpuFreq->SetCpuFreq(g_settings.cpufreq * 1000 * 1000); if (cpuFreq)
cpuFreq->SetCpuFreq(g_settings.cpufreq * 1000 * 1000);
if(g_settings.ci_standby_reset) { if(g_settings.ci_standby_reset) {
g_CamHandler->exec(NULL, "ca_ci_reset0"); g_CamHandler->exec(NULL, "ca_ci_reset0");
g_CamHandler->exec(NULL, "ca_ci_reset1"); g_CamHandler->exec(NULL, "ca_ci_reset1");
@@ -3671,7 +3668,8 @@ void CNeutrinoApp::standbyToStandby(void)
} }
g_Zapit->setStandby(true); g_Zapit->setStandby(true);
g_Sectionsd->setPauseScanning(true); g_Sectionsd->setPauseScanning(true);
cpuFreq->SetCpuFreq(g_settings.standby_cpufreq * 1000 * 1000); if (cpuFreq)
cpuFreq->SetCpuFreq(g_settings.standby_cpufreq * 1000 * 1000);
} }
} }
@@ -4847,9 +4845,8 @@ void CNeutrinoApp::standbyMode( bool bOnOff, bool fromDeepStandby )
InfoIcons->saveIconstate(); InfoIcons->saveIconstate();
CEpgScan::getInstance()->Start(true); CEpgScan::getInstance()->Start(true);
bool alive = recordingstatus || CEpgScan::getInstance()->Running() || bool alive = recordingstatus || CEpgScan::getInstance()->Running() || CStreamManager::getInstance()->StreamStatus();
CStreamManager::getInstance()->StreamStatus(); if (!alive && cpuFreq)
if(!alive)
cpuFreq->SetCpuFreq(g_settings.standby_cpufreq * 1000 * 1000); cpuFreq->SetCpuFreq(g_settings.standby_cpufreq * 1000 * 1000);
//fan speed //fan speed
@@ -4871,7 +4868,8 @@ void CNeutrinoApp::standbyMode( bool bOnOff, bool fromDeepStandby )
powerManager->SetStandby(false, false); powerManager->SetStandby(false, false);
CVFD::getInstance()->setMode(CVFD::MODE_TVRADIO); CVFD::getInstance()->setMode(CVFD::MODE_TVRADIO);
CVFD::getInstance()->ShowText("Resume ..."); CVFD::getInstance()->ShowText("Resume ...");
cpuFreq->SetCpuFreq(g_settings.cpufreq * 1000 * 1000); if (cpuFreq)
cpuFreq->SetCpuFreq(g_settings.cpufreq * 1000 * 1000);
videoDecoder->Standby(false); videoDecoder->Standby(false);
CEpgScan::getInstance()->Stop(); CEpgScan::getInstance()->Stop();
CSectionsdClient::CurrentNextInfo dummy; CSectionsdClient::CurrentNextInfo dummy;

View File

@@ -743,7 +743,8 @@ extern cCpuFreqManager * cpuFreq;
printf("CCpuFreqNotifier: %d Mhz\n", freq); printf("CCpuFreqNotifier: %d Mhz\n", freq);
freq *= 1000*1000; freq *= 1000*1000;
cpuFreq->SetCpuFreq(freq); if (cpuFreq)
cpuFreq->SetCpuFreq(freq);
return false; return false;
} }