From patchwork Mon Aug 5 13:40:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 11078321 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 CCEF513A4 for ; Tue, 6 Aug 2019 07:25:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B42AF28437 for ; Tue, 6 Aug 2019 07:25:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A83ED28821; Tue, 6 Aug 2019 07:25:20 +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 5A74C28437 for ; Tue, 6 Aug 2019 07:25:20 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0AF7989F97; Tue, 6 Aug 2019 07:24:41 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) by gabe.freedesktop.org (Postfix) with ESMTPS id 913516E43A for ; Mon, 5 Aug 2019 13:41:08 +0000 (UTC) Received: by mail-wr1-x444.google.com with SMTP id p13so9901206wru.10 for ; Mon, 05 Aug 2019 06:41:08 -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=u7zeWErMdF5cDye5AhvTdnoHNJxxvxbr+2y5SRXygFM=; b=ovzCafj8ozuqkSizUdrpJUiCFepkpAkTSwSZFroW0k0PRA7okLwmQM/r7yr5U3ouLE tbHZ4hcBRP8BoYXknRFZymwprsh/Ugvu7C6FTHSm2CLk/FWtxUXlWR9a7Vpn2/Tduouh t9ksyOCcIwuvnariTfZ79SQHCzZAqHT5HZKpXDB/QKHyhc7tZKcbJvpKBDJ/wsFSA/0m yHi/PcHf/tu7z+Fgol2dxg6llw4LhXuta3IGZ1zuV+sHI8uGiUmZB0NCm7PDcJEKX4S2 y84DlEfVwirBep5OYZrt+jmI4OLiX2zcGv73IY/4us7bR3SWqGmE1fTJj05vp2H87Euf hg6w== X-Gm-Message-State: APjAAAXs5hCsK3AN7Af2UAOkPoFvUd4BH1T63CLhOfV4RQogV6Ckb3Xs zwF9WfxpU7VA4RhU/3BgPsipWg== X-Google-Smtp-Source: APXvYqxG5de8oOGia6/RKX4BDBfFqrUciyIWbE/cUEFUzhPAcqXB/v97uk9srpVF1S7gz9QbWrzicA== X-Received: by 2002:adf:e84a:: with SMTP id d10mr25698441wrn.316.1565012467143; Mon, 05 Aug 2019 06:41:07 -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 w7sm99040534wrn.11.2019.08.05.06.41.06 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 05 Aug 2019 06:41:06 -0700 (PDT) From: Jerome Brunet To: Andrzej Hajda , Neil Armstrong Subject: [PATCH 1/8] drm/bridge: dw-hdmi-i2s: support more i2s format Date: Mon, 5 Aug 2019 15:40:55 +0200 Message-Id: <20190805134102.24173-2-jbrunet@baylibre.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190805134102.24173-1-jbrunet@baylibre.com> References: <20190805134102.24173-1-jbrunet@baylibre.com> MIME-Version: 1.0 X-Patchwork-Bot: notify X-Mailman-Approved-At: Tue, 06 Aug 2019 07:24:35 +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=u7zeWErMdF5cDye5AhvTdnoHNJxxvxbr+2y5SRXygFM=; b=MHoStDToM0MdRmsreIsrkeHnl7ndApf5lYedJ3xZjob55uO1i43CLbVtuy8Iw08zxr EknOi1kG8YM26xXqhhZoANy1raTNxAnyNlz3ph0LLBGST5tWhZunQGwVh2P7PEUEwrB4 w0HpoRCOV9knHIeJE35dlTeS72WUbACmEmW2Rc/cs7t9/KJscpct8svpiL6Uu8zjY9qj aNo+XFlfYl74BGc7P0mqMgdWhE2TkAOHZkBh9Xd/zwll8OyAFl28UrV3+9YKjeLObjGE l/3pkF5SHP6NCe4NG7CA54wAyMhjYmd/PhifrTXP54ETaQZaqnah1YmO6Ji4J+lCSe7T qn5A== 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 The dw-hdmi-i2s supports more formats than just regular i2s. Add support for left justified, right justified and dsp modes A and B. Signed-off-by: Jerome Brunet --- .../drm/bridge/synopsys/dw-hdmi-i2s-audio.c | 26 ++++++++++++++++--- drivers/gpu/drm/bridge/synopsys/dw-hdmi.h | 6 +++-- 2 files changed, 27 insertions(+), 5 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 5cbb71a866d5..2b624cff541d 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c @@ -44,9 +44,8 @@ static int dw_hdmi_i2s_hw_params(struct device *dev, void *data, u8 inputclkfs = 0; /* it cares I2S only */ - if ((fmt->fmt != HDMI_I2S) || - (fmt->bit_clk_master | fmt->frame_clk_master)) { - dev_err(dev, "unsupported format/settings\n"); + if (fmt->bit_clk_master | fmt->frame_clk_master) { + dev_err(dev, "unsupported clock settings\n"); return -EINVAL; } @@ -63,6 +62,27 @@ static int dw_hdmi_i2s_hw_params(struct device *dev, void *data, break; } + switch (fmt->fmt) { + case HDMI_I2S: + conf1 |= HDMI_AUD_CONF1_MODE_I2S; + break; + case HDMI_RIGHT_J: + conf1 |= HDMI_AUD_CONF1_MODE_RIGHT_J; + break; + case HDMI_LEFT_J: + conf1 |= HDMI_AUD_CONF1_MODE_LEFT_J; + break; + case HDMI_DSP_A: + conf1 |= HDMI_AUD_CONF1_MODE_BURST_1; + break; + case HDMI_DSP_B: + conf1 |= HDMI_AUD_CONF1_MODE_BURST_2; + break; + default: + dev_err(dev, "unsupported format\n"); + return -EINVAL; + } + dw_hdmi_set_sample_rate(hdmi, hparms->sample_rate); hdmi_write(audio, inputclkfs, HDMI_AUD_INPUTCLKFS); diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.h b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.h index 4e3ec09d3ca4..091d7c28aa17 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.h +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.h @@ -869,8 +869,10 @@ enum { /* AUD_CONF1 field values */ HDMI_AUD_CONF1_MODE_I2S = 0x00, - HDMI_AUD_CONF1_MODE_RIGHT_J = 0x02, - HDMI_AUD_CONF1_MODE_LEFT_J = 0x04, + HDMI_AUD_CONF1_MODE_RIGHT_J = 0x20, + HDMI_AUD_CONF1_MODE_LEFT_J = 0x40, + HDMI_AUD_CONF1_MODE_BURST_1 = 0x60, + HDMI_AUD_CONF1_MODE_BURST_2 = 0x80, HDMI_AUD_CONF1_WIDTH_16 = 0x10, HDMI_AUD_CONF1_WIDTH_24 = 0x18,