Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp1047936ybm; Wed, 27 May 2020 14:52:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJys9h0p8vdGsGGbkzAw6/eEnhiyfuJbrZDRIY79Ib56KVrHcLdKpWvg4xWW8xkR1Y858fn5 X-Received: by 2002:a17:906:7684:: with SMTP id o4mr319989ejm.449.1590616331429; Wed, 27 May 2020 14:52:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590616331; cv=none; d=google.com; s=arc-20160816; b=vtYEFwdtdm16l6TcMbnSMdXa5cuPyj8hloP24F1sVTt4mKibAJmUrwAFpz9r4qVfFT x7KjVucUWlcIZzwbe/ISwFL8n6vOcXjzvoyhjv1CvqjVbMQJjNAsbKvRg/qsHtZ9isnz CLBzaHY9H7a0aDUNQ2dywyBeP1wmnRgBZc1XxyQjhNaw2ZkddYKCfnq/SK16mHwWThHF 1i0QHzU+cgdiluwWqZPjF/e1dOnT7vrhO6bF0gmegrDYGC6cjUKDucs8nCaphXW/6pbI L7ASjRJF+tG1YcQgfZcz2K+3/GySS/8pIwea7SJs/3/I534lDyHha/cLxkzZ8Lym8e3Q 1t0g== 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=YLgHQlgusRMFYH3oIrPEeoCTOvM+aBf2NkHA4+L5RjA=; b=qN0nRMNusI9Nn1KJs+kT8fl5YLxh2IFVWcUi2cYyJBqC3WwYME467NXT7D3Nz+2CAj cH4aez+r8r4nvSEOqGtX+JsLu4FyWUgUZKyNfOsgF8G3fg0GpmdqOo8ocrbHMnToUBN2 xzW3B0t/y3NHX1Q2dtRn0ZnYJ6h1NKrINVjUehF3te+GGI7o1R1md+OCdtDwQLn3dytm prfaVbVjruMq4WMvQdnlv/2qIuhnGYTDBfDwPr1SK8CH3Y/ntRBU/jTeTSSQSTRR6eg3 48N3MpX0U5CagdTb/kFs8WBdQDCcwqUwbcIH/Xoyd6BSdF5WPL1FqJb8PYJlnYifAeUz cKig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cerno.tech header.s=fm2 header.b=w0ErxFaU; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b="GJ/aIjn6"; 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 o14si2257652edt.279.2020.05.27.14.51.47; Wed, 27 May 2020 14:52:11 -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=w0ErxFaU; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b="GJ/aIjn6"; 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 S1730713AbgE0PwV (ORCPT + 98 others); Wed, 27 May 2020 11:52:21 -0400 Received: from new1-smtp.messagingengine.com ([66.111.4.221]:46737 "EHLO new1-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390323AbgE0Pv3 (ORCPT ); Wed, 27 May 2020 11:51:29 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.nyi.internal (Postfix) with ESMTP id 63E995814FC; Wed, 27 May 2020 11:51:28 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Wed, 27 May 2020 11:51:28 -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=fm2; bh=YLgHQlgusRMFY H3oIrPEeoCTOvM+aBf2NkHA4+L5RjA=; b=w0ErxFaUcsUoJUqORgbXZo3SHKEYS T/6lYxDLeF7n963e8leZNqKXeWsKrzcNy7SMVb/4xC0ExfM8w2OGwcZMojFm4JSF buU6f8K0lxcOK3gYp5UlmlcM/zUhUXY4DsVWyLNmwESag510xQo2UdwJBnsthYwp zdW7F9tFcmSB5NdyWufcFDN71rtfD0VAw6HbehpS7pLwa3Cw654/S40ePHqf872m iKzYnH9gNcmu8hnLCv6FI6EN+5wCrrsJu/ydo1pV4Mr4EyzyXNaDkxbuiNLF6bY1 DijVhb1OCViU/WqcUKLNnhSXFcQ/yjoo6TPTrAsNMI3VHRaJHaU1sLoag== 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= fm2; bh=YLgHQlgusRMFYH3oIrPEeoCTOvM+aBf2NkHA4+L5RjA=; b=GJ/aIjn6 Rkhnb2v68Xe9sX9ag696XPiRuSrsjmb5Rgy07SlQJfO2rLZJjfukl6GQv6cj6pSC Wr/Y5Yicl7qO8CcwB7QlD9BfhQ7E3jXH0NMHFVQqaLbVOe3fctt+MBnb5xhtDbGA amkzHoWbWimWk705U3UNk95YOW47lGZj+xtiIY2LHo/jcZXc6hbEFLQTHvKPq17r aBXX4gLXsDNtYz96vf3h+9JKaKXoSWxV95Gea21Zi5MquI2Grb0K9lw31hpHTe5D Nuf8WnnEZqqLStswlx5fr5LLuDNiOt+YB1cKvUIKL4lJFzkL5tkbGYAdveHYN4uB N6W9ua4N1GWLwQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedruddvgedgkeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeforgigihhm vgcutfhiphgrrhguuceomhgrgihimhgvsegtvghrnhhordhtvggthheqnecuggftrfgrth htvghrnhepvdekleevfeffkeejhfffueelteelfeduieefheduudfggffhhfffheevveeh hedvnecukfhppeeltddrkeelrdeikedrjeeinecuvehluhhsthgvrhfuihiivgepheelne 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 F2955306218B; Wed, 27 May 2020 11:51:27 -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 v3 083/105] drm/vc4: hdmi: Add PHY RNG enable / disable function Date: Wed, 27 May 2020 17:48:53 +0200 Message-Id: <4ff7428d535748a50d25f3788197df8bc24a4102.1590594512.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 3d5e35aa96ff..133c7453e588 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; @@ -1414,6 +1415,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 39ae5273f36b..9ae4d2c5a4f0 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