2019-04-01 08:57:55

by Hugues Fruchet

[permalink] [raw]
Subject: [PATCH 0/2] Refine DCMI error messages

Cleanup and refine some DCMI error messages.

Hugues Fruchet (2):
media: stm32-dcmi: fix error messages
media: stm32-dcmi: do not emit error trace in case of few overrun

drivers/media/platform/stm32/stm32-dcmi.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)

--
2.7.4


2019-04-01 08:56:49

by Hugues Fruchet

[permalink] [raw]
Subject: [PATCH 2/2] media: stm32-dcmi: do not emit error trace in case of few overrun

Report overrun error only when it exceeds a given threshold.

Signed-off-by: Hugues Fruchet <[email protected]>
---
drivers/media/platform/stm32/stm32-dcmi.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/media/platform/stm32/stm32-dcmi.c b/drivers/media/platform/stm32/stm32-dcmi.c
index 693415c..b63d57c 100644
--- a/drivers/media/platform/stm32/stm32-dcmi.c
+++ b/drivers/media/platform/stm32/stm32-dcmi.c
@@ -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) {
--
2.7.4

2019-04-01 08:56:59

by Hugues Fruchet

[permalink] [raw]
Subject: [PATCH 1/2] media: stm32-dcmi: fix error messages

Revisit and add some error messages.

Signed-off-by: Hugues Fruchet <[email protected]>
---
drivers/media/platform/stm32/stm32-dcmi.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/stm32/stm32-dcmi.c b/drivers/media/platform/stm32/stm32-dcmi.c
index 098431d..693415c 100644
--- a/drivers/media/platform/stm32/stm32-dcmi.c
+++ b/drivers/media/platform/stm32/stm32-dcmi.c
@@ -1611,7 +1611,7 @@ static int dcmi_graph_init(struct stm32_dcmi *dcmi)
/* Parse the graph to extract a list of subdevice DT nodes. */
ret = dcmi_graph_parse(dcmi, dcmi->dev->of_node);
if (ret < 0) {
- dev_err(dcmi->dev, "Graph parsing failed\n");
+ dev_err(dcmi->dev, "Failed to parse graph\n");
return ret;
}

@@ -1620,6 +1620,7 @@ static int dcmi_graph_init(struct stm32_dcmi *dcmi)
ret = v4l2_async_notifier_add_subdev(&dcmi->notifier,
&dcmi->entity.asd);
if (ret) {
+ dev_err(dcmi->dev, "Failed to add subdev notifier\n");
of_node_put(dcmi->entity.node);
return ret;
}
@@ -1628,7 +1629,7 @@ static int dcmi_graph_init(struct stm32_dcmi *dcmi)

ret = v4l2_async_notifier_register(&dcmi->v4l2_dev, &dcmi->notifier);
if (ret < 0) {
- dev_err(dcmi->dev, "Notifier registration failed\n");
+ dev_err(dcmi->dev, "Failed to register notifier\n");
v4l2_async_notifier_cleanup(&dcmi->notifier);
return ret;
}
--
2.7.4