From patchwork Mon Apr 20 00:39:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Longerbeam X-Patchwork-Id: 11497949 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6D3B792C for ; Mon, 20 Apr 2020 00:39:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 54218221F7 for ; Mon, 20 Apr 2020 00:39:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="tsR4oDXg" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725964AbgDTAjj (ORCPT ); Sun, 19 Apr 2020 20:39:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1725949AbgDTAjj (ORCPT ); Sun, 19 Apr 2020 20:39:39 -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 270A2C061A0C for ; Sun, 19 Apr 2020 17:39:39 -0700 (PDT) Received: by mail-pl1-x643.google.com with SMTP id f8so3313553plt.2 for ; Sun, 19 Apr 2020 17:39:39 -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=9mTYcYwO3j5DgB6hEjXQEWO63m/OWQAU74YbBUG9mak=; b=tsR4oDXgUacwZqH8ce6tJbIyk4fPDr3Iuaob3YZ5Xd7esxfOBrrdpwuOZCKUOwDnYX oZTU47IDyNkHpEXL3iiKQCdISERxQGgmByIlT+xZm1bwXJXJbI+zslENFcIl2+vlEoUS pA5mRICtNPh4Li3zrW6ib+PkhbI5/XaZe1/Bt73f2bRqLfr5zHC8gqDSwPOar+6HhCUA +hTR2AKf24iEngA+q7HEqCQ162jm4PpOG9oQtxgaVC8wXmdYH7fHL4vy4DB0OC0HtCVg ZrVm5tMdsg5VNQG2/GrGThNSmFuirBIqFDWZXQHfaz7PP6sDunxtrojlIbwCFZ0PBzQn PLDA== 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=9mTYcYwO3j5DgB6hEjXQEWO63m/OWQAU74YbBUG9mak=; b=o6Ywo7wpXUas8p2Vf8Ae98SksJZqKNXpxo49r6C5d6JXVXuELNwz1JcHD+ZFBpqpKC VYu34u99oPF3lHMmhRJVvYqYIxo+07LQR1eqY4Z5f8Cxv8p5UbCg4bjj69RimkaENmGC iQjpVzkc2sV+ucKiHy3um5QMd6AK7abBYQJxgaVzY4k+gVnmJ8HP/4ax5VYhusDvJ0RV pH1obLA4O/v0kfXLN8E4zdyJp15r57PmqDtlL9wg768pLgUqTi6PDH4nTUsOKEkVlN65 GTD1yA/81yAxu16IvXvJ6EZPoKuuzHeFh/cE3+0UrFuaq6ES/A4HhWrXGAJ15JBCEIvM pAsA== X-Gm-Message-State: AGi0PuYcBuGWYX5Ocj8wtBXiCA/Omlr+4IRboYe1a9OHtux5yNjO8DPs uELvhmsdCmwRPpTM0IozGq48UXgzI5o= X-Google-Smtp-Source: APiQypL2bMKRY7kv+MhFAJqxBKrWQeOKeK/RVkGVn8d1WKgu59WhmbuiejMIz4tQsOXKk9u/5o6M7g== X-Received: by 2002:a17:90a:f418:: with SMTP id ch24mr18303110pjb.68.1587343178401; Sun, 19 Apr 2020 17:39:38 -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 f30sm12313701pje.29.2020.04.19.17.39.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Apr 2020 17:39:37 -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 v5 01/23] media: entity: Pass entity to get_fwnode_pad operation Date: Sun, 19 Apr 2020 17:39:08 -0700 Message-Id: <20200420003930.11463-2-slongerbeam@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200420003930.11463-1-slongerbeam@gmail.com> References: <20200420003930.11463-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 missing pointer to the entity in the media_entity operation get_fwnode_pad. There are no implementers of this op yet, but a future entity that does so will almost certainly need a reference to itself to carry out the work. Fixes: ae45cd5efc120 ("[media] media: entity: Add get_fwnode_pad entity operation") Signed-off-by: Steve Longerbeam Reviewed-by: Laurent Pinchart --- drivers/media/mc/mc-entity.c | 2 +- include/media/media-entity.h | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/media/mc/mc-entity.c b/drivers/media/mc/mc-entity.c index 211279c5fd77..12b45e669bcc 100644 --- a/drivers/media/mc/mc-entity.c +++ b/drivers/media/mc/mc-entity.c @@ -386,7 +386,7 @@ int media_entity_get_fwnode_pad(struct media_entity *entity, if (ret) return ret; - ret = entity->ops->get_fwnode_pad(&endpoint); + ret = entity->ops->get_fwnode_pad(entity, &endpoint); if (ret < 0) return ret; diff --git a/include/media/media-entity.h b/include/media/media-entity.h index 8cb2c504a05c..cde80ad029b7 100644 --- a/include/media/media-entity.h +++ b/include/media/media-entity.h @@ -212,7 +212,8 @@ struct media_pad { * mutex held. */ struct media_entity_operations { - int (*get_fwnode_pad)(struct fwnode_endpoint *endpoint); + int (*get_fwnode_pad)(struct media_entity *entity, + struct fwnode_endpoint *endpoint); int (*link_setup)(struct media_entity *entity, const struct media_pad *local, const struct media_pad *remote, u32 flags); From patchwork Mon Apr 20 00:39:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Longerbeam X-Patchwork-Id: 11497951 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BE23613B2 for ; Mon, 20 Apr 2020 00:39:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A3B8622242 for ; Mon, 20 Apr 2020 00:39:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="bpGJkdmc" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726048AbgDTAjl (ORCPT ); Sun, 19 Apr 2020 20:39:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34282 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1725949AbgDTAjk (ORCPT ); Sun, 19 Apr 2020 20:39:40 -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 93B34C061A0C for ; Sun, 19 Apr 2020 17:39:40 -0700 (PDT) Received: by mail-pj1-x1043.google.com with SMTP id ng8so3798918pjb.2 for ; Sun, 19 Apr 2020 17:39:40 -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=YiTS0YtZ80oRzEOF+lWi0r9Wu5t+ZyNnNhcpDAc5pFw=; b=bpGJkdmcBCBJiiy9FlPPKhXMot1yhoX0Y6jqP7sk7bjoXEu6xWlBy3G/wVU2QRQPVD 2NbxSeea1p8KsvjsNxVN9pfn9j82IzxVgXIaQJ2gGmNnmyW4CCT9G12xmA08VXgqgIX7 5w10H2nY3/59MP476xJ3hvu9mNCQr3P6ZUy/F66vs+zsew4YtvPHSIIYJH1yubn2AgR3 O9neKPAY529+W2XC7YpYTuYpCWqPv2b6h6XVsy2MGwyljg74w0EBjb6d7dF38qICaMWH 2Fxf681BdSvQAy41xvIfUptJSjdhmTowrEhMSpCtNAfY8OIGDxA8cBpfLB8rAjl3aI+m ZdeA== 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=YiTS0YtZ80oRzEOF+lWi0r9Wu5t+ZyNnNhcpDAc5pFw=; b=gpayGqNk0J/inFTAszQ9Bxdq+1tK8fJbQV8kheZvZstnyXJwxbJpPFcIRH1+YuS3/i iMtBwXDWx5oX+8AlSBLGmqz1OpQXV64jnXt0m/T5C7+kSbDwUM905mm1UM7n5tOYESQD 2eLX328miSY2EHoBmkNUoYRSvEngWgQV6Akt6Heaubas+Z82lsttNwNbltXEYWiqA1UH 0IjJDyaNWwShCaZTf+Z+su7ofIEsP/cLoQM/KNHrHELbd8lM3wOYYsGqEWKgdwnxdU36 XU9ngcVLhEHjfzNYqffmpUz6o5U/NL1l3YfVmZiSup1yBw4/blPZOw8Yz/ZcUViUZtDb 5Jiw== X-Gm-Message-State: AGi0PuZcS7TvNEA7nGSWnmot4FoxZUbreBykxdYdxCbHWvlPwVv5X1/w /0rVbfR+YSqMkW4omc69KhglI2QhRAk= X-Google-Smtp-Source: APiQypLNB9NPOvWdBD7f96HfmHff4sgE4fdp+ww0UX0AZ18dBtBMXw0M1wefu4NcGZr64x0oARqmzw== X-Received: by 2002:a17:90a:710a:: with SMTP id h10mr18280713pjk.101.1587343179799; Sun, 19 Apr 2020 17:39:39 -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 f30sm12313701pje.29.2020.04.19.17.39.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Apr 2020 17:39:39 -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 v5 02/23] media: entity: Modify default behavior of media_entity_get_fwnode_pad Date: Sun, 19 Apr 2020 17:39:09 -0700 Message-Id: <20200420003930.11463-3-slongerbeam@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200420003930.11463-1-slongerbeam@gmail.com> References: <20200420003930.11463-1-slongerbeam@gmail.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Modify the default behavior of media_entity_get_fwnode_pad() (when the entity does not provide the get_fwnode_pad op) to first assume the entity implements a 1:1 mapping between fwnode port number and media pad index. If the 1:1 mapping is not valid, e.g. the port number falls outside the entity's pad index range, or the pad at that port number doesn't match the given direction_flags, fall-back to the previous behavior that searches the entity for the first pad that matches the given direction_flags. The previous default behavior can choose the wrong pad for entities with multiple sink or source pads. With this change the function will choose the correct pad index if the entity implements a 1:1 port to pad mapping at that port. Signed-off-by: Steve Longerbeam --- drivers/media/mc/mc-entity.c | 25 ++++++++++++++++++++----- include/media/media-entity.h | 6 ++++-- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/drivers/media/mc/mc-entity.c b/drivers/media/mc/mc-entity.c index 12b45e669bcc..b1e0259a58c5 100644 --- a/drivers/media/mc/mc-entity.c +++ b/drivers/media/mc/mc-entity.c @@ -370,22 +370,37 @@ int media_entity_get_fwnode_pad(struct media_entity *entity, unsigned long direction_flags) { struct fwnode_endpoint endpoint; - unsigned int i; int ret; + ret = fwnode_graph_parse_endpoint(fwnode, &endpoint); + if (ret) + return ret; + if (!entity->ops || !entity->ops->get_fwnode_pad) { + unsigned int i; + + /* + * for the default case, first try a 1:1 mapping between + * fwnode port number and pad index. + */ + ret = endpoint.port; + if (ret < entity->num_pads && + (entity->pads[ret].flags & direction_flags)) + return ret; + + /* + * if that didn't work search the entity for the first + * pad that matches the @direction_flags. + */ for (i = 0; i < entity->num_pads; i++) { if (entity->pads[i].flags & direction_flags) return i; } + /* else fail */ return -ENXIO; } - ret = fwnode_graph_parse_endpoint(fwnode, &endpoint); - if (ret) - return ret; - ret = entity->ops->get_fwnode_pad(entity, &endpoint); if (ret < 0) return ret; diff --git a/include/media/media-entity.h b/include/media/media-entity.h index cde80ad029b7..9316eb9f8486 100644 --- a/include/media/media-entity.h +++ b/include/media/media-entity.h @@ -871,8 +871,10 @@ struct media_pad *media_entity_remote_pad(const struct media_pad *pad); * mappings of media pads. * * If the entity does not implement the get_fwnode_pad() operation - * then this function searches the entity for the first pad that - * matches the @direction_flags. + * then this function first assumes the entity implements a 1:1 mapping + * between fwnode port number and media pad index. If the 1:1 mapping + * is not valid, then the function searches the entity for the first pad + * that matches the @direction_flags. * * Return: returns the pad number on success or a negative error code. */ From patchwork Mon Apr 20 00:39:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Longerbeam X-Patchwork-Id: 11497953 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 26D4813B2 for ; Mon, 20 Apr 2020 00:39:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0F052221F7 for ; Mon, 20 Apr 2020 00:39:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="uIbEvBm7" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726050AbgDTAjm (ORCPT ); Sun, 19 Apr 2020 20:39:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34290 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1725949AbgDTAjl (ORCPT ); Sun, 19 Apr 2020 20:39:41 -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 DEE1CC061A0C for ; Sun, 19 Apr 2020 17:39:41 -0700 (PDT) Received: by mail-pj1-x1043.google.com with SMTP id e6so1265561pjt.4 for ; Sun, 19 Apr 2020 17:39:41 -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=q/D4Oi9U6YWOZjW+n+hLsbyUmbrnB8ZHPL+zrDmH5wo=; b=uIbEvBm7g5QFEKaNJL24wc3tQ3V0IYDKaRcu/U/UYsM4Ld71wKpvaDDIDFPLQdv5JV rS6bCkniZEfMaFynOoBPDn63G2bXx6GG/H/IkFWpatZ0dtLTBZweOE82JQxdt3Idm/WE Bm0G0OoLIbv7iF/VXr+r2F+r0ZGOVF2GIlCiFotb5fdgrFWBb0FtxVJfYJ96bhI2IMoh XYNvgAXmw7env0NnV1bXhGL9yMZN2fAOlYGUKln8PC3jiamFGNAEcxiD2HlgaEnPauMS 933ud8iDFBESkLJXam1MxdEH+MWM2g26ns929R5p5m6eaaRzF/cKHHtDtYsxnKHJVspT k1zw== 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=q/D4Oi9U6YWOZjW+n+hLsbyUmbrnB8ZHPL+zrDmH5wo=; b=Al9EI5j6SxQFkx+S140StXJaaypK1SQgrZyuO46Jash5iAKip8RTTg/urfC9GcnNds fSrFB9up7ZhiTmdXYSJfbs1vX4mXTyznqm0vZklXddc0Vy2zg7ayPZCSZ5Xwm05hQud3 TNQyURBEvO5oJlZ4JyF+ZYLbLSsbDn0ttISc8k3hcnBLZBoLm2kyNq8qVJ9ppUqBeAxg cgiSeaFow8TMrSJdtY8sFf4qZu8QmYFTuTX11XLQoAwI2tkoh7WuLg9uf9t3ZRHw10HG SukdDnYAfR2pmH4mQia102i9HcnbTp9dGaXciD/q+XrNo5SzVQZzgpYRs6phrxsC+ZQL u0UA== X-Gm-Message-State: AGi0PubRlZ1CyZsx/1c+QhhHIDbbt/IrKXioDQ8vPjto5FUttWhOgUbO rTTuUWc8LPGeFFaC71mbMeVc8frlp2I= X-Google-Smtp-Source: APiQypKhE9x81VWijriZ+9Gvb+NjghavjHSRYnIto1uQaKjnI68yraSnNrXj0xuuYEIOEjqUXxaiog== X-Received: by 2002:a17:90a:fc8c:: with SMTP id ci12mr15982579pjb.104.1587343181089; Sun, 19 Apr 2020 17:39:41 -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 f30sm12313701pje.29.2020.04.19.17.39.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Apr 2020 17:39:40 -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 v5 03/23] media: v4l2-subdev: add v4l2_subdev_get_fwnode_pad_default Date: Sun, 19 Apr 2020 17:39:10 -0700 Message-Id: <20200420003930.11463-4-slongerbeam@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200420003930.11463-1-slongerbeam@gmail.com> References: <20200420003930.11463-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 | 25 +++++++++++++++++++++++++ include/media/v4l2-subdev.h | 17 +++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c index a376b351135f..d5b5cd7a6049 100644 --- a/drivers/media/v4l2-core/v4l2-subdev.c +++ b/drivers/media/v4l2-core/v4l2-subdev.c @@ -696,6 +696,31 @@ const struct v4l2_file_operations v4l2_subdev_fops = { }; #ifdef CONFIG_MEDIA_CONTROLLER + +int v4l2_subdev_get_fwnode_pad_default(struct media_entity *entity, + struct fwnode_endpoint *endpoint) +{ + struct fwnode_handle *ep; + struct v4l2_subdev *sd; + + if (!is_media_entity_v4l2_subdev(entity)) + return -EINVAL; + + sd = media_entity_to_v4l2_subdev(entity); + + fwnode_graph_for_each_endpoint(dev_fwnode(sd->dev), ep) { + if (ep != endpoint->local_fwnode) + continue; + + fwnode_handle_put(ep); + + return endpoint->port; + } + + return -ENXIO; +} +EXPORT_SYMBOL_GPL(v4l2_subdev_get_fwnode_pad_default); + 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..940181323427 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_default - 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_default(struct media_entity *entity, + struct fwnode_endpoint *endpoint); + /** * v4l2_subdev_link_validate_default - validates a media link * From patchwork Mon Apr 20 00:39:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Longerbeam X-Patchwork-Id: 11497955 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D2E1292C for ; Mon, 20 Apr 2020 00:39:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B26BC21D82 for ; Mon, 20 Apr 2020 00:39:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="DfYoynp+" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726061AbgDTAjp (ORCPT ); Sun, 19 Apr 2020 20:39:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1725949AbgDTAjo (ORCPT ); Sun, 19 Apr 2020 20:39:44 -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 338DDC061A0C for ; Sun, 19 Apr 2020 17:39:43 -0700 (PDT) Received: by mail-pj1-x1043.google.com with SMTP id t40so3677004pjb.3 for ; Sun, 19 Apr 2020 17:39:43 -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=J52njaf4Sck+4xYqFKEBcgHGmI8LLr2X5QELOOLASRU=; b=DfYoynp++Fe52ng/x6PhYC3ADkhrIvJJkOsw5YxQ/knf+Xy9cOYVJxtAivdMFzkPHv 53TfLZCa0X+jC7omuMHh+fZh8JCsqPXCGas3QMZD1MpvtLYaIw+NZq5uo7tuaDpbPv1/ cJF5zpRfYws2w3mONcwp10lV4EJcWHidPBUP/TVl66jWY8CjDMNtI623WZ8lHPidWVYo FC5s8NC4vfw8+k1xlEVLXMGGienkJ1WE5rZmmzDfyM7Mt8FIzBml5RXmoWySS10BP7FS vs0Q7af4xt73pTKQxoZbWtfS0sRuRbyqF2P0cf1WQ9S48Zb6RzHeCNEEZ2HLZZomDKht IQxw== 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=J52njaf4Sck+4xYqFKEBcgHGmI8LLr2X5QELOOLASRU=; b=LeXX+U8sm2dnWCgATbIiNllukBi3l/8B4OKarlWlwiEJcvDTGAxuhrdhhA2Upc2+J2 OLFmN19RL9VzQBNZ/wvKve2/saTKxCy6jneJX4667memzSA7qiRqTl62dmfe9txBnaQg W14pB/7aqU/neSXvK18AXfWviCS7Lm8ObobH8HnkwKaA0WrEtJXxPlyVZ1A7PgquLJ0l S0BaUO/ZoRxkHUo6iO/QMSIkpN3AdFo/Gyo8szBrTUB5ab+WA90bI7J26BRraTPVyL+e wnhdX1C81Lry+AGORnUMrKBVw5XaGyeqUwIG5HwXaq+WDWtxKGZE4WaWfl8MZsPDK2Yy +RWQ== X-Gm-Message-State: AGi0PuaqO2XWfUHhvNQ1T6K860IamG6KZrfmbwwEkkEkzq8N+ZBTovI9 Wy5/3sZ3Q+56NAjZP0QSBWM9sftL4Lw= X-Google-Smtp-Source: APiQypLD2+HhnuprZnE/D0tw2j+7+q5/E2ygXPJBvSUPPKjtv9gFBJHhX8O2zA+SIx4snDaQ6iFI4w== X-Received: by 2002:a17:90b:297:: with SMTP id az23mr18003902pjb.85.1587343182363; Sun, 19 Apr 2020 17:39:42 -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 f30sm12313701pje.29.2020.04.19.17.39.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Apr 2020 17:39:41 -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 v5 04/23] media: v4l2-mc: add v4l2_create_fwnode_links helpers Date: Sun, 19 Apr 2020 17:39:11 -0700 Message-Id: <20200420003930.11463-5-slongerbeam@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200420003930.11463-1-slongerbeam@gmail.com> References: <20200420003930.11463-1-slongerbeam@gmail.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Add functions to create media links between source and sink subdevices, based on the fwnode endpoint connections between them: v4l2_create_fwnode_links_to_pad() - create links from a source subdev to a single sink pad based on fwnode endpoint connections. v4l2_create_fwnode_links() - create all links from a source to sink subdev based on fwnode endpoint connections. These functions can be used in a sink's v4l2-async notifier subdev bound callback to make the links from the bound subdev. Signed-off-by: Steve Longerbeam --- drivers/media/v4l2-core/v4l2-mc.c | 95 +++++++++++++++++++++++++++++++ include/media/v4l2-mc.h | 48 ++++++++++++++++ 2 files changed, 143 insertions(+) diff --git a/drivers/media/v4l2-core/v4l2-mc.c b/drivers/media/v4l2-core/v4l2-mc.c index 0fffdd3ce6a4..ba2f2b8dcc8c 100644 --- a/drivers/media/v4l2-core/v4l2-mc.c +++ b/drivers/media/v4l2-core/v4l2-mc.c @@ -309,6 +309,101 @@ int v4l_vb2q_enable_media_source(struct vb2_queue *q) } EXPORT_SYMBOL_GPL(v4l_vb2q_enable_media_source); +int v4l2_create_fwnode_links_to_pad(struct v4l2_subdev *src_sd, + struct media_pad *sink) +{ + struct fwnode_handle *endpoint; + struct v4l2_subdev *sink_sd; + + if (!(sink->flags & MEDIA_PAD_FL_SINK) || + !is_media_entity_v4l2_subdev(sink->entity)) + return -EINVAL; + + sink_sd = media_entity_to_v4l2_subdev(sink->entity); + + fwnode_graph_for_each_endpoint(dev_fwnode(src_sd->dev), endpoint) { + struct fwnode_handle *remote_ep; + int src_idx, sink_idx, ret; + struct media_pad *src; + + src_idx = media_entity_get_fwnode_pad(&src_sd->entity, + endpoint, + MEDIA_PAD_FL_SOURCE); + if (src_idx < 0) + continue; + + remote_ep = fwnode_graph_get_remote_endpoint(endpoint); + if (!remote_ep) + continue; + + /* + * ask the sink to verify it owns the remote endpoint, + * and translate to a sink pad. + */ + sink_idx = media_entity_get_fwnode_pad(&sink_sd->entity, + remote_ep, + MEDIA_PAD_FL_SINK); + fwnode_handle_put(remote_ep); + + if (sink_idx < 0 || sink_idx != sink->index) + continue; + + /* + * the source endpoint corresponds to one of its source pads, + * the source endpoint connects to an endpoint at the sink + * entity, and the sink endpoint corresponds to the sink + * pad requested, so we have found an endpoint connection + * that works, create the media link for it. + */ + + src = &src_sd->entity.pads[src_idx]; + + /* skip if link already exists */ + if (media_entity_find_link(src, sink)) + continue; + + dev_dbg(sink_sd->dev, "creating link %s:%d -> %s:%d\n", + src_sd->entity.name, src_idx, + sink_sd->entity.name, sink_idx); + + ret = media_create_pad_link(&src_sd->entity, src_idx, + &sink_sd->entity, sink_idx, 0); + if (ret) { + dev_err(sink_sd->dev, + "link %s:%d -> %s:%d failed with %d\n", + src_sd->entity.name, src_idx, + sink_sd->entity.name, sink_idx, ret); + + fwnode_handle_put(endpoint); + return ret; + } + } + + return 0; +} +EXPORT_SYMBOL_GPL(v4l2_create_fwnode_links_to_pad); + +int v4l2_create_fwnode_links(struct v4l2_subdev *src_sd, + struct v4l2_subdev *sink_sd) +{ + unsigned int i; + + for (i = 0; i < sink_sd->entity.num_pads; i++) { + struct media_pad *pad = &sink_sd->entity.pads[i]; + int ret; + + if (!(pad->flags & MEDIA_PAD_FL_SINK)) + continue; + + ret = v4l2_create_fwnode_links_to_pad(src_sd, pad); + if (ret) + return ret; + } + + return 0; +} +EXPORT_SYMBOL_GPL(v4l2_create_fwnode_links); + /* ----------------------------------------------------------------------------- * Pipeline power management * diff --git a/include/media/v4l2-mc.h b/include/media/v4l2-mc.h index 5e73eb8e28f6..302674d2a619 100644 --- a/include/media/v4l2-mc.h +++ b/include/media/v4l2-mc.h @@ -12,6 +12,7 @@ #include #include +#include #include /* We don't need to include pci.h or usb.h here */ @@ -84,6 +85,53 @@ void v4l_disable_media_source(struct video_device *vdev); */ int v4l_vb2q_enable_media_source(struct vb2_queue *q); +/** + * v4l2_create_fwnode_links_to_pad - Create fwnode-based links from a + * source subdev to a sink subdev pad. + * + * @src_sd - pointer to a source subdev + * @sink - pointer to a subdev sink pad + * + * This function searches for fwnode endpoint connections from a source + * subdevice to a single sink pad, and if suitable connections are found, + * translates them into media links to that pad. The function can be + * called by the sink subdevice, in its v4l2-async notifier subdev bound + * callback, to create links from a bound source subdevice. + * + * .. note:: + * + * Any sink that calls this function must implement the .get_fwnode_pad + * media operation in order to verify endpoints passed to it are owned + * by it. + * + * Return 0 on success or a negative error code on failure. + */ +int v4l2_create_fwnode_links_to_pad(struct v4l2_subdev *src_sd, + struct media_pad *sink); + +/** + * v4l2_create_fwnode_links - Create fwnode-based links from a source + * subdev to a sink subdev. + * + * @src_sd - pointer to a source subdevice + * @sink_sd - pointer to a sink subdevice + * + * This function searches for any and all fwnode endpoint connections + * between source and sink subdevices, and translates them into media + * links. The function can be called by the sink subdevice, in its + * v4l2-async notifier subdev bound callback, to create all links from + * a bound source subdevice. + * + * .. note:: + * + * Any sink that calls this function must implement the .get_fwnode_pad + * media operation in order to verify endpoints passed to it are owned + * by it. + * + * Return 0 on success or a negative error code on failure. + */ +int v4l2_create_fwnode_links(struct v4l2_subdev *src_sd, + struct v4l2_subdev *sink_sd); /** * v4l2_pipeline_pm_get - Increase the use count of a pipeline From patchwork Mon Apr 20 00:39:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Longerbeam X-Patchwork-Id: 11497957 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 23ED014B4 for ; Mon, 20 Apr 2020 00:39:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0B79121D82 for ; Mon, 20 Apr 2020 00:39:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="TpZUcxTF" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726063AbgDTAjp (ORCPT ); Sun, 19 Apr 2020 20:39:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726054AbgDTAjo (ORCPT ); Sun, 19 Apr 2020 20:39:44 -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 9D552C061A0F for ; Sun, 19 Apr 2020 17:39:44 -0700 (PDT) Received: by mail-pj1-x1043.google.com with SMTP id t9so1675787pjw.0 for ; Sun, 19 Apr 2020 17:39:44 -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=TpZUcxTFyHbT/DrioLzn6Nb2phk0iviW6Pw1bDU0R1oWNSJjKyKA+cRNpoCvPc0mgd cHlZ2mQAK2LpCDr+O18kAa833syQf6wDIitvcVrDFx/HxokdhGQbD4A3KQQ6gsqaRZOU LwlBZmIhUUqdLy2/ZtLFZSmq7l+dCuYdITINuPPdHdIWRZVEpdIi7+aszPFTNC32d5o8 XJLnuX3XAV7M40Cst1vbUlL+f4V0Y4CWKH0GbGmLO20g9KiMMyqjVxSILVMllU7pez0u 3BcmyvFjmjksw6850R7KO58xQi52BQS3WWcu+aDwxYSaVXADBOBZ2iLtXb9MsJVNJdV+ ZbNw== 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=Os/g6CmE+sXn+ASOFN7yjdZeLTnudDhD2WbsBM5gzd1qkBZebWs8+hZbJ/aUPg39xI rCMmN25tGGsHEEDl6ITPZPtOTnEEEVMVtJoK0KfmC9hBKo2DX0vp2p20ChuJoJEOjdIH 8rVdevg/oA4nzPojleGm3B4Au/OJsDTf2/GAARsy7ipn/zkGWalFNOYCGWPn4IfbtDvA LA/Ls2nhLz9bcko0tF36pZNDNheJ2wEtGD6wSVFdIm9+MB5O3psaXjmLKytf+de9Yaw6 9to4RMoHLbNY1/dS7GMZymQ5Z4Jw0leIX3fZ8Bds0RfH69iyhXhFDbQ0WrbUR9gmLXKq xyvw== X-Gm-Message-State: AGi0PuZBx9KwrlWjcwLvVKc5C0GmWbI3O/R02kwJRDWE8inq83VyrPR1 Z4yTVkOdTXuvNzCL1e4ZoUeXF5gQzjc= X-Google-Smtp-Source: APiQypJI2TSWYjAghXZ07v+lRA4aBHgMb3Zlt1Jsi3PO1tyElkUWAf2reEJzeAurMNQXoVFYofsFZQ== X-Received: by 2002:a17:90a:7d16:: with SMTP id g22mr18589163pjl.179.1587343183861; Sun, 19 Apr 2020 17:39:43 -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 f30sm12313701pje.29.2020.04.19.17.39.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Apr 2020 17:39:43 -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 v5 05/23] media: video-mux: Parse information from firmware without using callbacks Date: Sun, 19 Apr 2020 17:39:12 -0700 Message-Id: <20200420003930.11463-6-slongerbeam@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200420003930.11463-1-slongerbeam@gmail.com> References: <20200420003930.11463-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 Mon Apr 20 00:39:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Longerbeam X-Patchwork-Id: 11497959 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D823714B4 for ; Mon, 20 Apr 2020 00:39:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B683B221F7 for ; Mon, 20 Apr 2020 00:39:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="dAPlkIx2" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726069AbgDTAjr (ORCPT ); Sun, 19 Apr 2020 20:39:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726054AbgDTAjq (ORCPT ); Sun, 19 Apr 2020 20:39:46 -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 5474EC061A0C for ; Sun, 19 Apr 2020 17:39:46 -0700 (PDT) Received: by mail-pl1-x643.google.com with SMTP id h11so3294817plr.11 for ; Sun, 19 Apr 2020 17:39:46 -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=h6rWwFCNmeKlmAWhjuPvPuQJD25yhyO9wzPdxYNDeN4=; b=dAPlkIx2n3zOu67pNCZ1a/IoPRR768CpDzXtp2jHjkDJx7F7NvHzxHlS+Z7N7pJS+T /UyKB5i9J0RIuUgF5BRf5/GncSl+WxexY0eoU6LXBR/a++dNG7SDyQG4qQtpHWrwNP/n XbDWw5wZF2xfK7BQWZEtcypUEzBwJUjWXGN2InNfJG2TRakm3aNFdj9C9qqd2b9nwqxk QQURc9e9pyB5rLVUfR2GI8OyH05P4ztonOK/IlPTqp4sj4XOlmKFN1Rf40UtQce0LCwW rfzJx5JGwDCCdpIkLQld2FfqW4tADBSbwggsWnejSMdf63OUT51tbFmp8tcHBnbUawjx PiSg== 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=h6rWwFCNmeKlmAWhjuPvPuQJD25yhyO9wzPdxYNDeN4=; b=PmcRkTYltugL75eR1M37lTuXWKyCUryCNpuwuQgngjpGucDC8CfDwBhRxqUH3Rj9RA J+DIt5hFk5rVZkY1cgzNwThN3Z1CW427FrXaSYgwaOf3L4bvNPd60M454dfskhIyLxyX 5970hGq5+jVRVIzWWoxQj1YX2KYoBf+akXRKd1ltkUh7RJGkCnukfrADdYJ/bYdZHNLK ZaFS6DhwPgL4VQarj6+HU4C7IOlRpqBgOhlLLmXC+tvKhwlu+SXamZebb15WVxtyOa8o sgdfsZlrTrFaVorTjzS6tcC4JHiZAx5jiAWnAZS9iwj4xkSYmpFE6suDZDLjCSelealA gTAg== X-Gm-Message-State: AGi0PubcVg+SDsctDZP50b1xHXexBEJT/YGQ0k1J0m0cjvrsSOWGZvGv Q3nTPKnuTJ8p5/uCfSvEIucZ1ucdhr0= X-Google-Smtp-Source: APiQypJmzceoDX0PUX3ju+NOxu7TDjsSiNWJdV7ZjKb7pb6g3KVJLCX2+ORbsSFCh1hdhSaOxlVlFw== X-Received: by 2002:a17:90a:246d:: with SMTP id h100mr19246695pje.58.1587343185388; Sun, 19 Apr 2020 17:39:45 -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 f30sm12313701pje.29.2020.04.19.17.39.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Apr 2020 17:39:44 -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 v5 06/23] media: imx: Parse information from firmware without using callbacks Date: Sun, 19 Apr 2020 17:39:13 -0700 Message-Id: <20200420003930.11463-7-slongerbeam@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200420003930.11463-1-slongerbeam@gmail.com> References: <20200420003930.11463-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 functions v4l2_async_notifier_parse_fwnode_endpoints*() or v4l2_async_register_fwnode_subdev(), parse the input endpoints and set up the async sub-devices without using callbacks. The drivers know which ports it must parse 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/staging/media/imx/imx-media-csi.c | 78 +++++++++---------- drivers/staging/media/imx/imx6-mipi-csi2.c | 70 ++++++++++++----- drivers/staging/media/imx/imx7-media-csi.c | 53 ++++++++++--- drivers/staging/media/imx/imx7-mipi-csis.c | 91 +++++++++++++++------- 4 files changed, 192 insertions(+), 100 deletions(-) diff --git a/drivers/staging/media/imx/imx-media-csi.c b/drivers/staging/media/imx/imx-media-csi.c index e76a6a85baa3..58349c449c4d 100644 --- a/drivers/staging/media/imx/imx-media-csi.c +++ b/drivers/staging/media/imx/imx-media-csi.c @@ -58,6 +58,8 @@ struct csi_priv { struct ipu_soc *ipu; struct v4l2_subdev sd; struct media_pad pad[CSI_NUM_PADS]; + struct v4l2_async_notifier notifier; + /* the video device at IDMAC output pad */ struct imx_media_video_dev *vdev; struct imx_media_fim *fim; @@ -1867,59 +1869,49 @@ static const struct v4l2_subdev_internal_ops csi_internal_ops = { .unregistered = csi_unregistered, }; -static int imx_csi_parse_endpoint(struct device *dev, - struct v4l2_fwnode_endpoint *vep, - struct v4l2_async_subdev *asd) -{ - return fwnode_device_is_available(asd->match.fwnode) ? 0 : -ENOTCONN; -} - static int imx_csi_async_register(struct csi_priv *priv) { - struct v4l2_async_notifier *notifier; - struct fwnode_handle *fwnode; + struct v4l2_async_subdev *asd = NULL; + struct fwnode_handle *ep; unsigned int port; int ret; - notifier = kzalloc(sizeof(*notifier), GFP_KERNEL); - if (!notifier) - return -ENOMEM; - - v4l2_async_notifier_init(notifier); - - fwnode = dev_fwnode(priv->dev); + v4l2_async_notifier_init(&priv->notifier); /* get this CSI's port id */ - ret = fwnode_property_read_u32(fwnode, "reg", &port); - if (ret < 0) - goto out_free; - - ret = v4l2_async_notifier_parse_fwnode_endpoints_by_port( - priv->dev->parent, notifier, sizeof(struct v4l2_async_subdev), - port, imx_csi_parse_endpoint); + ret = fwnode_property_read_u32(dev_fwnode(priv->dev), "reg", &port); if (ret < 0) - goto out_cleanup; + return ret; - ret = v4l2_async_subdev_notifier_register(&priv->sd, notifier); - if (ret < 0) - goto out_cleanup; + ep = fwnode_graph_get_endpoint_by_id(dev_fwnode(priv->dev->parent), + port, 0, + FWNODE_GRAPH_ENDPOINT_NEXT); + if (ep) { + asd = kzalloc(sizeof(*asd), GFP_KERNEL); + if (!asd) { + fwnode_handle_put(ep); + return -ENOMEM; + } - ret = v4l2_async_register_subdev(&priv->sd); - if (ret < 0) - goto out_unregister; + ret = v4l2_async_notifier_add_fwnode_remote_subdev( + &priv->notifier, ep, asd); - priv->sd.subdev_notifier = notifier; + fwnode_handle_put(ep); - return 0; + if (ret) { + kfree(asd); + /* OK if asd already exists */ + if (ret != -EEXIST) + return ret; + } + } -out_unregister: - v4l2_async_notifier_unregister(notifier); -out_cleanup: - v4l2_async_notifier_cleanup(notifier); -out_free: - kfree(notifier); + ret = v4l2_async_subdev_notifier_register(&priv->sd, + &priv->notifier); + if (ret) + return ret; - return ret; + return v4l2_async_register_subdev(&priv->sd); } static int imx_csi_probe(struct platform_device *pdev) @@ -1999,9 +1991,13 @@ static int imx_csi_probe(struct platform_device *pdev) ret = imx_csi_async_register(priv); if (ret) - goto free; + goto cleanup; return 0; + +cleanup: + v4l2_async_notifier_unregister(&priv->notifier); + v4l2_async_notifier_cleanup(&priv->notifier); free: v4l2_ctrl_handler_free(&priv->ctrl_hdlr); mutex_destroy(&priv->lock); @@ -2015,6 +2011,8 @@ static int imx_csi_remove(struct platform_device *pdev) v4l2_ctrl_handler_free(&priv->ctrl_hdlr); mutex_destroy(&priv->lock); + v4l2_async_notifier_unregister(&priv->notifier); + v4l2_async_notifier_cleanup(&priv->notifier); v4l2_async_unregister_subdev(sd); media_entity_cleanup(&sd->entity); diff --git a/drivers/staging/media/imx/imx6-mipi-csi2.c b/drivers/staging/media/imx/imx6-mipi-csi2.c index 8ab823042c09..332d77aec8aa 100644 --- a/drivers/staging/media/imx/imx6-mipi-csi2.c +++ b/drivers/staging/media/imx/imx6-mipi-csi2.c @@ -35,6 +35,7 @@ struct csi2_dev { struct device *dev; struct v4l2_subdev sd; + struct v4l2_async_notifier notifier; struct media_pad pad[CSI2_NUM_PADS]; struct clk *dphy_clk; struct clk *pllref_clk; @@ -530,34 +531,59 @@ static const struct v4l2_subdev_internal_ops csi2_internal_ops = { .registered = csi2_registered, }; -static int csi2_parse_endpoint(struct device *dev, - struct v4l2_fwnode_endpoint *vep, - struct v4l2_async_subdev *asd) +static int csi2_async_register(struct csi2_dev *csi2) { - struct v4l2_subdev *sd = dev_get_drvdata(dev); - struct csi2_dev *csi2 = sd_to_dev(sd); + struct v4l2_fwnode_endpoint vep = { + .bus_type = V4L2_MBUS_CSI2_DPHY, + }; + struct v4l2_async_subdev *asd = NULL; + struct fwnode_handle *ep; + int ret; - if (!fwnode_device_is_available(asd->match.fwnode)) { - v4l2_err(&csi2->sd, "remote is not available\n"); - return -EINVAL; - } + v4l2_async_notifier_init(&csi2->notifier); - if (vep->bus_type != V4L2_MBUS_CSI2_DPHY) { - v4l2_err(&csi2->sd, "invalid bus type, must be MIPI CSI2\n"); - return -EINVAL; - } + ep = fwnode_graph_get_endpoint_by_id(dev_fwnode(csi2->dev), 0, 0, + FWNODE_GRAPH_ENDPOINT_NEXT); + if (!ep) + return -ENOTCONN; + + ret = v4l2_fwnode_endpoint_parse(ep, &vep); + if (ret) + goto err_parse; - csi2->bus = vep->bus.mipi_csi2; + csi2->bus = vep.bus.mipi_csi2; dev_dbg(csi2->dev, "data lanes: %d\n", csi2->bus.num_data_lanes); dev_dbg(csi2->dev, "flags: 0x%08x\n", csi2->bus.flags); - return 0; + asd = kzalloc(sizeof(*asd), GFP_KERNEL); + if (!asd) { + ret = -ENOMEM; + goto err_parse; + } + + ret = v4l2_async_notifier_add_fwnode_remote_subdev( + &csi2->notifier, ep, asd); + if (ret) + goto err_parse; + + fwnode_handle_put(ep); + + ret = v4l2_async_subdev_notifier_register(&csi2->sd, + &csi2->notifier); + if (ret) + return ret; + + return v4l2_async_register_subdev(&csi2->sd); + +err_parse: + fwnode_handle_put(ep); + kfree(asd); + return ret; } static int csi2_probe(struct platform_device *pdev) { - unsigned int sink_port = 0; struct csi2_dev *csi2; struct resource *res; int i, ret; @@ -633,15 +659,15 @@ static int csi2_probe(struct platform_device *pdev) platform_set_drvdata(pdev, &csi2->sd); - ret = v4l2_async_register_fwnode_subdev( - &csi2->sd, sizeof(struct v4l2_async_subdev), - &sink_port, 1, csi2_parse_endpoint); + ret = csi2_async_register(csi2); if (ret) - goto dphy_off; + goto clean_notifier; return 0; -dphy_off: +clean_notifier: + v4l2_async_notifier_unregister(&csi2->notifier); + v4l2_async_notifier_cleanup(&csi2->notifier); clk_disable_unprepare(csi2->dphy_clk); pllref_off: clk_disable_unprepare(csi2->pllref_clk); @@ -655,6 +681,8 @@ static int csi2_remove(struct platform_device *pdev) struct v4l2_subdev *sd = platform_get_drvdata(pdev); struct csi2_dev *csi2 = sd_to_dev(sd); + v4l2_async_notifier_unregister(&csi2->notifier); + v4l2_async_notifier_cleanup(&csi2->notifier); v4l2_async_unregister_subdev(sd); clk_disable_unprepare(csi2->dphy_clk); clk_disable_unprepare(csi2->pllref_clk); diff --git a/drivers/staging/media/imx/imx7-media-csi.c b/drivers/staging/media/imx/imx7-media-csi.c index acbdffb77668..aaa0b5870c53 100644 --- a/drivers/staging/media/imx/imx7-media-csi.c +++ b/drivers/staging/media/imx/imx7-media-csi.c @@ -155,6 +155,7 @@ struct imx7_csi { struct device *dev; struct v4l2_subdev sd; + struct v4l2_async_notifier notifier; struct imx_media_video_dev *vdev; struct imx_media_dev *imxmd; struct media_pad pad[IMX7_CSI_PADS_NUM]; @@ -1201,11 +1202,41 @@ static const struct v4l2_subdev_internal_ops imx7_csi_internal_ops = { .unregistered = imx7_csi_unregistered, }; -static int imx7_csi_parse_endpoint(struct device *dev, - struct v4l2_fwnode_endpoint *vep, - struct v4l2_async_subdev *asd) +static int imx7_csi_async_register(struct imx7_csi *csi) { - return fwnode_device_is_available(asd->match.fwnode) ? 0 : -EINVAL; + struct v4l2_async_subdev *asd = NULL; + struct fwnode_handle *ep; + int ret; + + v4l2_async_notifier_init(&csi->notifier); + + ep = fwnode_graph_get_endpoint_by_id(dev_fwnode(csi->dev), 0, 0, + FWNODE_GRAPH_ENDPOINT_NEXT); + if (ep) { + asd = kzalloc(sizeof(*asd), GFP_KERNEL); + if (!asd) { + fwnode_handle_put(ep); + return -ENOMEM; + } + + ret = v4l2_async_notifier_add_fwnode_remote_subdev( + &csi->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(&csi->sd, &csi->notifier); + if (ret) + return ret; + + return v4l2_async_register_subdev(&csi->sd); } static int imx7_csi_probe(struct platform_device *pdev) @@ -1288,19 +1319,21 @@ static int imx7_csi_probe(struct platform_device *pdev) if (ret < 0) goto free; - ret = v4l2_async_register_fwnode_subdev(&csi->sd, - sizeof(struct v4l2_async_subdev), - NULL, 0, - imx7_csi_parse_endpoint); + ret = imx7_csi_async_register(csi); if (ret) - goto free; + goto subdev_notifier_cleanup; return 0; +subdev_notifier_cleanup: + v4l2_async_notifier_unregister(&csi->notifier); + v4l2_async_notifier_cleanup(&csi->notifier); + free: v4l2_ctrl_handler_free(&csi->ctrl_hdlr); cleanup: + v4l2_async_notifier_unregister(&imxmd->notifier); v4l2_async_notifier_cleanup(&imxmd->notifier); v4l2_device_unregister(&imxmd->v4l2_dev); media_device_unregister(&imxmd->md); @@ -1325,6 +1358,8 @@ static int imx7_csi_remove(struct platform_device *pdev) v4l2_device_unregister(&imxmd->v4l2_dev); media_device_cleanup(&imxmd->md); + v4l2_async_notifier_unregister(&csi->notifier); + v4l2_async_notifier_cleanup(&csi->notifier); v4l2_async_unregister_subdev(sd); v4l2_ctrl_handler_free(&csi->ctrl_hdlr); diff --git a/drivers/staging/media/imx/imx7-mipi-csis.c b/drivers/staging/media/imx/imx7-mipi-csis.c index e2403b448b6d..b66299c1136d 100644 --- a/drivers/staging/media/imx/imx7-mipi-csis.c +++ b/drivers/staging/media/imx/imx7-mipi-csis.c @@ -221,6 +221,7 @@ struct csi_state { struct device *dev; struct media_pad pads[CSIS_PADS_NUM]; struct v4l2_subdev mipi_sd; + struct v4l2_async_notifier notifier; struct v4l2_subdev *src_sd; u8 index; @@ -946,33 +947,11 @@ 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_parse_endpoint(struct device *dev, - struct v4l2_fwnode_endpoint *ep, - struct v4l2_async_subdev *asd) -{ - struct v4l2_subdev *mipi_sd = dev_get_drvdata(dev); - struct csi_state *state = mipi_sd_to_csis_state(mipi_sd); - - if (ep->bus_type != V4L2_MBUS_CSI2_DPHY) { - dev_err(dev, "invalid bus type, must be MIPI CSI2\n"); - return -EINVAL; - } - - state->bus = ep->bus.mipi_csi2; - - dev_dbg(state->dev, "data lanes: %d\n", state->bus.num_data_lanes); - dev_dbg(state->dev, "flags: 0x%08x\n", state->bus.flags); - - return 0; -} - static int mipi_csis_subdev_init(struct v4l2_subdev *mipi_sd, struct platform_device *pdev, const struct v4l2_subdev_ops *ops) { struct csi_state *state = mipi_sd_to_csis_state(mipi_sd); - unsigned int sink_port = 0; - int ret; v4l2_subdev_init(mipi_sd, ops); mipi_sd->owner = THIS_MODULE; @@ -994,17 +973,58 @@ static int mipi_csis_subdev_init(struct v4l2_subdev *mipi_sd, state->pads[CSIS_PAD_SINK].flags = MEDIA_PAD_FL_SINK; state->pads[CSIS_PAD_SOURCE].flags = MEDIA_PAD_FL_SOURCE; - ret = media_entity_pads_init(&mipi_sd->entity, CSIS_PADS_NUM, - state->pads); + return media_entity_pads_init(&mipi_sd->entity, CSIS_PADS_NUM, + state->pads); +} + +static int mipi_csis_async_register(struct csi_state *state) +{ + struct v4l2_fwnode_endpoint vep = { + .bus_type = V4L2_MBUS_CSI2_DPHY, + }; + struct v4l2_async_subdev *asd = NULL; + struct fwnode_handle *ep; + int ret; + + v4l2_async_notifier_init(&state->notifier); + + ep = fwnode_graph_get_endpoint_by_id(dev_fwnode(state->dev), 0, 0, + FWNODE_GRAPH_ENDPOINT_NEXT); + if (!ep) + return -ENOTCONN; + + ret = v4l2_fwnode_endpoint_parse(ep, &vep); + if (ret) + goto err_parse; + + state->bus = vep.bus.mipi_csi2; + + dev_dbg(state->dev, "data lanes: %d\n", state->bus.num_data_lanes); + dev_dbg(state->dev, "flags: 0x%08x\n", state->bus.flags); + + asd = kzalloc(sizeof(*asd), GFP_KERNEL); + if (!asd) { + ret = -ENOMEM; + goto err_parse; + } + + ret = v4l2_async_notifier_add_fwnode_remote_subdev( + &state->notifier, ep, asd); + if (ret) + goto err_parse; + + fwnode_handle_put(ep); + + ret = v4l2_async_subdev_notifier_register(&state->mipi_sd, + &state->notifier); if (ret) return ret; - ret = v4l2_async_register_fwnode_subdev(mipi_sd, - sizeof(struct v4l2_async_subdev), - &sink_port, 1, - mipi_csis_parse_endpoint); - if (ret < 0) - dev_err(&pdev->dev, "async fwnode register failed: %d\n", ret); + return v4l2_async_register_subdev(&state->mipi_sd); + +err_parse: + fwnode_handle_put(ep); + kfree(asd); return ret; } @@ -1111,6 +1131,12 @@ static int mipi_csis_probe(struct platform_device *pdev) if (ret < 0) goto disable_clock; + ret = mipi_csis_async_register(state); + if (ret < 0) { + dev_err(&pdev->dev, "async register failed: %d\n", ret); + goto cleanup; + } + memcpy(state->events, mipi_csis_events, sizeof(state->events)); mipi_csis_debugfs_init(state); @@ -1129,7 +1155,10 @@ static int mipi_csis_probe(struct platform_device *pdev) unregister_all: mipi_csis_debugfs_exit(state); +cleanup: media_entity_cleanup(&state->mipi_sd.entity); + v4l2_async_notifier_unregister(&state->notifier); + v4l2_async_notifier_cleanup(&state->notifier); v4l2_async_unregister_subdev(&state->mipi_sd); disable_clock: mipi_csis_clk_disable(state); @@ -1217,6 +1246,8 @@ static int mipi_csis_remove(struct platform_device *pdev) struct csi_state *state = mipi_sd_to_csis_state(mipi_sd); mipi_csis_debugfs_exit(state); + v4l2_async_notifier_unregister(&state->notifier); + v4l2_async_notifier_cleanup(&state->notifier); v4l2_async_unregister_subdev(&state->mipi_sd); pm_runtime_disable(&pdev->dev); From patchwork Mon Apr 20 00:39:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Longerbeam X-Patchwork-Id: 11497961 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5806313B2 for ; Mon, 20 Apr 2020 00:39:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3967421D82 for ; Mon, 20 Apr 2020 00:39:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="UA+kx+GB" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726081AbgDTAjs (ORCPT ); Sun, 19 Apr 2020 20:39:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34312 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726054AbgDTAjr (ORCPT ); Sun, 19 Apr 2020 20:39:47 -0400 Received: from mail-pj1-x1041.google.com (mail-pj1-x1041.google.com [IPv6:2607:f8b0:4864:20::1041]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A53BCC061A0C for ; Sun, 19 Apr 2020 17:39:47 -0700 (PDT) Received: by mail-pj1-x1041.google.com with SMTP id np9so3794112pjb.4 for ; Sun, 19 Apr 2020 17:39:47 -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=UA+kx+GB6fIdUk8Myuuf8gC374VPw+DMgduhOrJr+/bUq1fa+TnFhvjz7wmU2Z6tpH BZ1juovMtf33IqDPJY1ZZ8XviC8gu1S180EfjlyW89yOGKFb91NSPJu20zvgPsWQq0tH 5Cp2zkZM7oMZvk1F2tZP76DRAKMZqYlKubdTXPOL0g/EAgaLsbekUOw41I2yoLpgHZek 2YRPAmlkftfZlYQFqDJcv6LPHwdv1/eWqmTlWfYstEfnlgbKZQixyM44pDCpAwu34MXR vbU8dwOFey3d2/IGB5IiPd8ZMobcwpLoDQTxWyldrQipwydMbZV/wcGeyFueKFVS0KtE Wjvw== 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=VVo0rISqlZwdlOzfqrPpLMhVOe1/yTJ1/NXH7qPsqHZRK/dRJgnSKStLunqyzxqDHV 8BU0OdEkCEinObocNErWmSARTkCz59K4GKpQ2ESz4wrZqV+PB4KjPiX6Q/Tr/UXcuDrK IWqwp/2uF1oA3GnLWxWk1kDWOhzgLvpqngrdmYG/RGyPE4UMl5aJk0mH45ZumTA7BqeB spQTQ41mPa+YMI9SLXpKEajkMpwSE7ERYf4mn8z0+ZiqgPY6ytXkfqAubTa8On2mug4F lKpEYh9PWcUma2RugB9Hepn25BEB5P6DvuI53/f0Jop5d89jxjnsuzz3E1BHS32ezEqT BZmA== X-Gm-Message-State: AGi0PuYH+/8UkedDmrGwzOyiYqiWSiJF5aGVgUdeHf5HPd+6mY6jBp97 8ljpniPNynAxv5PLrxt6o5k7AFfEt3U= X-Google-Smtp-Source: APiQypJfH3SiTGPiTaso4QHooZwZynmm/XAgFnDFebVXtE+qJQ1kYZMBmIOLJzy8v1lGw16B19b2qw== X-Received: by 2002:a17:90b:4c10:: with SMTP id na16mr1357192pjb.30.1587343186739; Sun, 19 Apr 2020 17:39:46 -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 f30sm12313701pje.29.2020.04.19.17.39.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Apr 2020 17:39:46 -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 v5 07/23] Revert "media: v4l2-fwnode: Add a convenience function for registering subdevs with notifiers" Date: Sun, 19 Apr 2020 17:39:14 -0700 Message-Id: <20200420003930.11463-8-slongerbeam@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200420003930.11463-1-slongerbeam@gmail.com> References: <20200420003930.11463-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 Mon Apr 20 00:39:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Longerbeam X-Patchwork-Id: 11497963 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3B01B92C for ; Mon, 20 Apr 2020 00:39:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 216C2221F7 for ; Mon, 20 Apr 2020 00:39:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="INh0tyDT" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726083AbgDTAjt (ORCPT ); Sun, 19 Apr 2020 20:39:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34314 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1725991AbgDTAjs (ORCPT ); Sun, 19 Apr 2020 20:39:48 -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 D9A3DC061A0C for ; Sun, 19 Apr 2020 17:39:48 -0700 (PDT) Received: by mail-pf1-x441.google.com with SMTP id d1so4135545pfh.1 for ; Sun, 19 Apr 2020 17:39:48 -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=rMR8kO8nK/Jq2/K37BPFuSD9GOIbjwp/Otnbct7wVOI=; b=INh0tyDTNiMqXR+Nsd1Xo9dIk9FhThE1MVHV4Ln4RPulZ3HuhUPJQX8nGLUveN/jl7 S6cqw97lIT7hAChQF5IY2XLY6Ysz3NdzUlG+cXHjXc7gSlBo6QZZ0sJxZ8SqrQqF9COE 2IYxHG0rEW0k1ay0GG3Xfj5ZkPWVaGp1oOxg8d7jnwqLc3rzeChzzKVcNvXBEQK8DZ0i 01k5xaFa+7a7LDD8741HxQpc234BBh8TkbNaxPLzP2AvXJO+PVvjHYCTTiQn0fppXYcc 4ENzNVJY1pe7hJQPLEzjO1QkeQr5780m1YWgaw7bDnxB5HBesX0aAOTe+Mf2fDk41MoQ wmFA== 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=rMR8kO8nK/Jq2/K37BPFuSD9GOIbjwp/Otnbct7wVOI=; b=F4xi3vjGUZI85Gf92L6CzQK+CHfgMrawWsNip/UAhj6QlyFXWNv7FmHt0+Pe0aP2pq NnVn0Jc5HWopOulXG5XNGyzvz80ZffyhGOGq/K06HQe/JTqJN4PjSQNwY8Z97hqn5cOA RIdkYqEDqMiu8/Wj6JD7bjbgOOkATo4IyDkbHxDCyw9w75tkIFiLJtIghO2UXYCaUY5Q E0JNdJk4sA6oASHi2+d/vwV02WIhISsp1yl1oulnQpXGfDn1AFaS3QyOypQVrWeaXDQW /47/5vUrj0qj+uGRYWxvugvdVcZpzuVL9ItBeVEyj8x3XE+4VHKOZGKWGc2ld3I9PnMr xTQA== X-Gm-Message-State: AGi0PuaXOe3hFXtGHni4GCTj+RBhEScGajobphRjPqx7drvFY5AMNykw 8xTVovsN5qWfdyF0PG5DmxAz1ji1I1s= X-Google-Smtp-Source: APiQypKSKDapeQBzoaTybXLwYJpZep4vctVObsOQj63VGW7M2x1aWaj9bGQqalfCRK2wk99IxJC7Zw== X-Received: by 2002:a63:f211:: with SMTP id v17mr11695614pgh.83.1587343188131; Sun, 19 Apr 2020 17:39:48 -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 f30sm12313701pje.29.2020.04.19.17.39.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Apr 2020 17:39:47 -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 v5 08/23] media: imx: csi: Implement get_fwnode_pad op Date: Sun, 19 Apr 2020 17:39:15 -0700 Message-Id: <20200420003930.11463-9-slongerbeam@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200420003930.11463-1-slongerbeam@gmail.com> References: <20200420003930.11463-1-slongerbeam@gmail.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org The CSI does not have a 1:1 relationship between fwnode port numbers and pad indexes. In fact the CSI fwnode device is itself a port which is the sink, containing only a single fwnode endpoint. Implement media_entity operation get_fwnode_pad to first verify the given endpoint is the CSI's sink endpoint, and if so return the CSI sink pad index. Signed-off-by: Steve Longerbeam Reviewed-by: Laurent Pinchart --- drivers/staging/media/imx/imx-media-csi.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/drivers/staging/media/imx/imx-media-csi.c b/drivers/staging/media/imx/imx-media-csi.c index 58349c449c4d..8501efaf9484 100644 --- a/drivers/staging/media/imx/imx-media-csi.c +++ b/drivers/staging/media/imx/imx-media-csi.c @@ -1830,9 +1830,32 @@ static void csi_unregistered(struct v4l2_subdev *sd) ipu_csi_put(priv->csi); } +/* + * The CSI has only one fwnode endpoint, at the sink pad. Verify the + * endpoint belongs to us, and return CSI_SINK_PAD. + */ +static int csi_get_fwnode_pad(struct media_entity *entity, + struct fwnode_endpoint *endpoint) +{ + struct v4l2_subdev *sd = media_entity_to_v4l2_subdev(entity); + struct csi_priv *priv = v4l2_get_subdevdata(sd); + struct fwnode_handle *csi_port = dev_fwnode(priv->dev); + struct fwnode_handle *csi_ep; + int ret; + + csi_ep = fwnode_get_next_child_node(csi_port, NULL); + + ret = endpoint->local_fwnode == csi_ep ? CSI_SINK_PAD : -ENXIO; + + fwnode_handle_put(csi_ep); + + return ret; +} + static const struct media_entity_operations csi_entity_ops = { .link_setup = csi_link_setup, .link_validate = v4l2_subdev_link_validate, + .get_fwnode_pad = csi_get_fwnode_pad, }; static const struct v4l2_subdev_core_ops csi_core_ops = { From patchwork Mon Apr 20 00:39:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Longerbeam X-Patchwork-Id: 11497965 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A3DD413B2 for ; Mon, 20 Apr 2020 00:39:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8BE2C21D82 for ; Mon, 20 Apr 2020 00:39:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="uuOWGvj8" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726099AbgDTAjw (ORCPT ); Sun, 19 Apr 2020 20:39:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1725991AbgDTAjv (ORCPT ); Sun, 19 Apr 2020 20:39:51 -0400 Received: from mail-pj1-x1041.google.com (mail-pj1-x1041.google.com [IPv6:2607:f8b0:4864:20::1041]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 584CEC061A0C for ; Sun, 19 Apr 2020 17:39:50 -0700 (PDT) Received: by mail-pj1-x1041.google.com with SMTP id ms17so3682831pjb.0 for ; Sun, 19 Apr 2020 17:39:50 -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=KL3F8Ry3F3mrrfiEfS5/cHlDdR5sJLqa+9CCe5yF5LU=; b=uuOWGvj8HDjyPEKlaIQtT/FsdQ0nnUzdobEbgxaQ0Xkia1lcIKWNg6DN/UUKhESAMP AA8xJ79tR/eGtv/fS22GlildTnBR+RW5vwNEuKhVTbj5a38AvtbdDc1Qr8nAbApD8fMU HEDT2+T+o/z2eQv2jXxpxuLovNMfVCQ1MAZ4cDJbCVmXAtCCfFGlocWhzMNrYKIktdTZ 9FAUR8Bq6KiqHDTL5I1Dum+sso1swqpkwfuSm3E8iOJB5TjJE1LW85wioDBYOW4O9aEg SGt1ClTfcWo/NKiArHJxsjnoucosJln891o7r3NRt7eJ5QSUq7UStpWcHL8opQN6Q+6G Trig== 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=KL3F8Ry3F3mrrfiEfS5/cHlDdR5sJLqa+9CCe5yF5LU=; b=T+0Vsb7WV43hv1R4ZuE0MsiHF3DI10yeg+O5YZmp+ps+HjKeaeIJmmveImf55RGbas rRTV90z6ABG2KcRz7GW/6EKsy6pxzSANN/hjvX4dKVbZ7AlTHOOytZnobS+NNvGRuD70 HZcwjTkq1WIgUFGa41RzbTRqG/SmusN9GIKr9SMImqnyZBZnPwO1VIVOcdVb2zp8RgBZ 2+NDWbI8OWMhv8mhlzxkd26F/uL8GxgEBkFhSFE4ZMm+A7qmy5ZCfYfyXlt1/+7sEtdk qVIO0SQvaHfjCHu/5AVlFbPUWe4CEdSMZU4zQFLSMSNakTsF0v974tCXFgN1u1F/gwuV MnUA== X-Gm-Message-State: AGi0PuYdLAP9WqdH3SkhDd0Jw7tNkvLPx2/018lBctSDYxiK9WGuaxVo OsFKfgcjfF3qa3QCctA5ElDVJPsgNnM= X-Google-Smtp-Source: APiQypJwxRSPM/Nt/U3QyNKyWz101KHI6RbEfMobBfX9FTVnP9+E7Bfj1lyXbK9fZwSH4h9m8xURNA== X-Received: by 2002:a17:90a:23e2:: with SMTP id g89mr18702757pje.105.1587343189619; Sun, 19 Apr 2020 17:39:49 -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 f30sm12313701pje.29.2020.04.19.17.39.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Apr 2020 17:39:49 -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 v5 09/23] media: video-mux: Implement get_fwnode_pad op Date: Sun, 19 Apr 2020 17:39:16 -0700 Message-Id: <20200420003930.11463-10-slongerbeam@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200420003930.11463-1-slongerbeam@gmail.com> References: <20200420003930.11463-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_default() 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..a21b299ce0e7 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_default, }; static int video_mux_s_stream(struct v4l2_subdev *sd, int enable) From patchwork Mon Apr 20 00:39:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Longerbeam X-Patchwork-Id: 11497967 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 761A913B2 for ; Mon, 20 Apr 2020 00:39:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5E09121D82 for ; Mon, 20 Apr 2020 00:39:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="gQVzbHDI" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726100AbgDTAjw (ORCPT ); Sun, 19 Apr 2020 20:39:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726089AbgDTAjv (ORCPT ); Sun, 19 Apr 2020 20:39:51 -0400 Received: from mail-pf1-x442.google.com (mail-pf1-x442.google.com [IPv6:2607:f8b0:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD5B7C061A0F for ; Sun, 19 Apr 2020 17:39:51 -0700 (PDT) Received: by mail-pf1-x442.google.com with SMTP id w65so4104502pfc.12 for ; Sun, 19 Apr 2020 17:39:51 -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=Nvvo/ZkObgnXossv1+5kaEIkJOJDxLCpF9rPZosUJGc=; b=gQVzbHDIHGDd5lN0ZFPofHK5LRJhqUXAVo7vTpKYU1+2sXaXDSiRE4aOhCHuMnY6BH XmzDeSe8x2K/G227ell7ScXeC5j1uBkof80gsFfODCdoGXY1mFzfG3hWFd0FKXiprR3G hKr6+bum5aYjhyEUdLuSd7CBGFA8PqTXPuot9+YdpUssOJZeJutObLoSTCYjk5gHQQUp aKatXRaD3ZCPy+hrg/aOFOSyya6JN4wIoey6s5ZjPYS8oh0nPSaZqJF8JZQr0L+6+LqT FAuT5XCcrskQROu0y99xWpFNmUSFefaqA7k4mVvqYieDi7bzlo+sTC0Mu9wtyhLEGiGZ UaPw== 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=Nvvo/ZkObgnXossv1+5kaEIkJOJDxLCpF9rPZosUJGc=; b=aM1k4GdxlqAt8SwPvQr3oaOIyzVy0jjyjyAc1JTr5Mo6vYVHpl9HUzONZkzY0+P1lE MathLaPccHiodnhs0fH7IzMTrLP2jaNjybJPGTus3xpX/v4nLOPNRxsPouOZVOXvIt8y aes0bTgNy7ruWJDC1DpzWaHSZPrtpLLleRtOU5COZ9iMkw9w5wqao5VNBgGdTAnrvg6B KDTo+cFTTpraTnlgRT/9z5js/Wyvsuy5CbRm+jROra1PMrCViY3aJLPqasQ0SXYU19t1 WDkZ6H1J3o5+n4e3ZbfSD1aedrHu5srA2uhbRsKnPAXUoQO96659FvMctr7WLq/7FPYs xrUQ== X-Gm-Message-State: AGi0PubLG7X4PjmCcdFrPg6W//PtxB+QfVeON481VB+CqvKXQGCYz3+S 7nSdICSuxGmHV4cFm571w7+gwPL/Z8k= X-Google-Smtp-Source: APiQypJkQdZ2Dg0zja2g4lEPGyB5Z+W6JtmWCMssS4JpILRY3TpooF8nV2Qmnw2D6SVDqaNaL+J46w== X-Received: by 2002:aa7:8259:: with SMTP id e25mr14236188pfn.82.1587343191036; Sun, 19 Apr 2020 17:39:51 -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 f30sm12313701pje.29.2020.04.19.17.39.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Apr 2020 17:39:50 -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 v5 10/23] media: imx: mipi csi-2: Implement get_fwnode_pad op Date: Sun, 19 Apr 2020 17:39:17 -0700 Message-Id: <20200420003930.11463-11-slongerbeam@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200420003930.11463-1-slongerbeam@gmail.com> References: <20200420003930.11463-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_default() as the get_fwnode_pad operation. The MIPI CSI-2 receiver maps port numbers and pad indexes 1:1. Signed-off-by: Steve Longerbeam --- drivers/staging/media/imx/imx6-mipi-csi2.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/media/imx/imx6-mipi-csi2.c b/drivers/staging/media/imx/imx6-mipi-csi2.c index 332d77aec8aa..5f5aef658a04 100644 --- a/drivers/staging/media/imx/imx6-mipi-csi2.c +++ b/drivers/staging/media/imx/imx6-mipi-csi2.c @@ -510,6 +510,7 @@ static int csi2_registered(struct v4l2_subdev *sd) static const struct media_entity_operations csi2_entity_ops = { .link_setup = csi2_link_setup, .link_validate = v4l2_subdev_link_validate, + .get_fwnode_pad = v4l2_subdev_get_fwnode_pad_default, }; static const struct v4l2_subdev_video_ops csi2_video_ops = { From patchwork Mon Apr 20 00:39:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Longerbeam X-Patchwork-Id: 11497969 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AE31692C for ; Mon, 20 Apr 2020 00:39:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 943B621D82 for ; Mon, 20 Apr 2020 00:39:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="UXzFqw9v" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726112AbgDTAjz (ORCPT ); Sun, 19 Apr 2020 20:39:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726089AbgDTAjy (ORCPT ); Sun, 19 Apr 2020 20:39:54 -0400 Received: from mail-pj1-x1044.google.com (mail-pj1-x1044.google.com [IPv6:2607:f8b0:4864:20::1044]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 36BBEC061A0C for ; Sun, 19 Apr 2020 17:39:53 -0700 (PDT) Received: by mail-pj1-x1044.google.com with SMTP id kb16so3802494pjb.1 for ; Sun, 19 Apr 2020 17:39:53 -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=jtajOtLt4o8DXOswYzYCoa3CZyiQQIMpXDBoB7VJNMQ=; b=UXzFqw9vVHBYj7XN31XK3qo8rlLF9OHfEkMFykcuSYOiW+Za2gwEk/9BDZHVVkwWlk ip5aHhYfSyitIBkvCWMMIBqTn5+Rh6h3z4Bol7d83v6WAi9rCqEJ1Cy5vTtNr6A8PVkP +6HOIXKzyRzInqhyKK8a95n6dUv1Wdk/0U3UR4O6WDuJM63NVYOyMEN/UBgUy2XWC5du Wi/o3qJVHCEc6+XCcKpCq2fWwuHRH6FKw3ddS50js8xpyNkohIiFBRp8KcfSVD7WwFNF HkQ2g8q+jhqDsZG0SgDXRiCNyjRaTfHvysaLMGBWnYlTrAQt+EERfPtd5W0u92Dj2YcH TvuA== 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=jtajOtLt4o8DXOswYzYCoa3CZyiQQIMpXDBoB7VJNMQ=; b=MXwj0AYXapAgTGzMfKkceVzox2ixouy/r/UKwGn4E6STwjclB5tmB+E5IwyIDJ9WO4 JXkNSEDPkbmmY5274oBNRvJCiWErTy8PEmbeiAUYH48HR2nnrosYNCSGnsQHAB1G/8ck jRre2Cvs9cN37TYKqONtWWCWCmtYE8hHV5AODfZSV0hKbWqHl1plI1HYqT4ti+K0/bnt qO2dzIZRWiC6IysFYqfeiQP0nYn4SkjBRKEl4fGG4WNwcKJXJ//m2WRmKB/FAZDeyZDL 1q/7JnsI+OrX/fXmzh8/A2hZFY2zR3O0Os8/OSXf2JdZ95qeaiQltWHH8Ls/eu8iGuZM FRVw== X-Gm-Message-State: AGi0PuaQo1sMv5Gg+mbWQcMkpdPO2OKZt6U3wJ0Y4xL22RyzW7yKfxfp IHTl0gib4SdTKq0xMr2eWzfX/egjSUE= X-Google-Smtp-Source: APiQypKxNqx5GNuMmEnjs9So+TwG8pU1qd+hXS6iqa++kUN74AuTRI+lOY7spqF0oiQLAFbaIqMjCQ== X-Received: by 2002:a17:90a:fa17:: with SMTP id cm23mr18802037pjb.121.1587343192463; Sun, 19 Apr 2020 17:39:52 -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 f30sm12313701pje.29.2020.04.19.17.39.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Apr 2020 17:39:51 -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 v5 11/23] media: imx: imx7-mipi-csis: Implement get_fwnode_pad op Date: Sun, 19 Apr 2020 17:39:18 -0700 Message-Id: <20200420003930.11463-12-slongerbeam@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200420003930.11463-1-slongerbeam@gmail.com> References: <20200420003930.11463-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_default() 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..1b3af031d136 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_default, }; static const struct v4l2_subdev_video_ops mipi_csis_video_ops = { From patchwork Mon Apr 20 00:39:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Longerbeam X-Patchwork-Id: 11497971 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 23DD814B4 for ; Mon, 20 Apr 2020 00:39:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0CA6721974 for ; Mon, 20 Apr 2020 00:39:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="HlheNYZ8" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726115AbgDTAjz (ORCPT ); Sun, 19 Apr 2020 20:39:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34338 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726105AbgDTAjy (ORCPT ); Sun, 19 Apr 2020 20:39:54 -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 8D491C061A0F for ; Sun, 19 Apr 2020 17:39:54 -0700 (PDT) Received: by mail-pf1-x443.google.com with SMTP id g30so4127611pfr.3 for ; Sun, 19 Apr 2020 17:39:54 -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=d7Ga9Qri/PF+o8gVigrVdhDIKmYgrogZBpx8dtUnaXA=; b=HlheNYZ8lvjl0jAY3Q0KKsGVlIPFmDViW1sGHgzWQMYZHGssX6ggdjqQE98nFYbLVL eKNvNHL20HNCBY+ES0mMz9+GCJFDkGHbCHz12P6vHo3ktRLsUrlVeKISGQXLU3yQXNuS KxVNbj79p76+dUF7lqD+qkv9WbOomAUI6BAthxm7DxynM87JUDfI61dKpJ/6radVdEeA Fm+NyWg4iHUCKMkNNzscfQI0EdLFbpUoeggHWhTHBFJGyR1S/2AF6DdcpQAqcELn7o9P FoYoiwhee1Ck7QeKrm6wliYIFFCaCVmLqXW2Tg4cc9uCE0i9ILOyVRirSeC7xpkEnAQ3 28vg== 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=d7Ga9Qri/PF+o8gVigrVdhDIKmYgrogZBpx8dtUnaXA=; b=YjE6YllV48ceyAsj1FfQNGyHmiOBeQM80Jx5Yzww6hafbOgpw1CjYvjqX+bBcIhdy5 WLT3dHKKMZ4TD117cZAMDBor1Okbas7jnLNd/phNM6cTAZyeqJ7wzPtrIU1I4bpa+fRP lnJOXrc6qQF40K6mFZ07rK2BTtrutZbkpnjjVxVtdrWUs+CM6McBDFG6jsp/mW7T/Y6G CrIL+RdmmzxncENat9k94Z0L11sjPg/Sfehawem7PcfNbIcbBu4qhfoW0HUBQJe25TQy iI9if3yfrWelA3aXqh8Qe25Uu1d1ZkyipNhD1aapKLoudk/buLooeP42a+saYRqvfNuk 7X+A== X-Gm-Message-State: AGi0PuYsKbm6/zp2l42ytYBFEHz9o4fXONKJFZ9AVdgR4z65qMQCVECE LRzO89zytkfPXQPWujNitNmi6tPcYUw= X-Google-Smtp-Source: APiQypLrPALgjXcw5daVnMims9bfSSMk3fRCeYUwTvXiBUYCyzLLQKzjqT7vYkl3oONxBSxw8HLXGg== X-Received: by 2002:aa7:84cd:: with SMTP id x13mr13902096pfn.41.1587343193821; Sun, 19 Apr 2020 17:39:53 -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 f30sm12313701pje.29.2020.04.19.17.39.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Apr 2020 17:39:53 -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 v5 12/23] media: imx: imx7-media-csi: Implement get_fwnode_pad op Date: Sun, 19 Apr 2020 17:39:19 -0700 Message-Id: <20200420003930.11463-13-slongerbeam@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200420003930.11463-1-slongerbeam@gmail.com> References: <20200420003930.11463-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_default() as the get_fwnode_pad operation. The i.MX7 CSI maps port numbers and pad indexes 1:1. Signed-off-by: Steve Longerbeam --- drivers/staging/media/imx/imx7-media-csi.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/media/imx/imx7-media-csi.c b/drivers/staging/media/imx/imx7-media-csi.c index aaa0b5870c53..e27d8f896a62 100644 --- a/drivers/staging/media/imx/imx7-media-csi.c +++ b/drivers/staging/media/imx/imx7-media-csi.c @@ -1178,6 +1178,7 @@ static int imx7_csi_init_cfg(struct v4l2_subdev *sd, static const struct media_entity_operations imx7_csi_entity_ops = { .link_setup = imx7_csi_link_setup, .link_validate = v4l2_subdev_link_validate, + .get_fwnode_pad = v4l2_subdev_get_fwnode_pad_default, }; static const struct v4l2_subdev_video_ops imx7_csi_video_ops = { From patchwork Mon Apr 20 00:39:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Longerbeam X-Patchwork-Id: 11497973 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6EEC192C for ; Mon, 20 Apr 2020 00:39:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5690F2145D for ; Mon, 20 Apr 2020 00:39:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="cRbmFLm7" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726117AbgDTAj5 (ORCPT ); Sun, 19 Apr 2020 20:39:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726105AbgDTAj5 (ORCPT ); Sun, 19 Apr 2020 20:39:57 -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 1EBD1C061A0C for ; Sun, 19 Apr 2020 17:39:56 -0700 (PDT) Received: by mail-pl1-x643.google.com with SMTP id g2so3311404plo.3 for ; Sun, 19 Apr 2020 17:39:56 -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=diBzADfannDdYI1cw4/kwf/YiXFzLk18zW8vS88VTgg=; b=cRbmFLm7HWyET8M2mtdxR1yy54EDrI9cDfTlzDKiHJ/or4k+rIQWlM+4vs+BsbQ9zZ JN9Dm6CD2/Y6wdzw0UN2/lA3u1Du42/FJLPlG3aqzNKKVu/dt2wJfSO/BTVueOpAzl38 P29oV6RrXFZCCEszq4x+v99HQ+qr0+8y+j3gQCiKsaQLD4dKH6WG/q9eViWNeuQGI92P AKZckvjqP3VYqPDa4yluMJO62eM9awibNfbdWbuEON9LxJKKeMe7IXY/6e7rG3/r5K6K uJ6p3W5KfmmfQiDdg9O3QZTqOEUoFFqmbkYWNcEKlUxLYhBzzxfM/qFd62zVyXRUAC3C 83rQ== 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=diBzADfannDdYI1cw4/kwf/YiXFzLk18zW8vS88VTgg=; b=Ft3fFXAs4VIl0U5gzmH0GW23BryQ/ElIcgJ/yg5y+uGvxr/5DBXhriDlg1rIdsluUp 3y7ThGudZ6talH4CmbRJZ0TraMbwOlvVN5BU7bPqyVnzbsK9jfzCWWypImzZ1+HzRyEV F7SFXxH8B0Dr0KJA6F8o7eyA+uaH9H3YKTlEpLd4a0TFmuTZBqG3/F/E+U3MZbrUDFQO j2rZqSs+RzgDVsiol4t5IyA8AICXX8MdkyMX/40M3tEj2ulj+m5fY0YM5UVGKHwzxXty wnm/T0I+k27RFcrFquaBti9zbht4rcbxggWsQMEA7vo3FgeCyxCuI/px8TPXoKpbdT0H 7ieA== X-Gm-Message-State: AGi0PubvmW7k3ahTnFtgJOUoXcUjsN0Pl8/VGBZ3detTtrdJ7tc+gt30 sQshIAqouwn9tSOPfdVb4O5Q/cKWpSQ= X-Google-Smtp-Source: APiQypJlbup7fHotYlAx/xuVClgsdrIXykUUWLkZ84fzozGP3eSLIQRDk0p5b74B9PgMyTUewJlVFw== X-Received: by 2002:a17:902:8485:: with SMTP id c5mr14891219plo.242.1587343195338; Sun, 19 Apr 2020 17:39:55 -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 f30sm12313701pje.29.2020.04.19.17.39.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Apr 2020 17:39:54 -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 v5 13/23] media: video-mux: Create media links in bound notifier Date: Sun, 19 Apr 2020 17:39:20 -0700 Message-Id: <20200420003930.11463-14-slongerbeam@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200420003930.11463-1-slongerbeam@gmail.com> References: <20200420003930.11463-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 a21b299ce0e7..4dd6f859450e 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 Mon Apr 20 00:39:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Longerbeam X-Patchwork-Id: 11497975 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A49E292C for ; Mon, 20 Apr 2020 00:39:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8C7082145D for ; Mon, 20 Apr 2020 00:39:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="h2fxC/39" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726124AbgDTAj7 (ORCPT ); Sun, 19 Apr 2020 20:39:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34352 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726105AbgDTAj6 (ORCPT ); Sun, 19 Apr 2020 20:39:58 -0400 Received: from mail-pj1-x1044.google.com (mail-pj1-x1044.google.com [IPv6:2607:f8b0:4864:20::1044]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62EBEC061A0F for ; Sun, 19 Apr 2020 17:39:57 -0700 (PDT) Received: by mail-pj1-x1044.google.com with SMTP id e6so1265751pjt.4 for ; Sun, 19 Apr 2020 17:39:57 -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=5iZ4ElvB1SxhCL6livyWFYVITUmBqykVUIxdDCLmPkM=; b=h2fxC/39hH7LZJ/r5hx7fmLAOWPI+IWasPWXpFJ/Yc1NGuogTqlyIYiyY+W6oSQY7j NdAN9JtJdpxYr2eQl33EOzzSx/deTuOEblN4vixI8zDqqt+UKueYI105dPBt/nN9t5KO WFCJ08ZcY1GrtsiUcb1djU+3LmdQSShXRlUWB+8BD+dncLQms3lHRO6+BRkeJoV0F/Fg 0HoSrjcuftIs4CGjyfwUvbPN8OtaWAdCbKubcMXlmmukGojmscXSay85sOTucNohZ2n3 HNpOWIIcSbV7Nk8hPgZ2Deu9nl0lVFLdMJKHC2Ln0xUh3l5PZAfsAvZ+H1M1lyplp9Ti uDag== 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=5iZ4ElvB1SxhCL6livyWFYVITUmBqykVUIxdDCLmPkM=; b=kmsz9DLzdVTn8Hew19AGGsTuvZZanHciaSTSoQMC5AA6mTmccxx4b+hpCzlbBN8AlE 4zWPppiaq7G65QHZJE17DvoHhG5SavKj68tt6jOQcjfVqZXAWo8gc8WA5/n4+RXCh6E/ 4wmyGDUeDxTO2xQtiBTr8eIUIyf4d3m6M07CTm/LMxFdFbL99uWPEVodkyLprJ6dQC6d Y0jcLWBAF2waJaqoVWRobbs/6ToAPgKTi8QOMJTksii1pxSdg9YAV/b275YI7Un0ZUAl ecY4CihSaVEYIMULoWfGu6HCdo4K/6SedH+XqPfxNR4ahJP9cP6l+xoHkuqNX6DlEqOB PDYw== X-Gm-Message-State: AGi0PuZazbgPDVDCjty4JU7msMZxbCP2RCoivQrMIcOwNpWsszqkxQHB qzKXKTWgQasWSHcXxDVuwv/0cylXRH0= X-Google-Smtp-Source: APiQypLF9WnbLr3fkkmoj+yGLriKL8lDXDvAEjx17D9cZsoF+kSCoPZpRI7LL6tOwG5AoTarGwDwCA== X-Received: by 2002:a17:902:ba86:: with SMTP id k6mr14810831pls.47.1587343196651; Sun, 19 Apr 2020 17:39:56 -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 f30sm12313701pje.29.2020.04.19.17.39.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Apr 2020 17:39:56 -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 v5 14/23] media: imx: mipi csi-2: Create media links in bound notifier Date: Sun, 19 Apr 2020 17:39:21 -0700 Message-Id: <20200420003930.11463-15-slongerbeam@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200420003930.11463-1-slongerbeam@gmail.com> References: <20200420003930.11463-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 --- Chnges 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() that creates a single link. --- drivers/staging/media/imx/imx6-mipi-csi2.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/staging/media/imx/imx6-mipi-csi2.c b/drivers/staging/media/imx/imx6-mipi-csi2.c index 5f5aef658a04..41d61c9a09f9 100644 --- a/drivers/staging/media/imx/imx6-mipi-csi2.c +++ b/drivers/staging/media/imx/imx6-mipi-csi2.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include "imx-media.h" @@ -91,6 +92,11 @@ static inline struct csi2_dev *sd_to_dev(struct v4l2_subdev *sdev) return container_of(sdev, struct csi2_dev, sd); } +static inline struct csi2_dev *notifier_to_dev(struct v4l2_async_notifier *n) +{ + return container_of(n, struct csi2_dev, notifier); +} + /* * The required sequence of MIPI CSI-2 startup as specified in the i.MX6 * reference manual is as follows: @@ -532,6 +538,20 @@ static const struct v4l2_subdev_internal_ops csi2_internal_ops = { .registered = csi2_registered, }; +static int csi2_notify_bound(struct v4l2_async_notifier *notifier, + struct v4l2_subdev *sd, + struct v4l2_async_subdev *asd) +{ + struct csi2_dev *csi2 = notifier_to_dev(notifier); + struct media_pad *sink = &csi2->sd.entity.pads[CSI2_SINK_PAD]; + + return v4l2_create_fwnode_links_to_pad(sd, sink); +} + +static const struct v4l2_async_notifier_operations csi2_notify_ops = { + .bound = csi2_notify_bound, +}; + static int csi2_async_register(struct csi2_dev *csi2) { struct v4l2_fwnode_endpoint vep = { @@ -570,6 +590,8 @@ static int csi2_async_register(struct csi2_dev *csi2) fwnode_handle_put(ep); + csi2->notifier.ops = &csi2_notify_ops; + ret = v4l2_async_subdev_notifier_register(&csi2->sd, &csi2->notifier); if (ret) From patchwork Mon Apr 20 00:39:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Longerbeam X-Patchwork-Id: 11497977 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0CD0714B4 for ; Mon, 20 Apr 2020 00:40:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E7D9521974 for ; Mon, 20 Apr 2020 00:39:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="CVo2VKUw" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726136AbgDTAj7 (ORCPT ); Sun, 19 Apr 2020 20:39:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726121AbgDTAj6 (ORCPT ); Sun, 19 Apr 2020 20:39:58 -0400 Received: from mail-pl1-x642.google.com (mail-pl1-x642.google.com [IPv6:2607:f8b0:4864:20::642]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C0576C061A0C for ; Sun, 19 Apr 2020 17:39:58 -0700 (PDT) Received: by mail-pl1-x642.google.com with SMTP id d24so3301877pll.8 for ; Sun, 19 Apr 2020 17:39:58 -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=zeq7U4bgVi6QRt2+oSb5yHP0cc+C7xZkBs+2BlV9yu0=; b=CVo2VKUwaFM7LPyrdFtvIU7eVPn59p8JVgohZFOLY2mZ9WAcV/T0AY48BpGHU5kzT8 4GoZ8o6rbyRqFEDpGawL7OaMy7zzeffRCnZWIYeccsfKk1CVECJAAlnZYHcTPL2o70Pz KXUl2GOUtUu3Qod3QqF+blEi4rWlWkV8emFxjRglDupFulv06Sr9g6MFzHYeTzMd4Dwa kSVCiBgqq+mhyeEj7eeLb3PCeYbn3ShHDUDvINhX7B5rIAuR6vJVxG7xE4TIU1TeV4Jf fbdjw+t8U5xXtoM/FCIn3AoboRQDc1eyT8yJ8e810Bagwd74Vf8dW/EMbm+MxwSl8ND/ KSww== 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=zeq7U4bgVi6QRt2+oSb5yHP0cc+C7xZkBs+2BlV9yu0=; b=CuhXpLuQJ5xmrLdAO6V1MAq6sp+qGIOSR8yaFKZMh7m+lwkn9GDzDC1vtW7CGRyHTI 1IicNOMNhN8ol8I4FPzfvuMbIUdW803H++0x5nGw7wGRPneEkSR6d9CKQxttFTaC7Flt MmhJacd13sdXkN3WvKFkjx7r/YIziEZzGLd4GgYxB8WMbrh1WP2smwjNcdAdu8Y5KESR 64HD1A8fjXdIzmRAx0Ynxr8qAgnaDhSB1kk73jXnJxAohInDJ7O0L980eEfJ3kRVCQHR iCH62Wyb25ZzDhY8rnlkptrVXLnRTp4x/P2KMx43XcJw4+ndU7k02iBNifeSUiyK/8oO /7EA== X-Gm-Message-State: AGi0PuaJqBGsvkG/k4wZnA0jKM76IoTsG45d+3P4NQl0BtXlr3yb7tED kJgGcaVyToshMUYlLU6Z0YagVm4qum0= X-Google-Smtp-Source: APiQypIKkFIulezgjXHm/ADUWFo5cYbATROwvLrV3boIKohxK90C+75ib3N+xs74GeIV1QRUHr4sMQ== X-Received: by 2002:a17:90a:8a06:: with SMTP id w6mr19560817pjn.191.1587343198018; Sun, 19 Apr 2020 17:39:58 -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 f30sm12313701pje.29.2020.04.19.17.39.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Apr 2020 17:39:57 -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 v5 15/23] media: imx7: mipi csis: Create media links in bound notifier Date: Sun, 19 Apr 2020 17:39:22 -0700 Message-Id: <20200420003930.11463-16-slongerbeam@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200420003930.11463-1-slongerbeam@gmail.com> References: <20200420003930.11463-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 1b3af031d136..6a13dc119c1f 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 Mon Apr 20 00:39:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Longerbeam X-Patchwork-Id: 11497979 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9649D13B2 for ; Mon, 20 Apr 2020 00:40:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7D19721974 for ; Mon, 20 Apr 2020 00:40:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="RA1yGQhJ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726141AbgDTAkA (ORCPT ); Sun, 19 Apr 2020 20:40:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726121AbgDTAkA (ORCPT ); Sun, 19 Apr 2020 20:40:00 -0400 Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 241BEC061A0C for ; Sun, 19 Apr 2020 17:40:00 -0700 (PDT) Received: by mail-pg1-x542.google.com with SMTP id g6so4193227pgs.9 for ; Sun, 19 Apr 2020 17:40:00 -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=cjzjDl7JHxJQeLK72XK1Q3pp4TAeVaMa8A7/cGohwnw=; b=RA1yGQhJnszrIP8KT3nDnutZOlMgdJL7TaYHRLF5JHNMFl775MS+gk4G0XrdugteS8 9ZlWst2u+/6Pf7+r9EtdpAEWMrDnD+82Dh5UkekD+CwYsW71dT0sqLm1s8PUSm/vb2Ax KsFamy2nfOi06mJxAXTVDImtCtXkdMbOnsU/UvqsQa7Cl64guxBesqRIut+mtueoetRF m116/BykuLmiaNaSYFd2nE7KSao+HFeTK+3msiUeGGU14ybFUEpGrjG/ykhRGb+Kfyov yBbxJxcLZf7HH72fejdKazLuyMEtXsu0YGaal2syLWjVvuqkTg993gnFxTr02nGXVzku nsWg== 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=cjzjDl7JHxJQeLK72XK1Q3pp4TAeVaMa8A7/cGohwnw=; b=LonEJJh+K7kUwlsjy+G3J6i6oRhBY5fmev+9390k9Q93kvEpDiGDvrAHobeAzc87J5 Otsfdjf03g7Kyi3H98fLaRzmBmtFTtro/uW5PfY1QUaIU8cz8psIPvM0TlohwZZ8whiw jr1GAtUvNRBgfmpiYnGGmVjwpJbuaqynX1/1HS4yEZrFnoOvfADbMoxsiKWRiCpv68QW j5tvACIPb8Z4bBYzRZ/VaJk+N9ptsfD9JT4auzJ8qBj3b3SBfXEeeJlkfmG5bonbaWDO rRjzb2aviqF/vRc6BXTVDiN4an1NWWCtZc8AGBdy/Jwu1b23w9PDdM4tBJSirrGiPvtc 1fqg== X-Gm-Message-State: AGi0PuYty3808XWa77KjAhzKJdOBncR7taW6mUnFNBhrJ0tGhrzTwEOQ UTq85P+tK66fg9h+tSNRiuym9MVd7MU= X-Google-Smtp-Source: APiQypIItdwUaaHNSI9YaORMalCvd5ZKraoMgkQhRBHZiDC5N3cOqDxMYuChDOY372Hvl5F9XpvMqQ== X-Received: by 2002:a62:7c51:: with SMTP id x78mr13876732pfc.227.1587343199402; Sun, 19 Apr 2020 17:39:59 -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 f30sm12313701pje.29.2020.04.19.17.39.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Apr 2020 17:39:58 -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 v5 16/23] media: imx7: csi: Create media links in bound notifier Date: Sun, 19 Apr 2020 17:39:23 -0700 Message-Id: <20200420003930.11463-17-slongerbeam@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200420003930.11463-1-slongerbeam@gmail.com> References: <20200420003930.11463-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 Reviewed-by: Rui Miguel Silva --- 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: - Rename notifier_to_dev() to imx7_csi_notifier_to_dev() and remove unnecessary inline. Suggested by Rui Silva. --- drivers/staging/media/imx/imx7-media-csi.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/staging/media/imx/imx7-media-csi.c b/drivers/staging/media/imx/imx7-media-csi.c index e27d8f896a62..357475de4e0c 100644 --- a/drivers/staging/media/imx/imx7-media-csi.c +++ b/drivers/staging/media/imx/imx7-media-csi.c @@ -196,6 +196,12 @@ struct imx7_csi { struct completion last_eof_completion; }; +static struct imx7_csi * +imx7_csi_notifier_to_dev(struct v4l2_async_notifier *n) +{ + return container_of(n, struct imx7_csi, notifier); +} + static u32 imx7_csi_reg_read(struct imx7_csi *csi, unsigned int offset) { return readl(csi->regbase + offset); @@ -1203,6 +1209,20 @@ static const struct v4l2_subdev_internal_ops imx7_csi_internal_ops = { .unregistered = imx7_csi_unregistered, }; +static int imx7_csi_notify_bound(struct v4l2_async_notifier *notifier, + struct v4l2_subdev *sd, + struct v4l2_async_subdev *asd) +{ + struct imx7_csi *csi = imx7_csi_notifier_to_dev(notifier); + struct media_pad *sink = &csi->sd.entity.pads[IMX7_CSI_PAD_SINK]; + + return v4l2_create_fwnode_links_to_pad(sd, sink); +} + +static const struct v4l2_async_notifier_operations imx7_csi_notify_ops = { + .bound = imx7_csi_notify_bound, +}; + static int imx7_csi_async_register(struct imx7_csi *csi) { struct v4l2_async_subdev *asd = NULL; @@ -1233,6 +1253,8 @@ static int imx7_csi_async_register(struct imx7_csi *csi) } } + csi->notifier.ops = &imx7_csi_notify_ops; + ret = v4l2_async_subdev_notifier_register(&csi->sd, &csi->notifier); if (ret) return ret; From patchwork Mon Apr 20 00:39:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Longerbeam X-Patchwork-Id: 11497981 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C804692C for ; Mon, 20 Apr 2020 00:40:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AEFE021D82 for ; Mon, 20 Apr 2020 00:40:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="SdGX7gpF" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726147AbgDTAkC (ORCPT ); Sun, 19 Apr 2020 20:40:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34368 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726121AbgDTAkB (ORCPT ); Sun, 19 Apr 2020 20:40:01 -0400 Received: from mail-pg1-x544.google.com (mail-pg1-x544.google.com [IPv6:2607:f8b0:4864:20::544]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8FC7EC061A0C for ; Sun, 19 Apr 2020 17:40:01 -0700 (PDT) Received: by mail-pg1-x544.google.com with SMTP id o15so3641542pgi.1 for ; Sun, 19 Apr 2020 17:40:01 -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=XhPOvVCqZ5d3wZcpuBJWgpQLz/1gKin/AejGcxf3OiU=; b=SdGX7gpF8ZGiiJ2SJWfNkvUHNiGvvOPcXnFXe1puAiNfplfMlB8l4Cb6P56km6DDEz WWAc5qkBcsRBt35av2FZuUeGC+8lJEl+XdlO3xIzteq4WRimFLvLcl6eER3TvMlVw3YT BiLqZqt7jcLs9C9eRd3uj87qZDO64E2KFfQ4LNhGV2mFeTGOox9FRhH84Bg+khlfvC5G ps8gIUGeR4ULf7EJSCawSxSTSinG29L3PPjdbO7+2x4ria2rXoXJ7mYtUIcQ9eBNS6LJ XwrqcxsnUjHWFW2IIGQU/zhVtZ0dd+Jc/2tvgMLSg5wgS1yIq4ireH1FOGADs5gZb++x FNAg== 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=XhPOvVCqZ5d3wZcpuBJWgpQLz/1gKin/AejGcxf3OiU=; b=NzOT+qHB70BsS55EZ/nnDsjs8De/DapCfhL0xIqdN4kM9qiHYl6Gc6myaa7tOVUBnV voWrd7V61ileWAqkMnCeukNClJOSAzHTZIeh1JXoWaLyKis1088WM7abH6Vj4Bwzk8cp Dbw6G7wym10xr4Fqtw1EQvkRZ1TC9rM93h4MURLsXgb43dMh+XqMej8KO7p4lm932Gfz z97CPrJOLGExAr2uTOUUaEPoyWDJQHwf4IgXHeoa00ZAOFrJ9pqiDfqGXpG1OKl1Rnqh 3q9l2DO4Yj9Cez6ycv6z4KhRoY01CmlhbA/jNlgPmceylni8pJ7Xg445gCyM4UBcZFLZ ZS+Q== X-Gm-Message-State: AGi0PuZQn4v7asRQLa3X5TDwH9RVzzr2QipUQa7INhZEwY35goVr9wGl gnEMtfAbpzcLSUvFaRPogtnEgqraTKE= X-Google-Smtp-Source: APiQypKliirT5V2/ablTdxa6Qq3bzPsMY9CEGfVrCoLucELZVVcHzTx5tniTPHvC7L+oQfFzNnGM6A== X-Received: by 2002:a62:7656:: with SMTP id r83mr14065752pfc.71.1587343200739; Sun, 19 Apr 2020 17:40:00 -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 f30sm12313701pje.29.2020.04.19.17.39.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Apr 2020 17:40:00 -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 v5 17/23] media: imx: csi: Create media links in bound notifier Date: Sun, 19 Apr 2020 17:39:24 -0700 Message-Id: <20200420003930.11463-18-slongerbeam@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200420003930.11463-1-slongerbeam@gmail.com> References: <20200420003930.11463-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 8501efaf9484..8153ae5935cf 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; @@ -1892,6 +1897,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; @@ -1929,6 +1948,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 Mon Apr 20 00:39:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Longerbeam X-Patchwork-Id: 11497983 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DE14E92C for ; Mon, 20 Apr 2020 00:40:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C4C12214D8 for ; Mon, 20 Apr 2020 00:40:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="G/UIjr/W" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726157AbgDTAkD (ORCPT ); Sun, 19 Apr 2020 20:40:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726121AbgDTAkC (ORCPT ); Sun, 19 Apr 2020 20:40:02 -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 C8B3DC061A0C for ; Sun, 19 Apr 2020 17:40:02 -0700 (PDT) Received: by mail-pf1-x441.google.com with SMTP id 18so479031pfx.6 for ; Sun, 19 Apr 2020 17:40:02 -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=g4Yd3Fh0FSdhep9EpnQRUl0LoCywYLakOXNIVirmsmU=; b=G/UIjr/W1FbNoZdwiz0dfjclSGKlpt7n/AwLnYTwM2aPAEOoqbE3olqaAeA3ikTh8D swqvlfHNm2mgkM+6J0krxBYfGQQLWFzdxJM7vSZSBc4ZbD9284fNU7v3teYvtJupJI7v 4h7XANZLQ9stVxmj7a+tV6LjhoLqJEjMuCRUU0VY5BgI2PI+DZXe/dBLzO+ISrLXOgTt SVQhAi/6PY66L2dze86byL+tGvRzbFbDwUm07uMoPutE+VNtqPYKy2Pfp7J5dfGFClwJ ZG3bsQ5Z9TUxtSrsvsQwVdwfQ+nsmS6oF0GCw83XK01lEosH+JK4ruIM0vju0n0AlMMv pZvA== 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=g4Yd3Fh0FSdhep9EpnQRUl0LoCywYLakOXNIVirmsmU=; b=Yk/jWbEQslPZaARyf6A1dtTAylMNTOz+N11GBR9JLe8+H8wqOBr7r2C1kpv+tpDpA5 n4/7d3X9SGOIr60Sfal2whyH0DZiI4Nd5zuQ7MjwrA3+Vj7y52wuO/6U8d0gF0hBQnZk 20N9OBgMJhO0PS+liAi7XmG6KRxS8Nfi5suRFpv9CznbV9yQ4cOuQdMUOwe3kjTUhhpW PI3GRTsrBYZwawyf4b7YeRshNWVK5siGLgWjHCZtb4ft4qq0nRIT+7QudxwP5RHa1UQd B02QA4i13OK0acw1kxWcs7TTGNaxlgcZoiKDg6ZoOym4PLKAGtu78g6yKh1gcpQ0MkAr /tfQ== X-Gm-Message-State: AGi0PubsiJyvHDAQFvHJOGhZFqByWCuSmRCPcp/k0mq+8lfT85ngL0es 2+GPt95mwdP8kjojag9iBf8XGKhsUHA= X-Google-Smtp-Source: APiQypKvgqkg6ROrg7+ANe9G7zKzF1JdAVdds28RG7rnUVutBxvi3DaCBwNHO0YVEngagM7SrGmd1g== X-Received: by 2002:a62:5b87:: with SMTP id p129mr14252549pfb.5.1587343202005; Sun, 19 Apr 2020 17:40:02 -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 f30sm12313701pje.29.2020.04.19.17.40.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Apr 2020 17:40:01 -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 v5 18/23] media: imx7: csi: Remove imx7_csi_get_upstream_endpoint() Date: Sun, 19 Apr 2020 17:39:25 -0700 Message-Id: <20200420003930.11463-19-slongerbeam@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200420003930.11463-1-slongerbeam@gmail.com> References: <20200420003930.11463-1-slongerbeam@gmail.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org The function imx7_csi_get_upstream_endpoint() is not necessary for imx7. First, the imx7 CSI only receives from the CSI mux, so much of the code in there is pointless. Second, it is only used to determine whether the CSI mux has selected the CSI-2 input or the parallel input. This can be accomplished much more simply by getting the function type of selected input entity to the CSI mux. Signed-off-by: Steve Longerbeam --- drivers/staging/media/imx/imx7-media-csi.c | 77 ++++------------------ 1 file changed, 12 insertions(+), 65 deletions(-) diff --git a/drivers/staging/media/imx/imx7-media-csi.c b/drivers/staging/media/imx/imx7-media-csi.c index 357475de4e0c..7a9bad7b71d3 100644 --- a/drivers/staging/media/imx/imx7-media-csi.c +++ b/drivers/staging/media/imx/imx7-media-csi.c @@ -169,8 +169,6 @@ struct imx7_csi { struct media_entity *sink; - struct v4l2_fwnode_endpoint upstream_ep; - struct v4l2_mbus_framefmt format_mbus[IMX7_CSI_PADS_NUM]; const struct imx_media_pixfmt *cc[IMX7_CSI_PADS_NUM]; struct v4l2_fract frame_interval[IMX7_CSI_PADS_NUM]; @@ -435,61 +433,6 @@ static void imx7_csi_deinit(struct imx7_csi *csi) csi->is_init = false; } -static int imx7_csi_get_upstream_endpoint(struct imx7_csi *csi, - struct v4l2_fwnode_endpoint *ep, - bool skip_mux) -{ - struct device_node *endpoint, *port; - struct media_entity *src; - struct v4l2_subdev *sd; - struct media_pad *pad; - - if (!csi->src_sd) - return -EPIPE; - - src = &csi->src_sd->entity; - - /* - * if the source is neither a mux or csi2 get the one directly upstream - * from this csi - */ - if (src->function != MEDIA_ENT_F_VID_IF_BRIDGE && - src->function != MEDIA_ENT_F_VID_MUX) - src = &csi->sd.entity; - -skip_video_mux: - /* get source pad of entity directly upstream from src */ - pad = imx_media_pipeline_pad(src, 0, 0, true); - if (!pad) - return -ENODEV; - - sd = media_entity_to_v4l2_subdev(pad->entity); - - /* To get bus type we may need to skip video mux */ - if (skip_mux && src->function == MEDIA_ENT_F_VID_MUX) { - src = &sd->entity; - goto skip_video_mux; - } - - /* - * NOTE: this assumes an OF-graph port id is the same as a - * media pad index. - */ - port = of_graph_get_port_by_id(sd->dev->of_node, pad->index); - if (!port) - return -ENODEV; - - endpoint = of_get_next_child(port, NULL); - of_node_put(port); - if (!endpoint) - return -ENODEV; - - v4l2_fwnode_endpoint_parse(of_fwnode_handle(endpoint), ep); - of_node_put(endpoint); - - return 0; -} - static int imx7_csi_link_setup(struct media_entity *entity, const struct media_pad *local, const struct media_pad *remote, u32 flags) @@ -556,23 +499,27 @@ static int imx7_csi_pad_link_validate(struct v4l2_subdev *sd, struct v4l2_subdev_format *sink_fmt) { struct imx7_csi *csi = v4l2_get_subdevdata(sd); - struct v4l2_fwnode_endpoint upstream_ep = {}; + struct media_pad *pad; int ret; ret = v4l2_subdev_link_validate_default(sd, link, source_fmt, sink_fmt); if (ret) return ret; - ret = imx7_csi_get_upstream_endpoint(csi, &upstream_ep, true); - if (ret) { - v4l2_err(&csi->sd, "failed to find upstream endpoint\n"); - return ret; - } + if (!csi->src_sd) + return -EPIPE; + + /* + * find the entity that is selected by the CSI mux. This is needed + * to distinguish between a parallel or CSI-2 pipeline. + */ + pad = imx_media_pipeline_pad(&csi->src_sd->entity, 0, 0, true); + if (!pad) + return -ENODEV; mutex_lock(&csi->lock); - csi->upstream_ep = upstream_ep; - csi->is_csi2 = (upstream_ep.bus_type == V4L2_MBUS_CSI2_DPHY); + csi->is_csi2 = (pad->entity->function == MEDIA_ENT_F_VID_IF_BRIDGE); mutex_unlock(&csi->lock); From patchwork Mon Apr 20 00:39:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Longerbeam X-Patchwork-Id: 11497985 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 976A192C for ; Mon, 20 Apr 2020 00:40:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7EA6421974 for ; Mon, 20 Apr 2020 00:40:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="udzIy9Hb" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726161AbgDTAkF (ORCPT ); Sun, 19 Apr 2020 20:40:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34376 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726121AbgDTAkE (ORCPT ); Sun, 19 Apr 2020 20:40:04 -0400 Received: from mail-pj1-x1041.google.com (mail-pj1-x1041.google.com [IPv6:2607:f8b0:4864:20::1041]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E502C061A0C for ; Sun, 19 Apr 2020 17:40:04 -0700 (PDT) Received: by mail-pj1-x1041.google.com with SMTP id ms17so3683003pjb.0 for ; Sun, 19 Apr 2020 17:40:04 -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=DQiJWYDZBbUPZ7HiwC9ohaLu2KA+CJB23qe7/YkynpE=; b=udzIy9HbT817NB7ZrBvMCt/YoAjxmLyxDuWavBGGlch1uxEFb5IT2tZn9qMN/9t7DP IGzTPa3Zrrc0c/kreAWVLDjLSbJ7Mo5Q1huvlca2nS00zK97N76BtPUqDd+Umi4sfiAn cmLiJHZeSS30cjGRTYbxUmYLaI4lXfoRGUs+/44SJgI4gM3rcd4DGp7LZtBAu+dQKpE6 9ypGStYs7Tjd1aeBFcJMsRW01pepTp8yWEUNxpby4ZLh+fWnho72Q9d0xDe6B+vzaoXW OxgJw2GPzBYKXer7At8L/eCHVDeA78bXqygyM4IToVRNM9dgZ/JKfuEqhM6LEj1SN5BE EuMg== 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=DQiJWYDZBbUPZ7HiwC9ohaLu2KA+CJB23qe7/YkynpE=; b=QnzzkYdkhsY+GQAZwu4LISsTN7Vw4E1jSRhNTn8HuipOEDKcNUjxRxsiTOszOejuuj vsgUc634wC9p3VMilBQqp+NCiHs7VjZ43sE2j9lBGeH6BDV4Ud+qxnyzzpMwzdk80D/o kq7myQSB8wDhJZWHAg+/h1uHZHBRESL0aOhDE0MSQ5zB11QSaXd5D2hIZllr0uplSo68 i9HszCflaSdiX0A5z+qUtviFCjgMJVp0Ed0DdWD4tV8LX+N2SNEWS7hUDkfeOwXuB/Q8 vKVFhI04aB5jbk6kupTgvQS0xglUv39mYZEbHq5bpFdgBx1hnH3kq1OM8y2AamhNUQhh IyGw== X-Gm-Message-State: AGi0PubEtNwDD1lQcqwQ6QZOP6IDTxRFHxs1MbVgH+g4D7W6tDuZgGU5 70VERBBfudpoAazCB5jmHvQ07UTLWO0= X-Google-Smtp-Source: APiQypIMafuArKUWhOwYh7CleqIEkORQS+Pr/0JvlEpdIg6GPlWaIgJLRJjhXtbqkHkfG+qtrMOFSQ== X-Received: by 2002:a17:902:421:: with SMTP id 30mr13933009ple.271.1587343203757; Sun, 19 Apr 2020 17:40:03 -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 f30sm12313701pje.29.2020.04.19.17.40.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Apr 2020 17:40:02 -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 v5 19/23] media: imx5/6/7: csi: Mark a bound video mux as a CSI mux Date: Sun, 19 Apr 2020 17:39:26 -0700 Message-Id: <20200420003930.11463-20-slongerbeam@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200420003930.11463-1-slongerbeam@gmail.com> References: <20200420003930.11463-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 8153ae5935cf..303f92ef4d9c 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; @@ -1904,6 +1906,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 11861191324a..d89026bb99a8 100644 --- a/drivers/staging/media/imx/imx-media.h +++ b/drivers/staging/media/imx/imx-media.h @@ -292,5 +292,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 7a9bad7b71d3..7a398e0e56e3 100644 --- a/drivers/staging/media/imx/imx7-media-csi.c +++ b/drivers/staging/media/imx/imx7-media-csi.c @@ -1163,6 +1163,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 Mon Apr 20 00:39:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Longerbeam X-Patchwork-Id: 11497987 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2789292C for ; Mon, 20 Apr 2020 00:40:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0E17721974 for ; Mon, 20 Apr 2020 00:40:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="uk0SgZhy" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726167AbgDTAkG (ORCPT ); Sun, 19 Apr 2020 20:40:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726121AbgDTAkF (ORCPT ); Sun, 19 Apr 2020 20:40:05 -0400 Received: from mail-pl1-x642.google.com (mail-pl1-x642.google.com [IPv6:2607:f8b0:4864:20::642]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E5AE4C061A0C for ; Sun, 19 Apr 2020 17:40:05 -0700 (PDT) Received: by mail-pl1-x642.google.com with SMTP id d24so3301943pll.8 for ; Sun, 19 Apr 2020 17:40: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=HgXvXiGmx8JKUwSpgz+/fWmB1fVB5yi28upGLJmCYnY=; b=uk0SgZhyBnLdHMel6L1Ia238gs2AdRKbJwxLDT0t832HY8j+6pyMlMXOD11tDGPa5s 2lic/LsIXbGqAGj7gRkxdk6+0K0eC/aEXPKdjySYuDpVtqv8DbGIQkXZhGOKtiYeKR9T FyyKz5m9SC8WMqqtfNzl8WsqbIZTubbWS8lf/yjY8M7lSuesZjo+xV+n7uB6ETcKqNUs En44YDrO8JjqAjvXzIVXTJzlTldidSsgo2kwKhzOdSL0ozLnhozme8Vd1okHOKl0q6mX 610V4j35Fb35FiSntAHDaR7+y4RWZSDd1DkzZ4N6J+CBfH8OQ/s5yPdUHh5QtOE70R2L eyJw== 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=HgXvXiGmx8JKUwSpgz+/fWmB1fVB5yi28upGLJmCYnY=; b=JWcLjsaEoDzlIZYeKzO8ODmp3vkf5UmqnNo4YJFDkeXBjbAEqruGKUCCVzLU5QhlV+ UmHHCPw/G3dPRT0TjquM9rIM2GBDiQ0xAm2fo7QFw1LAOiao0nTPI/TnF2KT9xcqIS+s +MQ02Kf4fD6AKSw/7Aqj2ROXhUPycgO0OrfM+weYwvRrnp7c/XmOzbLuQitBAFziId3b tPDXSpVrY63jpUTMN/sFLKvfoMoLWEbLSS+s40O6ylGqdI/ZLeUP0rgWGrqefX0negfE M5mfialJr0pwFVRMFN/20xrVE6eLsLecX0ceKYcMO/SsjQwsQ+N3OvAyh1K80QsDhuNo nbSg== X-Gm-Message-State: AGi0PuZcHCA3Ey8Xm5HgMZK1PaszX/htc1Ux3VnyB1+OxCiVu5kpfwP9 jV2k6oR3i3MgFCLcPNtW/PRZgnGV2oo= X-Google-Smtp-Source: APiQypLr1ljc+teUYNt49H79DLWn0abRog/7eIWFERBqJveQxYEKM4GB6KRIE32bpIH3k/76pPhjuA== X-Received: by 2002:a17:902:8643:: with SMTP id y3mr14183902plt.149.1587343205034; Sun, 19 Apr 2020 17:40:05 -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 f30sm12313701pje.29.2020.04.19.17.40.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Apr 2020 17:40: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 v5 20/23] media: imx: csi: Lookup upstream endpoint with imx_media_get_pad_fwnode Date: Sun, 19 Apr 2020 17:39:27 -0700 Message-Id: <20200420003930.11463-21-slongerbeam@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200420003930.11463-1-slongerbeam@gmail.com> References: <20200420003930.11463-1-slongerbeam@gmail.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Fix the 1:1 port-id:pad-index assumption for the upstream subdevice, by searching the upstream subdevice's endpoints for one that maps to the pad's index. This is carried out by a new reverse mapping function imx_media_get_pad_fwnode(). Signed-off-by: Steve Longerbeam --- drivers/staging/media/imx/imx-media-csi.c | 22 ++++---------- drivers/staging/media/imx/imx-media-utils.c | 33 +++++++++++++++++++++ drivers/staging/media/imx/imx-media.h | 1 + 3 files changed, 40 insertions(+), 16 deletions(-) diff --git a/drivers/staging/media/imx/imx-media-csi.c b/drivers/staging/media/imx/imx-media-csi.c index 303f92ef4d9c..a7640a5d7791 100644 --- a/drivers/staging/media/imx/imx-media-csi.c +++ b/drivers/staging/media/imx/imx-media-csi.c @@ -164,7 +164,7 @@ static inline bool requires_passthrough(struct v4l2_fwnode_endpoint *ep, static int csi_get_upstream_endpoint(struct csi_priv *priv, struct v4l2_fwnode_endpoint *ep) { - struct device_node *endpoint, *port; + struct fwnode_handle *endpoint; struct v4l2_subdev *sd; struct media_pad *pad; @@ -205,23 +205,13 @@ static int csi_get_upstream_endpoint(struct csi_priv *priv, if (!pad) return -ENODEV; - sd = media_entity_to_v4l2_subdev(pad->entity); + endpoint = imx_media_get_pad_fwnode(pad); + if (IS_ERR(endpoint)) + return PTR_ERR(endpoint); - /* - * NOTE: this assumes an OF-graph port id is the same as a - * media pad index. - */ - port = of_graph_get_port_by_id(sd->dev->of_node, pad->index); - if (!port) - return -ENODEV; - - endpoint = of_get_next_child(port, NULL); - of_node_put(port); - if (!endpoint) - return -ENODEV; + v4l2_fwnode_endpoint_parse(endpoint, ep); - v4l2_fwnode_endpoint_parse(of_fwnode_handle(endpoint), ep); - of_node_put(endpoint); + fwnode_handle_put(endpoint); return 0; } diff --git a/drivers/staging/media/imx/imx-media-utils.c b/drivers/staging/media/imx/imx-media-utils.c index fae981698c49..cc47591a5f0b 100644 --- a/drivers/staging/media/imx/imx-media-utils.c +++ b/drivers/staging/media/imx/imx-media-utils.c @@ -923,6 +923,39 @@ imx_media_pipeline_video_device(struct media_entity *start_entity, } EXPORT_SYMBOL_GPL(imx_media_pipeline_video_device); +/* + * Find a fwnode endpoint that maps to the given subdevice's pad. + * If there are multiple endpoints that map to the pad, only the + * first endpoint encountered is returned. + * + * On success the refcount of the returned fwnode endpoint is + * incremented. + */ +struct fwnode_handle *imx_media_get_pad_fwnode(struct media_pad *pad) +{ + struct fwnode_handle *endpoint; + struct v4l2_subdev *sd; + + if (!is_media_entity_v4l2_subdev(pad->entity)) + return ERR_PTR(-ENODEV); + + sd = media_entity_to_v4l2_subdev(pad->entity); + + fwnode_graph_for_each_endpoint(dev_fwnode(sd->dev), endpoint) { + int pad_idx = media_entity_get_fwnode_pad(&sd->entity, + endpoint, + pad->flags); + if (pad_idx < 0) + continue; + + if (pad_idx == pad->index) + return endpoint; + } + + return ERR_PTR(-ENODEV); +} +EXPORT_SYMBOL_GPL(imx_media_get_pad_fwnode); + /* * Turn current pipeline streaming on/off starting from entity. */ diff --git a/drivers/staging/media/imx/imx-media.h b/drivers/staging/media/imx/imx-media.h index d89026bb99a8..058a41e3d941 100644 --- a/drivers/staging/media/imx/imx-media.h +++ b/drivers/staging/media/imx/imx-media.h @@ -201,6 +201,7 @@ imx_media_pipeline_subdev(struct media_entity *start_entity, u32 grp_id, struct video_device * imx_media_pipeline_video_device(struct media_entity *start_entity, enum v4l2_buf_type buftype, bool upstream); +struct fwnode_handle *imx_media_get_pad_fwnode(struct media_pad *pad); struct imx_media_dma_buf { void *virt; From patchwork Mon Apr 20 00:39:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Longerbeam X-Patchwork-Id: 11497989 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AC6F292C for ; Mon, 20 Apr 2020 00:40:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8D42921974 for ; Mon, 20 Apr 2020 00:40:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="JDsRVtD3" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726168AbgDTAkI (ORCPT ); Sun, 19 Apr 2020 20:40:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34390 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726121AbgDTAkH (ORCPT ); Sun, 19 Apr 2020 20:40:07 -0400 Received: from mail-pl1-x644.google.com (mail-pl1-x644.google.com [IPv6:2607:f8b0:4864:20::644]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1D70C061A0C for ; Sun, 19 Apr 2020 17:40:07 -0700 (PDT) Received: by mail-pl1-x644.google.com with SMTP id ay1so3312536plb.0 for ; Sun, 19 Apr 2020 17:40:07 -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=oN/HNwCrbaMk4efWCxWK/gANgecdnCUQnoso3mWWKm8=; b=JDsRVtD3HrWkOKWlBhrMRpf0wsvVm8Zr/6eQjlv7+46E9acB9SeuPf3XFlNVDA8FXa 5Ic4XgL6PODJYlTXO+gs4Xd+NpS28WAsdtga9QGtZf3I/9uQzONFf2hgb/ApcW3xLjr7 1YqH4/M+2HhqKbZwC3tKy4ejD98uWx91QpYMXHZRbQV0FSwly4AiRVQcgmtMlnBsgiqx LQCbpDmtsN4VxzAlDrspmQJyQgCx9R9sIW+RHCOLb61tfNsMil3EoP7643PkSGgROGak nhYBJgP8WlxX4j8fcZExZ7wx39wgVYvKUywbh7jz8krjDIqCo8uZNKrly0426IyH35b5 xnFw== 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=oN/HNwCrbaMk4efWCxWK/gANgecdnCUQnoso3mWWKm8=; b=BTKGsSHDk1datQg80P7pKs0zlZ9Gs7fvMMlcn6zJdcBsfdHd4EJb0NChocBhCfTEkQ tiMeREhfYIebCYnP5BebgJuX4o7kqJtVUbxZCEjs1a2Rwl6h/kQJ2hGSMO+atcPmJQtt SIjcYrQHGLJuLOurKANgN+m0shiU0KMpeasLaufmJ0ZFuAtYI+fAuca8rbAYLIugXPUu mMayH7DQ03jl1S3UOHiM7RglS1hZBOqzWlWCOP5Q+1lvj2jFcWjJTsvbDdAeLIb1Ypzc SIqdSPB9JeJeUMHIXj7/r0k8Gdc94oykAUPiGEfSHtyYanz/ed0f3dqAWV/tplgYaCrh TGng== X-Gm-Message-State: AGi0PubC0/DgHw09KpF5Ks9rFrFR9YzZieY7ZcB64DVJ2Mrc3lEdoO2Y VYZ1W+ACcMYI7mJ4z+7NubYRU1aJQLU= X-Google-Smtp-Source: APiQypIJ5qBwMgqQe6bC9RH8TDStLS8WqCDAjIkOd1N/nPUc6eJDt9N3SADMltnUPfbroVuvE2bwIg== X-Received: by 2002:a17:90a:1910:: with SMTP id 16mr18638221pjg.119.1587343206525; Sun, 19 Apr 2020 17:40:06 -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 f30sm12313701pje.29.2020.04.19.17.40.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Apr 2020 17:40:05 -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 v5 21/23] media: imx: Create missing links from CSI-2 receiver Date: Sun, 19 Apr 2020 17:39:28 -0700 Message-Id: <20200420003930.11463-22-slongerbeam@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200420003930.11463-1-slongerbeam@gmail.com> References: <20200420003930.11463-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 058a41e3d941..53bb22feb451 100644 --- a/drivers/staging/media/imx/imx-media.h +++ b/drivers/staging/media/imx/imx-media.h @@ -244,10 +244,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 Mon Apr 20 00:39:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Longerbeam X-Patchwork-Id: 11497991 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 440F413B2 for ; Mon, 20 Apr 2020 00:40:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2806121D82 for ; Mon, 20 Apr 2020 00:40:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Kotv2GrZ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726181AbgDTAkJ (ORCPT ); Sun, 19 Apr 2020 20:40:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726121AbgDTAkJ (ORCPT ); Sun, 19 Apr 2020 20:40: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 2A4D2C061A0C for ; Sun, 19 Apr 2020 17:40:09 -0700 (PDT) Received: by mail-pl1-x641.google.com with SMTP id f8so3313885plt.2 for ; Sun, 19 Apr 2020 17:40:09 -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=aulrQ6oHsIqioAIw97gNvp4/kCTJRc3i88m+9ebFRaM=; b=Kotv2GrZlVTn6Fwq+WfnD4JosEIApxK+mT1flcliLm62ptxFVLGCyqGlXCv40/1n0Q GJ0AqNuwz45Tiia6ZWyIdsrDBkWTCBwUqfKNm+xP8YaehonGRO2weXnHIWCekutpj/Rp YjwFMk+/bHB+Tgy/yBuyCiBElgaJamDYQ3ZOIJnlHvFI973zjNA90pWVd1CffWQTTbqa w2A3P9MptBhP/d3S5oVeRj8CZKfwb1kYf4O9YVioHQSgEY9fMShEB/PB305ZbnZAdYoA b0HH59vZskkhRFqJBsJ6Xdl3WhjEyT9HDtqD8JMORNzOQ/JfS+tS39QqPMxkD6M3b4HG 5ZpA== 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=aulrQ6oHsIqioAIw97gNvp4/kCTJRc3i88m+9ebFRaM=; b=cKjQHUYsxVaJMTXZsOEQK8CGqdn+m9Vs0wcy69HSGtyC73gKn861TA+WKZ8rM9TW50 dcl+vTqo9aCf6+6AU36Z9qLrjuhL/tnia/x+1yjeQGxSiPwtGmm7WBs9YxjjTPa9sGgx b6036SPS8am1SRPWce9dGCPXxk3xZptsx++owzpfoBLh+FhpJ/DAHYm13aeDln8QoDdO WpI90Vz4Tk+IkNAHjs6EyENCxRRYPSoXC564tOlKDD0CN4A4ZQlcQwuMJfoExDGZ5bCi srN9UF+yEVDh7Z+gZZ5f1pmJ58QBqP/dE9JGiOyyn8qDEZLRf7+RzEVbkmbQZrUlPti+ r7zw== X-Gm-Message-State: AGi0PubgTd15ddktUZTvgEQJLwsuDwdHcuJNNmKKjx4CJSVcZExmuj4V uXEEuvrG6p+ME0h/C3mHSUNNO17GEzQ= X-Google-Smtp-Source: APiQypLy99jpD7URhWxITUarmfCMQTVEpiRrm1LiuL+BVmf/IE6m/Q7YHpzGkgwBCnmRbsTre56xrg== X-Received: by 2002:a17:902:20b:: with SMTP id 11mr13026031plc.209.1587343208341; Sun, 19 Apr 2020 17:40:08 -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 f30sm12313701pje.29.2020.04.19.17.40.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Apr 2020 17:40: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 v5 22/23] media: imx: silence a couple debug messages Date: Sun, 19 Apr 2020 17:39:29 -0700 Message-Id: <20200420003930.11463-23-slongerbeam@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200420003930.11463-1-slongerbeam@gmail.com> References: <20200420003930.11463-1-slongerbeam@gmail.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Convert to dev_dbg the "subdev bound" and IPU-internal media-link creation messages. Signed-off-by: Steve Longerbeam Reviewed-by: Laurent Pinchart --- drivers/staging/media/imx/imx-media-dev-common.c | 4 +++- drivers/staging/media/imx/imx-media-dev.c | 2 +- drivers/staging/media/imx/imx-media-internal-sd.c | 6 +++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/staging/media/imx/imx-media-dev-common.c b/drivers/staging/media/imx/imx-media-dev-common.c index f6ad9631fa0e..5fe4b22ab847 100644 --- a/drivers/staging/media/imx/imx-media-dev-common.c +++ b/drivers/staging/media/imx/imx-media-dev-common.c @@ -24,7 +24,9 @@ static int imx_media_subdev_bound(struct v4l2_async_notifier *notifier, struct v4l2_subdev *sd, struct v4l2_async_subdev *asd) { - v4l2_info(sd->v4l2_dev, "subdev %s bound\n", sd->name); + struct imx_media_dev *imxmd = notifier2dev(notifier); + + dev_dbg(imxmd->md.dev, "subdev %s bound\n", sd->name); return 0; } diff --git a/drivers/staging/media/imx/imx-media-dev.c b/drivers/staging/media/imx/imx-media-dev.c index 2c3c2adca683..6d2205461e56 100644 --- a/drivers/staging/media/imx/imx-media-dev.c +++ b/drivers/staging/media/imx/imx-media-dev.c @@ -32,7 +32,7 @@ static int imx_media_subdev_bound(struct v4l2_async_notifier *notifier, return ret; } - v4l2_info(&imxmd->v4l2_dev, "subdev %s bound\n", sd->name); + dev_dbg(imxmd->md.dev, "subdev %s bound\n", sd->name); return 0; } diff --git a/drivers/staging/media/imx/imx-media-internal-sd.c b/drivers/staging/media/imx/imx-media-internal-sd.c index d4237e1a4241..da4109b2fd13 100644 --- a/drivers/staging/media/imx/imx-media-internal-sd.c +++ b/drivers/staging/media/imx/imx-media-internal-sd.c @@ -142,9 +142,9 @@ static int create_internal_link(struct imx_media_dev *imxmd, &sink->entity.pads[link->remote_pad])) return 0; - v4l2_info(&imxmd->v4l2_dev, "%s:%d -> %s:%d\n", - src->name, link->local_pad, - sink->name, link->remote_pad); + dev_dbg(imxmd->md.dev, "%s:%d -> %s:%d\n", + src->name, link->local_pad, + sink->name, link->remote_pad); ret = media_create_pad_link(&src->entity, link->local_pad, &sink->entity, link->remote_pad, 0); From patchwork Mon Apr 20 00:39:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Longerbeam X-Patchwork-Id: 11497993 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9B17013B2 for ; Mon, 20 Apr 2020 00:40:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8233221974 for ; Mon, 20 Apr 2020 00:40:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="nOIpwk+/" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726189AbgDTAkL (ORCPT ); Sun, 19 Apr 2020 20:40:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726121AbgDTAkK (ORCPT ); Sun, 19 Apr 2020 20:40:10 -0400 Received: from mail-pg1-x544.google.com (mail-pg1-x544.google.com [IPv6:2607:f8b0:4864:20::544]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 980DFC061A0C for ; Sun, 19 Apr 2020 17:40:10 -0700 (PDT) Received: by mail-pg1-x544.google.com with SMTP id h69so4201291pgc.8 for ; Sun, 19 Apr 2020 17:40:10 -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=nOIpwk+/SXXpNdXIg0pLKG9+XTHKRZ/7CRt5FSoITv+k0UE5B3QgA9nV+UmogS+X0w ajv+eL35aNu1z4q4bom4mUV1V9LupOHkGh0EJU2zeeZqpcrTtFVhmYoUDnmDnCzuDtfT x9tjHK8lfzIv/KWh9DP79hktZyNFy2YqBk5ufitz/aDkSWuU5ELgeMCjWbkQME08GrVZ ed46kgv4hZiVtZGjBo0T1vRZiF+ow5z5rOpQiRcv3CqnBTvRGDr79Dz6z7SdzC3aJAoW oi6afMh5WYkmkePlm188/oK009WW1EsShflDQtfBXhxifaC2o/2DRi2iv3GY1CfC+4At 8bpA== 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=YRf8/79dbntnKbeFWNbjMfzPHl6vbMrdfXLC5D11QFNKuY/Ot/AJr9VcadKqmrLnb3 JW5L3dadjPQKXum6IG1xrjc5pQ7ImpOb/cjK7PExbmu2mmNgjpTKrs6O8W47kxmo1KME YeH8vbGX/OLXHrOjgzPR8WGxbyVTHM4GvrunzoaDgGidwln55cIaSq131TsncXY6XZtD dq3cbACyBTDid8Afl8qU+5GeSMoJ6kDHQ7sk8vYXk+9ZhhkBO5EnRshtkPKxc9devSGL yyX6lqs8bCx2xnLabKla+z/tzzXW0jlMRVhvuWU06xTXpb/SugB4Ec7urm9I/BwOXFg+ U3zQ== X-Gm-Message-State: AGi0PuYg/R0XiaXFhLVvPapNb3L7jlpeAXWe6RaTV2ZsZmlTmmZixZwg 2Rn59jJVrDTHkZpoonuNObpoipS48EY= X-Google-Smtp-Source: APiQypLxor1zhs1LX2Z1E/dQEUMkYtAjUnF4AglmyLj23pMOu08AU71xmNo/iTEtQIys5rYK82qhjA== X-Received: by 2002:a62:7d11:: with SMTP id y17mr14023458pfc.127.1587343209766; Sun, 19 Apr 2020 17:40:09 -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 f30sm12313701pje.29.2020.04.19.17.40.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Apr 2020 17:40: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 v5 23/23] media: imx: TODO: Remove media link creation todos Date: Sun, 19 Apr 2020 17:39:30 -0700 Message-Id: <20200420003930.11463-24-slongerbeam@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200420003930.11463-1-slongerbeam@gmail.com> References: <20200420003930.11463-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