From patchwork Thu Oct 3 04:05:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cheng-yi Chiang X-Patchwork-Id: 11172065 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6F28014DB for ; Thu, 3 Oct 2019 04:06:52 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 789EC2085B for ; Thu, 3 Oct 2019 04:06:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="uONMJdH9"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="GJ8dCYph" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 789EC2085B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 464731664; Thu, 3 Oct 2019 06:05:59 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 464731664 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1570075609; bh=FXatHJE3eHKIm21qFXfOFioWg9koGkUoNW6Ik5OKpSQ=; h=From:To:Date:Cc:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=uONMJdH9yC5TqTwIKQyDdtTHNSk8reZw1NC/iv+pFdq9gck6izqqoOs/315kewPws ZVBFOKYwctkECB7egWYNS6vr2WSfXmH901xRcUkmpfRT+kIgPZ7l8bYbs3uk/75bkE I34sk19Yq+cOhhtpL7uGYJFyxpkelhx2yu5lGNy0= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 93FF1F804FF; Thu, 3 Oct 2019 06:05:58 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id 87CCFF80506; Thu, 3 Oct 2019 06:05:56 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on alsa1.perex.cz X-Spam-Level: X-Spam-Status: No, score=-0.1 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,SPF_PASS autolearn=disabled version=3.4.0 Received: from mail-pg1-x544.google.com (mail-pg1-x544.google.com [IPv6:2607:f8b0:4864:20::544]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 157A0F80137 for ; Thu, 3 Oct 2019 06:05:52 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 157A0F80137 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="GJ8dCYph" Received: by mail-pg1-x544.google.com with SMTP id z12so883270pgp.9 for ; Wed, 02 Oct 2019 21:05:52 -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=YBQJ16kILwtHUr0OiFIGwhzlU/DEqHjv7cJWqZHHJLH+7Af9Xrh0zHebBBopr8gwCX Rpeop59Zdt3XL77/ukUB/UNYmspqF5TpmyacObH4JcFt/TkKfrqW8cfrmidY6wHuf7Zp E30RXvK9B8dEGXz3MS1FP5cJUqudyzRiYEFmMcW1VnXk05sKhPF2D/hYW58VAG1AL9L1 DXvKg9+FZ0j+bBnPrfSk64TScHqUCNXKzBiGoVSgQ4MVXtVhjMJw8MMreKt1HWcxIykX MAWFqWA//1fPuJNkcig7qesKt4Yzf8SCt2W0LFS0oGZi9y0fY9qkEGhqgqED88pinmNA 7lUg== X-Gm-Message-State: APjAAAXOkfVRkv01GRO4nVK51Y6ek3fFAMFNdlNxovOcZoBMBjcHvHHZ J1Xd50TZnCrUZPSTMqD4lqeX/g== X-Google-Smtp-Source: APXvYqzWiB8hQkm2uo7S8xni0GVmAx2W9Y1kaKW4dhI8KN2xpmpX/enaUKzWwxDftTpN40iGJ57rhw== 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 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 Cc: Jernej Skrabec , tzungbi@chromium.org, alsa-devel@alsa-project.org, Jonas Karlman , Neil Armstrong , dianders@chromium.org, dri-devel@lists.freedesktop.org, Hans Verkuil , linux-rockchip@lists.infradead.org, Russell King , Mark Brown , Daniel Kurtz , Yakir Yang , dgreid@chromium.org, Cheng-Yi Chiang , linux-arm-kernel@lists.infradead.org, Jerome Brunet Subject: [alsa-devel] [PATCH v2] FROMLIST: drm/bridge: dw-hdmi: Restore audio when setting a mode X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" 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 */