@@ -37,6 +37,10 @@
#define RKISP1_MIN_BUFFERS_NEEDED 3
+#define RKISP1_IS_SEMI_PLANAR(write_format) \
+ (((write_format) == RKISP1_MI_CTRL_MP_WRITE_YUV_SPLA) || \
+ ((write_format) == RKISP1_MI_CTRL_SP_WRITE_SPLA))
+
enum rkisp1_plane {
RKISP1_PLANE_Y = 0,
RKISP1_PLANE_CB = 1,
@@ -429,7 +433,8 @@ static void rkisp1_mp_config(struct rkisp1_capture *cap)
cap->config->mi.cr_size_init);
rkisp1_irq_frame_end_enable(cap);
- if (cap->pix.cfg->uv_swap) {
+ if (RKISP1_IS_SEMI_PLANAR(cap->pix.cfg->write_format) &&
+ cap->pix.cfg->uv_swap) {
reg = rkisp1_read(rkisp1, RKISP1_CIF_MI_XTD_FORMAT_CTRL);
reg = reg | RKISP1_CIF_MI_XTD_FMT_CTRL_MP_CB_CR_SWAP;
@@ -466,7 +471,8 @@ static void rkisp1_sp_config(struct rkisp1_capture *cap)
rkisp1_write(rkisp1, cap->sp_y_stride, RKISP1_CIF_MI_SP_Y_LLENGTH);
rkisp1_irq_frame_end_enable(cap);
- if (cap->pix.cfg->uv_swap) {
+ if (RKISP1_IS_SEMI_PLANAR(cap->pix.cfg->write_format) &&
+ cap->pix.cfg->uv_swap) {
u32 reg = rkisp1_read(rkisp1, RKISP1_CIF_MI_XTD_FORMAT_CTRL);
reg = reg | RKISP1_CIF_MI_XTD_FMT_CTRL_SP_CB_CR_SWAP;