diff options
author | Guennadi Liakhovetski <g.liakhovetski@gmx.de> | 2009-02-23 16:12:58 +0100 |
---|---|---|
committer | Guennadi Liakhovetski <g.liakhovetski@gmx.de> | 2009-02-23 16:12:58 +0100 |
commit | 426a59d72f4443f7d8cb949a514b566bc0f64cad (patch) | |
tree | 77d0072e1c79e3c784be9ae151af5fb1526f0f60 /linux/drivers/media/video/sh_mobile_ceu_camera.c | |
parent | 64c5c0e18bea0815ea7a971107b21a6c606bad77 (diff) | |
download | mediapointer-dvb-s2-426a59d72f4443f7d8cb949a514b566bc0f64cad.tar.gz mediapointer-dvb-s2-426a59d72f4443f7d8cb949a514b566bc0f64cad.tar.bz2 |
sh_mobile_ceu_camera: include NV* formats into the format list only once.
From: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
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>
---
drivers/media/video/sh_mobile_ceu_camera.c | 19 +++++++++++++++++++
1 files changed, 19 insertions(+), 0 deletions(-)
Diffstat (limited to 'linux/drivers/media/video/sh_mobile_ceu_camera.c')
-rw-r--r-- | linux/drivers/media/video/sh_mobile_ceu_camera.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/linux/drivers/media/video/sh_mobile_ceu_camera.c b/linux/drivers/media/video/sh_mobile_ceu_camera.c index 19b04bfa4..29ff02802 100644 --- a/linux/drivers/media/video/sh_mobile_ceu_camera.c +++ b/linux/drivers/media/video/sh_mobile_ceu_camera.c @@ -587,11 +587,29 @@ static int sh_mobile_ceu_get_formats(struct soc_camera_device *icd, int idx, if (ret < 0) return 0; + /* Beginning of a pass */ + if (!idx) + icd->host_priv = NULL; + switch (icd->formats[idx].fourcc) { case V4L2_PIX_FMT_UYVY: case V4L2_PIX_FMT_VYUY: case V4L2_PIX_FMT_YUYV: case V4L2_PIX_FMT_YVYU: + if (icd->host_priv) + goto add_single_format; + + /* + * Our case is simple so far: for any of the above four camera + * formats we add all our four synthesized NV* formats, so, + * just marking the device with a single flag suffices. If + * the format generation rules are more complex, you would have + * to actually hang your already added / counted formats onto + * the host_priv pointer and check whether the format you're + * going to add now is already there. + */ + icd->host_priv = (void *)sh_mobile_ceu_formats; + n = ARRAY_SIZE(sh_mobile_ceu_formats); formats += n; for (k = 0; xlate && k < n; k++) { @@ -604,6 +622,7 @@ static int sh_mobile_ceu_get_formats(struct soc_camera_device *icd, int idx, icd->formats[idx].name); } default: +add_single_format: /* Generic pass-through */ formats++; if (xlate) { |