Project

General

Profile

Files » 210827_set_ctrls.patch

Lion Wang, 10/26/2021 03:52 PM

View differences:

src/kernel/linux/v4.4_mt8183/drivers/media/platform/mtk-camera/mtk_camera_drv.c (working copy)
321 321
	.stop_streaming		= vb2ops_camera_stop_streaming,
322 322
};
323 323

  
324
static int camera_set_ctrls(struct mtk_camera_ctx *ctx);
325

  
324 326
static struct mtk_camera_fmt *mtk_camera_find_format(struct v4l2_format *f)
325 327
{
326 328
	struct mtk_camera_fmt *fmt;
......
697 699

  
698 700
		mtk_camera_err("camera_set_format_mplane , SET_PARAM_FRAME_SIZE,format:%d",size[2]);
699 701
		camera_if_set_param(ctx, SET_PARAM_FRAME_SIZE, (void *)size);
702
		if (ctx->cam_if_rdy)
703
			camera_set_ctrls(ctx);
700 704
		ctx->state = MTK_STATE_INIT;
701 705
	} else
702 706
		mtk_camera_err("%s:[%d] state=(%x) invalid call",
......
1010 1014
#define V4L2_CID_CAMERA_HDR                           (V4L2_CID_USER_MTK_CAMERA_BASE + 11)
1011 1015
#define V4L2_CID_CAMERA_MULTI_OUTPUT_NUM              (V4L2_CID_USER_MTK_CAMERA_BASE + 12)
1012 1016

  
1013

  
1014 1017
static int camera_set_ctrl(struct mtk_camera_ctx *ctx, enum camera_set_param_type type, uint32_t value)
1015 1018
{
1016 1019
    int ret = 0;
......
1024 1027
	return ret;
1025 1028
}
1026 1029

  
1030
static int camera_set_ctrls(struct mtk_camera_ctx *ctx)
1031
{
1032
	int ret = 0;
1027 1033

  
1034
	camera_set_ctrl(ctx, SET_PARAM_BRIGHTNESS, ctx->ctrls.brightness->val);
1035
	camera_set_ctrl(ctx, SET_PARAM_CONTRAST, ctx->ctrls.contrast->val);
1036
	camera_set_ctrl(ctx, SET_PARAM_SATURATION, ctx->ctrls.saturation->val);
1037
	camera_set_ctrl(ctx, SET_PARAM_SHARPNESS, ctx->ctrls.sharpness->val);
1038
	camera_set_ctrl(ctx, SET_PARAM_HUE, ctx->ctrls.hue->val);
1039
	camera_set_ctrl(ctx, SET_PARAM_GAMMA, ctx->ctrls.gamma->val);
1040
	camera_set_ctrl(ctx, SET_PARAM_AUTO_WHITE_BALANCE, ctx->ctrls.auto_white_balance->val);
1041
	camera_set_ctrl(ctx, SET_PARAM_WHITE_BALANCE_TEMP, ctx->ctrls.white_balance_temperature->val);
1042
	camera_set_ctrl(ctx, SET_PARAM_EXPOSURE, ctx->ctrls.exposure->val);
1043
	camera_set_ctrl(ctx, SET_PARAM_POWER_LINE_FREQ, ctx->ctrls.power_line_frequency->val);
1044
	camera_set_ctrl(ctx, SET_PARAM_MIN_FPS, ctx->ctrls.min_fps->val);
1045
	camera_set_ctrl(ctx, SET_PARAM_MAX_FPS, ctx->ctrls.max_fps->val);
1046
	camera_set_ctrl(ctx, SET_PARAM_EXPOSURE_AUTO, ctx->ctrls.exposure_auto->val);
1047
	camera_set_ctrl(ctx, SET_PARAM_EXPOSURE_ABSOLUTE, ctx->ctrls.exposure_absolute->val);
1048
	camera_set_ctrl(ctx, SET_PARAM_FOCUS_AUTO, ctx->ctrls.focus_auto->val);
1049
	camera_set_ctrl(ctx, SET_PARAM_FOCUS_ABSOLUTE, ctx->ctrls.focus_absolute->val);
1050
	camera_set_ctrl(ctx, SET_PARAM_SENSOR_ORIENTATION, ctx->ctrls.sensor_orientation->val);
1051
	camera_set_ctrl(ctx, SET_PARAM_EXPOSURE_REGION_LEFT, ctx->ctrls.exposure_region_left->val);
1052
	camera_set_ctrl(ctx, SET_PARAM_EXPOSURE_REGION_TOP, ctx->ctrls.exposure_region_top->val);
1053
	camera_set_ctrl(ctx, SET_PARAM_EXPOSURE_REGION_RIGHT, ctx->ctrls.exposure_region_right->val);
1054
	camera_set_ctrl(ctx, SET_PARAM_EXPOSURE_REGION_BOTTOM, ctx->ctrls.exposure_region_bottom->val);
1055
	camera_set_ctrl(ctx, SET_PARAM_EXPOSURE_WEIGHT, ctx->ctrls.exposure_weight->val);
1056
	camera_set_ctrl(ctx, SET_PARAM_EXPOSURE_REGION_TRIGGER, ctx->ctrls.exposure_region_trigger->val);
1057
	camera_set_ctrl(ctx, SET_PARAM_ISO, ctx->ctrls.iso->val);
1058
	camera_set_ctrl(ctx, SET_PARAM_FRAME_DURATION, ctx->ctrls.frame_duration->val);
1059

  
1060
	return ret;
1061
}
1062

  
1028 1063
static int mtk_camera_s_ctrl(struct v4l2_ctrl *ctrl)
1029 1064
{
1030 1065
	struct mtk_camera_ctx *ctx = ctrl_to_ctx(ctrl);
(5-5/11)