From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BE90EC4167B for ; Mon, 27 Nov 2023 11:19:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=2KsgTRyntyNpB+XErspojjo3ioVfAqqEpFQgCtSacD0=; b=Pi43KQiKrKNxG0 dyyuDnJP1AV2e9iXCN3GcEUA/jkssRXd5s2B7ph6W9q9WzS2NOCgdN+ecFlbxNjWHioAJq1Nb+SDl tsm+1LVcvll0VyzRpdYM8qzd+WdjlzKnGRQdH/EuFe/Xk9eSHkqyf1W0QR6Fy7vWQPchFALZDYEgg Fjr+5mCK8/sPE6Ijgj7NnI91BdklqHaaBVtf58o6HEo3dZNzoXoKMDUTKi6Iq7xMUkNxZ1F1E43CO D4fY6igWd+SyLFH7h9cw4v1kN1Uzu89lGNIfZKCPw6TmXbcGWF8qMq345KoNhpqXf1XGJ7GE/oI4R JluGXR3z0tx6IJ958qkQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r7ZeU-002CW6-20; Mon, 27 Nov 2023 11:19:46 +0000 Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r7ZeS-002CV2-0j for linux-rockchip@lists.infradead.org; Mon, 27 Nov 2023 11:19:45 +0000 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 1r7ZeO-0000ed-Kg; Mon, 27 Nov 2023 12:19:40 +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 1r7ZeL-00BvgR-89; Mon, 27 Nov 2023 12:19:37 +0100 Received: from sha by ptx.whiteo.stw.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1r7ZeL-00459o-52; Mon, 27 Nov 2023 12:19:37 +0100 Date: Mon, 27 Nov 2023 12:19:37 +0100 From: Sascha Hauer To: Andy Yan Cc: 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, Andy Yan Subject: Re: [PATCH v2 10/12] drm/rockchip: vop2: Add support for rk3588 Message-ID: <20231127111937.GW3359458@pengutronix.de> References: <20231122125316.3454268-1-andyshrk@163.com> <20231122125544.3454918-1-andyshrk@163.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20231122125544.3454918-1-andyshrk@163.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-rockchip@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231127_031944_265836_31C44D37 X-CRM114-Status: GOOD ( 18.13 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org Hi Andy, Looks good overall, two small things inside. On Wed, Nov 22, 2023 at 08:55:44PM +0800, Andy Yan wrote: > > +#define vop2_output_if_is_hdmi(x) (x == ROCKCHIP_VOP2_EP_HDMI0 || x == ROCKCHIP_VOP2_EP_HDMI1) > +#define vop2_output_if_is_dp(x) (x == ROCKCHIP_VOP2_EP_DP0 || x == ROCKCHIP_VOP2_EP_DP1) > +#define vop2_output_if_is_edp(x) (x == ROCKCHIP_VOP2_EP_EDP0 || x == ROCKCHIP_VOP2_EP_EDP1) > +#define vop2_output_if_is_mipi(x) (x == ROCKCHIP_VOP2_EP_MIPI0 || x == ROCKCHIP_VOP2_EP_MIPI1) > +#define vop2_output_if_is_lvds(x) (x == ROCKCHIP_VOP2_EP_LVDS0 || x == ROCKCHIP_VOP2_EP_LVDS1) > +#define vop2_output_if_is_dpi(x) (x == ROCKCHIP_VOP2_EP_RGB0) Not that it matters in practice here, but you should add braces around the x argument in the macros usage, i.e. ((x) == ROCKCHIP_VOP2_EP_RGB0) > +static unsigned long rk3588_set_intf_mux(struct vop2_video_port *vp, int id, u32 polflags) > +{ > + struct vop2 *vop2 = vp->vop2; > + int dclk_core_div, dclk_out_div, if_pixclk_div, if_dclk_div; > + unsigned long clock; > + u32 die, dip, div, vp_clk_div, val; > + > + clock = rk3588_calc_cru_cfg(vp, id, &dclk_core_div, &dclk_out_div, > + &if_pixclk_div, &if_dclk_div); > + if (!clock) > + return 0; > + > + vp_clk_div = FIELD_PREP(RK3588_VP_CLK_CTRL__DCLK_CORE_DIV, dclk_core_div); > + vp_clk_div |= FIELD_PREP(RK3588_VP_CLK_CTRL__DCLK_OUT_DIV, dclk_out_div); > + > + die = vop2_readl(vop2, RK3568_DSP_IF_EN); > + dip = vop2_readl(vop2, RK3568_DSP_IF_POL); > + div = vop2_readl(vop2, RK3568_DSP_IF_CTRL); > + > + switch (id) { > + case ROCKCHIP_VOP2_EP_HDMI0: > + div |= FIELD_PREP(RK3588_DSP_IF_EDP_HDMI0_DCLK_DIV, if_dclk_div); you should clear the bits of a mask before setting them again. The same goes for several other bits modified in this switch/case. > + div |= FIELD_PREP(RK3588_DSP_IF_EDP_HDMI0_PCLK_DIV, if_pixclk_div); > + die &= ~RK3588_SYS_DSP_INFACE_EN_EDP_HDMI0_MUX; > + die |= RK3588_SYS_DSP_INFACE_EN_HDMI0 | > + FIELD_PREP(RK3588_SYS_DSP_INFACE_EN_EDP_HDMI0_MUX, vp->id); > + val = rk3588_get_hdmi_pol(polflags); > + regmap_write(vop2->vop_grf, RK3588_GRF_VOP_CON2, HIWORD_UPDATE(1, 1, 1)); > + regmap_write(vop2->vo1_grf, RK3588_GRF_VO1_CON0, HIWORD_UPDATE(val, 6, 5)); > + break; 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 | _______________________________________________ Linux-rockchip mailing list Linux-rockchip@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-rockchip