From patchwork Thu Dec 13 13:41:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Verkuil X-Patchwork-Id: 10728749 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D7F3A13AF for ; Thu, 13 Dec 2018 13:41:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C5DA52C1F1 for ; Thu, 13 Dec 2018 13:41:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BA4892C194; Thu, 13 Dec 2018 13:41:21 +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 9C69D2C250 for ; Thu, 13 Dec 2018 13:41:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729667AbeLMNlT (ORCPT ); Thu, 13 Dec 2018 08:41:19 -0500 Received: from lb1-smtp-cloud7.xs4all.net ([194.109.24.24]:59410 "EHLO lb1-smtp-cloud7.xs4all.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729524AbeLMNlS (ORCPT ); Thu, 13 Dec 2018 08:41:18 -0500 Received: from test-nl.fritz.box ([80.101.105.217]) by smtp-cloud7.xs4all.net with ESMTPA id XREngf3iadllcXREpgEECJ; Thu, 13 Dec 2018 14:41:15 +0100 From: hverkuil-cisco@xs4all.nl To: linux-media@vger.kernel.org Cc: Hans Verkuil Subject: [RFCv5 PATCH 1/4] uapi/linux/media.h: add property support Date: Thu, 13 Dec 2018 14:41:10 +0100 Message-Id: <20181213134113.15247-2-hverkuil-cisco@xs4all.nl> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181213134113.15247-1-hverkuil-cisco@xs4all.nl> References: <20181213134113.15247-1-hverkuil-cisco@xs4all.nl> MIME-Version: 1.0 X-CMAE-Envelope: MS4wfHOaWAa9T0hX0cy0lvLPmonAa9fBNHICWnMmB+u3IVCGCsJHEggH9FjzVoprc6YFyE5n8/zTY61pZmuyKsRoUVYHLbEAvZBVXmnG4CxVUyorrptV0uC2 B1EIofqPJQdckMVnBOI5VBLMa0dcYn2QTxUXCUg8JFPEtmEng+fdpBOuzMAx7qePBdRu9/BLE3rFnTattHBcHkXqpAQfESrkQL5CkhWiJ1/Qk96CQmvjy8RJ 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 Extend the topology struct with a properties array. Add a new media_v2_prop structure to store property information. Signed-off-by: Hans Verkuil --- include/uapi/linux/media.h | 56 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/include/uapi/linux/media.h b/include/uapi/linux/media.h index e5d0c5c611b5..12982327381e 100644 --- a/include/uapi/linux/media.h +++ b/include/uapi/linux/media.h @@ -342,6 +342,58 @@ struct media_v2_link { __u32 reserved[6]; } __attribute__ ((packed)); +#define MEDIA_PROP_TYPE_GROUP 1 +#define MEDIA_PROP_TYPE_U64 2 +#define MEDIA_PROP_TYPE_S64 3 +#define MEDIA_PROP_TYPE_STRING 4 + +#define MEDIA_OWNER_TYPE_ENTITY 0 +#define MEDIA_OWNER_TYPE_PAD 1 +#define MEDIA_OWNER_TYPE_LINK 2 +#define MEDIA_OWNER_TYPE_INTF 3 +#define MEDIA_OWNER_TYPE_PROP 4 + +/** + * struct media_v2_prop - A media property + * + * @id: The unique non-zero ID of this property + * @type: Property type + * @owner_id: The ID of the object this property belongs to + * @owner_type: The type of the object this property belongs to + * @flags: Property flags + * @name: Property name + * @payload_size: Property payload size, 0 for U64/S64 + * @payload_offset: Property payload starts at this offset from &prop.id. + * This is 0 for U64/S64. + * @reserved: Property reserved field, will be zeroed. + */ +struct media_v2_prop { + __u32 id; + __u32 type; + __u32 owner_id; + __u32 owner_type; + __u32 flags; + char name[32]; + __u32 payload_size; + __u32 payload_offset; + __u32 reserved[18]; +} __attribute__ ((packed)); + +static inline const char *media_prop2string(const struct media_v2_prop *prop) +{ + return (const char *)prop + prop->payload_offset; +} + +static inline __u64 media_prop2u64(const struct media_v2_prop *prop) +{ + return *(const __u64 *)((const char *)prop + prop->payload_offset); +} + +static inline __s64 media_prop2s64(const struct media_v2_prop *prop) +{ + return *(const __s64 *)((const char *)prop + prop->payload_offset); +} + struct media_v2_topology { __u64 topology_version; @@ -360,6 +412,10 @@ struct media_v2_topology { __u32 num_links; __u32 reserved4; __u64 ptr_links; + + __u32 num_props; + __u32 props_payload_size; + __u64 ptr_props; } __attribute__ ((packed)); /* ioctls */