From patchwork Fri Jun 29 11:43:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Verkuil X-Patchwork-Id: 10496451 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 61B2A601C7 for ; Fri, 29 Jun 2018 11:43:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4FEAB29577 for ; Fri, 29 Jun 2018 11:43:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 43FD5295A4; Fri, 29 Jun 2018 11:43:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C4E4D2958D for ; Fri, 29 Jun 2018 11:43:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936208AbeF2Lni (ORCPT ); Fri, 29 Jun 2018 07:43:38 -0400 Received: from lb2-smtp-cloud8.xs4all.net ([194.109.24.25]:38512 "EHLO lb2-smtp-cloud8.xs4all.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936098AbeF2Lng (ORCPT ); Fri, 29 Jun 2018 07:43:36 -0400 Received: from tschai.fritz.box ([212.251.195.8]) by smtp-cloud8.xs4all.net with ESMTPA id YroJfY2xFoj71YroNf5Wx0; Fri, 29 Jun 2018 13:43:35 +0200 From: Hans Verkuil To: linux-media@vger.kernel.org Cc: Hans Verkuil Subject: [PATCHv5 03/12] media: add flags field to struct media_v2_entity Date: Fri, 29 Jun 2018 13:43:22 +0200 Message-Id: <20180629114331.7617-4-hverkuil@xs4all.nl> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180629114331.7617-1-hverkuil@xs4all.nl> References: <20180629114331.7617-1-hverkuil@xs4all.nl> X-CMAE-Envelope: MS4wfCy8nOXvkKfYe3/HfmFm9fzvWt+Zekmdp7ajoCRrguJpk+nWACTZZa2BJCEaVWDb0c+bPAaNKdOykeNqA8mCEGIoqR6e2igotNzxAdNXo+LykN4n/eee V7B2q33KAb3+/lAKAnrd/CihTh35+s4FvAdUORZerazv/+ZBt/S0c2VFGcEs4q1QLFV5gCfdXdwiUrPuVzIAvnSjiVqjas5xeQ8= Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Hans Verkuil The v2 entity structure never exposed the entity flags, which made it impossible to detect connector or default entities. It is really trivial to just expose this information, so implement this. Signed-off-by: Hans Verkuil Acked-by: Sakari Ailus --- drivers/media/media-device.c | 1 + include/uapi/linux/media.h | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/media/media-device.c b/drivers/media/media-device.c index 047d38372a27..14959b19a342 100644 --- a/drivers/media/media-device.c +++ b/drivers/media/media-device.c @@ -266,6 +266,7 @@ static long media_device_get_topology(struct media_device *mdev, void *arg) memset(&kentity, 0, sizeof(kentity)); kentity.id = entity->graph_obj.id; kentity.function = entity->function; + kentity.flags = entity->flags; strlcpy(kentity.name, entity->name, sizeof(kentity.name)); diff --git a/include/uapi/linux/media.h b/include/uapi/linux/media.h index f6338bd57929..ebd2cda67833 100644 --- a/include/uapi/linux/media.h +++ b/include/uapi/linux/media.h @@ -280,11 +280,21 @@ struct media_links_enum { * MC next gen API definitions */ +/* + * Appeared in 4.19.0. + * + * The media_version argument comes from the media_version field in + * struct media_device_info. + */ +#define MEDIA_V2_ENTITY_HAS_FLAGS(media_version) \ + ((media_version) >= ((4 << 16) | (19 << 8) | 0)) + struct media_v2_entity { __u32 id; char name[64]; __u32 function; /* Main function of the entity */ - __u32 reserved[6]; + __u32 flags; + __u32 reserved[5]; } __attribute__ ((packed)); /* Should match the specific fields at media_intf_devnode */