mirror of
https://github.com/apache/nuttx.git
synced 2026-08-12 07:55:32 +00:00
drivers/devfreq: remove default governor
It's better not to use global governor, as modifying one device will cause all devices' governor to be modified. Signed-off-by: guanyi3 <guanyi3@xiaomi.com>
This commit is contained in:
parent
827b455f68
commit
1e2f9745cb
5 changed files with 11 additions and 42 deletions
|
|
@ -12,27 +12,6 @@ config DEVFREQ
|
|||
|
||||
if DEVFREQ
|
||||
|
||||
choice
|
||||
prompt "DEVFREQ_DEFAULT_GOVERNOR"
|
||||
default DEVFREQ_DEFAULT_GOV_PERFORMANCE
|
||||
|
||||
config DEVFREQ_DEFAULT_GOV_PERFORMANCE
|
||||
bool "devfreq_performance"
|
||||
---help---
|
||||
devfreq performance governor, always choose the highest frequency
|
||||
|
||||
config DEVFREQ_DEFAULT_GOV_POWERSAVE
|
||||
bool "devfreq_powersave"
|
||||
---help---
|
||||
devfreq powersave governor, always choose the lowest frequency
|
||||
|
||||
config DEVFREQ_DEFAULT_GOV_PASSIVE
|
||||
bool "devfreq_passive"
|
||||
---help---
|
||||
devfreq passive governor, a device-defined governor
|
||||
|
||||
endchoice
|
||||
|
||||
config DEVFREQ_PROCFS
|
||||
bool "devfreq_procfs"
|
||||
default n
|
||||
|
|
|
|||
|
|
@ -485,6 +485,9 @@ FAR struct devfreq_s *devfreq_register(
|
|||
devfreq->priv = priv;
|
||||
devfreq->suspended = false;
|
||||
devfreq->freq_table = driver->get_table(devfreq);
|
||||
devfreq->min = 0;
|
||||
devfreq->max = UINT32_MAX;
|
||||
devfreq->cur = driver->get_frequency(devfreq);
|
||||
if (!devfreq->freq_table)
|
||||
{
|
||||
goto out;
|
||||
|
|
@ -497,13 +500,11 @@ FAR struct devfreq_s *devfreq_register(
|
|||
|
||||
if (!governor)
|
||||
{
|
||||
devfreq->governor = devfreq_default_governor();
|
||||
}
|
||||
else
|
||||
{
|
||||
devfreq->governor = governor;
|
||||
goto out;
|
||||
}
|
||||
|
||||
devfreq->governor = governor;
|
||||
|
||||
if (devfreq_init_governor(devfreq) < 0)
|
||||
{
|
||||
goto out;
|
||||
|
|
|
|||
|
|
@ -24,8 +24,6 @@
|
|||
|
||||
#include <nuttx/devfreq.h>
|
||||
|
||||
#ifdef CONFIG_DEVFREQ_DEFAULT_GOV_PERFORMANCE
|
||||
|
||||
/****************************************************************************
|
||||
* Private Function Prototypes
|
||||
****************************************************************************/
|
||||
|
|
@ -55,9 +53,7 @@ static uint32_t devfreq_performance_limit(FAR struct devfreq_s *devfreq)
|
|||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
FAR struct devfreq_governor_s *devfreq_default_governor(void)
|
||||
FAR struct devfreq_governor_s *devfreq_performance(void)
|
||||
{
|
||||
return &g_devfreq_gov_performance;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_DEVFREQ_DEFAULT_GOV_PERFORMANCE */
|
||||
|
|
|
|||
|
|
@ -24,8 +24,6 @@
|
|||
|
||||
#include <nuttx/devfreq.h>
|
||||
|
||||
#ifdef CONFIG_DEVFREQ_DEFAULT_GOV_POWERSAVE
|
||||
|
||||
/****************************************************************************
|
||||
* Private Function Prototypes
|
||||
****************************************************************************/
|
||||
|
|
@ -55,9 +53,7 @@ static uint32_t devfreq_powersave_limit(FAR struct devfreq_s *devfreq)
|
|||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
FAR struct devfreq_governor_s *devfreq_default_governor(void)
|
||||
FAR struct devfreq_governor_s *devfreq_powersave(void)
|
||||
{
|
||||
return &g_devfreq_gov_powersave;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_DEVFREQ_DEFAULT_GOV_POWERSAVE */
|
||||
|
|
|
|||
|
|
@ -222,7 +222,7 @@ int devfreq_unregister_notifier(FAR struct devfreq_s *devfreq,
|
|||
FAR struct notifier_block *nb);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: devfreq_get
|
||||
* Name: devfreq_get_frequency
|
||||
*
|
||||
* Description:
|
||||
* get the current device frequency (in kHz)
|
||||
|
|
@ -342,11 +342,8 @@ FAR struct devfreq_s *devfreq_find_by_index(size_t index);
|
|||
|
||||
void devfreq_procfs_initialize(void);
|
||||
|
||||
#ifdef CONFIG_DEVFREQ_DEFAULT_GOV_PASSIVE
|
||||
#define devfreq_default_governor() NULL
|
||||
#else
|
||||
FAR struct devfreq_governor_s *devfreq_default_governor(void);
|
||||
#endif
|
||||
FAR struct devfreq_governor_s *devfreq_performance(void);
|
||||
FAR struct devfreq_governor_s *devfreq_powersave(void);
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue