From dd5c4b741f129abdb5c64b17e649b324c45ec5c9 Mon Sep 17 00:00:00 2001 From: Akihiro Mizusawa Date: Mon, 17 Mar 2025 22:08:53 +0000 Subject: [PATCH] host: nvcsi: Deprecate nvhost_module_pm_ops Deprecate the usage of nvhost_module_pm_ops as part of the wider nvhost API deprecation while maintaining equivalent functionality. The NVCSI driver does not register prepare_poweroff, poweron_reset, finalize_poweron callbacks nor set the clock gating regs with nvhost, so the runtime operations will only call clk APIs. Bug 4921620 Change-Id: I22a75c9f58ec0980aa97997b674c26a9bb62d47b Signed-off-by: Akihiro Mizusawa Signed-off-by: Mainak Sen Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3321086 GVS: buildbot_gerritrpt Reviewed-by: Frank Chen Reviewed-by: Chinniah Poosapadi Reviewed-by: FNU Raunak Tested-by: FNU Raunak --- drivers/video/tegra/host/nvcsi/nvcsi-t194.c | 31 ++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/drivers/video/tegra/host/nvcsi/nvcsi-t194.c b/drivers/video/tegra/host/nvcsi/nvcsi-t194.c index bf00e238..30cee0e1 100644 --- a/drivers/video/tegra/host/nvcsi/nvcsi-t194.c +++ b/drivers/video/tegra/host/nvcsi/nvcsi-t194.c @@ -309,6 +309,35 @@ static int __exit t194_nvcsi_remove(struct platform_device *dev) return 0; } +static int t194_nvcsi_runtime_suspend(struct device *dev) +{ + struct platform_device *pdev = to_platform_device(dev); + struct nvhost_device_data *info = platform_get_drvdata(pdev); + + clk_bulk_disable_unprepare(info->num_clks, info->clks); + + return 0; +} + +static int t194_nvcsi_runtime_resume(struct device *dev) +{ + struct platform_device *pdev = to_platform_device(dev); + struct nvhost_device_data *pdata = platform_get_drvdata(pdev); + int err; + + err = clk_bulk_prepare_enable(pdata->num_clks, pdata->clks); + if (err) { + dev_warn(dev, "failed to enable clocks: %d\n", err); + return err; + } + + return 0; +} + +const struct dev_pm_ops t194_nvcsi_pm_ops = { + SET_RUNTIME_PM_OPS(t194_nvcsi_runtime_suspend, t194_nvcsi_runtime_resume, NULL) +}; + #if defined(NV_PLATFORM_DRIVER_STRUCT_REMOVE_RETURNS_VOID) /* Linux v6.11 */ static void t194_nvcsi_remove_wrapper(struct platform_device *pdev) { @@ -331,7 +360,7 @@ static struct platform_driver t194_nvcsi_driver = { .of_match_table = tegra194_nvcsi_of_match, #endif #ifdef CONFIG_PM - .pm = &nvhost_module_pm_ops, + .pm = &t194_nvcsi_pm_ops, #endif }, };