allwinner h616/h618 cpu freq driver

From: titus <titus_at_edc.ro>
Date: Tue, 22 Aug 2023 10:25:12 UTC
H616 / H618 socs have a slightly different cpu-opp table for the cpu freq to voltage mapping
------------------------------------------------------------------------------------------------------
        opp-table-cpu {
                compatible = "allwinner,sun50i-h616-operating-points";
                nvmem-cells = <0x4c>;
                opp-shared;
                phandle = <0x3>;
                opp-480000000 {

                        clock-latency-ns = <0x3b9b0>;
                        opp-hz = <0x0 0x1c9c3800>;
                        opp-microvolt-speed0 = <0xdbba0 0xdbba0 0x10c8e0>;
                        opp-microvolt-speed1 = <0xdbba0 0xdbba0 0x10c8e0>;
                        opp-microvolt-speed2 = <0xdbba0 0xdbba0 0x10c8e0>;
                };
…..
-----------------------------------------------------------------------------------------
instead of the standard
        opp-table-cpu {
                compatible = "operating-points-v2";
                opp-shared;
                phandle = <0x3>;
                opp-480000000 {

                        opp-hz = <0x0 0x1c9c3800>;
                        opp-microvolt = <0xc8320>;
                        clock-latency-ns = <0x3b9b0>;
                };
…..
----------------------------------------------------------------------------
there are 3 sets of voltages listed and the speed key [0-2] is obtained from the nvmem cell with phandle <0x4c>

the question is how will be the best/recommended method to implement support
1. hack sys/dev/cpufreq/cpufreq_dt.c with a build time option and use ifdefs
2. duplicate the cpufreq_dt.c code and create a cloned driver from scratch
3. create a driver that only looks for compatible = "allwinner,sun50i-h616-operating-points” and then live patches
the fdt (reads the nvmem cell and replace opp-microvolt-speedN = <foo> with opp-microvolt = <foo>

thanks,
 Titus