Lines Matching refs:vmux
56 struct video_mux *vmux = v4l2_subdev_to_video_mux(sd); in video_mux_link_setup() local
71 mutex_lock(&vmux->lock); in video_mux_link_setup()
74 if (vmux->active == local->index) in video_mux_link_setup()
77 if (vmux->active >= 0) { in video_mux_link_setup()
83 ret = mux_control_try_select(vmux->mux, local->index); in video_mux_link_setup()
86 vmux->active = local->index; in video_mux_link_setup()
89 vmux->format_mbus[source_pad] = vmux->format_mbus[vmux->active]; in video_mux_link_setup()
91 if (vmux->active != local->index) in video_mux_link_setup()
95 mux_control_deselect(vmux->mux); in video_mux_link_setup()
96 vmux->active = -1; in video_mux_link_setup()
100 mutex_unlock(&vmux->lock); in video_mux_link_setup()
112 struct video_mux *vmux = v4l2_subdev_to_video_mux(sd); in video_mux_s_stream() local
116 if (vmux->active == -1) { in video_mux_s_stream()
121 pad = media_entity_remote_pad(&sd->entity.pads[vmux->active]); in video_mux_s_stream()
146 struct video_mux *vmux = v4l2_subdev_to_video_mux(sd); in __video_mux_get_pad_format() local
152 return &vmux->format_mbus[pad]; in __video_mux_get_pad_format()
162 struct video_mux *vmux = v4l2_subdev_to_video_mux(sd); in video_mux_get_format() local
164 mutex_lock(&vmux->lock); in video_mux_get_format()
170 mutex_unlock(&vmux->lock); in video_mux_get_format()
179 struct video_mux *vmux = v4l2_subdev_to_video_mux(sd); in video_mux_set_format() local
181 struct media_pad *pad = &vmux->pads[sdformat->pad]; in video_mux_set_format()
297 mutex_lock(&vmux->lock); in video_mux_set_format()
300 if ((pad->flags & MEDIA_PAD_FL_SOURCE) && vmux->active >= 0) in video_mux_set_format()
301 sdformat->format = vmux->format_mbus[vmux->active]; in video_mux_set_format()
306 if ((pad->flags & MEDIA_PAD_FL_SINK) && (pad->index == vmux->active)) in video_mux_set_format()
309 mutex_unlock(&vmux->lock); in video_mux_set_format()
317 struct video_mux *vmux = v4l2_subdev_to_video_mux(sd); in video_mux_init_cfg() local
321 mutex_lock(&vmux->lock); in video_mux_init_cfg()
328 mutex_unlock(&vmux->lock); in video_mux_init_cfg()
348 struct video_mux *vmux = notifier_to_video_mux(notifier); in video_mux_notify_bound() local
350 return v4l2_create_fwnode_links(sd, &vmux->subdev); in video_mux_notify_bound()
357 static int video_mux_async_register(struct video_mux *vmux, in video_mux_async_register() argument
363 v4l2_async_nf_init(&vmux->notifier); in video_mux_async_register()
370 dev_fwnode(vmux->subdev.dev), i, 0, in video_mux_async_register()
383 asd = v4l2_async_nf_add_fwnode_remote(&vmux->notifier, ep, in video_mux_async_register()
396 vmux->notifier.ops = &video_mux_notify_ops; in video_mux_async_register()
398 ret = v4l2_async_subdev_nf_register(&vmux->subdev, &vmux->notifier); in video_mux_async_register()
402 return v4l2_async_register_subdev(&vmux->subdev); in video_mux_async_register()
410 struct video_mux *vmux; in video_mux_probe() local
415 vmux = devm_kzalloc(dev, sizeof(*vmux), GFP_KERNEL); in video_mux_probe()
416 if (!vmux) in video_mux_probe()
419 platform_set_drvdata(pdev, vmux); in video_mux_probe()
421 v4l2_subdev_init(&vmux->subdev, &video_mux_subdev_ops); in video_mux_probe()
422 snprintf(vmux->subdev.name, sizeof(vmux->subdev.name), "%pOFn", np); in video_mux_probe()
423 vmux->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; in video_mux_probe()
424 vmux->subdev.dev = dev; in video_mux_probe()
442 vmux->mux = devm_mux_control_get(dev, NULL); in video_mux_probe()
443 if (IS_ERR(vmux->mux)) { in video_mux_probe()
444 ret = PTR_ERR(vmux->mux); in video_mux_probe()
450 mutex_init(&vmux->lock); in video_mux_probe()
451 vmux->active = -1; in video_mux_probe()
452 vmux->pads = devm_kcalloc(dev, num_pads, sizeof(*vmux->pads), in video_mux_probe()
454 if (!vmux->pads) in video_mux_probe()
457 vmux->format_mbus = devm_kcalloc(dev, num_pads, in video_mux_probe()
458 sizeof(*vmux->format_mbus), in video_mux_probe()
460 if (!vmux->format_mbus) in video_mux_probe()
464 vmux->pads[i].flags = (i < num_pads - 1) ? MEDIA_PAD_FL_SINK in video_mux_probe()
466 vmux->format_mbus[i] = video_mux_format_mbus_default; in video_mux_probe()
469 vmux->subdev.entity.function = MEDIA_ENT_F_VID_MUX; in video_mux_probe()
470 ret = media_entity_pads_init(&vmux->subdev.entity, num_pads, in video_mux_probe()
471 vmux->pads); in video_mux_probe()
475 vmux->subdev.entity.ops = &video_mux_ops; in video_mux_probe()
477 ret = video_mux_async_register(vmux, num_pads - 1); in video_mux_probe()
479 v4l2_async_nf_unregister(&vmux->notifier); in video_mux_probe()
480 v4l2_async_nf_cleanup(&vmux->notifier); in video_mux_probe()
488 struct video_mux *vmux = platform_get_drvdata(pdev); in video_mux_remove() local
489 struct v4l2_subdev *sd = &vmux->subdev; in video_mux_remove()
491 v4l2_async_nf_unregister(&vmux->notifier); in video_mux_remove()
492 v4l2_async_nf_cleanup(&vmux->notifier); in video_mux_remove()