From patchwork Fri Aug 21 13:19:28 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda Delgado X-Patchwork-Id: 7051821 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 4EA79C05AC for ; Fri, 21 Aug 2015 13:20:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 86E8120620 for ; Fri, 21 Aug 2015 13:20:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 702A12061D for ; Fri, 21 Aug 2015 13:20:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753842AbbHUNUP (ORCPT ); Fri, 21 Aug 2015 09:20:15 -0400 Received: from mail-la0-f41.google.com ([209.85.215.41]:35652 "EHLO mail-la0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753727AbbHUNTs (ORCPT ); Fri, 21 Aug 2015 09:19:48 -0400 Received: by lahi9 with SMTP id i9so41036361lah.2; Fri, 21 Aug 2015 06:19:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=maPUPLiOSQ45BktgRJyWUr9RVz9WQ4lVtcIk8dMnugY=; b=Cu7YmJ+wQwKdCo5rTyI7BelsAzohHQLeq3okTISnRqPnNMoghDdBN7GlTW97C7moSu kxYBOZxCgdr6b70MGi+V1PTW0L/vlUOH1TZzevK9XV59Un4xP4uirbR4UR/qDyvW2dOH kanHgS69iLhWbAfkwAygdrTeivraCcIvMcPjN2rg4Ad7rANcFwI2NR/S+sbKyYryBxEU VIoW2PgV2D4Aw+we/NFROPAwGaJ+lnYpcXADhwAw9nvGWMLN7TjZ9GBtpiq6wfke6Tv4 nSX3h59PR7PJLcKhvHjnGKjrJHQ/dNRBMywT34UJ/Z64ij8DIYG24yhnOeRnuCJ6PxGk 3RZQ== X-Received: by 10.152.30.100 with SMTP id r4mr7781339lah.92.1440163186414; Fri, 21 Aug 2015 06:19:46 -0700 (PDT) Received: from neopili.qtec.com (cpe.xe-3-0-1-778.vbrnqe10.dk.customer.tdc.net. [80.197.57.18]) by smtp.gmail.com with ESMTPSA id ph4sm2293746lbb.3.2015.08.21.06.19.44 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 21 Aug 2015 06:19:45 -0700 (PDT) From: Ricardo Ribalda Delgado To: Mauro Carvalho Chehab , Mike Isely , Laurent Pinchart , Hans Verkuil , Steven Toth , Sakari Ailus , Vincent Palatin , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Ricardo Ribalda Delgado Subject: [PATCH v2 09/10] media/pci/saa7164-vbi Support for V4L2_CTRL_WHICH_DEF_VAL Date: Fri, 21 Aug 2015 15:19:28 +0200 Message-Id: <1440163169-18047-10-git-send-email-ricardo.ribalda@gmail.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1440163169-18047-1-git-send-email-ricardo.ribalda@gmail.com> References: <1440163169-18047-1-git-send-email-ricardo.ribalda@gmail.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This driver does not use the control infrastructure. Add support for the new field which on structure v4l2_ext_controls Signed-off-by: Ricardo Ribalda Delgado --- drivers/media/pci/saa7164/saa7164-vbi.c | 57 +++++++++++++++++++-------------- 1 file changed, 33 insertions(+), 24 deletions(-) diff --git a/drivers/media/pci/saa7164/saa7164-vbi.c b/drivers/media/pci/saa7164/saa7164-vbi.c index 08f23b6d9cef..4c2d8ec5b4dd 100644 --- a/drivers/media/pci/saa7164/saa7164-vbi.c +++ b/drivers/media/pci/saa7164/saa7164-vbi.c @@ -494,30 +494,6 @@ static int saa7164_get_ctrl(struct saa7164_port *port, return 0; } -static int vidioc_g_ext_ctrls(struct file *file, void *priv, - struct v4l2_ext_controls *ctrls) -{ - struct saa7164_vbi_fh *fh = file->private_data; - struct saa7164_port *port = fh->port; - int i, err = 0; - - if (ctrls->which == V4L2_CTRL_CLASS_MPEG) { - for (i = 0; i < ctrls->count; i++) { - struct v4l2_ext_control *ctrl = ctrls->controls + i; - - err = saa7164_get_ctrl(port, ctrl); - if (err) { - ctrls->error_idx = i; - break; - } - } - return err; - - } - - return -EINVAL; -} - static int saa7164_try_ctrl(struct v4l2_ext_control *ctrl, int ac3) { int ret = -EINVAL; @@ -810,6 +786,39 @@ static int vidioc_queryctrl(struct file *file, void *priv, return -EINVAL; } +static int vidioc_g_ext_ctrls(struct file *file, void *priv, + struct v4l2_ext_controls *ctrls) +{ + struct saa7164_vbi_fh *fh = file->private_data; + struct saa7164_port *port = fh->port; + int i, err = 0; + + if (ctrls->which != V4L2_CTRL_CLASS_MPEG && + ctrls->which != V4L2_CTRL_WHICH_DEF_VAL) + return -EINVAL; + + for (i = 0; i < ctrls->count; i++) { + struct v4l2_ext_control *ctrl = ctrls->controls + i; + + if (ctrls->which == V4L2_CTRL_WHICH_DEF_VAL) { + struct v4l2_queryctrl q; + + err = fill_queryctrl(&port->vbi_params, &q); + if (!err) + ctrl->value = q.default_value; + } else + err = saa7164_get_ctrl(port, ctrl); + + if (err) { + ctrls->error_idx = i; + break; + } + } + + return err; +} + + static int saa7164_vbi_stop_port(struct saa7164_port *port) { struct saa7164_dev *dev = port->dev;