From patchwork Fri Aug 21 09:29:45 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: 7050541 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 42D6DC05AC for ; Fri, 21 Aug 2015 09:31:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5CF42204D1 for ; Fri, 21 Aug 2015 09:31:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7547F2047D for ; Fri, 21 Aug 2015 09:31:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753727AbbHUJaD (ORCPT ); Fri, 21 Aug 2015 05:30:03 -0400 Received: from mail-la0-f47.google.com ([209.85.215.47]:35338 "EHLO mail-la0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753696AbbHUJ37 (ORCPT ); Fri, 21 Aug 2015 05:29:59 -0400 Received: by lahi9 with SMTP id i9so37765514lah.2; Fri, 21 Aug 2015 02:29:58 -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=eVJ6CY1NA23/EW7YpbSi9IvHbJmms6o01aB7cIz/6e8=; b=mjJwwfEdJi6Zzg9nn/PnbsPUSj1h4xXJtB6V19p4uO0jBxeoN0Ev833hKpX+91umS5 BivvWL+A5RlnNW9sgCSdM6dXI0qI8wHUoxdMX5Jx3nzY5HTjyko7QdZxgWPLbhmQXFEx yYoa0HCZABSGm04cXJHx1EVPqzl89iA96iHeQEF8XAu5fDrz3W6hakPVax6vQvhXC//g FaUdPD8Qz+u7PfB/sQv7UKqT4nD3teHC4m8l5wkkgDCxfBhcSb7adsKeHTsufp2dTWPW DXj4xbFO9GbrY3Jgw1rdm9+sPgiWL4oDyo4Vn8IBi1mSOEuI/hMYZ55/8gxsZneDu15E t5gQ== X-Received: by 10.112.72.69 with SMTP id b5mr7002425lbv.24.1440149398380; Fri, 21 Aug 2015 02:29:58 -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 f10sm2112680lae.23.2015.08.21.02.29.57 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 21 Aug 2015 02:29:57 -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 7/8] media/pci/saa7164-vbi Support for V4L2_CTRL_WHICH_DEF_VAL Date: Fri, 21 Aug 2015 11:29:45 +0200 Message-Id: <1440149386-19783-8-git-send-email-ricardo.ribalda@gmail.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1440149386-19783-1-git-send-email-ricardo.ribalda@gmail.com> References: <1440149386-19783-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 859fd03d82f9..e8723102a4d2 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->ctrl_class == 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->ctrl_class != 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;