* [PATCH 0/5] OMAP4 ISS: Miscellaneous fixes and improvements
@ 2014-06-06 15:21 Laurent Pinchart
2014-06-06 15:21 ` [PATCH 1/5] v4l: omap4iss: Don't reinitialize the video qlock at every streamon Laurent Pinchart
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Laurent Pinchart @ 2014-06-06 15:21 UTC (permalink / raw)
To: linux-media
Hello,
This patch set brings miscellaneous fixes and improvements to the OMAP4 ISS
driver. Please see individual patches for details.
Patch 4/5 depends on the "vb2: Report POLLERR for fatal errors only" patch
series posted to the linux-media mailing list.
I plan to send a pull request that will include both series.
Laurent Pinchart (5):
v4l: omap4iss: Don't reinitialize the video qlock at every streamon
v4l: omap4iss: Add module debug parameter
v4l: omap4iss: Use the devm_* managed allocators
v4l: omap4iss: Signal fatal errors to the vb2 queue
MAINTAINERS: Add the OMAP4 ISS driver
MAINTAINERS | 3 +-
drivers/staging/media/omap4iss/iss.c | 84 +++---------------------------
drivers/staging/media/omap4iss/iss_video.c | 22 ++++----
3 files changed, 22 insertions(+), 87 deletions(-)
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/5] v4l: omap4iss: Don't reinitialize the video qlock at every streamon
2014-06-06 15:21 [PATCH 0/5] OMAP4 ISS: Miscellaneous fixes and improvements Laurent Pinchart
@ 2014-06-06 15:21 ` Laurent Pinchart
2014-06-06 15:21 ` [PATCH 2/5] v4l: omap4iss: Add module debug parameter Laurent Pinchart
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Laurent Pinchart @ 2014-06-06 15:21 UTC (permalink / raw)
To: linux-media
Initialize the spin lock once only when initializing the video object.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
drivers/staging/media/omap4iss/iss_video.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/media/omap4iss/iss_video.c b/drivers/staging/media/omap4iss/iss_video.c
index ded31ea..7aded26 100644
--- a/drivers/staging/media/omap4iss/iss_video.c
+++ b/drivers/staging/media/omap4iss/iss_video.c
@@ -895,7 +895,6 @@ iss_video_streamon(struct file *file, void *fh, enum v4l2_buf_type type)
video->queue = &vfh->queue;
INIT_LIST_HEAD(&video->dmaqueue);
- spin_lock_init(&video->qlock);
video->error = false;
atomic_set(&pipe->frame_number, -1);
@@ -1175,6 +1174,7 @@ int omap4iss_video_init(struct iss_video *video, const char *name)
if (ret < 0)
return ret;
+ spin_lock_init(&video->qlock);
mutex_init(&video->mutex);
atomic_set(&video->active, 0);
--
1.8.5.5
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/5] v4l: omap4iss: Add module debug parameter
2014-06-06 15:21 [PATCH 0/5] OMAP4 ISS: Miscellaneous fixes and improvements Laurent Pinchart
2014-06-06 15:21 ` [PATCH 1/5] v4l: omap4iss: Don't reinitialize the video qlock at every streamon Laurent Pinchart
@ 2014-06-06 15:21 ` Laurent Pinchart
2014-06-06 15:21 ` [PATCH 3/5] v4l: omap4iss: Use the devm_* managed allocators Laurent Pinchart
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Laurent Pinchart @ 2014-06-06 15:21 UTC (permalink / raw)
To: linux-media
The parameter is used to initialize the video node debug field and
activate the V4L debug infrastructure.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
drivers/staging/media/omap4iss/iss_video.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/staging/media/omap4iss/iss_video.c b/drivers/staging/media/omap4iss/iss_video.c
index 7aded26..a54ee8c 100644
--- a/drivers/staging/media/omap4iss/iss_video.c
+++ b/drivers/staging/media/omap4iss/iss_video.c
@@ -25,6 +25,9 @@
#include "iss_video.h"
#include "iss.h"
+static unsigned debug;
+module_param(debug, uint, 0644);
+MODULE_PARM_DESC(debug, "activates debug info");
/* -----------------------------------------------------------------------------
* Helper functions
@@ -1043,6 +1046,8 @@ static int iss_video_open(struct file *file)
if (handle == NULL)
return -ENOMEM;
+ video->video.debug = debug;
+
v4l2_fh_init(&handle->vfh, &video->video);
v4l2_fh_add(&handle->vfh);
--
1.8.5.5
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/5] v4l: omap4iss: Use the devm_* managed allocators
2014-06-06 15:21 [PATCH 0/5] OMAP4 ISS: Miscellaneous fixes and improvements Laurent Pinchart
2014-06-06 15:21 ` [PATCH 1/5] v4l: omap4iss: Don't reinitialize the video qlock at every streamon Laurent Pinchart
2014-06-06 15:21 ` [PATCH 2/5] v4l: omap4iss: Add module debug parameter Laurent Pinchart
@ 2014-06-06 15:21 ` Laurent Pinchart
2014-06-06 15:21 ` [PATCH 4/5] v4l: omap4iss: Signal fatal errors to the vb2 queue Laurent Pinchart
2014-06-06 15:21 ` [PATCH 5/5] MAINTAINERS: Add the OMAP4 ISS driver Laurent Pinchart
4 siblings, 0 replies; 6+ messages in thread
From: Laurent Pinchart @ 2014-06-06 15:21 UTC (permalink / raw)
To: linux-media
This simplifies remove and error code paths.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
drivers/staging/media/omap4iss/iss.c | 84 ++++--------------------------------
1 file changed, 8 insertions(+), 76 deletions(-)
diff --git a/drivers/staging/media/omap4iss/iss.c b/drivers/staging/media/omap4iss/iss.c
index 4a9e444..d548371 100644
--- a/drivers/staging/media/omap4iss/iss.c
+++ b/drivers/staging/media/omap4iss/iss.c
@@ -1003,32 +1003,17 @@ static void iss_disable_clocks(struct iss_device *iss)
clk_disable(iss->iss_fck);
}
-static void iss_put_clocks(struct iss_device *iss)
-{
- if (iss->iss_fck) {
- clk_put(iss->iss_fck);
- iss->iss_fck = NULL;
- }
-
- if (iss->iss_ctrlclk) {
- clk_put(iss->iss_ctrlclk);
- iss->iss_ctrlclk = NULL;
- }
-}
-
static int iss_get_clocks(struct iss_device *iss)
{
- iss->iss_fck = clk_get(iss->dev, "iss_fck");
+ iss->iss_fck = devm_clk_get(iss->dev, "iss_fck");
if (IS_ERR(iss->iss_fck)) {
dev_err(iss->dev, "Unable to get iss_fck clock info\n");
- iss_put_clocks(iss);
return PTR_ERR(iss->iss_fck);
}
- iss->iss_ctrlclk = clk_get(iss->dev, "iss_ctrlclk");
+ iss->iss_ctrlclk = devm_clk_get(iss->dev, "iss_ctrlclk");
if (IS_ERR(iss->iss_ctrlclk)) {
dev_err(iss->dev, "Unable to get iss_ctrlclk clock info\n");
- iss_put_clocks(iss);
return PTR_ERR(iss->iss_ctrlclk);
}
@@ -1104,29 +1089,11 @@ static int iss_map_mem_resource(struct platform_device *pdev,
{
struct resource *mem;
- /* request the mem region for the camera registers */
-
mem = platform_get_resource(pdev, IORESOURCE_MEM, res);
- if (!mem) {
- dev_err(iss->dev, "no mem resource?\n");
- return -ENODEV;
- }
-
- if (!request_mem_region(mem->start, resource_size(mem), pdev->name)) {
- dev_err(iss->dev,
- "cannot reserve camera register I/O region\n");
- return -ENODEV;
- }
- iss->res[res] = mem;
- /* map the region */
- iss->regs[res] = ioremap_nocache(mem->start, resource_size(mem));
- if (!iss->regs[res]) {
- dev_err(iss->dev, "cannot map camera register I/O region\n");
- return -ENODEV;
- }
+ iss->regs[res] = devm_ioremap_resource(iss->dev, mem);
- return 0;
+ return PTR_ERR_OR_ZERO(iss->regs[res]);
}
static void iss_unregister_entities(struct iss_device *iss)
@@ -1389,7 +1356,7 @@ static int iss_probe(struct platform_device *pdev)
if (pdata == NULL)
return -EINVAL;
- iss = kzalloc(sizeof(*iss), GFP_KERNEL);
+ iss = devm_kzalloc(&pdev->dev, sizeof(*iss), GFP_KERNEL);
if (!iss) {
dev_err(&pdev->dev, "Could not allocate memory\n");
return -ENOMEM;
@@ -1456,7 +1423,8 @@ static int iss_probe(struct platform_device *pdev)
goto error_iss;
}
- if (request_irq(iss->irq_num, iss_isr, IRQF_SHARED, "OMAP4 ISS", iss)) {
+ if (devm_request_irq(iss->dev, iss->irq_num, iss_isr, IRQF_SHARED,
+ "OMAP4 ISS", iss)) {
dev_err(iss->dev, "Unable to request IRQ\n");
ret = -EINVAL;
goto error_iss;
@@ -1465,7 +1433,7 @@ static int iss_probe(struct platform_device *pdev)
/* Entities */
ret = iss_initialize_modules(iss);
if (ret < 0)
- goto error_irq;
+ goto error_iss;
ret = iss_register_entities(iss);
if (ret < 0)
@@ -1477,29 +1445,12 @@ static int iss_probe(struct platform_device *pdev)
error_modules:
iss_cleanup_modules(iss);
-error_irq:
- free_irq(iss->irq_num, iss);
error_iss:
omap4iss_put(iss);
error:
- iss_put_clocks(iss);
-
- for (i = 0; i < OMAP4_ISS_MEM_LAST; i++) {
- if (iss->regs[i]) {
- iounmap(iss->regs[i]);
- iss->regs[i] = NULL;
- }
-
- if (iss->res[i]) {
- release_mem_region(iss->res[i]->start,
- resource_size(iss->res[i]));
- iss->res[i] = NULL;
- }
- }
platform_set_drvdata(pdev, NULL);
mutex_destroy(&iss->iss_mutex);
- kfree(iss);
return ret;
}
@@ -1507,29 +1458,10 @@ error:
static int iss_remove(struct platform_device *pdev)
{
struct iss_device *iss = platform_get_drvdata(pdev);
- unsigned int i;
iss_unregister_entities(iss);
iss_cleanup_modules(iss);
- free_irq(iss->irq_num, iss);
- iss_put_clocks(iss);
-
- for (i = 0; i < OMAP4_ISS_MEM_LAST; i++) {
- if (iss->regs[i]) {
- iounmap(iss->regs[i]);
- iss->regs[i] = NULL;
- }
-
- if (iss->res[i]) {
- release_mem_region(iss->res[i]->start,
- resource_size(iss->res[i]));
- iss->res[i] = NULL;
- }
- }
-
- kfree(iss);
-
return 0;
}
--
1.8.5.5
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 4/5] v4l: omap4iss: Signal fatal errors to the vb2 queue
2014-06-06 15:21 [PATCH 0/5] OMAP4 ISS: Miscellaneous fixes and improvements Laurent Pinchart
` (2 preceding siblings ...)
2014-06-06 15:21 ` [PATCH 3/5] v4l: omap4iss: Use the devm_* managed allocators Laurent Pinchart
@ 2014-06-06 15:21 ` Laurent Pinchart
2014-06-06 15:21 ` [PATCH 5/5] MAINTAINERS: Add the OMAP4 ISS driver Laurent Pinchart
4 siblings, 0 replies; 6+ messages in thread
From: Laurent Pinchart @ 2014-06-06 15:21 UTC (permalink / raw)
To: linux-media
When a fatal error occurs in the pipeline signal it to the vb2 queue
with a call to vb2_queue_error(). The queue will then take care to
return -EIO when preparing buffers, remove the driver-specific code that
now duplicates that check.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
drivers/staging/media/omap4iss/iss_video.c | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/drivers/staging/media/omap4iss/iss_video.c b/drivers/staging/media/omap4iss/iss_video.c
index a54ee8c..6dc6a45 100644
--- a/drivers/staging/media/omap4iss/iss_video.c
+++ b/drivers/staging/media/omap4iss/iss_video.c
@@ -331,15 +331,6 @@ static int iss_video_buf_prepare(struct vb2_buffer *vb)
if (vb2_plane_size(vb, 0) < size)
return -ENOBUFS;
- /* Refuse to prepare the buffer is the video node has registered an
- * error. We don't need to take any lock here as the operation is
- * inherently racy. The authoritative check will be performed in the
- * queue handler, which can't return an error, this check is just a best
- * effort to notify userspace as early as possible.
- */
- if (unlikely(video->error))
- return -EIO;
-
addr = vb2_dma_contig_plane_dma_addr(vb, 0);
if (!IS_ALIGNED(addr, 32)) {
dev_dbg(video->iss->dev,
@@ -363,6 +354,11 @@ static void iss_video_buf_queue(struct vb2_buffer *vb)
spin_lock_irqsave(&video->qlock, flags);
+ /* Mark the buffer is faulty and give it back to the queue immediately
+ * if the video node has registered an error. vb2 will perform the same
+ * check when preparing the buffer, but that is inherently racy, so we
+ * need to handle the race condition with an authoritative check here.
+ */
if (unlikely(video->error)) {
vb2_buffer_done(vb, VB2_BUF_STATE_ERROR);
spin_unlock_irqrestore(&video->qlock, flags);
@@ -513,6 +509,7 @@ void omap4iss_video_cancel_stream(struct iss_video *video)
vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR);
}
+ vb2_queue_error(video->queue);
video->error = true;
spin_unlock_irqrestore(&video->qlock, flags);
--
1.8.5.5
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 5/5] MAINTAINERS: Add the OMAP4 ISS driver
2014-06-06 15:21 [PATCH 0/5] OMAP4 ISS: Miscellaneous fixes and improvements Laurent Pinchart
` (3 preceding siblings ...)
2014-06-06 15:21 ` [PATCH 4/5] v4l: omap4iss: Signal fatal errors to the vb2 queue Laurent Pinchart
@ 2014-06-06 15:21 ` Laurent Pinchart
4 siblings, 0 replies; 6+ messages in thread
From: Laurent Pinchart @ 2014-06-06 15:21 UTC (permalink / raw)
To: linux-media
Update the OMAP Image Signal Processor entry to cover both the OMAP3 ISP
and OMAP4 ISS.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
MAINTAINERS | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/MAINTAINERS b/MAINTAINERS
index 6b7c633..6f2f537 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -6402,11 +6402,12 @@ L: linux-omap@vger.kernel.org
S: Maintained
F: arch/arm/mach-omap2/omap_hwmod_44xx_data.c
-OMAP IMAGE SIGNAL PROCESSOR (ISP)
+OMAP IMAGING SUBSYSTEM (OMAP3 ISP and OMAP4 ISS)
M: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
L: linux-media@vger.kernel.org
S: Maintained
F: drivers/media/platform/omap3isp/
+F: drivers/staging/media/omap4iss/
OMAP USB SUPPORT
M: Felipe Balbi <balbi@ti.com>
--
1.8.5.5
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-06-06 15:21 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-06 15:21 [PATCH 0/5] OMAP4 ISS: Miscellaneous fixes and improvements Laurent Pinchart
2014-06-06 15:21 ` [PATCH 1/5] v4l: omap4iss: Don't reinitialize the video qlock at every streamon Laurent Pinchart
2014-06-06 15:21 ` [PATCH 2/5] v4l: omap4iss: Add module debug parameter Laurent Pinchart
2014-06-06 15:21 ` [PATCH 3/5] v4l: omap4iss: Use the devm_* managed allocators Laurent Pinchart
2014-06-06 15:21 ` [PATCH 4/5] v4l: omap4iss: Signal fatal errors to the vb2 queue Laurent Pinchart
2014-06-06 15:21 ` [PATCH 5/5] MAINTAINERS: Add the OMAP4 ISS driver Laurent Pinchart
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).