[RK 3288][Android 6.0]デバッグノート---CPUが使用する周波数テーブル


Platform: Rockchip OS: Android 6.0 Kernel: 3.10.92
システムにはCPU関連の周波数表が3枚あります.
1. rockchip-cpufreq.c:
/* Frequency table index must be sequential starting at 0 */
static struct cpufreq_frequency_table default_freq_table[] = {
    {.frequency = 312 * 1000,       .index = 875 * 1000},
    {.frequency = 504 * 1000,       .index = 925 * 1000},
    {.frequency = 816 * 1000,       .index = 975 * 1000},
    {.frequency = 1008 * 1000,      .index = 1075 * 1000},
    {.frequency = 1200 * 1000,      .index = 1150 * 1000},
    {.frequency = 1416 * 1000,      .index = 1250 * 1000},
    {.frequency = 1608 * 1000,      .index = 1350 * 1000},
    {.frequency = CPUFREQ_TABLE_END},
};
static struct cpufreq_frequency_table *freq_table = default_freq_table;

2. rk3288.dtsi:
&clk_core_dvfs_table {
    operating-points = <
        /* KHz    uV */
        126000 900000
        216000 900000
        312000 900000
        408000 900000
        600000 900000
        696000 950000
        816000 1000000
        1008000 1050000
        1200000 1100000
        1416000 1200000
        1512000 1300000
        1608000 1350000
    //  1704000 1350000
    //  1800000 1400000
        >;
    //......
    };

3. rk3288.dtsi:
&clk_core_dvfs_table {
        //......
        support-pvtm = <1>;
        pvtm-operating-points = <
                /* KHz    uV    margin(uV)*/
                126000 900000   25000
                216000 900000   25000
                312000 900000   25000
                408000 900000   25000
                600000 900000   25000
                696000 950000   25000
                816000 1000000  25000
                1008000 1050000 25000
                1200000 1100000 25000
                1416000 1200000 25000
                1512000 1300000 25000
                1608000 1350000 25000
                >;
    status="okay";
    };

最終的には3枚目を使います.
コードコール:
最初のテーブルが上書きされた場所:dvfs.c:
static int cpufreq_init_cpu0(struct cpufreq_policy *policy)
{
    freq_table = dvfs_get_freq_volt_table(clk_cpu_dvfs_node);
}
struct cpufreq_frequency_table *dvfs_get_freq_volt_table(struct dvfs_node *clk_dvfs_node) 
{
    struct cpufreq_frequency_table *table;

    if (!clk_dvfs_node)
        return NULL;

    mutex_lock(&clk_dvfs_node->vd->mutex);
    table = clk_dvfs_node->dvfs_table;
    mutex_unlock(&clk_dvfs_node->vd->mutex);

    return table;
}

2番目のテーブルが上書きされた場所:
int clk_enable_dvfs(struct dvfs_node *clk_dvfs_node)
{
            if (clk_dvfs_node->support_pvtm)
            pvtm_set_dvfs_table(clk_dvfs_node);
}