From patchwork Mon Jan 18 16:17:37 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacek Anaszewski X-Patchwork-Id: 8056041 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 DED7BBEEE5 for ; Mon, 18 Jan 2016 16:19:05 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F19F8204AE for ; Mon, 18 Jan 2016 16:19:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2A207204A9 for ; Mon, 18 Jan 2016 16:19:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932162AbcARQTB (ORCPT ); Mon, 18 Jan 2016 11:19:01 -0500 Received: from mailout2.samsung.com ([203.254.224.25]:39931 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932123AbcARQTA (ORCPT ); Mon, 18 Jan 2016 11:19:00 -0500 Received: from epcpsbgm2new.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0O1500UJKPBNT420@mailout2.samsung.com> for linux-media@vger.kernel.org; Tue, 19 Jan 2016 01:18:59 +0900 (KST) X-AuditID: cbfee61b-f793c6d00000236c-bd-569d1073b989 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2new.samsung.com (EPCPMTA) with SMTP id 7C.59.09068.3701D965; Tue, 19 Jan 2016 01:18:59 +0900 (KST) Received: from AMDC2362.DIGITAL.local ([106.120.53.23]) by mmp2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0O15003TLP9I9Y00@mmp2.samsung.com>; Tue, 19 Jan 2016 01:18:59 +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, hverkuil@xs4all.nl, Jacek Anaszewski Subject: [PATCH 12/15] mediactl: libv4l2subdev: add get_pipeline_entity_by_cid function Date: Mon, 18 Jan 2016 17:17:37 +0100 Message-id: <1453133860-21571-13-git-send-email-j.anaszewski@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1453133860-21571-1-git-send-email-j.anaszewski@samsung.com> References: <1453133860-21571-1-git-send-email-j.anaszewski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprPLMWRmVeSWpSXmKPExsVy+t9jQd1igblhBkdua1tMnzKL0eLN8elM FqcmP2Oy6L36nNGic+ISdoueDVtZLT5t+cbkwO7xdMJkdo/ZHTNZPeadDPR4v+8qm0ffllWM Hp83yXmc+vqZPYA9issmJTUnsyy1SN8ugSvjcFNNQT9/xddz35gaGM/zdDFyckgImEjcePWL BcIWk7hwbz1bFyMXh5DALEaJ3VMOs0I4Pxklll/sZQSpYhMwlPj54jUTiC0iIC/xpPcGWAez wBZGibt3FrGDJIQFIiW+/fgP1sAioCqx6uwVsAZeAU+Jbb+eA9VwAK1TkJgzyQYkzAkUfnNz PxuILSTgIXHg7lbmCYy8CxgZVjFKpBYkFxQnpeca5aWW6xUn5haX5qXrJefnbmIEB9sz6R2M h3e5H2IU4GBU4uF1ODs7TIg1say4MvcQowQHs5II7yGOuWFCvCmJlVWpRfnxRaU5qcWHGKU5 WJTEefddigwTEkhPLEnNTk0tSC2CyTJxcEo1MJYsv1bWmlSWL2NYZrbdo/V8ikO8HTuX5NMU 6Qzv7+n/trDcWGGVZbyAU6Peuu4yQ/5JkVqLdt+Zrxd9DuA8suZZietLyYsLCp3eZnaWy0hH 9TNt2Xl756c03h166uvXdl+8wf7Lk1VJQl0teu46p4SHjqesFXcZnn0nm8y0dblG9ssH5qUr lFiKMxINtZiLihMB9ou/+DICAAA= 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, 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 9d48ac1..14e9423 100644 --- a/utils/media-ctl/libv4l2subdev.c +++ b/utils/media-ctl/libv4l2subdev.c @@ -1052,3 +1052,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 be2d82e..607ec50 100644 --- a/utils/media-ctl/v4l2subdev.h +++ b/utils/media-ctl/v4l2subdev.h @@ -394,4 +394,19 @@ enum v4l2_subdev_fmt_mismatch v4l2_subdev_format_compare( 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