From c2dd36f33c3da1ed60c81aa79a32e86f7454ce28 Mon Sep 17 00:00:00 2001 From: Akihiro Mizusawa Date: Mon, 17 Mar 2025 22:07:24 +0000 Subject: [PATCH] host: capture-support: 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 capture-support 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: I438621258378bb6e81fc7a82e3334dcbfa180dc9 Signed-off-by: Akihiro Mizusawa Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3321085 Reviewed-by: Chinniah Poosapadi Reviewed-by: Frank Chen Tested-by: FNU Raunak GVS: buildbot_gerritrpt Reviewed-by: FNU Raunak --- .../tegra/host/capture/capture-support.c | 33 ++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/drivers/video/tegra/host/capture/capture-support.c b/drivers/video/tegra/host/capture/capture-support.c index ad341f2b..29f98139 100644 --- a/drivers/video/tegra/host/capture/capture-support.c +++ b/drivers/video/tegra/host/capture/capture-support.c @@ -23,6 +23,8 @@ #include #include #include +#include +#include #ifdef CONFIG_TEGRA_HWPM_CAM #include @@ -256,6 +258,35 @@ static const struct of_device_id capture_support_match[] = { }; MODULE_DEVICE_TABLE(of, capture_support_match); +static int capture_support_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 capture_support_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 capture_support_pm_ops = { + SET_RUNTIME_PM_OPS(capture_support_runtime_suspend, capture_support_runtime_resume, NULL) +}; + #if defined(NV_PLATFORM_DRIVER_STRUCT_REMOVE_RETURNS_VOID) /* Linux v6.11 */ static void capture_support_remove_wrapper(struct platform_device *pdev) { @@ -275,7 +306,7 @@ static struct platform_driver capture_support_driver = { /* Only suitable name for dummy falcon driver */ .name = "scare-pigeon", .of_match_table = capture_support_match, - .pm = &nvhost_module_pm_ops, + .pm = &capture_support_pm_ops, }, };