From patchwork Fri Aug 21 09:29:44 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: 7050551 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 4C99AC05AC for ; Fri, 21 Aug 2015 09:31:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 57785205F4 for ; Fri, 21 Aug 2015 09:31:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1CFE4204D1 for ; Fri, 21 Aug 2015 09:31:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753718AbbHUJaB (ORCPT ); Fri, 21 Aug 2015 05:30:01 -0400 Received: from mail-lb0-f174.google.com ([209.85.217.174]:34882 "EHLO mail-lb0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753681AbbHUJ36 (ORCPT ); Fri, 21 Aug 2015 05:29:58 -0400 Received: by lbcbn3 with SMTP id bn3so39866622lbc.2; Fri, 21 Aug 2015 02:29:57 -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=GVCnp4vliFKhCDhMIqWDjlYeBS/SmWOARNr4kN1AiIs=; b=j8+ppOnfQPpEFszzyGR7mEtW3wrMcV6cIp7RctA8baWquVMRmIklntRUHuv/r1Y9ZA 8VDVsv/tAkUPv/PyiRZpHdjFE7nnXe2OVax2+BnhiubP9vlmRYlX1F1U6lNkwt5ST31F u0aGx/JwqcG669vnm6U2JzzDekiM8+ZKDTZnaQysrfh7jYZN3mJ1MSfEBWcaAgYJC2Pk xZVyHliGx3QIl0tHEthTcYiGQ2hraPEXbSft6sk6KXBluc8maP3wwumiQvoh535fyaK/ 6z4TPj8EKVZnDStMGJYE9AmbWIRC+t0Fjc/a9y2Wn6Sd3zNR/b6ccZbQoX2O+Yb/iBWN 25iA== X-Received: by 10.112.125.34 with SMTP id mn2mr6366433lbb.76.1440149396969; Fri, 21 Aug 2015 02:29:56 -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.56 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 21 Aug 2015 02:29:56 -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 6/8] media/pci/saa7164-encoder Support for V4L2_CTRL_WHICH_DEF_VAL Date: Fri, 21 Aug 2015 11:29:44 +0200 Message-Id: <1440149386-19783-7-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-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 4434e0f28c26..e897b83b66dd 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->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; @@ -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->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->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;