diff options
Diffstat (limited to 'drivers/media/video/pxa_camera.c')
-rw-r--r-- | drivers/media/video/pxa_camera.c | 54 |
1 files changed, 36 insertions, 18 deletions
diff --git a/drivers/media/video/pxa_camera.c b/drivers/media/video/pxa_camera.c index 4df09a693ec7..f063f5981f43 100644 --- a/drivers/media/video/pxa_camera.c +++ b/drivers/media/video/pxa_camera.c | |||
@@ -197,9 +197,11 @@ struct pxa_buffer { | |||
197 | 197 | ||
198 | struct pxa_camera_dev { | 198 | struct pxa_camera_dev { |
199 | struct soc_camera_host soc_host; | 199 | struct soc_camera_host soc_host; |
200 | /* PXA27x is only supposed to handle one camera on its Quick Capture | 200 | /* |
201 | * PXA27x is only supposed to handle one camera on its Quick Capture | ||
201 | * interface. If anyone ever builds hardware to enable more than | 202 | * interface. If anyone ever builds hardware to enable more than |
202 | * one camera, they will have to modify this driver too */ | 203 | * one camera, they will have to modify this driver too |
204 | */ | ||
203 | struct soc_camera_device *icd; | 205 | struct soc_camera_device *icd; |
204 | struct clk *clk; | 206 | struct clk *clk; |
205 | 207 | ||
@@ -267,8 +269,10 @@ static void free_buffer(struct videobuf_queue *vq, struct pxa_buffer *buf) | |||
267 | dev_dbg(icd->dev.parent, "%s (vb=0x%p) 0x%08lx %d\n", __func__, | 269 | dev_dbg(icd->dev.parent, "%s (vb=0x%p) 0x%08lx %d\n", __func__, |
268 | &buf->vb, buf->vb.baddr, buf->vb.bsize); | 270 | &buf->vb, buf->vb.baddr, buf->vb.bsize); |
269 | 271 | ||
270 | /* This waits until this buffer is out of danger, i.e., until it is no | 272 | /* |
271 | * longer in STATE_QUEUED or STATE_ACTIVE */ | 273 | * This waits until this buffer is out of danger, i.e., until it is no |
274 | * longer in STATE_QUEUED or STATE_ACTIVE | ||
275 | */ | ||
272 | videobuf_waiton(&buf->vb, 0, 0); | 276 | videobuf_waiton(&buf->vb, 0, 0); |
273 | videobuf_dma_unmap(vq, dma); | 277 | videobuf_dma_unmap(vq, dma); |
274 | videobuf_dma_free(dma); | 278 | videobuf_dma_free(dma); |
@@ -437,15 +441,19 @@ static int pxa_videobuf_prepare(struct videobuf_queue *vq, | |||
437 | WARN_ON(!list_empty(&vb->queue)); | 441 | WARN_ON(!list_empty(&vb->queue)); |
438 | 442 | ||
439 | #ifdef DEBUG | 443 | #ifdef DEBUG |
440 | /* This can be useful if you want to see if we actually fill | 444 | /* |
441 | * the buffer with something */ | 445 | * This can be useful if you want to see if we actually fill |
446 | * the buffer with something | ||
447 | */ | ||
442 | memset((void *)vb->baddr, 0xaa, vb->bsize); | 448 | memset((void *)vb->baddr, 0xaa, vb->bsize); |
443 | #endif | 449 | #endif |
444 | 450 | ||
445 | BUG_ON(NULL == icd->current_fmt); | 451 | BUG_ON(NULL == icd->current_fmt); |
446 | 452 | ||
447 | /* I think, in buf_prepare you only have to protect global data, | 453 | /* |
448 | * the actual buffer is yours */ | 454 | * I think, in buf_prepare you only have to protect global data, |
455 | * the actual buffer is yours | ||
456 | */ | ||
449 | buf->inwork = 1; | 457 | buf->inwork = 1; |
450 | 458 | ||
451 | if (buf->fmt != icd->current_fmt || | 459 | if (buf->fmt != icd->current_fmt || |
@@ -834,8 +842,10 @@ static void pxa_camera_init_videobuf(struct videobuf_queue *q, | |||
834 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 842 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); |
835 | struct pxa_camera_dev *pcdev = ici->priv; | 843 | struct pxa_camera_dev *pcdev = ici->priv; |
836 | 844 | ||
837 | /* We must pass NULL as dev pointer, then all pci_* dma operations | 845 | /* |
838 | * transform to normal dma_* ones. */ | 846 | * We must pass NULL as dev pointer, then all pci_* dma operations |
847 | * transform to normal dma_* ones. | ||
848 | */ | ||
839 | videobuf_queue_sg_init(q, &pxa_videobuf_ops, NULL, &pcdev->lock, | 849 | videobuf_queue_sg_init(q, &pxa_videobuf_ops, NULL, &pcdev->lock, |
840 | V4L2_BUF_TYPE_VIDEO_CAPTURE, V4L2_FIELD_NONE, | 850 | V4L2_BUF_TYPE_VIDEO_CAPTURE, V4L2_FIELD_NONE, |
841 | sizeof(struct pxa_buffer), icd); | 851 | sizeof(struct pxa_buffer), icd); |
@@ -1059,8 +1069,10 @@ static void pxa_camera_setup_cicr(struct soc_camera_device *icd, | |||
1059 | if (ret < 0) | 1069 | if (ret < 0) |
1060 | y_skip_top = 0; | 1070 | y_skip_top = 0; |
1061 | 1071 | ||
1062 | /* Datawidth is now guaranteed to be equal to one of the three values. | 1072 | /* |
1063 | * We fix bit-per-pixel equal to data-width... */ | 1073 | * Datawidth is now guaranteed to be equal to one of the three values. |
1074 | * We fix bit-per-pixel equal to data-width... | ||
1075 | */ | ||
1064 | switch (flags & SOCAM_DATAWIDTH_MASK) { | 1076 | switch (flags & SOCAM_DATAWIDTH_MASK) { |
1065 | case SOCAM_DATAWIDTH_10: | 1077 | case SOCAM_DATAWIDTH_10: |
1066 | dw = 4; | 1078 | dw = 4; |
@@ -1071,8 +1083,10 @@ static void pxa_camera_setup_cicr(struct soc_camera_device *icd, | |||
1071 | bpp = 0x20; | 1083 | bpp = 0x20; |
1072 | break; | 1084 | break; |
1073 | default: | 1085 | default: |
1074 | /* Actually it can only be 8 now, | 1086 | /* |
1075 | * default is just to silence compiler warnings */ | 1087 | * Actually it can only be 8 now, |
1088 | * default is just to silence compiler warnings | ||
1089 | */ | ||
1076 | case SOCAM_DATAWIDTH_8: | 1090 | case SOCAM_DATAWIDTH_8: |
1077 | dw = 2; | 1091 | dw = 2; |
1078 | bpp = 0; | 1092 | bpp = 0; |
@@ -1524,10 +1538,12 @@ static int pxa_camera_reqbufs(struct soc_camera_file *icf, | |||
1524 | { | 1538 | { |
1525 | int i; | 1539 | int i; |
1526 | 1540 | ||
1527 | /* This is for locking debugging only. I removed spinlocks and now I | 1541 | /* |
1542 | * This is for locking debugging only. I removed spinlocks and now I | ||
1528 | * check whether .prepare is ever called on a linked buffer, or whether | 1543 | * check whether .prepare is ever called on a linked buffer, or whether |
1529 | * a dma IRQ can occur for an in-work or unlinked buffer. Until now | 1544 | * a dma IRQ can occur for an in-work or unlinked buffer. Until now |
1530 | * it hadn't triggered */ | 1545 | * it hadn't triggered |
1546 | */ | ||
1531 | for (i = 0; i < p->count; i++) { | 1547 | for (i = 0; i < p->count; i++) { |
1532 | struct pxa_buffer *buf = container_of(icf->vb_vidq.bufs[i], | 1548 | struct pxa_buffer *buf = container_of(icf->vb_vidq.bufs[i], |
1533 | struct pxa_buffer, vb); | 1549 | struct pxa_buffer, vb); |
@@ -1662,8 +1678,10 @@ static int __devinit pxa_camera_probe(struct platform_device *pdev) | |||
1662 | pcdev->platform_flags = pcdev->pdata->flags; | 1678 | pcdev->platform_flags = pcdev->pdata->flags; |
1663 | if (!(pcdev->platform_flags & (PXA_CAMERA_DATAWIDTH_8 | | 1679 | if (!(pcdev->platform_flags & (PXA_CAMERA_DATAWIDTH_8 | |
1664 | PXA_CAMERA_DATAWIDTH_9 | PXA_CAMERA_DATAWIDTH_10))) { | 1680 | PXA_CAMERA_DATAWIDTH_9 | PXA_CAMERA_DATAWIDTH_10))) { |
1665 | /* Platform hasn't set available data widths. This is bad. | 1681 | /* |
1666 | * Warn and use a default. */ | 1682 | * Platform hasn't set available data widths. This is bad. |
1683 | * Warn and use a default. | ||
1684 | */ | ||
1667 | dev_warn(&pdev->dev, "WARNING! Platform hasn't set available " | 1685 | dev_warn(&pdev->dev, "WARNING! Platform hasn't set available " |
1668 | "data widths, using default 10 bit\n"); | 1686 | "data widths, using default 10 bit\n"); |
1669 | pcdev->platform_flags |= PXA_CAMERA_DATAWIDTH_10; | 1687 | pcdev->platform_flags |= PXA_CAMERA_DATAWIDTH_10; |