summaryrefslogtreecommitdiff
path: root/drivers/dma
diff options
context:
space:
mode:
authorGuoniu.Zhou <guoniu.zhou@nxp.com>2018-03-29 11:36:43 +0800
committerLeonard Crestez <leonard.crestez@nxp.com>2018-08-24 12:41:33 +0300
commit1ce3186610456b7558cfa5e26743577f6d5d04a0 (patch)
tree11f7f254dc9b5c5337bbcda16694b6481351ec25 /drivers/dma
parentfc07e2ab17beb8da32a08edaeafbe991d2d6f3ce (diff)
MLK-17938: pxp: pxp will hang when output height is 8
When output height is eight, yscale of ps engine will be over two, it not support by pxp. According to pxp doc, a factor greater than 2 is not supported with the bilinear filter. so correct it when this case happen in order to ensure that pxp will be not hang up. Reviewed-by: Robby.cai <robby.cai@nxp.com> Signed-off-by: Guoniu.Zhou <guoniu.zhou@nxp.com>
Diffstat (limited to 'drivers/dma')
-rw-r--r--drivers/dma/pxp/pxp_dma_v3.c28
-rw-r--r--drivers/dma/pxp/regs-pxp_v3.h2
2 files changed, 29 insertions, 1 deletions
diff --git a/drivers/dma/pxp/pxp_dma_v3.c b/drivers/dma/pxp/pxp_dma_v3.c
index 48c3144ffce8..647fdd3e4b06 100644
--- a/drivers/dma/pxp/pxp_dma_v3.c
+++ b/drivers/dma/pxp/pxp_dma_v3.c
@@ -1,7 +1,7 @@
/*
* Copyright (C) 2010-2016 Freescale Semiconductor, Inc.
*
- * Copyright 2017 NXP
+ * Copyright 2017-2018 NXP
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -2306,6 +2306,19 @@ static uint32_t ps_calc_scaling(struct pxp_pixmap *input,
}
scale.xscale = input->crop.width * 0x1000 /
(output->crop.width * decx);
+
+ /* A factor greater than 2 is not supported
+ * with the bilinear filter, so correct it in
+ * driver
+ */
+ if (((scale.xscale >> BP_PXP_PS_SCALE_OFFSET) & 0x3) > 2) {
+ scale.xscale &= (~(0x3 << BP_PXP_PS_SCALE_OFFSET));
+ scale.xscale |= (0x2 << BP_PXP_PS_SCALE_OFFSET);
+ pr_warn("%s: scale.xscale is larger than 2, forcing to 2"
+ "input w/h=(%d,%d), output w/h=(%d, %d)\n",
+ __func__, input->crop.width, input->crop.height,
+ output->crop.width, output->crop.height);
+ }
} else {
if (!is_yuv(input->format) ||
(is_yuv(input->format) == is_yuv(output->format)) ||
@@ -2343,6 +2356,19 @@ static uint32_t ps_calc_scaling(struct pxp_pixmap *input,
}
scale.yscale = input->crop.height * 0x1000 /
(output->crop.height * decy);
+
+ /* A factor greater than 2 is not supported
+ * with the bilinear filter, so correct it in
+ * driver
+ */
+ if (((scale.yscale >> BP_PXP_PS_SCALE_OFFSET) & 0x3) > 2) {
+ scale.yscale &= (~(0x3 << BP_PXP_PS_SCALE_OFFSET));
+ scale.yscale |= (0x2 << BP_PXP_PS_SCALE_OFFSET);
+ pr_warn("%s: scale.yscale is larger than 2, forcing to 2"
+ "input w/h=(%d,%d), output w/h=(%d, %d)\n",
+ __func__, input->crop.width, input->crop.height,
+ output->crop.width, output->crop.height);
+ }
} else {
if ((input->crop.height > 1) && (output->crop.height > 1))
scale.yscale = (input->crop.height - 1) * 0x1000 /
diff --git a/drivers/dma/pxp/regs-pxp_v3.h b/drivers/dma/pxp/regs-pxp_v3.h
index 15a481151a13..80e310bb5ca7 100644
--- a/drivers/dma/pxp/regs-pxp_v3.h
+++ b/drivers/dma/pxp/regs-pxp_v3.h
@@ -456,6 +456,8 @@
#define BF_PXP_PS_SCALE_XSCALE(v) \
(((v) << 0) & BM_PXP_PS_SCALE_XSCALE)
+#define BP_PXP_PS_SCALE_OFFSET 12
+
#define HW_PXP_PS_OFFSET (0x00000120)
#define BP_PXP_PS_OFFSET_RSVD2 28