NotForUpstream: media: video-mux: Propagate controls to source

The i.MX8MP makes calls on it's source device to determine
the link-frequency that should be configured on the CSI2 receiver.

When the source is behind a video mux, we need to pass this call through
to the connected device.

Map the control handler of the source device to the video-mux,
essentially proxying all controls on the mux to the device which has
it's link enabled.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
Kieran Bingham
2024-10-10 14:52:52 +01:00
committed by Dom Cobley
parent f304deeb4e
commit 7ac6a6a5a9

View File

@@ -70,6 +70,7 @@ static int video_mux_link_setup(struct media_entity *entity,
{ {
struct v4l2_subdev *sd = media_entity_to_v4l2_subdev(entity); struct v4l2_subdev *sd = media_entity_to_v4l2_subdev(entity);
struct v4l2_subdev_state *sd_state; struct v4l2_subdev_state *sd_state;
struct v4l2_subdev *source_sd;
struct video_mux *vmux = v4l2_subdev_to_video_mux(sd); struct video_mux *vmux = v4l2_subdev_to_video_mux(sd);
u16 source_pad = entity->num_pads - 1; u16 source_pad = entity->num_pads - 1;
int ret = 0; int ret = 0;
@@ -110,6 +111,10 @@ static int video_mux_link_setup(struct media_entity *entity,
source_pad); source_pad);
*source_mbusformat = *v4l2_subdev_state_get_format(sd_state, *source_mbusformat = *v4l2_subdev_state_get_format(sd_state,
vmux->active); vmux->active);
source_sd = media_entity_to_v4l2_subdev(remote->entity);
vmux->subdev.ctrl_handler = source_sd->ctrl_handler;
} else { } else {
if (vmux->active != local->index) if (vmux->active != local->index)
goto out; goto out;
@@ -117,6 +122,8 @@ static int video_mux_link_setup(struct media_entity *entity,
dev_dbg(sd->dev, "going inactive\n"); dev_dbg(sd->dev, "going inactive\n");
mux_control_deselect(vmux->mux); mux_control_deselect(vmux->mux);
vmux->active = -1; vmux->active = -1;
vmux->subdev.ctrl_handler = NULL;
} }
out: out: