Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp393606rdb; Fri, 17 Nov 2023 01:41:15 -0800 (PST) X-Google-Smtp-Source: AGHT+IFnag3RETcOwMRSVyBfscDzYpvVLpBELCqvFrqP9xUYkCim25NLnEStP1VIhZfh/X3JC+2f X-Received: by 2002:a05:6358:6f90:b0:16b:c414:ae2 with SMTP id s16-20020a0563586f9000b0016bc4140ae2mr16460923rwn.8.1700214075193; Fri, 17 Nov 2023 01:41:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700214075; cv=none; d=google.com; s=arc-20160816; b=jH9qpoMidxqButrhBiI6GURTRZJhyuRgU8t0Hr62+QPRSEELMu8fgbl+fXetS+kNgk 4E/4shFIsdVyszurFjnhYskjpzYRJK6SHtz3i3/yPUoQ3BjNKxjomS0abvvq0PKDzxNU VE4tnuXrXF4jutsYyxBpw2n+881ljWSXmqB8NzbgstCStjDWt/erOR468DgEbYN/qs+3 GT2dvmiAaUTWAkJCtin3KfjAZeo+9eU97PoIn7asmFoJMF+ZZVsAkYvC6imEZY62fuOd LVPW3wM/KvbmpXQ5TviwHcH1jlKnbSgeTIu0ulbXjYk7kJgir8XF1ntDndLS+qVIjh5z PcNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=9x2WmCGZWkwDqUH5xu3haiy76+v13xkl78shtuc7Ghk=; fh=rqnKIXeg1xV0lZyDAgwm51UP4haVZcw2iJchFsPOU4I=; b=phG+a0hBEpuJb8SxWbiSQC1cbnHaeqRjDMt/fPe31DhOFJEB3jcdNhjwLO+nhytLxX PEdXTnWqFbaSl4jqUd5ZkASp5inC0Va2oeBWghpuivSN7rXoTDgyuSqXon8MCauDNqzz 9V2N8MbA8cUOVllnchp7DUbtq53TGo+e0xyHgI0oZdyNTfVF9lWexBLvos7+174cquFg M+BCsW/h+3rKIOQog6jTKk7SZTcf/Wa8VC3q72eAobLZvi/fXwy694e6DN3N3DNZF2HD Jgs+PFvdV3OWCL7MrVg8MC0uFt38QgzxNSY+Zkegf8Ytk1ex4pOJ+TYzxzYKg7UOcUOM GVyQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id by39-20020a056a0205a700b005bd2713d3a1si1725194pgb.650.2023.11.17.01.41.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Nov 2023 01:41:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id A3AAD806AFC3; Fri, 17 Nov 2023 01:41:10 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345734AbjKQJkE (ORCPT + 99 others); Fri, 17 Nov 2023 04:40:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52508 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235718AbjKQJj4 (ORCPT ); Fri, 17 Nov 2023 04:39:56 -0500 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [IPv6:2a0a:edc0:2:b01:1d::104]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53395D7A for ; Fri, 17 Nov 2023 01:39:53 -0800 (PST) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1r3vKD-0004VP-Ol; Fri, 17 Nov 2023 10:39:45 +0100 Received: from [2a0a:edc0:2:b01:1d::c0] (helo=ptx.whiteo.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1r3vK8-009eBl-Hj; Fri, 17 Nov 2023 10:39:40 +0100 Received: from sha by ptx.whiteo.stw.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1r3vK8-002UUH-EB; Fri, 17 Nov 2023 10:39:40 +0100 Date: Fri, 17 Nov 2023 10:39:40 +0100 From: Sascha Hauer To: Andy Yan Cc: Sebastian Reichel , Andy Yan , heiko@sntech.de, hjc@rock-chips.com, dri-devel@lists.freedesktop.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, krzysztof.kozlowski+dt@linaro.org, robh+dt@kernel.org, devicetree@vger.kernel.org, kever.yang@rock-chips.com, chris.obbard@collabora.com Subject: Re: [PATCH 09/11] drm/rockchip: vop2: Add support for rk3588 Message-ID: <20231117093940.GJ3359458@pengutronix.de> References: <20231114112534.1770731-1-andyshrk@163.com> <20231114112855.1771372-1-andyshrk@163.com> <20231115090823.GY3359458@pengutronix.de> <8f2ebc81-51c5-44d5-b27b-633a6cc85d0d@rock-chips.com> <20231116134757.zu7axb6cvriqjm6y@mercury.elektranox.org> <3e011d52-017e-4360-86b4-781535ef61ad@rock-chips.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3e011d52-017e-4360-86b4-781535ef61ad@rock-chips.com> X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-Accept-Language: de,en X-Accept-Content-Type: text/plain User-Agent: Mutt/1.10.1 (2018-07-13) X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: sha@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Fri, 17 Nov 2023 01:41:10 -0800 (PST) On Fri, Nov 17, 2023 at 03:06:35PM +0800, Andy Yan wrote: > Hi Sebastian: > > On 11/16/23 21:47, Sebastian Reichel wrote: > > Hi, > > > > On Thu, Nov 16, 2023 at 06:39:40PM +0800, Andy Yan wrote: > > > > > vop2->sys_grf = syscon_regmap_lookup_by_phandle(dev->of_node, "rockchip,grf"); > > > > This already lacks an error check, shame on me... > > > > > > > > > + vop2->vop_grf = syscon_regmap_lookup_by_phandle(dev->of_node, "rockchip,vop-grf"); > > > > > + vop2->vo1_grf = syscon_regmap_lookup_by_phandle(dev->of_node, "rockchip,vo1-grf"); > > > > > + vop2->sys_pmu = syscon_regmap_lookup_by_phandle(dev->of_node, "rockchip,pmu"); > > > > ... but please don't duplicate that. > > > It a little difficult to find a proper way to do the check, as not every soc need all these phandles. > > > > > > Do i need check it per soc? > > I suggest adding a u32 flags to struct vop2_data and then have > > something like this: > > > > if (vop2_data->flags & VOP2_HAS_VOP_GRF) { > > vop2->vop_grf = syscon_regmap_lookup_by_phandle(dev->of_node, "rockchip,vop-grf"); > > if (IS_ERR(vop2->vop_grf)) > > return dev_err_probe(dev, PTR_ERR(vop2->vop_grf) "cannot get vop-grf"); > > } > > > > if (vop2_data->flags & VOP2_HAS_VO1_GRF) { > > vop2->vo1_grf = syscon_regmap_lookup_by_phandle(dev->of_node, "rockchip,vo1-grf"); > > if (IS_ERR(vop2->vo1_grf)) > > return dev_err_probe(dev, PTR_ERR(vop2->vo1_grf) "cannot get vo1-grf"); > > } > > > > ... > > > I can do it like this if Sascha is also happy with it. Yes, I am. Sascha -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |