tegra: hwpm: Linux: IOCTL for Credit Programming

- Add IOCTL infra for Credit programming in Linux based
OSs.

Bug 4571175

Signed-off-by: vasukis <vasukis@nvidia.com>
Change-Id: I1a5ff5aefcf8da6ad85507d71c0a9bd3b7f31f6d
Reviewed-on: https://git-master.nvidia.com/r/c/linux-hwpm/+/3136565
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Seema Khowala <seemaj@nvidia.com>
This commit is contained in:
vasukis
2024-05-13 19:00:50 +00:00
committed by mobile promotions
parent b5f2672134
commit 5d80b2edb5
4 changed files with 107 additions and 3 deletions

View File

@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2021-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-FileCopyrightText: Copyright (c) 2021-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
@@ -247,6 +247,21 @@ static int tegra_hwpm_update_get_put_ioctl(struct tegra_soc_hwpm *hwpm,
return tegra_hwpm_update_mem_bytes(hwpm, update_get_put);
}
static int tegra_hwpm_credit_program_ioctl(struct tegra_soc_hwpm *hwpm,
struct tegra_soc_hwpm_exec_credit_program *credit_info)
{
tegra_hwpm_fn(hwpm, " ");
if (!hwpm->bind_completed) {
tegra_hwpm_err(hwpm,
"The Credit Programming can be called only"
" after completion of BIND IOCTL");
return -EPERM;
}
return tegra_hwpm_credit_program(hwpm, credit_info);
}
static long tegra_hwpm_ioctl(struct file *file,
unsigned int cmd,
unsigned long arg)
@@ -337,6 +352,10 @@ static long tegra_hwpm_ioctl(struct file *file,
ret = tegra_hwpm_update_get_put_ioctl(hwpm,
(struct tegra_soc_hwpm_update_get_put *)buf);
break;
case TEGRA_CTRL_CMD_SOC_HWPM_CREDIT_PROGRAM:
ret = tegra_hwpm_credit_program_ioctl(hwpm,
(struct tegra_soc_hwpm_exec_credit_program *)buf);
break;
default:
tegra_hwpm_err(hwpm, "Unknown IOCTL command");
ret = -ENOTTY;