mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-24 10:34:43 +03:00
gpu: nvgpu: Refactor Clk, Volt sub-unit
As a part of refactoring, we need to move the volt unit from perf to pmu as it belongs there and also move the arbitor specific functions under CLK_ARB as they will be removed from safety build. This patch does the following *Move volt struct from perf to pmu *Move volt setup from pmu_pstate to volt *Move clk freq related functions into CLK_ARB NVGPU-4491 NVGPU-4492 Change-Id: I7180cd12bbf91cc4d2e79b6e2d71c16e494c8ff0 Signed-off-by: Abdul Salam <absalam@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/2268215 Reviewed-by: Deepak Nibade <dnibade@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
Alex Waterman
parent
933b62a36e
commit
14b218c284
112
drivers/gpu/nvgpu/common/pmu/volt/volt.c
Normal file
112
drivers/gpu/nvgpu/common/pmu/volt/volt.c
Normal file
@@ -0,0 +1,112 @@
|
||||
/*
|
||||
* Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <nvgpu/pmu/volt.h>
|
||||
#include <nvgpu/gk20a.h>
|
||||
|
||||
#include "volt_rail.h"
|
||||
#include "volt_dev.h"
|
||||
#include "volt_policy.h"
|
||||
#include "volt_pmu.h"
|
||||
|
||||
int nvgpu_pmu_volt_sw_setup(struct gk20a *g)
|
||||
{
|
||||
int err;
|
||||
nvgpu_log_fn(g, " ");
|
||||
|
||||
err = nvgpu_volt_rail_sw_setup(g);
|
||||
if (err != 0) {
|
||||
return err;
|
||||
}
|
||||
|
||||
err = nvgpu_volt_dev_sw_setup(g);
|
||||
if (err != 0) {
|
||||
return err;
|
||||
}
|
||||
|
||||
err = nvgpu_volt_policy_sw_setup(g);
|
||||
if (err != 0) {
|
||||
return err;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int nvgpu_pmu_volt_init(struct gk20a *g)
|
||||
{
|
||||
int err = 0;
|
||||
|
||||
nvgpu_log_fn(g, " ");
|
||||
|
||||
/* If already allocated, do not re-allocate */
|
||||
if (g->pmu->volt != NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
g->pmu->volt = (struct nvgpu_pmu_volt *) nvgpu_kzalloc(g,
|
||||
sizeof(struct nvgpu_pmu_volt));
|
||||
if (g->pmu->volt == NULL) {
|
||||
err = -ENOMEM;
|
||||
return err;
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
void nvgpu_pmu_volt_deinit(struct gk20a *g)
|
||||
{
|
||||
if ((g->pmu != NULL) && (g->pmu->volt != NULL)) {
|
||||
nvgpu_kfree(g, g->pmu->volt);
|
||||
g->pmu->volt = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
int nvgpu_pmu_volt_pmu_setup(struct gk20a *g)
|
||||
{
|
||||
int err;
|
||||
nvgpu_log_fn(g, " ");
|
||||
|
||||
err = nvgpu_volt_rail_pmu_setup(g);
|
||||
if (err != 0) {
|
||||
return err;
|
||||
}
|
||||
|
||||
err = nvgpu_volt_dev_pmu_setup(g);
|
||||
if (err != 0) {
|
||||
return err;
|
||||
}
|
||||
|
||||
err = nvgpu_volt_policy_pmu_setup(g);
|
||||
if (err != 0) {
|
||||
return err;
|
||||
}
|
||||
|
||||
err = nvgpu_volt_send_load_cmd_to_pmu(g);
|
||||
if (err != 0) {
|
||||
nvgpu_err(g,
|
||||
"Failed to send VOLT LOAD CMD to PMU: status = 0x%08x.",
|
||||
err);
|
||||
return err;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user