How to control exposure via v4l2-ctl on IMX8MP(kerver version 5.10.72_2.2.1)

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to control exposure via v4l2-ctl on IMX8MP(kerver version 5.10.72_2.2.1)

1,383 Views
billpu
Contributor I

kerver version:5.10.72

platform:DART-MX8M-PLUS

Key driver file path:

L5.10.72_2.2.1\kernel-source\drivers\media\i2c\ov5640.c
	static int ov5640_s_ctrl(struct v4l2_ctrl *ctrl)
	{
		struct v4l2_subdev *sd = ctrl_to_sd(ctrl);
		struct ov5640_dev *sensor = to_ov5640_dev(sd);
		int ret;

		/* v4l2_ctrl_lock() locks our own mutex */

		/*
		 * If the device is not powered up by the host driver do
		 * not apply any controls to H/W at this time. Instead
		 * the controls will be restored right after power-up.
		 */
		if (sensor->power_count == 0)
			return 0;

		switch (ctrl->id) {
		case V4L2_CID_AUTOGAIN:
			ret = ov5640_set_ctrl_gain(sensor, ctrl->val);
			break;
		case V4L2_CID_EXPOSURE_AUTO:
			ret = ov5640_set_ctrl_exposure(sensor, ctrl->val);
			break;
		case V4L2_CID_AUTO_WHITE_BALANCE:
			ret = ov5640_set_ctrl_white_balance(sensor, ctrl->val);
			break;
		case V4L2_CID_HUE:
			ret = ov5640_set_ctrl_hue(sensor, ctrl->val);
			break;
		case V4L2_CID_CONTRAST:
			ret = ov5640_set_ctrl_contrast(sensor, ctrl->val);
			break;
		case V4L2_CID_SATURATION:
			ret = ov5640_set_ctrl_saturation(sensor, ctrl->val);
			break;
		case V4L2_CID_TEST_PATTERN:
			ret = ov5640_set_ctrl_test_pattern(sensor, ctrl->val);
			break;
		case V4L2_CID_POWER_LINE_FREQUENCY:
			ret = ov5640_set_ctrl_light_freq(sensor, ctrl->val);
			break;
		case V4L2_CID_HFLIP:
			ret = ov5640_set_ctrl_hflip(sensor, ctrl->val);
			break;
		case V4L2_CID_VFLIP:
			ret = ov5640_set_ctrl_vflip(sensor, ctrl->val);
			break;
		default:
			ret = -EINVAL;
			break;
		}

		return ret;
	}

L5.10.72_2.2.1\kernel-source\drivers\staging\media\imx\imx8-mipi-csi2-sam.c
L5.10.72_2.2.1\kernel-source\drivers\staging\media\imx\imx8-isi-cap.c
	static int mxc_isi_s_ctrl(struct v4l2_ctrl *ctrl)
	{
		struct mxc_isi_cap_dev *isi_cap = ctrl_to_isi_cap(ctrl);
		struct mxc_isi_dev *mxc_isi = mxc_isi_get_hostdata(isi_cap->pdev);
		unsigned long flags;

		dev_dbg(&isi_cap->pdev->dev, "%s\n", __func__);

		if (ctrl->flags & V4L2_CTRL_FLAG_INACTIVE)
			return 0;

		spin_lock_irqsave(&mxc_isi->slock, flags);

		switch (ctrl->id) {
		case V4L2_CID_HFLIP:
			if (ctrl->val < 0)
				return -EINVAL;
			mxc_isi->hflip = (ctrl->val > 0) ? 1 : 0;
			break;

		case V4L2_CID_VFLIP:
			if (ctrl->val < 0)
				return -EINVAL;
			mxc_isi->vflip = (ctrl->val > 0) ? 1 : 0;
			break;

		case V4L2_CID_ALPHA_COMPONENT:
			if (ctrl->val < 0 || ctrl->val > 255)
				return -EINVAL;
			mxc_isi->alpha = ctrl->val;
			mxc_isi->alphaen = 1;
			break;

		default:
			dev_err(&isi_cap->pdev->dev,
				"%s: Not support %d CID\n", __func__, ctrl->id);
			return -EINVAL;
		}

		spin_unlock_irqrestore(&mxc_isi->slock, flags);
		return 0;
	}

Message:

root@imx8mp-var-dart:~# v4l2-ctl --list-ctrls -d /dev/video1

User Controls

                horizontal_flip 0x00980914 (bool)   : default=0 value=0
                  vertical_flip 0x00980915 (bool)   : default=0 value=0
                alpha_component 0x00980929 (int)    : min=0 max=255 step=1 default=0 value=0

There is s_ctrl control in OV5640, but it does not seem to be registered, so usr v4l2-ctrl -list-ctrls are not enumerated, what should I do to make these commands work?

 

Labels (1)
0 Kudos
Reply
5 Replies

1,363 Views
Bio_TICFSL
NXP TechSupport
NXP TechSupport

Hello,

The ov5640, comes by default in the BSP, I guess this is due to your dartmodule or BSP.

 

Regards

0 Kudos
Reply

1,336 Views
billpu
Contributor I
Hi Bio_TICFSL,
Yes, I used dartmodule. What should I do?
0 Kudos
Reply

1,337 Views
billpu
Contributor I

Hi Bio_TICFSL,

Yes, I used dartmodule. What should I do?

 

0 Kudos
Reply

1,239 Views
Bio_TICFSL
NXP TechSupport
NXP TechSupport

You may contact the vendor.

regards

0 Kudos
Reply

1,160 Views
billpu
Contributor I

Okay.Thank you.

0 Kudos
Reply