tegra: hwpm: add wrapper linux os structure

Currently, HWPM parent structure contains linux specific device
variables. In an effort to make HWPM driver OS agnostic, create Linux
specific wrapper HWPM structure tegra_hwpm_os_linux. Move linux specific
variables from tegra_soc_hwpm structure to tegra_hwpm_os_linux
structure.

Jira THWPM-60

Change-Id: I189cde92c5b83b327ccb467c72dee5756f16481d
Signed-off-by: Vedashree Vidwans <vvidwans@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2729700
Reviewed-by: Seema Khowala <seemaj@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Vedashree Vidwans
2022-06-15 23:41:07 -07:00
committed by mobile promotions
parent 2dd64aec0b
commit 738361e0e2
14 changed files with 292 additions and 212 deletions

View File

@@ -18,39 +18,44 @@
#include <tegra_hwpm_io.h>
#include <tegra_hwpm.h>
#include <os/linux/debugfs.h>
#include <os/linux/driver.h>
void tegra_hwpm_debugfs_init(struct tegra_soc_hwpm *hwpm)
void tegra_hwpm_debugfs_init(struct tegra_hwpm_os_linux *hwpm_linux)
{
if (!hwpm) {
tegra_hwpm_err(hwpm, "Invalid hwpm struct");
struct tegra_soc_hwpm *hwpm = &hwpm_linux->hwpm;
if (!hwpm_linux) {
tegra_hwpm_err(hwpm, "Invalid hwpm_linux struct");
return;
}
hwpm->debugfs_root =
hwpm_linux->debugfs_root =
debugfs_create_dir(TEGRA_SOC_HWPM_MODULE_NAME, NULL);
if (!hwpm->debugfs_root) {
if (!hwpm_linux->debugfs_root) {
tegra_hwpm_err(hwpm, "Failed to create debugfs root directory");
goto fail;
}
/* Debug logs */
debugfs_create_u32("log_mask", S_IRUGO|S_IWUSR, hwpm->debugfs_root,
&hwpm->dbg_mask);
debugfs_create_u32("log_mask", S_IRUGO|S_IWUSR,
hwpm_linux->debugfs_root, &hwpm->dbg_mask);
return;
fail:
debugfs_remove_recursive(hwpm->debugfs_root);
hwpm->debugfs_root = NULL;
debugfs_remove_recursive(hwpm_linux->debugfs_root);
hwpm_linux->debugfs_root = NULL;
}
void tegra_hwpm_debugfs_deinit(struct tegra_soc_hwpm *hwpm)
void tegra_hwpm_debugfs_deinit(struct tegra_hwpm_os_linux *hwpm_linux)
{
if (!hwpm) {
struct tegra_soc_hwpm *hwpm = &hwpm_linux->hwpm;
if (!hwpm_linux) {
tegra_hwpm_err(hwpm, "Invalid hwpm struct");
return;
}
debugfs_remove_recursive(hwpm->debugfs_root);
hwpm->debugfs_root = NULL;
debugfs_remove_recursive(hwpm_linux->debugfs_root);
hwpm_linux->debugfs_root = NULL;
}