Planar formats with the u and v planes swapped can be
supported by swapping the address of the cb and cr buffers.
Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
                        rkisp1_pixfmt_comp_size(pixm, RKISP1_PLANE_CB);
        }
 
+       /*
+        * uv swap can be supported for planar formats by switching
+        * the address of cb and cr
+        */
+       if (cap->pix.info->comp_planes == 3 && cap->pix.cfg->uv_swap)
+               swap(ispbuf->buff_addr[RKISP1_PLANE_CR],
+                    ispbuf->buff_addr[RKISP1_PLANE_CB]);
+
        spin_lock_irqsave(&cap->buf.lock, flags);
 
        /*