Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp603382pxb; Thu, 15 Apr 2021 02:04:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz3Bc6DVYM8gBB4P7EM0IUfVEDQljUjtLHw84DNMORiNs0tmkaBlPSBAC7yCG6+kn1srysj X-Received: by 2002:a17:907:b1b:: with SMTP id h27mr2348886ejl.421.1618477479539; Thu, 15 Apr 2021 02:04:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618477479; cv=none; d=google.com; s=arc-20160816; b=K63x+sUon77cSGbFlasaDRyYbINB82sX5CPbwDQcbrYsvp66csVfOuOfCJnVBN6bLL 3On+E3oXbTQ0+5Anc5EqePQbFmmYx7gm9/k2DODd6Zylgl5m3M5k5Idp1nsEb/x1W1OQ d7+wQCTMJA9TioSGlQZ/Orhaeapm8Pt7K+oR7RQkB93m/9yGNgPKrSOEj/ICcHg+Oz3G umR9yAAAD5Ut5N2cIMJlJEaSMk5ehPNX+xJ79F05WZNeWHdfnrveIccnN8SzfPc/omXB KGfGdeoo+9mqndGtxgbhrQonZ0ER1x568oQW+y+Nv2W7SYND+lsoVkMPknSENh1+NcT6 UkeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :dkim-signature; bh=Ix39sTXIdzBPeQc6zVxgol87V62s6qIp0rqVdblLghI=; b=VxM2+B88XJ8vnntGHoPwhImsV87/i3kmaRclBQBYVZuK4HKQj5p8Ji+88NKuuTMven 8anWvpBNrtcSHGUGBwtNwy4LPrR3aOSLEgULSMgoJX/kFT+gmrPPz0pKhgTjPBDwjfxR UgCkOHrxHDJrNt3kYVhy8TFD+1sTfGk65KwM+bm/BP/+tDqsJoyxvMLh24JGU086eCY6 1Tk4/zFPnmS+E8R3JJFnQ/OPBFOVg0tyEOC1VGXbGwayQDQ9GzZx3X54TeoalxCbW+U+ JJjqmtV17TI47jSULhBMJQ5nLPMPHzKthZeSFQSGtDEj7AQYNGCrb/l78rt+F/7QppYG 4SAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cerno.tech header.s=fm2 header.b=ZjPdlSAM; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=IkH8qVy+; 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=cerno.tech Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n1si1788381eja.710.2021.04.15.02.04.15; Thu, 15 Apr 2021 02:04:39 -0700 (PDT) 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=@cerno.tech header.s=fm2 header.b=ZjPdlSAM; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=IkH8qVy+; 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=cerno.tech Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231749AbhDOJDk (ORCPT + 99 others); Thu, 15 Apr 2021 05:03:40 -0400 Received: from new1-smtp.messagingengine.com ([66.111.4.221]:49977 "EHLO new1-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231326AbhDOJDj (ORCPT ); Thu, 15 Apr 2021 05:03:39 -0400 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailnew.nyi.internal (Postfix) with ESMTP id 3FBE5580731; Thu, 15 Apr 2021 05:03:16 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Thu, 15 Apr 2021 05:03:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm2; bh=Ix39sTXIdzBPeQc6zVxgol87V62 s6qIp0rqVdblLghI=; b=ZjPdlSAMvhzGHZTqukqSHIySHquqmpAGd57SVplw3wx wtEnql7pT00+S8MigfilGegogxQhaxz3+W32v5osInHdI1gMlCT2yNuNGvNGh5Xv exjimUBqqSrKHr8smU6GGYztrIc5pT4tXEpTrlZ2+w5jeh4X+vDdq/j+TllG17vJ 0RSM6VcDq8x0z2o5rhRXrB7jMAC6CE2RylXNQS0LO2l4Aohc/QoMOSpXtup3hpOl fxdZlG2qt6HgiSX2Ne4og9U1ZeRsAd05EJQvA8tlfn8sSRhA2CovxiJJeKfxDF7a jX+76iWHIMfo+5L7CRwfM1fVK5FPLUGmbhS6Sftlgpg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=Ix39sT XIdzBPeQc6zVxgol87V62s6qIp0rqVdblLghI=; b=IkH8qVy+9k6U2N+2SlYNiB JzRs+9uU7j1Jy+b0KSy64uO3kG7cfMMqTAkRACUL0aerc/d7WtshYhyNm64E30Bj F17O0okCm+GLsYcorEVbKHyfU0tbLiwOXv0Yrpcdufgr+OuOdy9qf0rjy4g0EgbR ke6eIsnBaDvBT4QL50NO8aSume8OTm7CAT3zrKhzDH6T+UXhVYewnqfShTtKdDXs GuELPLaJ5rA7Fmb3bowZrA1+wxx3EV75zUDMCCYHSyy6TQpVMGqBu6BHjjo/cy+o VS1RdD/o4eq2UJomFkJDZm/K2Z16GB0IsHHity7tUIB2Maaa48mr2AScoxG7JqPQ == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrudelfedgudduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfhfgggtuggjsehgtderredttdejnecuhfhrohhmpeforgigihhm vgcutfhiphgrrhguuceomhgrgihimhgvsegtvghrnhhordhtvggthheqnecuggftrfgrth htvghrnhepuedtgfejueduheevgfevvdettdduleffgfffkeeltdffkeegudekjeeuveei gedunecukfhppeeltddrkeelrdeikedrjeeinecuvehluhhsthgvrhfuihiivgeptdenuc frrghrrghmpehmrghilhhfrhhomhepmhgrgihimhgvsegtvghrnhhordhtvggthh X-ME-Proxy: Received: from localhost (lfbn-tou-1-1502-76.w90-89.abo.wanadoo.fr [90.89.68.76]) by mail.messagingengine.com (Postfix) with ESMTPA id CA03F1080069; Thu, 15 Apr 2021 05:03:14 -0400 (EDT) Date: Thu, 15 Apr 2021 11:03:12 +0200 From: Maxime Ripard To: Kevin Tang Cc: Maarten Lankhorst , Sean Paul , David Airlie , Daniel Vetter , Rob Herring , Mark Rutland , Orson Zhai , Chunyan Zhang , "Linux-Kernel@Vger. Kernel. Org" , ML dri-devel , devicetree@vger.kernel.org Subject: Re: [PATCH v4 4/6] drm/sprd: add Unisoc's drm display controller driver Message-ID: <20210415090312.md6exuuv2y4mblxn@gilmour> References: <20210222132822.7830-1-kevin3.tang@gmail.com> <20210222132822.7830-5-kevin3.tang@gmail.com> <20210324111019.og6d3w47swjim2mq@gilmour> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="ypmvmwrpdbpuk4rg" Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --ypmvmwrpdbpuk4rg Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi, On Thu, Apr 15, 2021 at 08:18:52AM +0800, Kevin Tang wrote: > Maxime Ripard =E4=BA=8E2021=E5=B9=B43=E6=9C=8824=E6= =97=A5=E5=91=A8=E4=B8=89 =E4=B8=8B=E5=8D=887:10=E5=86=99=E9=81=93=EF=BC=9A > > > +static struct sprd_dpu *sprd_crtc_init(struct drm_device *drm, > > > + struct drm_plane *primary) > > > +{ > > > + struct device_node *port; > > > + struct sprd_dpu *dpu; > > > + > > > + /* > > > + * set crtc port so that drm_of_find_possible_crtcs call works > > > + */ > > > + port =3D of_parse_phandle(drm->dev->of_node, "ports", 0); > > > + if (!port) { > > > + drm_err(drm, "find 'ports' phandle of %s failed\n", > > > + drm->dev->of_node->full_name); > > > + return ERR_PTR(-EINVAL); > > > + } > > > + of_node_put(port); > > > > The YAML binding should already make sure that your binding is sane, and > > if you still get a DT that doesn't follow it, you have a whole lot of > > other issues than whether ports is there :) > > > > > + dpu =3D drmm_crtc_alloc_with_planes(drm, struct sprd_dpu, base, > > > + primary, NULL, > > > + &sprd_crtc_funcs, NULL); > > > + if (IS_ERR(dpu)) { > > > + drm_err(drm, "failed to init crtc.\n"); > > > + return dpu; > > > + } > > > + > > > + dpu->base.port =3D port; > > > > But you're still referencing it here, while you called of_node_put on it > > already? You should only call it once you're done with it. >=20 > of_node_put should be called after done with it, this maybe indeed be a = bug. > i will fix it. > > > > > > I'm not really sure why you would need drm_of_find_possible_crtcs to > > work then if you don't follow the OF-Graph bindings. >=20 > it scan all endports of encoder, if a matching crtc is found by > OF-Graph bindings > and then genarate the crtc mask, here is description: > 41 /** > 42 * drm_of_find_possible_crtcs - find the possible CRTCs for an encode= r port > 43 * @dev: DRM device > 44 * @port: encoder port to scan for endpoints > 45 * > 46 * Scan all endpoints attached to a port, locate their attached CRTCs, > 47 * and generate the DRM mask of CRTCs which may be attached to this > 48 * encoder. > 49 * > if we don't follow the OF-Graph bindings, crtc can't attched to encoder. Yeah, what I'm actually confused about is why you would need the of_parse_phandle call. You usually call drm_of_find_possible_crtcs with the encoder device node, so from your MIPI-DSI driver in your case, and with it's device->of_node pointer and it should work perfectly fine? Maxime --ypmvmwrpdbpuk4rg Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRcEzekXsqa64kGDp7j7w1vZxhRxQUCYHgBUAAKCRDj7w1vZxhR xVRAAQDaqBTh/injDtSwQK3iV7Z5wvP7T2ktGwk9WYZ2ZfAq9gEAwhppNac9aGVm la/J2jdy4d1ngYkDjjhlgrRCDASW+gU= =Rre6 -----END PGP SIGNATURE----- --ypmvmwrpdbpuk4rg--