Commit 01be377c authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull media fixes from Mauro Carvalho Chehab:
 "Some fixes for some platform drivers (rockchip, atmel, omap, daVinci,
  tegra-cec, coda and rcar).

  Also includes a fix on one of the V4L2 uAPI doc, explaining a border
  case"

* tag 'media/v5.2-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media:
  media: rockchip/vpu: Fix/re-order probe-error/remove path
  media: rockchip/vpu: Initialize mdev->bus_info
  media: rockchip/vpu: Get vdev from the file arg in vidioc_querycap()
  media: rockchip/vpu: Add missing dont_use_autosuspend() calls
  media: rockchip/vpu: Do not request id 0 for our video device
  media: tegra-cec: fix cec_notifier_parse_hdmi_phandle return check
  media: davinci/vpbe: array underflow in vpbe_enum_outputs()
  media: field-order.rst: clarify FIELD_ANY and FIELD_NONE
  media: staging/imx: add media device to capture register
  media: rcar-csi2: Propagate the FLD signal for NTSC and PAL
  media: rcar-csi2: restart CSI-2 link if error is detected
  media: omap_vout: potential buffer overflow in vidioc_dqbuf()
  media: coda: fix unset field and fail on invalid field in buf_prepare
  media: atmel: atmel-isc: fix asd memory allocation
  media: atmel: atmel-isc: fix INIT_WORK misplacement
  media: atmel: atmel-isc: limit incoming pixels per frame
parents 11b11773 fc8670d1
Loading
Loading
Loading
Loading
+7 −9
Original line number Diff line number Diff line
@@ -75,12 +75,11 @@ enum v4l2_field

    * - ``V4L2_FIELD_ANY``
      - 0
      - Applications request this field order when any one of the
	``V4L2_FIELD_NONE``, ``V4L2_FIELD_TOP``, ``V4L2_FIELD_BOTTOM``, or
	``V4L2_FIELD_INTERLACED`` formats is acceptable. Drivers choose
	depending on hardware capabilities or e. g. the requested image
	size, and return the actual field order. Drivers must never return
	``V4L2_FIELD_ANY``. If multiple field orders are possible the
      - Applications request this field order when any field format
	is acceptable. Drivers choose depending on hardware capabilities or
	e.g. the requested image size, and return the actual field order.
	Drivers must never return ``V4L2_FIELD_ANY``.
	If multiple field orders are possible the
	driver must choose one of the possible field orders during
	:ref:`VIDIOC_S_FMT <VIDIOC_G_FMT>` or
	:ref:`VIDIOC_TRY_FMT <VIDIOC_G_FMT>`. struct
@@ -88,9 +87,8 @@ enum v4l2_field
	``V4L2_FIELD_ANY``.
    * - ``V4L2_FIELD_NONE``
      - 1
      - Images are in progressive format, not interlaced. The driver may
	also indicate this order when it cannot distinguish between
	``V4L2_FIELD_TOP`` and ``V4L2_FIELD_BOTTOM``.
      - Images are in progressive (frame-based) format, not interlaced
        (field-based).
    * - ``V4L2_FIELD_TOP``
      - 2
      - Images consist of the top (aka odd) field only.
+19 −0
Original line number Diff line number Diff line
@@ -37,6 +37,25 @@
#define ISC_PFG_CFG0_BPS_TWELVE (0x0 << 28)
#define ISC_PFE_CFG0_BPS_MASK   GENMASK(30, 28)

#define ISC_PFE_CFG0_COLEN	BIT(12)
#define ISC_PFE_CFG0_ROWEN	BIT(13)

/* ISC Parallel Front End Configuration 1 Register */
#define ISC_PFE_CFG1    0x00000010

#define ISC_PFE_CFG1_COLMIN(v)		((v))
#define ISC_PFE_CFG1_COLMIN_MASK	GENMASK(15, 0)
#define ISC_PFE_CFG1_COLMAX(v)		((v) << 16)
#define ISC_PFE_CFG1_COLMAX_MASK	GENMASK(31, 16)

/* ISC Parallel Front End Configuration 2 Register */
#define ISC_PFE_CFG2    0x00000014

#define ISC_PFE_CFG2_ROWMIN(v)		((v))
#define ISC_PFE_CFG2_ROWMIN_MASK	GENMASK(15, 0)
#define ISC_PFE_CFG2_ROWMAX(v)		((v) << 16)
#define ISC_PFE_CFG2_ROWMAX_MASK	GENMASK(31, 16)

/* ISC Clock Enable Register */
#define ISC_CLKEN               0x00000018

+42 −4
Original line number Diff line number Diff line
@@ -721,6 +721,40 @@ static void isc_start_dma(struct isc_device *isc)
	u32 sizeimage = isc->fmt.fmt.pix.sizeimage;
	u32 dctrl_dview;
	dma_addr_t addr0;
	u32 h, w;

	h = isc->fmt.fmt.pix.height;
	w = isc->fmt.fmt.pix.width;

	/*
	 * In case the sensor is not RAW, it will output a pixel (12-16 bits)
	 * with two samples on the ISC Data bus (which is 8-12)
	 * ISC will count each sample, so, we need to multiply these values
	 * by two, to get the real number of samples for the required pixels.
	 */
	if (!ISC_IS_FORMAT_RAW(isc->config.sd_format->mbus_code)) {
		h <<= 1;
		w <<= 1;
	}

	/*
	 * We limit the column/row count that the ISC will output according
	 * to the configured resolution that we want.
	 * This will avoid the situation where the sensor is misconfigured,
	 * sending more data, and the ISC will just take it and DMA to memory,
	 * causing corruption.
	 */
	regmap_write(regmap, ISC_PFE_CFG1,
		     (ISC_PFE_CFG1_COLMIN(0) & ISC_PFE_CFG1_COLMIN_MASK) |
		     (ISC_PFE_CFG1_COLMAX(w - 1) & ISC_PFE_CFG1_COLMAX_MASK));

	regmap_write(regmap, ISC_PFE_CFG2,
		     (ISC_PFE_CFG2_ROWMIN(0) & ISC_PFE_CFG2_ROWMIN_MASK) |
		     (ISC_PFE_CFG2_ROWMAX(h - 1) & ISC_PFE_CFG2_ROWMAX_MASK));

	regmap_update_bits(regmap, ISC_PFE_CFG0,
			   ISC_PFE_CFG0_COLEN | ISC_PFE_CFG0_ROWEN,
			   ISC_PFE_CFG0_COLEN | ISC_PFE_CFG0_ROWEN);

	addr0 = vb2_dma_contig_plane_dma_addr(&isc->cur_frm->vb.vb2_buf, 0);
	regmap_write(regmap, ISC_DAD0, addr0);
@@ -1965,6 +1999,8 @@ static int isc_async_complete(struct v4l2_async_notifier *notifier)
	struct vb2_queue *q = &isc->vb2_vidq;
	int ret;

	INIT_WORK(&isc->awb_work, isc_awb_work);

	ret = v4l2_device_register_subdev_nodes(&isc->v4l2_dev);
	if (ret < 0) {
		v4l2_err(&isc->v4l2_dev, "Failed to register subdev nodes\n");
@@ -2018,8 +2054,6 @@ static int isc_async_complete(struct v4l2_async_notifier *notifier)
		return ret;
	}

	INIT_WORK(&isc->awb_work, isc_awb_work);

	/* Register video device */
	strscpy(vdev->name, ATMEL_ISC_NAME, sizeof(vdev->name));
	vdev->release		= video_device_release_empty;
@@ -2135,8 +2169,11 @@ static int isc_parse_dt(struct device *dev, struct isc_device *isc)
			break;
		}

		subdev_entity->asd = devm_kzalloc(dev,
				     sizeof(*subdev_entity->asd), GFP_KERNEL);
		/* asd will be freed by the subsystem once it's added to the
		 * notifier list
		 */
		subdev_entity->asd = kzalloc(sizeof(*subdev_entity->asd),
					     GFP_KERNEL);
		if (!subdev_entity->asd) {
			of_node_put(rem);
			ret = -ENOMEM;
@@ -2284,6 +2321,7 @@ static int atmel_isc_probe(struct platform_device *pdev)
						     subdev_entity->asd);
		if (ret) {
			fwnode_handle_put(subdev_entity->asd->match.fwnode);
			kfree(subdev_entity->asd);
			goto cleanup_subdev;
		}

+10 −0
Original line number Diff line number Diff line
@@ -1515,10 +1515,20 @@ static int coda_queue_setup(struct vb2_queue *vq,

static int coda_buf_prepare(struct vb2_buffer *vb)
{
	struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
	struct coda_ctx *ctx = vb2_get_drv_priv(vb->vb2_queue);
	struct coda_q_data *q_data;

	q_data = get_q_data(ctx, vb->vb2_queue->type);
	if (V4L2_TYPE_IS_OUTPUT(vb->vb2_queue->type)) {
		if (vbuf->field == V4L2_FIELD_ANY)
			vbuf->field = V4L2_FIELD_NONE;
		if (vbuf->field != V4L2_FIELD_NONE) {
			v4l2_warn(&ctx->dev->v4l2_dev,
				  "%s field isn't supported\n", __func__);
			return -EINVAL;
		}
	}

	if (vb2_plane_size(vb, 0) < q_data->sizeimage) {
		v4l2_warn(&ctx->dev->v4l2_dev,
+1 −1
Original line number Diff line number Diff line
@@ -104,7 +104,7 @@ static int vpbe_enum_outputs(struct vpbe_device *vpbe_dev,
			     struct v4l2_output *output)
{
	struct vpbe_config *cfg = vpbe_dev->cfg;
	int temp_index = output->index;
	unsigned int temp_index = output->index;

	if (temp_index >= cfg->num_outputs)
		return -EINVAL;
Loading