From patchwork Sat Jan 19 21:45:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Longerbeam X-Patchwork-Id: 10772223 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 76AF313B5 for ; Sat, 19 Jan 2019 21:46:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6650A2AFB9 for ; Sat, 19 Jan 2019 21:46:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5A9D92B2AB; Sat, 19 Jan 2019 21:46:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F2C3F2AFB9 for ; Sat, 19 Jan 2019 21:46:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729701AbfASVqO (ORCPT ); Sat, 19 Jan 2019 16:46:14 -0500 Received: from mail-wm1-f65.google.com ([209.85.128.65]:50244 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729056AbfASVqO (ORCPT ); Sat, 19 Jan 2019 16:46:14 -0500 Received: by mail-wm1-f65.google.com with SMTP id n190so7586669wmd.0; Sat, 19 Jan 2019 13:46:12 -0800 (PST) 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=w4pDpNNiZVftYGZN/ZfjMBwdA+nK0DkXdKOIzQhsz4k=; b=YtdhT8RbsdmQsBpQBYCWX0f1PY7Jefd/07yOzlZTUBuyPkZ4DvkM2+8YNO2a9NT0dQ 08rh+SjbGnEGSm9TQvg4hzXhScXLsp5C48NaVELrWom2pt8GT9JwKpHlhz2aGFW9h2TN R83DNFAg7IGT4tV9SHZiEaa5ioBYjNrS9vn95hmYtKt8/GG4XCMo7tjo546RYMYObkwb e49RTIwV8bbE/7/IFqSw78xu7th9v+zrtV6zleKD4MJ03j9ltclWeHTP7F/Bd3mm7Kmt /QGfKuMbpMwWU6zv7zo4iEvrM7G9AzduduUVsXVbCFUC4h7iveihPQlrpgdARcn9O/wm gYGg== 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=w4pDpNNiZVftYGZN/ZfjMBwdA+nK0DkXdKOIzQhsz4k=; b=i56oWNQxcWfBoe6RH8QIVD7RBtyevA17nH3JZ7HyIOazbk+uq1YjxqS7LLM9oomX27 M4cD8MIDpVtoIHPjXiWaEG2VJr/qTPoHYSJElv7WxRBWbbK3Y35A691KSiDhuVTVg0HT GUPEWsSmSADGJyHg0UCHy5jzdgy8PN9Mmm3IyqSoPlOLEYUAEcP1+/lv8pec3MpqYi2z oQE5VyjaEsbS2I6hnHRSWsmbaztBj2BC5Zz/ZQMMat6IJziuAAyO6D2uNkD+E2XJXEiG UCRryBAXL3HH9UqAvvYBzbJTxBgqqWBlbMB+RHhRVCekUcZbV7V5ka9AjPgWVUe42mmt YwQQ== X-Gm-Message-State: AJcUukeIPeVFfe/rKpT/t5yneLRx6jnyM+A/UFv1MnUGFZ0fKfFI1yyi xgw0KkjK4p1OPJlyLXbYr0Xyn9dZ X-Google-Smtp-Source: ALg8bN7a4uh70hBn2UPLgTkTDPaqo7nkqhTBtUiBkvqgfA7W3WOlb+EDMZFDlaRl3J2WchsgPBadeA== X-Received: by 2002:a1c:2b01:: with SMTP id r1mr19430582wmr.7.1547934371081; Sat, 19 Jan 2019 13:46:11 -0800 (PST) Received: from mappy.world.mentorg.com (sjewanfw1-nat.mentorg.com. [139.181.7.34]) by smtp.gmail.com with ESMTPSA id o5sm26432048wrw.46.2019.01.19.13.46.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 19 Jan 2019 13:46:10 -0800 (PST) From: Steve Longerbeam To: linux-media@vger.kernel.org Cc: Steve Longerbeam , stable@vger.kernel.org, Philipp Zabel , Mauro Carvalho Chehab , Greg Kroah-Hartman , devel@driverdev.osuosl.org (open list:STAGING SUBSYSTEM), linux-kernel@vger.kernel.org (open list) Subject: [PATCH 1/4] media: imx: csi: Allow unknown nearest upstream entities Date: Sat, 19 Jan 2019 13:45:57 -0800 Message-Id: <20190119214600.30897-2-slongerbeam@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190119214600.30897-1-slongerbeam@gmail.com> References: <20190119214600.30897-1-slongerbeam@gmail.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On i.MX6, the nearest upstream entity to the CSI can only be the CSI video muxes or the Synopsys DW MIPI CSI-2 receiver. However the i.MX53 has no CSI video muxes or a MIPI CSI-2 receiver. So allow for the nearest upstream entity to the CSI to be something other than those. Fixes: bf3cfaa712e5c ("media: staging/imx: get CSI bus type from nearest upstream entity") Signed-off-by: Steve Longerbeam Cc: stable@vger.kernel.org --- drivers/staging/media/imx/imx-media-csi.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/drivers/staging/media/imx/imx-media-csi.c b/drivers/staging/media/imx/imx-media-csi.c index 555aa45e02e3..b9af7d3d4974 100644 --- a/drivers/staging/media/imx/imx-media-csi.c +++ b/drivers/staging/media/imx/imx-media-csi.c @@ -154,9 +154,10 @@ static inline bool requires_passthrough(struct v4l2_fwnode_endpoint *ep, /* * Parses the fwnode endpoint from the source pad of the entity * connected to this CSI. This will either be the entity directly - * upstream from the CSI-2 receiver, or directly upstream from the - * video mux. The endpoint is needed to determine the bus type and - * bus config coming into the CSI. + * upstream from the CSI-2 receiver, directly upstream from the + * video mux, or directly upstream from the CSI itself. The endpoint + * is needed to determine the bus type and bus config coming into + * the CSI. */ static int csi_get_upstream_endpoint(struct csi_priv *priv, struct v4l2_fwnode_endpoint *ep) @@ -172,7 +173,8 @@ static int csi_get_upstream_endpoint(struct csi_priv *priv, if (!priv->src_sd) return -EPIPE; - src = &priv->src_sd->entity; + sd = priv->src_sd; + src = &sd->entity; if (src->function == MEDIA_ENT_F_VID_MUX) { /* @@ -186,6 +188,14 @@ static int csi_get_upstream_endpoint(struct csi_priv *priv, src = &sd->entity; } + /* + * 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_find_upstream_pad(priv->md, src, 0); if (IS_ERR(pad)) From patchwork Sat Jan 19 21:45:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Longerbeam X-Patchwork-Id: 10772221 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6ADAA13B5 for ; Sat, 19 Jan 2019 21:46:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5AC572AFB9 for ; Sat, 19 Jan 2019 21:46:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4F3C72B2AB; Sat, 19 Jan 2019 21:46:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F31DD2AFB9 for ; Sat, 19 Jan 2019 21:46:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729760AbfASVqR (ORCPT ); Sat, 19 Jan 2019 16:46:17 -0500 Received: from mail-wr1-f66.google.com ([209.85.221.66]:40229 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729731AbfASVqQ (ORCPT ); Sat, 19 Jan 2019 16:46:16 -0500 Received: by mail-wr1-f66.google.com with SMTP id p4so19104079wrt.7; Sat, 19 Jan 2019 13:46:15 -0800 (PST) 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=fpUvrYP64FN5NwOLadPNJrZi+hirqUYiz7DdK6pImqY=; b=KIL7gCV/wV0OYKWmTi0vIGgWBfwVwPXuh/hpba6tpM97R2v5JHGpeOaH8IxH91kPtA 44dnHxxLYaSv2WVqnqaFIhAgRlBtcXB4VhrsgBHmK6idVhTZHiUA7Tnevpd1svqcmrcb cmbIkKpRAslymqP/si93G1yZFG7OnQVfuGbjTLE/ws/JspiPT359VFuHpzOGMeO4zcpJ MTcg8IV5YOO/Xws06hKvyioqjbWCxuvJyCnxx26JUJ65rq4k9nY6JZV6gYHbEqTHTzcf M7FkEDjM1oPVgLIvMDdo4lknS6/NsBddf1V5V4aRlvvz+d8HWkd3lwtL/PlDP8SL/axS Rckg== 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=fpUvrYP64FN5NwOLadPNJrZi+hirqUYiz7DdK6pImqY=; b=lotMEi+MauqQQSkeJV3IDh2qIaFpfXz0Wxr6tJsYULMhSFQZFZNg/U0c9rLdam8+2c 8BStPj6Q773n6/MMUnrxRlPLHghCsmZ8RBi4+SNFc3gQhLBsNQ3htXa/KdyUP6q9L7Dq jXI6gyXQZy09T80uuGNmLYtr/PUrzVsc8NVGvQSdymkSrv21NX+F7gWKku4QEBhRCW38 GMfRcnbx9wa/i79vjQTuBtGWgFql6ksaGbK42HPKYxRid0uD4ic6P4ypkl9bZoIDIB+K gcf5/OVdLMAudCJFADrO3tkki4HGdeg/T2TxbkaTO3EH0/zJipyI43MrNt9FSQt+sOMF q+jQ== X-Gm-Message-State: AJcUukdcg/i4//QOiNTjMd/PxXkjKfjUhzutKcTyTsBCT0T1Zj4vzhtt IvDuThKsflP3J3sXd05hLjd1RzOl X-Google-Smtp-Source: ALg8bN72MvuSG73r3/kdu4VGxvGiDRDrJ02hT/7kAWFn4IVG6MvImj6kMys21OTTK9NaOAWl9IEiaQ== X-Received: by 2002:a5d:448f:: with SMTP id j15mr20300880wrq.108.1547934373988; Sat, 19 Jan 2019 13:46:13 -0800 (PST) Received: from mappy.world.mentorg.com (sjewanfw1-nat.mentorg.com. [139.181.7.34]) by smtp.gmail.com with ESMTPSA id o5sm26432048wrw.46.2019.01.19.13.46.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 19 Jan 2019 13:46:13 -0800 (PST) From: Steve Longerbeam To: linux-media@vger.kernel.org Cc: Steve Longerbeam , stable@vger.kernel.org, Philipp Zabel , Mauro Carvalho Chehab , Greg Kroah-Hartman , devel@driverdev.osuosl.org (open list:STAGING SUBSYSTEM), linux-kernel@vger.kernel.org (open list) Subject: [PATCH 2/4] media: imx: Clear fwnode link struct for each endpoint iteration Date: Sat, 19 Jan 2019 13:45:58 -0800 Message-Id: <20190119214600.30897-3-slongerbeam@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190119214600.30897-1-slongerbeam@gmail.com> References: <20190119214600.30897-1-slongerbeam@gmail.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In imx_media_create_csi_of_links(), the 'struct v4l2_fwnode_link' must be cleared for each endpoint iteration, otherwise if the remote port has no "reg" property, link.remote_port will not be reset to zero. This was discovered on the i.MX53 SMD board, since the OV5642 connects directly to ipu1_csi0 and has a single source port with no "reg" property. Fixes: 621b08eabcddb ("media: staging/imx: remove static media link arrays") Signed-off-by: Steve Longerbeam Cc: stable@vger.kernel.org --- drivers/staging/media/imx/imx-media-of.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/staging/media/imx/imx-media-of.c b/drivers/staging/media/imx/imx-media-of.c index a01327f6e045..2da81a5af274 100644 --- a/drivers/staging/media/imx/imx-media-of.c +++ b/drivers/staging/media/imx/imx-media-of.c @@ -143,15 +143,18 @@ 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 fwnode_handle *fwnode, *csi_ep; - struct v4l2_fwnode_link link; struct device_node *ep; - int ret; - - link.local_node = of_fwnode_handle(csi_np); - link.local_port = CSI_SINK_PAD; 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); From patchwork Sat Jan 19 21:45:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Longerbeam X-Patchwork-Id: 10772219 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DA0A613B4 for ; Sat, 19 Jan 2019 21:46:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C8BD12AFB9 for ; Sat, 19 Jan 2019 21:46:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BC3C62B2AB; Sat, 19 Jan 2019 21:46:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 232162AFB9 for ; Sat, 19 Jan 2019 21:46:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729820AbfASVqW (ORCPT ); Sat, 19 Jan 2019 16:46:22 -0500 Received: from mail-wm1-f65.google.com ([209.85.128.65]:33151 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729793AbfASVqU (ORCPT ); Sat, 19 Jan 2019 16:46:20 -0500 Received: by mail-wm1-f65.google.com with SMTP id r24so3443349wmh.0; Sat, 19 Jan 2019 13:46:18 -0800 (PST) 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=RmgzoA4J0dAtqBeEiwAlBbV0PSmV+fxJTTx9iib3O40=; b=Ad9MiAc8QGcupTnQo+R0LCmw1aHUtmtA1IqInPAHRYaUgiNAZwTxKXOu+i3ggit30U WWOMrjw+2nDMOeilytXV449UTia9NgN7x3Iiy6aPATlZElaT8kZ9Sr1VF4YUqC35+wTW gHETiizoaNEPBHM0bs2rFmIyJnger801aFYtdERigTcK0Bjd/9tY5xmZtPuqr5UtRP0O LTtSNmGfiEKgNCT8XzmME+EssC/kR1ef4YgXHVZNmUmFivuuOk8cUc/JH1CwKVD2cfux CMj4UlxLM7FyZlgOl42BsCI+gPBkFt8tm0SV4RlOwdnaHI0rDR1lggDQ4B4UEJgd6uMj 49oQ== 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=RmgzoA4J0dAtqBeEiwAlBbV0PSmV+fxJTTx9iib3O40=; b=Yyp5c6du0rDETkXDM9pIuNRmQNPyjWbnNKPwvL4dGlZE7XuIhaKtEQq1ysdL9DCpn8 HXfANxNxlee+L5XS3Etoo6eHgn2wmqW5F7aTOQQeqXsN+ou2SVprSkiOREy726qE5U5F tWyd/zWd1F08JJ+fV5f8dERBBDMrvtWNRaaiPMvOacD2cLfCo8XczUyus2mS2yxi28oZ Pn/9ouVVoXprRGitJCZfp1d9tncZz2b5kOnZO/pgqSt6FT24yxL54jrooZat6tRGDdTf bcQOKhNK1Zdk9E79aDeoG+CmOvGxgylQhFEabJoBRzcTfOX/zwtfzpRBBNGI85+1KRZQ pM1g== X-Gm-Message-State: AJcUukeaNbpolTKkywCA6COumphSYhQ9TpIKocbpFhFDuY4WVi5n5vFu gT7Q1/WI64hSRxvePJzaIH4D2RDK X-Google-Smtp-Source: ALg8bN4kcOOjB85vwezKZZsAPF6RoFwIhZi0oZRR+Oq/nxfbqMdX6Oa7576x69JOe9UWraHv821iQw== X-Received: by 2002:a1c:96ce:: with SMTP id y197mr20453077wmd.36.1547934377192; Sat, 19 Jan 2019 13:46:17 -0800 (PST) Received: from mappy.world.mentorg.com (sjewanfw1-nat.mentorg.com. [139.181.7.34]) by smtp.gmail.com with ESMTPSA id o5sm26432048wrw.46.2019.01.19.13.46.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 19 Jan 2019 13:46:16 -0800 (PST) From: Steve Longerbeam To: linux-media@vger.kernel.org Cc: Steve Longerbeam , stable@vger.kernel.org, Philipp Zabel , Mauro Carvalho Chehab , Greg Kroah-Hartman , devel@driverdev.osuosl.org (open list:STAGING SUBSYSTEM), linux-kernel@vger.kernel.org (open list) Subject: [PATCH 3/4] media: imx: Rename functions that add IPU-internal subdevs/links Date: Sat, 19 Jan 2019 13:45:59 -0800 Message-Id: <20190119214600.30897-4-slongerbeam@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190119214600.30897-1-slongerbeam@gmail.com> References: <20190119214600.30897-1-slongerbeam@gmail.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP For the functions that add and remove the internal IPU subdevice descriptors and links between them, rename them to make clear they are the subdevs and links internal to the IPU. Also rename the platform data structure for the internal IPU subdevices. No functional changes. Signed-off-by: Steve Longerbeam Cc: stable@vger.kernel.org Acked-by: Philipp Zabel --- drivers/staging/media/imx/imx-ic-common.c | 2 +- drivers/staging/media/imx/imx-media-dev.c | 10 +++++----- .../staging/media/imx/imx-media-internal-sd.c | 16 ++++++++-------- drivers/staging/media/imx/imx-media-vdic.c | 2 +- drivers/staging/media/imx/imx-media.h | 10 +++++----- 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/drivers/staging/media/imx/imx-ic-common.c b/drivers/staging/media/imx/imx-ic-common.c index cfdd4900a3be..94dc5d88a069 100644 --- a/drivers/staging/media/imx/imx-ic-common.c +++ b/drivers/staging/media/imx/imx-ic-common.c @@ -26,7 +26,7 @@ static struct imx_ic_ops *ic_ops[IC_NUM_OPS] = { static int imx_ic_probe(struct platform_device *pdev) { - struct imx_media_internal_sd_platformdata *pdata; + struct imx_media_ipu_internal_sd_pdata *pdata; struct imx_ic_priv *priv; int ret; diff --git a/drivers/staging/media/imx/imx-media-dev.c b/drivers/staging/media/imx/imx-media-dev.c index 4b344a4a3706..edf9c80bbbc8 100644 --- a/drivers/staging/media/imx/imx-media-dev.c +++ b/drivers/staging/media/imx/imx-media-dev.c @@ -155,7 +155,7 @@ static int imx_media_create_links(struct v4l2_async_notifier *notifier) case IMX_MEDIA_GRP_ID_IC_PRPVF: case IMX_MEDIA_GRP_ID_CSI0: case IMX_MEDIA_GRP_ID_CSI1: - ret = imx_media_create_internal_links(imxmd, sd); + ret = imx_media_create_ipu_internal_links(imxmd, sd); if (ret) return ret; /* @@ -487,10 +487,10 @@ static int imx_media_probe(struct platform_device *pdev) goto notifier_cleanup; } - ret = imx_media_add_internal_subdevs(imxmd); + ret = imx_media_add_ipu_internal_subdevs(imxmd); if (ret) { v4l2_err(&imxmd->v4l2_dev, - "add_internal_subdevs failed with %d\n", ret); + "add_ipu_internal_subdevs failed with %d\n", ret); goto notifier_cleanup; } @@ -513,7 +513,7 @@ static int imx_media_probe(struct platform_device *pdev) return 0; del_int: - imx_media_remove_internal_subdevs(imxmd); + imx_media_remove_ipu_internal_subdevs(imxmd); notifier_cleanup: v4l2_async_notifier_cleanup(&imxmd->notifier); v4l2_device_unregister(&imxmd->v4l2_dev); @@ -530,7 +530,7 @@ static int imx_media_remove(struct platform_device *pdev) v4l2_info(&imxmd->v4l2_dev, "Removing imx-media\n"); v4l2_async_notifier_unregister(&imxmd->notifier); - imx_media_remove_internal_subdevs(imxmd); + imx_media_remove_ipu_internal_subdevs(imxmd); v4l2_async_notifier_cleanup(&imxmd->notifier); v4l2_device_unregister(&imxmd->v4l2_dev); media_device_unregister(&imxmd->md); diff --git a/drivers/staging/media/imx/imx-media-internal-sd.c b/drivers/staging/media/imx/imx-media-internal-sd.c index 0fdc45dbfb76..b8e763dbbecb 100644 --- a/drivers/staging/media/imx/imx-media-internal-sd.c +++ b/drivers/staging/media/imx/imx-media-internal-sd.c @@ -1,7 +1,7 @@ /* * Media driver for Freescale i.MX5/6 SOC * - * Adds the internal subdevices and the media links between them. + * Adds the IPU internal subdevices and the media links between them. * * Copyright (c) 2016 Mentor Graphics Inc. * @@ -192,7 +192,7 @@ static struct v4l2_subdev *find_sink(struct imx_media_dev *imxmd, /* * retrieve IPU id from subdev name, note: can't get this from - * struct imx_media_internal_sd_platformdata because if src is + * struct imx_media_ipu_internal_sd_pdata because if src is * a CSI, it has different struct ipu_client_platformdata which * does not contain IPU id. */ @@ -229,8 +229,8 @@ static int create_ipu_internal_link(struct imx_media_dev *imxmd, return ret; } -int imx_media_create_internal_links(struct imx_media_dev *imxmd, - struct v4l2_subdev *sd) +int imx_media_create_ipu_internal_links(struct imx_media_dev *imxmd, + struct v4l2_subdev *sd) { const struct internal_subdev *intsd; const struct internal_pad *intpad; @@ -270,7 +270,7 @@ static int add_internal_subdev(struct imx_media_dev *imxmd, const struct internal_subdev *isd, int ipu_id) { - struct imx_media_internal_sd_platformdata pdata; + struct imx_media_ipu_internal_sd_pdata pdata; struct platform_device_info pdevinfo = {}; struct platform_device *pdev; @@ -328,7 +328,7 @@ static int add_ipu_internal_subdevs(struct imx_media_dev *imxmd, int ipu_id) return 0; } -int imx_media_add_internal_subdevs(struct imx_media_dev *imxmd) +int imx_media_add_ipu_internal_subdevs(struct imx_media_dev *imxmd) { int ret; @@ -343,11 +343,11 @@ int imx_media_add_internal_subdevs(struct imx_media_dev *imxmd) return 0; remove: - imx_media_remove_internal_subdevs(imxmd); + imx_media_remove_ipu_internal_subdevs(imxmd); return ret; } -void imx_media_remove_internal_subdevs(struct imx_media_dev *imxmd) +void imx_media_remove_ipu_internal_subdevs(struct imx_media_dev *imxmd) { struct imx_media_async_subdev *imxasd; struct v4l2_async_subdev *asd; diff --git a/drivers/staging/media/imx/imx-media-vdic.c b/drivers/staging/media/imx/imx-media-vdic.c index 4a890714193e..efd2e028a098 100644 --- a/drivers/staging/media/imx/imx-media-vdic.c +++ b/drivers/staging/media/imx/imx-media-vdic.c @@ -931,7 +931,7 @@ static const struct v4l2_subdev_internal_ops vdic_internal_ops = { static int imx_vdic_probe(struct platform_device *pdev) { - struct imx_media_internal_sd_platformdata *pdata; + struct imx_media_ipu_internal_sd_pdata *pdata; struct vdic_priv *priv; int ret; diff --git a/drivers/staging/media/imx/imx-media.h b/drivers/staging/media/imx/imx-media.h index bc7feb81937c..0f915baeac8a 100644 --- a/drivers/staging/media/imx/imx-media.h +++ b/drivers/staging/media/imx/imx-media.h @@ -113,7 +113,7 @@ struct imx_media_pad_vdev { struct list_head list; }; -struct imx_media_internal_sd_platformdata { +struct imx_media_ipu_internal_sd_pdata { char sd_name[V4L2_SUBDEV_NAME_SIZE]; u32 grp_id; int ipu_id; @@ -237,10 +237,10 @@ struct imx_media_fim *imx_media_fim_init(struct v4l2_subdev *sd); void imx_media_fim_free(struct imx_media_fim *fim); /* imx-media-internal-sd.c */ -int imx_media_add_internal_subdevs(struct imx_media_dev *imxmd); -int imx_media_create_internal_links(struct imx_media_dev *imxmd, - struct v4l2_subdev *sd); -void imx_media_remove_internal_subdevs(struct imx_media_dev *imxmd); +int imx_media_add_ipu_internal_subdevs(struct imx_media_dev *imxmd); +int imx_media_create_ipu_internal_links(struct imx_media_dev *imxmd, + struct v4l2_subdev *sd); +void imx_media_remove_ipu_internal_subdevs(struct imx_media_dev *imxmd); /* imx-media-of.c */ int imx_media_add_of_subdevs(struct imx_media_dev *dev, From patchwork Sat Jan 19 21:46:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Longerbeam X-Patchwork-Id: 10772217 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 38A0013B4 for ; Sat, 19 Jan 2019 21:46:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 280CD2AFB9 for ; Sat, 19 Jan 2019 21:46:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1BDEB2B2AB; Sat, 19 Jan 2019 21:46:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 845662AFB9 for ; Sat, 19 Jan 2019 21:46:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729883AbfASVqZ (ORCPT ); Sat, 19 Jan 2019 16:46:25 -0500 Received: from mail-wm1-f66.google.com ([209.85.128.66]:54164 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729815AbfASVqX (ORCPT ); Sat, 19 Jan 2019 16:46:23 -0500 Received: by mail-wm1-f66.google.com with SMTP id d15so7552770wmb.3; Sat, 19 Jan 2019 13:46:21 -0800 (PST) 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=ZUDsAPnEhnt2k1sb+3yEFqAh+mhoQp14vu2KJMqARhE=; b=gbCg5ayohpLSfevNgyFHpr7IWdCpWAUqjKnSe8Z2vXszHkhGEiagfCV6NdNKXb+YMC wi78+C/rZMyJuFtyTPXjOmkvvtVBF+yR4Vj973Uo9iRMlgv+i6jR09XIozZKlifAy97k I66iTC6AdETpbCR5tsSgWoBP5Nw1UqYMH0XHSsEdOAEKrEuneEeLL15r9vfYIjLf9RVK ImZNvoKPtHUw0CMc24sujQRvTg/J80LrKTieERjwQpJtJtg+k/NGpUW248fON9bl4DMO VLw5+whjItOr8m1P/dL0+Kh3G3DfSM7rTt+0ALIVnF36Z4NZiNPxEVSNuCqKba7AnMMF 0nzg== 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=ZUDsAPnEhnt2k1sb+3yEFqAh+mhoQp14vu2KJMqARhE=; b=ISr4kpLs2OHqweS6r5mLbCshXN4GsQhMXfT0dov5K+OaWQXbx79vb9j5UFDUFPYRrh JovI1Y62fnA65xn0fvlVUdG/sK1hmfo+d3qSOb8IzMwKQKZqwiCzpCWeGsndhYdDmJZd 9VJKIEONn4+qVrY+TRtOb00m1bi6waAQ4Ab0/ut15n3ZVx00hBuKdkZpkjWexA3uka7a pyDnZ7sDBZ4hzpenihCBVzYAWPqXM5ItzFovmIZ/UwYQYzea3cyB0SdzKfsfX8vqaQ/w knHu7NmdWRXqnTrWEupCpC2xa95z24TFt4tzdgJQtB1Smm5vPThqFrDu530JGWNePpPI w3mA== X-Gm-Message-State: AJcUukcD8KCa62WQmbP1+MvW29MdCAfXA0CBhdC4HjgfsDaCXNhVGo8O fKtWi6j7n9+1AurbqXLLEP9WQej1 X-Google-Smtp-Source: ALg8bN7tdNevzgFC40n1LOkOj3USMtk2DuZ9ZFG3/IitXOetjgBS9DiVQsb1kLrbZ48NEaYR1zFL5A== X-Received: by 2002:a7b:c7c2:: with SMTP id z2mr18950353wmk.47.1547934380333; Sat, 19 Jan 2019 13:46:20 -0800 (PST) Received: from mappy.world.mentorg.com (sjewanfw1-nat.mentorg.com. [139.181.7.34]) by smtp.gmail.com with ESMTPSA id o5sm26432048wrw.46.2019.01.19.13.46.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 19 Jan 2019 13:46:19 -0800 (PST) From: Steve Longerbeam To: linux-media@vger.kernel.org Cc: Steve Longerbeam , stable@vger.kernel.org, Philipp Zabel , Mauro Carvalho Chehab , Greg Kroah-Hartman , devel@driverdev.osuosl.org (open list:STAGING SUBSYSTEM), linux-kernel@vger.kernel.org (open list) Subject: [PATCH 4/4] media: imx: Don't register IPU subdevs/links if CSI port missing Date: Sat, 19 Jan 2019 13:46:00 -0800 Message-Id: <20190119214600.30897-5-slongerbeam@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190119214600.30897-1-slongerbeam@gmail.com> References: <20190119214600.30897-1-slongerbeam@gmail.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The second IPU internal sub-devices were being registered and links to them created even when the second IPU is not present. This is wrong for i.MX6 S/DL and i.MX53 which have only a single IPU. Fixes: e130291212df5 ("[media] media: Add i.MX media core driver") Signed-off-by: Steve Longerbeam Cc: stable@vger.kernel.org Reviewed-by: Philipp Zabel --- drivers/staging/media/imx/imx-media-dev.c | 7 -- .../staging/media/imx/imx-media-internal-sd.c | 22 +----- drivers/staging/media/imx/imx-media-of.c | 76 ++++++++++++------- drivers/staging/media/imx/imx-media.h | 3 +- 4 files changed, 53 insertions(+), 55 deletions(-) diff --git a/drivers/staging/media/imx/imx-media-dev.c b/drivers/staging/media/imx/imx-media-dev.c index edf9c80bbbc8..924166cf957b 100644 --- a/drivers/staging/media/imx/imx-media-dev.c +++ b/drivers/staging/media/imx/imx-media-dev.c @@ -487,13 +487,6 @@ static int imx_media_probe(struct platform_device *pdev) goto notifier_cleanup; } - ret = imx_media_add_ipu_internal_subdevs(imxmd); - if (ret) { - v4l2_err(&imxmd->v4l2_dev, - "add_ipu_internal_subdevs failed with %d\n", ret); - goto notifier_cleanup; - } - /* no subdevs? just bail */ if (list_empty(&imxmd->notifier.asd_list)) { ret = -ENODEV; diff --git a/drivers/staging/media/imx/imx-media-internal-sd.c b/drivers/staging/media/imx/imx-media-internal-sd.c index b8e763dbbecb..3811c12d475b 100644 --- a/drivers/staging/media/imx/imx-media-internal-sd.c +++ b/drivers/staging/media/imx/imx-media-internal-sd.c @@ -298,13 +298,14 @@ static int add_internal_subdev(struct imx_media_dev *imxmd, } /* adds the internal subdevs in one ipu */ -static int add_ipu_internal_subdevs(struct imx_media_dev *imxmd, int ipu_id) +int imx_media_add_ipu_internal_subdevs(struct imx_media_dev *imxmd, + int ipu_id) { enum isd_enum i; + int ret; for (i = 0; i < num_isd; i++) { const struct internal_subdev *isd = &int_subdev[i]; - int ret; /* * the CSIs are represented in the device-tree, so those @@ -322,25 +323,10 @@ static int add_ipu_internal_subdevs(struct imx_media_dev *imxmd, int ipu_id) } if (ret) - return ret; + goto remove; } return 0; -} - -int imx_media_add_ipu_internal_subdevs(struct imx_media_dev *imxmd) -{ - int ret; - - ret = add_ipu_internal_subdevs(imxmd, 0); - if (ret) - goto remove; - - ret = add_ipu_internal_subdevs(imxmd, 1); - if (ret) - goto remove; - - return 0; remove: imx_media_remove_ipu_internal_subdevs(imxmd); diff --git a/drivers/staging/media/imx/imx-media-of.c b/drivers/staging/media/imx/imx-media-of.c index 2da81a5af274..32ed1a99813f 100644 --- a/drivers/staging/media/imx/imx-media-of.c +++ b/drivers/staging/media/imx/imx-media-of.c @@ -20,50 +20,68 @@ #include