Commit 51354cc3 authored by Magnus Damm's avatar Magnus Damm Committed by Mauro Carvalho Chehab

V4L/DVB (9244): video: improve sh_mobile_ceu buffer handling

This patch improves the buffer handling in the sh_mobile_ceu driver.

Instead of marking all queued buffers as VIDEOBUF_ACTIVE the code now
marks queued-but-not-active buffers as VIDEOBUF_QUEUED and buffers
involved in dma as VIDEOBUF_ACTIVE. The code is also updated with
code to cancel active buffers, thanks to Morimoto-san.
Tested-by: default avatarKuninori Morimoto <morimoto.kuninori@renesas.com>
Signed-off-by: default avatarMagnus Damm <damm@igel.co.jp>
Signed-off-by: default avatarGuennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 2c0a072e
...@@ -165,6 +165,7 @@ static void sh_mobile_ceu_capture(struct sh_mobile_ceu_dev *pcdev) ...@@ -165,6 +165,7 @@ static void sh_mobile_ceu_capture(struct sh_mobile_ceu_dev *pcdev)
ceu_write(pcdev, CETCR, 0x0317f313 ^ 0x10); ceu_write(pcdev, CETCR, 0x0317f313 ^ 0x10);
if (pcdev->active) { if (pcdev->active) {
pcdev->active->state = VIDEOBUF_ACTIVE;
ceu_write(pcdev, CDAYR, videobuf_to_dma_contig(pcdev->active)); ceu_write(pcdev, CDAYR, videobuf_to_dma_contig(pcdev->active));
ceu_write(pcdev, CAPSR, 0x1); /* start capture */ ceu_write(pcdev, CAPSR, 0x1); /* start capture */
} }
...@@ -236,7 +237,7 @@ static void sh_mobile_ceu_videobuf_queue(struct videobuf_queue *vq, ...@@ -236,7 +237,7 @@ static void sh_mobile_ceu_videobuf_queue(struct videobuf_queue *vq,
dev_dbg(&icd->dev, "%s (vb=0x%p) 0x%08lx %zd\n", __func__, dev_dbg(&icd->dev, "%s (vb=0x%p) 0x%08lx %zd\n", __func__,
vb, vb->baddr, vb->bsize); vb, vb->baddr, vb->bsize);
vb->state = VIDEOBUF_ACTIVE; vb->state = VIDEOBUF_QUEUED;
spin_lock_irqsave(&pcdev->lock, flags); spin_lock_irqsave(&pcdev->lock, flags);
list_add_tail(&vb->queue, &pcdev->capture); list_add_tail(&vb->queue, &pcdev->capture);
...@@ -323,12 +324,24 @@ static void sh_mobile_ceu_remove_device(struct soc_camera_device *icd) ...@@ -323,12 +324,24 @@ static void sh_mobile_ceu_remove_device(struct soc_camera_device *icd)
{ {
struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
struct sh_mobile_ceu_dev *pcdev = ici->priv; struct sh_mobile_ceu_dev *pcdev = ici->priv;
unsigned long flags;
BUG_ON(icd != pcdev->icd); BUG_ON(icd != pcdev->icd);
/* disable capture, disable interrupts */ /* disable capture, disable interrupts */
ceu_write(pcdev, CEIER, 0); ceu_write(pcdev, CEIER, 0);
ceu_write(pcdev, CAPSR, 1 << 16); /* reset */ ceu_write(pcdev, CAPSR, 1 << 16); /* reset */
/* make sure active buffer is canceled */
spin_lock_irqsave(&pcdev->lock, flags);
if (pcdev->active) {
list_del(&pcdev->active->queue);
pcdev->active->state = VIDEOBUF_ERROR;
wake_up_all(&pcdev->active->done);
pcdev->active = NULL;
}
spin_unlock_irqrestore(&pcdev->lock, flags);
icd->ops->release(icd); icd->ops->release(icd);
dev_info(&icd->dev, dev_info(&icd->dev,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment