[PATCH v3][for_v3.5] media: mx2_camera: Fix mbus format handling

javier Martin javier.martin at vista-silicon.com
Mon Jul 9 02:56:55 EDT 2012


On 6 July 2012 17:11, Guennadi Liakhovetski <g.liakhovetski at gmx.de> wrote:
> hmm... sorry again. It is my fault, that I left this patch without
> attention for full 5 weeks, but I still don't have a sufficiently good
> feeling about it. Look here:
>
> On Fri, 6 Jul 2012, Guennadi Liakhovetski wrote:
>
>> Hi Javier
>>
>> Thanks for the patch, and sorry for delay. I was away first 10 days of
>> June and still haven't come round to cleaning up my todo list since
>> then...
>>
>> On Fri, 1 Jun 2012, Javier Martin wrote:
>
> [snip]
>
>> > @@ -1024,14 +1039,28 @@ static int mx2_camera_set_bus_param(struct soc_camera_device *icd)
>> >             return ret;
>> >     }
>> >
>> > +   xlate = soc_camera_xlate_by_fourcc(icd, pixfmt);
>> > +   if (!xlate) {
>> > +           dev_warn(icd->parent, "Format %x not found\n", pixfmt);
>> > +           return -EINVAL;
>> > +   }
>> > +
>> > +   if (xlate->code == V4L2_MBUS_FMT_YUYV8_2X8) {
>> > +           csicr1 |= CSICR1_PACK_DIR;
>> > +           csicr1 &= ~CSICR1_SWAP16_EN;
>> > +           dev_dbg(icd->parent, "already yuyv format, don't convert\n");
>> > +   } else if (xlate->code == V4L2_MBUS_FMT_UYVY8_2X8) {
>> > +           csicr1 &= ~CSICR1_PACK_DIR;
>> > +           csicr1 |= CSICR1_SWAP16_EN;
>> > +           dev_dbg(icd->parent, "convert uyvy mbus format into yuyv\n");
>> > +   }
>
> This doesn't look right. From V4L2_MBUS_FMT_YUYV8_2X8 you can produce two
> output formats:
>
> V4L2_PIX_FMT_YUV420 and
> V4L2_PIX_FMT_YUYV
>
> For both of them you set CSICR1_PACK_DIR, which wasn't the default before?
> Next for V4L2_MBUS_FMT_UYVY8_2X8. From this one you can produce 3 formats:
>
> V4L2_PIX_FMT_YUV420,
> V4L2_PIX_FMT_YUYV and
> V4L2_PIX_FMT_UYVY
>
> For all 3 of them you now set CSICR1_SWAP16_EN. Are you sure all the above
> is correct?

No, there's just one thing wrong. With this patch, pass-through mode
for  V4L2_MBUS_FMT_UYVY8_2X8 won't work, since I always convert it to
YUYV.

Let me send a new version of the patch to address this problem.

Regards.
-- 
Javier Martin
Vista Silicon S.L.
CDTUC - FASE C - Oficina S-345
Avda de los Castros s/n
39005- Santander. Cantabria. Spain
+34 942 25 32 60
www.vista-silicon.com



More information about the linux-arm-kernel mailing list