summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrzej Pietrasiewicz <andrzej.p@samsung.com>2017-08-08 07:27:05 -0400
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2017-08-20 08:01:28 -0400
commit630dde63001dc62be7abcc54101a80209ad6ec38 (patch)
treeb2ec48355a351892edcf2dbe5b69fae6c1166a18
parente28e6f75667d68cd36f1ef312c3d988795fee331 (diff)
media: s5p-jpeg: disable encoder/decoder in exynos4-like hardware after use
Clearing the bits turns off the encoder/decoder. If the hardware is not turned off after use, at subsequent uses it does not work in a stable manner, resulting in incorrect interrupt status value being read and e.g. erroneous read of compressed bitstream size. Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
-rw-r--r--drivers/media/platform/s5p-jpeg/jpeg-core.c2
-rw-r--r--drivers/media/platform/s5p-jpeg/jpeg-core.h1
-rw-r--r--drivers/media/platform/s5p-jpeg/jpeg-hw-exynos4.c5
3 files changed, 7 insertions, 1 deletions
diff --git a/drivers/media/platform/s5p-jpeg/jpeg-core.c b/drivers/media/platform/s5p-jpeg/jpeg-core.c
index 663b79cb14b0..917c9629f6b2 100644
--- a/drivers/media/platform/s5p-jpeg/jpeg-core.c
+++ b/drivers/media/platform/s5p-jpeg/jpeg-core.c
@@ -2806,6 +2806,8 @@ static irqreturn_t exynos4_jpeg_irq(int irq, void *priv)
if (jpeg->variant->version == SJPEG_EXYNOS4)
curr_ctx->subsampling = exynos4_jpeg_get_frame_fmt(jpeg->regs);
+ exynos4_jpeg_set_enc_dec_mode(jpeg->regs, S5P_JPEG_DISABLE);
+
spin_unlock(&jpeg->slock);
v4l2_m2m_job_finish(jpeg->m2m_dev, curr_ctx->fh.m2m_ctx);
diff --git a/drivers/media/platform/s5p-jpeg/jpeg-core.h b/drivers/media/platform/s5p-jpeg/jpeg-core.h
index 9aa26bd1d46d..a46465e10351 100644
--- a/drivers/media/platform/s5p-jpeg/jpeg-core.h
+++ b/drivers/media/platform/s5p-jpeg/jpeg-core.h
@@ -63,6 +63,7 @@
#define S5P_JPEG_ENCODE 0
#define S5P_JPEG_DECODE 1
+#define S5P_JPEG_DISABLE -1
#define FMT_TYPE_OUTPUT 0
#define FMT_TYPE_CAPTURE 1
diff --git a/drivers/media/platform/s5p-jpeg/jpeg-hw-exynos4.c b/drivers/media/platform/s5p-jpeg/jpeg-hw-exynos4.c
index a1d823ab0c63..c78403368e5b 100644
--- a/drivers/media/platform/s5p-jpeg/jpeg-hw-exynos4.c
+++ b/drivers/media/platform/s5p-jpeg/jpeg-hw-exynos4.c
@@ -38,10 +38,13 @@ void exynos4_jpeg_set_enc_dec_mode(void __iomem *base, unsigned int mode)
writel((reg & EXYNOS4_ENC_DEC_MODE_MASK) |
EXYNOS4_DEC_MODE,
base + EXYNOS4_JPEG_CNTL_REG);
- } else {/* encode */
+ } else if (mode == S5P_JPEG_ENCODE) {/* encode */
writel((reg & EXYNOS4_ENC_DEC_MODE_MASK) |
EXYNOS4_ENC_MODE,
base + EXYNOS4_JPEG_CNTL_REG);
+ } else { /* disable both */
+ writel(reg & EXYNOS4_ENC_DEC_MODE_MASK,
+ base + EXYNOS4_JPEG_CNTL_REG);
}
}