summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSudhir Vyas <svyas@nvidia.com>2014-08-18 19:29:58 +0530
committerMatthew Pedro <mapedro@nvidia.com>2015-11-04 20:28:40 -0800
commitdef1339b1678fd043bed01ffbb3efa188f37c1bd (patch)
tree127956b9feded58c55515b5af15385811fad876e
parentff5bccb61c1f8da1f63451fda88bd1f65dbee5b2 (diff)
video: tegra: host: Query vi/isp max clk-rate
Query max vi/isp clk-rate runtime to calcuate max BW. Remove max-bw defines. Bug 1538490 Bug 1695435 Change-Id: I86a5c22fa3c7c9582351bbe9a95776aaea6a613d Signed-off-by: Sudhir Vyas <svyas@nvidia.com> Reviewed-on: http://git-master/r/461278 (cherry picked from commit bbcd86c917430ceea1603e03964296ca4e26ac3a) Reviewed-on: http://git-master/r/825139 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Jihoon Bang <jbang@nvidia.com> Tested-by: Frank Shi <fshi@nvidia.com> Reviewed-by: Matthew Pedro <mapedro@nvidia.com>
-rw-r--r--drivers/video/tegra/host/isp/isp.c21
-rw-r--r--drivers/video/tegra/host/vi/tegra_vi.c21
2 files changed, 28 insertions, 14 deletions
diff --git a/drivers/video/tegra/host/isp/isp.c b/drivers/video/tegra/host/isp/isp.c
index 3323c85ca817..35e2d7d8bbf8 100644
--- a/drivers/video/tegra/host/isp/isp.c
+++ b/drivers/video/tegra/host/isp/isp.c
@@ -3,7 +3,7 @@
*
* Tegra Graphics ISP
*
- * Copyright (c) 2012-2014, NVIDIA Corporation. All rights reserved.
+ * Copyright (c) 2012-2015, NVIDIA Corporation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
@@ -44,11 +44,7 @@
#define T12_ISPA_DEV_ID 0
#define T12_ISPB_DEV_ID 1
-/*
- * MAX_BW = max(default ISP clock) * 2BPP, in KBps.
- * Here default max ISP clock is 420MHz.
- */
-#define ISP_DEFAULT_MAX_BW 840000
+#define ISP_MAX_BPP 2
static struct of_device_id tegra_isp_of_match[] = {
#ifdef TEGRA_12X_OR_HIGHER_CONFIG
@@ -82,17 +78,28 @@ int nvhost_isp_t124_finalize_poweron(struct platform_device *pdev)
static int isp_isomgr_register(struct isp *tegra_isp)
{
int iso_client_id = TEGRA_ISO_CLIENT_ISP_A;
+ struct clk *isp_clk;
+ unsigned long max_bw = 0;
+ struct nvhost_device_data *pdata =
+ platform_get_drvdata(tegra_isp->ndev);
dev_dbg(&tegra_isp->ndev->dev, "%s++\n", __func__);
+ if (WARN_ONCE(pdata == NULL, "pdata not found, %s failed\n", __func__))
+ return -ENODEV;
+
if (tegra_isp->dev_id == T12_ISPB_DEV_ID)
iso_client_id = TEGRA_ISO_CLIENT_ISP_B;
if (tegra_isp->dev_id == T12_ISPA_DEV_ID)
iso_client_id = TEGRA_ISO_CLIENT_ISP_A;
+ /* Get max ISP BW */
+ isp_clk = pdata->clk[0];
+ max_bw = (clk_round_rate(isp_clk, UINT_MAX) / 1000) * ISP_MAX_BPP;
+
/* Register with max possible BW for ISP usecases.*/
tegra_isp->isomgr_handle = tegra_isomgr_register(iso_client_id,
- ISP_DEFAULT_MAX_BW,
+ max_bw,
NULL, /* tegra_isomgr_renegotiate */
NULL); /* *priv */
diff --git a/drivers/video/tegra/host/vi/tegra_vi.c b/drivers/video/tegra/host/vi/tegra_vi.c
index 878864426eca..448a3d100e02 100644
--- a/drivers/video/tegra/host/vi/tegra_vi.c
+++ b/drivers/video/tegra/host/vi/tegra_vi.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2014, NVIDIA CORPORATION. All rights reserved.
+ * Copyright (c) 2013-2015, NVIDIA CORPORATION. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
@@ -48,11 +48,7 @@ static DEFINE_MUTEX(la_lock);
#define T12_CSI_CSICIL_SW_SENSOR_B_RESET 0x980
#define T12_VI_CSI_1_CSI_IMAGE_DT 0x220
-/*
- * MAX_BW = max(VI clock) * 2BPP, in KBps.
- * Here default max VI clock is 420MHz.
- */
-#define VI_DEFAULT_MAX_BW 840000
+#define VI_MAX_BPP 2
#ifdef TEGRA_12X_OR_HIGHER_CONFIG
@@ -104,15 +100,26 @@ fail:
static int vi_isomgr_register(struct vi *tegra_vi)
{
int iso_client_id = TEGRA_ISO_CLIENT_VI_0;
+ struct clk *vi_clk;
+ unsigned long max_bw = 0;
+ struct nvhost_device_data *pdata =
+ platform_get_drvdata(tegra_vi->ndev);
dev_dbg(&tegra_vi->ndev->dev, "%s++\n", __func__);
+ if (WARN_ONCE(pdata == NULL, "pdata not found, %s failed\n", __func__))
+ return -ENODEV;
+
if (tegra_vi->ndev->id)
iso_client_id = TEGRA_ISO_CLIENT_VI_1;
+ /* Get max VI BW */
+ vi_clk = pdata->clk[0];
+ max_bw = (clk_round_rate(vi_clk, UINT_MAX) / 1000) * VI_MAX_BPP;
+
/* Register with max possible BW in VI usecases.*/
tegra_vi->isomgr_handle = tegra_isomgr_register(iso_client_id,
- VI_DEFAULT_MAX_BW,
+ max_bw,
NULL, /* tegra_isomgr_renegotiate */
NULL); /* *priv */