Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp689378rdb; Sun, 18 Feb 2024 07:17:37 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCX7taLAT/tCCiEaWBlzb4vQkdncBV7JcwhrD6eaw+M3CcdFfjEPCYHMiWqblqxuWIU7/bcEnLS1AcDaOi+xekwGusULKiUg8yfew2h+Sg== X-Google-Smtp-Source: AGHT+IGMHOqQBmeQiSnhzq4RQYERv36GwOeb8TbaZsE6BC3YzfNm7tB68AaXb4i7uirBLyPfg99v X-Received: by 2002:a05:6358:769a:b0:17a:e40f:9deb with SMTP id e26-20020a056358769a00b0017ae40f9debmr11364386rwg.9.1708269456827; Sun, 18 Feb 2024 07:17:36 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708269456; cv=pass; d=google.com; s=arc-20160816; b=vuCliHlCXQIlFXsAts0nsKJUWGuuYxCKG6Dm5DyAQJ9ad/7fHeevUCV9OOfZPlQcB5 FafXFtRMsNh6ERJvfCsh3hph6OOmqsDCU3YaJVgo9RUmXcPhL42DXBlRBD5bK9QQDRJJ dIPTxpucsvxVkL/7VhkaNFx7yETfneDAg6K2xVfU2+yRkTzvvAp5GVLZY+g4n+pytVtd 99YjS6HsnabKPYuDQdNkP8FEmEi7A5nLE5LIirgUWe3tSj1O6f7pzZCS/G5dkFleY+Sk doknLvzBvsfW0+eQ3JlKRAG5qDROtW1/asYvDlExxjceBHW/Xf1G5Lt+7onSW7O0ahg/ I3Ug== 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=/mAjNRlHFoDxud+AZ39eSxOGPQhN0UNKi5AoblBtca4=; fh=/cSE9pVfKDn7SzmEH1z8XCS1PgzfPt/EVBV390yYcow=; b=iw2NuyzETIqGYPtNY9v8ZMfz5L10tOG6tyE1y1MrlljtkoJF3vEeYYNoUWwKT73s+/ pLmTi3IPh5RUENitg2cAj2Dc1QPl5DkOFII8UtDQOrU7LH6zxsl/R2WPRkUE7rGyo4cM Q+ePoGttS+fZIOvQdWAP3DMyxBbM8S0r9EGG1OBiysSCBkTKH55fQPfD0F4TCfU4jk9O Dgp3CDhISA+loik6k+RGRu2d2RqWdQ6Gz6jnIeFuBGDm2+U1NxnI4WPCFeHO6a3wqMsB C9RDDHkV9rQ/3QlVY8aEYxzD2m7RzGVb76S7XcODQSVyiN/4sHbsvDKhTC4+3/mjCSND /1hA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@xff.cz header.s=mail header.b=betw1GS2; 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-70426-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70426-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=xff.cz Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id fu36-20020a05622a5da400b0042dc23ea45dsi4007413qtb.645.2024.02.18.07.17.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Feb 2024 07:17:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-70426-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@xff.cz header.s=mail header.b=betw1GS2; 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-70426-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70426-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 856E81C20935 for ; Sun, 18 Feb 2024 15:17:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 645196BFD8; Sun, 18 Feb 2024 15:17:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=xff.cz header.i=@xff.cz header.b="betw1GS2" 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 2CC611E535 for ; Sun, 18 Feb 2024 15:17:24 +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=1708269448; cv=none; b=CBe95rlzXGJOxk5hwn1GIgqy4AhrZPFmUvuRrRSoZkO3I+hKjR5ug4Kp8t954OgbyO0GMNWSCn4J0TsuHIV4ohLWZEdM9fxjPsMATl+TfcVTuX4/aMImhWVgQ68knC9Fg2npFEDe9m231GKxQ4Mch7++60V6MbwDlEYt8i5D4uc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708269448; c=relaxed/simple; bh=vgYyrkfy4NvMffwZnA9GbIjwpDwWVz0QVFbKOYEwfJQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=a2NGSEeDzzac9MpRoWYNiUPrSdUFGYZ66uPokos4bpvSD37hJFojlM+Uh2W+fy6JmZmcHzLMsNoW6NeONO/EnY+lk/sgneQ2yMQ+8ogKlMPiZ2mOmPrAHRs8VtfeQGM9iOp5FL5J747NrvqbtCEYOpGs4UTrOdxE4qP11z06qFw= 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=betw1GS2; 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=1708269442; bh=vgYyrkfy4NvMffwZnA9GbIjwpDwWVz0QVFbKOYEwfJQ=; h=Date:From:To:Cc:Subject:X-My-GPG-KeyId:References:From; b=betw1GS2RwS4OjostOe9MAyGZAzRsiDV36jcyw9WQ9jAB+MQ+pbGdaHEsM1Irngqh uzGfdq/2mOTdrV9ZRyr5tGZyEWVR5dvQAJzZ6q+1hEqP+RbIfet/pSkFiiTn3cwCLk p7GFEg35DB2UFv/USy8i6Y0HfbeLIg/DKhNUM5iI= Date: Sun, 18 Feb 2024 16:17:22 +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: 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> 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: <4c66c084-5af6-43fb-a256-4746b2e00192@rock-chips.com> 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. 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);