From patchwork Thu Feb 26 15:59:21 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacek Anaszewski X-Patchwork-Id: 5894511 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 778619F399 for ; Thu, 26 Feb 2015 16:01:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A1E8E203AB for ; Thu, 26 Feb 2015 16:01:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3E47D203B4 for ; Thu, 26 Feb 2015 16:01:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754474AbbBZQB2 (ORCPT ); Thu, 26 Feb 2015 11:01:28 -0500 Received: from mailout3.samsung.com ([203.254.224.33]:54773 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754557AbbBZQA7 (ORCPT ); Thu, 26 Feb 2015 11:00:59 -0500 Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout3.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NKD000GKZ5MM400@mailout3.samsung.com> for linux-media@vger.kernel.org; Fri, 27 Feb 2015 01:00:58 +0900 (KST) X-AuditID: cbfee61a-f79c06d000004e71-64-54ef433ac2d5 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id BE.E0.20081.A334FE45; Fri, 27 Feb 2015 01:00:58 +0900 (KST) Received: from AMDC2362.DIGITAL.local ([106.120.53.23]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0NKD00448Z32VO60@mmp2.samsung.com>; Fri, 27 Feb 2015 01:00:58 +0900 (KST) From: Jacek Anaszewski To: linux-media@vger.kernel.org Cc: sakari.ailus@linux.intel.com, laurent.pinchart@ideasonboard.com, gjasny@googlemail.com, hdegoede@redhat.com, kyungmin.park@samsung.com, Jacek Anaszewski Subject: [v4l-utils PATCH/RFC v5 11/14] mediactl: libv4l2subdev: add get_pipeline_entity_by_cid function Date: Thu, 26 Feb 2015 16:59:21 +0100 Message-id: <1424966364-3647-12-git-send-email-j.anaszewski@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1424966364-3647-1-git-send-email-j.anaszewski@samsung.com> References: <1424966364-3647-1-git-send-email-j.anaszewski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprOLMWRmVeSWpSXmKPExsVy+t9jQV0r5/chBk/uKllMnzKL0eLN8elM Fr1XnzNanG16w27ROXEJu0XPhq2sFp+2fGNyYPd4OmEyu8fsjpmsHvNOBnq833eVzaNvyypG j8+b5ALYorhsUlJzMstSi/TtErgy5k/dxVIwmb/i7oZ5zA2Ml3i6GDk5JARMJA4+usIGYYtJ XLi3Hsjm4hASmM4o8bX5BiOE084k0fjpFgtIFZuAocTPF6+ZQGwRAXmJJ703wDqYBXYzSjxb vocVJCEskCXR8mcSexcjBweLgKrEuScWIGFeAQ+J/R0bWUDCEgIKEnMm2YCEOYHCU798YgSx hQTcJb6+W842gZF3ASPDKkbR1ILkguKk9FxDveLE3OLSvHS95PzcTYzg4HomtYNxZYPFIUYB DkYlHt6E7HchQqyJZcWVuYcYJTiYlUR49a3fhwjxpiRWVqUW5ccXleakFh9ilOZgURLnVbJv CxESSE8sSc1OTS1ILYLJMnFwSjUw1s30FW5N3hthUOI87e831afs0p6lwuuij5vNljGb8m7l y/Ks88n+71eFuXpt8pYOTIi9sXlt5qR/R28mam/Y9rG4d8vk84fa7e8v6/bxfvC1apHh0Qdu 0/RdUv7e2e4+8/r7w69nbxU6sP/PZSfLmLqTxx0VUvaaXlh2+WbnnjduVzj6zTsv9yqxFGck GmoxFxUnAgAePbWEKgIAAA== Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, 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 Add a function for obtaining the v4l2 sub-device for which the v4l2 control related ioctl is predestined. Signed-off-by: Jacek Anaszewski Acked-by: Kyungmin Park --- utils/media-ctl/libv4l2subdev.c | 14 ++++++++++++++ utils/media-ctl/v4l2subdev.h | 15 +++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/utils/media-ctl/libv4l2subdev.c b/utils/media-ctl/libv4l2subdev.c index cc3df1e..379fe64 100644 --- a/utils/media-ctl/libv4l2subdev.c +++ b/utils/media-ctl/libv4l2subdev.c @@ -946,3 +946,17 @@ bool v4l2_subdev_has_v4l2_control_redir(struct media_device *media, return false; } + +struct media_entity *v4l2_subdev_get_pipeline_entity_by_cid(struct media_device *media, + int cid) +{ + struct media_entity *entity = media->pipeline; + + while (entity) { + if (v4l2_subdev_has_v4l2_control_redir(media, entity, cid)) + return entity; + entity = entity->next; + } + + return NULL; +} diff --git a/utils/media-ctl/v4l2subdev.h b/utils/media-ctl/v4l2subdev.h index 2b48fb5..0f1deca 100644 --- a/utils/media-ctl/v4l2subdev.h +++ b/utils/media-ctl/v4l2subdev.h @@ -353,4 +353,19 @@ int v4l2_subdev_format_compare(struct v4l2_mbus_framefmt *fmt1, bool v4l2_subdev_has_v4l2_control_redir(struct media_device *media, struct media_entity *entity, int ctrl_id); +/** + * @brief Get the first pipeline entity supporting the control + * @param media - media device. + * @param cid - v4l2 control identifier. + * + * Get the first entity in the media device pipeline, + * for which v4l2_control with cid is to be redirected + * + * @return associated entity if defined, or NULL if the + * control redirection wasn't defined for any entity + * in the pipeline + */ +struct media_entity *v4l2_subdev_get_pipeline_entity_by_cid( + struct media_device *media, int cid); + #endif