Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp751697ybt; Wed, 8 Jul 2020 10:45:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwt6kGLmI6oP03Pmlxo8nZ4/mUgN57wsTFfxZ0mumjR5Ulrkq58R8as8m/NURo1qDqup9yJ X-Received: by 2002:a17:906:194b:: with SMTP id b11mr46727872eje.28.1594230311663; Wed, 08 Jul 2020 10:45:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594230311; cv=none; d=google.com; s=arc-20160816; b=p9t6z6vaXmCyB6wkZLbIpleeNQ7MNyoGqEe2vwkJvzqlO93g0FuLk9t4jqgCIihrD3 0mpvaQR7iKKaqQ362NGoNmjJ6MxjadA3b8wPJy5rODU4fEbF5zQYhodrULeHiTiagMyf pcnJz2IzqdvvRyYMJLqzuIOzMOY4CggGgMD6elyFCI9597RinkQmZPe0Lp0sWvJBClf0 s7W3cVOaBsyzJcxRS9KhJ12tokn6HiOkgRrylqrduies8hBJUc/bzZ148YTiDAv2Vc9P 0baZu1WPl5ZaWCxaUCh7W/B3HPbSew7GwObPWMjOUM9GRJddj8yG+jE0CyRzYHJAI5Pi ZtwQ== 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=de0mF+VjX2q6uxMlPlcBcexMCkVgd8GF6/Q5G21dgxU=; b=Dji0p6c/f2cyLCDn757c4Rq6sEeeB3pW4AhBsrQaylCUozOCiHnyy1mQXrQVoKaUCf ao4HgGxCVSA/2A3B8Xf27ENfQ0Dg6sLPZlKnTz4m00Q8RaNLrDRzYI+A9dNspLfdh9VW V/yv0Om3nTbUQJeI0Hn9ZAfmbDx9zYLeXPiSzCxLdO7O4w73ayez0tWCwBeZ7WAX/szF KbdeuOFem426N8NIrTgk6ttITtNNB+FvSGPnpb+sJj2c3INUesSNiXlF9sYVMf+gCI/4 ArIJi/KiCP+7vyuoks8xXW2RO1l3wSN88YvVmgKzvGTheETZi7P7L8Y8rFagYBp31Lp6 1LbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cerno.tech header.s=fm3 header.b=MdxNv077; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=lp6j9SpF; 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 y19si315862eje.56.2020.07.08.10.44.48; Wed, 08 Jul 2020 10:45: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=fm3 header.b=MdxNv077; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=lp6j9SpF; 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 S1727854AbgGHRnv (ORCPT + 99 others); Wed, 8 Jul 2020 13:43:51 -0400 Received: from wnew4-smtp.messagingengine.com ([64.147.123.18]:42565 "EHLO wnew4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727820AbgGHRnr (ORCPT ); Wed, 8 Jul 2020 13:43:47 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.west.internal (Postfix) with ESMTP id 889D12F2; Wed, 8 Jul 2020 13:43:46 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Wed, 08 Jul 2020 13:43:47 -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=de0mF+VjX2q6u xMlPlcBcexMCkVgd8GF6/Q5G21dgxU=; b=MdxNv07736/c5yjumaS2Cpwh9F8P3 9gjJ7FdQCxmhVf0IntpcjfVO7odpLTAnP27ar4vuqnroPigJfoNrKl2z7u6CxBBH bND2Ba+a3sPIHAlCk5Vf3niqFgtPffQRNoe0kqmcOagA/eUwrlQVvG//jIuFV77J Wfb03MDAKABcdqpo8NcIYDPJ0jQxsIEvIwXc8eN933SRG6+QQJElmEMVlQ98o4ET IkpSiNU6cdK4fCoTvRzC+eVs3O0qmdUQ0RgDs7xu1lRnR/MVtidTJUKDNNBJETAe fagOs+9aQq6YZ+hHF31Cw4tCBPQeRRZhlY2y8LI9IfROebqS4qbl6alKg== 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=de0mF+VjX2q6uxMlPlcBcexMCkVgd8GF6/Q5G21dgxU=; b=lp6j9SpF YbKxXFOCIeZnRWdHdv56RTumbvWmDytVhK2Bb3fABHzNxONNbUyrY4c6BnuzDiGq 544ahJ7Q0J+lL0pZzgXYKEmR850v8lUqcVOfmGa7T8j14H3V4WeYcxgnN19rXUBb VEGOl1zoxaxRDzCdPLb87VydhW+0bZuJ9BH0BQjg9iCAVyEkc88vhzHGDKghr00l exqH9smHzGnAehEPvZlvD+B5T8Gebpguv+o0aK/SrAo9abBPRpWWByGjcaiQN8Oq B/+VPzRXfIe6Wv8RaBj6sgioip++kagw0N/c6HeLxdcRBOXLklVuYHMbUNLzu6V9 u8P2QA50qGc5zw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduiedrudejgdduudejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeforgigihhm vgcutfhiphgrrhguuceomhgrgihimhgvsegtvghrnhhordhtvggthheqnecuggftrfgrth htvghrnhepvdekleevfeffkeejhfffueelteelfeduieefheduudfggffhhfffheevveeh hedvnecukfhppeeltddrkeelrdeikedrjeeinecuvehluhhsthgvrhfuihiivgepgeeine 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 BF14D328005D; Wed, 8 Jul 2020 13:43:45 -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 52/78] drm/vc4: hdmi: Add reset callback Date: Wed, 8 Jul 2020 19:42:00 +0200 Message-Id: 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 The BCM2711 and BCM283x HDMI controllers use a slightly different reset sequence, so let's add a callback to reset the controller. Signed-off-by: Maxime Ripard --- drivers/gpu/drm/vc4/vc4_hdmi.c | 31 ++++++++++++++++++------------- drivers/gpu/drm/vc4/vc4_hdmi.h | 3 +++ 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c index a4fed1439bf3..80bc3dd9d4a8 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -69,6 +69,21 @@ static int vc4_hdmi_debugfs_regs(struct seq_file *m, void *unused) return 0; } +static void vc4_hdmi_reset(struct vc4_hdmi *vc4_hdmi) +{ + HDMI_WRITE(HDMI_M_CTL, VC4_HD_M_SW_RST); + udelay(1); + HDMI_WRITE(HDMI_M_CTL, 0); + + HDMI_WRITE(HDMI_M_CTL, VC4_HD_M_ENABLE); + + HDMI_WRITE(HDMI_SW_RESET_CONTROL, + VC4_HDMI_SW_RESET_HDMI | + VC4_HDMI_SW_RESET_FORMAT_DETECT); + + HDMI_WRITE(HDMI_SW_RESET_CONTROL, 0); +} + static enum drm_connector_status vc4_hdmi_connector_detect(struct drm_connector *connector, bool force) { @@ -363,11 +378,8 @@ static void vc4_hdmi_encoder_enable(struct drm_encoder *encoder) return; } - HDMI_WRITE(HDMI_SW_RESET_CONTROL, - VC4_HDMI_SW_RESET_HDMI | - VC4_HDMI_SW_RESET_FORMAT_DETECT); - - HDMI_WRITE(HDMI_SW_RESET_CONTROL, 0); + if (vc4_hdmi->variant->reset) + vc4_hdmi->variant->reset(vc4_hdmi); /* PHY should be in reset, like * vc4_hdmi_encoder_disable() does. @@ -1292,14 +1304,6 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data) vc4_hdmi->hpd_active_low = hpd_gpio_flags & OF_GPIO_ACTIVE_LOW; } - /* HDMI core must be enabled. */ - if (!(HDMI_READ(HDMI_M_CTL) & VC4_HD_M_ENABLE)) { - HDMI_WRITE(HDMI_M_CTL, VC4_HD_M_SW_RST); - udelay(1); - HDMI_WRITE(HDMI_M_CTL, 0); - - HDMI_WRITE(HDMI_M_CTL, VC4_HD_M_ENABLE); - } pm_runtime_enable(dev); drm_simple_encoder_init(drm, encoder, DRM_MODE_ENCODER_TMDS); @@ -1428,6 +1432,7 @@ static const struct vc4_hdmi_variant bcm2835_variant = { .num_registers = ARRAY_SIZE(vc4_hdmi_fields), .init_resources = vc4_hdmi_init_resources, + .reset = vc4_hdmi_reset, }; 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 b36e0210671f..17a30589f39c 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.h +++ b/drivers/gpu/drm/vc4/vc4_hdmi.h @@ -35,6 +35,9 @@ struct vc4_hdmi_variant { * clocks, etc) for that variant. */ int (*init_resources)(struct vc4_hdmi *vc4_hdmi); + + /* Callback to reset the HDMI block */ + void (*reset)(struct vc4_hdmi *vc4_hdmi); }; /* HDMI audio information */ -- git-series 0.9.1