Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3997856pxb; Tue, 2 Mar 2021 04:16:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJzGZmSMuvVzE7kORhOxwffrwkTHu9F5p3Nw3SgLTh/9o/SJIwYs4EyE7iHIOpvClt/WkHY4 X-Received: by 2002:a17:907:76bb:: with SMTP id jw27mr20335895ejc.366.1614687364286; Tue, 02 Mar 2021 04:16:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614687364; cv=none; d=google.com; s=arc-20160816; b=uQnpZgZyy7sSQjVYXeGt7CH03fXh8LTGZNZ2rdi9msu2x8KqsBq89g9iGQ90HwHuQ7 xkRizQMjBiBKTNorRMM+5slVej/ItiEEQjXb1QzGO9LjWTuKx/b4/URJF8JzFSOZQCZ1 GG3ttitr1bc8fkl7iPK7yIdMBV5kYK5Ye8IjIhHSO54iLsUGkQM7d3sTLCi2oy891F9g Zgqzma1ZkwlWlO5HQdCj8AyQ+4HWcGqc7+3mylWhT2H3kqF9HYaeGgrQQo1pVMavtkjB 8uES5FdfncpPT348PFF3j8usTK0eEWd87tjqlPf44sz7zzT4+wtBqPYp+QHxQ0EQATEb 3soA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Y6CEFQLnCAwjcD4EJAiKuu0e9NJZDibT8AqZCZRASCg=; b=unBMOotjEZUGDWDLwbnhhBzDiLoChfhDAR9oGPz/hbEK/XC7ldU6dX66dy+yzMpko8 sl+jHY1PD6olkYmww00q6me5UtMs7/xFgWqTZSUkDJYFnuN0kibHTur+/q8JgRIHDMLH 0IRuCiTZBEuLIbQfT7n8opj0tCgpJNfjfcPid7GpobSOXhDXXSOjk4XVrzYKfiCZDvR6 Muns10hJ8NGoN522XTlZWfgB1oUDVnRtTF83AlVOA0ATMO5GkpD1vDgPTtuKYbckxhys eLm4J+ChiedJBN8vA6mPA/fuosLh9Iqzex5AOyUc1An1mc8Y9PrKmGKVECJp9HK7S/AS ljzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JvnpaRxR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i12si12512244ejr.344.2021.03.02.04.15.41; Tue, 02 Mar 2021 04:16:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JvnpaRxR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1442622AbhCBCOo (ORCPT + 99 others); Mon, 1 Mar 2021 21:14:44 -0500 Received: from mail.kernel.org ([198.145.29.99]:54248 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236793AbhCATmC (ORCPT ); Mon, 1 Mar 2021 14:42:02 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6D34F6501C; Mon, 1 Mar 2021 17:11:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1614618678; bh=RbsRnAjVjKH2hfuolaRNlatMWXPRUnHLsvtlKr+1y5c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JvnpaRxROFk5biJPQz2I7I5GRW/0v8G7k2MnNpZObwBD+LU7gFSgS1ah8mn8wX+nY oMv8qlxCtHAros56CkvxwE16uov0BCMWFEET0UdRlMxzmQMLfaxq+vqP9JFaXA2K52 LuPNhDzkT28OrzOGVEqlQNqMo/QUgE3Im0419uaA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Fabio Estevam , Rui Miguel Silva , =?UTF-8?q?S=C3=A9bastien=20Szymanski?= , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.10 177/663] media: imx7: csi: Fix pad link validation Date: Mon, 1 Mar 2021 17:07:05 +0100 Message-Id: <20210301161150.544187438@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210301161141.760350206@linuxfoundation.org> References: <20210301161141.760350206@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Rui Miguel Silva [ Upstream commit f5ffb81f51376eb5a12e8c4cb4871426c65bb2af ] We can not make the assumption that the bound subdev is always a CSI mux, in i.MX6UL/i.MX6ULL that is not the case. So, just get the entity selected by source directly upstream from the CSI. Fixes: 86e02d07871c ("media: imx5/6/7: csi: Mark a bound video mux as a CSI mux") Reported-by: Fabio Estevam Signed-off-by: Rui Miguel Silva Tested-by: Fabio Estevam Tested-by: Sébastien Szymanski Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/staging/media/imx/imx7-media-csi.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/staging/media/imx/imx7-media-csi.c b/drivers/staging/media/imx/imx7-media-csi.c index 31e36168f9d0f..ac52b1daf9914 100644 --- a/drivers/staging/media/imx/imx7-media-csi.c +++ b/drivers/staging/media/imx/imx7-media-csi.c @@ -499,6 +499,7 @@ 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 media_entity *src; struct media_pad *pad; int ret; @@ -509,11 +510,21 @@ static int imx7_csi_pad_link_validate(struct v4l2_subdev *sd, if (!csi->src_sd) return -EPIPE; + src = &csi->src_sd->entity; + + /* + * if the source is neither a CSI MUX or CSI-2 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; + /* - * find the entity that is selected by the CSI mux. This is needed + * find the entity that is selected by the source. This is needed * to distinguish between a parallel or CSI-2 pipeline. */ - pad = imx_media_pipeline_pad(&csi->src_sd->entity, 0, 0, true); + pad = imx_media_pipeline_pad(src, 0, 0, true); if (!pad) return -ENODEV; -- 2.27.0