summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/media/platform/soc_camera/tegra_camera/common.c5
-rw-r--r--drivers/media/platform/soc_camera/tegra_camera/common.h9
-rw-r--r--drivers/media/platform/soc_camera/tegra_camera/vi.c53
-rw-r--r--drivers/media/platform/soc_camera/tegra_camera/vi2.c33
-rw-r--r--drivers/video/tegra/dc/dc.c20
-rw-r--r--drivers/video/tegra/dc/dsi.c2
-rw-r--r--drivers/video/tegra/host/bus_client.c21
-rw-r--r--drivers/video/tegra/host/gk20a/channel_gk20a.c31
-rw-r--r--drivers/video/tegra/host/gk20a/channel_gk20a.h2
-rw-r--r--drivers/video/tegra/host/gk20a/debug_gk20a.c21
-rw-r--r--drivers/video/tegra/host/gk20a/hw_pbdma_gk20a.h34
-rw-r--r--drivers/video/tegra/host/gk20a/platform_gk20a_tegra.c2
-rw-r--r--drivers/video/tegra/host/gr3d/gr3d.c11
-rw-r--r--drivers/video/tegra/host/gr3d/gr3d_t114.c3
-rw-r--r--drivers/video/tegra/host/host1x/host1x.h4
-rw-r--r--drivers/video/tegra/host/host1x/host1x_channel.c2
-rw-r--r--drivers/video/tegra/host/host1x/host1x_syncpt.c9
-rw-r--r--drivers/video/tegra/host/nvhost_syncpt.c239
-rw-r--r--drivers/video/tegra/host/nvhost_syncpt.h11
-rw-r--r--drivers/video/tegra/host/t114/t114.c29
-rw-r--r--drivers/video/tegra/host/t124/syncpt_t124.h32
-rw-r--r--drivers/video/tegra/host/t124/t124.c70
-rw-r--r--drivers/video/tegra/host/t148/t148.c31
-rw-r--r--drivers/video/tegra/host/vic03/vic03.c11
-rw-r--r--include/linux/nvhost.h68
25 files changed, 323 insertions, 430 deletions
diff --git a/drivers/media/platform/soc_camera/tegra_camera/common.c b/drivers/media/platform/soc_camera/tegra_camera/common.c
index aa5b915bb2d6..d257115258b9 100644
--- a/drivers/media/platform/soc_camera/tegra_camera/common.c
+++ b/drivers/media/platform/soc_camera/tegra_camera/common.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2014, NVIDIA CORPORATION. All rights reserved.
+ * Copyright (c) 2013, 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,
@@ -874,9 +874,6 @@ static int tegra_camera_probe(struct platform_device *pdev)
goto exit_deinit_clk;
}
- /* Init syncpts */
- cam->ops->init_syncpts(cam);
-
cam->reg_base = ndata->aperture[0];
if (!cam->reg_base) {
dev_err(&pdev->dev, "%s: failed to map register base\n",
diff --git a/drivers/media/platform/soc_camera/tegra_camera/common.h b/drivers/media/platform/soc_camera/tegra_camera/common.h
index 76de2a070cc6..94a3f46bbf92 100644
--- a/drivers/media/platform/soc_camera/tegra_camera/common.h
+++ b/drivers/media/platform/soc_camera/tegra_camera/common.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2014, NVIDIA CORPORATION. All rights reserved.
+ * Copyright (c) 2012-2013, 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,
@@ -67,7 +67,6 @@ struct tegra_camera_ops {
struct tegra_camera_buffer *buf);
int (*capture_stop)(struct tegra_camera_dev *vi2_cam, int port);
- void (*init_syncpts)(struct tegra_camera_dev *vi2_cam);
void (*incr_syncpts)(struct tegra_camera_dev *vi2_cam);
void (*save_syncpts)(struct tegra_camera_dev *vi2_cam);
@@ -101,12 +100,6 @@ struct tegra_camera_dev {
struct work_struct work;
struct mutex work_mutex;
- /* syncpt ids */
- u32 syncpt_id_csi_a;
- u32 syncpt_id_csi_b;
- u32 syncpt_id_vip;
-
- /* syncpt values */
u32 syncpt_csi_a;
u32 syncpt_csi_b;
u32 syncpt_vip;
diff --git a/drivers/media/platform/soc_camera/tegra_camera/vi.c b/drivers/media/platform/soc_camera/tegra_camera/vi.c
index 201abd2f7406..9792d1869538 100644
--- a/drivers/media/platform/soc_camera/tegra_camera/vi.c
+++ b/drivers/media/platform/soc_camera/tegra_camera/vi.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2014, NVIDIA CORPORATION. All rights reserved.
+ * Copyright (c) 2013, 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,
@@ -33,6 +33,11 @@
#define TEGRA_VIP_H_ACTIVE_START 0x98
#define TEGRA_VIP_V_ACTIVE_START 0x10
+/* SYNCPTs 12-17 are reserved for VI. */
+#define TEGRA_VI_SYNCPT_VI NVSYNCPT_VI_ISP_2
+#define TEGRA_VI_SYNCPT_CSI_A NVSYNCPT_VI_ISP_3
+#define TEGRA_VI_SYNCPT_CSI_B NVSYNCPT_VI_ISP_4
+
/* Tegra CSI-MIPI registers. */
#define TEGRA_VI_OUT_1_INCR_SYNCPT 0x000
#define TEGRA_VI_OUT_1_INCR_SYNCPT_CNTRL 0x004
@@ -403,34 +408,31 @@ static void vi_clks_disable(struct tegra_camera_dev *cam)
}
}
-static void vi_init_syncpts(struct tegra_camera_dev *cam)
-{
- cam->syncpt_id_csi_a = nvhost_get_syncpt_client_managed("vi_csi_A");
-
- cam->syncpt_id_csi_b = nvhost_get_syncpt_client_managed("vi_csi_B");
-
- cam->syncpt_id_vip = nvhost_get_syncpt_client_managed("vi_vip");
-}
-
static void vi_save_syncpts(struct tegra_camera_dev *cam)
{
cam->syncpt_csi_a =
- nvhost_syncpt_read_ext(cam->ndev, cam->syncpt_id_csi_a);
+ nvhost_syncpt_read_ext(cam->ndev,
+ TEGRA_VI_SYNCPT_CSI_A);
cam->syncpt_csi_b =
- nvhost_syncpt_read_ext(cam->ndev, cam->syncpt_id_csi_b);
+ nvhost_syncpt_read_ext(cam->ndev,
+ TEGRA_VI_SYNCPT_CSI_B);
cam->syncpt_vip =
- nvhost_syncpt_read_ext(cam->ndev, cam->syncpt_id_vip);
+ nvhost_syncpt_read_ext(cam->ndev,
+ TEGRA_VI_SYNCPT_VI);
}
static void vi_incr_syncpts(struct tegra_camera_dev *cam)
{
- nvhost_syncpt_cpu_incr_ext(cam->ndev, cam->syncpt_id_csi_a);
+ nvhost_syncpt_cpu_incr_ext(cam->ndev,
+ TEGRA_VI_SYNCPT_CSI_A);
- nvhost_syncpt_cpu_incr_ext(cam->ndev, cam->syncpt_id_csi_b);
+ nvhost_syncpt_cpu_incr_ext(cam->ndev,
+ TEGRA_VI_SYNCPT_CSI_B);
- nvhost_syncpt_cpu_incr_ext(cam->ndev, cam->syncpt_id_vip);
+ nvhost_syncpt_cpu_incr_ext(cam->ndev,
+ TEGRA_VI_SYNCPT_VI);
}
static void vi_capture_clean(struct tegra_camera_dev *cam)
@@ -515,7 +517,7 @@ static void vi_capture_setup_csi_a(struct tegra_camera_dev *cam,
TC_VI_REG_WT(cam, TEGRA_VI_CONT_SYNCPT_CSI_PPA_FRAME_END,
(0x1 << 8) | /* Enable continuous syncpt */
- cam->syncpt_id_csi_a);
+ TEGRA_VI_SYNCPT_CSI_A);
TC_VI_REG_WT(cam, TEGRA_CSI_PHY_CIL_COMMAND, 0x00020001);
@@ -598,7 +600,7 @@ static void vi_capture_setup_csi_b(struct tegra_camera_dev *cam,
TC_VI_REG_WT(cam, TEGRA_VI_CONT_SYNCPT_CSI_PPB_FRAME_END,
(0x1 << 8) | /* Enable continuous syncpt */
- cam->syncpt_id_csi_b);
+ TEGRA_VI_SYNCPT_CSI_B);
TC_VI_REG_WT(cam, TEGRA_CSI_PHY_CIL_COMMAND, 0x00010002);
@@ -638,7 +640,7 @@ static void vi_capture_setup_vip(struct tegra_camera_dev *cam,
TC_VI_REG_WT(cam, TEGRA_VI_CONT_SYNCPT_VIP_VSYNC,
(0x1 << 8) | /* Enable continuous syncpt */
- cam->syncpt_id_vip);
+ TEGRA_VI_SYNCPT_VI);
TC_VI_REG_WT(cam, TEGRA_VI_CAMERA_CONTROL, 0x00000004);
}
@@ -722,7 +724,7 @@ static int vi_capture_output_channel_setup(
TC_VI_REG_WT(cam, TEGRA_VI_CONT_SYNCPT_OUT_1,
(0x1 << 8) | /* Enable continuous syncpt */
- cam->syncpt_id_vip);
+ TEGRA_VI_SYNCPT_VI);
TC_VI_REG_WT(cam, TEGRA_VI_VI_ENABLE, 0x00000000);
} else if (buf->output_channel == 1) {
@@ -746,7 +748,7 @@ static int vi_capture_output_channel_setup(
TC_VI_REG_WT(cam, TEGRA_VI_CONT_SYNCPT_OUT_2,
(0x1 << 8) | /* Enable continuous syncpt */
- cam->syncpt_id_vip);
+ TEGRA_VI_SYNCPT_VI);
TC_VI_REG_WT(cam, TEGRA_VI_VI_ENABLE_2, 0x00000000);
} else {
@@ -900,7 +902,7 @@ static int vi_capture_start(struct tegra_camera_dev *cam,
TC_VI_REG_WT(cam, TEGRA_CSI_PIXEL_STREAM_PPA_COMMAND,
0x0000f005);
err = nvhost_syncpt_wait_timeout_ext(cam->ndev,
- cam->syncpt_id_csi_a,
+ TEGRA_VI_SYNCPT_CSI_A,
cam->syncpt_csi_a,
TEGRA_SYNCPT_CSI_WAIT_TIMEOUT,
NULL,
@@ -910,7 +912,7 @@ static int vi_capture_start(struct tegra_camera_dev *cam,
TC_VI_REG_WT(cam, TEGRA_CSI_PIXEL_STREAM_PPB_COMMAND,
0x0000f005);
err = nvhost_syncpt_wait_timeout_ext(cam->ndev,
- cam->syncpt_id_csi_b,
+ TEGRA_VI_SYNCPT_CSI_B,
cam->syncpt_csi_b,
TEGRA_SYNCPT_CSI_WAIT_TIMEOUT,
NULL,
@@ -920,7 +922,7 @@ static int vi_capture_start(struct tegra_camera_dev *cam,
TC_VI_REG_WT(cam, TEGRA_VI_CAMERA_CONTROL,
0x00000001);
err = nvhost_syncpt_wait_timeout_ext(cam->ndev,
- cam->syncpt_id_vip,
+ TEGRA_VI_SYNCPT_VI,
cam->syncpt_csi_a,
TEGRA_SYNCPT_VI_WAIT_TIMEOUT,
NULL,
@@ -976,7 +978,7 @@ static int vi_capture_stop(struct tegra_camera_dev *cam, int port)
if (vi_port_is_csi(port))
err = nvhost_syncpt_wait_timeout_ext(cam->ndev,
- cam->syncpt_id_vip,
+ TEGRA_VI_SYNCPT_VI,
cam->syncpt_vip,
TEGRA_SYNCPT_VI_WAIT_TIMEOUT,
NULL,
@@ -1051,7 +1053,6 @@ struct tegra_camera_ops vi_ops = {
.activate = vi_unpowergate,
.deactivate = vi_powergate,
- .init_syncpts = vi_init_syncpts,
.save_syncpts = vi_save_syncpts,
.incr_syncpts = vi_incr_syncpts,
diff --git a/drivers/media/platform/soc_camera/tegra_camera/vi2.c b/drivers/media/platform/soc_camera/tegra_camera/vi2.c
index bf69682c85c8..f58c03bff8a5 100644
--- a/drivers/media/platform/soc_camera/tegra_camera/vi2.c
+++ b/drivers/media/platform/soc_camera/tegra_camera/vi2.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2014, NVIDIA CORPORATION. All rights reserved.
+ * Copyright (c) 2013, 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,
@@ -29,6 +29,9 @@
#define TEGRA_SYNCPT_CSI_WAIT_TIMEOUT 200
+#define TEGRA_VI_SYNCPT_CSI_A NVSYNCPT_VI_0_3
+#define TEGRA_VI_SYNCPT_CSI_B NVSYNCPT_VI_1_3
+
#define TEGRA_VI_CFG_VI_INCR_SYNCPT 0x000
#define TEGRA_VI_CFG_VI_INCR_SYNCPT_CNTRL 0x004
#define TEGRA_VI_CFG_VI_INCR_SYNCPT_ERROR 0x008
@@ -435,27 +438,24 @@ static void vi2_clks_disable(struct tegra_camera_dev *cam)
}
}
-static void vi2_init_syncpts(struct tegra_camera_dev *cam)
-{
- cam->syncpt_id_csi_a = nvhost_get_syncpt_client_managed("vi_csi_A");
-
- cam->syncpt_id_csi_b = nvhost_get_syncpt_client_managed("vi_csi_B");
-}
-
static void vi2_save_syncpts(struct tegra_camera_dev *cam)
{
cam->syncpt_csi_a =
- nvhost_syncpt_read_ext(cam->ndev, cam->syncpt_id_csi_a);
+ nvhost_syncpt_read_ext(cam->ndev,
+ TEGRA_VI_SYNCPT_CSI_A);
cam->syncpt_csi_b =
- nvhost_syncpt_read_ext(cam->ndev, cam->syncpt_id_csi_b);
+ nvhost_syncpt_read_ext(cam->ndev,
+ TEGRA_VI_SYNCPT_CSI_B);
}
static void vi2_incr_syncpts(struct tegra_camera_dev *cam)
{
- nvhost_syncpt_cpu_incr_ext(cam->ndev, cam->syncpt_id_csi_a);
+ nvhost_syncpt_cpu_incr_ext(cam->ndev,
+ TEGRA_VI_SYNCPT_CSI_A);
- nvhost_syncpt_cpu_incr_ext(cam->ndev, cam->syncpt_id_csi_b);
+ nvhost_syncpt_cpu_incr_ext(cam->ndev,
+ TEGRA_VI_SYNCPT_CSI_B);
}
static void vi2_capture_clean(struct tegra_camera_dev *cam)
@@ -493,7 +493,7 @@ static int vi2_capture_setup_csi_0(struct tegra_camera_dev *cam,
/* VI_MWA_REQ_DONE */
TC_VI_REG_WT(cam, TEGRA_VI_CFG_VI_INCR_SYNCPT,
- (0x4 << 8) | cam->syncpt_id_csi_a);
+ (0x4 << 8) | TEGRA_VI_SYNCPT_CSI_A);
if (cam->tpg_mode) {
TC_VI_REG_WT(cam, TEGRA_CSI_PATTERN_GENERATOR_CTRL_A,
@@ -546,7 +546,7 @@ static int vi2_capture_setup_csi_1(struct tegra_camera_dev *cam,
/* VI_MWB_REQ_DONE */
TC_VI_REG_WT(cam, TEGRA_VI_CFG_VI_INCR_SYNCPT,
- (0x5 << 8) | cam->syncpt_id_csi_b);
+ (0x5 << 8) | TEGRA_VI_SYNCPT_CSI_B);
if (cam->tpg_mode) {
TC_VI_REG_WT(cam, TEGRA_CSI_PATTERN_GENERATOR_CTRL_B,
@@ -717,7 +717,7 @@ static int vi2_capture_start(struct tegra_camera_dev *cam,
0x0000f005);
TC_VI_REG_WT(cam, TEGRA_VI_CSI_0_SINGLE_SHOT, 0x1);
err = nvhost_syncpt_wait_timeout_ext(cam->ndev,
- cam->syncpt_id_csi_a,
+ TEGRA_VI_SYNCPT_CSI_A,
cam->syncpt_csi_a,
TEGRA_SYNCPT_CSI_WAIT_TIMEOUT,
NULL,
@@ -728,7 +728,7 @@ static int vi2_capture_start(struct tegra_camera_dev *cam,
0x0000f005);
TC_VI_REG_WT(cam, TEGRA_VI_CSI_1_SINGLE_SHOT, 0x1);
err = nvhost_syncpt_wait_timeout_ext(cam->ndev,
- cam->syncpt_id_csi_b,
+ TEGRA_VI_SYNCPT_CSI_B,
cam->syncpt_csi_b,
TEGRA_SYNCPT_CSI_WAIT_TIMEOUT,
NULL,
@@ -804,7 +804,6 @@ struct tegra_camera_ops vi2_ops = {
.activate = vi2_sw_reset,
- .init_syncpts = vi2_init_syncpts,
.save_syncpts = vi2_save_syncpts,
.incr_syncpts = vi2_incr_syncpts,
diff --git a/drivers/video/tegra/dc/dc.c b/drivers/video/tegra/dc/dc.c
index 8e696fdeb33c..01a4fe682ba6 100644
--- a/drivers/video/tegra/dc/dc.c
+++ b/drivers/video/tegra/dc/dc.c
@@ -2780,16 +2780,16 @@ static int tegra_dc_probe(struct platform_device *ndev)
if (TEGRA_DISPLAY_BASE == res->start) {
dc->vblank_syncpt = NVSYNCPT_VBLANK0;
- dc->win_syncpt[0] = nvhost_get_syncpt_client_managed("disp0_a");
- dc->win_syncpt[1] = nvhost_get_syncpt_client_managed("disp0_b");
- dc->win_syncpt[2] = nvhost_get_syncpt_client_managed("disp0_c");
+ dc->win_syncpt[0] = NVSYNCPT_DISP0_A;
+ dc->win_syncpt[1] = NVSYNCPT_DISP0_B;
+ dc->win_syncpt[2] = NVSYNCPT_DISP0_C;
dc->valid_windows = 0x07;
#ifdef CONFIG_ARCH_TEGRA_14x_SOC
- dc->win_syncpt[3] = nvhost_get_syncpt_client_managed("disp0_d");
- dc->win_syncpt[4] = nvhost_get_syncpt_client_managed("disp0_h");
+ dc->win_syncpt[3] = NVSYNCPT_DISP0_D;
+ dc->win_syncpt[4] = NVSYNCPT_DISP0_H;
dc->valid_windows |= 0x18;
#elif defined(CONFIG_ARCH_TEGRA_12x_SOC)
- dc->win_syncpt[3] = nvhost_get_syncpt_client_managed("disp0_d");
+ dc->win_syncpt[3] = NVSYNCPT_DISP0_D;
dc->valid_windows |= 0x08;
#endif
dc->powergate_id = TEGRA_POWERGATE_DISA;
@@ -2798,12 +2798,12 @@ static int tegra_dc_probe(struct platform_device *ndev)
#endif
} else if (TEGRA_DISPLAY2_BASE == res->start) {
dc->vblank_syncpt = NVSYNCPT_VBLANK1;
- dc->win_syncpt[0] = nvhost_get_syncpt_client_managed("disp1_a");
- dc->win_syncpt[1] = nvhost_get_syncpt_client_managed("disp1_b");
- dc->win_syncpt[2] = nvhost_get_syncpt_client_managed("disp1_c");
+ dc->win_syncpt[0] = NVSYNCPT_DISP1_A;
+ dc->win_syncpt[1] = NVSYNCPT_DISP1_B;
+ dc->win_syncpt[2] = NVSYNCPT_DISP1_C;
dc->valid_windows = 0x07;
#ifdef CONFIG_ARCH_TEGRA_14x_SOC
- dc->win_syncpt[4] = nvhost_get_syncpt_client_managed("disp1_h");
+ dc->win_syncpt[4] = NVSYNCPT_DISP1_H;
dc->valid_windows |= 0x10;
#endif
dc->powergate_id = TEGRA_POWERGATE_DISB;
diff --git a/drivers/video/tegra/dc/dsi.c b/drivers/video/tegra/dc/dsi.c
index 3e100cbe4ee7..32aa8387db92 100644
--- a/drivers/video/tegra/dc/dsi.c
+++ b/drivers/video/tegra/dc/dsi.c
@@ -728,7 +728,7 @@ static void tegra_dsi_init_sw(struct tegra_dc *dc,
dsi->target_hs_clk_khz);
#if DSI_USE_SYNC_POINTS
- dsi->syncpt_id = nvhost_get_syncpt_client_managed("dsi");
+ dsi->syncpt_id = NVSYNCPT_DSI;
#endif
/*
diff --git a/drivers/video/tegra/host/bus_client.c b/drivers/video/tegra/host/bus_client.c
index 9e3a7bb8aa69..c1b642ad15a3 100644
--- a/drivers/video/tegra/host/bus_client.c
+++ b/drivers/video/tegra/host/bus_client.c
@@ -737,11 +737,8 @@ static u32 create_mask(u32 *words, int num)
{
int i;
u32 word = 0;
- for (i = 0; i < num; i++) {
- if (!words[i] || words[i] > 31)
- continue;
+ for (i = 0; i < num && words[i] && words[i] < 32; i++)
word |= BIT(words[i]);
- }
return word;
}
@@ -818,20 +815,10 @@ static long nvhost_channelctl(struct file *filp,
platform_get_drvdata(priv->ch->dev);
struct nvhost_get_param_arg *arg =
(struct nvhost_get_param_arg *)buf;
- if (arg->param >= NVHOST_MODULE_MAX_SYNCPTS)
+ if (arg->param >= NVHOST_MODULE_MAX_SYNCPTS
+ || !pdata->syncpts[arg->param])
return -EINVAL;
- /* if we already have required syncpt then return it ... */
- if (pdata->syncpts[arg->param]) {
- arg->value = pdata->syncpts[arg->param];
- break;
- }
- /* ... otherwise get a new syncpt dynamically */
- arg->value = nvhost_get_syncpt_host_managed(pdata->pdev,
- arg->param);
- if (!arg->value)
- return -EAGAIN;
- /* ... and store it for further references */
- pdata->syncpts[arg->param] = arg->value;
+ arg->value = pdata->syncpts[arg->param];
break;
}
case NVHOST_IOCTL_CHANNEL_GET_WAITBASES:
diff --git a/drivers/video/tegra/host/gk20a/channel_gk20a.c b/drivers/video/tegra/host/gk20a/channel_gk20a.c
index 8d4fc640192d..4f3861bf369b 100644
--- a/drivers/video/tegra/host/gk20a/channel_gk20a.c
+++ b/drivers/video/tegra/host/gk20a/channel_gk20a.c
@@ -31,7 +31,6 @@
#include "debug.h"
#include "nvhost_memmgr.h"
#include "nvhost_sync.h"
-#include "nvhost_syncpt.h"
#include "gk20a.h"
#include "dbg_gpu_gk20a.h"
@@ -419,11 +418,12 @@ static int channel_gk20a_update_runlist(struct channel_gk20a *c, bool add)
void gk20a_disable_channel_no_update(struct channel_gk20a *ch)
{
+ struct nvhost_device_data *pdata = nvhost_get_devdata(ch->g->dev);
struct nvhost_master *host = host_from_gk20a_channel(ch);
/* ensure no fences are pending */
nvhost_syncpt_set_min_eq_max(&host->syncpt,
- ch->syncpt_id);
+ ch->hw_chid + pdata->syncpt_base);
/* disable channel */
gk20a_writel(ch->g, ccsr_channel_r(ch->hw_chid),
@@ -694,10 +694,6 @@ unbind:
mutex_unlock(&ch->dbg_s_lock);
- /* free the syncpt used for this channel */
- nvhost_free_syncpt(ch->syncpt_id);
- ch->syncpt_id = 0;
-
/* ALWAYS last */
release_used_channel(f, ch);
}
@@ -725,7 +721,6 @@ static struct channel_gk20a *gk20a_open_new_channel(struct gk20a *g)
{
struct fifo_gk20a *f = &g->fifo;
struct channel_gk20a *ch;
- struct nvhost_device_data *pdata = nvhost_get_devdata(g->dev);
ch = acquire_unused_channel(f);
if (ch == NULL) {
@@ -734,14 +729,6 @@ static struct channel_gk20a *gk20a_open_new_channel(struct gk20a *g)
return 0;
}
- /* get a free syncpt id */
- ch->syncpt_id = nvhost_get_syncpt_host_managed(pdata->pdev,
- ch->hw_chid);
- if (!ch->syncpt_id) {
- nvhost_err(dev_from_gk20a(g), "could not get free syncpt");
- return 0;
- }
-
ch->g = g;
#ifdef CONFIG_TEGRA_GK20A
ch->ch = gk20a_get_platform(g->dev)->nvhost.channel;
@@ -1165,6 +1152,7 @@ static int gk20a_alloc_channel_gpfifo(struct channel_gk20a *c,
struct nvhost_alloc_gpfifo_args *args)
{
struct gk20a *g = c->g;
+ struct nvhost_device_data *pdata = nvhost_get_devdata(g->dev);
struct device *d = dev_from_gk20a(g);
struct vm_gk20a *ch_vm;
u32 gpfifo_size;
@@ -1193,7 +1181,7 @@ static int gk20a_alloc_channel_gpfifo(struct channel_gk20a *c,
c->last_submit_fence.valid = false;
c->last_submit_fence.syncpt_value = 0;
- c->last_submit_fence.syncpt_id = c->syncpt_id;
+ c->last_submit_fence.syncpt_id = c->hw_chid + pdata->syncpt_base;
c->ramfc.offset = 0;
c->ramfc.size = ram_in_ramfc_s() / 8;
@@ -1544,6 +1532,7 @@ static int gk20a_submit_channel_gpfifo(struct channel_gk20a *c,
u32 flags)
{
struct gk20a *g = c->g;
+ struct nvhost_device_data *pdata = nvhost_get_devdata(g->dev);
struct device *d = dev_from_gk20a(g);
struct nvhost_syncpt *sp = syncpt_from_gk20a(g);
u32 i, incr_id = ~0, wait_id = ~0, wait_value = 0;
@@ -1581,7 +1570,7 @@ static int gk20a_submit_channel_gpfifo(struct channel_gk20a *c,
num_entries,
flags,
fence->syncpt_id, fence->value,
- c->syncpt_id);
+ c->hw_chid + pdata->syncpt_base);
check_gp_put(g, c);
update_gp_get(g, c);
@@ -1725,7 +1714,7 @@ static int gk20a_submit_channel_gpfifo(struct channel_gk20a *c,
if (incr_cmd) {
int j = 0;
- incr_id = c->syncpt_id;
+ incr_id = c->hw_chid + pdata->syncpt_base;
fence->syncpt_id = incr_id;
fence->value = nvhost_syncpt_incr_max(sp, incr_id, 1);
@@ -1848,6 +1837,7 @@ int gk20a_init_channel_support(struct gk20a *g, u32 chid)
int gk20a_channel_finish(struct channel_gk20a *ch, unsigned long timeout)
{
struct nvhost_syncpt *sp = syncpt_from_gk20a(ch->g);
+ struct nvhost_device_data *pdata = nvhost_get_devdata(ch->g->dev);
struct nvhost_fence fence;
int err = 0;
@@ -1860,7 +1850,7 @@ int gk20a_channel_finish(struct channel_gk20a *ch, unsigned long timeout)
if (!(ch->last_submit_fence.valid && ch->last_submit_fence.wfi)) {
nvhost_dbg_fn("issuing wfi, incr to finish the channel");
- fence.syncpt_id = ch->syncpt_id;
+ fence.syncpt_id = ch->hw_chid + pdata->syncpt_base;
err = gk20a_channel_submit_wfi_fence(ch->g, ch,
sp, &fence);
}
@@ -2072,6 +2062,7 @@ int gk20a_channel_suspend(struct gk20a *g)
struct nvhost_fence fence;
struct nvhost_syncpt *sp = syncpt_from_gk20a(g);
struct device *d = dev_from_gk20a(g);
+ struct nvhost_device_data *pdata = nvhost_get_devdata(g->dev);
int err;
nvhost_dbg_fn("");
@@ -2080,7 +2071,7 @@ int gk20a_channel_suspend(struct gk20a *g)
for (chid = 0; chid < f->num_channels; chid++) {
struct channel_gk20a *c = &f->channel[chid];
if (c->in_use && c->obj_class != KEPLER_C) {
- fence.syncpt_id = c->syncpt_id;
+ fence.syncpt_id = chid + pdata->syncpt_base;
err = gk20a_channel_submit_wfi_fence(g,
c, sp, &fence);
if (err) {
diff --git a/drivers/video/tegra/host/gk20a/channel_gk20a.h b/drivers/video/tegra/host/gk20a/channel_gk20a.h
index 88ea86fdb991..253f5bb02cff 100644
--- a/drivers/video/tegra/host/gk20a/channel_gk20a.h
+++ b/drivers/video/tegra/host/gk20a/channel_gk20a.h
@@ -85,8 +85,6 @@ struct channel_gk20a {
bool vpr;
pid_t pid;
- u32 syncpt_id;
-
struct mem_mgr *memmgr;
struct nvhost_channel *ch;
diff --git a/drivers/video/tegra/host/gk20a/debug_gk20a.c b/drivers/video/tegra/host/gk20a/debug_gk20a.c
index a6d7a5493ad5..d288a8afe586 100644
--- a/drivers/video/tegra/host/gk20a/debug_gk20a.c
+++ b/drivers/video/tegra/host/gk20a/debug_gk20a.c
@@ -1,7 +1,7 @@
/*
* drivers/video/tegra/host/t20/debug_gk20a.c
*
- * Copyright (C) 2011-2014 NVIDIA Corporation. All rights reserved.
+ * Copyright (C) 2011-2013 NVIDIA Corporation. All rights reserved.
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
@@ -24,7 +24,6 @@
#include "nvhost_memmgr.h"
#include "nvhost_cdma.h"
#include "nvhost_acm.h"
-#include "nvhost_syncpt.h"
#include "gk20a.h"
#include "hw_ram_gk20a.h"
@@ -74,17 +73,12 @@ static void gk20a_debug_show_channel(struct output *o,
{
u32 channel = gk20a_readl(g, ccsr_channel_r(ch->hw_chid));
u32 status = ccsr_channel_status_v(channel);
- u32 syncpointa, syncpointb;
void *inst_ptr;
- struct nvhost_master *host = host_from_gk20a_channel(ch);
inst_ptr = ch->inst_block.cpuva;
if (!inst_ptr)
return;
- syncpointa = mem_rd32(inst_ptr, ram_fc_syncpointa_w());
- syncpointb = mem_rd32(inst_ptr, ram_fc_syncpointb_w());
-
nvhost_debug_output(o, "%d-%s, pid %d: ", ch->hw_chid,
ch->ch->dev->name,
ch->pid);
@@ -106,22 +100,13 @@ static void gk20a_debug_show_channel(struct output *o,
((u64)mem_rd32(inst_ptr, ram_fc_pb_fetch_hi_w()) << 32ULL),
mem_rd32(inst_ptr, ram_fc_pb_header_w()),
mem_rd32(inst_ptr, ram_fc_pb_count_w()),
- syncpointa,
- syncpointb,
+ mem_rd32(inst_ptr, ram_fc_syncpointa_w()),
+ mem_rd32(inst_ptr, ram_fc_syncpointb_w()),
mem_rd32(inst_ptr, ram_fc_semaphorea_w()),
mem_rd32(inst_ptr, ram_fc_semaphoreb_w()),
mem_rd32(inst_ptr, ram_fc_semaphorec_w()),
mem_rd32(inst_ptr, ram_fc_semaphored_w()));
- if ((pbdma_syncpointb_op_v(syncpointb) == pbdma_syncpointb_op_wait_v())
- && (pbdma_syncpointb_wait_switch_v(syncpointb) ==
- pbdma_syncpointb_wait_switch_en_v()))
- nvhost_debug_output(o, "Waiting on syncpt %u (%s) val %u\n",
- pbdma_syncpointb_syncpt_index_v(syncpointb),
- get_syncpt_name(&host->syncpt,
- pbdma_syncpointb_syncpt_index_v(syncpointb)),
- pbdma_syncpointa_payload_v(syncpointa));
-
nvhost_debug_output(o, "\n");
}
diff --git a/drivers/video/tegra/host/gk20a/hw_pbdma_gk20a.h b/drivers/video/tegra/host/gk20a/hw_pbdma_gk20a.h
index df1a6d48541f..ea419f034a91 100644
--- a/drivers/video/tegra/host/gk20a/hw_pbdma_gk20a.h
+++ b/drivers/video/tegra/host/gk20a/hw_pbdma_gk20a.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2014, NVIDIA CORPORATION. All rights reserved.
+ * Copyright (c) 2012-2013, 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,
@@ -146,38 +146,6 @@ static inline u32 pbdma_formats_mp_fermi0_f(void)
{
return 0x0;
}
-static inline u32 pbdma_syncpointa_r(u32 i)
-{
- return 0x000400a4 + i*8192;
-}
-static inline u32 pbdma_syncpointa_payload_v(u32 r)
-{
- return (r >> 0) & 0xffffffff;
-}
-static inline u32 pbdma_syncpointb_r(u32 i)
-{
- return 0x000400a8 + i*8192;
-}
-static inline u32 pbdma_syncpointb_op_v(u32 r)
-{
- return (r >> 0) & 0x3;
-}
-static inline u32 pbdma_syncpointb_op_wait_v(void)
-{
- return 0x00000000;
-}
-static inline u32 pbdma_syncpointb_wait_switch_v(u32 r)
-{
- return (r >> 4) & 0x1;
-}
-static inline u32 pbdma_syncpointb_wait_switch_en_v(void)
-{
- return 0x00000001;
-}
-static inline u32 pbdma_syncpointb_syncpt_index_v(u32 r)
-{
- return (r >> 8) & 0xff;
-}
static inline u32 pbdma_pb_header_r(u32 i)
{
return 0x00040084 + i*8192;
diff --git a/drivers/video/tegra/host/gk20a/platform_gk20a_tegra.c b/drivers/video/tegra/host/gk20a/platform_gk20a_tegra.c
index 477bbd936cfe..7b8842ebc0d2 100644
--- a/drivers/video/tegra/host/gk20a/platform_gk20a_tegra.c
+++ b/drivers/video/tegra/host/gk20a/platform_gk20a_tegra.c
@@ -173,6 +173,8 @@ struct gk20a_platform t132_gk20a_tegra_platform = {
struct gk20a_platform gk20a_tegra_platform = {
.nvhost = {
+ .syncpts = {NVSYNCPT_GK20A_BASE},
+ .syncpt_base = NVSYNCPT_GK20A_BASE,
.class = NV_GRAPHICS_GPU_CLASS_ID,
.clocks = {{"PLLG_ref", UINT_MAX},
{"pwr", 204000000},
diff --git a/drivers/video/tegra/host/gr3d/gr3d.c b/drivers/video/tegra/host/gr3d/gr3d.c
index dc3fab85222a..3f7335cf688a 100644
--- a/drivers/video/tegra/host/gr3d/gr3d.c
+++ b/drivers/video/tegra/host/gr3d/gr3d.c
@@ -3,7 +3,7 @@
*
* Tegra Graphics Host 3D
*
- * Copyright (c) 2012-2014 NVIDIA Corporation. All rights reserved.
+ * Copyright (c) 2012-2013 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,
@@ -87,20 +87,11 @@ struct host1x_hwctx *nvhost_3dctx_alloc_common(struct host1x_hwctx_handler *p,
struct nvhost_channel *ch, bool mem_flag)
{
struct host1x_hwctx *ctx;
- struct nvhost_device_data *pdata = nvhost_get_devdata(ch->dev);
- u32 syncpt;
ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
if (!ctx)
return NULL;
- syncpt = pdata->syncpts[0];
- if (!syncpt) {
- syncpt = nvhost_get_syncpt_host_managed(ch->dev, 0);
- pdata->syncpts[0] = syncpt;
- }
- p->h.syncpt = syncpt;
-
if (mem_flag)
ctx->cpuva = dma_alloc_writecombine(&ch->dev->dev,
p->restore_size * 4,
diff --git a/drivers/video/tegra/host/gr3d/gr3d_t114.c b/drivers/video/tegra/host/gr3d/gr3d_t114.c
index c399d72d3704..6313bd0ba4b4 100644
--- a/drivers/video/tegra/host/gr3d/gr3d_t114.c
+++ b/drivers/video/tegra/host/gr3d/gr3d_t114.c
@@ -3,7 +3,7 @@
*
* Tegra Graphics Host 3d hardware context
*
- * Copyright (c) 2011-2014 NVIDIA Corporation. All rights reserved.
+ * Copyright (c) 2011-2013 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,
@@ -421,6 +421,7 @@ struct nvhost_hwctx_handler *nvhost_gr3d_t114_ctxhandler_init(
if (!p)
return NULL;
+ p->h.syncpt = syncpt;
p->h.waitbase = waitbase;
setup_save(p, NULL);
diff --git a/drivers/video/tegra/host/host1x/host1x.h b/drivers/video/tegra/host/host1x/host1x.h
index 5c1733c1bc3f..76c61d657195 100644
--- a/drivers/video/tegra/host/host1x/host1x.h
+++ b/drivers/video/tegra/host/host1x/host1x.h
@@ -3,7 +3,7 @@
*
* Tegra Graphics Host Driver Entrypoint
*
- * Copyright (c) 2010-2014, NVIDIA Corporation. All rights reserved.
+ * Copyright (c) 2010-2013, 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,
@@ -37,7 +37,9 @@ struct host1x_device_info {
int nb_channels; /* host1x: num channels supported */
int nb_pts; /* host1x: num syncpoints supported */
int nb_bases; /* host1x: num syncpoints supported */
+ u64 client_managed; /* host1x: client managed syncpts */
int nb_mlocks; /* host1x: number of mlocks */
+ const char **syncpt_names; /* names of sync points */
};
struct nvhost_master {
diff --git a/drivers/video/tegra/host/host1x/host1x_channel.c b/drivers/video/tegra/host/host1x/host1x_channel.c
index 7a5d54b76613..3160bfb4a51a 100644
--- a/drivers/video/tegra/host/host1x/host1x_channel.c
+++ b/drivers/video/tegra/host/host1x/host1x_channel.c
@@ -482,7 +482,7 @@ static inline int hwctx_handler_init(struct nvhost_channel *ch)
int err = 0;
struct nvhost_device_data *pdata = platform_get_drvdata(ch->dev);
- u32 syncpt = NVSYNCPT_INVALID;
+ u32 syncpt = pdata->syncpts[0];
u32 waitbase = pdata->waitbases[0];
if (pdata->alloc_hwctx_handler) {
diff --git a/drivers/video/tegra/host/host1x/host1x_syncpt.c b/drivers/video/tegra/host/host1x/host1x_syncpt.c
index 30eb4514ebf2..148bb2289e40 100644
--- a/drivers/video/tegra/host/host1x/host1x_syncpt.c
+++ b/drivers/video/tegra/host/host1x/host1x_syncpt.c
@@ -3,7 +3,7 @@
*
* Tegra Graphics Host Syncpoints for HOST1X
*
- * Copyright (c) 2010-2014, NVIDIA Corporation. All rights reserved.
+ * Copyright (c) 2010-2013, NVIDIA Corporation.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
@@ -108,7 +108,12 @@ static int host1x_syncpt_patch_wait(struct nvhost_syncpt *sp,
static const char *t20_syncpt_name(struct nvhost_syncpt *sp, u32 id)
{
- const char *name = sp->syncpt_names[id];
+ struct host1x_device_info *info = &syncpt_to_dev(sp)->info;
+ const char *name = NULL;
+
+ if (id < info->nb_pts)
+ name = info->syncpt_names[id];
+
return name ? name : "";
}
diff --git a/drivers/video/tegra/host/nvhost_syncpt.c b/drivers/video/tegra/host/nvhost_syncpt.c
index c92d4115fa09..eac590404fce 100644
--- a/drivers/video/tegra/host/nvhost_syncpt.c
+++ b/drivers/video/tegra/host/nvhost_syncpt.c
@@ -35,8 +35,6 @@
#include "chip_support.h"
#include "nvhost_channel.h"
-#include "host1x/host1x.h"
-
#define MAX_SYNCPT_LENGTH 5
#define NUM_SYSFS_ENTRY 4
@@ -66,11 +64,7 @@ int nvhost_syncpt_get_waitbase(struct nvhost_channel *ch, int id)
for (i = 0; i < NVHOST_MODULE_MAX_SYNCPTS && pdata->syncpts[i]; ++i)
ret |= (pdata->syncpts[i] == id);
-#ifdef CONFIG_ARCH_TEGRA_11x_SOC
if (!ret || (id == NVSYNCPT_2D_0))
-#else
- if (!ret)
-#endif
return NVSYNCPT_INVALID;
return pdata->waitbases[0];
@@ -561,10 +555,11 @@ struct nvhost_sync_timeline *nvhost_syncpt_timeline(struct nvhost_syncpt *sp,
}
#endif
-const char *get_syncpt_name(struct nvhost_syncpt *sp, int id)
+static const char *get_syncpt_name(struct nvhost_syncpt *sp, int id)
{
+ struct host1x_device_info *info = &syncpt_to_dev(sp)->info;
const char *name = NULL;
- name = sp->syncpt_names[id];
+ name = info->syncpt_names[id];
return name ? name : "";
}
@@ -648,198 +643,6 @@ static int nvhost_syncpt_timeline_attr(struct nvhost_master *host,
return 0;
}
-/**
- * performs a sequential search and returns first free syncpt id
- */
-static u32 nvhost_find_free_syncpt(struct nvhost_syncpt *sp)
-{
- u32 i;
-
- for (i = NVHOST_FREE_SYNCPT_BASE; i < nvhost_syncpt_nb_pts(sp); ++i)
- if (!sp->assigned[i])
- return i;
-
- return 0;
-}
-
-/**
- * marks a free syncpt id as reserved
- */
-static int nvhost_reserve_syncpt(struct nvhost_syncpt *sp, u32 id,
- bool client_managed)
-{
- /* is it already reserved ? */
- if (id < NVHOST_FREE_SYNCPT_BASE || sp->assigned[id])
- return -EINVAL;
-
- sp->assigned[id] = true;
- sp->client_managed[id] = client_managed;
-
- return 0;
-}
-
-/**
- * assigns a name to syncpt
- */
-static int nvhost_syncpt_assign_name(struct nvhost_syncpt *sp, u32 id,
- const char *syncpt_name)
-{
- if (id < NVHOST_FREE_SYNCPT_BASE || !sp->assigned[id])
- return -EINVAL;
-
- sp->syncpt_names[id] = syncpt_name;
-
- return 0;
-}
-
-static u32 nvhost_get_syncpt(struct nvhost_syncpt *sp, bool client_managed,
- const char *syncpt_name)
-{
- u32 id;
- int err = 0;
- struct nvhost_master *host = syncpt_to_dev(sp);
- struct device *d = &host->dev->dev;
-
- mutex_lock(&sp->syncpt_mutex);
-
- /* find a syncpt which is free */
- id = nvhost_find_free_syncpt(sp);
- if (!id) {
- nvhost_err(d, "failed to get new free syncpt\n");
- mutex_unlock(&sp->syncpt_mutex);
- return 0;
- }
-
- /* if we get one, then reserve it */
- err = nvhost_reserve_syncpt(sp, id, client_managed);
- if (err) {
- nvhost_err(d, "syncpt reservation failed\n");
- mutex_unlock(&sp->syncpt_mutex);
- return 0;
- }
-
- /* assign a name for debugging purpose */
- err = nvhost_syncpt_assign_name(sp, id, syncpt_name);
- if (err) {
- nvhost_err(d, "syncpt name assignment failed\n");
- mutex_unlock(&sp->syncpt_mutex);
- return 0;
- }
-
- mutex_unlock(&sp->syncpt_mutex);
-
- return id;
-}
-
-/**
- * Interface to get a new free (host managed) syncpt dynamically
- */
-u32 nvhost_get_syncpt_host_managed(struct platform_device *pdev,
- u32 param)
-{
- u32 id;
- char *syncpt_name;
- struct nvhost_master *nvhost_master = nvhost_get_host(pdev);
-
- syncpt_name = kasprintf(GFP_KERNEL, "%s_%d",
- dev_name(&pdev->dev), param);
-
- id = nvhost_get_syncpt(&nvhost_master->syncpt, false, syncpt_name);
- if (!id) {
- nvhost_err(&pdev->dev, "failed to get syncpt\n");
- return 0;
- }
-
- return id;
-}
-
-/**
- * Interface to get a new free (client managed) syncpt dynamically
- */
-u32 nvhost_get_syncpt_client_managed(const char *syncpt_name)
-{
- u32 id;
- struct nvhost_master *host = nvhost;
-
- if (!syncpt_name)
- syncpt_name = kasprintf(GFP_KERNEL, "client_managed");
-
- id = nvhost_get_syncpt(&host->syncpt, true, syncpt_name);
- if (!id) {
- nvhost_err(&host->dev->dev, "failed to get syncpt\n");
- return 0;
- }
-
- return id;
-}
-EXPORT_SYMBOL_GPL(nvhost_get_syncpt_client_managed);
-
-/**
- * API to mark in-use syncpt as free
- */
-void nvhost_free_syncpt(u32 id)
-{
- struct nvhost_master *host = nvhost;
- struct nvhost_syncpt *sp = &host->syncpt;
-
- WARN_ON(!sp->assigned[id]);
-
- mutex_lock(&sp->syncpt_mutex);
-
- /* set to default state */
- sp->assigned[id] = false;
- sp->client_managed[id] = false;
- kfree(sp->syncpt_names[id]);
- sp->syncpt_names[id] = NULL;
-
- mutex_unlock(&sp->syncpt_mutex);
-}
-
-static void nvhost_reserve_vblank_syncpts(struct nvhost_syncpt *sp)
-{
- mutex_lock(&sp->syncpt_mutex);
-
- sp->assigned[NVSYNCPT_VBLANK0] = true;
- sp->client_managed[NVSYNCPT_VBLANK0] = true;
- sp->syncpt_names[NVSYNCPT_VBLANK0] = "vblank0";
-
- sp->assigned[NVSYNCPT_VBLANK1] = true;
- sp->client_managed[NVSYNCPT_VBLANK1] = true;
- sp->syncpt_names[NVSYNCPT_VBLANK1] = "vblank1";
-
- sp->assigned[NVSYNCPT_AVP_0] = true;
- sp->client_managed[NVSYNCPT_AVP_0] = true;
- sp->syncpt_names[NVSYNCPT_AVP_0] = "avp";
-
- mutex_unlock(&sp->syncpt_mutex);
-}
-
-#ifdef CONFIG_ARCH_TEGRA_11x_SOC
-static void nvhost_reserve_2d_3d_syncpt(struct nvhost_syncpt *sp)
-{
- mutex_lock(&sp->syncpt_mutex);
-
- sp->assigned[NVSYNCPT_3D] = true;
- sp->syncpt_names[NVSYNCPT_3D] = "3d";
-
- sp->assigned[NVSYNCPT_2D_0] = true;
- sp->syncpt_names[NVSYNCPT_2D_0] = "2d_0";
-
- sp->assigned[NVSYNCPT_2D_1] = true;
- sp->client_managed[NVSYNCPT_2D_1] = true;
- sp->syncpt_names[NVSYNCPT_2D_1] = "2d_1";
-
- /* HACK: some tests for t114 require syncpt 17
- * to be reserved as client managed
- */
- sp->assigned[17] = true;
- sp->client_managed[17] = true;
- sp->syncpt_names[17] = "3d_1";
-
- mutex_unlock(&sp->syncpt_mutex);
-}
-#endif
-
int nvhost_syncpt_init(struct platform_device *dev,
struct nvhost_syncpt *sp)
{
@@ -848,12 +651,6 @@ int nvhost_syncpt_init(struct platform_device *dev,
int err = 0;
/* Allocate structs for min, max and base values */
- sp->assigned = kzalloc(sizeof(bool) * nvhost_syncpt_nb_pts(sp),
- GFP_KERNEL);
- sp->client_managed = kzalloc(sizeof(bool) * nvhost_syncpt_nb_pts(sp),
- GFP_KERNEL);
- sp->syncpt_names = kzalloc(sizeof(char *) * nvhost_syncpt_nb_pts(sp),
- GFP_KERNEL);
sp->min_val = kzalloc(sizeof(atomic_t) * nvhost_syncpt_nb_pts(sp),
GFP_KERNEL);
sp->max_val = kzalloc(sizeof(atomic_t) * nvhost_syncpt_nb_pts(sp),
@@ -872,8 +669,7 @@ int nvhost_syncpt_init(struct platform_device *dev,
}
#endif
- if (!(sp->assigned && sp->client_managed && sp->min_val && sp->max_val
- && sp->base_val && sp->lock_counts)) {
+ if (!(sp->min_val && sp->max_val && sp->base_val && sp->lock_counts)) {
/* frees happen in the deinit */
err = -ENOMEM;
goto fail;
@@ -885,8 +681,6 @@ int nvhost_syncpt_init(struct platform_device *dev,
goto fail;
}
- mutex_init(&sp->syncpt_mutex);
-
/* Allocate two attributes for each sync point: min and max */
sp->syncpt_attrs = kzalloc(sizeof(*sp->syncpt_attrs)
* nvhost_syncpt_nb_pts(sp) * NUM_SYSFS_ENTRY,
@@ -912,10 +706,6 @@ int nvhost_syncpt_init(struct platform_device *dev,
if (err)
goto fail;
- /* initialize syncpt status */
- sp->assigned[i] = false;
- sp->client_managed[i] = false;
-
#ifdef CONFIG_TEGRA_GRHOST_SYNC
sp->timeline[i] = nvhost_sync_timeline_create(sp, i);
if (!sp->timeline[i]) {
@@ -942,11 +732,6 @@ int nvhost_syncpt_init(struct platform_device *dev,
}
#endif
- nvhost_reserve_vblank_syncpts(sp);
-#ifdef CONFIG_ARCH_TEGRA_11x_SOC
- nvhost_reserve_2d_3d_syncpt(sp);
-#endif
-
return err;
fail:
@@ -991,21 +776,13 @@ void nvhost_syncpt_deinit(struct nvhost_syncpt *sp)
kfree(sp->syncpt_attrs);
sp->syncpt_attrs = NULL;
- kfree(sp->syncpt_names);
- sp->syncpt_names = NULL;
-
- kfree(sp->client_managed);
- sp->client_managed = NULL;
-
- kfree(sp->assigned);
- sp->assigned = NULL;
-
nvhost_syncpt_deinit_timeline(sp);
}
int nvhost_syncpt_client_managed(struct nvhost_syncpt *sp, u32 id)
{
- return sp->client_managed[id];
+ u64 mask = 1ULL << id;
+ return !!(syncpt_to_dev(sp)->info.client_managed & mask);
}
int nvhost_syncpt_nb_pts(struct nvhost_syncpt *sp)
@@ -1025,7 +802,9 @@ int nvhost_syncpt_nb_mlocks(struct nvhost_syncpt *sp)
void nvhost_syncpt_set_manager(struct nvhost_syncpt *sp, int id, bool client)
{
- sp->client_managed[id] = client;
+ u64 mask = 1ULL << id;
+ syncpt_to_dev(sp)->info.client_managed &= ~mask;
+ syncpt_to_dev(sp)->info.client_managed |= client ? mask : 0;
}
/* public sync point API */
diff --git a/drivers/video/tegra/host/nvhost_syncpt.h b/drivers/video/tegra/host/nvhost_syncpt.h
index ae0d35a83ac3..f8e3b170240d 100644
--- a/drivers/video/tegra/host/nvhost_syncpt.h
+++ b/drivers/video/tegra/host/nvhost_syncpt.h
@@ -26,9 +26,6 @@
#include <linux/nvhost.h>
#include <linux/atomic.h>
-/* when searching for free syncpt id, start from this base */
-#define NVHOST_FREE_SYNCPT_BASE 1
-
struct nvhost_syncpt;
/* Attribute struct for sysfs min and max attributes */
@@ -39,10 +36,7 @@ struct nvhost_syncpt_attr {
};
struct nvhost_syncpt {
- bool *assigned;
- bool *client_managed;
struct kobject *kobj;
- struct mutex syncpt_mutex;
atomic_t *min_val;
atomic_t *max_val;
u32 *base_val;
@@ -62,10 +56,6 @@ struct nvhost_syncpt {
int nvhost_syncpt_init(struct platform_device *, struct nvhost_syncpt *);
void nvhost_syncpt_deinit(struct nvhost_syncpt *);
-u32 nvhost_get_syncpt_host_managed(struct platform_device *pdata,
- u32 param);
-void nvhost_free_syncpt(u32 id);
-
#define syncpt_to_dev(sp) container_of(sp, struct nvhost_master, syncpt)
#define SYNCPT_CHECK_PERIOD (2 * HZ)
#define MAX_STUCK_CHECK_COUNT 15
@@ -109,7 +99,6 @@ int nvhost_syncpt_nb_pts(struct nvhost_syncpt *sp);
int nvhost_syncpt_nb_bases(struct nvhost_syncpt *sp);
int nvhost_syncpt_nb_mlocks(struct nvhost_syncpt *sp);
void nvhost_syncpt_set_manager(struct nvhost_syncpt *sp, int id, bool client);
-const char *get_syncpt_name(struct nvhost_syncpt *sp, int id);
/**
* Returns true if syncpoint min == max
diff --git a/drivers/video/tegra/host/t114/t114.c b/drivers/video/tegra/host/t114/t114.c
index eda00231d06e..7b149d77455f 100644
--- a/drivers/video/tegra/host/t114/t114.c
+++ b/drivers/video/tegra/host/t114/t114.c
@@ -3,7 +3,7 @@
*
* Tegra Graphics Init for Tegra11 Architecture Chips
*
- * Copyright (c) 2011-2014, NVIDIA Corporation. All rights reserved.
+ * Copyright (c) 2011-2013, 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,
@@ -70,11 +70,30 @@ static struct resource tegra_host1x02_resources[] = {
},
};
+static const char *s_syncpt_names[32] = {
+ "gfx_host",
+ "", "", "", "", "", "", "",
+ "disp0_a", "disp1_a", "avp_0",
+ "csi_vi_0", "csi_vi_1",
+ "vi_isp_0", "vi_isp_1", "vi_isp_2", "vi_isp_3", "vi_isp_4",
+ "2d_0", "2d_1",
+ "disp0_b", "disp1_b",
+ "3d",
+ "msenc",
+ "disp0_c", "disp1_c",
+ "vblank0", "vblank1",
+ "tsec", "msenc_unused",
+ "2d_tinyblt",
+ "dsi"
+};
+
static struct host1x_device_info host1x02_info = {
.nb_channels = 9,
.nb_pts = 32,
.nb_mlocks = 16,
.nb_bases = 12,
+ .syncpt_names = s_syncpt_names,
+ .client_managed = NVSYNCPTS_CLIENT_MANAGED,
};
struct nvhost_device_data t11_host1x_info = {
@@ -174,6 +193,8 @@ static struct resource isp_resources[] = {
struct nvhost_device_data t11_isp_info = {
.index = 3,
+ .syncpts = {NVSYNCPT_VI_ISP_2, NVSYNCPT_VI_ISP_3,
+ NVSYNCPT_VI_ISP_4},
.keepalive = true,
NVHOST_MODULE_NO_POWERGATE_IDS,
NVHOST_DEFAULT_CLOCKGATE_DELAY,
@@ -207,6 +228,10 @@ static struct resource vi_resources[] = {
struct nvhost_device_data t11_vi_info = {
.index = 4,
+ .syncpts = {NVSYNCPT_CSI_VI_0, NVSYNCPT_CSI_VI_1,
+ NVSYNCPT_VI_ISP_0, NVSYNCPT_VI_ISP_1,
+ NVSYNCPT_VI_ISP_2, NVSYNCPT_VI_ISP_3,
+ NVSYNCPT_VI_ISP_4},
.modulemutexes = {NVMODMUTEX_VI},
.clocks = { {"host1x", 136000000, 6} },
.exclusive = true,
@@ -239,6 +264,7 @@ static struct resource msenc_resources[] = {
struct nvhost_device_data t11_msenc_info = {
.version = NVHOST_ENCODE_MSENC_VER(2, 0),
.index = 5,
+ .syncpts = {NVSYNCPT_MSENC},
.waitbases = {NVWAITBASE_MSENC},
.class = NV_VIDEO_ENCODE_MSENC_CLASS_ID,
.clocks = { {"msenc", UINT_MAX, 107, TEGRA_MC_CLIENT_MSENC},
@@ -275,6 +301,7 @@ static struct resource tsec_resources[] = {
struct nvhost_device_data t11_tsec_info = {
.version = NVHOST_ENCODE_TSEC_VER(1, 0),
.index = 7,
+ .syncpts = {NVSYNCPT_TSEC},
.waitbases = {NVWAITBASE_TSEC},
.class = NV_TSEC_CLASS_ID,
.exclusive = false,
diff --git a/drivers/video/tegra/host/t124/syncpt_t124.h b/drivers/video/tegra/host/t124/syncpt_t124.h
index ddb4e5fa88e3..8e197823f3e7 100644
--- a/drivers/video/tegra/host/t124/syncpt_t124.h
+++ b/drivers/video/tegra/host/t124/syncpt_t124.h
@@ -3,7 +3,7 @@
*
* Tegra Graphics Host Syncpoints for T124
*
- * Copyright (c) 2011-2014, NVIDIA CORPORATION. All rights reserved.
+ * Copyright (c) 2011, 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,
@@ -24,6 +24,36 @@
#include <linux/nvhost.h>
+#define NVSYNCPT_GK20A_BASE 64
+/* following is base + number of gk20a channels. TODO: remove magic */
+#define NVSYNCPT_GK20A_LAST (NVSYNCPT_GK20A_BASE + 127)
+
+#define NV_VI_0_SYNCPTS { \
+ NVSYNCPT_VI_0_0, \
+ NVSYNCPT_VI_0_1, \
+ NVSYNCPT_VI_0_2, \
+ NVSYNCPT_VI_0_3, \
+ NVSYNCPT_VI_0_4}
+
+#define NV_VI_1_SYNCPTS { \
+ NVSYNCPT_VI_1_0, \
+ NVSYNCPT_VI_1_1, \
+ NVSYNCPT_VI_1_2, \
+ NVSYNCPT_VI_1_3, \
+ NVSYNCPT_VI_1_4}
+
+#define NV_ISP_0_SYNCPTS {\
+ NVSYNCPT_ISP_0_0, \
+ NVSYNCPT_ISP_0_1, \
+ NVSYNCPT_ISP_0_2, \
+ NVSYNCPT_ISP_0_3}
+
+#define NV_ISP_1_SYNCPTS {\
+ NVSYNCPT_ISP_1_0, \
+ NVSYNCPT_ISP_1_1, \
+ NVSYNCPT_ISP_1_2, \
+ NVSYNCPT_ISP_1_3}
+
#define NVWAITBASE_3D (3)
#define NVWAITBASE_MSENC (4)
#define NVWAITBASE_TSEC (5)
diff --git a/drivers/video/tegra/host/t124/t124.c b/drivers/video/tegra/host/t124/t124.c
index 32caf15fbe25..44ed22e01644 100644
--- a/drivers/video/tegra/host/t124/t124.c
+++ b/drivers/video/tegra/host/t124/t124.c
@@ -58,6 +58,17 @@ static int t124_num_alloc_channels = 0;
#define GK20A_DEV_NAME_SIZE 5
+#define BIT64(nr) (1ULL << (nr))
+#define NVSYNCPTS_CLIENT_MANAGED_T124 ( \
+ BIT64(NVSYNCPT_DISP0_A) | BIT64(NVSYNCPT_DISP1_A) | \
+ BIT64(NVSYNCPT_DISP0_B) | BIT64(NVSYNCPT_DISP1_B) | \
+ BIT64(NVSYNCPT_DISP0_C) | BIT64(NVSYNCPT_DISP1_C) | \
+ BIT(NVSYNCPT_DISP0_D) | \
+ BIT(NVSYNCPT_DISP0_H) | BIT(NVSYNCPT_DISP1_H) | \
+ BIT64(NVSYNCPT_DSI) | \
+ BIT64(NVSYNCPT_VBLANK0) | BIT64(NVSYNCPT_VBLANK1) | \
+ BIT64(NVSYNCPT_AVP_0))
+
/* Host1x driver matches module IDs while setting a
* particular clock, This ID is used for EMC module.
*/
@@ -81,11 +92,53 @@ static struct resource tegra_host1x04_resources[] = {
},
};
+static const char *s_syncpt_names[NV_HOST1X_SYNCPT_NB_PTS] = {
+ [NVSYNCPT_ISP_0_0] = "ispa_memory",
+ [NVSYNCPT_ISP_0_1] = "ispa_stats",
+ [NVSYNCPT_ISP_0_2] = "ispa_stream",
+ [NVSYNCPT_ISP_0_3] = "ispa_loadv",
+ [NVSYNCPT_ISP_1_0] = "ispb_memory",
+ [NVSYNCPT_ISP_1_1] = "ispb_stats",
+ [NVSYNCPT_ISP_1_2] = "ispb_stream",
+ [NVSYNCPT_ISP_1_3] = "ispb_loadv",
+ [NVSYNCPT_VI_0_0] = "vi0_ispa",
+ [NVSYNCPT_VI_0_1] = "vi0_ispb",
+ [NVSYNCPT_VI_0_2] = "vi0_stream",
+ [NVSYNCPT_VI_0_3] = "vi0_memory",
+ [NVSYNCPT_VI_0_4] = "vi0_flash",
+ [NVSYNCPT_VI_1_0] = "vi1_ispa",
+ [NVSYNCPT_VI_1_1] = "vi1_ispb",
+ [NVSYNCPT_VI_1_2] = "vi1_stream",
+ [NVSYNCPT_VI_1_3] = "vi1_memory",
+ [NVSYNCPT_VI_1_4] = "vi1_flash",
+ [NVSYNCPT_3D] = "3d",
+ [NVSYNCPT_MPE] = "mpe",
+ [NVSYNCPT_MPE_EBM_EOF] = "mpe_ebm_eof",
+ [NVSYNCPT_MPE_WR_SAFE] = "mpe_wr_safe",
+ [NVSYNCPT_VIC] = "vic",
+ [NVSYNCPT_TSEC] = "tsec",
+ [NVSYNCPT_DISP0_A] = "disp0",
+ [NVSYNCPT_DISP1_A] = "disp1",
+ [NVSYNCPT_AVP_0] = "avp",
+ [NVSYNCPT_DISP0_B] = "disp0b",
+ [NVSYNCPT_DISP1_B] = "disp1b",
+ [NVSYNCPT_DISP0_C] = "disp0c",
+ [NVSYNCPT_DISP1_C] = "disp1c",
+ [NVSYNCPT_DISP0_D] = "disp0d",
+ [NVSYNCPT_DISP0_H] = "disp0h",
+ [NVSYNCPT_DISP1_H] = "disp1h",
+ [NVSYNCPT_VBLANK0] = "vblank0",
+ [NVSYNCPT_VBLANK1] = "vblank1",
+ [NVSYNCPT_DSI] = "dsi",
+};
+
static struct host1x_device_info host1x04_info = {
.nb_channels = T124_NVHOST_NUMCHANNELS,
.nb_pts = NV_HOST1X_SYNCPT_NB_PTS,
.nb_mlocks = NV_HOST1X_NB_MLOCKS,
.nb_bases = NV_HOST1X_SYNCPT_NB_BASES,
+ .syncpt_names = s_syncpt_names,
+ .client_managed = NVSYNCPTS_CLIENT_MANAGED_T124,
};
struct nvhost_device_data t124_host1x_info = {
@@ -122,6 +175,7 @@ static struct resource isp_resources[] = {
static struct platform_device tegra_isp01b_device;
struct nvhost_device_data t124_isp_info = {
/* FIXME: control clocks from user space instead of hard-coding here */
+ .syncpts = NV_ISP_0_SYNCPTS,
.moduleid = NVHOST_MODULE_ISP,
.modulemutexes = {NVMODMUTEX_ISP_0},
.exclusive = true,
@@ -159,6 +213,7 @@ static struct resource ispb_resources[] = {
struct nvhost_device_data t124_ispb_info = {
/* FIXME: control clocks from user space instead of hard-coding here */
+ .syncpts = NV_ISP_1_SYNCPTS,
.moduleid = (1 << 16) | NVHOST_MODULE_ISP,
.modulemutexes = {NVMODMUTEX_ISP_1},
.exclusive = true,
@@ -199,6 +254,7 @@ static struct platform_device tegra_vi01b_device;
struct nvhost_device_data t124_vi_info = {
/* FIXME: resolve powergating dependency with DIS */
/* FIXME: control clocks from user space instead of hard-coding here */
+ .syncpts = NV_VI_0_SYNCPTS,
.moduleid = NVHOST_MODULE_VI,
.modulemutexes = {NVMODMUTEX_VI_0},
.exclusive = true,
@@ -236,6 +292,7 @@ static struct platform_device tegra_vi01_device = {
struct nvhost_device_data t124_vib_info = {
/* FIXME: resolve powergating dependency with DIS */
/* FIXME: control clocks from user space instead of hard-coding here */
+ .syncpts = NV_VI_1_SYNCPTS,
.moduleid = (1 << 16 | NVHOST_MODULE_VI),
.modulemutexes = {NVMODMUTEX_VI_1},
.exclusive = true,
@@ -280,6 +337,7 @@ static struct resource msenc_resources[] = {
struct nvhost_device_data t124_msenc_info = {
.version = NVHOST_ENCODE_MSENC_VER(3, 1),
+ .syncpts = {NVSYNCPT_MSENC, NVSYNCPT_MSENC_SLICE},
.waitbases = {NVWAITBASE_MSENC},
.class = NV_VIDEO_ENCODE_MSENC_CLASS_ID,
.clocks = {{"msenc", UINT_MAX, 0, TEGRA_MC_CLIENT_MSENC},
@@ -319,6 +377,7 @@ static struct resource tsec_resources[] = {
struct nvhost_device_data t124_tsec_info = {
.version = NVHOST_ENCODE_TSEC_VER(1, 0),
+ .syncpts = {NVSYNCPT_TSEC},
.waitbases = {NVWAITBASE_TSEC},
.class = NV_TSEC_CLASS_ID,
.exclusive = true,
@@ -357,6 +416,7 @@ static struct resource vic03_resources[] = {
};
struct nvhost_device_data t124_vic_info = {
+ .syncpts = {NVSYNCPT_VIC},
.modulemutexes = {NVMODMUTEX_VIC},
.clocks = {{"vic03", UINT_MAX, 0, TEGRA_MC_CLIENT_VIC},
{"emc", UINT_MAX} },
@@ -401,6 +461,7 @@ struct platform_device tegra_vic03_device = {
struct nvhost_device_data t132_isp_info = {
/* FIXME: control clocks from user space instead of hard-coding here */
+ .syncpts = NV_ISP_0_SYNCPTS,
.moduleid = NVHOST_MODULE_ISP,
.modulemutexes = {NVMODMUTEX_ISP_0},
.exclusive = true,
@@ -418,6 +479,7 @@ struct nvhost_device_data t132_isp_info = {
struct nvhost_device_data t132_ispb_info = {
/* FIXME: control clocks from user space instead of hard-coding here */
+ .syncpts = NV_ISP_1_SYNCPTS,
.moduleid = (1 << 16) | NVHOST_MODULE_ISP,
.modulemutexes = {NVMODMUTEX_ISP_1},
.exclusive = true,
@@ -436,6 +498,7 @@ struct nvhost_device_data t132_ispb_info = {
struct nvhost_device_data t132_vi_info = {
/* FIXME: resolve powergating dependency with DIS */
/* FIXME: control clocks from user space instead of hard-coding here */
+ .syncpts = NV_VI_0_SYNCPTS,
.moduleid = NVHOST_MODULE_VI,
.modulemutexes = {NVMODMUTEX_VI_0},
.exclusive = true,
@@ -461,6 +524,7 @@ struct nvhost_device_data t132_vi_info = {
struct nvhost_device_data t132_vib_info = {
/* FIXME: resolve powergating dependency with DIS */
/* FIXME: control clocks from user space instead of hard-coding here */
+ .syncpts = NV_VI_1_SYNCPTS,
.moduleid = (1 << 16 | NVHOST_MODULE_VI),
.modulemutexes = {NVMODMUTEX_VI_1},
.exclusive = true,
@@ -486,6 +550,7 @@ struct nvhost_device_data t132_vib_info = {
struct nvhost_device_data t132_msenc_info = {
.version = NVHOST_ENCODE_MSENC_VER(3, 1),
+ .syncpts = {NVSYNCPT_MSENC, NVSYNCPT_MSENC_SLICE},
.waitbases = {NVWAITBASE_MSENC},
.class = NV_VIDEO_ENCODE_MSENC_CLASS_ID,
.clocks = {{"msenc", UINT_MAX, 0, TEGRA_MC_CLIENT_MSENC},
@@ -502,6 +567,7 @@ struct nvhost_device_data t132_msenc_info = {
struct nvhost_device_data t132_tsec_info = {
.version = NVHOST_ENCODE_TSEC_VER(1, 0),
+ .syncpts = {NVSYNCPT_TSEC},
.waitbases = {NVWAITBASE_TSEC},
.class = NV_TSEC_CLASS_ID,
.exclusive = true,
@@ -517,6 +583,7 @@ struct nvhost_device_data t132_tsec_info = {
#ifdef CONFIG_ARCH_TEGRA_VIC
struct nvhost_device_data t132_vic_info = {
+ .syncpts = {NVSYNCPT_VIC},
.modulemutexes = {NVMODMUTEX_VIC},
.clocks = {{"vic03", UINT_MAX, 0, TEGRA_MC_CLIENT_VIC},
{"emc", UINT_MAX} },
@@ -641,6 +708,9 @@ int nvhost_init_t124_support(struct nvhost_master *host,
int err;
struct t124 *t124 = 0;
+ for (i = NVSYNCPT_GK20A_BASE; i <= NVSYNCPT_GK20A_LAST; i++)
+ s_syncpt_names[i] = "gk20a";
+
/* don't worry about cleaning up on failure... "remove" does it. */
err = nvhost_init_t124_channel_support(host, op);
if (err)
diff --git a/drivers/video/tegra/host/t148/t148.c b/drivers/video/tegra/host/t148/t148.c
index 5776e12ba06e..8b6cba356b4f 100644
--- a/drivers/video/tegra/host/t148/t148.c
+++ b/drivers/video/tegra/host/t148/t148.c
@@ -3,7 +3,7 @@
*
* Tegra Graphics Init for T148 Architecture Chips
*
- * Copyright (c) 2012-2014, NVIDIA Corporation. All rights reserved.
+ * Copyright (c) 2012-2013, 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,
@@ -68,11 +68,30 @@ static struct resource tegra_host1x03_resources[] = {
},
};
+static const char *s_syncpt_names[48] = {
+ "gfx_host",
+ "", "", "", "", "", "", "",
+ "disp0_a", "disp1_a", "avp_0",
+ "csi_vi_0", "csi_vi_1",
+ "vi_isp_0", "vi_isp_1", "vi_isp_2", "vi_isp_3", "vi_isp_4",
+ "2d_0", "2d_1",
+ "disp0_b", "disp1_b",
+ "3d",
+ "msenc",
+ "disp0_c", "disp1_c",
+ "vblank0", "vblank1",
+ "tsec", "msenc_unused",
+ "2d_tinyblt",
+ "dsi"
+};
+
static struct host1x_device_info host1x03_info = {
.nb_channels = 12,
.nb_pts = 48,
.nb_mlocks = 16,
.nb_bases = 12,
+ .syncpt_names = s_syncpt_names,
+ .client_managed = NVSYNCPTS_CLIENT_MANAGED,
};
struct nvhost_device_data t14_host1x_info = {
@@ -94,6 +113,7 @@ static struct platform_device tegra_host1x03_device = {
struct nvhost_device_data t14_gr3d_info = {
.version = 3,
.index = 1,
+ .syncpts = {NVSYNCPT_3D},
.waitbases = {NVWAITBASE_3D},
.modulemutexes = {NVMODMUTEX_3D},
.class = NV_GRAPHICS_3D_CLASS_ID,
@@ -133,6 +153,7 @@ static struct platform_device tegra_gr3d03_device = {
struct nvhost_device_data t14_gr2d_info = {
.index = 2,
+ .syncpts = {NVSYNCPT_2D_0, NVSYNCPT_2D_1},
.waitbases = {NVWAITBASE_2D_0, NVWAITBASE_2D_1},
.modulemutexes = {NVMODMUTEX_2D_FULL, NVMODMUTEX_2D_SIMPLE,
NVMODMUTEX_2D_SB_A, NVMODMUTEX_2D_SB_B},
@@ -167,6 +188,8 @@ static struct resource isp_resources[] = {
struct nvhost_device_data t14_isp_info = {
.index = 3,
+ .syncpts = {NVSYNCPT_VI_ISP_2, NVSYNCPT_VI_ISP_3,
+ NVSYNCPT_VI_ISP_4},
NVHOST_MODULE_NO_POWERGATE_IDS,
NVHOST_DEFAULT_CLOCKGATE_DELAY,
.moduleid = NVHOST_MODULE_ISP,
@@ -199,6 +222,10 @@ static struct resource vi_resources[] = {
struct nvhost_device_data t14_vi_info = {
.index = 4,
+ .syncpts = {NVSYNCPT_CSI_VI_0, NVSYNCPT_CSI_VI_1,
+ NVSYNCPT_VI_ISP_0, NVSYNCPT_VI_ISP_1,
+ NVSYNCPT_VI_ISP_2, NVSYNCPT_VI_ISP_3,
+ NVSYNCPT_VI_ISP_4},
.modulemutexes = {NVMODMUTEX_VI_0},
.clocks = { {"host1x", 136000000, 6} },
.exclusive = true,
@@ -231,6 +258,7 @@ static struct resource msenc_resources[] = {
struct nvhost_device_data t14_msenc_info = {
.version = NVHOST_ENCODE_MSENC_VER(3, 0),
.index = 5,
+ .syncpts = {NVSYNCPT_MSENC},
.waitbases = {NVWAITBASE_MSENC},
.class = NV_VIDEO_ENCODE_MSENC_CLASS_ID,
.clocks = { {"msenc", UINT_MAX, 107, TEGRA_MC_CLIENT_MSENC},
@@ -268,6 +296,7 @@ static struct resource tsec_resources[] = {
struct nvhost_device_data t14_tsec_info = {
.version = NVHOST_ENCODE_TSEC_VER(1,0),
.index = 7,
+ .syncpts = {NVSYNCPT_TSEC},
.waitbases = {NVWAITBASE_TSEC},
.class = NV_TSEC_CLASS_ID,
.exclusive = false,
diff --git a/drivers/video/tegra/host/vic03/vic03.c b/drivers/video/tegra/host/vic03/vic03.c
index fad5242c99ef..a148f9899447 100644
--- a/drivers/video/tegra/host/vic03/vic03.c
+++ b/drivers/video/tegra/host/vic03/vic03.c
@@ -451,12 +451,11 @@ static struct nvhost_hwctx *vic03_alloc_hwctx(struct nvhost_hwctx_handler *h,
struct nvhost_channel *ch)
{
struct host1x_hwctx_handler *p = to_host1x_hwctx_handler(h);
- struct nvhost_device_data *pdata = nvhost_get_devdata(ch->dev);
struct vic03 *v = get_vic03(ch->dev);
struct host1x_hwctx *ctx;
u32 *ptr;
- u32 syncpt;
+ u32 syncpt = nvhost_get_devdata(ch->dev)->syncpts[0];
u32 nvhost_vic03_restore_size = 10; /* number of words written below */
nvhost_dbg_fn("");
@@ -465,13 +464,6 @@ static struct nvhost_hwctx *vic03_alloc_hwctx(struct nvhost_hwctx_handler *h,
if (!ctx)
return NULL;
- syncpt = pdata->syncpts[0];
- if (!syncpt) {
- syncpt = nvhost_get_syncpt_host_managed(ch->dev, 0);
- pdata->syncpts[0] = syncpt;
- }
- h->syncpt = syncpt;
-
ctx->restore_size = nvhost_vic03_restore_size;
ctx->cpuva = dma_alloc_writecombine(&ch->dev->dev,
@@ -574,6 +566,7 @@ struct nvhost_hwctx_handler *nvhost_vic03_alloc_hwctx_handler(u32 syncpt,
if (!p)
return NULL;
+ p->h.syncpt = syncpt;
p->h.waitbase = waitbase;
p->h.alloc = vic03_alloc_hwctx;
diff --git a/include/linux/nvhost.h b/include/linux/nvhost.h
index d993fafabaa0..929ed6f99afc 100644
--- a/include/linux/nvhost.h
+++ b/include/linux/nvhost.h
@@ -52,13 +52,54 @@ struct nvhost_as_moduleops;
#define NVSYNCPT_INVALID (-1)
#define NVSYNCPT_GRAPHICS_HOST (0) /* t20, t30, t114, t148 */
-
-#define NVSYNCPT_AVP_0 (10) /* t20, t30, t114, t148 */
-#define NVSYNCPT_2D_0 (18)
-#define NVSYNCPT_2D_1 (19)
-#define NVSYNCPT_3D (22)
+#define NVSYNCPT_DISP0_D (5) /* t20, t30, t114, t148 */
+#define NVSYNCPT_DISP0_H (6) /* t20, t30, t114, t148 */
+#define NVSYNCPT_DISP1_H (7) /* t20, t30, t114, t148 */
+#define NVSYNCPT_DISP0_A (8) /* t20, t30, t114, t148 */
+#define NVSYNCPT_DISP1_A (9) /* t20, t30, t114, t148 */
+#define NVSYNCPT_AVP_0 (10) /* t20, t30, t114, t148 */
+#define NVSYNCPT_CSI_VI_0 (11) /* t20, t30, t114, t148 */
+#define NVSYNCPT_CSI_VI_1 (12) /* t20, t30, t114, t148 */
+#define NVSYNCPT_VI_ISP_0 (13) /* t20, t30, t114, t148 */
+#define NVSYNCPT_VI_ISP_1 (14) /* t20, t30, t114, t148 */
+#define NVSYNCPT_VI_ISP_2 (15) /* t20, t30, t114, t148 */
+#define NVSYNCPT_VI_ISP_3 (16) /* t20, t30, t114, t148 */
+#define NVSYNCPT_VI_ISP_4 (17) /* t20, t30, t114, t148 */
+#define NVSYNCPT_2D_0 (18) /* t20, t30, t114, t148 */
+#define NVSYNCPT_VIC (18) /* t124 */
+#define NVSYNCPT_2D_1 (19) /* t20, t30, t114, t148 */
+#define NVSYNCPT_MSENC_SLICE (19) /* t124 */
+#define NVSYNCPT_DISP0_B (20) /* t20, t30, t114, t148 */
+#define NVSYNCPT_DISP1_B (21) /* t20, t30, t114, t148 */
+#define NVSYNCPT_3D (22) /* t20, t30, t114, t148 */
+#define NVSYNCPT_MPE (23) /* t20, t30 */
+#define NVSYNCPT_MSENC (23) /* t114, t148 */
+#define NVSYNCPT_DISP0_C (24) /* t20, t30, t114, t148 */
+#define NVSYNCPT_DISP1_C (25) /* t20, t30, t114, t148 */
#define NVSYNCPT_VBLANK0 (26) /* t20, t30, t114, t148 */
#define NVSYNCPT_VBLANK1 (27) /* t20, t30, t114, t148 */
+#define NVSYNCPT_MPE_EBM_EOF (28) /* t20, t30 */
+#define NVSYNCPT_TSEC (28) /* t114, t148 */
+#define NVSYNCPT_MPE_WR_SAFE (29) /* t20, t30 */
+#define NVSYNCPT_DSI (31) /* t20, t30, t114, t148 */
+#define NVSYNCPT_ISP_0_0 (32) /* t124 */
+#define NVSYNCPT_ISP_0_1 (33) /* t124 */
+#define NVSYNCPT_ISP_0_2 (34) /* t124 */
+#define NVSYNCPT_ISP_0_3 (35) /* t124 */
+#define NVSYNCPT_ISP_1_0 (36) /* t124 */
+#define NVSYNCPT_ISP_1_1 (37) /* t124 */
+#define NVSYNCPT_ISP_1_2 (38) /* t124 */
+#define NVSYNCPT_ISP_1_3 (39) /* t124 */
+#define NVSYNCPT_VI_0_0 (40) /* t124 */
+#define NVSYNCPT_VI_0_1 (41) /* t124 */
+#define NVSYNCPT_VI_0_2 (42) /* t124 */
+#define NVSYNCPT_VI_0_3 (43) /* t124 */
+#define NVSYNCPT_VI_0_4 (44) /* t124 */
+#define NVSYNCPT_VI_1_0 (45) /* t124 */
+#define NVSYNCPT_VI_1_1 (46) /* t124 */
+#define NVSYNCPT_VI_1_2 (47) /* t124 */
+#define NVSYNCPT_VI_1_3 (48) /* t124 */
+#define NVSYNCPT_VI_1_4 (49) /* t124 */
#define NVWAITBASE_2D_0 (1) /* t20, t30, t114 */
#define NVWAITBASE_2D_1 (2) /* t20, t30, t114 */
@@ -82,6 +123,21 @@ struct nvhost_as_moduleops;
#define NVMODMUTEX_VIC (10) /* t124 */
#define NVMODMUTEX_VI_1 (11) /* t124 */
+/* sync points that are wholly managed by the client */
+#define NVSYNCPTS_CLIENT_MANAGED ( \
+ BIT(NVSYNCPT_DISP0_A) | BIT(NVSYNCPT_DISP1_A) | \
+ BIT(NVSYNCPT_DISP0_B) | BIT(NVSYNCPT_DISP1_B) | \
+ BIT(NVSYNCPT_DISP0_C) | BIT(NVSYNCPT_DISP1_C) | \
+ BIT(NVSYNCPT_DISP0_D) | \
+ BIT(NVSYNCPT_DISP0_H) | BIT(NVSYNCPT_DISP1_H) | \
+ BIT(NVSYNCPT_DSI) | \
+ BIT(NVSYNCPT_VBLANK0) | BIT(NVSYNCPT_VBLANK1) | \
+ BIT(NVSYNCPT_CSI_VI_0) | BIT(NVSYNCPT_CSI_VI_1) | \
+ BIT(NVSYNCPT_VI_ISP_1) | BIT(NVSYNCPT_VI_ISP_2) | \
+ BIT(NVSYNCPT_VI_ISP_3) | BIT(NVSYNCPT_VI_ISP_4) | \
+ BIT(NVSYNCPT_MPE_EBM_EOF) | BIT(NVSYNCPT_MPE_WR_SAFE) | \
+ BIT(NVSYNCPT_2D_1) | BIT(NVSYNCPT_AVP_0))
+
enum nvhost_power_sysfs_attributes {
NVHOST_POWER_SYSFS_ATTRIB_CLOCKGATE_DELAY = 0,
NVHOST_POWER_SYSFS_ATTRIB_POWERGATE_DELAY,
@@ -118,6 +174,7 @@ struct nvhost_device_data {
struct device_dma_parameters dma_parms;
u32 syncpts[NVHOST_MODULE_MAX_SYNCPTS];
+ u32 syncpt_base; /* Device sync point base */
u32 waitbases[NVHOST_MODULE_MAX_WAITBASES];
u32 modulemutexes[NVHOST_MODULE_MAX_MODMUTEXES];
u32 moduleid; /* Module id for user space API */
@@ -269,7 +326,6 @@ int nvhost_module_busy_ext(struct platform_device *dev);
void nvhost_module_idle_ext(struct platform_device *dev);
/* public host1x sync-point management APIs */
-u32 nvhost_get_syncpt_client_managed(const char *syncpt_name);
u32 nvhost_syncpt_incr_max_ext(struct platform_device *dev, u32 id, u32 incrs);
void nvhost_syncpt_cpu_incr_ext(struct platform_device *dev, u32 id);
u32 nvhost_syncpt_read_ext(struct platform_device *dev, u32 id);