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

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

[media] v4l2-ctrls: add a filter function to v4l2_ctrl_add_handler



With a filter function you can control more precisely which controls
are added. This is useful in particular for radio device nodes for
combined TV/Radio cards where you want to show just the radio-specific
controls and not controls like brightness.

Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent a4f64407
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -594,7 +594,11 @@ handler and finally add the first handler to the second. For example:
	v4l2_ctrl_new_std(&radio_ctrl_handler, &radio_ops, V4L2_CID_AUDIO_MUTE, ...);
	v4l2_ctrl_new_std(&video_ctrl_handler, &video_ops, V4L2_CID_BRIGHTNESS, ...);
	v4l2_ctrl_new_std(&video_ctrl_handler, &video_ops, V4L2_CID_CONTRAST, ...);
	v4l2_ctrl_add_handler(&video_ctrl_handler, &radio_ctrl_handler);
	v4l2_ctrl_add_handler(&video_ctrl_handler, &radio_ctrl_handler, NULL);

The last argument to v4l2_ctrl_add_handler() is a filter function that allows
you to filter which controls will be added. Set it to NULL if you want to add
all controls.

Or you can add specific controls to a handler:

+1 −1
Original line number Diff line number Diff line
@@ -1236,7 +1236,7 @@ static int cx8802_blackbird_probe(struct cx8802_driver *drv)
	err = cx2341x_handler_init(&dev->cxhdl, 36);
	if (err)
		goto fail_core;
	v4l2_ctrl_add_handler(&dev->cxhdl.hdl, &core->video_hdl);
	v4l2_ctrl_add_handler(&dev->cxhdl.hdl, &core->video_hdl, NULL);

	/* blackbird stuff */
	printk("%s/2: cx23416 based mpeg encoder (blackbird reference design)\n",
+1 −1
Original line number Diff line number Diff line
@@ -1795,7 +1795,7 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev,
		if (vc->id == V4L2_CID_CHROMA_AGC)
			core->chroma_agc = vc;
	}
	v4l2_ctrl_add_handler(&core->video_hdl, &core->audio_hdl);
	v4l2_ctrl_add_handler(&core->video_hdl, &core->audio_hdl, NULL);

	/* load and configure helper modules */

+1 −1
Original line number Diff line number Diff line
@@ -472,7 +472,7 @@ int fimc_capture_ctrls_create(struct fimc_dev *fimc)
		return ret;

	return v4l2_ctrl_add_handler(&vid_cap->ctx->ctrls.handler,
		    fimc->pipeline.subdevs[IDX_SENSOR]->ctrl_handler);
		    fimc->pipeline.subdevs[IDX_SENSOR]->ctrl_handler, NULL);
}

static int fimc_capture_set_default_format(struct fimc_dev *fimc);
+1 −1
Original line number Diff line number Diff line
@@ -1184,7 +1184,7 @@ static int soc_camera_probe(struct soc_camera_device *icd)
	sd->grp_id = soc_camera_grp_id(icd);
	v4l2_set_subdev_hostdata(sd, icd);

	if (v4l2_ctrl_add_handler(&icd->ctrl_handler, sd->ctrl_handler))
	if (v4l2_ctrl_add_handler(&icd->ctrl_handler, sd->ctrl_handler, NULL))
		goto ectrl;

	/* At this point client .probe() should have run already */
Loading