drm/tegra: add hwpm support in video ip driver

Add IP-HWPM interface in NVENC, OFA and VIC drivers. This code will
- register with HWPM driver during probe
- expose power management and register read/write function.

Bug 4158030

Change-Id: I9311c9fc31cffadf11c36b6e4516f0da84dcbdf4
Signed-off-by: Vedashree Vidwans <vvidwans@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2954070
Reviewed-by: Santosh BS <santoshb@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Vedashree Vidwans
2023-09-08 09:25:05 -07:00
committed by mobile promotions
parent ece68dd0d1
commit cbf177852b
7 changed files with 190 additions and 4 deletions

View File

@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (C) 2015-2023 NVIDIA CORPORATION. All rights reserved.
* SPDX-FileCopyrightText: Copyright (C) 2015-2023 NVIDIA CORPORATION. All rights reserved.
*/
#include <linux/bitops.h>
@@ -28,6 +28,7 @@
#include "falcon.h"
#include "util.h"
#include "vic.h"
#include "hwpm.h"
struct vic_config {
const char *firmware;
@@ -38,6 +39,7 @@ struct vic_config {
struct vic {
struct falcon falcon;
struct tegra_drm_hwpm hwpm;
void __iomem *regs;
struct tegra_drm_client client;
@@ -778,6 +780,11 @@ static int vic_probe(struct platform_device *pdev)
goto exit_actmon;
}
vic->hwpm.dev = dev;
vic->hwpm.regs = vic->regs;
tegra_drm_hwpm_register(&vic->hwpm, pdev->resource[0].start,
TEGRA_DRM_HWPM_IP_VIC);
pm_runtime_enable(dev);
pm_runtime_use_autosuspend(dev);
pm_runtime_set_autosuspend_delay(dev, 500);
@@ -800,6 +807,9 @@ static int vic_remove(struct platform_device *pdev)
pm_runtime_disable(&pdev->dev);
tegra_drm_hwpm_unregister(&vic->hwpm, pdev->resource[0].start,
TEGRA_DRM_HWPM_IP_VIC);
vic_devfreq_deinit(vic);
host1x_actmon_unregister(&vic->client.base);