mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-24 10:34:43 +03:00
gpu: nvgpu: Provide ability to select dgpu freq cap from DT
Add support in nvgpu to parse and get the freq cap from DT. The patch does below Parse the DT and gets the freq cap value during probe. During clk_arb init compare this with P0.Max and takes the lowest. Send change_seq with the new value and set dgpu freq. Use the lowest for "get points","get default","set VF". Bug 200556366 Change-Id: Ie10243f9bf83cb5ae07ebcc4cdc8efaffa56c309 Signed-off-by: Abdul Salam <absalam@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/2204644 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
14cbf46c3e
commit
8d3427633f
@@ -429,6 +429,26 @@ static int nvgpu_pci_pm_deinit(struct device *dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int nvgpu_get_dt_clock_limit(struct gk20a *g, u16 *gpuclk_clkmhz)
|
||||
{
|
||||
struct device_node *np;
|
||||
u32 gpuclk_dt_cap = 0U;
|
||||
|
||||
np = of_find_node_by_name(NULL, "nvgpu");
|
||||
if (!np) {
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
if (of_property_read_u32(np, "dgpuclk-max-mhz", &gpuclk_dt_cap)) {
|
||||
nvgpu_info(g, "dgpuclk-max-mhz not defined,"
|
||||
"P-state will be used");
|
||||
}
|
||||
|
||||
*gpuclk_clkmhz = (u16)gpuclk_dt_cap;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int nvgpu_pci_probe(struct pci_dev *pdev,
|
||||
const struct pci_device_id *pent)
|
||||
{
|
||||
@@ -597,6 +617,11 @@ static int nvgpu_pci_probe(struct pci_dev *pdev,
|
||||
}
|
||||
}
|
||||
|
||||
err = nvgpu_get_dt_clock_limit(g, &g->dgpu_max_clk);
|
||||
if (err != 0) {
|
||||
nvgpu_info(g, "Missing nvgpu node");
|
||||
}
|
||||
|
||||
err = nvgpu_pci_add_pci_power(pdev);
|
||||
if (err) {
|
||||
nvgpu_err(g, "add pci power failed (%d).", err);
|
||||
|
||||
Reference in New Issue
Block a user