| .. | .. |
|---|
| 119 | 119 | ret = -ENOMEM; |
|---|
| 120 | 120 | goto err_wq; |
|---|
| 121 | 121 | } |
|---|
| 122 | | - INIT_DELAYED_WORK(&platform->work, rk_pm_power_off_delay_work); |
|---|
| 122 | + INIT_DEFERRABLE_WORK(&platform->work, rk_pm_power_off_delay_work); |
|---|
| 123 | 123 | |
|---|
| 124 | 124 | wake_lock_init(&platform->wake_lock, WAKE_LOCK_SUSPEND, "gpu"); |
|---|
| 125 | 125 | |
|---|
| .. | .. |
|---|
| 378 | 378 | struct rk_context *platform = get_rk_context(kbdev); |
|---|
| 379 | 379 | ssize_t ret = 0; |
|---|
| 380 | 380 | unsigned long period_in_us = platform->utilisation_period * 1000; |
|---|
| 381 | | - unsigned long total_time = 0; |
|---|
| 382 | | - unsigned long busy_time = 0; |
|---|
| 383 | | - unsigned long utilisation = 0; |
|---|
| 381 | + unsigned long total_time; |
|---|
| 382 | + unsigned long busy_time; |
|---|
| 383 | + unsigned long utilisation; |
|---|
| 384 | 384 | |
|---|
| 385 | | -#ifdef CONFIG_MALI_DEVFREQ |
|---|
| 386 | 385 | kbase_pm_reset_dvfs_utilisation(kbdev); |
|---|
| 387 | | -#endif |
|---|
| 388 | 386 | usleep_range(period_in_us, period_in_us + 100); |
|---|
| 389 | | -#ifdef CONFIG_MALI_DEVFREQ |
|---|
| 390 | 387 | kbase_pm_get_dvfs_utilisation(kbdev, &total_time, &busy_time); |
|---|
| 391 | | -#else |
|---|
| 392 | | - dev_warn(dev, "can not get 'total_time' and 'busy_time', for CONFIG_MALI_DEVFREQ is disabled"); |
|---|
| 393 | | -#endif |
|---|
| 394 | 388 | /* 'devfreq_dev_profile' instance registered to devfreq |
|---|
| 395 | 389 | * also uses kbase_pm_reset_dvfs_utilisation |
|---|
| 396 | 390 | * and kbase_pm_get_dvfs_utilisation. |
|---|
| .. | .. |
|---|
| 398 | 392 | */ |
|---|
| 399 | 393 | D("total_time : %lu, busy_time : %lu.", total_time, busy_time); |
|---|
| 400 | 394 | |
|---|
| 401 | | - if (total_time != 0) |
|---|
| 402 | | - utilisation = busy_time * 100 / total_time; |
|---|
| 395 | + utilisation = busy_time * 100 / total_time; |
|---|
| 403 | 396 | ret += snprintf(buf, PAGE_SIZE, "%ld\n", utilisation); |
|---|
| 404 | 397 | |
|---|
| 405 | 398 | return ret; |
|---|
| .. | .. |
|---|
| 474 | 467 | return ret; |
|---|
| 475 | 468 | } |
|---|
| 476 | 469 | |
|---|
| 470 | +static const struct rockchip_opp_data rk3288_gpu_opp_data = { |
|---|
| 471 | + .get_soc_info = rk3288_get_soc_info, |
|---|
| 472 | +}; |
|---|
| 473 | + |
|---|
| 477 | 474 | static const struct of_device_id rockchip_mali_of_match[] = { |
|---|
| 478 | 475 | { |
|---|
| 479 | 476 | .compatible = "rockchip,rk3288", |
|---|
| 480 | | - .data = (void *)&rk3288_get_soc_info, |
|---|
| 477 | + .data = (void *)&rk3288_gpu_opp_data, |
|---|
| 481 | 478 | }, |
|---|
| 482 | 479 | { |
|---|
| 483 | 480 | .compatible = "rockchip,rk3288w", |
|---|
| 484 | | - .data = (void *)&rk3288_get_soc_info, |
|---|
| 481 | + .data = (void *)&rk3288_gpu_opp_data, |
|---|
| 485 | 482 | }, |
|---|
| 486 | 483 | {}, |
|---|
| 487 | 484 | }; |
|---|
| 488 | 485 | |
|---|
| 489 | 486 | int kbase_platform_rk_init_opp_table(struct kbase_device *kbdev) |
|---|
| 490 | 487 | { |
|---|
| 491 | | - return rockchip_init_opp_table(kbdev->dev, rockchip_mali_of_match, |
|---|
| 488 | + rockchip_get_opp_data(rockchip_mali_of_match, &kbdev->opp_info); |
|---|
| 489 | + |
|---|
| 490 | + return rockchip_init_opp_table(kbdev->dev, &kbdev->opp_info, |
|---|
| 492 | 491 | "gpu_leakage", "mali"); |
|---|
| 493 | 492 | } |
|---|