{"id":15401,"url":"https://patchwork.libcamera.org/api/1.1/patches/15401/?format=json","web_url":"https://patchwork.libcamera.org/patch/15401/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20220302220304.1327896-5-djrscally@gmail.com>","date":"2022-03-02T22:03:03","name":"[libcamera-devel,v3,4/5] media: entity: Add support for ancillary links","commit_ref":null,"pull_url":null,"state":"not-applicable","archived":false,"hash":"7abbe8933858235807a74fe124c6b3fc7a7c13b2","submitter":{"id":90,"url":"https://patchwork.libcamera.org/api/1.1/people/90/?format=json","name":"Daniel Scally","email":"djrscally@gmail.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/15401/mbox/","series":[{"id":2946,"url":"https://patchwork.libcamera.org/api/1.1/series/2946/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2946","date":"2022-03-02T22:02:59","name":"Introduce ancillary links","version":3,"mbox":"https://patchwork.libcamera.org/series/2946/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/15401/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/15401/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 244EEC3261\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  2 Mar 2022 22:03:21 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 31B956117D;\n\tWed,  2 Mar 2022 23:03:20 +0100 (CET)","from mail-wr1-x436.google.com (mail-wr1-x436.google.com\n\t[IPv6:2a00:1450:4864:20::436])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 0E4226116B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  2 Mar 2022 23:03:18 +0100 (CET)","by mail-wr1-x436.google.com with SMTP id u1so4882698wrg.11\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 02 Mar 2022 14:03:18 -0800 (PST)","from localhost.localdomain\n\t(cpc141996-chfd3-2-0-cust928.12-3.cable.virginm.net. [86.13.91.161])\n\tby smtp.gmail.com with ESMTPSA id\n\tl16-20020a05600c4f1000b0033383cdeea1sm229258wmq.10.2022.03.02.14.03.16\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 02 Mar 2022 14:03:17 -0800 (PST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"KkKr+64t\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=iKVMZBiFy16mG3Dfyafd/mMa87sEc9/DrYdseAp/SmA=;\n\tb=KkKr+64tlreZsZtfb+EYXbCd1f9PA5ds203rOrD0Vc97CwQy0d8sZjx4GMiY0sSNte\n\tPvreF3MN5DANeMYbCQpvhd2RBx5nqIHbsr/5hWGw3PBOQ2Nq62k1OmLXeh9giXwVjG3d\n\tislNFDUc/4SElPlCl+zcWugamE0A9YpHy7lpeE9W7/d3TwQx/N8Ozvd3v1du3y68n0kh\n\t6j4hj4JM0mJ7GrXZYFhwKsJsmi+Ul40mrmfIpaV/87xc6pTNfp4ZhmVSIsFVmExfTTyE\n\tGdT1nPD5NYX9BI15uqhXFnfzWZHnmZ9DOKxrkJw7yrh4TsIisuKdaOFqgTdUF0ugX2FA\n\tGQAg==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=iKVMZBiFy16mG3Dfyafd/mMa87sEc9/DrYdseAp/SmA=;\n\tb=1p4Gc3dBM5NZZ/HBJ8or5GyJkdZjQg3trnAoYVnJ1nB3+0gJpzI+6me8I8IA6JZHD7\n\tduzUAE3goUiphbTWH9JjwGnBkGpw/gUw8iuX8wYzK+KunbAIl2vo0G7eBPK65p4QVGvy\n\tp371sLhp0T7x5iwhUXYRGxqDZAixBenMbKYvSZ5pD0jJZjU7CHfgefQdkLNVGQrjhFBd\n\tv2kF0tXb2sH7Vvy9ySLhpPz5C+Wlf9WpzIcPVvXd1lk0wLrNZPqUpY7pd4Pp1wwEaC8/\n\t+e3eZ8+5RKXvVjAdZ9+VMD8HQXpEQwR1TQbYPWesuQdWflSyYQ+6eV8XVbSSidImGbAT\n\tdaMw==","X-Gm-Message-State":"AOAM533X7KGiE2Js/8URNwPKZ9N2lRFA27EDNMjQpIu3QpQIyyd3At6g\n\tGZj2gzxE6s2ZO/kb3I7RhqU=","X-Google-Smtp-Source":"ABdhPJysv6qzhhcHXob1XlKrY+1H3kUXWeq6zWkvJOiGorg2Fm1Y0767bWfPjeBmwER/3EXpWoBbUw==","X-Received":"by 2002:a05:6000:1a89:b0:1f0:4b5b:e0ce with SMTP id\n\tf9-20020a0560001a8900b001f04b5be0cemr781355wry.425.1646258597807; \n\tWed, 02 Mar 2022 14:03:17 -0800 (PST)","From":"Daniel Scally <djrscally@gmail.com>","To":"linux-media@vger.kernel.org,\n\tlibcamera-devel@lists.libcamera.org","Date":"Wed,  2 Mar 2022 22:03:03 +0000","Message-Id":"<20220302220304.1327896-5-djrscally@gmail.com>","X-Mailer":"git-send-email 2.25.1","In-Reply-To":"<20220302220304.1327896-1-djrscally@gmail.com>","References":"<20220302220304.1327896-1-djrscally@gmail.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v3 4/5] media: entity: Add support for\n\tancillary links","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Cc":"sakari.ailus@linux.intel.com","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Add functions to create ancillary links, so that they don't need to\nbe manually created by users.\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nSigned-off-by: Daniel Scally <djrscally@gmail.com>\n---\n\nChanges since v2:\n\n\t- Fixed some typos and comment phrasing (Laurent)\n\t- Changed the position of the new function to go after media_entity_call()\n\t(Laurent)\n\nChanges since v1:\n\n\t- Hardcoded MEDIA_LINK_FL_IMMUTABLE and MEDIA_LINK_FL_ENABLED (Laurent)\n\nChanges since the rfc:\n\n\t- (Laurent) Set gobj0 and gobj1 directly instead of the other union\n\tmembers\n\t- (Laurent) Added MEDIA_LNK_FL_IMMUTABLE to the kerneldoc for the new\n\tcreate function\n\n drivers/media/mc/mc-entity.c | 22 ++++++++++++++++++++++\n include/media/media-entity.h | 19 +++++++++++++++++++\n 2 files changed, 41 insertions(+)","diff":"diff --git a/drivers/media/mc/mc-entity.c b/drivers/media/mc/mc-entity.c\nindex 1a7d0a4fb9e8..d7e2f78a83cc 100644\n--- a/drivers/media/mc/mc-entity.c\n+++ b/drivers/media/mc/mc-entity.c\n@@ -1032,3 +1032,25 @@ void media_remove_intf_links(struct media_interface *intf)\n \tmutex_unlock(&mdev->graph_mutex);\n }\n EXPORT_SYMBOL_GPL(media_remove_intf_links);\n+\n+struct media_link *media_create_ancillary_link(struct media_entity *primary,\n+\t\t\t\t\t       struct media_entity *ancillary)\n+{\n+\tstruct media_link *link;\n+\n+\tlink = media_add_link(&primary->links);\n+\tif (!link)\n+\t\treturn ERR_PTR(-ENOMEM);\n+\n+\tlink->gobj0 = &primary->graph_obj;\n+\tlink->gobj1 = &ancillary->graph_obj;\n+\tlink->flags = MEDIA_LNK_FL_IMMUTABLE | MEDIA_LNK_FL_ENABLED |\n+\t\t      MEDIA_LNK_FL_ANCILLARY_LINK;\n+\n+\t/* Initialize graph object embedded in the new link */\n+\tmedia_gobj_create(primary->graph_obj.mdev, MEDIA_GRAPH_LINK,\n+\t\t\t  &link->graph_obj);\n+\n+\treturn link;\n+}\n+EXPORT_SYMBOL_GPL(media_create_ancillary_link);\ndiff --git a/include/media/media-entity.h b/include/media/media-entity.h\nindex fea489f03d57..2a58defc4886 100644\n--- a/include/media/media-entity.h\n+++ b/include/media/media-entity.h\n@@ -1108,4 +1108,23 @@ void media_remove_intf_links(struct media_interface *intf);\n \t(((entity)->ops && (entity)->ops->operation) ?\t\t\t\\\n \t (entity)->ops->operation((entity) , ##args) : -ENOIOCTLCMD)\n \n+/**\n+ * media_create_ancillary_link() - create an ancillary link between two\n+ *\t\t\t\t   instances of &media_entity\n+ *\n+ * @primary:\tpointer to the primary &media_entity\n+ * @ancillary:\tpointer to the ancillary &media_entity\n+ *\n+ * Create an ancillary link between two entities, indicating that they\n+ * represent two connected pieces of hardware that form a single logical unit.\n+ * A typical example is a camera lens controller being linked to the sensor that\n+ * it is supporting.\n+ *\n+ * The function sets both MEDIA_LNK_FL_ENABLED and MEDIA_LNK_FL_IMMUTABLE for\n+ * the new link.\n+ */\n+struct media_link *\n+media_create_ancillary_link(struct media_entity *primary,\n+\t\t\t    struct media_entity *ancillary);\n+\n #endif\n","prefixes":["libcamera-devel","v3","4/5"]}