Port-arm archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

sunxi: CPU frequency and voltage scaling support added to -current



Hi folks --

I've added a few drivers to -current that enables cpu frequency scaling support (using defacto standard machdep.cpu.frequency.* controls) as well as thermal monitoring support for Allwinner H3/A83T/A64 SoCs.

In addition, the Allwinner thermal sensor driver and generic DT frequency scaling driver will work together to ensure that your chip doesn't overhead; when the temperature warning trip point is reached, the cpufreq driver will automatically throttle the CPU until the temperature returns to normal. If for some reason this attempt to cool things down fails, a separate shutdown trip point will trigger the driver to immediately attempt to poweroff the board.

If everything is working, you should see something like this:

  sunxi# dmesg | grep sunxitherm
  sunxithermal0 at fdt1: Thermal sensor controller
  sunxithermal0: interrupting on GIC irq 63
  sunxithermal0: cpu: alarm 90C hyst 15C shut 105C

  sunxi# sysctl machdep.cpu
  machdep.cpu.frequency.target = 1296
  machdep.cpu.frequency.current = 1296
  machdep.cpu.frequency.available = 1296 1200 1008 816 648

  sunxi# envstat
                       Current  CritMax  WarnMax  WarnMin  CritMin  Unit
  [sunxithermal0]
    CPU temperature:    38.000                                      degC


The upstream Linux dts files are missing these controls for most newer SoCs, so you'll need to patch them in manually. There are a few pieces -- in the SoC-specific .dtsi we need to tell the cpu@0 node how to control the clock. You can see an example of this in sys/arch/arm/dts/sun8i-h3.dtsi:

                cpu@0 {
                        clocks = <&ccu CLK_CPUX>;
                        clock-latency = <2000000>;
                };

The board-specific files then need to define a power supply for the CPU and a list of operating points (CPU frequency + voltage pairs). Have a look at arch/arm/dts/sun8i-h3-nanopi-neo.dts and arch/arm/dts/sun8i-h3-orangepi-plus2e.dts for a few examples. Note that these are very much board specific! So please don't assume that copying one of these examples will work for you.

Cheers,
Jared


Home | Main Index | Thread Index | Old Index