Example #1
0
int fimc_hwset_output_size(struct fimc_control *ctrl, int width, int height)
{
	u32 cfg = readl(ctrl->regs + S3C_CITRGFMT);

	cfg &= ~(S3C_CITRGFMT_TARGETH_MASK | S3C_CITRGFMT_TARGETV_MASK);

	cfg |= S3C_CITRGFMT_TARGETHSIZE(width);
	cfg |= S3C_CITRGFMT_TARGETVSIZE(height);

	writel(cfg, ctrl->regs + S3C_CITRGFMT);

	return 0;
}
Example #2
0
void s3c_fimc_set_target_format(struct s3c_fimc_control *ctrl)
{
	struct s3c_fimc_out_frame *frame = &ctrl->out_frame;
	u32 cfg = 0;

	switch (frame->format) {
	case FORMAT_RGB565: /* fall through */
	case FORMAT_RGB666: /* fall through */
	case FORMAT_RGB888:
		cfg |= S3C_CITRGFMT_OUTFORMAT_RGB;
		break;

	case FORMAT_YCBCR420:
		cfg |= S3C_CITRGFMT_OUTFORMAT_YCBCR420;
		break;

	case FORMAT_YCBCR422:
		if (frame->planes == 1)
			cfg |= S3C_CITRGFMT_OUTFORMAT_YCBCR422_1PLANE;
		else
			cfg |= S3C_CITRGFMT_OUTFORMAT_YCBCR422;

		break;
	}

	cfg |= S3C_CITRGFMT_TARGETHSIZE(frame->width);
	cfg |= S3C_CITRGFMT_TARGETVSIZE(frame->height);
	cfg |= (frame->flip << S3C_CITRGFMT_FLIP_SHIFT);

	writel(cfg, ctrl->regs + S3C_CITRGFMT);

	if (ctrl->rot90)
		s3c_fimc_set_rot90(ctrl);

	cfg = S3C_CITAREA_TARGET_AREA(frame->width * frame->height);
	writel(cfg, ctrl->regs + S3C_CITAREA);
}