Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 88365105 authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab
Browse files

[media] v4l2-ctrls: replace is_volatile with V4L2_CTRL_FLAG_VOLATILE



With the new flag there is no need anymore to have a separate is_volatile
field. Modify all users to use the new flag.

Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Acked-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 74a45790
Loading
Loading
Loading
Loading
+6 −7
Original line number Diff line number Diff line
@@ -285,11 +285,11 @@ implement g_volatile_ctrl like this:
Note that you use the 'new value' union as well in g_volatile_ctrl. In general
controls that need to implement g_volatile_ctrl are read-only controls.

To mark a control as volatile you have to set the is_volatile flag:
To mark a control as volatile you have to set V4L2_CTRL_FLAG_VOLATILE:

	ctrl = v4l2_ctrl_new_std(&sd->ctrl_handler, ...);
	if (ctrl)
		ctrl->is_volatile = 1;
		ctrl->flags |= V4L2_CTRL_FLAG_VOLATILE;

For try/s_ctrl the new values (i.e. as passed by the user) are filled in and
you can modify them in try_ctrl or set them in s_ctrl. The 'cur' union
@@ -367,8 +367,7 @@ Driver specific controls can be created using v4l2_ctrl_new_custom():
The last argument is the priv pointer which can be set to driver-specific
private data.

The v4l2_ctrl_config struct also has fields to set the is_private and is_volatile
flags.
The v4l2_ctrl_config struct also has a field to set the is_private flag.

If the name field is not set, then the framework will assume this is a standard
control and will fill in the name, type and flags fields accordingly.
@@ -506,8 +505,8 @@ operation should return the value that the hardware's automatic mode set up
automatically.

If the cluster is put in manual mode, then the manual controls should become
active again and the is_volatile flag should be ignored (so g_volatile_ctrl is
no longer called while in manual mode).
active again and V4L2_CTRL_FLAG_VOLATILE should be ignored (so g_volatile_ctrl
is no longer called while in manual mode).

Finally the V4L2_CTRL_FLAG_UPDATE should be set for the auto control since
changing that control affects the control flags of the manual controls.
@@ -520,7 +519,7 @@ void v4l2_ctrl_auto_cluster(unsigned ncontrols, struct v4l2_ctrl **controls,

The first two arguments are identical to v4l2_ctrl_cluster. The third argument
tells the framework which value switches the cluster into manual mode. The
last argument will optionally set the is_volatile flag for the non-auto controls.
last argument will optionally set V4L2_CTRL_FLAG_VOLATILE for the non-auto controls.

The first control of the cluster is assumed to be the 'auto' control.

+1 −1
Original line number Diff line number Diff line
@@ -2109,7 +2109,7 @@ static int __devinit wl1273_fm_radio_probe(struct platform_device *pdev)
				 V4L2_CID_TUNE_ANTENNA_CAPACITOR,
				 0, 255, 1, 255);
	if (ctrl)
		ctrl->is_volatile = 1;
		ctrl->flags |= V4L2_CTRL_FLAG_VOLATILE;

	if (radio->ctrl_handler.error) {
		r = radio->ctrl_handler.error;
+1 −1
Original line number Diff line number Diff line
@@ -559,7 +559,7 @@ int fm_v4l2_init_video_device(struct fmdev *fmdev, int radio_nr)
			255, 1, 255);

	if (ctrl)
		ctrl->is_volatile = 1;
		ctrl->flags |= V4L2_CTRL_FLAG_VOLATILE;

	return 0;
}
+1 −1
Original line number Diff line number Diff line
@@ -258,7 +258,7 @@ static int adp1653_init_controls(struct adp1653_flash *flash)
	if (flash->ctrls.error)
		return flash->ctrls.error;

	fault->is_volatile = 1;
	fault->flags |= V4L2_CTRL_FLAG_VOLATILE;

	flash->subdev.ctrl_handler = &flash->ctrls;
	return 0;
+5 −5
Original line number Diff line number Diff line
@@ -640,7 +640,7 @@ static int pwc_set_awb(struct pwc_device *pdev)
			return ret;

		/* Update val when coming from auto or going to a preset */
		if (pdev->red_balance->is_volatile ||
		if ((pdev->red_balance->flags & V4L2_CTRL_FLAG_VOLATILE) ||
		    pdev->auto_white_balance->val == awb_indoor ||
		    pdev->auto_white_balance->val == awb_outdoor ||
		    pdev->auto_white_balance->val == awb_fl) {
@@ -654,12 +654,12 @@ static int pwc_set_awb(struct pwc_device *pdev)
					&pdev->blue_balance->val);
		}
		if (pdev->auto_white_balance->val == awb_auto) {
			pdev->red_balance->is_volatile = true;
			pdev->blue_balance->is_volatile = true;
			pdev->red_balance->flags |= V4L2_CTRL_FLAG_VOLATILE;
			pdev->blue_balance->flags |= V4L2_CTRL_FLAG_VOLATILE;
			pdev->color_bal_valid = false; /* Force cache update */
		} else {
			pdev->red_balance->is_volatile = false;
			pdev->blue_balance->is_volatile = false;
			pdev->red_balance->flags &= ~V4L2_CTRL_FLAG_VOLATILE;
			pdev->blue_balance->flags &= ~V4L2_CTRL_FLAG_VOLATILE;
		}
	}

Loading