diff options
| author | Udo Schläpfer <rockbox-2014.10@desktopwarrior.net> | 2015-01-30 22:47:30 +0100 |
|---|---|---|
| committer | Udo Schläpfer <rockbox-2014.10@desktopwarrior.net> | 2015-02-02 21:58:25 +0100 |
| commit | 040306a71663d98f1ca568b61010ee125d1e6501 (patch) | |
| tree | 369840173d587df590ce9674cfd0f62163034105 /firmware/target/hosted | |
| parent | dbabd0d9c34a33bc0c51243ec37f230d117db955 (diff) | |
| download | rockbox-040306a71663d98f1ca568b61010ee125d1e6501.zip rockbox-040306a71663d98f1ca568b61010ee125d1e6501.tar.gz rockbox-040306a71663d98f1ca568b61010ee125d1e6501.tar.bz2 rockbox-040306a71663d98f1ca568b61010ee125d1e6501.tar.xz | |
iBasso DX50/DX90: User selectable freq scaling governor.
Depends on http://gerrit.rockbox.org/r/#/c/1043/.
This patch adds a new setting in Settings -> General
-> System: Freq Scaling Governor
Usable in Quickscreen and Shortcuts.
Possible settings are:
- Conservative: Slow frequency switching.
- Ondemand or Interactive: Fast frequency switching.
- Powersave: Allways lowest frequency.
- Performance: Allways highest frequency.
German translation provided.
This may be genric for Android kernel based devices but is only enabled
for iBasso Devices. Other maintainers may choose do adopt this.
Change-Id: I10296f5be9586ad3a409105db0cd03682a30e9c1
Diffstat (limited to 'firmware/target/hosted')
| -rw-r--r-- | firmware/target/hosted/ibasso/governor-ibasso.c | 90 | ||||
| -rw-r--r-- | firmware/target/hosted/ibasso/governor-ibasso.h | 54 | ||||
| -rw-r--r-- | firmware/target/hosted/ibasso/system-ibasso.c | 4 |
3 files changed, 145 insertions, 3 deletions
diff --git a/firmware/target/hosted/ibasso/governor-ibasso.c b/firmware/target/hosted/ibasso/governor-ibasso.c new file mode 100644 index 0000000..b2d3cdf --- /dev/null +++ b/firmware/target/hosted/ibasso/governor-ibasso.c @@ -0,0 +1,90 @@ +/*************************************************************************** + * __________ __ ___ + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * + * Copyright (C) 2014 by Ilia Sergachev: Initial Rockbox port to iBasso DX50 + * Copyright (C) 2014 by Mario Basister: iBasso DX90 port + * Copyright (C) 2014 by Simon Rothen: Initial Rockbox repository submission, additional features + * Copyright (C) 2014 by Udo Schläpfer: Code clean up, additional features + * + * 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 software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + + +#include <stdio.h> + +#include "config.h" +#include "cpufreq-linux.h" +#include "debug.h" + +#include "debug-ibasso.h" +#include "governor-ibasso.h" +#include "sysfs-ibasso.h" + + +/* Default governor at boot. */ +static int _last_governor = GOVERNOR_INTERACTIVE; + + +void ibasso_set_governor(int governor) +{ + DEBUGF("DEBUG %s: _last_governor: %d, governor: %d.", __func__, _last_governor, governor); + + if(_last_governor != governor) + { + switch(governor) + { + case GOVERNOR_CONSERVATIVE: + { + _last_governor = governor; + cpufreq_set_governor("conservative", CPUFREQ_ALL_CPUS); + break; + } + + case GOVERNOR_ONDEMAND: + { + _last_governor = governor; + cpufreq_set_governor("ondemand", CPUFREQ_ALL_CPUS); + break; + } + + case GOVERNOR_POWERSAVE: + { + _last_governor = governor; + cpufreq_set_governor("powersave", CPUFREQ_ALL_CPUS); + break; + } + + case GOVERNOR_INTERACTIVE: + { + _last_governor = governor; + cpufreq_set_governor("interactive", CPUFREQ_ALL_CPUS); + break; + } + + case GOVERNOR_PERFORMANCE: + { + _last_governor = governor; + cpufreq_set_governor("performance", CPUFREQ_ALL_CPUS); + break; + } + + default: + { + DEBUGF("ERROR %s: Unknown governor: %d.", __func__, governor); + break; + } + } + } +} diff --git a/firmware/target/hosted/ibasso/governor-ibasso.h b/firmware/target/hosted/ibasso/governor-ibasso.h new file mode 100644 index 0000000..34781fd --- /dev/null +++ b/firmware/target/hosted/ibasso/governor-ibasso.h @@ -0,0 +1,54 @@ +/*************************************************************************** + * __________ __ ___ + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * + * Copyright (C) 2014 by Ilia Sergachev: Initial Rockbox port to iBasso DX50 + * Copyright (C) 2014 by Mario Basister: iBasso DX90 port + * Copyright (C) 2014 by Simon Rothen: Initial Rockbox repository submission, additional features + * Copyright (C) 2014 by Udo Schläpfer: Code clean up, additional features + * + * 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 software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + + +#ifndef _GOVERNOR_IBASSO_H_ +#define _GOVERNOR_IBASSO_H_ + + +/* Supported freq scaling governors. */ +enum ibasso_governors +{ + /* Slow frequency switching. */ + GOVERNOR_CONSERVATIVE = 0, + + /* Fast frequency switching. */ + GOVERNOR_ONDEMAND, + GOVERNOR_INTERACTIVE, + + /* Allways lowest frequency. */ + GOVERNOR_POWERSAVE, + + /* Allways highest frequency. */ + GOVERNOR_PERFORMANCE +}; + + +/* + Set the active freq scaling governor. + governor: ibasso_governors +*/ +void ibasso_set_governor(int governor); + + +#endif diff --git a/firmware/target/hosted/ibasso/system-ibasso.c b/firmware/target/hosted/ibasso/system-ibasso.c index 00f8669..a107af7 100644 --- a/firmware/target/hosted/ibasso/system-ibasso.c +++ b/firmware/target/hosted/ibasso/system-ibasso.c @@ -27,7 +27,6 @@ #include <sys/reboot.h> #include "config.h" -#include "cpufreq-linux.h" #include "debug.h" #include "button-ibasso.h" @@ -50,8 +49,7 @@ void system_init(void) volatile uintptr_t stack = 0; stackbegin = stackend = (uintptr_t*) &stack; - cpufreq_set_governor("powersave", CPUFREQ_ALL_CPUS); - vold_monitor_start(); + vold_monitor_start(); ibasso_set_usb_mode(USB_MODE_MASS_STORAGE); /* |