drm/lima: Add optional devfreq and cooling device support
Most platforms with a Mali-400 or Mali-450 GPU also have support for changing the GPU clock frequency. Add devfreq support so the GPU clock rate is updated based on the actual GPU usage when the "operating-points-v2" property is present in the board.dts. The actual devfreq code is taken from panfrost_devfreq.c and modified so it matches what the lima hardware needs: - a call to dev_pm_opp_set_clkname() during initialization because there are two clocks on Mali-4x0 IPs. "core" is the one that actually clocks the GPU so we need to control it using devfreq. - locking when reading or writing the devfreq statistics because (unlike than panfrost) we have multiple PP and GP IRQs which may finish jobs concurrently. Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Signed-off-by: Qiang Yu <yuq825@gmail.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200319203427.2259891-3-martin.blumenstingl@googlemail.com
This commit is contained in:

committed by
Qiang Yu

parent
6bb0942e8f
commit
1996970773
@@ -10,6 +10,7 @@
|
||||
#include <drm/drm_prime.h>
|
||||
#include <drm/lima_drm.h>
|
||||
|
||||
#include "lima_device.h"
|
||||
#include "lima_drv.h"
|
||||
#include "lima_gem.h"
|
||||
#include "lima_vm.h"
|
||||
@@ -397,13 +398,19 @@ static int lima_pdev_probe(struct platform_device *pdev)
|
||||
if (err)
|
||||
goto err_out1;
|
||||
|
||||
err = lima_devfreq_init(ldev);
|
||||
if (err) {
|
||||
dev_err(&pdev->dev, "Fatal error during devfreq init\n");
|
||||
goto err_out2;
|
||||
}
|
||||
|
||||
/*
|
||||
* Register the DRM device with the core and the connectors with
|
||||
* sysfs.
|
||||
*/
|
||||
err = drm_dev_register(ddev, 0);
|
||||
if (err < 0)
|
||||
goto err_out2;
|
||||
goto err_out3;
|
||||
|
||||
platform_set_drvdata(pdev, ldev);
|
||||
|
||||
@@ -412,8 +419,10 @@ static int lima_pdev_probe(struct platform_device *pdev)
|
||||
|
||||
return 0;
|
||||
|
||||
err_out2:
|
||||
err_out3:
|
||||
lima_device_fini(ldev);
|
||||
err_out2:
|
||||
lima_devfreq_fini(ldev);
|
||||
err_out1:
|
||||
drm_dev_put(ddev);
|
||||
err_out0:
|
||||
@@ -429,6 +438,7 @@ static int lima_pdev_remove(struct platform_device *pdev)
|
||||
sysfs_remove_bin_file(&ldev->dev->kobj, &lima_error_state_attr);
|
||||
platform_set_drvdata(pdev, NULL);
|
||||
drm_dev_unregister(ddev);
|
||||
lima_devfreq_fini(ldev);
|
||||
lima_device_fini(ldev);
|
||||
drm_dev_put(ddev);
|
||||
lima_sched_slab_fini();
|
||||
|
Reference in New Issue
Block a user