Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Allwinner DE2.0/DE3.0 mixer clock smart selection to both save power consumption and protect against mixer misuse #5

Open
rsglobal opened this issue Jun 7, 2022 · 0 comments

Comments

@rsglobal
Copy link
Member

rsglobal commented Jun 7, 2022

Currently mixer clock is always set to maximum, which affects power consumption.
Also in certain conditions mixer can produce damaged output.

How to play with pixel clock (can potentially damage the hardware, don't try if you're not ready to lose it):
Pixel clock divider control registers are located at 0x100000C address

Bits:

  • bits 3-0 - Mixer 0 divider
  • bits 7-4 - Mixer 1 divider

Values:

  • 0 - base freq / 1
  • 1 - base freq / 2

and so on

Bash example (divide base freq by 4. On OPI3 it does mean 600Mhz/4 = 150MHz):

devmem 0x100000C 32 0x3

It's safe to reduce mixer clock (MClk) down to pixel clock (PClk) once hardware down-scaling isn't used
Up-scaling does not require clocking the module faster than pixel clock.

Down-scaling has some limitation (Tested with RGBA8888):

Vertical VI downscaling up to 2x require MClk=2*PClk
Vertical VI downscaling up to 16x require MClk=4*PClk
Horizontal VI downscaling up to 4x require MClk=2*PClk
Horizontal VI downscaling up to 8x require MClk=4*PClk
Horizontal VI downscaling up to 16x require MClk=4*PClk
(TODO: Distinguish between fine/coarse modes)

Vertical UI downscaling up to 2x require MClk=2*PClk
Vertical UI downscaling up to 4x require MClk=4*PClk
Vertical UI downscaling up to 8x require MClk=8*PClk !!!
Vertical UI downscaling up to 16x require MClk=24*PClk !!!
Horizontal UI downscaling up to 4x require MClk=2*PClk
Horizontal UI downscaling up to 8x require MClk=4*PClk

Exceeding these values will cause damaged picture output and in some cases pipeline can freeze.

Power consumption measurements:

  • H6 SOC, 1920x1080@60 mode (PClk=148.5MHz, single-plane FB console case)
    Without changing the mixer clock (600MHz): 0.38A
    After changing the mixer clock (150MHz): 0.36A

  • H6 SOC, 640x480@60 mode (PClk=25.2MHz, modetest test pattern case)
    Without vhanging the mixer clock (600MHz) 0.35A
    After changing the mixer clock (37.5MHz): 0.33A

Stress testing to ensure it's safe to switch the divider while mixer is doing the work:

while true ; do devmem 0x100000c 4 0x1 ; devmem 0x100000c 4 0x0 ; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant