aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video
diff options
context:
space:
mode:
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>2009-02-23 10:12:58 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-03-30 11:42:52 -0400
commitc8329accf7e75a8a8fbe4ad0a15a3eacf221f380 (patch)
treef888bf19b63daaefd65bdaf1eecad293dc5eda5f /drivers/media/video
parentc354b400c0eac1cc0009958754797538857ce640 (diff)
V4L/DVB (10672): sh_mobile_ceu_camera: include NV* formats into the format list only once.
Currently, if an soc-camera device, connected to the sh_mobile_ceu_camera camera host driver, supports several formats from the UYVY, VYUY, YUYV, YVYU set, the driver would add four NV* formats for each of them. This patch fixes this misbehaviour. Reported-by: Kuninori Morimoto <morimoto.kuninori@renesas.com> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video')
-rw-r--r--drivers/media/video/sh_mobile_ceu_camera.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/media/video/sh_mobile_ceu_camera.c b/drivers/media/video/sh_mobile_ceu_camera.c
index 8a1badba70f7..ed3bfc4cf9f9 100644
--- a/drivers/media/video/sh_mobile_ceu_camera.c
+++ b/drivers/media/video/sh_mobile_ceu_camera.c
@@ -586,11 +586,29 @@ static int sh_mobile_ceu_get_formats(struct soc_camera_device *icd, int idx,
586 if (ret < 0) 586 if (ret < 0)
587 return 0; 587 return 0;
588 588
589 /* Beginning of a pass */
590 if (!idx)
591 icd->host_priv = NULL;
592
589 switch (icd->formats[idx].fourcc) { 593 switch (icd->formats[idx].fourcc) {
590 case V4L2_PIX_FMT_UYVY: 594 case V4L2_PIX_FMT_UYVY:
591 case V4L2_PIX_FMT_VYUY: 595 case V4L2_PIX_FMT_VYUY:
592 case V4L2_PIX_FMT_YUYV: 596 case V4L2_PIX_FMT_YUYV:
593 case V4L2_PIX_FMT_YVYU: 597 case V4L2_PIX_FMT_YVYU:
598 if (icd->host_priv)
599 goto add_single_format;
600
601 /*
602 * Our case is simple so far: for any of the above four camera
603 * formats we add all our four synthesized NV* formats, so,
604 * just marking the device with a single flag suffices. If
605 * the format generation rules are more complex, you would have
606 * to actually hang your already added / counted formats onto
607 * the host_priv pointer and check whether the format you're
608 * going to add now is already there.
609 */
610 icd->host_priv = (void *)sh_mobile_ceu_formats;
611
594 n = ARRAY_SIZE(sh_mobile_ceu_formats); 612 n = ARRAY_SIZE(sh_mobile_ceu_formats);
595 formats += n; 613 formats += n;
596 for (k = 0; xlate && k < n; k++) { 614 for (k = 0; xlate && k < n; k++) {
@@ -603,6 +621,7 @@ static int sh_mobile_ceu_get_formats(struct soc_camera_device *icd, int idx,
603 icd->formats[idx].name); 621 icd->formats[idx].name);
604 } 622 }
605 default: 623 default:
624add_single_format:
606 /* Generic pass-through */ 625 /* Generic pass-through */
607 formats++; 626 formats++;
608 if (xlate) { 627 if (xlate) {