Skip to content

Commit

Permalink
drm/panfrost: Remove opp table when unloading
Browse files Browse the repository at this point in the history
The devfreq opp table needs to be removed when unloading the driver to
free the memory associated with it.

Signed-off-by: Steven Price <steven.price@arm.com>
Signed-off-by: Rob Herring <robh@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20190816093107.30518-3-steven.price@arm.com
  • Loading branch information
Steven Price authored and Rob Herring committed Aug 19, 2019
1 parent e21dd29 commit aa4fffe
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
6 changes: 6 additions & 0 deletions drivers/gpu/drm/panfrost/panfrost_devfreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,18 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev)
DRM_DEV_ERROR(&pfdev->pdev->dev, "Couldn't initialize GPU devfreq\n");
ret = PTR_ERR(pfdev->devfreq.devfreq);
pfdev->devfreq.devfreq = NULL;
dev_pm_opp_of_remove_table(&pfdev->pdev->dev);
return ret;
}

return 0;
}

void panfrost_devfreq_fini(struct panfrost_device *pfdev)
{
dev_pm_opp_of_remove_table(&pfdev->pdev->dev);
}

void panfrost_devfreq_resume(struct panfrost_device *pfdev)
{
int i;
Expand Down
1 change: 1 addition & 0 deletions drivers/gpu/drm/panfrost/panfrost_devfreq.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#define __PANFROST_DEVFREQ_H__

int panfrost_devfreq_init(struct panfrost_device *pfdev);
void panfrost_devfreq_fini(struct panfrost_device *pfdev);

void panfrost_devfreq_resume(struct panfrost_device *pfdev);
void panfrost_devfreq_suspend(struct panfrost_device *pfdev);
Expand Down
5 changes: 4 additions & 1 deletion drivers/gpu/drm/panfrost/panfrost_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -547,12 +547,14 @@ static int panfrost_probe(struct platform_device *pdev)
*/
err = drm_dev_register(ddev, 0);
if (err < 0)
goto err_out1;
goto err_out2;

panfrost_gem_shrinker_init(ddev);

return 0;

err_out2:
panfrost_devfreq_fini(pfdev);
err_out1:
panfrost_device_fini(pfdev);
err_out0:
Expand All @@ -571,6 +573,7 @@ static int panfrost_remove(struct platform_device *pdev)
pm_runtime_get_sync(pfdev->dev);
pm_runtime_put_sync_autosuspend(pfdev->dev);
pm_runtime_disable(pfdev->dev);
panfrost_devfreq_fini(pfdev);
panfrost_device_fini(pfdev);
drm_dev_put(ddev);
return 0;
Expand Down

0 comments on commit aa4fffe

Please sign in to comment.