mirror of
https://github.com/mudita/MuditaOS.git
synced 2026-04-21 15:38:23 -04:00
[EGD-5661] Add power management for filesystem
Add peripheral control (USDHC and PLL2 clocks) for file system support. This will save energy and extend battery life.
This commit is contained in:
committed by
Maciej Gibowicz
parent
d967db0a48
commit
fa61bb38cd
@@ -33,6 +33,7 @@
|
||||
#include <time/ScopedTime.hpp>
|
||||
#include "Timers/TimerFactory.hpp"
|
||||
#include <service-appmgr/StartupType.hpp>
|
||||
#include <purefs/vfs_subsystem.hpp>
|
||||
|
||||
const inline size_t systemManagerStack = 4096 * 2;
|
||||
|
||||
@@ -642,6 +643,12 @@ namespace sys
|
||||
|
||||
deviceManager->RegisterNewDevice(powerManager->getExternalRamDevice());
|
||||
|
||||
cpuSentinel = std::make_shared<sys::CpuSentinel>(
|
||||
service::name::system_manager, this, [this](bsp::CpuFrequencyHz newFrequency) {
|
||||
UpdateResourcesAfterCpuFrequencyChange(newFrequency);
|
||||
});
|
||||
powerManager->RegisterNewSentinel(cpuSentinel);
|
||||
|
||||
return ReturnCodes::Success;
|
||||
}
|
||||
|
||||
@@ -773,6 +780,16 @@ namespace sys
|
||||
return MessageNone{};
|
||||
}
|
||||
|
||||
void SystemManager::UpdateResourcesAfterCpuFrequencyChange(bsp::CpuFrequencyHz newFrequency)
|
||||
{
|
||||
if (newFrequency == bsp::CpuFrequencyHz::Level_1) {
|
||||
purefs::subsystem::disk_mgr()->pm_control(purefs::blkdev::pm_state::suspend);
|
||||
}
|
||||
else {
|
||||
purefs::subsystem::disk_mgr()->pm_control(purefs::blkdev::pm_state::active);
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<std::shared_ptr<Service>> SystemManager::servicesList;
|
||||
std::vector<std::shared_ptr<app::Application>> SystemManager::applicationsList;
|
||||
cpp_freertos::MutexStandard SystemManager::serviceDestroyMutex;
|
||||
|
||||
Reference in New Issue
Block a user