From patchwork Fri Aug 21 13:19:27 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: 7051831 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 69889C05AC for ; Fri, 21 Aug 2015 13:20:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 91D8C20620 for ; Fri, 21 Aug 2015 13:20:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 79EE0205D6 for ; Fri, 21 Aug 2015 13:20:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753747AbbHUNTr (ORCPT ); Fri, 21 Aug 2015 09:19:47 -0400 Received: from mail-la0-f47.google.com ([209.85.215.47]:33390 "EHLO mail-la0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753694AbbHUNTq (ORCPT ); Fri, 21 Aug 2015 09:19:46 -0400 Received: by lalv9 with SMTP id v9so41161769lal.0; Fri, 21 Aug 2015 06:19:44 -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=l4ITjifbHufXamMUriedEZR6n02rVxz0W6ZZXx4OTrs=; b=Sz8ht22T+u9l6vhoEDD+MK71dgsKkpfME66Gx8iRWuF4n+eivAm7a3TUq1hGiItfq2 VWu4c/a4UD0ZDWUwR9sM26E/daw9g3DNUD5TVHDVO6QIPpSmYlu7m4KI0JgEw9RghNvY 8nNEl6F3Ml80QZ5gbZtRHUSpJ/U+je0jCXXoka0Mi9/tGPUmPbrWn//12yjnIzd4pdEf vQkwFsSuyCLRv+xmNEZJkjgDZrvfe9ZR5AvfGFbzotkmV94FAKezQLZnaubXZ2dO2sPm O60zwxB3+u2RhDc1TyHbVygWytgwp73Npy9BF97r1RU9PaU3JPZ8komFRMORHbkMRVLt kWGg== X-Received: by 10.152.30.73 with SMTP id q9mr7986140lah.31.1440163184807; Fri, 21 Aug 2015 06:19:44 -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.43 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 21 Aug 2015 06:19:43 -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 08/10] media/pci/saa7164-encoder Support for V4L2_CTRL_WHICH_DEF_VAL Date: Fri, 21 Aug 2015 15:19:27 +0200 Message-Id: <1440163169-18047-9-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-encoder.c | 55 ++++++++++++++++------------- 1 file changed, 31 insertions(+), 24 deletions(-) diff --git a/drivers/media/pci/saa7164/saa7164-encoder.c b/drivers/media/pci/saa7164/saa7164-encoder.c index e0ec64ed06fc..4a5c1ee3fb34 100644 --- a/drivers/media/pci/saa7164/saa7164-encoder.c +++ b/drivers/media/pci/saa7164/saa7164-encoder.c @@ -531,30 +531,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_encoder_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; @@ -884,6 +860,37 @@ 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_encoder_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->encoder_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_encoder_stop_port(struct saa7164_port *port) { struct saa7164_dev *dev = port->dev;