/* * Configure and enable the gasket with the frame size and CSI-2 data * type. For YUV422 8-bit, enable dual component mode unconditionally, * to match the configuration of the CSIS.
*/
ret = v4l2_subdev_call(remote_sd, pad, get_frame_desc, remote_pad, &fd); if (ret) {
dev_err(isi->dev, "failed to get frame descriptor from '%s':%u: %d\n",
remote_sd->name, remote_pad, ret); return ret;
}
if (fd.num_entries != 1) {
dev_err(isi->dev, "invalid frame descriptor for '%s':%u\n",
remote_sd->name, remote_pad); return -EINVAL;
}
fmt = v4l2_subdev_state_get_format(state, port, 0); if (!fmt) return -EINVAL;
ret = v4l2_subdev_routing_validate(sd, routing,
V4L2_SUBDEV_ROUTING_NO_N_TO_1); if (ret) return ret;
/* The memory input can be routed to the first pipeline only. */
for_each_active_route(&state->routing, route) { if (route->sink_pad == xbar->num_sinks - 1 &&
route->source_pad != xbar->num_sinks) {
dev_dbg(xbar->isi->dev, "invalid route from memory input (%u) to pipe %u\n",
route->sink_pad,
route->source_pad - xbar->num_sinks); return -EINVAL;
}
}
/* * Translate the source pad and streams to the sink side. The routing * validation forbids stream merging, so all matching entries in the * routing table are guaranteed to have the same sink pad. * * TODO: This is likely worth a helper function, it could perhaps be * supported by v4l2_subdev_state_xlate_streams() with pad1 set to -1.
*/
for_each_active_route(&state->routing, route) { if (route->source_pad != source_pad ||
!(source_streams & BIT(route->source_stream))) continue;
/* * Create a 1:1 mapping between pixel link inputs and outputs to * pipelines by default.
*/
routing.num_routes = min(xbar->num_sinks - 1, xbar->num_sources);
routes = kcalloc(routing.num_routes, sizeof(*routes), GFP_KERNEL); if (!routes) return -ENOMEM;
for (i = 0; i < routing.num_routes; ++i) { struct v4l2_subdev_route *route = &routes[i];
if (fmt->which == V4L2_SUBDEV_FORMAT_ACTIVE &&
media_pad_is_streaming(&xbar->pads[fmt->pad])) return -EBUSY;
/* * The source pad format is always identical to the sink pad format and * can't be modified.
*/ if (fmt->pad >= xbar->num_sinks) return v4l2_subdev_get_fmt(sd, state, fmt);
/* Validate the requested format. */ if (!mxc_isi_bus_format_by_code(fmt->format.code, MXC_ISI_PIPE_PAD_SINK))
fmt->format.code = MXC_ISI_DEF_MBUS_CODE_SINK;
/* * Set the format on the sink stream and propagate it to the source * streams.
*/
sink_fmt = v4l2_subdev_state_get_format(state, fmt->pad, fmt->stream); if (!sink_fmt) return -EINVAL;
*sink_fmt = fmt->format;
/* TODO: A format propagation helper would be useful. */
for_each_active_route(&state->routing, route) { struct v4l2_mbus_framefmt *source_fmt;
if (route->sink_pad != fmt->pad ||
route->sink_stream != fmt->stream) continue;
source_fmt = v4l2_subdev_state_get_format(state,
route->source_pad,
route->source_stream); if (!source_fmt) return -EINVAL;
if (!input->enable_count) {
ret = v4l2_subdev_disable_streams(remote_sd, remote_pad,
sink_streams); if (ret)
dev_err(xbar->isi->dev, "failed to disable streams 0x%llx on '%s':%u: %d\n",
sink_streams, remote_sd->name, remote_pad, ret);
/* * The subdev has one sink and one source per port, plus one sink for * the memory input.
*/
xbar->num_sinks = isi->pdata->num_ports + 1;
xbar->num_sources = isi->pdata->num_channels;
num_pads = xbar->num_sinks + xbar->num_sources;
xbar->pads = kcalloc(num_pads, sizeof(*xbar->pads), GFP_KERNEL); if (!xbar->pads) return -ENOMEM;
xbar->inputs = kcalloc(xbar->num_sinks, sizeof(*xbar->inputs),
GFP_KERNEL); if (!xbar->inputs) {
ret = -ENOMEM; goto err_free;
}
for (i = 0; i < xbar->num_sinks; ++i)
xbar->pads[i].flags = MEDIA_PAD_FL_SINK
| MEDIA_PAD_FL_MUST_CONNECT; for (i = 0; i < xbar->num_sources; ++i)
xbar->pads[i + xbar->num_sinks].flags = MEDIA_PAD_FL_SOURCE;
ret = media_entity_pads_init(&sd->entity, num_pads, xbar->pads); if (ret) goto err_free;
ret = v4l2_subdev_init_finalize(sd); if (ret < 0) goto err_entity;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.