[COMMON] media: smfc: fix missing secondary interrupt status
authorCho KyongHo <pullip.cho@samsung.com>
Wed, 15 Jul 2015 05:02:38 +0000 (14:02 +0900)
committerSeungchul Kim <sc377.kim@samsung.com>
Mon, 28 May 2018 05:31:08 +0000 (14:31 +0900)
SMFC can asserts without no status indication bit of the main image set
if the secondary image causes the interrupt.
Therefor the driver should check the interrupt status of the secondary
image when the interrupt is occurred even though 0 is read from the
interrupt status register of the main image.

Change-Id: I9581213730c88a0f51f414aa29c84f08ed3783c2
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
drivers/media/platform/exynos/smfc/smfc-regs.c

index 0f6b4e4291fb3b4743e97058422c0276bd3fec2c..619d547cfd9feed84d475779fbbde6d50a0a3ae1 100644 (file)
@@ -350,48 +350,42 @@ void smfc_hwconfigure_start(struct smfc_ctx *ctx,
 
 bool smfc_hwstatus_okay(struct smfc_dev *smfc, struct smfc_ctx *ctx)
 {
-       u32 val;
-       bool ret = false;
+       u32 val, val2, reg;
 
        /* Disable global interrupt */
-       val = __raw_readl(smfc->reg + REG_MAIN_JPEG_CNTL);
-       val ^= 1 << JPEG_CNTL_INT_EN_SHIFT;
-       __raw_writel(val, smfc->reg + REG_MAIN_JPEG_CNTL);
+       reg = __raw_readl(smfc->reg + REG_MAIN_JPEG_CNTL);
+       reg ^= 1 << JPEG_CNTL_INT_EN_SHIFT;
+       __raw_writel(reg, smfc->reg + REG_MAIN_JPEG_CNTL);
 
        val = __raw_readl(smfc->reg + REG_MAIN_INT_STATUS);
-       if (!val) {
-               dev_err(smfc->dev, "Interrupt with no status change\n");
-               goto err;
+       val2 = __raw_readl(smfc->reg + REG_SEC_INT_STATUS);
+
+       if (!val && !val2) {
+               dev_err(smfc->dev, "Interrupt with no state change\n");
+               return false;
        }
 
        if ((val & ~2)) {
-               dev_err(smfc->dev, "Error interrupt %#010x\n", val);
-               goto err;
+               dev_err(smfc->dev, "Error main interrupt %#010x.\n", val);
+               return false;
        }
 
-       if (!(ctx->flags & SMFC_CTX_B2B_COMPRESS))
-               goto finish;
+       if ((val2 & ~2)) {
+               dev_err(smfc->dev, "Error secondary interrupt %#010x.\n", val);
+               return false;
+       }
 
-       val = __raw_readl(smfc->reg + REG_SEC_INT_STATUS);
-       if (!val) {
+       if (!!(ctx->flags & SMFC_CTX_B2B_COMPRESS) && !val2) {
                dev_err(smfc->dev, "Secondary image is not completed\n");
-               goto err;
+               return false;
        }
 
-       if ((val & ~2)) {
-               dev_err(smfc->dev, "Error interrupt %#010x for the secondary\n",
-                       val);
-               goto err;
-       }
-finish:
-       ret = true;
-err:
        /* reset codec state to compression/decompression disabled */
-       val = __raw_readl(smfc->reg + REG_MAIN_JPEG_CNTL);
-       val &= ~JPEG_CNTL_RESET_MASK;
-       __raw_writel(val, smfc->reg + REG_MAIN_JPEG_CNTL);
+       reg = __raw_readl(smfc->reg + REG_MAIN_JPEG_CNTL);
+       reg &= ~JPEG_CNTL_RESET_MASK,
+       __raw_writel(reg, smfc->reg + REG_MAIN_JPEG_CNTL);
 
-       return ret;
+       return true;
 }
 
 void smfc_dump_registers(struct smfc_dev *smfc)