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, From patchwork Mon Aug 5 13:40:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 170550 Delivered-To: patch@linaro.org Received: by 2002:a92:512:0:0:0:0:0 with SMTP id q18csp4312015ile; Mon, 5 Aug 2019 06:41:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqxNn31cihaCRFvFzIM91cY3orZ7eFY3mQgFKlizuh3Pfz5d7nxlbXvkTZnN/sERgOM2xieY X-Received: by 2002:a65:528d:: with SMTP id y13mr48770273pgp.120.1565012476179; Mon, 05 Aug 2019 06:41:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565012476; cv=none; d=google.com; s=arc-20160816; b=PUUlZpdBw6/n4kCpgsD1ep2SjTMqwL0SB2m/jewuT/kDfaxE8yu8OE9AbEoFOGMSqQ aOJDmSDjSJDIE7NcmBYhivPxvOMFyQrzcqP8XVz8HOeCfXbRd5/Xh3Csbtow3uHtRcIB P3qsZ95yoBY1kOQwcaFzl6vCdzKs1U+SmZ3PRazAwm5lcsNJjcQoLaEBHg7SqX+bpczN zxNnEliWLAlzDjYEq/IAFP7H+NsQJV11d5+MoFlkXUhDL2QZsIMaCOhToJoo82Deq7XA Z/FIQyz9nno0zM7BLp97ZJmdDyywwoJ4dRHRzNCdoWYS2EwXwe0VC3vFYDL8fp57BO/T UUpg== 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=GncMVDz5Vd7/NEmfnXs9hYV3ld42S/SQ0pl+I46T4l8=; b=USLi9t4080rM9p4P88WaYmVgGnX9GT4beX+dFpaT7NUixJgx2MYh+1/+jddv7/nJ7K wurJ2uVLp+sNt7tOqixvgLH4Jz7/7zkvhIR+vaZLuYW87nUExCjOF+wSGkC/ngaOIH7S 5b+9VCeuSJQQ+XupawWmR6AdEbfARYZDKrRl1nuoJDoQ6notCxgQs8HtQSP56c0zgW3I RZo5eBZECsj/4G6jcyizdhgGMvhSiPqG+q+WCupLyECpJq5hEASRLdnPYAROIroNR9Ci v5GMUOF5aNrSPQqm1vJgV3WvxA0gpKI3lXcW5BDo2ggTL1TQ/YtDf/c7lF+R+LL8KMSz z10A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=o9lEr+Sk; 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 l185si43718267pgd.379.2019.08.05.06.41.15; Mon, 05 Aug 2019 06:41:16 -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=o9lEr+Sk; 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 S1729458AbfHENlO (ORCPT + 29 others); Mon, 5 Aug 2019 09:41:14 -0400 Received: from mail-wm1-f68.google.com ([209.85.128.68]:53341 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726508AbfHENlL (ORCPT ); Mon, 5 Aug 2019 09:41:11 -0400 Received: by mail-wm1-f68.google.com with SMTP id x15so74813053wmj.3 for ; Mon, 05 Aug 2019 06:41:09 -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=GncMVDz5Vd7/NEmfnXs9hYV3ld42S/SQ0pl+I46T4l8=; b=o9lEr+Skep04ad2BOwbVmN36Q5i0vAAvaall6aKeayBrBMJfcswlnOFmDDkEyHqQvz l6r6b5ma5Uw8b97m/7ZdXjYphKsrWHAUoFElJMElt217BZVGYEeVFpBkrywXBYBmgd8e LRVFIRSCpBzGhiJubWPADBLwMBClmqU4YEgVS6nU5tjNFdfT62fkfU654GJ66Ag0ZNx9 pbvJ6dfHI0YEmy8RC+gxOa/BDRkSa9K9AIQf0W4tEZwmcyDboR8Aj0mknHwOr5mXBBsY QSGmdro7WtQgXW5fDZdvzazaYQjg5h3dgprYSG8hZpH3J7DkCkOYvIX366+tCyK6L2Qu tSew== 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=GncMVDz5Vd7/NEmfnXs9hYV3ld42S/SQ0pl+I46T4l8=; b=rYZzhtxikGc6pP7AjPnbc2afCpxcxGpOFWfC50gLb54WrZQg8+a4W5ibx7PDWcsyXO ngG+nLlf2e4wz0z+7RWiEB2JxPVbd8ErHQxUSvktdhJ+i5jLuLRIUmFQAbTX4SDd/8NO FojPnCBgOKpwXyEkYP5ed8RCehCzkCOP3LzUmL2GsYMKvbNsyXbtVUpcIWFdp3nFQIl6 hOSN/IOXjN7r8EK1OE31p0o16ZedgK76ptBkMqnyUYJSQnB5ygOOeDJm0yAFZBimvkjU 3lK9QvaQKPB3omAtt2BH6ry/bsUWjjgYNyDJIgvSTdAxa7fm/wWzGnSnNewV7ZPWYnhj RfOQ== X-Gm-Message-State: APjAAAVT+GSW8CzNa+4Ows0lK0pEG/e9oWx0URTaGE8hcEHcEhdv/x8W UkwWlGibBI+ZRPFnC6jV86RWzw== X-Received: by 2002:a1c:e710:: with SMTP id e16mr19446088wmh.38.1565012468451; Mon, 05 Aug 2019 06:41:08 -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.07 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 05 Aug 2019 06:41:07 -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 2/8] drm/bridge: dw-hdmi: move audio channel setup out of ahb Date: Mon, 5 Aug 2019 15:40:56 +0200 Message-Id: <20190805134102.24173-3-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 Part of the channel count setup done in dw-hdmi ahb should actually be done whatever the interface providing the data. Let's move it to dw-hdmi driver instead. Signed-off-by: Jerome Brunet --- .../drm/bridge/synopsys/dw-hdmi-ahb-audio.c | 20 +++--------- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 32 +++++++++++++++++++ include/drm/bridge/dw_hdmi.h | 2 ++ 3 files changed, 38 insertions(+), 16 deletions(-) -- 2.21.0 diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-ahb-audio.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-ahb-audio.c index a494186ae6ce..2b7539701b42 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-ahb-audio.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-ahb-audio.c @@ -63,10 +63,6 @@ enum { HDMI_REVISION_ID = 0x0001, HDMI_IH_AHBDMAAUD_STAT0 = 0x0109, HDMI_IH_MUTE_AHBDMAAUD_STAT0 = 0x0189, - HDMI_FC_AUDICONF2 = 0x1027, - HDMI_FC_AUDSCONF = 0x1063, - HDMI_FC_AUDSCONF_LAYOUT1 = 1 << 0, - HDMI_FC_AUDSCONF_LAYOUT0 = 0 << 0, HDMI_AHB_DMA_CONF0 = 0x3600, HDMI_AHB_DMA_START = 0x3601, HDMI_AHB_DMA_STOP = 0x3602, @@ -403,7 +399,7 @@ static int dw_hdmi_prepare(struct snd_pcm_substream *substream) { struct snd_pcm_runtime *runtime = substream->runtime; struct snd_dw_hdmi *dw = substream->private_data; - u8 threshold, conf0, conf1, layout, ca; + u8 threshold, conf0, conf1, ca; /* Setup as per 3.0.5 FSL 4.1.0 BSP */ switch (dw->revision) { @@ -434,20 +430,12 @@ static int dw_hdmi_prepare(struct snd_pcm_substream *substream) conf1 = default_hdmi_channel_config[runtime->channels - 2].conf1; ca = default_hdmi_channel_config[runtime->channels - 2].ca; - /* - * For >2 channel PCM audio, we need to select layout 1 - * and set an appropriate channel map. - */ - if (runtime->channels > 2) - layout = HDMI_FC_AUDSCONF_LAYOUT1; - else - layout = HDMI_FC_AUDSCONF_LAYOUT0; - writeb_relaxed(threshold, dw->data.base + HDMI_AHB_DMA_THRSLD); writeb_relaxed(conf0, dw->data.base + HDMI_AHB_DMA_CONF0); writeb_relaxed(conf1, dw->data.base + HDMI_AHB_DMA_CONF1); - writeb_relaxed(layout, dw->data.base + HDMI_FC_AUDSCONF); - writeb_relaxed(ca, dw->data.base + HDMI_FC_AUDICONF2); + + dw_hdmi_set_channel_count(dw->data.hdmi, runtime->channels); + dw_hdmi_set_channel_allocation(dw->data.hdmi, ca); switch (runtime->format) { case SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE: diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c index 218a7b2308f7..be6d6819bef4 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -645,6 +645,38 @@ void dw_hdmi_set_sample_rate(struct dw_hdmi *hdmi, unsigned int rate) } EXPORT_SYMBOL_GPL(dw_hdmi_set_sample_rate); +void dw_hdmi_set_channel_count(struct dw_hdmi *hdmi, unsigned int cnt) +{ + u8 layout; + + mutex_lock(&hdmi->audio_mutex); + + /* + * For >2 channel PCM audio, we need to select layout 1 + * and set an appropriate channel map. + */ + if (cnt > 2) + layout = HDMI_FC_AUDSCONF_AUD_PACKET_LAYOUT_LAYOUT1; + else + layout = HDMI_FC_AUDSCONF_AUD_PACKET_LAYOUT_LAYOUT0; + + hdmi_modb(hdmi, layout, HDMI_FC_AUDSCONF_AUD_PACKET_LAYOUT_MASK, + HDMI_FC_AUDSCONF); + + mutex_unlock(&hdmi->audio_mutex); +} +EXPORT_SYMBOL_GPL(dw_hdmi_set_channel_count); + +void dw_hdmi_set_channel_allocation(struct dw_hdmi *hdmi, unsigned int ca) +{ + mutex_lock(&hdmi->audio_mutex); + + hdmi_writeb(hdmi, ca, HDMI_FC_AUDICONF2); + + mutex_unlock(&hdmi->audio_mutex); +} +EXPORT_SYMBOL_GPL(dw_hdmi_set_channel_allocation); + static void hdmi_enable_audio_clk(struct dw_hdmi *hdmi, bool enable) { if (enable) diff --git a/include/drm/bridge/dw_hdmi.h b/include/drm/bridge/dw_hdmi.h index c402364aec0d..cf528c289857 100644 --- a/include/drm/bridge/dw_hdmi.h +++ b/include/drm/bridge/dw_hdmi.h @@ -155,6 +155,8 @@ void dw_hdmi_resume(struct dw_hdmi *hdmi); void dw_hdmi_setup_rx_sense(struct dw_hdmi *hdmi, bool hpd, bool rx_sense); void dw_hdmi_set_sample_rate(struct dw_hdmi *hdmi, unsigned int rate); +void dw_hdmi_set_channel_count(struct dw_hdmi *hdmi, unsigned int cnt); +void dw_hdmi_set_channel_allocation(struct dw_hdmi *hdmi, unsigned int ca); void dw_hdmi_audio_enable(struct dw_hdmi *hdmi); void dw_hdmi_audio_disable(struct dw_hdmi *hdmi); void dw_hdmi_set_high_tmds_clock_ratio(struct dw_hdmi *hdmi); From patchwork Mon Aug 5 13:40:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 170551 Delivered-To: patch@linaro.org Received: by 2002:a92:512:0:0:0:0:0 with SMTP id q18csp4312039ile; Mon, 5 Aug 2019 06:41:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqyqXD9LB0yc5qB+YO+5AixDifJMU+jbC2zRVntBSA8/T4wzkdV2THUkwtQphP3jd8awXkOR X-Received: by 2002:a17:90a:c20e:: with SMTP id e14mr16019719pjt.0.1565012477709; Mon, 05 Aug 2019 06:41:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565012477; cv=none; d=google.com; s=arc-20160816; b=NfrBRK6Ztuoyls3zuY92cMqec4ZwH8bT/QWrWYioztlRF7MpOV0i5jhM/CY272AYki K1//u2/kvToYy2gDFaQR5rKsvu78iPh2SRBnOp6PLdLZBUA55n/Mm3I4JEUfyaPbkOzp HCcSEK9nPmHULmYFTDp5R7vcnXXQNKsaZhJExAy/poUAI8aVZcydr8ZFCPl3Cfa8J7cX QRhaQilJipmkzDEhPUf4BHUwmNZpV9SvjBzRr/277ksvcOtx/80h+K8d4C4um4HNArBf FgPP3+QRBdDNV4JxSqQ3uNgDl5M4Mz0otG1N7Lg/htt2X0oIl7Hrt6dJrUJlHWB6vkkd Re0g== 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=BuuMX+kd4A8dEfG3qDO6RvK4XQjF8g/kyhgS9BKn3r0=; b=lEjyAT+mFyZKx+Je5DZBNCe1WXpUU6N9tfw9E3I5WEk8pa+H33fJEcGrRysllIerQU xVFvEgEWSQGbetv8udMxk8owmWjN85hnE5Gb/al+MiXGg6021sAkNr/cj+8gn3KWz1Zg EBWzmoDXd56fm7mkZMt2EFdhaIe5miaOzG7FRm2Uk71SxEsqiiIEDWaeNk9BlWiEsL8K Yzws+MY9FvMw6FdaO10xNXvQ9uV5OS5o6ZKQpkvky+4BZX7A3pC/x5uhsMaESPQlpGUY dpoYlv3BgA5LrdOt3hJfKAhLLmSzLz8h2+C7aFLC2afFGSGriIgrGTR2mhE3vivhOasz TKwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=qJD4gdHb; 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 l185si43718267pgd.379.2019.08.05.06.41.17; Mon, 05 Aug 2019 06:41:17 -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=qJD4gdHb; 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 S1729594AbfHENlQ (ORCPT + 29 others); Mon, 5 Aug 2019 09:41:16 -0400 Received: from mail-wm1-f67.google.com ([209.85.128.67]:36225 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726620AbfHENlL (ORCPT ); Mon, 5 Aug 2019 09:41:11 -0400 Received: by mail-wm1-f67.google.com with SMTP id g67so68952475wme.1 for ; Mon, 05 Aug 2019 06:41:10 -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=BuuMX+kd4A8dEfG3qDO6RvK4XQjF8g/kyhgS9BKn3r0=; b=qJD4gdHbnAzeFnPvKM+8j1gE58vTH+WCsmheK6fZFJnnrjUDw3nFKihaYFnoE5elar VG/+rWF3g2A+JcgymCXaFsEXgyJnIDT+hsLYwH+ybejdUeXdVh+RW4+FCuhzOoHzFNhg xOrmmMM+mhlrnr8Uw1NRZC6uFoFHjrKT5BQwTbPRiu4nacBAy5VNHoh+jSh40BsBm18T 6OL8lWqJbAd4NDQsli32/MMIb20OPlIijh/jr1av7S2+rO1NNzTVkNTHRxzTR5WkVK8J RuYhO1fRZtrG7pz38v4Jr4FGft+lJR8YOPshh9Z5oJG31mIsgetJj3pEQPHxeyf37eWK h4tw== 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=BuuMX+kd4A8dEfG3qDO6RvK4XQjF8g/kyhgS9BKn3r0=; b=W3P2tKk9j+ti8vd5fEfG3CN15hBOv4kXSR4E+Fs9ZcXPAYSgidZew7GeOx4EsSMbc+ TeZPKDHkJbvP4Cz8qNDJJ3mlMIPIiS9q26+RfFAG0a3OE9QuM15Pm0F/aKY4CTf1nPv4 m7hqEMT8cTq0k+jBg6K4F26VExXnG6T47KVynIL0BxfNDI/gThhpoZY0B+0fowFJo5Gi dQj07TV5exQgMI/eCDpuDRweR6wORewKtrwOJrQm56SF3Upq7/zcXygXKxixJPSqqBUn baKazH1Fv1utgnasDSsvlcZXsgMoxNc763xXlzDI+h0OPmi4Ozs5NiJyxZ28oNpPUrnu aKmw== X-Gm-Message-State: APjAAAXOcR1chCAa+jCrLgWXJnBWxHdvHgUaUPy/xD6CK2SpeK7CeL92 V8emaWODTe+Kx+CqUIa1PyeNUQ== X-Received: by 2002:a1c:630a:: with SMTP id x10mr19986559wmb.113.1565012469416; Mon, 05 Aug 2019 06:41:09 -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.08 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 05 Aug 2019 06:41:08 -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 3/8] drm/bridge: dw-hdmi: set channel count in the infoframes Date: Mon, 5 Aug 2019 15:40:57 +0200 Message-Id: <20190805134102.24173-4-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 Set the number of channel in the infoframes Cc: Jonas Karlman Signed-off-by: Jerome Brunet --- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 4 ++++ 1 file changed, 4 insertions(+) -- 2.21.0 diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c index be6d6819bef4..bed4bb017afd 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -663,6 +663,10 @@ void dw_hdmi_set_channel_count(struct dw_hdmi *hdmi, unsigned int cnt) hdmi_modb(hdmi, layout, HDMI_FC_AUDSCONF_AUD_PACKET_LAYOUT_MASK, HDMI_FC_AUDSCONF); + /* Set the audio infoframes channel count */ + hdmi_modb(hdmi, (cnt - 1) << HDMI_FC_AUDICONF0_CC_OFFSET, + HDMI_FC_AUDICONF0_CC_MASK, HDMI_FC_AUDICONF0); + mutex_unlock(&hdmi->audio_mutex); } EXPORT_SYMBOL_GPL(dw_hdmi_set_channel_count); From patchwork Mon Aug 5 13:40:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 170555 Delivered-To: patch@linaro.org Received: by 2002:a92:512:0:0:0:0:0 with SMTP id q18csp4312425ile; Mon, 5 Aug 2019 06:41:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqxj1S//z+rb94Wy+wlBRAH6YwFlee31OowGCIT6X2P5kla8ws1tDdArbnYqwtoBHoEv7oFH X-Received: by 2002:a17:90a:109:: with SMTP id b9mr17365969pjb.112.1565012497521; Mon, 05 Aug 2019 06:41:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565012497; cv=none; d=google.com; s=arc-20160816; b=iKTMLm3g1SNOsHi+1pylBzyvN9qiOS1i35xPtV2b/2xQze19CqjQ8Nxxh7wm9yucWf m4JF6N+LsDzUlKbY2X3zUSxm/9wjzcS1o4ckMjXF5UxZ/9Lx78DinYSrpYzFrccIsEUc 6NNpHc8lUo1xqzn2WVD6TroKM7cwyG/yV4DDs6NfO3+0e0r1OKfgPpK2VKjdPxZIos9H YHq+e4PnzhlBe491wW33WTIgzQH/FV1lGG0BO8bIPIn4vfP7BM0RH8em0EV66xQZtegB Kn9KIk+1Upg2+K5E1IjHHV69rn3fGSh4aMCH/RNBLL2oIloj2zoXAso5vOAEt13bn7sS /mYA== 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=UcxCUBbmcFwMvFJ+lzmbbweMssQIyjYeLgMmBVzMwco=; b=NtEI+oGVAfI+ZzS3GrxhcEeDRE1AGUN5UA+Rwa0/hT2MiXOYdV0aOrHe7KWG11oYOn TEzcyYtcPWztnpBcN6O8hOwrX0L2ChsZmkOUi9FQ2r2qBWMRYXWkeTcVvW/HROCuMRQV lV8qWaqDBUC0jAerF4wccYzYo46tgH05PfSXqmP/FAGj+WoviRLH6YExUKKsskSCRV56 AL9E1P5auO/UELO3STIuhl/WFBABgL5WunH80CroiDk8DMESSlmWT38c4zAFrntzBKkW 8n3pcreN9WSnbmrFNfjYdT7jUqxm+haQcM4MRBAk7fCYCrq4/3SYeIJGdmJI4UX2r8bo nH6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=Z4GCLa3Q; 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 ci5si42832942plb.45.2019.08.05.06.41.36; Mon, 05 Aug 2019 06:41:37 -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=Z4GCLa3Q; 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 S1729900AbfHENlg (ORCPT + 29 others); Mon, 5 Aug 2019 09:41:36 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:46301 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729353AbfHENlM (ORCPT ); Mon, 5 Aug 2019 09:41:12 -0400 Received: by mail-wr1-f67.google.com with SMTP id z1so84466077wru.13 for ; Mon, 05 Aug 2019 06:41:11 -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=UcxCUBbmcFwMvFJ+lzmbbweMssQIyjYeLgMmBVzMwco=; b=Z4GCLa3Qh6Rov0aWhoMvXszTGWjElSstDzL3OKiiBUS0AOCza+chFFm6WBkjsSUjF2 m7xOnP1W7oEWspJ28voCXaybtNQT7tTsqqFEx7HvTKUAU3fYoR5vFmub4pqLSkJuo3oj mBEKL2w8yl024pYq1sCrC4thtkyQj4cTSdS8GOVPllKzjIeuRMOggkUldGnwUXF6GpcE iIi51y/TCARESONkSgnKt7lcAmDGBYh9N3T7XxaRVjeyf/XpaYzK2Aou97XfpPsfE5C8 7aMp3MHGEMwqTxBVSR/K8yqp3Iha6fOWk47mwTZNgm/mf5wWXhqrJXwWnoQZaOfGuF7o qNMg== 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=UcxCUBbmcFwMvFJ+lzmbbweMssQIyjYeLgMmBVzMwco=; b=TDjKQSdzXQy89QHVafZ+sgr7IMWvAc/xc4MjwQT+0//zbyT/s6xF4rYHN9mUbI8j/J WZHpil8LzgDnWqHfQVaZc70k/1YqUO/EtZQQknvo3ZboMviigJ0OCsDQk2vVPHN+E0cd 8yDuTACFu+U45FR5p1DoTE00ljkLA+5DMs5VnTxpA059uak4gSrLSFxJTfYZreLuRnTp p7gQRaDWE5+SvRNMmXdKpZ+c25Dg2rM3OO6QJJlDQ00lFWUbLaeGM3/6Op4ghKwWroQQ 5DEiMK/Lnb6ug/o1/YZopQqdATyJyq5mhH5lhHzM/CQGplR2p5xc7Bf88vp4kIxDoLwP mWVw== X-Gm-Message-State: APjAAAXsT1lQ3Mf5k9eKOAacSCEDanHB/D6LLOUvwNY7f9HMJx6kSpc7 VBL4Z635A1HW12PkCScxcslE4Q== X-Received: by 2002:adf:ef8d:: with SMTP id d13mr157062902wro.60.1565012470500; Mon, 05 Aug 2019 06:41:10 -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.09 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 05 Aug 2019 06:41:10 -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 4/8] drm/bridge: dw-hdmi-i2s: enable lpcm multi channels Date: Mon, 5 Aug 2019 15:40:58 +0200 Message-Id: <20190805134102.24173-5-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 Properly setup the channel count and layout in dw-hdmi i2s driver so we are not limited to 2 channels. Also correct the maximum channel reported by the DAI from 6 to 8 ch Cc: Jonas Karlman Signed-off-by: Jerome Brunet --- drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 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 2b624cff541d..caf8aed78fea 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c @@ -84,6 +84,7 @@ static int dw_hdmi_i2s_hw_params(struct device *dev, void *data, } dw_hdmi_set_sample_rate(hdmi, hparms->sample_rate); + dw_hdmi_set_channel_count(hdmi, hparms->channels); hdmi_write(audio, inputclkfs, HDMI_AUD_INPUTCLKFS); hdmi_write(audio, conf0, HDMI_AUD_CONF0); @@ -139,7 +140,7 @@ static int snd_dw_hdmi_probe(struct platform_device *pdev) pdata.ops = &dw_hdmi_i2s_ops; pdata.i2s = 1; - pdata.max_i2s_channels = 6; + pdata.max_i2s_channels = 8; pdata.data = audio; memset(&pdevinfo, 0, sizeof(pdevinfo)); From patchwork Mon Aug 5 13:40:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 170552 Delivered-To: patch@linaro.org Received: by 2002:a92:512:0:0:0:0:0 with SMTP id q18csp4312086ile; Mon, 5 Aug 2019 06:41:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqxM+/xqRiLRToAQySnY44mUcWJkh2AV9MO6VD1l9L48tZt6q9YGPz6R7+9ahUZqo5obv2vS X-Received: by 2002:a62:e910:: with SMTP id j16mr75140601pfh.123.1565012480137; Mon, 05 Aug 2019 06:41:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565012480; cv=none; d=google.com; s=arc-20160816; b=GvSkN/8Rym1Cw5FHvWe7+QXVpB1YORvTET1llFdDeO2rdJIUP82867IhQF3Eok2087 AvpURL43ddG1XSHEInw1bBK+g42CR81cQQUZHy7MqORME5ujCytFfSSHiLD+w5jtYgQS qK7batFsnzGcIEjJAlmes9iGUer5LSR9ZobfmhiKVRYNYFDV81vR+0fz6AspYjhzaQDB q1/sXAVzdwlrSkABLD1HwbbmSLix57ga/almAntnCMVG5GILrS8UQSfHoGqGhENmxYDz LHKFhm48nRfReGbG5BvTXVcAbt+QSE0JDrrBVpGHabsmcQMubrS4CZ+HrxEwFUtDLVxj DHJA== 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=2grGK+7b0cBByVRRUu0+TFl4ki5jcSq2t6fD2bzIBcg=; b=Nuh86SuBE9SYCBNji6S7ASCunkf4hivJLXbC/+RYGyEr/HW4eO6dtFZNRTKutUjpKP ZsiaX2gNKrTg/PYJJIKCEfonzW/uDjb3fCfC9UTH7QOobW1RqA1KxtlEEvJEhLFMPyMb vdiCkFGcd/DYVd60diDdmo6rRHYc9ey2oFjy/d9YzI8SeEaQn55V6rdIHCqbSKEuCIfK w06UmEM7E/6FvkZrqU2RhJh8dHpPKkGAKjqgqEVYXrlPnLCM8T//pYjNVeYRJ3qevLZe 2m1sttGTlFUoLkRP+IY7z99KPpn2vVYK2UwUUVD34N/4Pg/MQwS4g3jCQo6xB7R61MDg SN1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=XY6BtsEB; 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 t190si42828725pgd.465.2019.08.05.06.41.19; Mon, 05 Aug 2019 06:41:20 -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=XY6BtsEB; 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 S1729659AbfHENlS (ORCPT + 29 others); Mon, 5 Aug 2019 09:41:18 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:56082 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729363AbfHENlN (ORCPT ); Mon, 5 Aug 2019 09:41:13 -0400 Received: by mail-wm1-f66.google.com with SMTP id a15so74795131wmj.5 for ; Mon, 05 Aug 2019 06:41:12 -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=2grGK+7b0cBByVRRUu0+TFl4ki5jcSq2t6fD2bzIBcg=; b=XY6BtsEB1h0Gtg+bL5p1xMMozbLebyArx8o4E98A64UfAQwGnp5hTTSwxO3wBSrqNs sjtDhqO4sss6ywReivGGAP6VbBnP2qbrBZ5RDcxsWDX2P+Q9CaAIWgOrJZQHEH+twJPE C/kxG+bLpg59JjLS7HcM/K2Pehm7/j8fiXU6UnxOoJr101ja8u28RuDLs8CT+zvN5Rvg 2Ns0saVhFskKwefkeTaCx8x6mDEL08r4MclXBIMcTbDgbjKDJp0E1Nz+mXzDNqVCTsRy fUbTPcQbKGuYauyamy2q/FlnfnOy4z8lWR0PNpP7fonXJu8qTymVLyzDNFJJVjFG2kGu yZyg== 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=2grGK+7b0cBByVRRUu0+TFl4ki5jcSq2t6fD2bzIBcg=; b=ZMu/g/4uZ2JYXJIfDViAxZb/BwUkW8niLhJwWH1zKsta+B20aQ2LIUyBHZrdm704/5 2jElQZrb18QBpKQqYaFWeDI3mJPs/bPVYEuCCKiclI5cpgL5lJNUNAvqsfqMZPCmR5ei AUQwvryRoSTbiWEz5Ply8Mgold41lEY1yqNRNfewiEIUW3Jwx1w0H77cTxODVSqI3s4U 1aw0rUm60O+Q0QzoP5KZXmw0GHDdOBtvdrd23WDLdABQ/28Y3eeAbNM2c1oPeU6hMxiS aTEtNZq/g0mROYUlby7HbVHtJ1L+k/Cn3pKe80Y1DnY34RnbKcmr5fR+ODEcRQA3dErC rV6g== X-Gm-Message-State: APjAAAU7pi1IEmSECNEA8X7zJG8vPOwWiZ8xENAgB/4Tj+epCv/D6xuN gF1lSaBnDJzzQJ1PXBsFTdVsfQ== X-Received: by 2002:a1c:a7c6:: with SMTP id q189mr19275733wme.146.1565012471772; Mon, 05 Aug 2019 06:41:11 -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.10 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 05 Aug 2019 06:41:10 -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 5/8] drm/bridge: dw-hdmi-i2s: set the channel allocation Date: Mon, 5 Aug 2019 15:40:59 +0200 Message-Id: <20190805134102.24173-6-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 setup the channel allocation provided by the generic hdmi-codec driver Cc: Jonas Karlman Signed-off-by: Jerome Brunet --- drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c | 1 + 1 file changed, 1 insertion(+) -- 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 caf8aed78fea..0864dee8d180 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c @@ -85,6 +85,7 @@ static int dw_hdmi_i2s_hw_params(struct device *dev, void *data, dw_hdmi_set_sample_rate(hdmi, hparms->sample_rate); dw_hdmi_set_channel_count(hdmi, hparms->channels); + dw_hdmi_set_channel_allocation(hdmi, hparms->cea.channel_allocation); hdmi_write(audio, inputclkfs, HDMI_AUD_INPUTCLKFS); hdmi_write(audio, conf0, HDMI_AUD_CONF0); From patchwork Mon Aug 5 13:41:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 170553 Delivered-To: patch@linaro.org Received: by 2002:a92:512:0:0:0:0:0 with SMTP id q18csp4312165ile; Mon, 5 Aug 2019 06:41:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqxcQiYOWVAYVeW6r1YwIexj93uCLFrHdCaUC0hiYZtnMd4ZwWhaqoSt7InFUFirEU7uFoep X-Received: by 2002:a63:e54f:: with SMTP id z15mr135920012pgj.4.1565012482978; Mon, 05 Aug 2019 06:41:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565012482; cv=none; d=google.com; s=arc-20160816; b=n8jH+RXh84/rE4J5YELzYo3ftwIQFAert/oDVzse8FAZB7AnjGxp+Lm4fvx/ld+xgL qUlU7105z8XlK3ZNL73jHlBhyAAIKXGb1Ad6phnagnZtcp0WVFKTX1BPHChJw4aDhQak qqU5ez0lEVjq6NyDU3M5/ZRB6i/qaesF3wJ8maxUqrSTlL2BR0OFSpfwFBFvWvS6rsWA 3ZBgZV+MqbtOp5tddS9YemifibyQi6SzDFwqHXvliX1kPDLEhH3O7J80BqqnMXc/droJ wTHX6UDk1idQu7Qcg1l1S+xCBLDW42IdWRRUAHMz9FQ8yiCX3rTqyRu+Kvb+lF3bTVUy eCgg== 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=qVzaYwLQ0IyryucLyxiH/odxXJQTMSx5Nh4LY6yGL/I=; b=zqcbeFFw4/FTGT8SWKLLezHrtdpDAkDmpaQCfRRlyJ09xBj6vMzDb9XK4GDR+zUCvY Pb42xpKiLHq0b8fzRmQGBkzDCOexpuBHLeGoH6ppLZIhkv66AE8Nl3BkApT3eIeYGJLV ew019D6jXaX2et4idorib2LJ4cLJdzc3/p3xvSJGrFI13C8woJSF4OGmgyjQ6Vu0CXgc 0X8d/0lGU06Tqr5waxs7Qkm98M6hTvYcJ6K43QsTW3y/+rxXIg0xcOzZ5nHsLayqR1Ah f75S1ppIoxqMf1ch0ekMMcIvQTUzGXZT22ITVgNmywZHB4nCuLEFBnP6Jzzm/VzJ6p6u iplQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=f2kDgP14; 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 ci5si42832942plb.45.2019.08.05.06.41.22; Mon, 05 Aug 2019 06:41:22 -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=f2kDgP14; 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 S1729786AbfHENlV (ORCPT + 29 others); Mon, 5 Aug 2019 09:41:21 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:40931 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729387AbfHENlO (ORCPT ); Mon, 5 Aug 2019 09:41:14 -0400 Received: by mail-wm1-f66.google.com with SMTP id v19so73084874wmj.5 for ; Mon, 05 Aug 2019 06:41:13 -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=qVzaYwLQ0IyryucLyxiH/odxXJQTMSx5Nh4LY6yGL/I=; b=f2kDgP143d0HrJANosipnWVMoq01I+69xpPIahSbB00o59IrM6ocWRY8N8/9bj7/r/ 7Uk7JljTqjtYeSAgptE9vL/QG3qBzfbzMUwGvWDITSnZ5bS/CFvai/L1kZl3KAgNUydc wfQRJzatabV0duadNUeHxb5UbJ/L+g3hbd3XvyesDOHOYBnEflfp5ZYTY2bBRxmw1d9c kAvctaIY0WFROtJ3UZs2ChJ1EwKa/fgxo3taxsCN4XaadvYsE1qia05ZI/KlLnLBGpjF AuM13Dt6JP/0YB+USV+ZRAnP+tS3fouv2TTRnf1QxrelQhADnQPvu6ut5QpSdBSV7BJa NHXg== 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=qVzaYwLQ0IyryucLyxiH/odxXJQTMSx5Nh4LY6yGL/I=; b=PhHaYdULOubzAnujOJ5ttc9mWGSDxF2+5Y1YhpDtsV/HCoP1P0hy0emFLVppGHbQd1 n6YX4kseMbCfNFulcYwVi3WapGaPhNKTm09BT2D3TOIyS5fyxezADEcnzbW6P4E+EMUx y+YWVpUPcxMbnoRKkCi045oZZ72AWA7GmSkSbG/kEsR+MMf2Na1BmTbJD6KfaK2nU+PE g/8yFw3wBVLnqDnkfgRFxOQd2iYi0b6RfnBkfv3Ag0Aaezl0MvZwHGda6H1D1XyH7zMA V1ClENolHpyDYYKAZVGISpPhIcPKSdcaP6UM5TuLlU4dGzJEwPMOf5lOYa96CFomt1sk W9XQ== X-Gm-Message-State: APjAAAXqI2UunfDfn0emdCHJgBfPNvMJuu+NRjWqhMk0MyNrhN6Y1hc9 FwDKcjW2oHVm48VxscdtKa3Ukw== X-Received: by 2002:a1c:a8d7:: with SMTP id r206mr19116418wme.47.1565012472683; Mon, 05 Aug 2019 06:41:12 -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.11 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 05 Aug 2019 06:41:12 -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 6/8] drm/bridge: dw-hdmi-i2s: reset audio fifo before applying new params Date: Mon, 5 Aug 2019 15:41:00 +0200 Message-Id: <20190805134102.24173-7-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 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 Cc: 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(-) -- 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 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 */ From patchwork Mon Aug 5 13:41:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 170556 Delivered-To: patch@linaro.org Received: by 2002:a92:512:0:0:0:0:0 with SMTP id q18csp4312193ile; Mon, 5 Aug 2019 06:41:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqwzpp2yHm7Rz+PE6LYIcyusyaX3GTboiHJ0GaxcUpIw/q5M6TEEnj2X9xeNKxhqGinrhzHk X-Received: by 2002:a17:902:ba8b:: with SMTP id k11mr144179791pls.107.1565012485357; Mon, 05 Aug 2019 06:41:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565012485; cv=none; d=google.com; s=arc-20160816; b=eRgYKB72U1HayUQlWt+2CsKKUrhtj0Kn9j040Eq/hYXIabCclOWvNIDDwjZiLrbbDU HiTcZAaUyFd+MKXxh0h4E0MQmbG2Znc5OCyE74xHpRlqb/RFiu/Sx98Ti4tq6dEURzcz N6FFDI00u+yl3lV4jazw3R7JCJm9HAAmU4Yw4Z5VPhSgAxH5NsROCfI8jasxshme5/xI my9e1llr8+DijG0CjQ6T6SYBydYr3W0VVv/waMf/m2YlKyY8uBhpzdny/X/SxlTcjIO5 JGBIseVQSOt87DimY9897CMEQ4TKSmsiUlhQ6lN7vycU8Wm6sq5p8ywnpELGoUK2GLDW +Ntg== 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=ey1PsfmA4wlAavqiJpE2shxdYitiWZIgciri4C4xXGA=; b=FZIIamtZC2IPkAbfMDmajOmQ9YUVwN19aR7zElXCA4Q5GR2umv6V5N1oDwWfWUSuIh QzhroBI9C0lQrkh5MtW+SzOwpCuHwhTuVTobeEH+71L61GzqQbpK3fsntwPhIYjROpmM ndOi2JOOM9X3EPsMlhwqz6kHlJGBGDXcWq+z69xoBQNVmc1viTv5YuinlBO/YoNHRuDf 3Pf5yEeHtM/QRZ7xKBv3vlSlpMjSSk8bYi4jSJTvw7/X70oN3YgP+lQXoVE5MB8r6hbB z542nnk3CQ2tZK5zu5gHTF80fs6ZqtGTeOFSmdzerxdti0j+InUJYGn1KyeV4WYqUOlx bORg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=NNOrlaFb; 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 ci5si42832942plb.45.2019.08.05.06.41.24; Mon, 05 Aug 2019 06:41:25 -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=NNOrlaFb; 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 S1729732AbfHENlU (ORCPT + 29 others); Mon, 5 Aug 2019 09:41:20 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:41125 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729437AbfHENlP (ORCPT ); Mon, 5 Aug 2019 09:41:15 -0400 Received: by mail-wr1-f65.google.com with SMTP id c2so81242799wrm.8 for ; Mon, 05 Aug 2019 06:41:14 -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=ey1PsfmA4wlAavqiJpE2shxdYitiWZIgciri4C4xXGA=; b=NNOrlaFbC6G9Tou31NekV1Ouhhn/xSj9Bsy90P1UEbm9ZP4Ce+OUczmhiGXI1ortyf 2+rUNATxBIW1waSope2cT9bIGUYin4pyBuxmnAHJfu6Vjv5a2XuaMSLVfG3efjSrQMvL X+3Pi9ZFuqSeRI1KjrdTuTuEU7uVgp1WkeHlEjloWwne4xg3mV0ntH30tYf0c0H+kT79 PTNP2fCK79k7vGVZ5DLBrnkGQ51nMN/pqEpOkFJAa6odkJFZey9yrmS56oooI7KhcrpO EgafSUEQpDbkkZkIXzJBd2wOsG/3Hwx2wFOw5DwpDWZRjOuMuA4jfAB8FFpHUaKb66L3 Wmig== 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=ey1PsfmA4wlAavqiJpE2shxdYitiWZIgciri4C4xXGA=; b=FmGXmMC2eSoZ2o5JPLx0ervXep+q40Q1RLYgRGxegcU8q/2G0y4O0ofn+Vr4D+t1JP pVGtQWMwBC3UOiM6TARfzjEbGEOTiyix5FOlASDCOijQ3W4V1d4/27o8SYZjn5Fn7lEK v8cYRljGAJLL6NI0gN+ieHcqSBbgyi8FtrxFhWV7fxAxp9IUhGyYTmfhVpauaB7R+/JJ tmXvhZMQViCRwOwDu9suPTIzP4B7/VSUIlGNEP4pkmWlTEzIsBd4WRWwb4gvHQ1duFko TchdDps2XQxZCqxr53Qmj1trrqgZ836wp238gxOP9PI2UkLA6qnQWchvxIhWJei4oHPk rSdA== X-Gm-Message-State: APjAAAVUD34aE1IDaoIMyzS1rw3p8+dl8lh+nKku8yxeqqdsmnso0/0r 9Ds3eXwkYJ1Nn4nhmUVYQtrZuw== X-Received: by 2002:a5d:514f:: with SMTP id u15mr16161947wrt.183.1565012473623; Mon, 05 Aug 2019 06:41:13 -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.12 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 05 Aug 2019 06:41:13 -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 7/8] drm/bridge: dw-hdmi-i2s: enable only the required i2s lanes Date: Mon, 5 Aug 2019 15:41:01 +0200 Message-Id: <20190805134102.24173-8-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 Enable the i2s lanes depending on the number of channel in the stream Cc: Jonas Karlman Signed-off-by: Jerome Brunet --- .../gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c | 15 ++++++++++++++- drivers/gpu/drm/bridge/synopsys/dw-hdmi.h | 6 +++++- 2 files changed, 19 insertions(+), 2 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 41bee0099578..b8ece9c1ba2c 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c @@ -54,7 +54,20 @@ static int dw_hdmi_i2s_hw_params(struct device *dev, void *data, hdmi_write(audio, (u8)~HDMI_MC_SWRSTZ_I2SSWRST_REQ, HDMI_MC_SWRSTZ); inputclkfs = HDMI_AUD_INPUTCLKFS_64FS; - conf0 = HDMI_AUD_CONF0_I2S_ALL_ENABLE; + conf0 = (HDMI_AUD_CONF0_I2S_SELECT | HDMI_AUD_CONF0_I2S_EN0); + + /* Enable the required i2s lanes */ + switch (hparms->channels) { + case 7 ... 8: + conf0 |= HDMI_AUD_CONF0_I2S_EN3; + /* Fall-thru */ + case 5 ... 6: + conf0 |= HDMI_AUD_CONF0_I2S_EN2; + /* Fall-thru */ + case 3 ... 4: + conf0 |= HDMI_AUD_CONF0_I2S_EN1; + /* Fall-thru */ + } switch (hparms->sample_width) { case 16: diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.h b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.h index a272fa393ae6..6988f12d89d9 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.h +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.h @@ -865,7 +865,11 @@ enum { /* AUD_CONF0 field values */ HDMI_AUD_CONF0_SW_RESET = 0x80, - HDMI_AUD_CONF0_I2S_ALL_ENABLE = 0x2F, + HDMI_AUD_CONF0_I2S_SELECT = 0x20, + HDMI_AUD_CONF0_I2S_EN3 = 0x08, + HDMI_AUD_CONF0_I2S_EN2 = 0x04, + HDMI_AUD_CONF0_I2S_EN1 = 0x02, + HDMI_AUD_CONF0_I2S_EN0 = 0x01, /* AUD_CONF1 field values */ HDMI_AUD_CONF1_MODE_I2S = 0x00, From patchwork Mon Aug 5 13:41:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 170554 Delivered-To: patch@linaro.org Received: by 2002:a92:512:0:0:0:0:0 with SMTP id q18csp4312293ile; Mon, 5 Aug 2019 06:41:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqxDe3ph6F3jQhutJVn4zu+5zxfp09Ic2nPMFjNekhfsld1WcoueD36anhSrc9vupFGxD+Sp X-Received: by 2002:a17:90a:2163:: with SMTP id a90mr17422018pje.3.1565012488997; Mon, 05 Aug 2019 06:41:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565012488; cv=none; d=google.com; s=arc-20160816; b=cxGO2R73tY5yZYzrkrAI9ocQh/xuq3iXUeZufvjKi0kufug4gvh3IyK/8mo6T1E2iu oaiCgd3X09CYIfqnZq4Xl9xBcMOTt1whlX/qaGHd00kY3Ja0wsWDBwHwDngwo/U9/LWh VwEhLtzjVKu7JGWXPwc8Xcnclx+cw5Nyuk4Sx9WTzy+neNJonsj7ZxOu5/EggCPl1rm2 LTFJkp+lfQZdnaaDeHwK3KMISlYsEvyQ05wHLacLh5nthMszjWCDPhl0DwwrVXvUx2W6 rSDK082LEFdl9n2F79poEgvuQ7Wgzbc5TxLNUdG558x0jw+RJ0crKOlK21METsilYXuH ZsaQ== 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=x+WcHBmr4prRt0vIkSfM9PPUqwEgU3pvt4JgB//l4IQ=; b=NVdmHlFeku2iSujaL/jNQVvvUir0ltske/NiMWlpajVnmr6H8g3WJ2PtSI3P74oaWj N6Aiowlr5u3ZT8NyBZb3MSZDzWh/pJOnZLxQp6e2VQm6clb0KJkbk9uC3BFDScD2YHFS ZkicuPLiA7jZV4kdDxyKrbnH8tCyOc0RL2PTJXRQN6KnBDUpTeRHN/6cM70+I5ZR4iwN LIe/+bjrxFQxXmQGa+EjOQHvn9EFDtPIAZfWmftA7o6ztP6JHOqNo9qE+Sz+LzVVh4wY RjJ3rJbJzJi7ZykE9wnvpo8ayXer8PwLxiVWToXJv3/WpPUY6i+B0PyWbrp25l858l3u BxcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=djq1XNNC; 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 ci5si42832942plb.45.2019.08.05.06.41.28; Mon, 05 Aug 2019 06:41:28 -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=djq1XNNC; 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 S1729824AbfHENl1 (ORCPT + 29 others); Mon, 5 Aug 2019 09:41:27 -0400 Received: from mail-wm1-f68.google.com ([209.85.128.68]:50497 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729489AbfHENlQ (ORCPT ); Mon, 5 Aug 2019 09:41:16 -0400 Received: by mail-wm1-f68.google.com with SMTP id v15so74808146wml.0 for ; Mon, 05 Aug 2019 06:41:15 -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=x+WcHBmr4prRt0vIkSfM9PPUqwEgU3pvt4JgB//l4IQ=; b=djq1XNNCaa80etpmbt/t52jE3VOpu447E/HlXbMrdXc4UCAeGM1biJA8j1G/SxpTSI v+VzJq4HpD++RmUH3M6U3m+jS8S2emGkORh5sRBm2LnD9l6vrNZNF8aqU+4Z1nZXDBvZ uNvwfeYVTsBbHmQ94RdlN/ll9Xb00pD7PfEn9Ef/bE+ysLCoMdKRAtubd3m2ovyEq/qY IdB3WIu2s2PYsQ53POMt1Q7JvfrjWPiqZ6MrTYCRz+1WSPX/3JoDdnzghdJQLSskqINU eKFIJqbT0a7cN2Lngixg3wJqPQrhYfjyovnI9dvgYknO7XVgISZUhzYhvXawyv4IVOdA YzFA== 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=x+WcHBmr4prRt0vIkSfM9PPUqwEgU3pvt4JgB//l4IQ=; b=JoEYxHfZKGxMnaiLrclcHZKJ6PzKs/899C3gXBpwPbDwaZrv0SKKwqH/F3JId63Tgn PmPPzbaazoQg70zicPG+BDECCx8+lPeEw1XJUBNCo05Pa3HuGmgnposYY81oueszsRIC m3TOdk0+zZodaBRKKKp0Dm+U2CqQaRSHly3T6qaIDfCni8NuYDcLn/vrpelvRcuGf3bB J7BLjMi8D4ZA87vzWoh7Tm0Y62tUMaa/2s8ieg1MdrOpkxoruMMhIE/relUxmyK7FBmD MedupwfO2Kb4HqDpuopKZAVPliwYuBISzn/p9EqzbWwmsBBa7dOh0n9eLkYAc4nna5XY 7pTg== X-Gm-Message-State: APjAAAUwe9OYlNvvAac0AZCm69UlFZxvJGYpucvoOsq/SFpRfdWGOK2d U7L92ombh6tmkhtmIvnAXsPEsw== X-Received: by 2002:a1c:480a:: with SMTP id v10mr18887642wma.120.1565012474656; Mon, 05 Aug 2019 06:41:14 -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.13 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 05 Aug 2019 06:41:14 -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 8/8] drm/bridge: dw-hdmi-i2s: add .get_eld support Date: Mon, 5 Aug 2019 15:41:02 +0200 Message-Id: <20190805134102.24173-9-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 Provide the eld to the generic hdmi-codec driver. This will let the driver enforce the maximum channel number and set the channel allocation depending on the hdmi sink. Cc: Jonas Karlman Signed-off-by: Jerome Brunet --- drivers/gpu/drm/bridge/synopsys/dw-hdmi-audio.h | 1 + drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c | 10 ++++++++++ drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 1 + 3 files changed, 12 insertions(+) -- 2.21.0 Reviewed-by: Jonas Karlman diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-audio.h b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-audio.h index 63b5756f463b..cb07dc0da5a7 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-audio.h +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-audio.h @@ -14,6 +14,7 @@ struct dw_hdmi_audio_data { struct dw_hdmi_i2s_audio_data { struct dw_hdmi *hdmi; + u8 *eld; void (*write)(struct dw_hdmi *hdmi, u8 val, int offset); u8 (*read)(struct dw_hdmi *hdmi, int offset); 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 b8ece9c1ba2c..14d499b344c0 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c @@ -121,6 +121,15 @@ static void dw_hdmi_i2s_audio_shutdown(struct device *dev, void *data) dw_hdmi_audio_disable(hdmi); } +static int dw_hdmi_i2s_get_eld(struct device *dev, void *data, uint8_t *buf, + size_t len) +{ + struct dw_hdmi_i2s_audio_data *audio = data; + + memcpy(buf, audio->eld, min(sizeof(audio->eld), len)); + return 0; +} + static int dw_hdmi_i2s_get_dai_id(struct snd_soc_component *component, struct device_node *endpoint) { @@ -144,6 +153,7 @@ static int dw_hdmi_i2s_get_dai_id(struct snd_soc_component *component, static struct hdmi_codec_ops dw_hdmi_i2s_ops = { .hw_params = dw_hdmi_i2s_hw_params, .audio_shutdown = dw_hdmi_i2s_audio_shutdown, + .get_eld = dw_hdmi_i2s_get_eld, .get_dai_id = dw_hdmi_i2s_get_dai_id, }; diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c index bed4bb017afd..8df69c9dbfad 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -2797,6 +2797,7 @@ __dw_hdmi_probe(struct platform_device *pdev, struct dw_hdmi_i2s_audio_data audio; audio.hdmi = hdmi; + audio.eld = hdmi->connector.eld; audio.write = hdmi_writeb; audio.read = hdmi_readb; hdmi->enable_audio = dw_hdmi_i2s_audio_enable;