bool s5p_vlayer_set_csc_coef(unsigned long buf_in)
{
	struct s5p_video_csc_coef *coef = (struct s5p_video_csc_coef *)buf_in;
	enum s5p_tv_vp_err verr;

	if (coef->csc_coeff < VPROC_CSC_Y2Y_COEF ||
		coef->csc_coeff > VPROC_CSC_CR2CR_COEF) {
		pr_err("%s::invalid csc_coeff(%d)\n",
			__func__, coef->csc_coeff);
		return false;
	}

	if (s5p_vlayer_wait_previous_update()) {
		pr_err("%s::s5p_vlayer_wait_previous_update() fail\n",
			__func__);
		return false;
	}

	verr = s5p_vp_init_csc_coef(coef->csc_coeff, coef->coeff);
	if (verr != VPROC_NO_ERROR) {
		pr_err("%s::s5p_vp_init_csc_coef() fail\n",
			__func__);
		return false;
	}

	verr = s5p_vp_update();
	if (verr != VPROC_NO_ERROR) {
		pr_err("%s::s5p_vp_update() fail\n", __func__);
		return false;
	}

	g_s5ptv_status.vl_csc_coef_default = false;

	return true;
}
bool s5p_vlayer_set_dest_position(unsigned long buf_in)
{
	u32 d_ox = 0;
	u32 d_oy = 0;
	struct s5p_img_offset *offset = (struct s5p_img_offset *)buf_in;
	enum s5p_tv_vp_err verr;

	g_s5ptv_status.vl_basic_param.dest_offset_x = offset->offset_x;
	g_s5ptv_status.vl_basic_param.dest_offset_y = offset->offset_y;
	s5p_vlayer_calc_inner_values();

	d_ox = g_s5ptv_status.vl_dest_offset_x;
	d_oy = g_s5ptv_status.vl_dest_offset_y;

	if (s5p_vlayer_wait_previous_update()) {
		pr_err("%s::s5p_vlayer_wait_previous_update() fail\n",
			__func__);
		return false;
	}

	s5p_vp_set_dest_position(d_ox, d_oy);

	verr = s5p_vp_update();
	if (verr != VPROC_NO_ERROR) {
		pr_err("%s::s5p_vp_update() fail\n", __func__);
		return false;
	}

	return true;
}
bool s5p_vlayer_set_img_size(unsigned long buf_in)
{
	struct s5p_img_size *size = (struct s5p_img_size *)buf_in;
	enum s5p_tv_vp_err verr;

	VLAYERPRINTK("()\n");

	g_s5ptv_status.vl_basic_param.img_width = size->img_width;
	g_s5ptv_status.vl_basic_param.img_height = size->img_height;

	if (s5p_vlayer_wait_previous_update()) {
		pr_err("%s::s5p_vlayer_wait_previous_update() fail\n",
			__func__);
		return false;
	}

	verr = s5p_vp_set_img_size(size->img_width, size->img_height);
	if (verr != VPROC_NO_ERROR) {
		pr_err("%s::s5p_vp_set_img_size() fail\n",
			__func__);
		return false;
	}

	verr = s5p_vp_update();
	if (verr != VPROC_NO_ERROR) {
		pr_err("%s::s5p_vp_update() fail\n", __func__);
		return false;
	}

	return true;
}
bool s5p_vlayer_set_src_position(unsigned long buf_in)
{
	struct s5p_img_offset *offset = (struct s5p_img_offset *)buf_in;
	enum s5p_tv_vp_err verr;

	g_s5ptv_status.vl_basic_param.src_offset_x = offset->offset_x;
	g_s5ptv_status.vl_basic_param.src_offset_y = offset->offset_y;
	s5p_vlayer_calc_inner_values();

	if (s5p_vlayer_wait_previous_update()) {
		pr_err("%s::s5p_vlayer_wait_previous_update() fail\n",
			__func__);
		return false;
	}

	s5p_vp_set_src_position(g_s5ptv_status.vl_src_offset_x,
				  g_s5ptv_status.vl_src_x_fact_step,
				  g_s5ptv_status.vl_src_offset_y);

	verr = s5p_vp_update();
	if (verr != VPROC_NO_ERROR) {
		pr_err("%s::s5p_vp_set_src_position() fail\n",
			__func__);
		return false;
	}

	return true;
}
/*
 * start  - start functions are only called under stopping video processor
 */
enum s5p_tv_vp_err s5p_vp_start(void)
{
	VPPRINTK("()\n");
	writel(VP_ON_ENABLE, g_vp_base + S5P_VP_ENABLE);

	return s5p_vp_update();
}
bool s5p_vlayer_set_bottom_address(unsigned long buf_in)
{
	u32 t_y_addr = 0;
	u32 t_c_addr = 0;
	u32 b_y_addr = 0;
	u32 b_c_addr = 0;

	u32 img_width = g_s5ptv_status.vl_basic_param.img_width;

	struct s5p_video_img_address *addr =
		(struct s5p_video_img_address *)buf_in;
	enum s5p_tv_vp_err verr;
	enum s5p_vp_src_color s_color = g_s5ptv_status.src_color;

	if (s_color == VPROC_SRC_COLOR_NV12IW) {
		g_s5ptv_status.vl_basic_param.top_y_address =
			addr->y_address - img_width;
		g_s5ptv_status.vl_basic_param.top_c_address =
			addr->c_address - img_width;
	}

	s5p_vlayer_calc_inner_values();

	t_y_addr = g_s5ptv_status.vl_top_y_address;
	t_c_addr = g_s5ptv_status.vl_top_c_address;
	b_y_addr = g_s5ptv_status.vl_bottom_y_address;
	b_c_addr = g_s5ptv_status.vl_bottom_c_address;

	if (s5p_vlayer_wait_previous_update()) {
		pr_err("%s::s5p_vlayer_wait_previous_update() fail\n",
			__func__);
		return false;
	}

	verr = s5p_vp_set_bottom_field_address(b_y_addr, b_c_addr);
	if (verr != VPROC_NO_ERROR) {
		pr_err("%s::s5p_vp_set_bottom_field_address() fail\n",
			__func__);
		return false;
	}

	if (g_s5ptv_status.src_color == VPROC_SRC_COLOR_NV12IW) {
		verr = s5p_vp_set_top_field_address(t_y_addr, t_c_addr);
		if (verr != VPROC_NO_ERROR) {
			pr_err("%s::s5p_vp_set_top_field_address() fail\n",
			__func__);
			return false;
		}
	}

	verr = s5p_vp_update();
	if (verr != VPROC_NO_ERROR) {
		pr_err("%s::s5p_vp_update() fail\n", __func__);
		return false;
	}

	return true;
}
示例#7
0
int s5p_vp_start(void)
{
	int error = 0;

	writel(S5P_VP_ENABLE_ON, vp_base + S5P_VP_ENABLE);

	error = s5p_vp_update();

	return error;
}
bool s5p_vlayer_set_top_address(unsigned long buf_in)
{
	u32 t_y_addr = 0;
	u32 t_c_addr = 0;
	u32 b_y_addr = 0;
	u32 b_c_addr = 0;

	struct s5p_video_img_address *addr =
		(struct s5p_video_img_address *)buf_in;
	enum s5p_tv_vp_err verr;

	g_s5ptv_status.vl_basic_param.top_y_address = addr->y_address;
	g_s5ptv_status.vl_basic_param.top_c_address = addr->c_address;

	s5p_vlayer_calc_inner_values();

	t_y_addr = g_s5ptv_status.vl_top_y_address;
	t_c_addr = g_s5ptv_status.vl_top_c_address;
	b_y_addr = g_s5ptv_status.vl_bottom_y_address;
	b_c_addr = g_s5ptv_status.vl_bottom_c_address;

	if (s5p_vlayer_wait_previous_update()) {
		pr_err("%s::s5p_vlayer_wait_previous_update() fail\n",
			__func__);
		return false;
	}

	verr = s5p_vp_set_top_field_address(t_y_addr, t_c_addr);
	if (verr != VPROC_NO_ERROR) {
		pr_err("%s::s5p_vp_set_top_field_address() fail\n", __func__);
		return false;
	}

	if (check_input_mode(g_s5ptv_status.src_color) == INTERLACED) {
		s5p_vp_set_field_id(g_s5ptv_status.field_id);
		verr = s5p_vp_set_bottom_field_address(b_y_addr, b_c_addr);
		if (verr != VPROC_NO_ERROR) {
			pr_err("%s::s5p_vp_set_bottom_field_address() fail\n", __func__);
			return false;
		}
	}

	verr = s5p_vp_update();
	if (verr != VPROC_NO_ERROR) {
		pr_err("%s::s5p_vp_update() fail\n", __func__);
		return false;
	}

	return true;
}
示例#9
0
int s5p_vp_stop(void)
{
	int error = 0;

	writel((readl(vp_base + S5P_VP_ENABLE) & ~S5P_VP_ENABLE_ON),
		vp_base + S5P_VP_ENABLE);

	error = s5p_vp_update();

	while (!(readl(vp_base + S5P_VP_ENABLE) & S5P_VP_ENABLE_OPERATING))
		msleep(1);

	return error;
}
bool s5p_vlayer_set_brightness_contrast_control(unsigned long buf_in)
{
	u32 intc;
	u32 slope;

	enum s5p_vp_line_eq eq_num;
	enum s5p_tv_vp_err verr;
	struct s5p_vl_bright_contrast_ctrl *ctrl =
		(struct s5p_vl_bright_contrast_ctrl *)buf_in;

	if (ctrl->eq_num > VProc_LINE_EQ_7 ||
		ctrl->eq_num < VProc_LINE_EQ_0) {
		pr_err("%s::invalid eq_num(%d)\n", __func__, ctrl->eq_num);
		return false;
	}

	memcpy((void *)&(g_s5ptv_status.vl_bc_control[ctrl->eq_num]),
		(const void *)ctrl, sizeof(struct s5p_vl_csc_ctrl));

	eq_num	= g_s5ptv_status.vl_bc_control[ctrl->eq_num].eq_num;
	intc	= g_s5ptv_status.vl_bc_control[ctrl->eq_num].intc;
	slope	= g_s5ptv_status.vl_bc_control[ctrl->eq_num].slope;

	if (s5p_vlayer_wait_previous_update()) {
		pr_err("%s::s5p_vlayer_wait_previous_update() fail\n",
			__func__);
		return false;
	}

	verr = s5p_vp_set_brightness_contrast_control(eq_num, intc, slope);
	if (verr != VPROC_NO_ERROR) {
		pr_err("%s::s5p_vp_set_brightness_contrast_control() fail\n",
			__func__);
		return false;
	}

	verr = s5p_vp_update();
	if (verr != VPROC_NO_ERROR) {
		pr_err("%s::s5p_vp_update() fail\n", __func__);
		return false;
	}
	return true;
}
bool s5p_vlayer_set_poly_filter_coef(unsigned long buf_in)
{
	struct s5p_video_poly_filter_coef *coef =
		(struct s5p_video_poly_filter_coef *)buf_in;
	enum s5p_tv_vp_err verr;

	if (coef->poly_coeff < VPROC_POLY8_Y0_LL ||
	    (coef->poly_coeff > VPROC_POLY8_Y3_HH &&
	     coef->poly_coeff < VPROC_POLY4_Y0_LL) ||
	    coef->poly_coeff > VPROC_POLY4_C1_HH) {
		pr_err("%s::invalid poly_coeff(%d)\n",
			__func__, coef->poly_coeff);
		return false;
	}

	if (s5p_vlayer_wait_previous_update()) {
		pr_err("%s::s5p_vlayer_wait_previous_update() fail\n",
			__func__);
		return false;
	}

	verr = s5p_vp_init_poly_filter_coef(coef->poly_coeff,
					coef->ch0, coef->ch1,
					coef->ch2, coef->ch3);
	if (verr != VPROC_NO_ERROR) {
		pr_err("%s::s5p_vp_init_poly_filter_coef() fail\n",
			__func__);
		return false;
	}

	verr = s5p_vp_update();
	if (verr != VPROC_NO_ERROR) {
		pr_err("%s::s5p_vp_update() fail\n", __func__);
		return false;
	}

	g_s5ptv_status.vl_poly_filter_default = false;

	return true;
}
bool s5p_vlayer_set_contrast(unsigned long buf_in)
{
	enum s5p_tv_vp_err verr;

	g_s5ptv_status.vl_contrast = (unsigned char)buf_in;

	if (s5p_vlayer_wait_previous_update()) {
		pr_err("%s::s5p_vlayer_wait_previous_update() fail\n",
			__func__);
		return false;
	}

	s5p_vp_set_contrast(g_s5ptv_status.vl_contrast);

	verr = s5p_vp_update();
	if (verr != VPROC_NO_ERROR) {
		pr_err("%s::s5p_vp_update() fail\n", __func__);
		return false;
	}

	return true;
}
bool s5p_vlayer_set_field_id(unsigned long buf_in)
{
	enum s5p_tv_vp_err verr;

	g_s5ptv_status.field_id = (enum s5p_vp_field)(buf_in);

	if (s5p_vlayer_wait_previous_update()) {
		pr_err("%s::s5p_vlayer_wait_previous_update() fail\n",
			__func__);
		return false;
	}

	s5p_vp_set_field_id(g_s5ptv_status.field_id);

	verr = s5p_vp_update();
	if (verr != VPROC_NO_ERROR) {
		pr_err("%s::s5p_vp_update() fail\n", __func__);
		return false;
	}

	return true;
}
bool s5p_vlayer_set_brightness(unsigned long buf_in)
{
	enum s5p_tv_vp_err verr;

	g_s5ptv_status.us_vl_brightness = (unsigned short)buf_in;

	if (s5p_vlayer_wait_previous_update()) {
		pr_err("%s::s5p_vlayer_wait_previous_update() fail\n",
			__func__);
		return false;
	}

	s5p_vp_set_brightness(g_s5ptv_status.us_vl_brightness);

	verr = s5p_vp_update();
	if (verr != VPROC_NO_ERROR) {
		pr_err("%s::s5p_vp_update() fail\n",
			__func__);
		return false;
	}

	return true;
}
/*
 * stop  - stop functions are only called under running video processor
 */
enum s5p_tv_vp_err s5p_vp_stop(void)
{
	enum s5p_tv_vp_err ret = VPROC_NO_ERROR;
	int time_out = HDMI_TIME_OUT;
	VPPRINTK("()\n");

	writel((readl(g_vp_base + S5P_VP_ENABLE) & ~VP_ON_ENABLE),
		g_vp_base + S5P_VP_ENABLE);

	ret = s5p_vp_update();

	while (!(readl(g_vp_base + S5P_VP_ENABLE) & VP_POWER_DOWN_RDY) && time_out) {
		msleep(1);
		time_out--;
	}

	if (time_out <= 0) {
		pr_err("readl S5P_VP_ENABLE for VP_POWER_DOWN_RDY fail\n");
		ret = S5P_TV_VP_ERR_INVALID_PARAM;
	}

	return ret;
}
bool s5p_vlayer_set_dest_size(unsigned long buf_in)
{
	u32 s_w = 0;
	u32 s_h = 0;
	u32 d_w = 0;
	u32 d_h = 0;
	bool ipc = false;

	struct s5p_img_size *size = (struct s5p_img_size *)buf_in;
	enum s5p_tv_vp_err verr;

	g_s5ptv_status.vl_basic_param.dest_width = size->img_width;
	g_s5ptv_status.vl_basic_param.dest_height = size->img_height;
	s5p_vlayer_calc_inner_values();

	s_w = g_s5ptv_status.vl_src_width;
	s_h = g_s5ptv_status.vl_src_height;
	d_w = g_s5ptv_status.vl_dest_width;
	d_h = g_s5ptv_status.vl_dest_height;
	ipc = g_s5ptv_status.vl2d_ipc;

	if (s5p_vlayer_wait_previous_update()) {
		pr_err("%s::s5p_vlayer_wait_previous_update() fail\n",
			__func__);
		return false;
	}

	s5p_vp_set_src_dest_size(s_w, s_h, d_w, d_h, ipc);

	verr = s5p_vp_update();
	if (verr != VPROC_NO_ERROR) {
		pr_err("%s::s5p_vp_update() fail\n", __func__);
		return false;
	}

	return true;
}