[RK3288][Android6.0] 调试笔记 --- GPU DVFS的控制开关

Platform: Rockchip
OS: Android 6.0
Kernel: 3.10.92

GPU的DVFS不是在dts而是在驱动中直接控制并且默认打开的.

DVFS控制核心函数是mali_dvfs_event_proc(), 放在队列中处理,而队列是否开启受变量dvfs->is_enabled的控制.

int kbase_platform_dvfs_event(struct kbase_device *kbdev,
                  u32 utilisation, /* calculated_utilisation. */
                  u32 util_gl_share_no_use,
                  u32 util_cl_share_no_use[2])
{
    if (dvfs->is_enabled) {
        /* run 'mali_dvfs_work' in 'mali_dvfs_wq', on cpu0. */
        queue_work_on(0, dvfs->mali_dvfs_wq, &(dvfs->mali_dvfs_work));
    }
}

dvfs->is_enabled开机初始化就默认被设置为true.

int kbase_platform_dvfs_init(struct kbase_device *kbdev)
{
    dvfs->is_enabled = true;
}

也可以动态修改来决定是否开启DVFS.
开启:

root@rk3288:/ # echo on > /sys/devices/ffa30000.gpu/dvfs

关闭

root@rk3288:/ # echo off > /sys/devices/ffa30000.gpu/dvfs

本质上也是控制dvfs->is_enabled的值.
mali_kbase_platform.c

static ssize_t set_dvfs(struct device *dev,
            struct device_attribute *attr,
            const char *buf,
            size_t count)
{
    if (sysfs_streq("off", buf)) {
        kbase_platform_dvfs_disable(kbdev);
        ret = kbase_platform_dvfs_set_clk_highest(kbdev);
    } else if (sysfs_streq("on", buf)) {
        D("to enable mali_dvfs.");
        kbase_platform_dvfs_enable(kbdev);
    }
}
void kbase_platform_dvfs_enable(struct kbase_device *kbdev)
{
    struct rk_dvfs_t *dvfs = get_rk_dvfs(kbdev);

    mutex_lock(&(dvfs->dvfs_mutex));
    dvfs->is_enabled = true;
    mutex_unlock(&(dvfs->dvfs_mutex));
}

附dvfs->is_enabled初始化调用过程

kbase_platform_device_probe ->  mali_kbase_core_linux.c
  kbase_backend_early_init ->  mali_kbase_gpu.c
    kbasep_platform_device_init  -> mali_kbase_config.c
      platform_funcs_p->platform_init_func -> 
        kbase_platform_init -> mali_kbase_config_rk.c
          kbase_platform_dvfs_init

你可能感兴趣的:(子类__DDR_DVFS)