From patchwork Sat Aug 18 11:45:35 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anatolij Gustschin X-Patchwork-Id: 1340811 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id F37E2DF266 for ; Sat, 18 Aug 2012 11:45:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751824Ab2HRLpp (ORCPT ); Sat, 18 Aug 2012 07:45:45 -0400 Received: from mail-out.m-online.net ([212.18.0.10]:50082 "EHLO mail-out.m-online.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751597Ab2HRLpo (ORCPT ); Sat, 18 Aug 2012 07:45:44 -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 3Wzfc250P9z3hhgp; Sat, 18 Aug 2012 13:45:38 +0200 (CEST) X-Auth-Info: bedHktNABCuhUasjD5eHv7zuR2WU7O0Sb0zsIWbs9k8= Received: from localhost (p4FDE7D44.dip.t-dialin.net [79.222.125.68]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA id 3Wzfc23mfvzbbj2; Sat, 18 Aug 2012 13:45:38 +0200 (CEST) From: Anatolij Gustschin To: linux-media@vger.kernel.org Cc: Guennadi Liakhovetski , Mauro Carvalho Chehab Subject: [PATCH] V4L: soc_camera: allow reading from video device if supported Date: Sat, 18 Aug 2012 13:45:35 +0200 Message-Id: <1345290335-12980-1-git-send-email-agust@denx.de> X-Mailer: git-send-email 1.7.1 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 --- drivers/media/platform/soc_camera.c | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-) diff --git a/drivers/media/platform/soc_camera.c b/drivers/media/platform/soc_camera.c index 10b57f8..d591a42 100644 --- a/drivers/media/platform/soc_camera.c +++ b/drivers/media/platform/soc_camera.c @@ -645,9 +645,16 @@ 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; + struct soc_camera_host *ici = to_soc_camera_host(icd->parent); int err = -EINVAL; - dev_err(icd->pdev, "camera device read not implemented\n"); + dev_dbg(icd->pdev, "read called, buf %p\n", buf); + + if (ici->ops->init_videobuf2 && icd->vb2_vidq.io_modes & VB2_READ) + err = vb2_read(&icd->vb2_vidq, buf, count, ppos, + file->f_flags & O_NONBLOCK); + else + dev_err(icd->pdev, "camera device read not implemented\n"); return err; }