From patchwork Fri May 1 17:15:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Longerbeam X-Patchwork-Id: 209996 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 07737C47258 for ; Fri, 1 May 2020 17:16:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DA4B02137B for ; Fri, 1 May 2020 17:16:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="JiD72NVj" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729061AbgEARQG (ORCPT ); Fri, 1 May 2020 13:16:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1729037AbgEARQF (ORCPT ); Fri, 1 May 2020 13:16:05 -0400 Received: from mail-pl1-x641.google.com (mail-pl1-x641.google.com [IPv6:2607:f8b0:4864:20::641]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CFE9AC061A0E for ; Fri, 1 May 2020 10:16:05 -0700 (PDT) Received: by mail-pl1-x641.google.com with SMTP id v2so3842945plp.9 for ; Fri, 01 May 2020 10:16:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=/RVoX7yT7iGvoW/qYzoH+jpIAMj0AtP9LvPCJFybw1A=; b=JiD72NVjDtz3enhXc7RGkxBL+K1uTheOlPVTi9xueyKWRcDLMAATycu9ppnGl20NyT +a1oDIawnsYaZiM1whtrJMGzgKRUi1dcbtdJyTXPvBYnFJnsmUkVvg4SegU9n7q4H/47 H3F77Ia/pGac8/Hjm1rkSNivInEg49FOeezUfK7o4j1gFhC5/GOUAO8Yx2IFmWVQxu2W cro9zV/O6zB8q4HgTCWIeoHC/k5qb0oYoPAvnbRvcfXaqwQP3NabKbq/8DjjNCkOmnB0 Pbs5/1wlkgQQW5OB4RLKcEM8rXIq6pFZLf8IoVs44hSw8BnzaTzpdkNfsxbUWbKwPIWX P+wQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=/RVoX7yT7iGvoW/qYzoH+jpIAMj0AtP9LvPCJFybw1A=; b=n9sssEOHqaya22/QpkR2izaThQN8QvMQlXaEx7MZWRTJ3UUsrlUETaIhwWp8oKE6uI u0D4NDg5rBQVbDkk4WwJNPu3F5Z/wP8GSdT5ADMYaJ0/0rgUvmDAWEQpb4Mf7xoxBlQI ltARGYpOoiipZkbavU7CLki28so4aB1C08TAPltYp19iycXtOqgSlMaV6HvyHeOJ5N2S B3ZPSXGvhPd4hGy2KhH9FAK5Rshy/RzzEO+3VrDWRGRrVMhv//s/pXZgAi0McJCgvOU8 pRSGgh+KP7Gj/fafp743hODVxgxZgIZCFzCqqgtXiWfRQ0dQhTgZ3Br3Q41hEgrs2cWI ml0A== X-Gm-Message-State: AGi0PubHLxvlVc82UexrGDnnmMnInEEu6NApTnFz9dufyWBEiCK94b8V BTWWmwfx0R/m1msQ1iHtjnJUXK3K X-Google-Smtp-Source: APiQypIGQLRj5b3HPqLRhGAA9gLVcvDelGhiVn0VbK0+DaLDTDHWcsg9UEcZpiyw7Jh9WL2HZEu8lg== X-Received: by 2002:a17:90a:a40e:: with SMTP id y14mr680710pjp.101.1588353364997; Fri, 01 May 2020 10:16:04 -0700 (PDT) Received: from mappy.hsd1.ca.comcast.net (c-107-3-184-99.hsd1.ca.comcast.net. [107.3.184.99]) by smtp.gmail.com with ESMTPSA id g14sm2733966pfh.49.2020.05.01.10.16.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 May 2020 10:16:04 -0700 (PDT) From: Steve Longerbeam To: linux-media@vger.kernel.org Cc: Sakari Ailus , Mauro Carvalho Chehab , Hans Verkuil , Rui Miguel Silva , Laurent Pinchart , Philipp Zabel , Steve Longerbeam Subject: [PATCH v6 02/22] media: v4l2-subdev: add v4l2_subdev_get_fwnode_pad_1_to_1 Date: Fri, 1 May 2020 10:15:36 -0700 Message-Id: <20200501171556.14731-3-slongerbeam@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200501171556.14731-1-slongerbeam@gmail.com> References: <20200501171556.14731-1-slongerbeam@gmail.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Add a convenience function that can be used as the .get_fwnode_pad operation for subdevices that map port numbers and pad indexes 1:1. The function verifies the endpoint is owned by the subdevice, and if so returns the endpoint port number. Signed-off-by: Steve Longerbeam --- drivers/media/v4l2-core/v4l2-subdev.c | 22 ++++++++++++++++++++++ include/media/v4l2-subdev.h | 17 +++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c index a376b351135f..3bdda686341f 100644 --- a/drivers/media/v4l2-core/v4l2-subdev.c +++ b/drivers/media/v4l2-core/v4l2-subdev.c @@ -696,6 +696,28 @@ const struct v4l2_file_operations v4l2_subdev_fops = { }; #ifdef CONFIG_MEDIA_CONTROLLER + +int v4l2_subdev_get_fwnode_pad_1_to_1(struct media_entity *entity, + struct fwnode_endpoint *endpoint) +{ + struct fwnode_handle *fwnode; + struct v4l2_subdev *sd; + + if (!is_media_entity_v4l2_subdev(entity)) + return -EINVAL; + + sd = media_entity_to_v4l2_subdev(entity); + + fwnode = fwnode_graph_get_port_parent(endpoint->local_fwnode); + fwnode_handle_put(fwnode); + + if (dev_fwnode(sd->dev) == fwnode) + return endpoint->port; + + return -ENXIO; +} +EXPORT_SYMBOL_GPL(v4l2_subdev_get_fwnode_pad_1_to_1); + int v4l2_subdev_link_validate_default(struct v4l2_subdev *sd, struct media_link *link, struct v4l2_subdev_format *source_fmt, diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h index a4848de59852..f7fe78a6f65a 100644 --- a/include/media/v4l2-subdev.h +++ b/include/media/v4l2-subdev.h @@ -1027,6 +1027,23 @@ static inline void *v4l2_get_subdev_hostdata(const struct v4l2_subdev *sd) #ifdef CONFIG_MEDIA_CONTROLLER +/** + * v4l2_subdev_get_fwnode_pad_1_to_1 - Get pad number from a subdev fwnode + * endpoint, assuming 1:1 port:pad + * + * @entity - Pointer to the subdev entity + * @endpoint - Pointer to a parsed fwnode endpoint + * + * This function can be used as the .get_fwnode_pad operation for + * subdevices that map port numbers and pad indexes 1:1. If the endpoint + * is owned by the subdevice, the function returns the endpoint port + * number. + * + * Returns the endpoint port number on success or a negative error code. + */ +int v4l2_subdev_get_fwnode_pad_1_to_1(struct media_entity *entity, + struct fwnode_endpoint *endpoint); + /** * v4l2_subdev_link_validate_default - validates a media link * From patchwork Fri May 1 17:15:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Longerbeam X-Patchwork-Id: 209995 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3736CC4724C for ; Fri, 1 May 2020 17:16:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 179FB24955 for ; Fri, 1 May 2020 17:16:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="DBpS263Q" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729112AbgEARQK (ORCPT ); Fri, 1 May 2020 13:16:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1728933AbgEARQJ (ORCPT ); Fri, 1 May 2020 13:16:09 -0400 Received: from mail-pl1-x641.google.com (mail-pl1-x641.google.com [IPv6:2607:f8b0:4864:20::641]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E63EC061A0C for ; Fri, 1 May 2020 10:16:08 -0700 (PDT) Received: by mail-pl1-x641.google.com with SMTP id w3so3847705plz.5 for ; Fri, 01 May 2020 10:16:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=da6/kHTa4PmSLjQMbuwmheSk9zUOW8puN02Um2cjqfY=; b=DBpS263QMw5+MtOoiLyAmY6fQZOYrYNAGwCi0tNjVcbT6AqH3gpz6A9dWFGm4mgnEp bkd/3rFxMxpUTZUBIfRkEFAswfnECV223JcYZbMgp2PgtZRTN4Q4/UOQUGeNxCqN0+Xj I7MQrpMEHqVdghyv3p7sCep0nGhNgU1gfyokLhkJHAp/FqUyeWaPy+YpSAlqaAo1azKV 8iKcjitszyn5f8H/oG22o2tZ7Qm5o25Ui19Od8cgrHqpwTLXYFoR9878LvGiUSpl0nkN lpiyzH993iNG52/4LMXWtV55X03tWJJ/qsRV16CVaxSFEP9FqRi6GX/WSKSuGjJWGtYg bCBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=da6/kHTa4PmSLjQMbuwmheSk9zUOW8puN02Um2cjqfY=; b=neMaXt3WWzEu9Rlv/p1rI2DUZSm/9vtlKUd9Xdeo/lEHHZ8iF+ghvzv8U5Bla2bJ/w AQi4F2LDwkSvdvrO6+jh/rZvoOAzpAa8NNmIbg6E9nLZ19icbfa7WatJlKckjPP3FwfV kK92oTs22I1FmeoRyNVnMJ+pnKDEwfumNSZaMcVNW4+5inn+aGuo/QtBRpBGBUClCot2 a0D/lkpool/fnPzAgH/PUTdJg52BYQv1knbU9IgNjHwAJELJVWDU2gPiDlYYXbMcSfLg pD2qvinelN/RgZrJS7AO6klcmOSoLYBfp2tBj/WoWUYnKr2CsL7iCXU645F/XL3w72hf h/Vg== X-Gm-Message-State: AGi0PubCqsyadFEiNfAvclVwvwvkZzscUSS+6x5gVCIlrL6nk0YGujST Zci7BoxEpN5ZL0WzNQ4ltnq0VilH X-Google-Smtp-Source: APiQypLEHLY7P5/rVu4uifih+nyf4vN5dlGCEhLuaXE/lzWAriDGJUwU7da6JEPbHRKY6txWdgkp2A== X-Received: by 2002:a17:90a:6343:: with SMTP id v3mr646254pjs.127.1588353367674; Fri, 01 May 2020 10:16:07 -0700 (PDT) Received: from mappy.hsd1.ca.comcast.net (c-107-3-184-99.hsd1.ca.comcast.net. [107.3.184.99]) by smtp.gmail.com with ESMTPSA id g14sm2733966pfh.49.2020.05.01.10.16.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 May 2020 10:16:07 -0700 (PDT) From: Steve Longerbeam To: linux-media@vger.kernel.org Cc: Sakari Ailus , Mauro Carvalho Chehab , Hans Verkuil , Rui Miguel Silva , Laurent Pinchart , Philipp Zabel , Steve Longerbeam Subject: [PATCH v6 04/22] media: video-mux: Parse information from firmware without using callbacks Date: Fri, 1 May 2020 10:15:38 -0700 Message-Id: <20200501171556.14731-5-slongerbeam@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200501171556.14731-1-slongerbeam@gmail.com> References: <20200501171556.14731-1-slongerbeam@gmail.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Instead of using the convenience function v4l2_async_register_fwnode_subdev(), parse the video-mux input endpoints and set up the async sub-devices without using callbacks. The video-mux knows which ports it must parse (the input ports) and how to handle unconnected remotes, so it makes the code simpler to transfer control of endpoint parsing to the driver. Signed-off-by: Steve Longerbeam --- drivers/media/platform/video-mux.c | 70 ++++++++++++++++++++---------- 1 file changed, 46 insertions(+), 24 deletions(-) diff --git a/drivers/media/platform/video-mux.c b/drivers/media/platform/video-mux.c index ddd0e338f9e4..7b6c96a29aa5 100644 --- a/drivers/media/platform/video-mux.c +++ b/drivers/media/platform/video-mux.c @@ -21,6 +21,7 @@ struct video_mux { struct v4l2_subdev subdev; + struct v4l2_async_notifier notifier; struct media_pad *pads; struct v4l2_mbus_framefmt *format_mbus; struct mux_control *mux; @@ -330,36 +331,49 @@ static const struct v4l2_subdev_ops video_mux_subdev_ops = { .video = &video_mux_subdev_video_ops, }; -static int video_mux_parse_endpoint(struct device *dev, - struct v4l2_fwnode_endpoint *vep, - struct v4l2_async_subdev *asd) -{ - /* - * it's not an error if remote is missing on a video-mux - * input port, return -ENOTCONN to skip this endpoint with - * no error. - */ - return fwnode_device_is_available(asd->match.fwnode) ? 0 : -ENOTCONN; -} - static int video_mux_async_register(struct video_mux *vmux, unsigned int num_input_pads) { - unsigned int i, *ports; + unsigned int i; int ret; - ports = kcalloc(num_input_pads, sizeof(*ports), GFP_KERNEL); - if (!ports) - return -ENOMEM; - for (i = 0; i < num_input_pads; i++) - ports[i] = i; + v4l2_async_notifier_init(&vmux->notifier); - ret = v4l2_async_register_fwnode_subdev( - &vmux->subdev, sizeof(struct v4l2_async_subdev), - ports, num_input_pads, video_mux_parse_endpoint); + for (i = 0; i < num_input_pads; i++) { + struct v4l2_async_subdev *asd; + struct fwnode_handle *ep; - kfree(ports); - return ret; + ep = fwnode_graph_get_endpoint_by_id( + dev_fwnode(vmux->subdev.dev), i, 0, + FWNODE_GRAPH_ENDPOINT_NEXT); + if (!ep) + continue; + + asd = kzalloc(sizeof(*asd), GFP_KERNEL); + if (!asd) { + fwnode_handle_put(ep); + return -ENOMEM; + } + + ret = v4l2_async_notifier_add_fwnode_remote_subdev( + &vmux->notifier, ep, asd); + + fwnode_handle_put(ep); + + if (ret) { + kfree(asd); + /* OK if asd already exists */ + if (ret != -EEXIST) + return ret; + } + } + + ret = v4l2_async_subdev_notifier_register(&vmux->subdev, + &vmux->notifier); + if (ret) + return ret; + + return v4l2_async_register_subdev(&vmux->subdev); } static int video_mux_probe(struct platform_device *pdev) @@ -434,7 +448,13 @@ static int video_mux_probe(struct platform_device *pdev) vmux->subdev.entity.ops = &video_mux_ops; - return video_mux_async_register(vmux, num_pads - 1); + ret = video_mux_async_register(vmux, num_pads - 1); + if (ret) { + v4l2_async_notifier_unregister(&vmux->notifier); + v4l2_async_notifier_cleanup(&vmux->notifier); + } + + return ret; } static int video_mux_remove(struct platform_device *pdev) @@ -442,6 +462,8 @@ static int video_mux_remove(struct platform_device *pdev) struct video_mux *vmux = platform_get_drvdata(pdev); struct v4l2_subdev *sd = &vmux->subdev; + v4l2_async_notifier_unregister(&vmux->notifier); + v4l2_async_notifier_cleanup(&vmux->notifier); v4l2_async_unregister_subdev(sd); media_entity_cleanup(&sd->entity); From patchwork Fri May 1 17:15:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Longerbeam X-Patchwork-Id: 209994 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B5D7EC47257 for ; Fri, 1 May 2020 17:16:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 918DF2137B for ; Fri, 1 May 2020 17:16:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="eQgYazT0" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729182AbgEARQM (ORCPT ); Fri, 1 May 2020 13:16:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58044 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1728970AbgEARQL (ORCPT ); Fri, 1 May 2020 13:16:11 -0400 Received: from mail-pf1-x441.google.com (mail-pf1-x441.google.com [IPv6:2607:f8b0:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 27F30C061A0C for ; Fri, 1 May 2020 10:16:11 -0700 (PDT) Received: by mail-pf1-x441.google.com with SMTP id y25so1837140pfn.5 for ; Fri, 01 May 2020 10:16:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=pw/KWtB3cpNCCKjjUKy2o/QpPcKDD4Imxdz62soASJ8=; b=eQgYazT0syAKPkzd3IwUdSu6HnNkPO+JEmCibV8D6LfY3aBs+JLljAxz7HsKGRAPUh EpLZrphVns1wfoMaRIsuG+B9wTwiwfRiPTqL+Lf8ho7ZSKtTurTY5u9toFh1MgWk1OzR KhTbySO2jk5KqIny0tUgGHdJy+31PlEG8IJq/3+yfTQ8H29ADMMZwosm6ZXslw3GjSIx FDrukisVCUXLql1lTqcVcoj6stScWIBtdTLOYvSx5/0bw2shH++wpjt/SN+YEc0yz+Yq 6ajaAuINery7B/u6ZXVGMypJKO2eZN0vLjGqfrCQ6+wL9yvDaTPS7M+PRas6rzo5zzt3 zmjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=pw/KWtB3cpNCCKjjUKy2o/QpPcKDD4Imxdz62soASJ8=; b=dlRzFazDaKSHiNp8MzMP/sdLaxQfkF/0mSqKA5pyeDboo8i3sq7hnc3OdAMheHI1Dz WDByEHwpzjwLucPsYfTk9DZUX5rEUkinF1CORxCa4vSGhYFD3JxYLzbINcjvQ7oZtkrE sLw9nazQ+iF6uW+ow0IPEVuTYdF2Hx0ZDLdqzh6YmTkcgv78QrtpJntpt1sqlkJV3aaE sgis19hwZQ8hxa2srqIOiSnHjO/x9kFlpnUJZP21MdZMkbfSzaFfKC6UK773zsjfdtN1 /MOZvSTXV1d0L6w1UzEwMqBm+7l+QjzznYZY2r3xBweX70lbIBi1kSuyf0YJNQTPxrSX pMpQ== X-Gm-Message-State: AGi0PuYgfDo1GOdOy+Srf7RoyJ4K1J/ipqfz4nmNN9e6Dyyz+dN4tMmG U4F5z6sw1LnzqmEIu1I9TbokV1Yh X-Google-Smtp-Source: APiQypJ7AX0j0MUPsyJlh5TTDApKzh3UZIOL8CHcnPY9JYTZAdfVjyZUGvYz2vM49x9AoNBwxKxhRg== X-Received: by 2002:a62:144c:: with SMTP id 73mr5147723pfu.37.1588353370344; Fri, 01 May 2020 10:16:10 -0700 (PDT) Received: from mappy.hsd1.ca.comcast.net (c-107-3-184-99.hsd1.ca.comcast.net. [107.3.184.99]) by smtp.gmail.com with ESMTPSA id g14sm2733966pfh.49.2020.05.01.10.16.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 May 2020 10:16:09 -0700 (PDT) From: Steve Longerbeam To: linux-media@vger.kernel.org Cc: Sakari Ailus , Mauro Carvalho Chehab , Hans Verkuil , Rui Miguel Silva , Laurent Pinchart , Philipp Zabel , Steve Longerbeam Subject: [PATCH v6 06/22] Revert "media: v4l2-fwnode: Add a convenience function for registering subdevs with notifiers" Date: Fri, 1 May 2020 10:15:40 -0700 Message-Id: <20200501171556.14731-7-slongerbeam@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200501171556.14731-1-slongerbeam@gmail.com> References: <20200501171556.14731-1-slongerbeam@gmail.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org The users of v4l2_async_register_fwnode_subdev() have switched to parsing their endpoints and setting up async sub-device lists in their notifiers locally, without using the endpoint parsing callbacks. There are no more users of v4l2_async_register_fwnode_subdev() so this convenience function can be removed. This reverts commit 1634f0eded87d1f150e823fa56cd782ea0775eb2. Signed-off-by: Steve Longerbeam --- drivers/media/v4l2-core/v4l2-fwnode.c | 62 --------------------------- include/media/v4l2-fwnode.h | 38 ---------------- 2 files changed, 100 deletions(-) diff --git a/drivers/media/v4l2-core/v4l2-fwnode.c b/drivers/media/v4l2-core/v4l2-fwnode.c index 97f0f8b23b5d..e1f273ae8522 100644 --- a/drivers/media/v4l2-core/v4l2-fwnode.c +++ b/drivers/media/v4l2-core/v4l2-fwnode.c @@ -1323,68 +1323,6 @@ int v4l2_async_register_subdev_sensor_common(struct v4l2_subdev *sd) } EXPORT_SYMBOL_GPL(v4l2_async_register_subdev_sensor_common); -int v4l2_async_register_fwnode_subdev(struct v4l2_subdev *sd, - size_t asd_struct_size, - unsigned int *ports, - unsigned int num_ports, - parse_endpoint_func parse_endpoint) -{ - struct v4l2_async_notifier *notifier; - struct device *dev = sd->dev; - struct fwnode_handle *fwnode; - int ret; - - if (WARN_ON(!dev)) - return -ENODEV; - - fwnode = dev_fwnode(dev); - if (!fwnode_device_is_available(fwnode)) - return -ENODEV; - - notifier = kzalloc(sizeof(*notifier), GFP_KERNEL); - if (!notifier) - return -ENOMEM; - - v4l2_async_notifier_init(notifier); - - if (!ports) { - ret = v4l2_async_notifier_parse_fwnode_endpoints(dev, notifier, - asd_struct_size, - parse_endpoint); - if (ret < 0) - goto out_cleanup; - } else { - unsigned int i; - - for (i = 0; i < num_ports; i++) { - ret = v4l2_async_notifier_parse_fwnode_endpoints_by_port(dev, notifier, asd_struct_size, ports[i], parse_endpoint); - if (ret < 0) - goto out_cleanup; - } - } - - ret = v4l2_async_subdev_notifier_register(sd, notifier); - if (ret < 0) - goto out_cleanup; - - ret = v4l2_async_register_subdev(sd); - if (ret < 0) - goto out_unregister; - - sd->subdev_notifier = notifier; - - return 0; - -out_unregister: - v4l2_async_notifier_unregister(notifier); -out_cleanup: - v4l2_async_notifier_cleanup(notifier); - kfree(notifier); - - return ret; -} -EXPORT_SYMBOL_GPL(v4l2_async_register_fwnode_subdev); - MODULE_LICENSE("GPL"); MODULE_AUTHOR("Sakari Ailus "); MODULE_AUTHOR("Sylwester Nawrocki "); diff --git a/include/media/v4l2-fwnode.h b/include/media/v4l2-fwnode.h index dd82d6d9764e..fad7a6480bf9 100644 --- a/include/media/v4l2-fwnode.h +++ b/include/media/v4l2-fwnode.h @@ -20,7 +20,6 @@ #include #include -#include struct fwnode_handle; struct v4l2_async_notifier; @@ -490,43 +489,6 @@ v4l2_async_notifier_parse_fwnode_endpoints_by_port(struct device *dev, int v4l2_async_notifier_parse_fwnode_sensor_common(struct device *dev, struct v4l2_async_notifier *notifier); -/** - * v4l2_async_register_fwnode_subdev - registers a sub-device to the - * asynchronous sub-device framework - * and parses fwnode endpoints - * - * @sd: pointer to struct &v4l2_subdev - * @asd_struct_size: size of the driver's async sub-device struct, including - * sizeof(struct v4l2_async_subdev). The &struct - * v4l2_async_subdev shall be the first member of - * the driver's async sub-device struct, i.e. both - * begin at the same memory address. - * @ports: array of port id's to parse for fwnode endpoints. If NULL, will - * parse all ports owned by the sub-device. - * @num_ports: number of ports in @ports array. Ignored if @ports is NULL. - * @parse_endpoint: Driver's callback function called on each V4L2 fwnode - * endpoint. Optional. - * - * This function is just like v4l2_async_register_subdev() with the - * exception that calling it will also allocate a notifier for the - * sub-device, parse the sub-device's firmware node endpoints using - * v4l2_async_notifier_parse_fwnode_endpoints() or - * v4l2_async_notifier_parse_fwnode_endpoints_by_port(), and - * registers the sub-device notifier. The sub-device is similarly - * unregistered by calling v4l2_async_unregister_subdev(). - * - * While registered, the subdev module is marked as in-use. - * - * An error is returned if the module is no longer loaded on any attempts - * to register it. - */ -int -v4l2_async_register_fwnode_subdev(struct v4l2_subdev *sd, - size_t asd_struct_size, - unsigned int *ports, - unsigned int num_ports, - parse_endpoint_func parse_endpoint); - /* Helper macros to access the connector links. */ /** v4l2_connector_last_link - Helper macro to get the first From patchwork Fri May 1 17:15:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Longerbeam X-Patchwork-Id: 209993 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5E53FC47253 for ; Fri, 1 May 2020 17:16:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3FEBB2173E for ; Fri, 1 May 2020 17:16:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="MZAqA2Cj" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729391AbgEARQO (ORCPT ); Fri, 1 May 2020 13:16:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58058 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1728970AbgEARQO (ORCPT ); Fri, 1 May 2020 13:16:14 -0400 Received: from mail-pg1-x541.google.com (mail-pg1-x541.google.com [IPv6:2607:f8b0:4864:20::541]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 401F6C061A0C for ; Fri, 1 May 2020 10:16:14 -0700 (PDT) Received: by mail-pg1-x541.google.com with SMTP id s18so4801743pgl.12 for ; Fri, 01 May 2020 10:16:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Dg8KbWlDnXHLMKnZ1WrAv3cvcCZ02gA3fmDwwT1MLdE=; b=MZAqA2CjwAT26XTGJdTdHWTS8QFPG66KdQsvoxIaMfUcb9SW1nhNkk0FbcyQ7rDWzT pKPp6q0cVV8bn+jP2V/ayKAsw0T1mj3/2Bv+vuD2YOLTcewnbRK8R76y+bX4z8s7ldsr cRiYQkCAHE3S2NDrnrj6hbJnG3WNeDp09SDNyNoJxbC3NLjS8XUgzdxnFDH1AnmGyCOc rnSlAgolEWfcBUXYUUXh0BdTKFsayXO1pAcBCrO6WnPWE2wxOLuSUtEmBz9DUn0++6Al uLvR4c8IX1zZPcj3wmz92H2HR4NTK5BTK6qN3IXDcjRdKimfXhNSSz1hUP//XdD07g80 EhOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Dg8KbWlDnXHLMKnZ1WrAv3cvcCZ02gA3fmDwwT1MLdE=; b=ORGzeu+TL4d6ygC4eopodgFkF5a37tq1GuZDvvcCSQ1q06JovLhZY/JyhC2FbDWWIm TN58YX8wPzq+AaNq0PVM6nDQJTaX/ycdsRJZe4+iXLN4xl4EibqGK9ef3bn2lWhyBZhm 2OHijGQ2HBbfeoBHpIUVgUNQCKdi9m2rZ2h0vifzc9QaptpX/OjFkVAEgPcNj8Voo+70 e+qXPBKgV+2uMzQXpcIo1P/083lkM+yVwwtGKnE7U8aCk0hPeYdiWHA0UdW1QGeh3DAm F40/AITE8+QfmWbPJkTplnwKinSLg5388B+iSR2tEU+Dan8sd4jQ98ay8P58yT2et9Z8 3muQ== X-Gm-Message-State: AGi0PuZsbHdI1yTFTR/s1f/wQIy+odd9ZZugiCv712iNMniD+eQoqNBk fscmRPmNBmnaKH+0wwV8itm7aVli X-Google-Smtp-Source: APiQypKjpyvPjhTSlYMGrs9b6jk6kWM/eW7i7uxdOlWjbDnawVoR6fGbEE6rJxmf7NrQdvEpRmk6og== X-Received: by 2002:a62:7ece:: with SMTP id z197mr5309425pfc.244.1588353373272; Fri, 01 May 2020 10:16:13 -0700 (PDT) Received: from mappy.hsd1.ca.comcast.net (c-107-3-184-99.hsd1.ca.comcast.net. [107.3.184.99]) by smtp.gmail.com with ESMTPSA id g14sm2733966pfh.49.2020.05.01.10.16.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 May 2020 10:16:12 -0700 (PDT) From: Steve Longerbeam To: linux-media@vger.kernel.org Cc: Sakari Ailus , Mauro Carvalho Chehab , Hans Verkuil , Rui Miguel Silva , Laurent Pinchart , Philipp Zabel , Steve Longerbeam Subject: [PATCH v6 08/22] media: video-mux: Implement get_fwnode_pad op Date: Fri, 1 May 2020 10:15:42 -0700 Message-Id: <20200501171556.14731-9-slongerbeam@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200501171556.14731-1-slongerbeam@gmail.com> References: <20200501171556.14731-1-slongerbeam@gmail.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Use v4l2_subdev_get_fwnode_pad_1_to_1() as the get_fwnode_pad operation. The video mux maps fwnode port numbers and pad indexes 1:1. Signed-off-by: Steve Longerbeam --- drivers/media/platform/video-mux.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/media/platform/video-mux.c b/drivers/media/platform/video-mux.c index 7b6c96a29aa5..9f148f403603 100644 --- a/drivers/media/platform/video-mux.c +++ b/drivers/media/platform/video-mux.c @@ -97,6 +97,7 @@ static int video_mux_link_setup(struct media_entity *entity, static const struct media_entity_operations video_mux_ops = { .link_setup = video_mux_link_setup, .link_validate = v4l2_subdev_link_validate, + .get_fwnode_pad = v4l2_subdev_get_fwnode_pad_1_to_1, }; static int video_mux_s_stream(struct v4l2_subdev *sd, int enable) From patchwork Fri May 1 17:15:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Longerbeam X-Patchwork-Id: 209992 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 03F6DC47253 for ; Fri, 1 May 2020 17:16:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D841824955 for ; Fri, 1 May 2020 17:16:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ekX8ni4H" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729447AbgEARQR (ORCPT ); Fri, 1 May 2020 13:16:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58068 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1728970AbgEARQQ (ORCPT ); Fri, 1 May 2020 13:16:16 -0400 Received: from mail-pl1-x643.google.com (mail-pl1-x643.google.com [IPv6:2607:f8b0:4864:20::643]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BEDA0C061A0C for ; Fri, 1 May 2020 10:16:16 -0700 (PDT) Received: by mail-pl1-x643.google.com with SMTP id b6so570674plz.13 for ; Fri, 01 May 2020 10:16:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Ew8ODtHZB2v9klvRNnpmtFZWxf7EehbfPJw388DD5Ig=; b=ekX8ni4HBJWGQDnPDSV7REbK9E4efv3nRbPgv5AmoAnbGZ2OTcXKXFUNvwODKDyU2d GA4xn0hS8SBXp8W7paEmlPkNw/cXmdoPfxrXD0RdD0XTP1nNaeV3JOWlp7yWjdNZLvmC 19JLExz6aumQguIHcDet0E6aKNrphau6cayf9JKb9i2TW549SHBcwRmVx1Lm+F7TXAQ4 dyCdOxGR9VcI9M0PNXh0mC+d84t1Z6O/iLkExwSkYg/Zf0Qo0JXPpkk+WEhUY/Y7FjiR rIcoPdjzlQrf/AnJ9UpzrtRTD8evoS41AT1piQxDHSoXxEpntPZ8k7ZjiYZF8TnKnAle 25gA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Ew8ODtHZB2v9klvRNnpmtFZWxf7EehbfPJw388DD5Ig=; b=UWcvY4O+iQ2fe9IY+Dwj/aDHtE9YPBkWkXVkryPuuc5LbRfGAhg2w6TJeTi4Evw9lN rGNaTWXFLn79jkiIQlAs9/J0nqnC/fSqX/fjm/+6gqM2u5jieBEBlySXNOIvBKMzLcJY 26rAQYtQR5oJ49pK7a9PbInsAjMgM/LQmdAkKttDxc781qALTpIOlhmjPQGo0mAu0IaY g/U2FwpA+xgLV3O5kr0n0O66IR0hRgub1b005po9ayg+SDlNmMMNM4ngR0Owqe9agFl3 gGXnDRU0r/i8sHB6STYsVYBYIbCgwW9LOr1/IAAjFbR2oDfKf6aOUs99DYrD9FCiTooH RQ+A== X-Gm-Message-State: AGi0Pubg/j/fowzrRKOJOLaQZ7SMyWVb9kkIScH+EW1Ugs3siDgfP3U5 cBSbSA3fbhPXw+8q7dnAVPFxmh/I X-Google-Smtp-Source: APiQypLqH8lJLySrWVJnqsD50s4VKr2/Ls881t2bEXV+tGt2rFdammAF85urgRVhuI31yBmqD9wxzw== X-Received: by 2002:a17:90a:3343:: with SMTP id m61mr758801pjb.112.1588353375930; Fri, 01 May 2020 10:16:15 -0700 (PDT) Received: from mappy.hsd1.ca.comcast.net (c-107-3-184-99.hsd1.ca.comcast.net. [107.3.184.99]) by smtp.gmail.com with ESMTPSA id g14sm2733966pfh.49.2020.05.01.10.16.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 May 2020 10:16:15 -0700 (PDT) From: Steve Longerbeam To: linux-media@vger.kernel.org Cc: Sakari Ailus , Mauro Carvalho Chehab , Hans Verkuil , Rui Miguel Silva , Laurent Pinchart , Philipp Zabel , Steve Longerbeam Subject: [PATCH v6 10/22] media: imx: imx7-mipi-csis: Implement get_fwnode_pad op Date: Fri, 1 May 2020 10:15:44 -0700 Message-Id: <20200501171556.14731-11-slongerbeam@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200501171556.14731-1-slongerbeam@gmail.com> References: <20200501171556.14731-1-slongerbeam@gmail.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Use v4l2_subdev_get_fwnode_pad_1_to_1() as the get_fwnode_pad operation. The imx7-mipi-csis maps port numbers and pad indexes 1:1. Signed-off-by: Steve Longerbeam --- drivers/staging/media/imx/imx7-mipi-csis.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/media/imx/imx7-mipi-csis.c b/drivers/staging/media/imx/imx7-mipi-csis.c index b66299c1136d..7b5c3e662d0d 100644 --- a/drivers/staging/media/imx/imx7-mipi-csis.c +++ b/drivers/staging/media/imx/imx7-mipi-csis.c @@ -906,6 +906,7 @@ static const struct v4l2_subdev_core_ops mipi_csis_core_ops = { static const struct media_entity_operations mipi_csis_entity_ops = { .link_setup = mipi_csis_link_setup, .link_validate = v4l2_subdev_link_validate, + .get_fwnode_pad = v4l2_subdev_get_fwnode_pad_1_to_1, }; static const struct v4l2_subdev_video_ops mipi_csis_video_ops = { From patchwork Fri May 1 17:15:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Longerbeam X-Patchwork-Id: 209991 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D01B9C47257 for ; Fri, 1 May 2020 17:16:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B1BE624956 for ; Fri, 1 May 2020 17:16:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="das/IGQR" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729535AbgEARQU (ORCPT ); Fri, 1 May 2020 13:16:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1728970AbgEARQT (ORCPT ); Fri, 1 May 2020 13:16:19 -0400 Received: from mail-pj1-x1043.google.com (mail-pj1-x1043.google.com [IPv6:2607:f8b0:4864:20::1043]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F5A3C061A0C for ; Fri, 1 May 2020 10:16:19 -0700 (PDT) Received: by mail-pj1-x1043.google.com with SMTP id a5so146433pjh.2 for ; Fri, 01 May 2020 10:16:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=BnMGjNnDbs7knQNG08RhDP1eWnGEoczFnCi38jnuKiY=; b=das/IGQR7zyQOTvEceNfRO9GvX26AdyGcY0THN9bP6n3FsnSbtVFXp42pmyf/xhmGW CWF1dv9xtUOWq+hQ53RPeYAbp2i8Gjyr2kTLGtILug4KoNdPPW5+nbk3a2oZWYMWRE2r byS5/pewuzpzg/rycpO+nMKsuhPMS3kGCCw7/UV2ox0nYK6x6lZjPnp0Z/yTRRbS/BMs Bs2UblLGAQ7EqykvGJrupbwe9eIF9S3kpq/H4OTtXMsk7hC4R1+cPPoKSMDGxPUyyGSV AAJ+ZEdUt53DWp4XMWmMjLzh2WcY4g02OGMZa2vJ68F3Upsj9vew8IiKqd93fzxgxhja qDDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=BnMGjNnDbs7knQNG08RhDP1eWnGEoczFnCi38jnuKiY=; b=fv3a04RUuDln0wCkBpvgBhGDTo8VDq9CHT3ThjvqsGuNyz6acZYrocEIfjZqpGi3pt YC10yIy5w3NxVMVD6EN2OlYcdMQ+3CscGC4dAeWVv8bAecQMiw4UpjFKEi/Jli2TRKx2 OlidpBYbaPiypKxpgL5ni9PsDEMxvf+wGC+t+07lbMm2q02J62giW6jAjSkSCCNx4Vqt bBSzJzmG1XyRS7wJpjvks0Fz0FeN5Zrtu3TH5XX4B1tSI7cKdazY+zbA40LsGmKwEVOb w1ZpEdxAJE7Dqal2tegXTuiExHfQiT7+lOYMqcGTxFAEOZs3Z8JUCIIKajFneDmXTc3o CrbA== X-Gm-Message-State: AGi0PubcxLAnYx4ot4dVKyFjsL0oouE81Vw7tHjoMe0Yy5dojqLs6Rjv KVSElfS9istUgR2jmCPEJiISAiuZ X-Google-Smtp-Source: APiQypJGrGmH0EYP1tEyCcspnlrATc+MAyOfXZE0KiBc8uDCPyPyyXDLlT3PcksKjpkb7Pb8DSj9ug== X-Received: by 2002:a17:90a:2943:: with SMTP id x3mr666937pjf.63.1588353378703; Fri, 01 May 2020 10:16:18 -0700 (PDT) Received: from mappy.hsd1.ca.comcast.net (c-107-3-184-99.hsd1.ca.comcast.net. [107.3.184.99]) by smtp.gmail.com with ESMTPSA id g14sm2733966pfh.49.2020.05.01.10.16.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 May 2020 10:16:18 -0700 (PDT) From: Steve Longerbeam To: linux-media@vger.kernel.org Cc: Sakari Ailus , Mauro Carvalho Chehab , Hans Verkuil , Rui Miguel Silva , Laurent Pinchart , Philipp Zabel , Steve Longerbeam Subject: [PATCH v6 12/22] media: video-mux: Create media links in bound notifier Date: Fri, 1 May 2020 10:15:46 -0700 Message-Id: <20200501171556.14731-13-slongerbeam@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200501171556.14731-1-slongerbeam@gmail.com> References: <20200501171556.14731-1-slongerbeam@gmail.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Implement a notifier bound op to register media links from the remote sub-device's source pad(s) to the video-mux sink pad(s). Signed-off-by: Steve Longerbeam --- Changes in v5: - went back to something similar to v2. A call is made to helper v4l2_create_fwnode_links(). Changes in v4: - none Changes in v3: - this version does the work inline. The previous version called a media_create_fwnode_links() which is removed in v3. --- drivers/media/platform/video-mux.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/media/platform/video-mux.c b/drivers/media/platform/video-mux.c index 9f148f403603..53570250a25d 100644 --- a/drivers/media/platform/video-mux.c +++ b/drivers/media/platform/video-mux.c @@ -17,6 +17,7 @@ #include #include #include +#include #include struct video_mux { @@ -36,6 +37,12 @@ static const struct v4l2_mbus_framefmt video_mux_format_mbus_default = { .field = V4L2_FIELD_NONE, }; +static inline struct video_mux * +notifier_to_video_mux(struct v4l2_async_notifier *n) +{ + return container_of(n, struct video_mux, notifier); +} + static inline struct video_mux *v4l2_subdev_to_video_mux(struct v4l2_subdev *sd) { return container_of(sd, struct video_mux, subdev); @@ -332,6 +339,19 @@ static const struct v4l2_subdev_ops video_mux_subdev_ops = { .video = &video_mux_subdev_video_ops, }; +static int video_mux_notify_bound(struct v4l2_async_notifier *notifier, + struct v4l2_subdev *sd, + struct v4l2_async_subdev *asd) +{ + struct video_mux *vmux = notifier_to_video_mux(notifier); + + return v4l2_create_fwnode_links(sd, &vmux->subdev); +} + +static const struct v4l2_async_notifier_operations video_mux_notify_ops = { + .bound = video_mux_notify_bound, +}; + static int video_mux_async_register(struct video_mux *vmux, unsigned int num_input_pads) { @@ -369,6 +389,8 @@ static int video_mux_async_register(struct video_mux *vmux, } } + vmux->notifier.ops = &video_mux_notify_ops; + ret = v4l2_async_subdev_notifier_register(&vmux->subdev, &vmux->notifier); if (ret) From patchwork Fri May 1 17:15:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Longerbeam X-Patchwork-Id: 209990 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 75400C4724C for ; Fri, 1 May 2020 17:16:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 574FB2137B for ; Fri, 1 May 2020 17:16:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Cqia4m0l" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729686AbgEARQW (ORCPT ); Fri, 1 May 2020 13:16:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58090 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1728970AbgEARQW (ORCPT ); Fri, 1 May 2020 13:16:22 -0400 Received: from mail-pf1-x441.google.com (mail-pf1-x441.google.com [IPv6:2607:f8b0:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E866C061A0C for ; Fri, 1 May 2020 10:16:22 -0700 (PDT) Received: by mail-pf1-x441.google.com with SMTP id p25so1819712pfn.11 for ; Fri, 01 May 2020 10:16:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=cvFFu/w/Sqd1CjEtVEg3CHkjbOlulSOPdqVl8s8dGaI=; b=Cqia4m0ldgnKSrzy62lTb8j3aY85o+cpyVKOjBunkw5WCAloV7HKA/KhDUmuoK2PPJ 6LUwK9CQR7Bq7ujIR5CLPPOOndYmTEjotw3gr/kkEaLk4q1aMBLHvyGBkaEqpt++WjpL cvY+j+tbymS453VN568HEbL5nG0q9BHa84Y3P/Svtl4wj2doEE0mcbjPbJ/26DHanVCw vaxsoLLIdEUCsoje1s9Dx8FSYGt7oVq6zuNGlkEbbFGT43Zm5Q2rYgHlrZXU/iR9wypJ zFslpGoH4n+2S0tsMLVY7JUZ7tkDkQ6/CxK+ll20NN/W4BQTUCi5Ni4D93dGE+nLdmeK Ey4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=cvFFu/w/Sqd1CjEtVEg3CHkjbOlulSOPdqVl8s8dGaI=; b=qMK7hL1hatnAoDptJV8a0XA60WeuowTZ13Nrnno8wuG6N0xVO51GKVHdvjwNgd0VXT qQX8oHydz6yZD4Ej4ntIWTtSrv8VKJbcueVYImAurh8LO6kWG5YAGmajXJhKGVjLInKV dAmL3UsJNt7V0kehqd4p6xIWF+6tSh1ojDvkdxgPg9iUtpo7FIbgozOvTi1QRrQPjyFl N8oqYyo9GuCEU95sML6/wMlsY+2Z/d3Tdn/jNSh/p9tx8v65zIOHg2M7eG+0C1ojmWlm 27Yp/vRgPGKU1MALQyRjr8Rzmf21riq5SxItBubZDHgUaIXYv3fFN7BLuTEivTXzXftm ZrLw== X-Gm-Message-State: AGi0PuajjcHEo4dsGImxFX8qSQ6V7//4sQZYwyS3KLVxJmPTXb5BW0Y1 +v9aa8An3sCqnd2OlYh3YBasgzTH X-Google-Smtp-Source: APiQypILAL97XnNE/TTeRW5PvBMLjOWPrP5SmvyHwT8HZiDhsRDvnXB7N5YuJcWlyDyF/XYNLBqi7w== X-Received: by 2002:a63:513:: with SMTP id 19mr5258582pgf.48.1588353381359; Fri, 01 May 2020 10:16:21 -0700 (PDT) Received: from mappy.hsd1.ca.comcast.net (c-107-3-184-99.hsd1.ca.comcast.net. [107.3.184.99]) by smtp.gmail.com with ESMTPSA id g14sm2733966pfh.49.2020.05.01.10.16.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 May 2020 10:16:20 -0700 (PDT) From: Steve Longerbeam To: linux-media@vger.kernel.org Cc: Sakari Ailus , Mauro Carvalho Chehab , Hans Verkuil , Rui Miguel Silva , Laurent Pinchart , Philipp Zabel , Steve Longerbeam Subject: [PATCH v6 14/22] media: imx7: mipi csis: Create media links in bound notifier Date: Fri, 1 May 2020 10:15:48 -0700 Message-Id: <20200501171556.14731-15-slongerbeam@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200501171556.14731-1-slongerbeam@gmail.com> References: <20200501171556.14731-1-slongerbeam@gmail.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Implement a notifier bound op to register media links from the remote sub-device's source pad(s) to the mipi csi-2 receiver sink pad. Signed-off-by: Steve Longerbeam --- Changes in v5: - imx_media_create_fwnode_pad_link() has been moved to core as v4l2_create_fwnode_links_to_pad(). Changes in v4: - none Changes in v3: - call a local imx-media utility imx_media_create_fwnode_pad_link(). Changes in v2: - Move notifier_to_csis_state() next to mipi_sd_to_csis_state(), remove unnecessary inline, and rename to mipi_notifier_to_csis_state(). Suggested by Rui Silva. --- drivers/staging/media/imx/imx7-mipi-csis.c | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/drivers/staging/media/imx/imx7-mipi-csis.c b/drivers/staging/media/imx/imx7-mipi-csis.c index 7b5c3e662d0d..1025e42740f1 100644 --- a/drivers/staging/media/imx/imx7-mipi-csis.c +++ b/drivers/staging/media/imx/imx7-mipi-csis.c @@ -26,6 +26,7 @@ #include #include +#include #include #define CSIS_DRIVER_NAME "imx7-mipi-csis" @@ -385,6 +386,12 @@ static int mipi_csis_dump_regs(struct csi_state *state) return 0; } +static struct csi_state * +mipi_notifier_to_csis_state(struct v4l2_async_notifier *n) +{ + return container_of(n, struct csi_state, notifier); +} + static struct csi_state *mipi_sd_to_csis_state(struct v4l2_subdev *sdev) { return container_of(sdev, struct csi_state, mipi_sd); @@ -948,6 +955,20 @@ static int mipi_csis_parse_dt(struct platform_device *pdev, static int mipi_csis_pm_resume(struct device *dev, bool runtime); +static int mipi_csis_notify_bound(struct v4l2_async_notifier *notifier, + struct v4l2_subdev *sd, + struct v4l2_async_subdev *asd) +{ + struct csi_state *state = mipi_notifier_to_csis_state(notifier); + struct media_pad *sink = &state->mipi_sd.entity.pads[CSIS_PAD_SINK]; + + return v4l2_create_fwnode_links_to_pad(sd, sink); +} + +static const struct v4l2_async_notifier_operations mipi_csis_notify_ops = { + .bound = mipi_csis_notify_bound, +}; + static int mipi_csis_subdev_init(struct v4l2_subdev *mipi_sd, struct platform_device *pdev, const struct v4l2_subdev_ops *ops) @@ -1016,6 +1037,8 @@ static int mipi_csis_async_register(struct csi_state *state) fwnode_handle_put(ep); + state->notifier.ops = &mipi_csis_notify_ops; + ret = v4l2_async_subdev_notifier_register(&state->mipi_sd, &state->notifier); if (ret) From patchwork Fri May 1 17:15:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Longerbeam X-Patchwork-Id: 209989 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 28855C47257 for ; Fri, 1 May 2020 17:16:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0A3E524954 for ; Fri, 1 May 2020 17:16:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="HKk0pN0P" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729801AbgEARQZ (ORCPT ); Fri, 1 May 2020 13:16:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58100 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1728970AbgEARQY (ORCPT ); Fri, 1 May 2020 13:16:24 -0400 Received: from mail-pf1-x443.google.com (mail-pf1-x443.google.com [IPv6:2607:f8b0:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C2485C061A0C for ; Fri, 1 May 2020 10:16:24 -0700 (PDT) Received: by mail-pf1-x443.google.com with SMTP id 18so1831737pfx.6 for ; Fri, 01 May 2020 10:16:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=g7H6Ri9yWcJp790asZwo8Gkl5sN2mkHYDZM5qgRTUO8=; b=HKk0pN0P9R0udEGF97Q8GdCXalVJISAOlTxj5t+4BeTRDQTKDeia/GR7e1V/BT2qGd JSgiyzl8M3Ng58REBps3wZ7dFLq8lC5gTzV4VPRCjViUGqQzG4IF9PcBFi3o5101UR5n 2JneKdiEbq6EdKy3Jx3clqu7avMM16NygX40EjgoECe1EShuG6slybJTt+7nmtgf7Bjj RH0OEIkJxlYysqrbXiKIOtYLjGXtMFbRdOKn5khsh5Y+NTJT5XRwfMIp/ttqFOrCYrM9 8cx+Kb6iOiPQWreq8rwuywhiDilRformQxGuGEwvR7DMOXafa/Regdei0wp+Ee8Q+4ev 8NBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=g7H6Ri9yWcJp790asZwo8Gkl5sN2mkHYDZM5qgRTUO8=; b=j3AaXnwEb18B0fx2f8RjKlMgAEw6LMqkgcUfrXDvrTxz/jjkKW9KiDxkZtCNpO5N48 XHIvPF6vIY3z0bUr5lLElcjaWesFXk+tM2qotTAmuLIfNK1fp6putfALXbD0D+wvdtMj RCg60Cx47JUONVNbHhcQP6WVOLBqZf2YSE6viyzlkzifX8tFuBWKjYlW//GXrHMo+WDT 8oUpNGKjDcTXRLs4Hnqqx70ue0ddH8io5ceTQL/ycgfN2+qArRoG2Qkh3EyYSHvCcJdY roRvDLvPT7Z2rVvQrgRqqDn/HvyoBiLx6ZEagEf4TADHSCpiyYoVti+Sim9xpQ/wF5pi VSgA== X-Gm-Message-State: AGi0PuYhCmb3+kaO9e+DJ756nKg1e96OvwhC8GlPKfJFKK6FLX/DBDw+ s7O61Gu/LEc0ebtQzweBDk2HQ6ZF X-Google-Smtp-Source: APiQypKCr3ktUWmpW+i+BLkDvjUg3N0FL72RK2+PsJGuu7/ovNnUMMWPJQNTZdwMbcwS91P2ckRbkA== X-Received: by 2002:a63:130c:: with SMTP id i12mr4920149pgl.122.1588353384057; Fri, 01 May 2020 10:16:24 -0700 (PDT) Received: from mappy.hsd1.ca.comcast.net (c-107-3-184-99.hsd1.ca.comcast.net. [107.3.184.99]) by smtp.gmail.com with ESMTPSA id g14sm2733966pfh.49.2020.05.01.10.16.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 May 2020 10:16:23 -0700 (PDT) From: Steve Longerbeam To: linux-media@vger.kernel.org Cc: Sakari Ailus , Mauro Carvalho Chehab , Hans Verkuil , Rui Miguel Silva , Laurent Pinchart , Philipp Zabel , Steve Longerbeam Subject: [PATCH v6 16/22] media: imx: csi: Create media links in bound notifier Date: Fri, 1 May 2020 10:15:50 -0700 Message-Id: <20200501171556.14731-17-slongerbeam@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200501171556.14731-1-slongerbeam@gmail.com> References: <20200501171556.14731-1-slongerbeam@gmail.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Implement a notifier bound op to register media links from the remote sub-device's source pad(s) to the CSI sink pad. Signed-off-by: Steve Longerbeam --- Changes in v5: - imx_media_create_fwnode_pad_link() has been moved to core as v4l2_create_fwnode_links_to_pad(). Changes in v4: - none Changes in v3: - call a local imx-media utility imx_media_create_fwnode_pad_link(). --- drivers/staging/media/imx/imx-media-csi.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/drivers/staging/media/imx/imx-media-csi.c b/drivers/staging/media/imx/imx-media-csi.c index 08f698af4797..a051a063a2db 100644 --- a/drivers/staging/media/imx/imx-media-csi.c +++ b/drivers/staging/media/imx/imx-media-csi.c @@ -120,6 +120,11 @@ static inline struct csi_priv *sd_to_dev(struct v4l2_subdev *sdev) return container_of(sdev, struct csi_priv, sd); } +static inline struct csi_priv *notifier_to_dev(struct v4l2_async_notifier *n) +{ + return container_of(n, struct csi_priv, notifier); +} + static inline bool is_parallel_bus(struct v4l2_fwnode_endpoint *ep) { return ep->bus_type != V4L2_MBUS_CSI2_DPHY; @@ -1894,6 +1899,20 @@ static const struct v4l2_subdev_internal_ops csi_internal_ops = { .unregistered = csi_unregistered, }; +static int imx_csi_notify_bound(struct v4l2_async_notifier *notifier, + struct v4l2_subdev *sd, + struct v4l2_async_subdev *asd) +{ + struct csi_priv *priv = notifier_to_dev(notifier); + struct media_pad *sink = &priv->sd.entity.pads[CSI_SINK_PAD]; + + return v4l2_create_fwnode_links_to_pad(sd, sink); +} + +static const struct v4l2_async_notifier_operations csi_notify_ops = { + .bound = imx_csi_notify_bound, +}; + static int imx_csi_async_register(struct csi_priv *priv) { struct v4l2_async_subdev *asd = NULL; @@ -1931,6 +1950,8 @@ static int imx_csi_async_register(struct csi_priv *priv) } } + priv->notifier.ops = &csi_notify_ops; + ret = v4l2_async_subdev_notifier_register(&priv->sd, &priv->notifier); if (ret) From patchwork Fri May 1 17:15:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Longerbeam X-Patchwork-Id: 209988 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EAA1DC47257 for ; Fri, 1 May 2020 17:16:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CB64B24953 for ; Fri, 1 May 2020 17:16:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="edc3A13C" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729885AbgEARQ3 (ORCPT ); Fri, 1 May 2020 13:16:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1729792AbgEARQ1 (ORCPT ); Fri, 1 May 2020 13:16:27 -0400 Received: from mail-pl1-x641.google.com (mail-pl1-x641.google.com [IPv6:2607:f8b0:4864:20::641]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 98EDBC061A0E for ; Fri, 1 May 2020 10:16:27 -0700 (PDT) Received: by mail-pl1-x641.google.com with SMTP id a21so280364pls.4 for ; Fri, 01 May 2020 10:16:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=iR1mKkkmKIZESgEF8BbzgebbENJGwFXvt3bpadflBeo=; b=edc3A13CnaJYaOprnVfOHCkqYgRm7iLAmR2LyO34CUt5jwHga9B39+x1eYl/q6qEm/ AkQqD9dGXJUvRrzTP1fgp7At4IFvqJD2zeCgxY3QQwgAgvK0i/Dcs9Q3SV4dbD1KhhNW Wrq2zHwUW4JLSy7Rvom5vuOKUqzHON/2Gf43GsHK8NIVwksktaQZgLj37abDhTrVudEn PsgxPlf4r0CvJlCIugshSs3DunKxEh9lKAWqSP+rjG5OIk8NnVS9l9ya6JefddNq5DF4 u1qmP3RdYLdLB2FNL+lUV4cYEyTqwL8c/NLtC6cnTttL2Ge436HM1cEjRi/+dMDicj5P Hx6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=iR1mKkkmKIZESgEF8BbzgebbENJGwFXvt3bpadflBeo=; b=Qmfy5YoVONs2EOwygQCmtOW7IlNOUFl03JNE08KSW9Vl5oMsJU10dQmeqWH/+nv0/x XwMx893eyfJiyG0sZikY6D49dMBbx+sv53fifWMdNmyXrYjjSNBrSLnw+tDgghtKai5W sjsBCYuPrArsT0JPbLn2uNuoExpAz7s9MQDT3/2mPfzkbMbEJl7wqWFeXVnU3sgoFbKE NjxhnhW5y4t5JjMAF10bd6cpO+nAaEkv5Ru8DDtlzI5jQZlezGrsdzQiphVAKthkRgIN kP/GpFgDtJqI6hWtHboZtHp2wKG8SyrGCNzS23aPd9+dP0jq0+ecJacjOseMt3rCptgm ZQHQ== X-Gm-Message-State: AGi0PuZk9Xsv0qVI9KBR1n6Xx7/shq83IMBGt4A9j7eMHI1AL9f3vHAx D1dZzTRO9Jw2iz/Hzbmf8CUgTS20 X-Google-Smtp-Source: APiQypIYuKiFBHNTkSqPILyXYmNY4ZFkUStvm/1xe5xdTzTPk4jwmU+nqXCRD6osL4lke2kRBEhvgg== X-Received: by 2002:a17:90b:30cb:: with SMTP id hi11mr679774pjb.103.1588353386774; Fri, 01 May 2020 10:16:26 -0700 (PDT) Received: from mappy.hsd1.ca.comcast.net (c-107-3-184-99.hsd1.ca.comcast.net. [107.3.184.99]) by smtp.gmail.com with ESMTPSA id g14sm2733966pfh.49.2020.05.01.10.16.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 May 2020 10:16:26 -0700 (PDT) From: Steve Longerbeam To: linux-media@vger.kernel.org Cc: Sakari Ailus , Mauro Carvalho Chehab , Hans Verkuil , Rui Miguel Silva , Laurent Pinchart , Philipp Zabel , Steve Longerbeam Subject: [PATCH v6 18/22] media: imx5/6/7: csi: Mark a bound video mux as a CSI mux Date: Fri, 1 May 2020 10:15:52 -0700 Message-Id: <20200501171556.14731-19-slongerbeam@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200501171556.14731-1-slongerbeam@gmail.com> References: <20200501171556.14731-1-slongerbeam@gmail.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org For i.MX5/6, if the bound subdev is a video mux, it must be one of the CSI muxes, and for i.MX7, the bound subdev must always be a CSI mux. So if the bound subdev is a video mux, mark it as a CSI mux with a new group id IMX_MEDIA_GRP_ID_CSI_MUX. In the process use the new group id in csi_get_upstream_endpoint(), and do some cleanup in that function for better readability. Suggested-by: Laurent Pinchart Signed-off-by: Steve Longerbeam --- drivers/staging/media/imx/imx-media-csi.c | 45 +++++++++++++--------- drivers/staging/media/imx/imx-media.h | 1 + drivers/staging/media/imx/imx7-media-csi.c | 7 ++++ 3 files changed, 35 insertions(+), 18 deletions(-) diff --git a/drivers/staging/media/imx/imx-media-csi.c b/drivers/staging/media/imx/imx-media-csi.c index a051a063a2db..6cfbe67c43d1 100644 --- a/drivers/staging/media/imx/imx-media-csi.c +++ b/drivers/staging/media/imx/imx-media-csi.c @@ -165,7 +165,6 @@ static int csi_get_upstream_endpoint(struct csi_priv *priv, struct v4l2_fwnode_endpoint *ep) { struct device_node *endpoint, *port; - struct media_entity *src; struct v4l2_subdev *sd; struct media_pad *pad; @@ -176,30 +175,33 @@ static int csi_get_upstream_endpoint(struct csi_priv *priv, return -EPIPE; sd = priv->src_sd; - src = &sd->entity; - if (src->function == MEDIA_ENT_F_VID_MUX) { + switch (sd->grp_id) { + case IMX_MEDIA_GRP_ID_CSI_MUX: /* - * CSI is connected directly to video mux, skip up to + * CSI is connected directly to CSI mux, skip up to * CSI-2 receiver if it is in the path, otherwise stay - * with video mux. + * with the CSI mux. */ - sd = imx_media_pipeline_subdev(src, IMX_MEDIA_GRP_ID_CSI2, + sd = imx_media_pipeline_subdev(&sd->entity, + IMX_MEDIA_GRP_ID_CSI2, true); - if (!IS_ERR(sd)) - src = &sd->entity; + if (IS_ERR(sd)) + sd = priv->src_sd; + break; + case IMX_MEDIA_GRP_ID_CSI2: + break; + default: + /* + * the source is neither the CSI mux nor the CSI-2 receiver, + * get the source pad directly upstream from CSI itself. + */ + sd = &priv->sd; + break; } - /* - * If the source is neither the video mux nor the CSI-2 receiver, - * get the source pad directly upstream from CSI itself. - */ - if (src->function != MEDIA_ENT_F_VID_MUX && - sd->grp_id != IMX_MEDIA_GRP_ID_CSI2) - src = &priv->sd.entity; - - /* get source pad of entity directly upstream from src */ - pad = imx_media_pipeline_pad(src, 0, 0, true); + /* get source pad of entity directly upstream from sd */ + pad = imx_media_pipeline_pad(&sd->entity, 0, 0, true); if (!pad) return -ENODEV; @@ -1906,6 +1908,13 @@ static int imx_csi_notify_bound(struct v4l2_async_notifier *notifier, struct csi_priv *priv = notifier_to_dev(notifier); struct media_pad *sink = &priv->sd.entity.pads[CSI_SINK_PAD]; + /* + * If the subdev is a video mux, it must be one of the CSI + * muxes. Mark it as such via its group id. + */ + if (sd->entity.function == MEDIA_ENT_F_VID_MUX) + sd->grp_id = IMX_MEDIA_GRP_ID_CSI_MUX; + return v4l2_create_fwnode_links_to_pad(sd, sink); } diff --git a/drivers/staging/media/imx/imx-media.h b/drivers/staging/media/imx/imx-media.h index ca36beca16de..b5b7d3245727 100644 --- a/drivers/staging/media/imx/imx-media.h +++ b/drivers/staging/media/imx/imx-media.h @@ -311,5 +311,6 @@ void imx_media_csc_scaler_device_unregister(struct imx_media_video_dev *vdev); #define IMX_MEDIA_GRP_ID_IPU_IC_PRP BIT(13) #define IMX_MEDIA_GRP_ID_IPU_IC_PRPENC BIT(14) #define IMX_MEDIA_GRP_ID_IPU_IC_PRPVF BIT(15) +#define IMX_MEDIA_GRP_ID_CSI_MUX BIT(16) #endif diff --git a/drivers/staging/media/imx/imx7-media-csi.c b/drivers/staging/media/imx/imx7-media-csi.c index 69f7abb32ae1..a3f3df901704 100644 --- a/drivers/staging/media/imx/imx7-media-csi.c +++ b/drivers/staging/media/imx/imx7-media-csi.c @@ -1164,6 +1164,13 @@ static int imx7_csi_notify_bound(struct v4l2_async_notifier *notifier, struct imx7_csi *csi = imx7_csi_notifier_to_dev(notifier); struct media_pad *sink = &csi->sd.entity.pads[IMX7_CSI_PAD_SINK]; + /* The bound subdev must always be the CSI mux */ + if (WARN_ON(sd->entity.function != MEDIA_ENT_F_VID_MUX)) + return -ENXIO; + + /* Mark it as such via its group id */ + sd->grp_id = IMX_MEDIA_GRP_ID_CSI_MUX; + return v4l2_create_fwnode_links_to_pad(sd, sink); } From patchwork Fri May 1 17:15:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Longerbeam X-Patchwork-Id: 209987 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 60906C47259 for ; Fri, 1 May 2020 17:16:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3C0832137B for ; Fri, 1 May 2020 17:16:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="qejat9+K" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729955AbgEARQb (ORCPT ); Fri, 1 May 2020 13:16:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1728970AbgEARQa (ORCPT ); Fri, 1 May 2020 13:16:30 -0400 Received: from mail-pj1-x1042.google.com (mail-pj1-x1042.google.com [IPv6:2607:f8b0:4864:20::1042]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50F64C061A0E for ; Fri, 1 May 2020 10:16:30 -0700 (PDT) Received: by mail-pj1-x1042.google.com with SMTP id a32so140773pje.5 for ; Fri, 01 May 2020 10:16:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=7nDsABg1OEiBsUmQMmNToGbTWaiUH5u7uhY2MzTbsLk=; b=qejat9+KbVys97XNtCdWHUTSOOpS7yDnXM+sqGPR+fcQliDl83JU+0RzHj1lURqhsQ /fRv87cIFgeUK8e4h2SYWWybpT6zLy7IR6X2/aZpTZVdpQJv4vC7pt5yHl1tdFBqhKUN h+t2mqdmoYxpY55D15tcIcuE0wcXISjy4cct8SRIsnXt5LoCKwz/bpWKGI4MyopDtm1I 9814exbmQCL60/QnYSIGS38bRj0pKPFncKYgYemK3bFmBOEK7ZL7kRWwAz3MHwnL7zIg cpFCvsFgcYbjMW3DtQfjNSx1PhGQY7VRpX7x4IPXip6R/3WYtfekWTluDoMhEwD6BWjK tlzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=7nDsABg1OEiBsUmQMmNToGbTWaiUH5u7uhY2MzTbsLk=; b=i7OhhzaNZ4jqbcx4yFSp0mWUI7fss643Wq3NJFPSd1O/XSAEuWWs7TOZ/hBR+Tuyeg Z3TjZD3qYeuJl8cOpC/JW8ngISlGRO1B4sekSvBJBElXjTA00+yHJChACkoUrtYO7rBU DgBv1qTVfW4zTNKgc3/vb48s/SAF8kP1IfaIGEyTrEt3VCoijowke2i1Wue1DZv/bk8G rfahVdz7N/DxRd9HXVORnP7HWhAT2B+6ABIAAgB8RW4Nso+Ct1Z/kFq8Ukqg5HUow/0l Nrv8Sp5jp80A+19aeoD4hHlD5/UKPDKZXvOr/MghgdNP/ONejrA0+jj3x8h7YorX0K+7 1eCQ== X-Gm-Message-State: AGi0Puat4HzRjuW+OLBF4Gds+JQfx5Y1O8JPBTlUtQjhg7F1cQ/0vSEj z1BKWGLUFKZbyTkNRcCESJ134jmC X-Google-Smtp-Source: APiQypL7jlgQTp0V3CRUjUj+uiyJ+GOE5XgaAL1/UeXkbLjIpolf3jZmPsunOFDW7cbjx2SIQJfgaQ== X-Received: by 2002:a17:902:74cb:: with SMTP id f11mr5634181plt.171.1588353389412; Fri, 01 May 2020 10:16:29 -0700 (PDT) Received: from mappy.hsd1.ca.comcast.net (c-107-3-184-99.hsd1.ca.comcast.net. [107.3.184.99]) by smtp.gmail.com with ESMTPSA id g14sm2733966pfh.49.2020.05.01.10.16.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 May 2020 10:16:28 -0700 (PDT) From: Steve Longerbeam To: linux-media@vger.kernel.org Cc: Sakari Ailus , Mauro Carvalho Chehab , Hans Verkuil , Rui Miguel Silva , Laurent Pinchart , Philipp Zabel , Steve Longerbeam Subject: [PATCH v6 20/22] media: imx: Create missing links from CSI-2 receiver Date: Fri, 1 May 2020 10:15:54 -0700 Message-Id: <20200501171556.14731-21-slongerbeam@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200501171556.14731-1-slongerbeam@gmail.com> References: <20200501171556.14731-1-slongerbeam@gmail.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org The entities external to the i.MX6 IPU and i.MX7 now create the links to their fwnode-endpoint connected entities in their notifier bound callbacks. Which means imx_media_create_of_links() and imx_media_create_csi_of_links() are no longer needed and are removed. However there is still one case in which imx-media needs to create fwnode-endpoint based links at probe completion. The v4l2-async framework does not allow multiple subdevice notifiers to contain a duplicate subdevice in their asd_list. Only the first subdev notifier that discovers and adds that one subdevice to its asd_list will receive a bound callback for it. Other subdevices that also have firmware endpoint connections to this duplicate subdevice will not have it in their asd_list, and thus will never receive a bound callback for it. In the case of imx-media, the one duplicate subdevice in question is the i.MX6 MIPI CSI-2 receiver. Until there is a solution to that problem, rewrite imx_media_create_links() to add the missing links from the CSI-2 receiver to the CSIs and CSI muxes. The function is renamed imx_media_create_csi2_links(). Signed-off-by: Steve Longerbeam Reviewed-by: Laurent Pinchart --- Changes in v5: - imx_media_create_fwnode_pad_link() has been moved to core as v4l2_create_fwnode_link(). - use the new group id IMX_MEDIA_GRP_ID_CSI_MUX to look specifically for an imx CSI video mux. Suggested by Laurent. Changes in v4: - none Changes in v3: - call a local imx-media utility imx_media_create_fwnode_pad_links(). Changes in v2: - this is a rewrite of v1 "media: imx: Use media_create_fwnode_links for external links", which only adds the missing CSI-2 receiver links. --- .../staging/media/imx/imx-media-dev-common.c | 46 +++---- drivers/staging/media/imx/imx-media-of.c | 114 ------------------ drivers/staging/media/imx/imx-media.h | 4 - 3 files changed, 17 insertions(+), 147 deletions(-) diff --git a/drivers/staging/media/imx/imx-media-dev-common.c b/drivers/staging/media/imx/imx-media-dev-common.c index 66b505f7e8df..f6ad9631fa0e 100644 --- a/drivers/staging/media/imx/imx-media-dev-common.c +++ b/drivers/staging/media/imx/imx-media-dev-common.c @@ -30,41 +30,31 @@ static int imx_media_subdev_bound(struct v4l2_async_notifier *notifier, } /* - * Create the media links for all subdevs that registered. + * Create the missing media links from the CSI-2 receiver. * Called after all async subdevs have bound. */ -static int imx_media_create_links(struct v4l2_async_notifier *notifier) +static void imx_media_create_csi2_links(struct imx_media_dev *imxmd) { - struct imx_media_dev *imxmd = notifier2dev(notifier); - struct v4l2_subdev *sd; + struct v4l2_subdev *sd, *csi2 = NULL; list_for_each_entry(sd, &imxmd->v4l2_dev.subdevs, list) { - switch (sd->grp_id) { - case IMX_MEDIA_GRP_ID_IPU_VDIC: - case IMX_MEDIA_GRP_ID_IPU_IC_PRP: - case IMX_MEDIA_GRP_ID_IPU_IC_PRPENC: - case IMX_MEDIA_GRP_ID_IPU_IC_PRPVF: - /* - * links have already been created for the - * sync-registered subdevs. - */ - break; - case IMX_MEDIA_GRP_ID_IPU_CSI0: - case IMX_MEDIA_GRP_ID_IPU_CSI1: - case IMX_MEDIA_GRP_ID_CSI: - imx_media_create_csi_of_links(imxmd, sd); - break; - default: - /* - * if this subdev has fwnode links, create media - * links for them. - */ - imx_media_create_of_links(imxmd, sd); + if (sd->grp_id == IMX_MEDIA_GRP_ID_CSI2) { + csi2 = sd; break; } } + if (!csi2) + return; - return 0; + list_for_each_entry(sd, &imxmd->v4l2_dev.subdevs, list) { + /* skip if not a CSI or a CSI mux */ + if (!(sd->grp_id & IMX_MEDIA_GRP_ID_IPU_CSI) && + !(sd->grp_id & IMX_MEDIA_GRP_ID_CSI) && + !(sd->grp_id & IMX_MEDIA_GRP_ID_CSI_MUX)) + continue; + + v4l2_create_fwnode_links(csi2, sd); + } } /* @@ -196,9 +186,7 @@ int imx_media_probe_complete(struct v4l2_async_notifier *notifier) mutex_lock(&imxmd->mutex); - ret = imx_media_create_links(notifier); - if (ret) - goto unlock; + imx_media_create_csi2_links(imxmd); ret = imx_media_create_pad_vdev_lists(imxmd); if (ret) diff --git a/drivers/staging/media/imx/imx-media-of.c b/drivers/staging/media/imx/imx-media-of.c index 2d3efd2a6dde..82e13e972e23 100644 --- a/drivers/staging/media/imx/imx-media-of.c +++ b/drivers/staging/media/imx/imx-media-of.c @@ -74,117 +74,3 @@ int imx_media_add_of_subdevs(struct imx_media_dev *imxmd, return ret; } EXPORT_SYMBOL_GPL(imx_media_add_of_subdevs); - -/* - * Create a single media link to/from sd using a fwnode link. - * - * NOTE: this function assumes an OF port node is equivalent to - * a media pad (port id equal to media pad index), and that an - * OF endpoint node is equivalent to a media link. - */ -static int create_of_link(struct imx_media_dev *imxmd, - struct v4l2_subdev *sd, - struct v4l2_fwnode_link *link) -{ - struct v4l2_subdev *remote, *src, *sink; - int src_pad, sink_pad; - - if (link->local_port >= sd->entity.num_pads) - return -EINVAL; - - remote = imx_media_find_subdev_by_fwnode(imxmd, link->remote_node); - if (!remote) - return 0; - - if (sd->entity.pads[link->local_port].flags & MEDIA_PAD_FL_SINK) { - src = remote; - src_pad = link->remote_port; - sink = sd; - sink_pad = link->local_port; - } else { - src = sd; - src_pad = link->local_port; - sink = remote; - sink_pad = link->remote_port; - } - - /* make sure link doesn't already exist before creating */ - if (media_entity_find_link(&src->entity.pads[src_pad], - &sink->entity.pads[sink_pad])) - return 0; - - v4l2_info(sd->v4l2_dev, "%s:%d -> %s:%d\n", - src->name, src_pad, sink->name, sink_pad); - - return media_create_pad_link(&src->entity, src_pad, - &sink->entity, sink_pad, 0); -} - -/* - * Create media links to/from sd using its device-tree endpoints. - */ -int imx_media_create_of_links(struct imx_media_dev *imxmd, - struct v4l2_subdev *sd) -{ - struct v4l2_fwnode_link link; - struct device_node *ep; - int ret; - - for_each_endpoint_of_node(sd->dev->of_node, ep) { - ret = v4l2_fwnode_parse_link(of_fwnode_handle(ep), &link); - if (ret) - continue; - - ret = create_of_link(imxmd, sd, &link); - v4l2_fwnode_put_link(&link); - if (ret) - return ret; - } - - return 0; -} -EXPORT_SYMBOL_GPL(imx_media_create_of_links); - -/* - * Create media links to the given CSI subdevice's sink pads, - * using its device-tree endpoints. - */ -int imx_media_create_csi_of_links(struct imx_media_dev *imxmd, - struct v4l2_subdev *csi) -{ - struct device_node *csi_np = csi->dev->of_node; - struct device_node *ep; - - for_each_child_of_node(csi_np, ep) { - struct fwnode_handle *fwnode, *csi_ep; - struct v4l2_fwnode_link link; - int ret; - - memset(&link, 0, sizeof(link)); - - link.local_node = of_fwnode_handle(csi_np); - link.local_port = CSI_SINK_PAD; - - csi_ep = of_fwnode_handle(ep); - - fwnode = fwnode_graph_get_remote_endpoint(csi_ep); - if (!fwnode) - continue; - - fwnode = fwnode_get_parent(fwnode); - fwnode_property_read_u32(fwnode, "reg", &link.remote_port); - fwnode = fwnode_get_next_parent(fwnode); - if (is_of_node(fwnode) && - of_node_name_eq(to_of_node(fwnode), "ports")) - fwnode = fwnode_get_next_parent(fwnode); - link.remote_node = fwnode; - - ret = create_of_link(imxmd, csi, &link); - fwnode_handle_put(link.remote_node); - if (ret) - return ret; - } - - return 0; -} -EXPORT_SYMBOL_GPL(imx_media_create_csi_of_links); diff --git a/drivers/staging/media/imx/imx-media.h b/drivers/staging/media/imx/imx-media.h index c5f2aa2f0e98..f17135158029 100644 --- a/drivers/staging/media/imx/imx-media.h +++ b/drivers/staging/media/imx/imx-media.h @@ -263,10 +263,6 @@ void imx_media_unregister_ipu_internal_subdevs(struct imx_media_dev *imxmd); /* imx-media-of.c */ int imx_media_add_of_subdevs(struct imx_media_dev *dev, struct device_node *np); -int imx_media_create_of_links(struct imx_media_dev *imxmd, - struct v4l2_subdev *sd); -int imx_media_create_csi_of_links(struct imx_media_dev *imxmd, - struct v4l2_subdev *csi); int imx_media_of_add_csi(struct imx_media_dev *imxmd, struct device_node *csi_np); From patchwork Fri May 1 17:15:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Longerbeam X-Patchwork-Id: 209986 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 88CE0C47253 for ; Fri, 1 May 2020 17:16:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 68C312137B for ; Fri, 1 May 2020 17:16:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="oh6/4+lT" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729998AbgEARQd (ORCPT ); Fri, 1 May 2020 13:16:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58132 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1729951AbgEARQd (ORCPT ); Fri, 1 May 2020 13:16:33 -0400 Received: from mail-pl1-x643.google.com (mail-pl1-x643.google.com [IPv6:2607:f8b0:4864:20::643]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E7951C061A0C for ; Fri, 1 May 2020 10:16:32 -0700 (PDT) Received: by mail-pl1-x643.google.com with SMTP id d24so3846058pll.8 for ; Fri, 01 May 2020 10:16:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=AS+AHCuMQWIyLmWzD2RHQ/sZnkJFO9p0vLnea6pI0u8=; b=oh6/4+lTRtxuDurfROSG0h4tUeTfPfdAf2Z8+ixz3dSaZAr1nlT/B+PYRMD5Pq95Fn VvOYxziFwdvP89uJEW6eDcpYSZoigiKCt5SfbusDQEBnjQ2V6LDvlFlPyJgJvtvNhe+d uNn3tl9KOf8Q/wzLIZd/ErB+hmr477uKZkIcB+DDSmsK+5Cuu80WoWbfQh8pDGtur2E3 DU56Xc4vCGPTJowoJ0fC41A2Sr2y1+sOzS4vXj/Cni+UxQiOQF06bLiuVeGm1c129Mn0 l+sNuokS+PxFMKZKZCKV8jrupfuGYbkY7qirG588MuU22ZrLmNw8VDMg4vWReiWSdobX CjjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=AS+AHCuMQWIyLmWzD2RHQ/sZnkJFO9p0vLnea6pI0u8=; b=YVTHFojZ7HkrkYu1OBhrzJMhD4K9Ih9cURZurvqZWSJ6mePRoLdJWU63bTOxcwhvRr NeYojGGcL70gzntnbdsqXs27EKVT0th+vBewtOSrdwt3UeKK+o2yMQJtl71LJADWwUqX PmwjEfLLSBtbJDYW+T9N5e2SdRxHQ1DV366l3ttvnyu7HSHH2mwD8jbKIRVWJtX0Cpzc qb2Khh3ylJLRKeKRPPgw6LnNtDnsPxxe6hJCVAA+F4cMob+qSau05aMZsdLFrxsLBgSQ 7NkoFHm4fAulCfMEula7/ab3/0g6KwMWWW0KJtDFSSdwE9lolBf68/th93Prv4GYD8gb 9ujQ== X-Gm-Message-State: AGi0PuYEwbB2rIEp36PWGpX20efFOiyy+EbmF3wBQHONXbC1VYTShAf7 BPnXXGAS/IGN88nSnVob73wtnLkU X-Google-Smtp-Source: APiQypK5sQOd8+H9jVCejE9rccsY6gZ/S+UPB10u4HlY97ANFt8A3tphUI4Jv0pCXCtbOqx29yX2hg== X-Received: by 2002:a17:90a:80c2:: with SMTP id k2mr749889pjw.6.1588353392120; Fri, 01 May 2020 10:16:32 -0700 (PDT) Received: from mappy.hsd1.ca.comcast.net (c-107-3-184-99.hsd1.ca.comcast.net. [107.3.184.99]) by smtp.gmail.com with ESMTPSA id g14sm2733966pfh.49.2020.05.01.10.16.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 May 2020 10:16:31 -0700 (PDT) From: Steve Longerbeam To: linux-media@vger.kernel.org Cc: Sakari Ailus , Mauro Carvalho Chehab , Hans Verkuil , Rui Miguel Silva , Laurent Pinchart , Philipp Zabel , Steve Longerbeam Subject: [PATCH v6 22/22] media: imx: TODO: Remove media link creation todos Date: Fri, 1 May 2020 10:15:56 -0700 Message-Id: <20200501171556.14731-23-slongerbeam@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200501171556.14731-1-slongerbeam@gmail.com> References: <20200501171556.14731-1-slongerbeam@gmail.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Remove the TODO items regarding media link creation, these issues are resolved by moving media link creation to individual entity bound callbacks and the implementation of the get_fwnode_pad operation. Signed-off-by: Steve Longerbeam --- drivers/staging/media/imx/TODO | 29 ----------------------------- 1 file changed, 29 deletions(-) diff --git a/drivers/staging/media/imx/TODO b/drivers/staging/media/imx/TODO index 6f29b5ca5324..a371cdedcdb0 100644 --- a/drivers/staging/media/imx/TODO +++ b/drivers/staging/media/imx/TODO @@ -17,35 +17,6 @@ decided whether this feature is useful enough to make it generally available by exporting to v4l2-core. -- After all async subdevices have been bound, v4l2_fwnode_parse_link() - is used to form the media links between the devices discovered in - the OF graph. - - While this approach allows support for arbitrary OF graphs, there - are some assumptions for this to work: - - 1. If a port owned by a device in the graph has endpoint nodes, the - port is treated as a media pad. - - This presents problems for devices that don't make this port = pad - assumption. Examples are SMIAPP compatible cameras which define only - a single output port node, but which define multiple pads owned - by multiple subdevices (pixel-array, binner, scaler). Or video - decoders (entity function MEDIA_ENT_F_ATV_DECODER), which also define - only a single output port node, but define multiple pads for video, - VBI, and audio out. - - A workaround at present is to set the port reg properties to - correspond to the media pad index that the port represents. A - possible long-term solution is to implement a subdev API that - maps a port id to a media pad index. - - 2. Every endpoint of a port owned by a device in the graph is treated - as a media link. - - Which means a port must not contain mixed-use endpoints, they - must all refer to media links between V4L2 subdevices. - - i.MX7: all of the above, since it uses the imx media core - i.MX7: use Frame Interval Monitor