From patchwork Mon Aug 12 12:07:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 11095323 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EB14D1398 for ; Thu, 15 Aug 2019 08:38:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DA8E02884A for ; Thu, 15 Aug 2019 08:38:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CCEE82886F; Thu, 15 Aug 2019 08:38:10 +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=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8278C2884A for ; Thu, 15 Aug 2019 08:38:10 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 101166E918; Thu, 15 Aug 2019 08:35:16 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) by gabe.freedesktop.org (Postfix) with ESMTPS id E6A876E501 for ; Mon, 12 Aug 2019 12:07:36 +0000 (UTC) Received: by mail-wm1-x341.google.com with SMTP id 10so11927277wmp.3 for ; Mon, 12 Aug 2019 05:07:36 -0700 (PDT) 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=+7rNGhftPAm98gxQzspW2Bl38AWTm/sVwK1bJUwi+9s=; b=TzRxR73MrersbVWJtw8UC8J4Sv+eDztW3gMIpv6PgCDRx9sMw12FXeo4zSS80AUWkZ Rdog7Vk55WD0rsqHEELeBe899lzcZo5JJyQA0H8nxGB9NhS3JOjAyY6FEY3KzJqYNeAr dS6MkHr4/oU8EUMpicsXXWkdcFQqjFcQIn/Q2/wRw5Q7ETIYT50kmboyONDECsMikNkJ vyURIgkamcsLwxYFbfsU+O8V19Q/vfXv4APP1YVOX5Jm6FNSf8iwfa3oVZMjOyE82vKk JjuGB8vbQSCn/tgCCOAe6ITCxBAwIinIjeqm0J2Bc8BUqAiS5+fpgpDGr3Twwv9xM4Ur XgBQ== X-Gm-Message-State: APjAAAWJconBybVPAOH27kPVqrlYeEQRLo9DciGm60xRKxuxd8U/A4oI cHlKTjELWflX2DnuaQglfbw7zQ== X-Google-Smtp-Source: APXvYqzfPZVz7gWpdlttsi/wKeTKZdYi6SBdhAvNGLWGXbHVP91D0/y3OiVgUj4sWE1/dLgWfQri7w== X-Received: by 2002:a1c:1f41:: with SMTP id f62mr28067454wmf.176.1565611655458; Mon, 12 Aug 2019 05:07:35 -0700 (PDT) Received: from starbuck.baylibre.local (lmontsouris-657-1-212-31.w90-63.abo.wanadoo.fr. [90.63.244.31]) by smtp.googlemail.com with ESMTPSA id j9sm1883415wrx.66.2019.08.12.05.07.34 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 12 Aug 2019 05:07:35 -0700 (PDT) From: Jerome Brunet To: Andrzej Hajda , Neil Armstrong Subject: [PATCH v2 6/8] drm/bridge: dw-hdmi-i2s: reset audio fifo before applying new params Date: Mon, 12 Aug 2019 14:07:24 +0200 Message-Id: <20190812120726.1528-7-jbrunet@baylibre.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190812120726.1528-1-jbrunet@baylibre.com> References: <20190812120726.1528-1-jbrunet@baylibre.com> MIME-Version: 1.0 X-Patchwork-Bot: notify X-Mailman-Approved-At: Thu, 15 Aug 2019 08:34:55 +0000 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=+7rNGhftPAm98gxQzspW2Bl38AWTm/sVwK1bJUwi+9s=; b=rDwjvizqSw6Jz6AkOORykYkiAVItW36h9yIqrSC6nXnNDmDCRZtcTAJJCA4PBosGnH udRGdq/OsG7HCT1oFBaXuW0dQ6f9+s4m2z+tnI96mdsZGFqBYABurZMO8EQtvQgJOsWG ZuPZy9FPI8wgr5HIADP9ult6InbBe4KL1ExExYGEU96fwU9dimdR6xtIHI9XAhqE3YvC fSlYBsOBJdwSPg5xqueM2fiMOQD/huROetdJhaDMeb5qjgGVvpTUq98oh0/ytyf5dl9C +i2+2g+Mu+TW0YXap8l1FGYxX7g7ietxEAmQtKO9SlSKPgGROCnAuQQKJm1wJBCUncWw UN9A== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jonas Karlman , Kevin Hilman , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-amlogic@lists.infradead.org, Jerome Brunet Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP When changing the audio hw params, reset the audio fifo to make sure any old remaining data is flushed. The databook mentions that such reset should be followed by a reset of the i2s block to make sure the samples stay aligned Reviewed-by: Jonas Karlman Signed-off-by: Jerome Brunet --- drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c | 6 ++++-- drivers/gpu/drm/bridge/synopsys/dw-hdmi.h | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c index 0864dee8d180..41bee0099578 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c @@ -49,6 +49,10 @@ static int dw_hdmi_i2s_hw_params(struct device *dev, void *data, return -EINVAL; } + /* Reset the FIFOs before applying new params */ + hdmi_write(audio, HDMI_AUD_CONF0_SW_RESET, HDMI_AUD_CONF0); + hdmi_write(audio, (u8)~HDMI_MC_SWRSTZ_I2SSWRST_REQ, HDMI_MC_SWRSTZ); + inputclkfs = HDMI_AUD_INPUTCLKFS_64FS; conf0 = HDMI_AUD_CONF0_I2S_ALL_ENABLE; @@ -102,8 +106,6 @@ static void dw_hdmi_i2s_audio_shutdown(struct device *dev, void *data) struct dw_hdmi *hdmi = audio->hdmi; dw_hdmi_audio_disable(hdmi); - - hdmi_write(audio, HDMI_AUD_CONF0_SW_RESET, HDMI_AUD_CONF0); } static int dw_hdmi_i2s_get_dai_id(struct snd_soc_component *component, diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.h b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.h index 091d7c28aa17..a272fa393ae6 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.h +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.h @@ -940,6 +940,7 @@ enum { HDMI_MC_CLKDIS_PIXELCLK_DISABLE = 0x1, /* MC_SWRSTZ field values */ + HDMI_MC_SWRSTZ_I2SSWRST_REQ = 0x08, HDMI_MC_SWRSTZ_TMDSSWRST_REQ = 0x02, /* MC_FLOWCTRL field values */