Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp1673442ybn; Wed, 2 Oct 2019 21:20:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqwAg4WBDIS3hQE6CW6fFb/6WMW0z8XRVWRLlPKVrRd0/y9MOEz2C4X0wxyePwtuV/Y+VGhk X-Received: by 2002:a17:906:b30b:: with SMTP id n11mr6241851ejz.35.1570076432134; Wed, 02 Oct 2019 21:20:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570076432; cv=none; d=google.com; s=arc-20160816; b=x5+2cJwUfRdeB6vEw6PQL1TyB70pXpZtwFfjrQQ98RJrTmlNeXcum078KogXMMjqCA belXtSGnzJEoNgm2192Mdgrl3pe+93ivfWWo4KYoyW78AJh/zKNFVP8oBmx3jm/tTPRX Vvm6v0uECrD2KseLdKq4ZIv79lFXZbexToYotqyJsUF799NltpiN9RRF2W+cgYz2LQnf DWoX+uFmTZq64G3we2bKMS369e+/3BKYVYg9nNxh2a0sbQ32G/ZXgtGHbktJrSHuhEld c6QSxVs2Km5DguQXOSVA9DfckrRvoxR5BFuM2Zf+auYnm0o+w/d+EFe0zjmnCbLUbdcO rXxQ== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=ipcV5l1n/8It2aLom5M2l+YXf6MikdW6xOH7ijHIWC4=; b=dc/JsqGtR37CmdjNbwZ/GgoiB6S4M0dp0QT1ZPoIICrEIkCn1azoVR4cDUoC5KYM7r sd7OQFbnGH7KVROFAtoAoAOhcyOn3z7DloSJW3hK10AKDaOKfJC+NpKYlNlTrII7kxbd QmBKu6kCm9RPZrrroohyKIPM27IMIYRLiegKqvIEe64VKhDEmGX7GZFVWaq3HRezznPr yrGJl+D0Tgilk85iCiRJUPDXYeAEqYQEAZOw2CkDvTGtVSNhzBBW1lGpIHjn0+D21ZCG ALNfjWRsMuZ3PEzFYfenemdkgh30hCal0qi6WAVqgKXSFkNCPhZntGvWAtVFPcLUUiGh LP4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=GJ8dCYph; 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=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g22si752961eda.27.2019.10.02.21.20.08; Wed, 02 Oct 2019 21:20:32 -0700 (PDT) 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=@chromium.org header.s=google header.b=GJ8dCYph; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726376AbfJCEFv (ORCPT + 99 others); Thu, 3 Oct 2019 00:05:51 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:41737 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726002AbfJCEFv (ORCPT ); Thu, 3 Oct 2019 00:05:51 -0400 Received: by mail-pg1-f194.google.com with SMTP id s1so888959pgv.8 for ; Wed, 02 Oct 2019 21:05:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ipcV5l1n/8It2aLom5M2l+YXf6MikdW6xOH7ijHIWC4=; b=GJ8dCYphiCUor6hJ8Gk2a0LVJjkKGKBK0qYgul5TeGjsdlVTkyabw4iWB5Tf+iw8Ua FiN7fu0PJaIxegA5BQ9wp6F5l6rFTNhY5aFK9pAnie4HM6QzrpFmxoq8pnTTVRFeYJAV OE4PSBL5YMHVsOurDvxBxxhEypEBCMV34tWV0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ipcV5l1n/8It2aLom5M2l+YXf6MikdW6xOH7ijHIWC4=; b=ih+84fUkyJbVk7eY0cEPHdt0Iud2st/FuR1V1T/yX7n8NqxCubGYD1/1tYppr7vsgD Gaw4uGGXe0uNfTWg90S8YWIeZQjTdEwXX9zAAQYVgfb6woTefVNitD7TUmlv6mG7IUMp jNMxDNGhyH636y1grTgqMKXe/FGwGOikB9uGsyjPZPESA/f0AmsutVtyOeYY/5lwqJKN CUYpO/D1j0zmApCb+kv5Rw9E4Sby5NPguIbb6jAXtA7bRkdQUtNEBXkGU4aCusCsjx/m pfIa2/3xwSvn5KcLHYfw/cQmfyV+Gt4wuvrSUmKxKfens/tAZCPDVmVYrn+eTq1aK98J UMIA== X-Gm-Message-State: APjAAAVG3YT4Wd6Cr9NRqdcW3y16f1+itqkGeAJMi71wvOJtZmeHP5EC VSmDqEt+L63pG0zHroWBl9ttyyQJXGI= X-Received: by 2002:a62:754a:: with SMTP id q71mr8685426pfc.70.1570075550111; Wed, 02 Oct 2019 21:05:50 -0700 (PDT) Received: from localhost ([2401:fa00:1:10:79b4:bd83:e4a5:a720]) by smtp.gmail.com with ESMTPSA id z5sm954845pgi.19.2019.10.02.21.05.46 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 02 Oct 2019 21:05:49 -0700 (PDT) From: Cheng-Yi Chiang To: linux-kernel@vger.kernel.org Cc: Neil Armstrong , Jerome Brunet , Jernej Skrabec , Jonas Karlman , Hans Verkuil , Mark Brown , Jaroslav Kysela , Russell King , dianders@chromium.org, dgreid@chromium.org, tzungbi@chromium.org, alsa-devel@alsa-project.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, Daniel Kurtz , Cheng-Yi Chiang , Yakir Yang Subject: [PATCH v2] FROMLIST: drm/bridge: dw-hdmi: Restore audio when setting a mode Date: Thu, 3 Oct 2019 12:05:40 +0800 Message-Id: <20191003040540.180310-1-cychiang@chromium.org> X-Mailer: git-send-email 2.23.0.444.g18eeb5a265-goog 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 From: Daniel Kurtz When setting a new display mode, dw_hdmi_setup() calls dw_hdmi_enable_video_path(), which disables all hdmi clocks, including the audio clock. We should only (re-)enable the audio clock if audio was already enabled when setting the new mode. Without this patch, on RK3288, there will be HDMI audio on some monitors if i2s was played to headphone when the monitor was plugged. ACER H277HU and ASUS PB278 are two of the monitors showing this issue. Signed-off-by: Cheng-Yi Chiang Signed-off-by: Daniel Kurtz Signed-off-by: Yakir Yang --- Change from v1 to v2: - Use audio_lock to protect audio clock. drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c index aa7efd4da1c8..749d8e4c535b 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -1982,6 +1982,17 @@ static void hdmi_disable_overflow_interrupts(struct dw_hdmi *hdmi) HDMI_IH_MUTE_FC_STAT2); } +static void dw_hdmi_audio_restore(struct dw_hdmi *hdmi) +{ + unsigned long flags; + + spin_lock_irqsave(&hdmi->audio_lock, flags); + + hdmi_enable_audio_clk(hdmi, hdmi->audio_enable); + + spin_unlock_irqrestore(&hdmi->audio_lock, flags); +} + static int dw_hdmi_setup(struct dw_hdmi *hdmi, struct drm_display_mode *mode) { int ret; @@ -2045,7 +2056,7 @@ static int dw_hdmi_setup(struct dw_hdmi *hdmi, struct drm_display_mode *mode) /* HDMI Initialization Step E - Configure audio */ hdmi_clk_regenerator_update_pixel_clock(hdmi); - hdmi_enable_audio_clk(hdmi, true); + dw_hdmi_audio_restore(hdmi); } /* not for DVI mode */ -- 2.23.0.444.g18eeb5a265-goog