Received: by 2002:a05:7412:b101:b0:e2:908c:2ebd with SMTP id az1csp3113584rdb; Wed, 15 Nov 2023 23:50:48 -0800 (PST) X-Google-Smtp-Source: AGHT+IHi09EVY+Qlc4wHzmsR0cMrpRiC9uWCMz2SspKhV1VhOEdTLpJuGGmKQPnCMZXgBTkorz/2 X-Received: by 2002:a05:6a20:12cd:b0:187:cd37:c463 with SMTP id v13-20020a056a2012cd00b00187cd37c463mr461577pzg.7.1700121048700; Wed, 15 Nov 2023 23:50:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700121048; cv=none; d=google.com; s=arc-20160816; b=WIr/iJRglx052KIlV/F06tRTsvpqkqYDyp7MwacYI/BPZ7gh3fXafZcqsmSufn5gM4 5LcXOTtUPxG8EAuTqvo+pHW1WRjVw38DZ9siqgwIRL4eVGRRWcYbQIVX2ueSK5dird0g +/ZsWAljYNNshLo2xRsJK66RoViSxpuBIIIiGhipNENdL2WI9pGMsNBPbu41HUdVI0Jy TysSP0xtWX0K8Ynl4jFHiYqUKCg0swisI9BbgMGvt833lzJJsE3oyykIcTsY6FEzUbKv QccBuM+0GTghSVm/xKLTR/cpxk4jL+tazFmQfV40TUvQf9ZgLINpdQ8XOxJwJW4UI81f Zv8Q== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=ngD2JqmiREiU1flDrtznPucIDaxxd6LUI8kiBKR5/bE=; fh=XQFg0SWwAuqFJ1ucPzyzcHdnkajPg2WZzF19M+/Btxg=; b=PoDE/Fx8nYOPzFf+k+vAzX8Md5crg6fK4CnEXLf8JLfZGmUfYbN7ghkCqWoDJNq6uH rwpUPsfP3xqLnDsH9ixDqEdgfWyQOh6fS3xvl1N7ruqAOdKDZnL3n6vbAH0MOKaoDeta B4ejfjqlwHLAnwBI1ZQxwqQLOzvf2nk9ok0MfYBBsIzHr5FY5gXW/cHxLjep3EjNWBpa WsfF6Lre3JxT9GDuQBIyaz1txQsiePS2lv+lvbVtgSzxx7jngLM8as9cAyX0L2gniCRW P3CvX6Vqo/Bcwni6xE/yiIpvweLWh//2bHpZ5c3RxNfZIzGXl8hUylyqWQPX5IGlPePl Mg7w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id fj26-20020a056a003a1a00b0068fe0f46f27si11968263pfb.171.2023.11.15.23.50.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Nov 2023 23:50:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 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 fry.vger.email (Postfix) with ESMTP id CB7A38116783; Wed, 15 Nov 2023 23:50:45 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344012AbjKPHud (ORCPT + 99 others); Thu, 16 Nov 2023 02:50:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48756 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229638AbjKPHuc (ORCPT ); Thu, 16 Nov 2023 02:50:32 -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 26721120 for ; Wed, 15 Nov 2023 23:50:29 -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 1r3X8l-0007e8-Pq; Thu, 16 Nov 2023 08:50:19 +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 1r3X8h-009P0C-AH; Thu, 16 Nov 2023 08:50:15 +0100 Received: from sha by ptx.whiteo.stw.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1r3X8h-002J9d-7Q; Thu, 16 Nov 2023 08:50:15 +0100 Date: Thu, 16 Nov 2023 08:50:15 +0100 From: Sascha Hauer To: Andy Yan Cc: 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, sebastian.reichel@collabora.com, kever.yang@rock-chips.com, chris.obbard@collabora.com Subject: Re: [PATCH 09/11] drm/rockchip: vop2: Add support for rk3588 Message-ID: <20231116075015.GG3359458@pengutronix.de> References: <20231114112534.1770731-1-andyshrk@163.com> <20231114112855.1771372-1-andyshrk@163.com> <20231115090823.GY3359458@pengutronix.de> <229557d7-beec-44e0-9ee6-4a962b33ec79@rock-chips.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <229557d7-beec-44e0-9ee6-4a962b33ec79@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, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.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 (fry.vger.email [0.0.0.0]); Wed, 15 Nov 2023 23:50:46 -0800 (PST) On Thu, Nov 16, 2023 at 03:24:54PM +0800, Andy Yan wrote: > > case ROCKCHIP_VOP2_EP_HDMI0: > > case ROCKCHIP_VOP2_EP_HDMI1: > > ... > > } > > > > would look a bit better overall. > > > > > + /* > > > + * K = 2: dclk_core = if_pixclk_rate > if_dclk_rate > > > + * K = 1: dclk_core = hdmie_edp_dclk > if_pixclk_rate > > > + */ > > > + if (output_mode == ROCKCHIP_OUT_MODE_YUV420) { > > > + dclk_rate = dclk_rate >> 1; > > > + K = 2; > > > + } > > > + > > > + if_pixclk_rate = (dclk_core_rate << 1) / K; > > > + if_dclk_rate = dclk_core_rate / K; > > > + > > > + *if_pixclk_div = dclk_rate / if_pixclk_rate; > > > + *if_dclk_div = dclk_rate / if_dclk_rate; > > Not sure if this will change with future extensions, but currently > > *if_pixclk_div will always be 2 and *if_dclk_div will alway be 4, > > so maybe better write it like this > > > Yes, the calculation of *if_pixclk_div is always 2 and *if_dclk_div is always 4, > > I think calculation formula can give us a clear explanation why is 2 or 4. > > considering the great power of rk3588, i think it can calculate it very easy. Sure it can. My concern is not the CPU time it takes to do that equation, but more the readability of the code. For me as a reader it might be more easily acceptable that both dividers have fixed values than it is to understand the equation. Your mileage may vary, I won't insist on this. > > > > > > > > + *dclk_core_div = dclk_rate / dclk_core_rate; > > *dclk_core_div is calculated the same way for all cases. You could pull > > this out of the if/else. > Okay, will do. > > > > > + } else if (vop2_output_if_is_edp(id)) { > > > + /* edp_pixclk = edp_dclk > dclk_core */ > > > + if_pixclk_rate = v_pixclk / K; > > > + if_dclk_rate = v_pixclk / K; > > if_dclk_rate is unused here. > > > It will be removed in next version. > > > > > > + dclk_rate = if_pixclk_rate * K; > > > + *dclk_core_div = dclk_rate / dclk_core_rate; > > > + *if_pixclk_div = dclk_rate / if_pixclk_rate; > > > + *if_dclk_div = *if_pixclk_div; > > Both *if_pixclk_div and *if_dclk_div will always be 1. > > Actually,? they will be the value of K here,? if it work at split mode(two > > edp connect to one VP, one show the image for left half, one for right half, > > a function like a dual channel mipi dsi). > > I know it split mode is not supported by the current mainline, but i think keep Ok. 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 |