All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hans Verkuil <hverkuil@xs4all.nl>
To: Robert Jarzmik <robert.jarzmik@free.fr>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Guennadi Liakhovetski <g.liakhovetski@gmx.de>,
	Jiri Kosina <trivial@kernel.org>
Cc: linux-kernel@vger.kernel.org, linux-media@vger.kernel.org
Subject: Re: [PATCH v3 11/14] media: platform: pxa_camera: make a standalone v4l2 device
Date: Sat, 13 Aug 2016 20:58:28 +0200	[thread overview]
Message-ID: <c51a3d10-58d5-ef7c-ec9c-60dc70e124f3@xs4all.nl> (raw)
In-Reply-To: <1470684652-16295-12-git-send-email-robert.jarzmik@free.fr>

On 08/08/2016 09:30 PM, Robert Jarzmik wrote:

<snip>

> +static int pxa_camera_sensor_bound(struct v4l2_async_notifier *notifier,
> +		     struct v4l2_subdev *subdev,
> +		     struct v4l2_async_subdev *asd)
> +{
> +	int err;
> +	struct v4l2_device *v4l2_dev = notifier->v4l2_dev;
> +	struct pxa_camera_dev *pcdev = v4l2_dev_to_pcdev(v4l2_dev);
> +	struct video_device *vdev = &pcdev->vdev;
> +	struct v4l2_pix_format *pix = &pcdev->current_pix;
> +	struct v4l2_subdev_format format = {
> +		.which = V4L2_SUBDEV_FORMAT_ACTIVE,
> +	};
> +	struct v4l2_mbus_framefmt *mf = &format.format;
> +
> +	dev_info(pcdev_to_dev(pcdev), "%s(): trying to bind a device\n",
> +		 __func__);
> +	mutex_lock(&pcdev->mlock);
> +	*vdev = pxa_camera_videodev_template;
> +	vdev->v4l2_dev = v4l2_dev;
> +	vdev->lock = &pcdev->mlock;
> +	pcdev->sensor = subdev;
> +	pcdev->vdev.queue = &pcdev->vb2_vq;
> +	pcdev->vdev.v4l2_dev = &pcdev->v4l2_dev;

You're missing this line here:

	pcdev->vdev.ctrl_handler = subdev->ctrl_handler;

This ensures that the sensor's controls are exposed to the video device node.

> +	video_set_drvdata(&pcdev->vdev, pcdev);
> +
> +	v4l2_disable_ioctl(vdev, VIDIOC_G_STD);
> +	v4l2_disable_ioctl(vdev, VIDIOC_S_STD);

Since you don't implement vidioc_g/s_std these two lines can be removed.

> +
> +	err = pxa_camera_build_formats(pcdev);
> +	if (err) {
> +		dev_err(pcdev_to_dev(pcdev), "building formats failed: %d\n",
> +			err);
> +		goto out;
> +	}
> +
> +	pcdev->current_fmt = pcdev->user_formats;
> +	pix->field = V4L2_FIELD_NONE;
> +	pix->width = DEFAULT_WIDTH;
> +	pix->height = DEFAULT_HEIGHT;
> +	pix->bytesperline =
> +		soc_mbus_bytes_per_line(pix->width,
> +					pcdev->current_fmt->host_fmt);
> +	pix->sizeimage =
> +		soc_mbus_image_size(pcdev->current_fmt->host_fmt,
> +				    pix->bytesperline, pix->height);
> +	pix->pixelformat = pcdev->current_fmt->host_fmt->fourcc;
> +	v4l2_fill_mbus_format(mf, pix, pcdev->current_fmt->code);
> +	err = sensor_call(pcdev, pad, set_fmt, NULL, &format);
> +	if (err)
> +		goto out;
> +
> +	v4l2_fill_pix_format(pix, mf);
> +	pr_info("%s(): colorspace=0x%x pixfmt=0x%x\n",
> +		__func__, pix->colorspace, pix->pixelformat);
> +
> +	err = pxa_camera_init_videobuf2(pcdev);
> +	if (err)
> +		goto out;
> +
> +	err = video_register_device(&pcdev->vdev, VFL_TYPE_GRABBER, -1);
> +	if (err) {
> +		v4l2_err(v4l2_dev, "register video device failed: %d\n", err);
> +		pcdev->sensor = NULL;
> +	} else {
> +		dev_info(pcdev_to_dev(pcdev),
> +			 "PXA Camera driver attached to camera %s\n",
> +			 subdev->name);
> +		subdev->owner = v4l2_dev->dev->driver->owner;
> +	}
> +out:
> +	mutex_unlock(&pcdev->mlock);
> +	return err;
> +}

Regards,

	Hans

  reply	other threads:[~2016-08-14  9:25 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-08 19:30 [PATCH v3 00/14] pxa_camera transition to v4l2 standalone device Robert Jarzmik
2016-08-08 19:30 ` [PATCH v3 01/14] media: mt9m111: make a standalone v4l2 subdevice Robert Jarzmik
2016-08-08 19:30 ` [PATCH v3 02/14] media: mt9m111: prevent module removal while in use Robert Jarzmik
2016-08-13 18:40   ` Hans Verkuil
2016-08-14 19:31     ` Robert Jarzmik
2016-08-08 19:30 ` [PATCH v3 03/14] media: mt9m111: use only the SRGB colorspace Robert Jarzmik
2016-08-08 19:30 ` [PATCH v3 04/14] media: mt9m111: move mt9m111 out of soc_camera Robert Jarzmik
2016-08-08 19:30 ` [PATCH v3 05/14] media: platform: pxa_camera: convert to vb2 Robert Jarzmik
2016-08-13  9:25   ` Robert Jarzmik
2016-08-13  9:29     ` Hans Verkuil
2016-08-13 11:15       ` Robert Jarzmik
2016-08-08 19:30 ` [PATCH v3 06/14] media: platform: pxa_camera: trivial move of functions Robert Jarzmik
2016-08-08 19:30 ` [PATCH v3 07/14] media: platform: pxa_camera: introduce sensor_call Robert Jarzmik
2016-08-08 19:30 ` [PATCH v3 08/14] media: platform: pxa_camera: make printk consistent Robert Jarzmik
2016-08-08 19:30 ` [PATCH v3 09/14] media: platform: pxa_camera: add buffer sequencing Robert Jarzmik
2016-08-15 13:26   ` Robert Jarzmik
2016-08-15 13:31     ` Hans Verkuil
2016-08-15 14:42       ` Robert Jarzmik
2016-08-08 19:30 ` [PATCH v3 10/14] media: platform: pxa_camera: remove set_crop Robert Jarzmik
2016-08-13 18:50   ` Hans Verkuil
2016-08-14 19:29     ` Robert Jarzmik
2016-08-08 19:30 ` [PATCH v3 11/14] media: platform: pxa_camera: make a standalone v4l2 device Robert Jarzmik
2016-08-13 18:58   ` Hans Verkuil [this message]
2016-08-14 19:30     ` Robert Jarzmik
2016-08-08 19:30 ` [PATCH v3 12/14] media: platform: pxa_camera: add debug register access Robert Jarzmik
2016-08-13 18:46   ` Hans Verkuil
2016-08-14 19:30     ` Robert Jarzmik
2016-08-08 19:30 ` [PATCH v3 13/14] media: platform: pxa_camera: change stop_streaming semantics Robert Jarzmik
2016-08-08 19:30 ` [PATCH v3 14/14] media: platform: pxa_camera: move pxa_camera out of soc_camera Robert Jarzmik
2016-08-15 10:04   ` Robert Jarzmik
2016-08-08 20:16 ` [PATCH v3 00/14] pxa_camera transition to v4l2 standalone device Hans Verkuil
2016-08-13 19:02 ` Hans Verkuil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c51a3d10-58d5-ef7c-ec9c-60dc70e124f3@xs4all.nl \
    --to=hverkuil@xs4all.nl \
    --cc=g.liakhovetski@gmx.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=robert.jarzmik@free.fr \
    --cc=trivial@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.