Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp207228imj; Thu, 14 Feb 2019 18:42:07 -0800 (PST) X-Google-Smtp-Source: AHgI3IaWjevO/RGXiph4Iv6C4kNlgiog38EPDVhxKHgb5QVKVRhVL4HoJiY44f452LLYF5iVaylY X-Received: by 2002:a65:6553:: with SMTP id a19mr3126705pgw.267.1550198527202; Thu, 14 Feb 2019 18:42:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550198527; cv=none; d=google.com; s=arc-20160816; b=MQHvItVjt1ioUe7eeClx7qV9+veHvBwXIM28bKC3/ryrr8yq1MiEnbdRf3SoSnWcOt 9t7hJORyi4Nll8gPxqtt6px2qIg20MZ5N7tGb+1yrm//CCby9h+jO7JITK7ZjLZUObig qkUy1KlCdQSZSGll29JGitrhaV2BHLvKn6+2mk8dklfjBxWj0DR5yovr/DD/J9dktPkA nWIpyhXPJO08Zejgvk0wfxV/WQzfojB1OejVS9hA04sZVywxBB4CwAbK9fXk7dXdT+QA Z/hbiLBl6ARo/tSU6kkOlMO0GRH1DPQgYzbzl+qajY8ThuvviI+cP6brAyeTf9EfRp8M UvTw== 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; bh=WnK4L0dsbOVLF3Y3JQ996ZSsueclp1XJQR+AXTNplP0=; b=otzJp/jOA/Nx+vhm5X64KySarpgxVSCBsMoz0Iboh7mX9uWyKciIZ4tkN1P0Q7tvFX cLuTrCkQOUwkRugOAsybFhN/+uydrGhjs++dFUe1Fk50rp0i3QEMNq50JMVcJEaT5ZKk sXctP/bYzJ5ZVp03MWUMRIACGDBxcvefYvnKhQ4ftKeE4/JVg7wqRaKf9uhvbdH1Kqgg w4yGS8PQr2tAVVG2+BQCNCv/P6ns3Ny7ovIUYRniBJWGOeQ5X8iRL91xxpFYzNqrI7hp zklQG/PjlwUuQu0U+SurApHsfcm9af8NVDT53/lGSUYO9yvqSWkpAOE14G9Ta6/XkFS7 9lOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=g3N+L0dR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m9si3823346pgv.523.2019.02.14.18.41.51; Thu, 14 Feb 2019 18:42:07 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=g3N+L0dR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387483AbfBOCjV (ORCPT + 99 others); Thu, 14 Feb 2019 21:39:21 -0500 Received: from mail.kernel.org ([198.145.29.99]:50356 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390199AbfBOCKP (ORCPT ); Thu, 14 Feb 2019 21:10:15 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7A677206BA; Fri, 15 Feb 2019 02:10:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1550196614; bh=b9mHi0vxGM5l7wd3jcDXtjgneNvouOkb7J+ZhDi3SMo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g3N+L0dRe/tIYVa9JafzXFJmI3+C+f4PIaeH0QHJD9RECdcyHYoiaadxhPDqEuoP3 2qxXYVDDVMySU+NJiw/r6piTZBQ5cK1TEPsffMDwahYLRrivWj6GV+vGXdDPRlaHFJ FX32epcTFqGlZjGxfakMKxjTxe8/3ofJLJiTzVcs= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Priit Laes , Maxime Ripard , Sasha Levin , dri-devel@lists.freedesktop.org Subject: [PATCH AUTOSEL 4.20 46/77] drm/sun4i: hdmi: Fix usage of TMDS clock Date: Thu, 14 Feb 2019 21:08:24 -0500 Message-Id: <20190215020855.176727-46-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190215020855.176727-1-sashal@kernel.org> References: <20190215020855.176727-1-sashal@kernel.org> MIME-Version: 1.0 X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Priit Laes [ Upstream commit 5e1bc251cebc84b41b8eb5d2434e54d939a85430 ] Although TMDS clock is required for HDMI to properly function, nobody called clk_prepare_enable(). This fixes reference counting issues and makes sure clock is running when it needs to be running. Due to TDMS clock being parent clock for DDC clock, TDMS clock was turned on/off for each EDID probe, causing spurious failures for certain HDMI/DVI screens. Fixes: 9c5681011a0c ("drm/sun4i: Add HDMI support") Signed-off-by: Priit Laes [Maxime: Moved the TMDS clock enable earlier] Signed-off-by: Maxime Ripard Link: https://patchwork.freedesktop.org/patch/msgid/20190122073232.7240-1-plaes@plaes.org Signed-off-by: Sasha Levin --- drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c index 061d2e0d9011..416da5376701 100644 --- a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c +++ b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c @@ -92,6 +92,8 @@ static void sun4i_hdmi_disable(struct drm_encoder *encoder) val = readl(hdmi->base + SUN4I_HDMI_VID_CTRL_REG); val &= ~SUN4I_HDMI_VID_CTRL_ENABLE; writel(val, hdmi->base + SUN4I_HDMI_VID_CTRL_REG); + + clk_disable_unprepare(hdmi->tmds_clk); } static void sun4i_hdmi_enable(struct drm_encoder *encoder) @@ -102,6 +104,8 @@ static void sun4i_hdmi_enable(struct drm_encoder *encoder) DRM_DEBUG_DRIVER("Enabling the HDMI Output\n"); + clk_prepare_enable(hdmi->tmds_clk); + sun4i_hdmi_setup_avi_infoframes(hdmi, mode); val |= SUN4I_HDMI_PKT_CTRL_TYPE(0, SUN4I_HDMI_PKT_AVI); val |= SUN4I_HDMI_PKT_CTRL_TYPE(1, SUN4I_HDMI_PKT_END); -- 2.19.1