media: stm32-dcmi: do not emit error trace in case of few overrun
authorHugues Fruchet <hugues.fruchet@st.com>
Mon, 1 Apr 2019 08:55:00 +0000 (04:55 -0400)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Mon, 22 Apr 2019 15:07:33 +0000 (11:07 -0400)
Report overrun error only when it exceeds a given threshold.

Signed-off-by: Hugues Fruchet <hugues.fruchet@st.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
drivers/media/platform/stm32/stm32-dcmi.c

index 693415cf851891d2aa83f5e8307794ff8e781164..b63d57cd89e513bf4f58348a3d9364d31568ebee 100644 (file)
@@ -97,6 +97,8 @@ enum state {
 
 #define TIMEOUT_MS     1000
 
+#define OVERRUN_ERROR_THRESHOLD        3
+
 struct dcmi_graph_entity {
        struct device_node *node;
 
@@ -446,11 +448,13 @@ static irqreturn_t dcmi_irq_thread(int irq, void *arg)
 
        spin_lock_irq(&dcmi->irqlock);
 
-       if ((dcmi->misr & IT_OVR) || (dcmi->misr & IT_ERR)) {
-               dcmi->errors_count++;
-               if (dcmi->misr & IT_OVR)
-                       dcmi->overrun_count++;
+       if (dcmi->misr & IT_OVR) {
+               dcmi->overrun_count++;
+               if (dcmi->overrun_count > OVERRUN_ERROR_THRESHOLD)
+                       dcmi->errors_count++;
        }
+       if (dcmi->misr & IT_ERR)
+               dcmi->errors_count++;
 
        if (dcmi->sd_format->fourcc == V4L2_PIX_FMT_JPEG &&
            dcmi->misr & IT_FRAME) {