Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp1333157rdb; Mon, 19 Feb 2024 11:39:37 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUtjf7uVQDfXB9FGjsfsTZhKfJYtWJARqm22JyLfySusu/grT5tp9qhG8VTUJabFZ1jbDNCND2MrY/w/24vnflAirgVahxCkVRi04LaFQ== X-Google-Smtp-Source: AGHT+IHUHsAqiSQPpLbFcWNnR9CQNqb198hwTuP4J80OnMZ2zgvlPBKVIFi/FjczPWkMA67Zbmgl X-Received: by 2002:a17:90b:1988:b0:299:6748:658d with SMTP id mv8-20020a17090b198800b002996748658dmr4086239pjb.18.1708371577710; Mon, 19 Feb 2024 11:39:37 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708371577; cv=pass; d=google.com; s=arc-20160816; b=bkEmPC4oGGUzMkNIEyKiLTaHAZxxbaeiBgAaUnFFfRzsVce3B8IPsCo3av7UU/iova Ul2wGjE0/FIcMkltEd/O+16lfY7yjqFdlby9kxu0sqGl6c+htq1oZGLgujDIDAgNCSKu DzLvnQlEaDbGLeYIPep+6DIxxBRw6h1XVoZUHnuoC0hSyrQZ0DcJ6LXB/vjjQFe66jpG jyIfo6WfHsxYfA+fhSxeCRo9qBK0pwBKEeKDG1bbwfD8ibpdFNnrfBMc80GSD46jkKYb i+PLXCBqN3OwFJumqsa+EzEueRWJR/YV9eyQ4fuXLHay4UpGWipd+jNaGGlKu6svyRxX WoLg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:mail-followup-to:message-id:subject:cc:to:from:date :dkim-signature; bh=UxKBTk1E7NTV4F7pjypNpKtUr6DkX0NZqr1Ck1uEI+s=; fh=/cSE9pVfKDn7SzmEH1z8XCS1PgzfPt/EVBV390yYcow=; b=VAwnSVOj5GI4if+TCXMg2XKFz95r7AdCfMa7oBGjoYjl4ttYAkU39x9V48ro66oWPI vJyoS8Y3VJHYmIq1O5awnVe5oxdCpuh/Ydsk4wIeygeIgNzHE31fscdt7U6UfmoZl8QA wNigvDy7K3d7O0Ox0vvz5bRanCGRPdZFhh2KjRMzsP6s0AjDsw+UAumSga3It7INha1J WanNGGqOU4ynkzG/NlqoWJupe2qi5K6YnKs8Z1weg0RqynM7PVnFrxf21qlMvjsiw+CV BXtgUxfmDqbcYalisDcrX/MzUjbE313TvtnLShmVBw2eZZ2pRk7lvnUmL7geXqVAFCVR lFXg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@xff.cz header.s=mail header.b=JVt1ocNF; arc=pass (i=1 spf=pass spfdomain=xff.cz dkim=pass dkdomain=xff.cz dmarc=pass fromdomain=xff.cz); spf=pass (google.com: domain of linux-kernel+bounces-71878-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71878-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=xff.cz Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id i13-20020a17090acf8d00b002995b3a3d71si4279950pju.64.2024.02.19.11.39.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Feb 2024 11:39:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-71878-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@xff.cz header.s=mail header.b=JVt1ocNF; arc=pass (i=1 spf=pass spfdomain=xff.cz dkim=pass dkdomain=xff.cz dmarc=pass fromdomain=xff.cz); spf=pass (google.com: domain of linux-kernel+bounces-71878-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71878-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=xff.cz Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 63230281014 for ; Mon, 19 Feb 2024 19:39:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3F1AF524B1; Mon, 19 Feb 2024 19:39:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=xff.cz header.i=@xff.cz header.b="JVt1ocNF" Received: from vps.xff.cz (vps.xff.cz [195.181.215.36]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9AA1350A87 for ; Mon, 19 Feb 2024 19:39:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.181.215.36 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708371570; cv=none; b=rxRCA76B6PxWD+YGjWXjBNakUkzRGPWspLsY7BvW+O1V/9FtvJ7GMq05KyBiW734fToqt+kq7f+3sJv9F+OV3jZQDD5v1VfmEEHK2aayf4245nopevTk1TSfWg+q2zeoKngsE5V8jA7iJaKwpINQyIyHYWqn24W/ttyR7+B0KXY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708371570; c=relaxed/simple; bh=eYJcncYVMz2/P+8L4YuElamp9/gwH5EEjsU0YmeUEy4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=fXB6VE108PY5QKKUump/Kr39F0flfGs5sOasDUDGukMpvWzDiJAFuHKEd+xD3NIvDrA1fJR1Qh5fDZNyrUkPK+82Q27HAS76Y8uGbYw6J61kI5USJJTgMXOnuSPN0sfF5FJ3TFTlnKjTAq7VbBGaqNpaY6/zIx6LkYTOCJPFy5k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=xff.cz; spf=pass smtp.mailfrom=xff.cz; dkim=pass (1024-bit key) header.d=xff.cz header.i=@xff.cz header.b=JVt1ocNF; arc=none smtp.client-ip=195.181.215.36 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=xff.cz Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=xff.cz DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=xff.cz; s=mail; t=1708371564; bh=eYJcncYVMz2/P+8L4YuElamp9/gwH5EEjsU0YmeUEy4=; h=Date:From:To:Cc:Subject:X-My-GPG-KeyId:References:From; b=JVt1ocNFUSrQEY5yZpav/AneRAxvrc0MRJokvqgkTVvWnzpX0EiEb1/bIAm8kdgJL uPdGB9eJCG9pCCAUd4Qb3YPdsImVA5coUlQZe1Gf+3YAJv2Dm8W6DpHOh9dVd5pgux 9mdnhFla+wGVTifBvj3mjQfM9APNzqEgk+ZMO/DA= Date: Mon, 19 Feb 2024 20:39:23 +0100 From: =?utf-8?Q?Ond=C5=99ej?= Jirman To: Andy Yan Cc: linux-kernel@vger.kernel.org, Sandy Huang , Heiko =?utf-8?Q?St=C3=BCbner?= , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , "open list:DRM DRIVERS FOR ROCKCHIP" , "moderated list:ARM/Rockchip SoC support" , "open list:ARM/Rockchip SoC support" Subject: Re: [PATCH] drm: rockchip: Don't require MIPI DSI device when it's used for ISP Message-ID: <65qkkf7baecbcnemtabzup2nupd63obz4ewrhruk5frl2t3hwv@eqxm3tzgqcv6> Mail-Followup-To: =?utf-8?Q?Ond=C5=99ej?= Jirman , Andy Yan , linux-kernel@vger.kernel.org, Sandy Huang , Heiko =?utf-8?Q?St=C3=BCbner?= , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , "open list:DRM DRIVERS FOR ROCKCHIP" , "moderated list:ARM/Rockchip SoC support" , "open list:ARM/Rockchip SoC support" X-My-GPG-KeyId: EBFBDDE11FB918D44D1F56C1F9F0A873BE9777ED References: <20240217183941.1752463-1-megi@xff.cz> <4c66c084-5af6-43fb-a256-4746b2e00192@rock-chips.com> <7044f324-5a45-4a4c-a15e-86614e53acf0@rock-chips.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <7044f324-5a45-4a4c-a15e-86614e53acf0@rock-chips.com> On Mon, Feb 19, 2024 at 11:02:01AM +0800, Andy Yan wrote: > Hi Ondrej: > > On 2/18/24 23:17, Ondřej Jirman wrote: > > Hi Andy, > > > > On Sun, Feb 18, 2024 at 07:14:56PM +0800, Andy Yan wrote: > > > Hi, > > > > > > On 2/18/24 02:39, Ondřej Jirman wrote: > > > > From: Ondrej Jirman > > > > > > > > On RK3399 one MIPI DSI device can be alternatively used with the ISP1, > > > > to provide RX DPHY. When this is the case (ISP1 is enabled in device > > > > tree), probe success of DRM is tied to probe success of ISP1 connected > > > > camera sensor. This can fail if the user is able to killswitch the camera > > > > power, like on Pinephone Pro. > > > > > > > > Detect use of MIPI DSI controller by ISP, and don't include it in > > > > component match list in that case. > > > > > > > > > > Isn't this supposed to be taken care of within the dts? > > > Since DPHY1 should exclusively used by MIPI DSI1 and ISP1, then if > > > a device want to use ISP1, the DSI1 should be disabled in dts. > > > > DSI1 can't be disabled, because it provides PHY device for ISP1 in this > > scenario. > > > > The problem is that in this scenario DRM keeps waiting for DSI1 device, > > despite it just being used for PHY for ISP1 and not as a component for > > rockchip DRM driver. > > > Oh, get it. > With a quick look, seems that Heiko has already take this scenario into consideration > when add PHY function in the dsi drivers[0] > Does this mean the current drivers does not work as expected? It didn't work anymore since some fw devlink changes that were added some time after 2021. But it might have got resolved since than. So please ignore this patch for now. kind regards, o. > [0]https://patchwork.freedesktop.org/patch/420386/ > > > > See: > > > > isp1: isp1@ff920000 { > > compatible = "rockchip,rk3399-cif-isp"; > > reg = <0x0 0xff920000 0x0 0x4000>; > > interrupts = ; > > clocks = <&cru SCLK_ISP1>, > > <&cru ACLK_ISP1_WRAPPER>, > > <&cru HCLK_ISP1_WRAPPER>; > > clock-names = "isp", "aclk", "hclk"; > > iommus = <&isp1_mmu>; > > phys = <&mipi_dsi1>; <--------- > > phy-names = "dphy"; > > power-domains = <&power RK3399_PD_ISP1>; > > status = "disabled"; > > > > If mipi_dsi1 is disabled, isp1 will never probe. > > > > It's a consequence of this special dual use of mipi_dsi1. > > > > kind regards, > > o. > > > > > > Signed-off-by: Ondrej Jirman > > > > --- > > > > drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 47 +++++++++++++++++++++ > > > > 1 file changed, 47 insertions(+) > > > > > > > > diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c > > > > index ab55d7132550..f47de94ad576 100644 > > > > --- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c > > > > +++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c > > > > @@ -354,6 +354,43 @@ static void rockchip_drm_match_remove(struct device *dev) > > > > device_link_del(link); > > > > } > > > > +/* > > > > + * Check if ISP block linked to a mipi-dsi device via phys phandle is > > > > + * enabled in device tree. > > > > + */ > > > > +static bool rockchip_drm_is_mipi1_and_used_by_isp(struct device *dev) > > > > +{ > > > > + struct device_node *np = NULL, *phy_np; > > > > + > > > > + if (!of_device_is_compatible(dev->of_node, "rockchip,rk3399-mipi-dsi")) > > > > + return false; > > > > + > > > > + while (true) { > > > > + np = of_find_compatible_node(np, NULL, "rockchip,rk3399-cif-isp"); > > > > + if (!np) > > > > + break; > > > > + > > > > + if (!of_device_is_available(np)) { > > > > + of_node_put(np); > > > > + continue; > > > > + } > > > > + > > > > + phy_np = of_parse_phandle(np, "phys", 0); > > > > + if (!phy_np) { > > > > + of_node_put(np); > > > > + continue; > > > > + } > > > > + > > > > + of_node_put(phy_np); > > > > + of_node_put(np); > > > > + > > > > + if (phy_np == dev->of_node) > > > > + return true; > > > > + } > > > > + > > > > + return false; > > > > +} > > > > + > > > > static struct component_match *rockchip_drm_match_add(struct device *dev) > > > > { > > > > struct component_match *match = NULL; > > > > @@ -371,6 +408,16 @@ static struct component_match *rockchip_drm_match_add(struct device *dev) > > > > if (!d) > > > > break; > > > > + /* > > > > + * If mipi1 is connected to ISP, we don't want to wait for mipi1 component, > > > > + * because it will not be used by DRM anyway, to not tie success of camera > > > > + * driver probe to display pipeline initialization. > > > > + */ > > > > + if (rockchip_drm_is_mipi1_and_used_by_isp(d)) { > > > > + dev_info(d, "used by ISP1, skipping from DRM\n"); > > > > + continue; > > > > + } > > > > + > > > > device_link_add(dev, d, DL_FLAG_STATELESS); > > > > component_match_add(dev, &match, component_compare_dev, d); > > > > } while (true);