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: 170549 Delivered-To: patch@linaro.org Received: by 2002:a92:512:0:0:0:0:0 with SMTP id q18csp4311908ile; Mon, 5 Aug 2019 06:41:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqyLOLq8/FbXympJHEpmN0CFn4wr4Xpt2DMERdttAivPKcInDiKb9t2iV9V8Mn17desHI6kx X-Received: by 2002:a63:9e54:: with SMTP id r20mr103556950pgo.64.1565012471348; Mon, 05 Aug 2019 06:41:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565012471; cv=none; d=google.com; s=arc-20160816; b=VBimiwwCGtK1ILeagkLtlZeH5zs2wtjbr8QrUWqQ3Nh22yna75OPQz+Hq2CT8f1lNT U8FSjjyIybgBI+WJS2MCvbsFKjbZ7LOCsm6guoTxq7tNum3mbgEquzhibe/qx1xPX+kH N0TI037XNIAfYdRznbNtmqV1RmBaGlxtBjpyOqPc9uQWHhHqaQJFG/KI824CnHpixXOX Gj3eAhodsSUUYMWgttHZS31EZMEWW9uuMejVgx9piLt3pCLXVmBcA9dXioBpijLYJl8u mxhxiaQWN8eCqTocahnVx424mPWAOzz4aCgbotHCCz5LgxUbGn2llPmthnQj0A++VpHE oLyg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=u7zeWErMdF5cDye5AhvTdnoHNJxxvxbr+2y5SRXygFM=; b=FyLWM6z5kgWkJZ91cD1+W0+MSVTpTG0w1lO47buEKzKxE08isVBsEtsTi7M8T7iJlp hzsJ5amu3UZIpBZ/qAEJXBmZgJ4jfPQbwYEKoCc1NkuOrw65KyTQenm8KntEsoEObeFr rF/B209cSDEzdRJm5iPNHLkGS/8I2Y8ZqEJZEwBdzpehCd6s+gyoRyyIknb3lncgc0s1 SKZa5NONbWq9j9MB3dOGD70NO+eSZ+v8eRMVUMAovtdeyYEHff70NxcDgp485VNd48ye 7G/hM6gXCHHRLK3K4HSRL4ves1+ADwBczOS/OD6ZoI42qH5SIAwz2wIkwMaYVJ5MphAv sBYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=MHoStDTo; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o7si50803744pgq.459.2019.08.05.06.41.11; Mon, 05 Aug 2019 06:41:11 -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=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=MHoStDTo; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729326AbfHENlK (ORCPT + 29 others); Mon, 5 Aug 2019 09:41:10 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:33896 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726620AbfHENlJ (ORCPT ); Mon, 5 Aug 2019 09:41:09 -0400 Received: by mail-wr1-f65.google.com with SMTP id 31so84500239wrm.1 for ; Mon, 05 Aug 2019 06:41:07 -0700 (PDT) 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-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=QkeX6NkW0m5Z8RGRg2N9ngDb6LpO7xgNL1PUBTCrb4VqWY/qeSlix0Yh97mLZn6mCm Q+9XgqevaIWnVT4tGOMtNKg4IJXEdNQv/fBr90wI7d9KDaNpPVR8SHZUQRnhZXPxhNqu 9mEpcj1PK1IgI2qytJlXjRzhtFPe1Pf18mKE9ceq4L3O9DRDCmMc/eKx+K60ZKfRHzAB hLFMhka0qvBHs42ZsL1EetT0EfN9HwnGdr2MiZPk7yCs7k9sSn94usTgNXjcilrndpBk ycOlJmvp6B1COHFFyJnu2HKS9Okmj6j0kXAaSlZWDgaunc8iwcypHFuz1rDtXes6I75L skLQ== X-Gm-Message-State: APjAAAVr1k6NgrQrB53tXmLMVlFGhosIG+LxPHDgTZaKtd0nytgvmvfK fidmAhXJKL94kZHBVT5sAm6Vo6x/fcg= 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 Cc: Jerome Brunet , Kevin Hilman , Jonas Karlman , linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(-) -- 2.21.0 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,