MLK-11316-2 mxc IPUv3: PRE: Define small Y resolution
authorLiu Ying <Ying.Liu@freescale.com>
Fri, 11 Sep 2015 08:09:57 +0000 (16:09 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 19:48:48 +0000 (14:48 -0500)
In order to workaround the PRE SoC bug recorded by errata ERR009624, the
software cannot write the PRE_CTRL register when the PRE writes the PRE_CTRL
register automatically to set the ENABLE bit(bit0) to 1 in the PRE repeat mode.

The software mechanism to set the PRE_CTRL register is different for PRE Y
resolution higher than 9 lines and lower than or equal to 9 lines.  So,
this patch defines the small Y resolution and adds a helper to check the
Y resolution.

Signed-off-by: Liu Ying <Ying.Liu@freescale.com>
(cherry picked from commit cf7df46e3b1d2142ff354498982194247bf07fea)

include/linux/ipu-v3-pre.h

index 2b36d34..1bf50ae 100644 (file)
@@ -13,6 +13,7 @@
 
 #define IPU_PRE_MAX_WIDTH      1920
 #define IPU_PRE_MAX_BPP                4
+#define IPU_PRE_SMALL_LINE     9       /* to workaround errata ERR009624*/
 
 struct ipu_rect {
        int left;
@@ -66,6 +67,20 @@ struct ipu_pre_context {
        unsigned long store_addr;
 };
 
+/*
+ * In order to workaround the PRE SoC bug recorded by errata ERR009624,
+ * the software cannot write the PRE_CTRL register when the PRE writes
+ * the PRE_CTRL register automatically to set the ENABLE bit(bit0) to 1
+ * in the PRE repeat mode.
+ * The software mechanism to set the PRE_CTRL register is different for
+ * PRE Y resolution higher than 9 lines and lower or equal to 9 lines.
+ * Use this helper to check the Y resolution.
+ */
+static inline bool ipu_pre_yres_is_small(unsigned int yres)
+{
+       return yres <= IPU_PRE_SMALL_LINE;
+}
+
 #ifdef CONFIG_MXC_IPU_V3_PRE
 int ipu_pre_alloc(int ipu_id, ipu_channel_t ipu_ch);
 void ipu_pre_free(unsigned int *id);