Skip to content

Commit

Permalink
Dont overclock core on Pi4 unless >100Mhz
Browse files Browse the repository at this point in the history
  • Loading branch information
IanSB committed Nov 26, 2021
1 parent c1a30a6 commit f464205
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
6 changes: 1 addition & 5 deletions src/defs.h
Expand Up @@ -8,10 +8,6 @@
#define _RPI3 3
#define _RPI4 4

#ifdef RPI4
//#define RPI4D
#endif

#ifdef USE_ARM_CAPTURE
#ifdef RPI4
#define USE_ALT_M7DEINTERLACE_CODE // uses re-ordered code for mode7 deinterlace
Expand Down Expand Up @@ -484,7 +480,7 @@ typedef struct {
#if defined(RPI4)
#define SCALER_DISPLAY_LIST (volatile uint32_t *)(_get_peripheral_base() + 0x404000)
#else
#define SCALER_DISPLAY_LIST (volatile uint32_t *)(_get_peripheral_base() + 0x402000)
#define SCALER_DISPLAY_LIST (volatile uint32_t *)(_get_peripheral_base() + 0x402000)
#endif

#define PIXEL_FORMAT 1 // RGBA4444
Expand Down
6 changes: 5 additions & 1 deletion src/info.c
Expand Up @@ -59,7 +59,7 @@ unsigned int get_clock_rate(int clk_id) {

void set_clock_rates(unsigned int cpu, unsigned int core, unsigned int sdram) {
static unsigned int old_core = -1;
static unsigned int old_cpu = -1;
static unsigned int old_cpu = -1;
if (core != old_core) {
delay_in_arm_cycles_cpu_adjust(50000000);
}
Expand All @@ -68,11 +68,15 @@ static unsigned int old_cpu = -1;
RPI_PropertyAddTag(TAG_SET_CLOCK_RATE, CORE_CLK_ID, core, 0);
RPI_PropertyAddTag(TAG_SET_CLOCK_RATE, SDRAM_CLK_ID, sdram, 0);
RPI_PropertyProcess();

if (core != old_core) {
#ifndef RPI4
RPI_AuxMiniUartFlush();
RPI_AuxMiniUartInit(115200, 8);
#endif
old_core = core;
}

if (cpu != old_cpu) {
calculate_cpu_timings();
old_cpu = cpu;
Expand Down
8 changes: 8 additions & 0 deletions src/osd.c
Expand Up @@ -1222,7 +1222,15 @@ static void set_clocks(){
auto_core = 150; //overclock to 400
}
}
#ifdef RPI4
if (core_overclock > 100) { //pi 4 core is already 500 Mhz (all others 400Mhz) so don't overclock unless overclock >100Mhz
set_clock_rates((cpu_clock + auto_cpu + cpu_overclock) * 1000000, (core_clock + auto_core + core_overclock - 100) * 1000000, (sdram_clock + sdram_overclock) * 1000000);
} else {
set_clock_rates((cpu_clock + auto_cpu + cpu_overclock) * 1000000, (core_clock + auto_core) * 1000000, (sdram_clock + sdram_overclock) * 1000000);
}
#else
set_clock_rates((cpu_clock + auto_cpu + cpu_overclock) * 1000000, (core_clock + auto_core + core_overclock) * 1000000, (sdram_clock + sdram_overclock) * 1000000);
#endif
}

static void set_feature(int num, int value) {
Expand Down

0 comments on commit f464205

Please sign in to comment.