Ejemplo n.º 1
0
static int ipipe_enum_frame_size(struct v4l2_subdev *sd,
				 struct v4l2_subdev_pad_config *cfg,
				 struct v4l2_subdev_frame_size_enum *fse)
{
	struct iss_ipipe_device *ipipe = v4l2_get_subdevdata(sd);
	struct v4l2_mbus_framefmt format;

	if (fse->index != 0)
		return -EINVAL;

	format.code = fse->code;
	format.width = 1;
	format.height = 1;
	ipipe_try_format(ipipe, cfg, fse->pad, &format, fse->which);
	fse->min_width = format.width;
	fse->min_height = format.height;

	if (format.code != fse->code)
		return -EINVAL;

	format.code = fse->code;
	format.width = -1;
	format.height = -1;
	ipipe_try_format(ipipe, cfg, fse->pad, &format, fse->which);
	fse->max_width = format.width;
	fse->max_height = format.height;

	return 0;
}
Ejemplo n.º 2
0
/*
 * ipipe_set_format - Set the video format on a pad
 * @sd : ISP IPIPE V4L2 subdevice
 * @cfg: V4L2 subdev pad config
 * @fmt: Format
 *
 * Return 0 on success or -EINVAL if the pad is invalid or doesn't correspond
 * to the format type.
 */
static int ipipe_set_format(struct v4l2_subdev *sd,
			    struct v4l2_subdev_pad_config *cfg,
			    struct v4l2_subdev_format *fmt)
{
	struct iss_ipipe_device *ipipe = v4l2_get_subdevdata(sd);
	struct v4l2_mbus_framefmt *format;

	format = __ipipe_get_format(ipipe, cfg, fmt->pad, fmt->which);
	if (!format)
		return -EINVAL;

	ipipe_try_format(ipipe, cfg, fmt->pad, &fmt->format, fmt->which);
	*format = fmt->format;

	/* Propagate the format from sink to source */
	if (fmt->pad == IPIPE_PAD_SINK) {
		format = __ipipe_get_format(ipipe, cfg, IPIPE_PAD_SOURCE_VP,
					    fmt->which);
		*format = fmt->format;
		ipipe_try_format(ipipe, cfg, IPIPE_PAD_SOURCE_VP, format,
				 fmt->which);
	}

	return 0;
}
Ejemplo n.º 3
0
static int ipipe_enum_frame_size(struct v4l2_subdev *sd,
                                 struct v4l2_subdev_fh *fh,
                                 struct v4l2_subdev_frame_size_enum *fse)
{
    struct iss_ipipe_device *ipipe = v4l2_get_subdevdata(sd);
    struct v4l2_mbus_framefmt format;

    if (fse->index != 0)
        return -EINVAL;

    format.code = fse->code;
    format.width = 1;
    format.height = 1;
    ipipe_try_format(ipipe, fh, fse->pad, &format, V4L2_SUBDEV_FORMAT_TRY);
    fse->min_width = format.width;
    fse->min_height = format.height;

    if (format.code != fse->code)
        return -EINVAL;

    format.code = fse->code;
    format.width = -1;
    format.height = -1;
    ipipe_try_format(ipipe, fh, fse->pad, &format, V4L2_SUBDEV_FORMAT_TRY);
    fse->max_width = format.width;
    fse->max_height = format.height;

    return 0;
}