staging: topaz: check if hw is idle based on command fifo
authorTopi Pohjolainen <topi.pohjolainen@intel.com>
Fri, 27 Apr 2012 14:24:11 +0000 (17:24 +0300)
committerMarkus Lehtonen <markus.lehtonen@linux.intel.com>
Tue, 3 Jul 2012 09:31:00 +0000 (12:31 +0300)
Part of video hw driver update from UMG.

Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
drivers/staging/mrst/imgv/pnw_topaz.c

index 75787a4..df00fcc 100644 (file)
@@ -669,6 +669,7 @@ int pnw_check_topaz_idle(struct drm_device *dev)
        struct drm_psb_private *dev_priv =
                (struct drm_psb_private *)dev->dev_private;
        struct pnw_topaz_private *topaz_priv = dev_priv->topaz_private;
+       uint32_t reg_val;
 
        if (dev_priv->topaz_ctx == NULL)
                return 0;
@@ -680,6 +681,15 @@ int pnw_check_topaz_idle(struct drm_device *dev)
                PSB_DEBUG_PM("TOPAZ: %s, HW is busy\n", __func__);
                return -EBUSY;
        }
+       TOPAZ_MULTICORE_READ32(TOPAZSC_CR_MULTICORE_CMD_FIFO_1,
+                       &reg_val);
+       reg_val &= MASK_TOPAZSC_CR_CMD_FIFO_SPACE;
+       if (reg_val != 32) {
+               PSB_DEBUG_GENERAL("TOPAZ: HW is busy. Free words in command"
+                               "FIFO is %d.\n",
+                               reg_val);
+               return -EBUSY;
+       }
 
        return 0; /* we think it is idle */
 }