diff --git a/drivers/gpu/host1x/dev.c b/drivers/gpu/host1x/dev.c index 9746969c..b3f2c5a8 100644 --- a/drivers/gpu/host1x/dev.c +++ b/drivers/gpu/host1x/dev.c @@ -2,7 +2,7 @@ /* * Tegra host1x driver * - * Copyright (c) 2010-2022, NVIDIA CORPORATION & AFFILIATES. All Rights Reserved. + * Copyright (c) 2010-2023, NVIDIA CORPORATION & AFFILIATES. All Rights Reserved. */ #include @@ -817,15 +817,17 @@ static int host1x_probe(struct platform_device *pdev) if (err) return err; - host->clk = devm_clk_get(&pdev->dev, NULL); - if (IS_ERR(host->clk)) { - err = PTR_ERR(host->clk); + host->clk = devm_clk_get_optional(&pdev->dev, "host1x"); + if (!host->clk) + host->clk = devm_clk_get(&pdev->dev, NULL); + if (IS_ERR(host->clk)) + return dev_err_probe(&pdev->dev, PTR_ERR(host->clk), + "failed to get host1x clock\n"); - if (err != -EPROBE_DEFER) - dev_err(&pdev->dev, "failed to get clock: %d\n", err); - - return err; - } + host->actmon_clk = devm_clk_get_optional(&pdev->dev, "actmon"); + if (IS_ERR(host->actmon_clk)) + return dev_err_probe(&pdev->dev, PTR_ERR(host->actmon_clk), + "failed to get actmon clock\n"); err = host1x_get_resets(host); if (err) @@ -949,6 +951,7 @@ static int __maybe_unused host1x_runtime_suspend(struct device *dev) usleep_range(1000, 2000); clk_disable_unprepare(host->clk); + clk_disable_unprepare(host->actmon_clk); reset_control_bulk_release(host->nresets, host->resets); return 0; @@ -974,14 +977,20 @@ static int __maybe_unused host1x_runtime_resume(struct device *dev) err = clk_prepare_enable(host->clk); if (err) { - dev_err(dev, "failed to enable clock: %d\n", err); + dev_err(dev, "failed to enable host1x clock: %d\n", err); goto release_reset; } + err = clk_prepare_enable(host->actmon_clk); + if (err) { + dev_err(dev, "failed to enable actmon clock: %d\n", err); + goto disable_host1x_clk; + } + err = reset_control_bulk_deassert(host->nresets, host->resets); if (err < 0) { dev_err(dev, "failed to deassert reset: %d\n", err); - goto disable_clk; + goto disable_actmon_clk; } host1x_setup_virtualization_tables(host); @@ -990,7 +999,9 @@ static int __maybe_unused host1x_runtime_resume(struct device *dev) return 0; -disable_clk: +disable_actmon_clk: + clk_disable_unprepare(host->actmon_clk); +disable_host1x_clk: clk_disable_unprepare(host->clk); release_reset: reset_control_bulk_release(host->nresets, host->resets); diff --git a/drivers/gpu/host1x/dev.h b/drivers/gpu/host1x/dev.h index 7a3ebf70..299e5b3a 100644 --- a/drivers/gpu/host1x/dev.h +++ b/drivers/gpu/host1x/dev.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ /* - * Copyright (c) 2012-2015, NVIDIA Corporation. + * Copyright (c) 2012-2023, NVIDIA CORPORATION & AFFILIATES. All Rights Reserved. */ #ifndef HOST1X_DEV_H @@ -136,6 +136,7 @@ struct host1x { struct host1x_syncpt_base *bases; struct device *dev; struct clk *clk; + struct clk *actmon_clk; struct reset_control_bulk_data resets[2]; unsigned int nresets;