Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1438be56 authored by Anatolij Gustschin's avatar Anatolij Gustschin Committed by Mauro Carvalho Chehab
Browse files

[media] V4L: soc_camera: allow reading from video device if supported



Try reading on video device. If the camera bus driver supports reading
we can try it and return the result. Also add a debug line.

Signed-off-by: default avatarAnatolij Gustschin <agust@denx.de>
Signed-off-by: default avatarGuennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 0dc2d849
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -645,11 +645,17 @@ static ssize_t soc_camera_read(struct file *file, char __user *buf,
			       size_t count, loff_t *ppos)
{
	struct soc_camera_device *icd = file->private_data;
	int err = -EINVAL;
	struct soc_camera_host *ici = to_soc_camera_host(icd->parent);

	dev_dbg(icd->pdev, "read called, buf %p\n", buf);

	if (ici->ops->init_videobuf2 && icd->vb2_vidq.io_modes & VB2_READ)
		return vb2_read(&icd->vb2_vidq, buf, count, ppos,
				file->f_flags & O_NONBLOCK);

	dev_err(icd->pdev, "camera device read not implemented\n");

	return err;
	return -EINVAL;
}

static int soc_camera_mmap(struct file *file, struct vm_area_struct *vma)