From patchwork Fri Apr 7 14:19:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Romain Perier X-Patchwork-Id: 9669589 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6A77060364 for ; Fri, 7 Apr 2017 14:20:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5B8D528614 for ; Fri, 7 Apr 2017 14:20:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5096928615; Fri, 7 Apr 2017 14:20:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 105DA28617 for ; Fri, 7 Apr 2017 14:20:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=qHELfg668a/FxTY3KMJV3iF9d15UjK4dCMz58QRk7v0=; b=fHl3GqZ8+PAIKijB15nnhA3cGA 53+Wmm6trTca6EKUe1D1p773mJ7QDEBZgvTiv3BZ0L+KC2MsIqTH2qy1KysNISFGFXGq7LgT8VmGJ 6aW3jDdomU10lajt6i3PpuVZ8yNHrsvttXCk5dPQjDspztvcU5DZQyxQd+ReNRNorZJu7YTjNh/gl mzd19kbzvXcbEPWWD9E4ua1XQhyVJlzKSoIRiwQDflmBThFiU4wdABuBQpW5K9n7lhEVWKCeeiGDv txdDc9UCs2AAF5InxLTVBmlx3mRpDK/xhZNUZi942veS5IlDcw2SrP5QUxTlfT5QlLGmvLu+2RHLF gVWt5LcA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cwUkQ-0003kt-Ip; Fri, 07 Apr 2017 14:20:22 +0000 Received: from casper.infradead.org ([2001:770:15f::2]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cwUjr-0001uA-Uh; Fri, 07 Apr 2017 14:19:48 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=A/XFJFLnzgonf8U+bFWC4pf6AIm/+sWxMOR7Qc3eD08=; b=EsY6qD6QrJLP1cBUg8xudULaA 7QtSq4Ly4LxCCrppWr+woPid+ZZwlp4vmYFiJHk+3gxxaWpEuYF0/mEaIohTKoGqbTbVLKJTcU51H upG0L0n+TNjs80ioa2f5YAqJqiYz6tY5/QkO4MdWIR0RnPlZu8qUfaVxNgAUoYAcSwP6C1KMUGasL WqNdW5EkDt4aGQV+hvAKKdzIHJuLUnZMMTKnbnHvK1tKULSOo6/YBKhzlS7JSkCMfDYiEnjM5K0jU YtbkoiYY+Gr9ldnY31P9OOAQu72KCBkrSLtWhmN09ObQLRw/5LN5xgvwfSow6x5tGeC2yU7sa7cfa QlK4reg7g==; Received: from bhuna.collabora.co.uk ([46.235.227.227]) by casper.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cwUjn-0003KD-Lo; Fri, 07 Apr 2017 14:19:46 +0000 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: rperier) with ESMTPSA id 203B02657E6 From: Romain Perier To: Archit Taneja , David Airlie Subject: [PATCH 2/2] drm: dw-hdmi: Gate audio clock from the I2S enablement callbacks Date: Fri, 7 Apr 2017 16:19:05 +0200 Message-Id: <20170407141905.14147-3-romain.perier@collabora.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170407141905.14147-1-romain.perier@collabora.com> References: <20170407141905.14147-1-romain.perier@collabora.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170407_151943_715521_3BFC322A X-CRM114-Status: GOOD ( 11.64 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jose Abreu , Neil Armstrong , Russell King , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org, Romain Perier , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Currently, the audio sampler clock is enabled from dw_hdmi_setup() at step E. and is kept enabled for later use. This clock should be enabled and disabled along with the actual audio stream and not always on (that is bad for PM). Futhermore, as described by the datasheet, the I2S variant need to gate/ungate the clock when the stream is enabled/disabled. This commit adds a parameter to hdmi_audio_enable_clk() that controls when the audio sample clock must be enabled or disabled. Then, it adds the call to this function from dw_hdmi_i2s_audio_enable() and dw_hdmi_i2s_audio_disable(). Signed-off-by: Romain Perier --- drivers/gpu/drm/bridge/dw-hdmi.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/bridge/dw-hdmi.c b/drivers/gpu/drm/bridge/dw-hdmi.c index d34e0a5..3bd0807 100644 --- a/drivers/gpu/drm/bridge/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/dw-hdmi.c @@ -559,6 +559,12 @@ void dw_hdmi_set_sample_rate(struct dw_hdmi *hdmi, unsigned int rate) } EXPORT_SYMBOL_GPL(dw_hdmi_set_sample_rate); +static void hdmi_enable_audio_clk(struct dw_hdmi *hdmi, bool enable) +{ + hdmi_modb(hdmi, enable ? 0 : HDMI_MC_CLKDIS_AUDCLK_DISABLE, + HDMI_MC_CLKDIS_AUDCLK_DISABLE, HDMI_MC_CLKDIS); +} + void dw_hdmi_ahb_audio_enable(struct dw_hdmi *hdmi) { hdmi_set_cts_n(hdmi, hdmi->audio_cts, hdmi->audio_n); @@ -572,12 +578,13 @@ void dw_hdmi_ahb_audio_disable(struct dw_hdmi *hdmi) void dw_hdmi_i2s_audio_enable(struct dw_hdmi *hdmi) { hdmi_set_cts_n(hdmi, hdmi->audio_cts, hdmi->audio_n); + hdmi_enable_audio_clk(hdmi, true); } void dw_hdmi_i2s_audio_disable(struct dw_hdmi *hdmi) { - + hdmi_enable_audio_clk(hdmi, false); } void dw_hdmi_audio_enable(struct dw_hdmi *hdmi) @@ -1365,11 +1372,6 @@ static void dw_hdmi_enable_video_path(struct dw_hdmi *hdmi) } } -static void hdmi_enable_audio_clk(struct dw_hdmi *hdmi) -{ - hdmi_modb(hdmi, 0, HDMI_MC_CLKDIS_AUDCLK_DISABLE, HDMI_MC_CLKDIS); -} - /* Workaround to clear the overflow condition */ static void dw_hdmi_clear_overflow(struct dw_hdmi *hdmi) { @@ -1471,7 +1473,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); + hdmi_enable_audio_clk(hdmi, true); } /* not for DVI mode */