1
0
Fork 0
forked from len0rd/rockbox

FS#10344 - AMSSansa Dynamically adjust core voltage to extend playtime.

Lower CVDD core voltage to 1.10 volts when the frequency is less than 200 MHz.

 

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21577 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jack Halpin 2009-06-30 17:56:21 +00:00
parent 8c22a60290
commit e905ca61d4
3 changed files with 30 additions and 7 deletions

View file

@ -27,6 +27,20 @@
#include "as3514.h"
/* Charge Pump and Power management Settings */
#define AS314_CP_DCDC3_SETTING \
((0<<7) | /* CP_SW Auto-Switch Margin 0=200/300 1=150/255 */ \
(0<<6) | /* CP_on 0=Normal op 1=Chg Pump Always On */ \
(0<<5) | /* LREG_CPnot Always write 0 */ \
(0<<3) | /* DCDC3p BVDD setting 3.6/3.2/3.1/3.0 */ \
(1<<2) | /* LREG_off 1=Auto mode switching 0=Length Reg only*/\
(0<<0) ) /* CVDDp Core Voltage Setting 1.2/1.15/1.10/1.05*/
#define CVDD_1_20 0
#define CVDD_1_15 1
#define CVDD_1_10 2
#define CVDD_1_05 3
void ascodec_init(void);
int ascodec_write(unsigned int index, unsigned int value);

View file

@ -28,6 +28,7 @@
#include "sprintf.h"
#include "cpu.h"
#include "pl180.h"
#include "ascodec-target.h"
#define _DEBUG_PRINTF(a,varargs...) do { \
snprintf(buf, sizeof(buf), (a), ##varargs); lcd_puts(0,line++,buf); \
@ -280,7 +281,10 @@ bool __dbg_hw_info(void)
_DEBUG_PRINTF("SD :%3dkHz %3dkHz", AS3525_SD_IDENT_FREQ/1000,calc_freq(CLK_SD_IDENT_NAND)/1000);
_DEBUG_PRINTF("MSD :%3dkHz %3dkHz", AS3525_SD_IDENT_FREQ/1000,calc_freq(CLK_SD_IDENT_MSD)/1000);
_DEBUG_PRINTF("USB: %3dMHz", calc_freq(CLK_USB)/1000000);
_DEBUG_PRINTF("MMU: %s", (read_cp15() & CP15_MMU) ? " op" : "nop");
ascodec_write(AS3514_ADC_0, 4<<4); /* ADC Source = CVDD */
_DEBUG_PRINTF("MMU: %s CVDDP:%4d", (read_cp15() & CP15_MMU) ? " op" : "nop",
((ascodec_read(AS3514_ADC_1) |
((ascodec_read(AS3514_ADC_0) & 3)<<8)) * 25));
_DEBUG_PRINTF("Icache:%s Dcache:%s",(read_cp15() & CP15_IC) ? " op" : "nop",
(read_cp15() & CP15_DC) ? " op" : "nop");

View file

@ -271,7 +271,6 @@ void system_init(void)
AS3525_PCLK_SEL);
asm volatile(
"mov r0, #0 \n"
"mrc p15, 0, r0, c1, c0 \n" /* control register */
"bic r0, r0, #3<<30 \n" /* clears bus bits : sets fastbus */
"mcr p15, 0, r0, c1, c0 \n"
@ -295,10 +294,8 @@ void system_init(void)
ascodec_init();
#ifndef BOOTLOADER
/* Disable fast hardware power-off, to use power button normally
* We don't need the power button in the bootloader. */
ascodec_write(AS3514_CVDD_DCDC3, ascodec_read(AS3514_CVDD_DCDC3) & (1<<2));
/* Initialize power management settings */
ascodec_write(AS3514_CVDD_DCDC3, AS314_CP_DCDC3_SETTING);
#ifdef CONFIG_TUNER
fmradio_i2c_init();
#endif
@ -331,7 +328,12 @@ void set_cpu_frequency(long frequency)
{
if(frequency == CPUFREQ_MAX)
{
/* Increasing frequency so boost voltage before change */
ascodec_write(AS3514_CVDD_DCDC3, (AS314_CP_DCDC3_SETTING | CVDD_1_20));
/* Confirm voltage is at least 1.20v before making fclk > 200 MHz */
ascodec_write(AS3514_ADC_0, 4<<4); /* ADC Source = CVDD */
while (ascodec_read(AS3514_ADC_1) < 0xe0); /* 0x1e0 *.0025 = 1.20 */
/* e0 = 8LSB's of 0x1e0 */
asm volatile(
"mrc p15, 0, r0, c1, c0 \n"
@ -355,6 +357,9 @@ void set_cpu_frequency(long frequency)
"mcr p15, 0, r0, c1, c0 \n"
: : : "r0" );
/* Decreasing frequency so reduce voltage after change */
ascodec_write(AS3514_CVDD_DCDC3, (AS314_CP_DCDC3_SETTING | CVDD_1_10));
cpu_frequency = CPUFREQ_NORMAL;
}
}