Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp754341ybt; Wed, 8 Jul 2020 10:48:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzEBU7l/jy71x2W9lXrO6YTcn3pVx4zxWJHSiSLCdn6GpgoLvjRChutb1uN6EcPgJ5fBumd X-Received: by 2002:a05:6402:228d:: with SMTP id cw13mr68998374edb.343.1594230532584; Wed, 08 Jul 2020 10:48:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594230532; cv=none; d=google.com; s=arc-20160816; b=ZfQ7f/yKmyvuDZEvBah0sklhY48mJL176Bm5PFOvmP49n5UGeIYFYjwMINn/KDP1E1 KMCU1ZoWQT/nVg2nw6l4BdRltMgkeMWmUPUN61eJNvgwMKEXnAL4R3tfh4Wnk/E3nJGY vHneCCn3hRR94PNN6jh4pfs2GzhKV6ESDgTZYgbuF+g2n6SssqYAfEuHteF/8qT7kVdZ NmUfwuZtLjfo6HfG9xWkG49xAzc2SUHR4qWQaUwff63GTHRWm7BZbryvl7llneV0Z3h3 4szv9K2DL2HVZ9+BZ4LgLH7ffGAxSui2YhAlJ3WbR32b9iq45l7UY03OjbPqjymu3u08 ukpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=wDrRDroC8ocj8EhlxGBQct+8EUPDVlBrak0jB4BFHGo=; b=1J7jbfAdmgdA0f2NvoN6VVSu4dcANOosrg0Grm8iAC//6aXlxDPVI3R+O6znH88C8x +KUVnrdmDyarM/aeI26mbccj+RXBdWdrnsvFs3TUxfYyE0+81AI6GkgdcqJnBZX+Oxoq ZWrxfOAExKS+9CEb54K1GX3yVlwugQnm60tff1hEgBsFjt+hTk1GUChwWSRISY+QeNla l3qdO7WjVQWRYTM3FgokMZK50/hGR9tMKlv6sQ6lfk4NE9Gb0TGX99y5BsTmrf0n5dko J7toJCULo74qAdQ3x2UP7ZKBKRJPGDl7WkqFUi1EDu5CFzAsiQ8X/VIeRC6ZVgIx12ax hjYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cerno.tech header.s=fm3 header.b=rTp3MKQH; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b="F/6caJE7"; 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 y19si361036edt.374.2020.07.08.10.48.29; Wed, 08 Jul 2020 10:48:52 -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=fm3 header.b=rTp3MKQH; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b="F/6caJE7"; 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 S1727858AbgGHRp1 (ORCPT + 99 others); Wed, 8 Jul 2020 13:45:27 -0400 Received: from wnew4-smtp.messagingengine.com ([64.147.123.18]:52501 "EHLO wnew4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727847AbgGHRnu (ORCPT ); Wed, 8 Jul 2020 13:43:50 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.west.internal (Postfix) with ESMTP id 5D862102B; Wed, 8 Jul 2020 13:43:49 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Wed, 08 Jul 2020 13:43:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm3; bh=wDrRDroC8ocj8 EhlxGBQct+8EUPDVlBrak0jB4BFHGo=; b=rTp3MKQH3O4FLes4WZVlJPXOMKpRj qAhvlzTMUZVMUNcv0wyzRNJDL45Z+Artll6LyQUu+RvoOq7kMOolWQ7BRMk2Z1Nr CMNQgkj5KlGg/FpN74MRpF27fqBfixosMoVc05DuOV8tYjQEt34A82xRtLuFfK22 UraoFvX3SeVRQGsmFaShLWkwijl4U+68qkBay9toG4AH1hfY2zi5/BziUsOw2uXE TLvhJ/1PPp1HuNdkX7D7ORO9AXeUFqxoSaXtahYWWWMrY15rHym35lXHNh+98w9+ rp0fpLp0Vxdj9SdsF0R+HXFkA+KYlLCHqmP6GjKkCN4lgE+W2PSMH2bhw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding: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= fm3; bh=wDrRDroC8ocj8EhlxGBQct+8EUPDVlBrak0jB4BFHGo=; b=F/6caJE7 a53qzHGxUZMlzac6tX6zdlUJEgpQJPFXG2/3LXr8ljX7Jqp38dy5c56e+Q9b38/l uH7pxyy61ocuD0ehI6+KMKHV5L/6USfnygYDdbd/Fzf/aDWMLUhLlu+nyl8wBvye TFDstftKYS/ojwZ9/ziRtRSTpN6od1NCmfCv4IdOBd9ZvjcFsxcpMe6XV1eEq2jF Tch0PXbc7rtvP7rKdiHm1i0jM7zYbb/Ub7cDG2sXZco8v/sIdX15xz6mLOKTa1Hx 5l7EphTv2T7Bc9m5drBhhDID6uHXaDFrMW/KLVytUarprWrTA6rsFDTt14+QZhrr 9ZohpB0bhs0g7w== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduiedrudejgdduudejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeforgigihhm vgcutfhiphgrrhguuceomhgrgihimhgvsegtvghrnhhordhtvggthheqnecuggftrfgrth htvghrnhepvdekleevfeffkeejhfffueelteelfeduieefheduudfggffhhfffheevveeh hedvnecukfhppeeltddrkeelrdeikedrjeeinecuvehluhhsthgvrhfuihiivgephedtne curfgrrhgrmhepmhgrihhlfhhrohhmpehmrgigihhmvgestggvrhhnohdrthgvtghh 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 9A701328005D; Wed, 8 Jul 2020 13:43:48 -0400 (EDT) From: Maxime Ripard To: Nicolas Saenz Julienne , Eric Anholt Cc: dri-devel@lists.freedesktop.org, linux-rpi-kernel@lists.infradead.org, bcm-kernel-feedback-list@broadcom.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Dave Stevenson , Tim Gover , Phil Elwell , Maxime Ripard Subject: [PATCH v4 54/78] drm/vc4: hdmi: Add PHY RNG enable / disable function Date: Wed, 8 Jul 2020 19:42:02 +0200 Message-Id: <6289e210ab50767f32951c1e9b80d420dc879447.1594230107.git-series.maxime@cerno.tech> X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Let's continue the implementation of hooks for the parts that change in the BCM2711 SoC with the PHY RNG setup. Signed-off-by: Maxime Ripard --- drivers/gpu/drm/vc4/vc4_hdmi.c | 15 +++++++++------ drivers/gpu/drm/vc4/vc4_hdmi.h | 8 ++++++++ drivers/gpu/drm/vc4/vc4_hdmi_phy.c | 15 +++++++++++++++ 3 files changed, 32 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c index 068041145d1c..19897d6525ac 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -762,9 +762,9 @@ static int vc4_hdmi_audio_trigger(struct snd_pcm_substream *substream, int cmd, switch (cmd) { case SNDRV_PCM_TRIGGER_START: vc4_hdmi_set_audio_infoframe(encoder); - HDMI_WRITE(HDMI_TX_PHY_CTL_0, - HDMI_READ(HDMI_TX_PHY_CTL_0) & - ~VC4_HDMI_TX_PHY_RNG_PWRDN); + + if (vc4_hdmi->variant->phy_rng_enable) + vc4_hdmi->variant->phy_rng_enable(vc4_hdmi); HDMI_WRITE(HDMI_MAI_CTL, VC4_SET_FIELD(vc4_hdmi->audio.channels, @@ -776,9 +776,10 @@ static int vc4_hdmi_audio_trigger(struct snd_pcm_substream *substream, int cmd, VC4_HD_MAI_CTL_DLATE | VC4_HD_MAI_CTL_ERRORE | VC4_HD_MAI_CTL_ERRORF); - HDMI_WRITE(HDMI_TX_PHY_CTL_0, - HDMI_READ(HDMI_TX_PHY_CTL_0) | - VC4_HDMI_TX_PHY_RNG_PWRDN); + + if (vc4_hdmi->variant->phy_rng_disable) + vc4_hdmi->variant->phy_rng_disable(vc4_hdmi); + break; default: break; @@ -1433,6 +1434,8 @@ static const struct vc4_hdmi_variant bcm2835_variant = { .reset = vc4_hdmi_reset, .phy_init = vc4_hdmi_phy_init, .phy_disable = vc4_hdmi_phy_disable, + .phy_rng_enable = vc4_hdmi_phy_rng_enable, + .phy_rng_disable = vc4_hdmi_phy_rng_disable, }; static const struct of_device_id vc4_hdmi_dt_match[] = { diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.h b/drivers/gpu/drm/vc4/vc4_hdmi.h index 32c80161c786..950accbc44e4 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.h +++ b/drivers/gpu/drm/vc4/vc4_hdmi.h @@ -47,6 +47,12 @@ struct vc4_hdmi_variant { /* Callback to disable the PHY */ void (*phy_disable)(struct vc4_hdmi *vc4_hdmi); + + /* Callback to enable the RNG in the PHY */ + void (*phy_rng_enable)(struct vc4_hdmi *vc4_hdmi); + + /* Callback to disable the RNG in the PHY */ + void (*phy_rng_disable)(struct vc4_hdmi *vc4_hdmi); }; /* HDMI audio information */ @@ -107,5 +113,7 @@ encoder_to_vc4_hdmi(struct drm_encoder *encoder) void vc4_hdmi_phy_init(struct vc4_hdmi *vc4_hdmi, struct drm_display_mode *mode); void vc4_hdmi_phy_disable(struct vc4_hdmi *vc4_hdmi); +void vc4_hdmi_phy_rng_enable(struct vc4_hdmi *vc4_hdmi); +void vc4_hdmi_phy_rng_disable(struct vc4_hdmi *vc4_hdmi); #endif /* _VC4_HDMI_H_ */ diff --git a/drivers/gpu/drm/vc4/vc4_hdmi_phy.c b/drivers/gpu/drm/vc4/vc4_hdmi_phy.c index 5a1746877bb5..93287e24d7d1 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi_phy.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi_phy.c @@ -7,6 +7,7 @@ */ #include "vc4_hdmi.h" +#include "vc4_regs.h" #include "vc4_hdmi_regs.h" void vc4_hdmi_phy_init(struct vc4_hdmi *vc4_hdmi, struct drm_display_mode *mode) @@ -23,3 +24,17 @@ void vc4_hdmi_phy_disable(struct vc4_hdmi *vc4_hdmi) { HDMI_WRITE(HDMI_TX_PHY_RESET_CTL, 0xf << 16); } + +void vc4_hdmi_phy_rng_enable(struct vc4_hdmi *vc4_hdmi) +{ + HDMI_WRITE(HDMI_TX_PHY_CTL_0, + HDMI_READ(HDMI_TX_PHY_CTL_0) & + ~VC4_HDMI_TX_PHY_RNG_PWRDN); +} + +void vc4_hdmi_phy_rng_disable(struct vc4_hdmi *vc4_hdmi) +{ + HDMI_WRITE(HDMI_TX_PHY_CTL_0, + HDMI_READ(HDMI_TX_PHY_CTL_0) | + VC4_HDMI_TX_PHY_RNG_PWRDN); +} -- git-series 0.9.1