From patchwork Fri Aug 24 14:36:11 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anatolij Gustschin X-Patchwork-Id: 1371481 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id A32D33FC33 for ; Fri, 24 Aug 2012 14:36:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932762Ab2HXOgR (ORCPT ); Fri, 24 Aug 2012 10:36:17 -0400 Received: from mail-out.m-online.net ([212.18.0.10]:38390 "EHLO mail-out.m-online.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932567Ab2HXOgP (ORCPT ); Fri, 24 Aug 2012 10:36:15 -0400 Received: from frontend1.mail.m-online.net (frontend1.mail.intern.m-online.net [192.168.8.180]) by mail-out.m-online.net (Postfix) with ESMTP id 3X3Q634CD5z3hhcl; Fri, 24 Aug 2012 16:36:09 +0200 (CEST) X-Auth-Info: Y21X/ipuRO+EmRDzD+6uwRpxQMRIHzf7HdlaSSKwlFk= Received: from localhost (p4FC461F2.dip.t-dialin.net [79.196.97.242]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA id 3X3Q610bydzbblK; Fri, 24 Aug 2012 16:36:09 +0200 (CEST) From: Anatolij Gustschin To: linux-media@vger.kernel.org Cc: Guennadi Liakhovetski , Mauro Carvalho Chehab , dzu@denx.de Subject: [PATCH v3] V4L: soc_camera: allow reading from video device if supported Date: Fri, 24 Aug 2012 16:36:11 +0200 Message-Id: <1345818971-31062-1-git-send-email-agust@denx.de> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1345799604-29608-1-git-send-email-agust@denx.de> References: <1345799604-29608-1-git-send-email-agust@denx.de> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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: Anatolij Gustschin --- v3: - simplified as suggested by Guennadi v2: - rebased on current staging/for_v3.7 branch drivers/media/platform/soc_camera/soc_camera.c | 10 ++++++++-- 1 files changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/soc_camera/soc_camera.c b/drivers/media/platform/soc_camera/soc_camera.c index 10b57f8..1dd3997 100644 --- a/drivers/media/platform/soc_camera/soc_camera.c +++ b/drivers/media/platform/soc_camera/soc_camera.c @@ -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)