From patchwork Fri Aug 21 13:19:26 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: 7051861 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 35F5DC05AC for ; Fri, 21 Aug 2015 13:21:26 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5F45320620 for ; Fri, 21 Aug 2015 13:21:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 609D0205D6 for ; Fri, 21 Aug 2015 13:21:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753920AbbHUNVG (ORCPT ); Fri, 21 Aug 2015 09:21:06 -0400 Received: from mail-lb0-f176.google.com ([209.85.217.176]:35038 "EHLO mail-lb0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753668AbbHUNTo (ORCPT ); Fri, 21 Aug 2015 09:19:44 -0400 Received: by lbcbn3 with SMTP id bn3so43325386lbc.2; Fri, 21 Aug 2015 06:19:43 -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=efyR39E2qXhTEvzgbbyOR5LGtL/c5DKb729kPou0dHQ=; b=sl2Y+d13LKsDdvaD6Os99UiK4Mg9ijxgap3KqOsptSBAG9S1HCjpPzxDI8AeKH22bn duP8nTtCU7JSyputpRI+7Cq2nofA73vt2gG74JKLSjjcUNURVIcTgbQQYWCyT2z3DGiY AtWdc05aVS47c4VTClpsZLCP/of7i+tYzFqpGb9XBsQ6cE430HvMtX1BD6HyRFdYEERY l0mFrHfnl+9VAWef63BigxNfcfi12Sfie6QuoQ1FDRrsF3p6ARTBDpQfS9pkFo3Jy9B+ fsxT36QVxhXmKTJ7MhFFewPmPKCQgpc2bAWyf5NhqcilNGhtvDTgBOWS+e2G7sBLu7e4 EEhg== X-Received: by 10.152.28.105 with SMTP id a9mr8034814lah.9.1440163183222; Fri, 21 Aug 2015 06:19:43 -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.42 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 21 Aug 2015 06:19:42 -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 07/10] media/usb/pvrusb2: Support for V4L2_CTRL_WHICH_DEF_VAL Date: Fri, 21 Aug 2015 15:19:26 +0200 Message-Id: <1440163169-18047-8-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 Acked-By: Mike Isely --- drivers/media/usb/pvrusb2/pvrusb2-v4l2.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c b/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c index 1c5f85bf7ed4..43b2f2214798 100644 --- a/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c +++ b/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c @@ -628,6 +628,7 @@ static int pvr2_g_ext_ctrls(struct file *file, void *priv, struct pvr2_v4l2_fh *fh = file->private_data; struct pvr2_hdw *hdw = fh->channel.mc_head->hdw; struct v4l2_ext_control *ctrl; + struct pvr2_ctrl *cptr; unsigned int idx; int val; int ret; @@ -635,8 +636,18 @@ static int pvr2_g_ext_ctrls(struct file *file, void *priv, ret = 0; for (idx = 0; idx < ctls->count; idx++) { ctrl = ctls->controls + idx; - ret = pvr2_ctrl_get_value( + if (ctls->which == V4L2_CTRL_WHICH_DEF_VAL) { + cptr = pvr2_hdw_get_ctrl_v4l(hdw, ctrl->id); + if (cptr) + pvr2_ctrl_get_def(cptr, &val); + else + ret = -EINVAL; + + + } else + ret = pvr2_ctrl_get_value( pvr2_hdw_get_ctrl_v4l(hdw, ctrl->id), &val); + if (ret) { ctls->error_idx = idx; return ret; @@ -658,6 +669,10 @@ static int pvr2_s_ext_ctrls(struct file *file, void *priv, unsigned int idx; int ret; + /* Default value cannot be changed */ + if (ctls->which == V4L2_CTRL_WHICH_DEF_VAL) + return -EINVAL; + ret = 0; for (idx = 0; idx < ctls->count; idx++) { ctrl = ctls->controls + idx;