Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp598624rdb; Sun, 18 Feb 2024 03:16:08 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCX3IIn+KOR1ad2ExIl4Xku7nl2sdp911A+cP26W5Pq5DzLldS+6D35H2t7TB25NLfZ0gHdaiodclaJ7NbR9IeTcCKuiP0Ua7BHdmJ8lBw== X-Google-Smtp-Source: AGHT+IEDtd27t2GBe1tcTIchN0bGMMViEezTN8SgDlja7NHiwHaIcAM3x4E5rdZapMZBcVVCAQAd X-Received: by 2002:a17:902:ea0d:b0:1db:e7a4:90a8 with SMTP id s13-20020a170902ea0d00b001dbe7a490a8mr707490plg.10.1708254968254; Sun, 18 Feb 2024 03:16:08 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708254968; cv=pass; d=google.com; s=arc-20160816; b=OSenfvPBhZkqa58rfuTJdS+pX+AfXZpA11W26EKvg8jVqlsp/EN+9MUdO0GW00PBFT o7OCt2wozrQ1l/dB4mTctucZwJ6t6TpSYI1txsMH1rbvpaLVyzU0IFlFkX61LYoCrlvO pyFY00bTqaQnR5Cx9QCiuf+GmkDOPaZdiHXx+bpuJKFvCERya7WvwrTEcfSoqMYNEG3W pFqeXrWFB6KVkVWhPuEJnpHAM/DbNK++1VhQsExDYFv7Ou4zCCyu2JIdsFAJlJUeJgvK PUJXMDA3KVG0xt0zd196jxLwz5AKINz1dkM8qd1eSJlsBsjYqOU/l1jETyHepWg/atxx XVdA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=z/dQY2HoW+YQ89aYc9H+gh/iwK6p8BunDVlsiz6zZYc=; fh=WFTh/kHoYZM/pqRzPW6gGHQeJtXVqsHSzkvlScVFDU4=; b=uiPEjyMcVeYtB7YBheIs39+Tu3qT+LyStJH44BQ+CaUi0w6CDk/M1tWhnuV47HJETe Nv8S8xcOBlCNhAT3H1/d9PxSf9d0D9IJOh1M7WQ70ZtMa+K58IsUrPU3j4sqiczhqqoh R6ZjHaKc5n9A/ss6SCQeb2cM4haqMdQ/rr6lSkX4eg+EA5UTYtR6t9hNZ/Do6pMf9hLf 4JQ6yNmXhodtOFTu0+62Lno74gBWGbM6zsNGiP+pzOyhPdJcDwbkUnbwal3xAdSSalx2 HbSn9nNSU4DNmqnIXpAFMbGSFLQL5hXujw8nzrejPYL6fD2UK1fxA1GsFNb+JmnzA28r FWmw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@rock-chips.com header.s=default header.b=AAa0zM2E; arc=pass (i=1 spf=pass spfdomain=rock-chips.com dkim=pass dkdomain=rock-chips.com dmarc=pass fromdomain=rock-chips.com); spf=pass (google.com: domain of linux-kernel+bounces-70364-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70364-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=rock-chips.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id u15-20020a170903124f00b001d5f0ef1c8dsi2793111plh.167.2024.02.18.03.16.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Feb 2024 03:16:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-70364-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@rock-chips.com header.s=default header.b=AAa0zM2E; arc=pass (i=1 spf=pass spfdomain=rock-chips.com dkim=pass dkdomain=rock-chips.com dmarc=pass fromdomain=rock-chips.com); spf=pass (google.com: domain of linux-kernel+bounces-70364-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70364-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=rock-chips.com 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 F302E282AB3 for ; Sun, 18 Feb 2024 11:16:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 73A5A5BAE4; Sun, 18 Feb 2024 11:16:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=rock-chips.com header.i=@rock-chips.com header.b="AAa0zM2E" Received: from mail-m12828.netease.com (mail-m12828.netease.com [103.209.128.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AB5345BAC7 for ; Sun, 18 Feb 2024 11:15:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.209.128.28 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708254962; cv=none; b=cI1rKYyt56kCnVE8rVI8YfCBT4k1+qlJ62X42+FQoDgL+ZAH4q7szS4w0huZsJd4NaI26wGbEd9GYk6qTLU/RsF+23VTlqFte1pXjMRG4t+nKT8CgRBdJ1pBf9nfau9CyxxILgD6AsjXHvGPN5N8xFL1C0rmvvLm1KgYFH9ejv0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708254962; c=relaxed/simple; bh=enJw2hJHeVjwULo0CtS0Nea0QT2Oyo4LKVNd88e4C50=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=W3F6IXhA0V7HPWbR0mP9FDhQ5JGuIDt0aFG9Lc51ytduTOhdM2McgeF8cUS2xNqxrfPmfNdAi+ISJscWwnvQ6YqWBfsqXWxEG1bUH1Kdv5JGuqIoG9SMtNn5jykUwrXR3Qflq+nerhlncKIK1OcUsFxMTsLKCffRRHq+MRpp6XU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=rock-chips.com; spf=pass smtp.mailfrom=rock-chips.com; dkim=pass (1024-bit key) header.d=rock-chips.com header.i=@rock-chips.com header.b=AAa0zM2E; arc=none smtp.client-ip=103.209.128.28 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=rock-chips.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rock-chips.com DKIM-Signature: a=rsa-sha256; b=AAa0zM2E+Q12+GcmuIFv1U7goDU0DJKrvIT/J3L5khHV86ESFhoQJ+kNQZR+FX6N4AuyM0Mah3+XdQWYwe4YpfrkXIkDw4Zvv1ZPS9vZx/xurswQ+lIplIZwnB7GIDwYfYx5WGSL1QtX+PCB2h1akWZd5Cly6IX/L1rqef6XDEw=; c=relaxed/relaxed; s=default; d=rock-chips.com; v=1; bh=z/dQY2HoW+YQ89aYc9H+gh/iwK6p8BunDVlsiz6zZYc=; h=date:mime-version:subject:message-id:from; Received: from [172.16.12.141] (unknown [58.22.7.114]) by smtp.qiye.163.com (Hmail) with ESMTPA id 920A584021C; Sun, 18 Feb 2024 19:14:56 +0800 (CST) Message-ID: <4c66c084-5af6-43fb-a256-4746b2e00192@rock-chips.com> Date: Sun, 18 Feb 2024 19:14:56 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] drm: rockchip: Don't require MIPI DSI device when it's used for ISP Content-Language: en-US To: =?UTF-8?Q?Ond=C5=99ej_Jirman?= , linux-kernel@vger.kernel.org Cc: Sandy Huang , =?UTF-8?Q?Heiko_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" References: <20240217183941.1752463-1-megi@xff.cz> From: Andy Yan In-Reply-To: <20240217183941.1752463-1-megi@xff.cz> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-HM-Spam-Status: e1kfGhgUHx5ZQUpXWQgPGg8OCBgUHx5ZQUlOS1dZFg8aDwILHllBWSg2Ly tZV1koWUFDSUNOT01LS0k3V1ktWUFJV1kPCRoVCBIfWUFZGRhOGVZNTUpIGRofSk5DHx5VEwETFh oSFyQUDg9ZV1kYEgtZQVlOQ1VJSVVMVUpKT1lXWRYaDxIVHRRZQVlPS0hVSk1PSU5IVUpLS1VKQk tLWQY+ X-HM-Tid: 0a8dbbed244003a4kunm920a584021c X-HM-MType: 1 X-HM-Sender-Digest: e1kMHhlZQR0aFwgeV1kSHx4VD1lBWUc6NT46Ijo5VjMcHy4dMg4NCz80 AlEKFEJVSlVKTEtDSU5PQ0JMTkNCVTMWGhIXVRoVHwJVAhoVOwkUGBBWGBMSCwhVGBQWRVlXWRIL WUFZTkNVSUlVTFVKSk9ZV1kIAVlBT0JMTzcG 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. > 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);