Skip to content

RP1 Overclock regression in 6.12 #6725

Closed

Description

@schoolpost

Describe the bug

In order to support a higher frame rates at higher resolutions with CSI-2 camera modules, the RP1 clock must be increased from the default 200Mhz ( 400Mpx/s ) to a higher 300Mhz ( 600Mpx/s )

This was possible in kernel 6.6, in fact when overclock to 300Mhz in 6.6 it would actually set the clock to 333Mhz; but my latest attempts in 6.12 appear to have no effect anymore. ( stuck at 200Mhz )

It would be great to have a config.txt method of setting an increased RP1 clock for camera use cases.

Steps to reproduce the behaviour

Please refer here for more information: raspberrypi/libcamera#243

Device (s)

Raspberry Pi 5

System

Linux raspberrypi 6.6.78-v8-16k+ SMP PREEMPT Mon Mar 3 15:28:28 MST 2025 aarch64 GNU/Linux

( I've gone back to 6.6 in the mean time, so I can't provide a 6.12 log here )

Logs

No response

Additional context

No response

Activity

  1. pelwell commented on Mar 21, 2025

    @pelwell
    Contributor

    I can't reproduce this - the clock still changes on 6.12, both with a self-built kernel and with the latest from rpi-update, although both require a modified DTB as you have found. Are you sure you copied in the hacked dtb file?

    This kind of modification could be done with an overlay, but publishing that makes it look approved of. And I'd want to change the clock driver to make it legal. Currently I think it only works because the parent PLL is modified without looking at the maximum frequency, and since the sys clock is 1:1 with the parent it gets changed immediately.

    What are your thoughts, @naushir?

  2. schoolpost commented on Mar 21, 2025

    @schoolpost
    Author

    I can't reproduce this - the clock still changes on 6.12, both with a self-built kernel and with the latest from rpi-update, although both require a modified DTB as you have found. Are you sure you copied in the hacked dtb file?

    This kind of modification could be done with an overlay, but publishing that makes it look approved of. And I'd want to change the clock driver to make it legal. Currently I think it only works because the parent PLL is modified without looking at the maximum frequency, and since the sys clock is 1:1 with the parent it gets changed immediately.

    What are your thoughts, @naushir?

    How are you verifying the clock speed changes taking effect? ( cat /sys/kernel/debug/clk/clk_summary ? )

    For example this is what I get in 6.6 with the modification of the .dtb:

                                     enable  prepare  protect                                duty  hardware                            connection
       clock                          count    count    count        rate   accuracy phase  cycle    enable   consumer                         id
    ---------------------------------------------------------------------------------------------------------------------------------------------
     fw-clk-disp                         1       1        0        0           0          0     50000      Y   107c580000.hvs                  disp                     
                                                                                                               deviceless                      no_connection_id         
     fw-clk-vec                          0       0        0        0           0          0     50000      Y   deviceless                      no_connection_id         
     fw-clk-pixel-bvb                    0       0        0        0           0          0     50000      Y   107c706400.hdmi                 bvb                      
                                                                                                               107c701400.hdmi                 bvb                      
                                                                                                               deviceless                      no_connection_id         
     fw-clk-m2mc                         0       0        0        120000000   0          0     50000      Y   107c706400.hdmi                 hdmi                     
                                                                                                               107c701400.hdmi                 hdmi                     
                                                                                                               deviceless                      no_connection_id         
     fw-clk-hevc                         0       0        0        500000000   0          0     50000      Y   1000800000.codec                hevc                     
                                                                                                               deviceless                      no_connection_id         
     fw-clk-pixel                        0       0        0        0           0          0     50000      Y   deviceless                      no_connection_id         
     fw-clk-isp                          2       2        0        500000000   0          0     50000      Y   1000880000.pisp_be              no_connection_id         
                                                                                                               deviceless                      no_connection_id         
     fw-clk-v3d                          0       0        0        500000000   0          0     50000      Y   1002000000.v3d                  no_connection_id         
                                                                                                               deviceless                      no_connection_id         
     fw-clk-core                         1       1        0        500000000   0          0     50000      Y   107c580000.hvs                  core                     
                                                                                                               deviceless                      no_connection_id         
     fw-clk-arm                          0       0        0        1500000000  0          0     50000      Y   cpu0                            no_connection_id         
                                                                                                               cpu0                            no_connection_id         
                                                                                                               deviceless                      no_connection_id         
     cam1_clk                            1       1        0        24000000    0          0     50000      Y   11-001a                         no_connection_id         
                                                                                                               deviceless                      no_connection_id         
     core                                0       0        0        50000000    0          0     50000      Y   deviceless                      no_connection_id         
     src                                 0       0        0        1000000000  0          0     50000      Y   deviceless                      no_connection_id         
     xosc                                8       8        0        50000000    0          0     50000      Y   deviceless                      no_connection_id         
        clk_pwm1                         1       1        0        50000000    0          0     50000      Y      1f0009c000.pwm                  no_connection_id         
                                                                                                                  deviceless                      no_connection_id         
        clksrc_mipi1_dsi_byteclk         0       0        0        0           0          0     50000      Y      deviceless                      no_connection_id         
        clksrc_mipi0_dsi_byteclk         0       0        0        0           0          0     50000      Y      deviceless                      no_connection_id         
        clk_gp5                          0       0        0        50000000    0          0     50000      Y      deviceless                      no_connection_id         
        clk_gp4                          0       0        0        50000000    0          0     50000      Y      deviceless                      no_connection_id         
        clk_gp3                          0       0        0        50000000    0          0     50000      Y      deviceless                      no_connection_id         
        clk_gp0                          0       0        0        50000000    0          0     50000      Y      deviceless                      no_connection_id         
        clk_sdio_timer                   0       0        0        1000000     0          0     50000      Y      deviceless                      no_connection_id         
           clk_gp1                       0       0        0        1000000     0          0     50000      Y         deviceless                      no_connection_id         
        clk_adc                          1       1        0        50000000    0          0     50000      Y      1f000c8000.adc                  no_connection_id         
                                                                                                                  deviceless                      no_connection_id         
        clk_eth_tsu                      1       1        0        50000000    0          0     50000      Y      1f00100000.ethernet             tsu_clk                  
                                                                                                                  1f00100000.ethernet             tsu_clk                  
                                                                                                                  deviceless                      no_connection_id         
        clk_mipi1_cfg                    1       1        0        25000000    0          0     50000      Y      1f00128000.csi                  no_connection_id         
                                                                                                                  deviceless                      no_connection_id         
        clk_mipi0_cfg                    0       0        0        50000000    0          0     50000      Y      deviceless                      no_connection_id         
        clk_i2s                          0       0        0        50000000    0          0     50000      Y      deviceless                      no_connection_id         
        clk_uart                         0       0        0        50000000    0          0     50000      Y      deviceless                      no_connection_id         
        clk_slow_sys                     1       1        0        50000000    0          0     50000      Y      deviceless                      no_connection_id         
        pll_video_core                   1       1        0        0           0          0     50000      Y      deviceless                      no_connection_id         
           pll_video_sec                 0       0        0        0           0          0     50000      Y         deviceless                      no_connection_id         
           pll_video                     0       0        0        0           0          0     50000      Y         deviceless                      no_connection_id         
              pll_video_pri_ph           0       0        0        0           0          0     50000      Y            deviceless                      no_connection_id         
        pll_audio_core                   1       1        0        1536000001  0          0     50000      Y      deviceless                      no_connection_id         
           pll_audio_tern                0       0        0        80842106    0          0     50000      Y         deviceless                      no_connection_id         
           pll_audio_sec                 0       0        0        192000001   0          0     50000      Y         deviceless                      no_connection_id         
           pll_audio                     0       0        0        61440000    0          0     50000      Y         deviceless                      no_connection_id         
              pll_audio_pri_ph           0       0        0        30720000    0          0     50000      Y            deviceless                      no_connection_id         
        pll_sys_core                     3       3        0        1000000000  0          0     50000      Y      deviceless                      no_connection_id         
           pll_sys_sec                   1       1        0        125000000   0          0     50000      Y         deviceless                      no_connection_id         
              clk_eth                    1       1        0        125000000   0          0     50000      Y            1f00100000.ethernet             tx_clk                   
                                                                                                                        deviceless                      no_connection_id         
           pll_sys                       2       2        0        333333333   0          0     50000      Y         deviceless                      no_connection_id         
              clk_mipi1_dpi              0       0        0        333333333   0          0     50000      Y            deviceless                      no_connection_id         
              clk_mipi0_dpi              0       0        0        333333333   0          0     50000      Y            deviceless                      no_connection_id         
              clk_dpi                    0       0        0        333333333   0          0     50000      Y            deviceless                      no_connection_id         
              clk_sdio_alt_src           0       0        0        166666666   0          0     50000      Y            deviceless                      no_connection_id         
                 clk_gp2                 0       0        0        166666666   0          0     50000      Y               deviceless                      no_connection_id         
              clk_sys                    6       6        0        333333333   0          0     50000      Y            1f00080000.i2c                  no_connection_id         
                                                                                                                        1f00074000.i2c                  no_connection_id         
                                                                                                                        1f00188000.dma                  cfgr-clk                 
                                                                                                                        1f00100000.ethernet             hclk                     
                                                                                                                        1f00100000.ethernet             pclk                     
                                                                                                                        deviceless                      no_connection_id         
              pll_sys_pri_ph             1       1        0        166666666   0          0     50000      Y            deviceless                      no_connection_id         
                 clk_vec                 0       0        0        166666666   0          0     50000      Y               deviceless                      no_connection_id         
                 clk_dma                 1       1        0        166666666   0          0     50000      Y               1f00188000.dma                  core-clk                 
                                                                                                                           deviceless                      no_connection_id         
     emmc2-clock                         1       1        0        200000000   0          0     50000      Y   1000fff000.mmc                  no_connection_id         
                                                                                                               deviceless                      no_connection_id         
     uart-clock                          1       2        0        44236800    0          0     50000      Y   107d001000.serial               no_connection_id         
                                                                                                               deviceless                      no_connection_id         
     vpu-clock                           2       2        0        750000000   0          0     50000      Y   107d004000.spi                  no_connection_id         
                                                                                                               107d001000.serial               apb_pclk                 
                                                                                                               deviceless                      no_connection_id         
     otg                                 0       0        0        480000000   0          0     50000      Y   deviceless                      no_connection_id         
     osc                                 0       0        0        54000000    0          0     50000      Y   deviceless                      no_connection_id         
     108MHz-clock                        0       0        0        108000000   0          0     50000      Y   deviceless                      no_connection_id         
        hdmi1-108MHz                     0       0        0        108000000   0          0     50000      N      107c706400.hdmi                 audio                    
                                                                                                                  deviceless                      no_connection_id         
        hdmi0-108MHz                     0       0        0        108000000   0          0     50000      N      107c701400.hdmi                 audio                    
                                                                                                                  deviceless                      no_connection_id         
     27MHz-clock                         1       1        0        27000000    0          0     50000      Y   107c706400.hdmi                 cec                      
                                                                                                               107c701400.hdmi                 cec                      
                                                                                                               107d517a80.pwm                  no_connection_id         
                                                                                                               deviceless                      no_connection_id         
     clk_audio_out                       0       0        0        0           0          0     50000      Y   deviceless                      no_connection_id         
     clk_audio_in                        0       0        0        0           0          0     50000      Y   deviceless                      no_connection_id         
     clk_pwm0                            0       0        0        0           0          0     50000      Y   deviceless                      no_connection_id         
    

    I'll recompile the latest 6.12 with the .dtb changes, and report what mine shows.

    More importantly, beyond just getting a different clock reading, the camera peripheral is produces artifacts and glitches that are consistent with the clock remaining at 200Mhz as I cannot achieve UHD 60fps live video preview as I can in 6.6 with the same changes.

  3. schoolpost commented on Mar 22, 2025

    @schoolpost
    Author

    Perhaps it was an issue with a previous version of 6.12 I tried a few weeks ago, but seems to be fixed since. I am able to set the clock to a higher speed now:

           pll_sys                       2       2        0        333333333   0          0     50000      Y         deviceless                      no_connection_id         
              clk_mipi1_dpi              0       0        0        333333333   0          0     50000      Y            deviceless                      no_connection_id         
              clk_mipi0_dpi              0       0        0        333333333   0          0     50000      Y            deviceless                      no_connection_id         
              clk_dpi                    0       0        0        333333333   0          0     50000      Y            deviceless                      no_connection_id         
              clk_sdio_alt_src           0       0        0        166666666   0          0     50000      Y            deviceless                      no_connection_id         
                 clk_gp2                 0       0        0        166666666   0          0     50000      Y               deviceless                      no_connection_id         
              clk_sys                    6       6        0        333333333   0          0     50000      Y            1f00080000.i2c                  no_connection_id  
    

    And I do not have any glitches or issues with the camera anymore as expected.

    Having this configurable through an overlay would still be a welcome add however.

  4. will127534 commented on Mar 22, 2025

    @will127534

    For those who stumble across this issue, here is the dtoverlay to change RP1 clock without recompile the kernel:

    /dts-v1/;
    /plugin/;
    
    / {
    	compatible = "brcm,bcm2712";
    
    	fragment@0 {
    		target = <&rp1_clocks>;
    		__overlay__ {
    			/*
    			 * Re-specify the entire assigned-clock-rates array.
    			 * Only the items for RP1_PLL_SYS (index #2) and
    			 * RP1_CLK_SYS (index #7) have been changed to 300000000.
    			 */
    			assigned-clock-rates = <
    				/* RP1_PLL_SYS_CORE  */ 1000000000
    				/* RP1_PLL_AUDIO_CORE*/ 1536000000
    				/* RP1_PLL_SYS       */ 300000000
    				/* RP1_PLL_SYS_SEC   */ 125000000
    				/* RP1_CLK_ETH       */ 125000000
    				/* RP1_PLL_AUDIO     */ 61440000
    				/* RP1_PLL_AUDIO_SEC */ 153600000
    				/* RP1_CLK_SYS       */ 300000000
    				/* RP1_PLL_SYS_PRI_PH*/ 100000000
    				/* RP1_CLK_SLOW_SYS  */ 50000000
    				/* RP1_CLK_SDIO_TIMER*/ 1000000
    				/* RP1_CLK_SDIO_ALT_SRC*/ 200000000
    				/* RP1_CLK_ETH_TSU   */ 50000000
    			>;
    		};
    	};
    };
    

    Save it as rp1-300mhz.dtso and do dtc -@ -I dts -O dtb -o rp1-300mhz.dtbo rp1-300mhz.dtso to compile, copy the rp1-300mhz.dtbo to /boot/firmware/overlays/ and do dtoverlay=rp1-300mhz in config.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions