Right now I have only tested changing DDR frequencies and voltage and to GPU. In that last case I'm not exactly sure how data in DTB (Device Tree Blob) are affecting real working parameters of GPU.
How to change DDR voltage and frequencies:
1. Copy resource file: "dd if=/dev/block/mtd/by-name/resource of=/sdcard/resource.img bs=1024 count=114"
2. Open file /sdcard/resource.img in Hex Editor and find ASCII text: "pd_ddr"
3. After text "clk_ddr" you will find 12 byte structure describing size and offset for that leaf name. For example (hexadecimal): "00 00 00 03 00 00 00 30 00 00 08 57". Most important number here is 30h=48 which tell as how many data bytes that node hold. 857h = 2135 is byte offset in structure which stores names of leafs in that tree. In my case It beggins at hex offset: "174b0". Therefore this exact number index: "operating-points" name which starts at 17d07h. These 48 bytes describe DDR operation points (freq in kHz (4B),voltage in uV (4B) x 6): "00 03 0d 40 00 10 67 38 00 04 93 e0 00 10 67 38 00 06 f5 40 00 11 2a 88 00 08 22 08 00 11 8c 30 00 09 27 c0 00 13 12 d0 00 0a ae 60 00 13 d6 20" which translates to "200000kHz 1075000uV 300000kHz 1075000uV 456000kHz 1125000uV 533000kHz 1150000uV 600000kHz 1250000uV 696000kHz 1300000uV".
Next leaf name is "channel" and is only 4B long and contain only number "2".
Next is 5B? long "status" and contains string "okay".
Next leaf "freq-table" (00 00 00 03 00 00 00 28 00 00 08 da) is important because in my case it contains 40bytes describing freqency table pairs (status (4B), freq kHz (4B)), which is used in working system and correlate with system status: "normal = 0x1", "suspend = 0x2", "video_1080p = 0x20", "video_4k = 0x10", "performance = 0x2000". There you can change working DDR frequencies to your liking. But in my opinion these should correspond with defined "operating points". And remember in actual system only boot, normal and suspend are used. Of course you can force video_1080p and video_4k states by writing and hodling /dev/video_state file but it isn't convinient.
This is fragment of DTS (Device Tree Source) file which describe above binary data structures:
pd_ddr { clk_ddr { operating-points = <0x30d40 0x106738 0x493e0 0x106738 0x6f540 0x112a88 0x82208 0x118c30 0x927c0 0x1312d0 0xaae60 0x13d620>; channel = <0x2>; status = "okay"; freq-table = <0x1 0x927c0 0x2 0x30d40 0x20 0x927c0 0x10 0x927c0 0x2000 0xaae60>; auto-freq-table = <0x3a980 0x4f1a0 0x6f540 0x80e80 0x927c0 0xaae60>; auto-freq = <0x0>; }; }; pd_vio { aclk_vio1 { operating-points = <0x186a0 0x10c8e0 0x7a120 0x10c8e0>; status = "okay"; }; }; }; vd_gpu { regulator_name = "vdd_gpu"; suspend_volt = <0x3e8>; pd_gpu { clk_gpu { operating-points = <0x30d40 0xdbba0 0x493e0 0xe7ef0 0x668a0 0x10c8e0 0x7a120 0x118c30 0x927c0 0x1312d0>; channel = <0x1>; status = "okay"; }; };
#define SYS_STATUS_NORMAL (1<<0) #define SYS_STATUS_SUSPEND (1<<1) #define SYS_STATUS_IDLE (1<<2) #define SYS_STATUS_REBOOT (1<<3) #define SYS_STATUS_VIDEO_4K (1<<4) #define SYS_STATUS_VIDEO_1080P (1<<5) #define SYS_STATUS_GPU (1<<6) (...) #define SYS_STATUS_PERFORMANCE (1<<13)
You will find current operating voltage set for DDR in /sys/class/regulator/regulator.3/microvolts (vdd_logic?) device file but I'm not sure if these values aren't modified in hardware by changing reference voltage for ACT8846QM regulator like it was with RK3188 boards. When there was no LPDDR3 memory present on the board by changing one resistor manufacturer could replace LPDDR3 memory with DDR3 and wouldn't have to change software. Voltage regulator still "thought" that it was supplying 1,2V and in reality it was 1,5V (1,2 x 1,25 = 64kOhm/51kOhm - voltage divider). I do not know how it is in current design therefore be carefull and do not go beyond 1,3V for a time being.
Not so far bellow "pd_ddr" in resource.img we have "pd_gpu" and "clk_gpu" branches but till now I didn't tested changing these numbers. They seem fishy to me because they do not exactly correspond with data which I see when executing command: "dmesg|grep mali_dvfs" and there isn't any visible way to change treshold properity.
After saving changes you can flash back resource.img into resource partition:
"dd of=/dev/block/mtd/by-name/resource if=/sdcard/resource.img bs=1024 count=114". If something goes wrong and device isn't booting up then you can flash original resource.img "PC way" in Android Tool.
Comment