video:tegra:nvavp: Add sync point increment support
Soumen Kumar Dey [Tue, 21 May 2013 10:10:16 +0000 (15:10 +0530)]
Move sync point increment to CPU side for T11X.

bug 1279729

Change-Id: I3ff5efc2300635411aaa5b71a3455e0b27808460
Signed-off-by: Soumen Kumar Dey <sdey@nvidia.com>
Reviewed-on: http://git-master/r/232770
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Reviewed-by: Gajanan Bhat <gbhat@nvidia.com>

drivers/media/video/tegra/nvavp/nvavp_dev.c
drivers/media/video/tegra/nvavp/nvavp_os.h

index fb42936..8921b6b 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * drivers/media/video/tegra/nvavp/nvavp_dev.c
  *
- * Copyright (c) 2012, NVIDIA CORPORATION.  All rights reserved.
+ * Copyright (c) 2011-2013, NVIDIA CORPORATION.  All rights reserved.
  *
  * This file is licensed under the terms of the GNU General Public License
  * version 2. This program is licensed "as is" without any warranty of any
@@ -235,6 +235,12 @@ static void nvavp_set_channel_control_area(struct nvavp_info *nvavp, int channel
        writel(0x1, &control->idle_notify_enable);
        writel(NVAVP_OS_IDLE_TIMEOUT, &control->idle_notify_delay);
 
+#if defined(CONFIG_ARCH_TEGRA_11x_SOC)
+       /* enable sync pt trap enable for avp */
+       if (IS_VIDEO_CHANNEL_ID(channel_id))
+               writel(0x1, &control->sync_pt_incr_trap_enable);
+#endif
+
        /* init dma start and end pointers */
        writel(channel_info->pushbuf_phys, &control->dma_start);
        writel((channel_info->pushbuf_phys + NVAVP_PUSHBUFFER_SIZE),
@@ -377,6 +383,13 @@ static int nvavp_service(struct nvavp_info *nvavp)
        if (inbox & NVE276_OS_INTERRUPT_VIDEO_IDLE)
                schedule_work(&nvavp->clock_disable_work);
 
+       if (inbox & NVE276_OS_INTERRUPT_SYNCPT_INCR_TRAP) {
+               /* sync pnt incr */
+               if (nvavp->syncpt_id == NVE276_OS_SYNCPT_INCR_TRAP_GET_SYNCPT(inbox))
+                       nvhost_syncpt_cpu_incr_ext(
+                               nvavp->nvhost_dev, nvavp->syncpt_id);
+       }
+
 #if defined(CONFIG_TEGRA_NVAVP_AUDIO)
        if (inbox & NVE276_OS_INTERRUPT_AUDIO_IDLE)
                pr_debug("nvavp_service NVE276_OS_INTERRUPT_AUDIO_IDLE\n");
index 4d7f677..39c6674 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * drivers/media/video/tegra/nvavp/nvavp_os.h
  *
- * Copyright (C) 2011 NVIDIA Corp.
+ * Copyright (c) 2011-2013, NVIDIA CORPORATION.  All rights reserved.
  *
  * This file is licensed under the terms of the GNU General Public License
  * version 2. This program is licensed "as is" without any warranty of any
@@ -26,7 +26,8 @@ struct nv_e276_control {
        u32 put;
        u32 reserved03[15];
        u32 get;
-       u32 reserved04[10];
+       u32 reserved04[9];
+       u32 sync_pt_incr_trap_enable;
        u32 watchdog_timeout;
        u32 idle_notify_enable;
        u32 idle_notify_delay;
@@ -76,9 +77,13 @@ struct nv_e276_control {
 #define NVE276_OS_INTERRUPT_APP_NOTIFY         (0x00000020)
 #define NVE276_OS_INTERRUPT_VIDEO_IDLE         (0x00000040)
 #define NVE276_OS_INTERRUPT_AUDIO_IDLE         (0x00000080)
+#define NVE276_OS_INTERRUPT_SYNCPT_INCR_TRAP   (0x00002000)
 #define NVE276_OS_INTERRUPT_AVP_BREAKPOINT     (0x00800000)
 #define NVE276_OS_INTERRUPT_AVP_FATAL_ERROR    (0x01000000)
 
+/* Get sync point id from avp->cpu data */
+#define NVE276_OS_SYNCPT_INCR_TRAP_GET_SYNCPT(x)       (((x)>>14)&0x1f)
+
 struct nvavp_os_info {
        u32                     entry_offset;
        u32                     control_offset;