From patchwork Fri Aug 21 09:29:43 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: 7050591 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 104B4C05AC for ; Fri, 21 Aug 2015 09:32:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3592F204D1 for ; Fri, 21 Aug 2015 09:32:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 55B7A2047D for ; Fri, 21 Aug 2015 09:32:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753903AbbHUJbr (ORCPT ); Fri, 21 Aug 2015 05:31:47 -0400 Received: from mail-la0-f50.google.com ([209.85.215.50]:35316 "EHLO mail-la0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753655AbbHUJ35 (ORCPT ); Fri, 21 Aug 2015 05:29:57 -0400 Received: by lahi9 with SMTP id i9so37764968lah.2; Fri, 21 Aug 2015 02:29:56 -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=DB72vUoCPJybrOcFWcfG21/847PiC+GNcBwY6Zer/uGQqtbiDvA/xeJLuXwtRRcjVu LKZlSSEC43X019FQrlKC5ynIOh97Qz5kK9+NOrarrGShyFcX97AeqvcCLToFRNrmmSsB TDlPjtO1hOm3ecJ5uKjRJp7KhVWnI6DWWlskPlzb3K4x2nCX+SLmodK800uR9v1CpsaQ J9EZZ2mxv7DIClmansPot1PU9aSV7dHYMVSV3SPTuM80Fdh5KhLzAFXUmlTB/In5cOZ7 89CGdg2iW0wkKQGwHhLs0lNNUr2jWhg7UxvPm987P4WyhrZ7qdAL1Z7T1DO8/Y1ILHEY zGpg== X-Received: by 10.152.45.102 with SMTP id l6mr3480013lam.33.1440149395969; Fri, 21 Aug 2015 02:29:55 -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.54 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 21 Aug 2015 02:29:55 -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 5/8] media/usb/pvrusb2: Support for V4L2_CTRL_WHICH_DEF_VAL Date: Fri, 21 Aug 2015 11:29:43 +0200 Message-Id: <1440149386-19783-6-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/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;