aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/video/cafe_ccic.c42
-rw-r--r--drivers/media/video/ov7670.c15
2 files changed, 3 insertions, 54 deletions
diff --git a/drivers/media/video/cafe_ccic.c b/drivers/media/video/cafe_ccic.c
index 30864dac26a3..9d9844e22951 100644
--- a/drivers/media/video/cafe_ccic.c
+++ b/drivers/media/video/cafe_ccic.c
@@ -612,16 +612,6 @@ static void cafe_ctlr_image(struct cafe_camera *cam)
612 C0_DF_MASK); 612 C0_DF_MASK);
613 break; 613 break;
614 614
615 /*
616 * For "fake rgb32" get the image pitch right.
617 */
618 case V4L2_PIX_FMT_RGB32:
619 cafe_reg_write_mask(cam, REG_IMGPITCH, fmt->bytesperline/2,
620 IMGP_YP_MASK);
621 imgsz = ((fmt->height << IMGSZ_V_SHIFT) & IMGSZ_V_MASK) |
622 ((fmt->bytesperline/2) & IMGSZ_H_MASK);
623 cafe_reg_write(cam, REG_IMGSIZE, imgsz);
624 /* fall into ... */
625 case V4L2_PIX_FMT_RGB444: 615 case V4L2_PIX_FMT_RGB444:
626 cafe_reg_write_mask(cam, REG_CTRL0, 616 cafe_reg_write_mask(cam, REG_CTRL0,
627 C0_DF_RGB|C0_RGBF_444|C0_RGB4_XRGB, 617 C0_DF_RGB|C0_RGBF_444|C0_RGB4_XRGB,
@@ -902,11 +892,8 @@ static int cafe_alloc_dma_bufs(struct cafe_camera *cam, int loadtime)
902 cafe_set_config_needed(cam, 1); 892 cafe_set_config_needed(cam, 1);
903 if (loadtime) 893 if (loadtime)
904 cam->dma_buf_size = dma_buf_size; 894 cam->dma_buf_size = dma_buf_size;
905 else { 895 else
906 cam->dma_buf_size = cam->pix_format.sizeimage; 896 cam->dma_buf_size = cam->pix_format.sizeimage;
907 if (cam->pix_format.pixelformat == V4L2_PIX_FMT_RGB32)
908 cam->dma_buf_size /= 2;
909 }
910 if (n_dma_bufs > 3) 897 if (n_dma_bufs > 3)
911 n_dma_bufs = 3; 898 n_dma_bufs = 3;
912 899
@@ -1751,26 +1738,6 @@ static struct video_device cafe_v4l_template = {
1751 * Interrupt handler stuff 1738 * Interrupt handler stuff
1752 */ 1739 */
1753 1740
1754/*
1755 * Create RGB32 from RGB444 so it can be displayed before the applications
1756 * know about the latter format.
1757 */
1758static void cafe_fake_rgb32(struct cafe_camera *cam, char *dest, char *src)
1759{
1760 int i;
1761 u16 *ssrc = (u16 *) src;
1762
1763 /* RGB444 version */
1764 for (i = 0; i < cam->pix_format.sizeimage; i += 4) {
1765 // dest[0] = (*ssrc & 0xf000) >> 8;
1766 dest[0] = (*ssrc & 0x000f) << 4;
1767 dest[1] = (*ssrc & 0x00f0);
1768 dest[2] = (*ssrc & 0x0f00) >> 4;
1769 dest[3] = (*ssrc & 0xf000); /* Alpha */
1770 dest += 4;
1771 ssrc++;
1772 }
1773}
1774 1741
1775 1742
1776static void cafe_frame_tasklet(unsigned long data) 1743static void cafe_frame_tasklet(unsigned long data)
@@ -1800,11 +1767,8 @@ static void cafe_frame_tasklet(unsigned long data)
1800 */ 1767 */
1801 sbuf = list_entry(cam->sb_avail.next, 1768 sbuf = list_entry(cam->sb_avail.next,
1802 struct cafe_sio_buffer, list); 1769 struct cafe_sio_buffer, list);
1803 if (cam->pix_format.pixelformat == V4L2_PIX_FMT_RGB32) 1770 memcpy(sbuf->buffer, cam->dma_bufs[bufno],
1804 cafe_fake_rgb32(cam, sbuf->buffer, cam->dma_bufs[bufno]); 1771 cam->pix_format.sizeimage);
1805 else
1806 memcpy(sbuf->buffer, cam->dma_bufs[bufno],
1807 cam->pix_format.sizeimage);
1808 sbuf->v4lbuf.bytesused = cam->pix_format.sizeimage; 1772 sbuf->v4lbuf.bytesused = cam->pix_format.sizeimage;
1809 sbuf->v4lbuf.sequence = cam->buf_seq[bufno]; 1773 sbuf->v4lbuf.sequence = cam->buf_seq[bufno];
1810 sbuf->v4lbuf.flags &= ~V4L2_BUF_FLAG_QUEUED; 1774 sbuf->v4lbuf.flags &= ~V4L2_BUF_FLAG_QUEUED;
diff --git a/drivers/media/video/ov7670.c b/drivers/media/video/ov7670.c
index b7d824ee03ea..7d380d76338a 100644
--- a/drivers/media/video/ov7670.c
+++ b/drivers/media/video/ov7670.c
@@ -497,19 +497,6 @@ static struct ov7670_format_struct {
497 .regs = ov7670_fmt_rgb565, 497 .regs = ov7670_fmt_rgb565,
498 .cmatrix = { 179, -179, 0, -61, -176, 228 }, 498 .cmatrix = { 179, -179, 0, -61, -176, 228 },
499 }, 499 },
500 /*
501 * Pretend we do RGB32. This is here on the assumption that the
502 * upper layer will reformat RGB444 appropriately.
503 *
504 * The entire purpose for this thing's existence is to enable easy
505 * display of RGB444 for debugging purposes. It will come out soon.
506 */
507 {
508 .desc = "RGB32 (faked)",
509 .pixelformat = V4L2_PIX_FMT_RGB32,
510 .regs = ov7670_fmt_rgb444,
511 .cmatrix = { 179, -179, 0, -61, -176, 228 },
512 },
513}; 500};
514#define N_OV7670_FMTS (sizeof(ov7670_formats)/sizeof(ov7670_formats[0])) 501#define N_OV7670_FMTS (sizeof(ov7670_formats)/sizeof(ov7670_formats[0]))
515 502
@@ -694,8 +681,6 @@ static int ov7670_try_fmt(struct i2c_client *c, struct v4l2_format *fmt,
694 pix->width = wsize->width; 681 pix->width = wsize->width;
695 pix->height = wsize->height; 682 pix->height = wsize->height;
696 pix->bytesperline = pix->width*BYTES_PER_PIXEL; 683 pix->bytesperline = pix->width*BYTES_PER_PIXEL;
697 if (pix->pixelformat == V4L2_PIX_FMT_RGB32)
698 pix->bytesperline *= 2;
699 pix->sizeimage = pix->height*pix->bytesperline; 684 pix->sizeimage = pix->height*pix->bytesperline;
700 return 0; 685 return 0;
701} 686}