From 81ed2aa50f07599f29186eb3071c4e58a0e4323c Mon Sep 17 00:00:00 2001 From: rob Date: Mon, 31 Mar 2008 22:43:20 +0000 Subject: [PATCH] Introduce sanity check and extra nop to stabilise TCC780x set_cpu_frequency(). Re-enable HAVE_ADJUSTABLE_CPU_FREQ and kill a few warnings by setting HAVE_SW_TONE_CONTROLS. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16904 a1c6a512-1295-4272-9138-f99709370657 --- firmware/export/config-cowond2.h | 5 ++--- firmware/sound.c | 6 +++--- firmware/target/arm/tcc780x/system-tcc780x.c | 7 ++++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/firmware/export/config-cowond2.h b/firmware/export/config-cowond2.h index aeb60bfce..a2a177550 100644 --- a/firmware/export/config-cowond2.h +++ b/firmware/export/config-cowond2.h @@ -84,8 +84,7 @@ #define HAVE_WM8985 /* There is no hardware tone control */ -/* TODO: probably need to use this */ -//#define HAVE_SW_TONE_CONTROLS +#define HAVE_SW_TONE_CONTROLS /* Define this for LCD backlight available */ #define HAVE_BACKLIGHT @@ -122,7 +121,7 @@ #define CPU_FREQ 48000000 /* Define this if you have adjustable CPU frequency */ -/* #define HAVE_ADJUSTABLE_CPU_FREQ */ +#define HAVE_ADJUSTABLE_CPU_FREQ /* Offset ( in the firmware file's header ) to the file CRC */ #define FIRMWARE_OFFSET_FILE_CRC 0 diff --git a/firmware/sound.c b/firmware/sound.c index b4d1059f9..b559fe2b5 100644 --- a/firmware/sound.c +++ b/firmware/sound.c @@ -227,7 +227,7 @@ static int tenthdb2reg(int db) #if (CONFIG_CODEC == MAS3507D) || defined HAVE_UDA1380 \ || defined HAVE_WM8975 || defined HAVE_WM8758 || defined(HAVE_WM8731) \ || defined(HAVE_WM8721) || defined(HAVE_TLV320) || defined(HAVE_WM8751) \ - || defined(HAVE_AS3514) + || defined(HAVE_AS3514) || defined(HAVE_WM8985) /* all values in tenth of dB MAS3507D UDA1380 */ int current_volume = 0; /* -780..+180 -840.. 0 */ @@ -405,7 +405,7 @@ void sound_set_volume(int value) #elif (CONFIG_CODEC == MAS3507D) || defined HAVE_UDA1380 \ || defined HAVE_WM8975 || defined HAVE_WM8758 || defined HAVE_WM8731 \ || defined(HAVE_WM8721) || defined(HAVE_TLV320) || defined(HAVE_WM8751) \ - || defined(HAVE_AS3514) + || defined(HAVE_AS3514) || defined(HAVE_WM8985) current_volume = value * 10; /* tenth of dB */ set_prescaled_volume(); #elif CONFIG_CPU == PNX0101 @@ -424,7 +424,7 @@ void sound_set_balance(int value) #elif CONFIG_CODEC == MAS3507D || defined HAVE_UDA1380 \ || defined HAVE_WM8975 || defined HAVE_WM8758 || defined HAVE_WM8731 \ || defined(HAVE_WM8721) || defined(HAVE_TLV320) || defined(HAVE_WM8751) \ - || defined(HAVE_AS3514) + || defined(HAVE_AS3514) || defined(HAVE_WM8985) current_balance = value * VOLUME_RANGE / 100; /* tenth of dB */ set_prescaled_volume(); #elif CONFIG_CPU == PNX0101 diff --git a/firmware/target/arm/tcc780x/system-tcc780x.c b/firmware/target/arm/tcc780x/system-tcc780x.c index f6392b023..c109b8ddd 100644 --- a/firmware/target/arm/tcc780x/system-tcc780x.c +++ b/firmware/target/arm/tcc780x/system-tcc780x.c @@ -291,11 +291,11 @@ int system_memory_guard(int newmode) #ifdef HAVE_ADJUSTABLE_CPU_FREQ -/* Note: This is not currently enabled because switching seems to - cause an occasional freeze. To be investigated. */ - void set_cpu_frequency(long frequency) { + if (cpu_frequency == frequency) + return; + /* CPU/COP frequencies can be scaled between Fbus (min) and Fsys (max). Fbus should not be set below ~32Mhz with LCD enabled or the display will be garbled. */ @@ -327,6 +327,7 @@ void set_cpu_frequency(long frequency) asm volatile ( "nop \n\t" "nop \n\t" + "nop \n\t" ); cpu_frequency = frequency; -- 2.11.4.GIT