sh_mobile_ceu_camera: NV12/21/16/61 are added only once.
Commit Message
NV12/21/16/61 had been added every time
UYVY/VYUY/YUYV/YVYU appears on get_formats.
This patch modify this problem.
Signed-off-by: Kuninori Morimoto <morimoto.kuninori@renesas.com>
---
[before]
Format NV12 (12 bits, NV12): Planar NV12
Format NV21 (12 bits, NV21): Planar NV21
Format unknown (0x3631564e) ( 0 bits, NV16): Unknown 0x3631564e
Format unknown (0x3136564e) ( 0 bits, NV61): Unknown 0x3136564e
Format YUYV (16 bits, YUYV): Packed YUY2
Format NV12 (12 bits, NV12): Planar NV12
Format NV21 (12 bits, NV21): Planar NV21
Format unknown (0x3631564e) ( 0 bits, NV16): Unknown 0x3631564e
Format unknown (0x3136564e) ( 0 bits, NV61): Unknown 0x3136564e
Format unknown (0x55595659) ( 0 bits, YVYU): Packed YVYU
Format NV12 (12 bits, NV12): Planar NV12
Format NV21 (12 bits, NV21): Planar NV21
Format unknown (0x3631564e) ( 0 bits, NV16): Unknown 0x3631564e
Format unknown (0x3136564e) ( 0 bits, NV61): Unknown 0x3136564e
Format UYVY (16 bits, UYVY): Packed UYVY
Format RGB555 (16 bits, RGB555): BGR 15-bit
Format RGB555X (16 bits, RGB555X): Unknown 0x51424752
Format RGB565 (16 bits, RGB565): BGR 16-bit
Format RGB565X (16 bits, RGB565X): Unknown 0x52424752
[after]
Format NV12 (12 bits, NV12): Planar NV12
Format NV21 (12 bits, NV21): Planar NV21
Format unknown (0x3631564e) ( 0 bits, NV16): Unknown 0x3631564e
Format unknown (0x3136564e) ( 0 bits, NV61): Unknown 0x3136564e
Format YUYV (16 bits, YUYV): Packed YUY2
Format unknown (0x55595659) ( 0 bits, YVYU): Packed YVYU
Format UYVY (16 bits, UYVY): Packed UYVY
Format RGB555 (16 bits, RGB555): BGR 15-bit
Format RGB555X (16 bits, RGB555X): Unknown 0x51424752
Format RGB565 (16 bits, RGB565): BGR 16-bit
Format RGB565X (16 bits, RGB565X): Unknown 0x52424752
drivers/media/video/sh_mobile_ceu_camera.c | 64 ++++++++++++++++------------
1 files changed, 36 insertions(+), 28 deletions(-)
Comments
On Fri, Jan 23, 2009 at 9:28 AM, Kuninori Morimoto
<morimoto.kuninori@renesas.com> wrote:
> NV12/21/16/61 had been added every time
> UYVY/VYUY/YUYV/YVYU appears on get_formats.
> This patch modify this problem.
That's one way to do it. Every similar driver has to do the same thing. Yuck.
Or we could have a better translation framework that does OR for us,
using for instance bitmaps.
/ magnus
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
@@ -555,42 +555,50 @@ static int sh_mobile_ceu_get_formats(struct soc_camera_device *icd, int idx,
struct soc_camera_format_xlate *xlate)
{
struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
- int ret, k, n;
+ int ret, i, k, n;
int formats = 0;
ret = sh_mobile_ceu_try_bus_param(icd);
if (ret < 0)
return 0;
- 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:
- n = ARRAY_SIZE(sh_mobile_ceu_formats);
- formats += n;
- for (k = 0; xlate && k < n; k++) {
- xlate->host_fmt = &sh_mobile_ceu_formats[k];
- xlate->cam_fmt = icd->formats + idx;
- xlate->buswidth = icd->formats[idx].depth;
- xlate++;
- dev_dbg(&ici->dev, "Providing format %s using %s\n",
- sh_mobile_ceu_formats[k].name,
- icd->formats[idx].name);
- }
- default:
- /* Generic pass-through */
- formats++;
- if (xlate) {
- xlate->host_fmt = icd->formats + idx;
- xlate->cam_fmt = icd->formats + idx;
- xlate->buswidth = icd->formats[idx].depth;
- xlate++;
- dev_dbg(&ici->dev,
- "Providing format %s in pass-through mode\n",
- icd->formats[idx].name);
+ /* yuv color format check when idx == 0 */
+ if (idx)
+ goto yuv_check_done;
+
+ for (i = 0 ; i < icd->num_formats ; i++) {
+ switch (icd->formats[i].fourcc) {
+ case V4L2_PIX_FMT_UYVY:
+ case V4L2_PIX_FMT_VYUY:
+ case V4L2_PIX_FMT_YUYV:
+ case V4L2_PIX_FMT_YVYU:
+ n = ARRAY_SIZE(sh_mobile_ceu_formats);
+ formats += n;
+ for (k = 0; xlate && k < n; k++) {
+ xlate->host_fmt = &sh_mobile_ceu_formats[k];
+ xlate->cam_fmt = icd->formats + i;
+ xlate->buswidth = icd->formats[i].depth;
+ xlate++;
+ dev_dbg(&ici->dev,
+ "Providing format %s using %s\n",
+ sh_mobile_ceu_formats[k].name,
+ icd->formats[i].name);
+ }
+ goto yuv_check_done;
}
}
+yuv_check_done:
+
+ formats++;
+ if (xlate) {
+ xlate->host_fmt = icd->formats + idx;
+ xlate->cam_fmt = icd->formats + idx;
+ xlate->buswidth = icd->formats[idx].depth;
+ xlate++;
+ dev_dbg(&ici->dev,
+ "Providing format %s in pass-through mode\n",
+ icd->formats[idx].name);
+ }
return formats;
}