video: tegra: support clock set rate for nvcsi

Dynamic frequency scaling based on the current workload is implemented
in the tegra_camera_platform driver. Registering the clock set rate
callback to allow the tegra_camera_platform driver to set the device
clock rate.

Bug 4374126

Signed-off-by: Johnny Liu <johnliu@nvidia.com>
Change-Id: Iae8fb7952a2ad3b07c1506bfd12b709a252ec2f2
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3020547
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Ankur Pawar <ankurp@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Johnny Liu
2023-11-22 08:56:13 +00:00
committed by mobile promotions
parent d25c39fa00
commit aae5cf4cb7

View File

@@ -1,8 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* NVCSI driver for T194
*
* Copyright (c) 2017-2022, NVIDIA Corporation. All rights reserved.
* SPDX-FileCopyrightText: Copyright (C) 2017-2023 NVIDIA CORPORATION. All rights reserved.
*/
#include "nvcsi-t194.h"
@@ -50,6 +48,7 @@ struct t194_nvcsi {
struct platform_device *pdev;
struct tegra_csi_device csi;
struct dentry *dir;
struct clk *clk;
};
struct nvhost_device_data t19_nvcsi_info = {
@@ -145,6 +144,18 @@ int t194_nvcsi_early_probe(struct platform_device *pdev)
return 0;
}
static int t194_nvcsi_set_rate(struct tegra_camera_dev_info *cdev_info, unsigned long rate)
{
struct nvhost_device_data *info = platform_get_drvdata(cdev_info->pdev);
struct t194_nvcsi *nvcsi = info->private_data;
return clk_set_rate(nvcsi->clk, rate);
}
static struct tegra_camera_dev_ops t194_nvcsi_cdev_ops = {
.set_rate = t194_nvcsi_set_rate,
};
int t194_nvcsi_late_probe(struct platform_device *pdev)
{
struct nvhost_device_data *pdata = platform_get_drvdata(pdev);
@@ -159,6 +170,8 @@ int t194_nvcsi_late_probe(struct platform_device *pdev)
csi_info.bus_width = CSI_BUS_WIDTH;
csi_info.lane_num = NUM_LANES;
csi_info.pg_clk_rate = PG_CLK_RATE;
csi_info.ops = &t194_nvcsi_cdev_ops;
err = tegra_camera_device_register(&csi_info, nvcsi);
if (err)
return err;
@@ -172,9 +185,10 @@ int t194_nvcsi_late_probe(struct platform_device *pdev)
static int t194_nvcsi_probe(struct platform_device *pdev)
{
int err;
struct device *dev = &pdev->dev;
struct nvhost_device_data *pdata;
struct t194_nvcsi *nvcsi;
int err;
err = t194_nvcsi_early_probe(pdev);
if (err)
@@ -184,6 +198,12 @@ static int t194_nvcsi_probe(struct platform_device *pdev)
nvcsi = pdata->private_data;
nvcsi->clk = devm_clk_get(dev, NULL);
if (IS_ERR(nvcsi->clk)) {
dev_err(&pdev->dev, "failed to get clock\n");
return PTR_ERR(nvcsi->clk);
}
err = nvhost_client_device_get_resources(pdev);
if (err)
return err;