return 2 << 24; /* default: YUV422 */
}
-void smfc_hwconfigure_2nd_image(struct smfc_ctx *ctx)
+void smfc_hwconfigure_2nd_image(struct smfc_ctx *ctx, bool hwfc_enabled)
{
struct vb2_buffer *vb2buf_img, *vb2buf_jpg;
u32 format;
*/
smfc_hwconfigure_jpeg_base(ctx, vb2buf_jpg, true);
+ format = ctx->img_fmt->regcfg;
/*
* Chroma subsampling is always 1/2 for both of horizontal and vertical
- * directions to reduce the compressed size of the secondary image
+ * directions to reduce the compressed size of the secondary image.
+ * If HWFC is enabled, the chroma subsampling is not allowed.
*/
- format = ctx->img_fmt->regcfg | smfc_get_jpeg_format(2, 2);
+ if (hwfc_enabled)
+ format |= smfc_get_jpeg_format(ctx->img_fmt->chroma_hfactor,
+ ctx->img_fmt->chroma_vfactor);
+ else
+ format |= smfc_get_jpeg_format(2, 2);
+
__raw_writel(format, ctx->smfc->reg + REG_SEC_IMAGE_FORMAT);
}
if (!!(ctx->flags & SMFC_CTX_B2B_COMPRESS) &&
!!(ctx->flags & SMFC_CTX_COMPRESS)) {
smfc_hwconfigure_2nd_tables(ctx, thumb_quality_factor);
- smfc_hwconfigure_2nd_image(ctx);
+ smfc_hwconfigure_2nd_image(ctx, !!enable_hwfc);
}
spin_lock_irqsave(&ctx->smfc->flag_lock, flags);
void smfc_hwconfigure_start(struct smfc_ctx *ctx,
unsigned int rst_int, bool hwfc_en);
void smfc_hwconfigure_2nd_tables(struct smfc_ctx *ctx, unsigned int qfactor);
-void smfc_hwconfigure_2nd_image(struct smfc_ctx *ctx);
+void smfc_hwconfigure_2nd_image(struct smfc_ctx *ctx, bool hwfc_enabled);
bool smfc_hwstatus_okay(struct smfc_dev *smfc, struct smfc_ctx *ctx);
void smfc_hwconfigure_reset(struct smfc_dev *smfc);
void smfc_dump_registers(struct smfc_dev *smfc);