Exemple #1
0
static int gsc_capture_subdev_s_stream(struct v4l2_subdev *sd, int enable)
{
	struct gsc_dev *gsc = v4l2_get_subdevdata(sd);
	struct gsc_capture_device *cap = &gsc->cap;
	struct gsc_ctx *ctx = cap->ctx;

	if (enable) {
		gsc_dbg("start");
		gsc_hw_set_frm_done_irq_mask(gsc, false);
		gsc_hw_set_overflow_irq_mask(gsc, false);
		gsc_hw_set_one_frm_mode(gsc, false);
		gsc_hw_set_gsc_irq_enable(gsc, true);

		if (gsc->pipeline.disp) {
			gsc_hw_set_sysreg_writeback(gsc);
			gsc_hw_set_pixelasync_reset_wb(gsc);
		} else {
			gsc_hw_set_pxlasync_camif_lo_mask(gsc, true);
		}

		gsc_hw_set_input_path(ctx);
		gsc_hw_set_in_size(ctx);
		gsc_hw_set_in_image_format(ctx);
		gsc_hw_set_output_path(ctx);
		gsc_hw_set_out_size(ctx);
		gsc_hw_set_out_image_format(ctx);
		gsc_hw_set_global_alpha(ctx);

		gsc_capture_scaler_info(ctx);
		gsc_hw_set_prescaler(ctx);
		gsc_hw_set_mainscaler(ctx);
		gsc_hw_set_h_coef(ctx);
		gsc_hw_set_v_coef(ctx);

		set_bit(ST_CAPT_PEND, &gsc->state);

		gsc_hw_enable_control(gsc, true);
		set_bit(ST_CAPT_STREAM, &gsc->state);
	} else {
		gsc_dbg("stop");
	}

	return 0;
}
static int gsc_capture_subdev_s_stream(struct v4l2_subdev *sd, int enable)
{
	struct gsc_dev *gsc = v4l2_get_subdevdata(sd);
	struct gsc_capture_device *cap = &gsc->cap;
	struct gsc_ctx *ctx = cap->ctx;
	int ret;

	if (enable) {
		gsc_hw_set_local_src(gsc, true);
		gsc_hw_set_sysreg_writeback(gsc, true);
		gsc_hw_set_sw_reset(gsc);
		ret = gsc_wait_reset(gsc);
		if (ret < 0) {
			gsc_err("gscaler s/w reset timeout");
			return ret;
		}
		ret = gsc_set_scaler_info(ctx);
		if (ret) {
			gsc_err("Scaler setup error");
			return ret;
		}
		gsc_hw_set_output_buf_fixed(gsc);
		gsc_hw_set_output_buf_masking(gsc, 0, false);
		gsc_hw_set_frm_done_irq_mask(gsc, false);
		gsc_hw_set_deadlock_irq_mask(gsc, false);
		gsc_hw_set_read_slave_error_mask(gsc, false);
		gsc_hw_set_write_slave_error_mask(gsc, false);
		gsc_hw_set_overflow_irq_mask(gsc, true);
		gsc_hw_set_gsc_irq_enable(gsc, true);
		gsc_hw_set_one_frm_mode(gsc, true);
		gsc_hw_set_freerun_clock_mode(gsc, false);

		gsc_hw_set_input_path(ctx);
		gsc_hw_set_in_size(ctx);
		gsc_hw_set_in_image_format(ctx);

		gsc_hw_set_output_path(ctx);
		gsc_hw_set_out_size(ctx);
		gsc_hw_set_out_image_format(ctx);

		gsc_hw_set_prescaler(ctx);
		gsc_hw_set_mainscaler(ctx);
		gsc_hw_set_h_coef(ctx);
		gsc_hw_set_v_coef(ctx);

		gsc_hw_set_output_rotation(ctx);

		gsc_hw_set_global_alpha(ctx);
		if (is_rotation) {
			ret = gsc_check_rotation_size(ctx);
			if (ret < 0) {
				gsc_err("Scaler setup error");
				return ret;
			}
		}

		gsc_hw_set_for_wb(gsc);
		gsc_hw_set_lookup_table(gsc);
		gsc_hw_set_smart_if_con(gsc, true);
		gsc_hw_set_buscon_realtime(gsc);
		gsc_hw_set_qos_enable(gsc);
	}

	return 0;
}