From patchwork Mon Aug 12 12:07:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 171063 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp2747117ily; Mon, 12 Aug 2019 05:07:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqyZNKEqIB7klN6cP31jKeeBIqtWrokguOPHS2QCDNO15inm2ZBKRydUWBieMbHBy9YUAkBJ X-Received: by 2002:a17:90a:8688:: with SMTP id p8mr23518121pjn.57.1565611664380; Mon, 12 Aug 2019 05:07:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565611664; cv=none; d=google.com; s=arc-20160816; b=elMnKuaw8yrbY8yunf90o/FyXlHHMDNkkM9nDrRJhLb2ijlwerj+U4Ts2thnKcrA6y RAg48ZeNuVc2LtGahdkRtjfSojj/tElZUnsmLQT3C2vRYLKKFuLn+MWbPVJieLWZ1M8A TNp9OddvhjYeHtYovKO3p3/WdGgWlDKc97W5gUUIPkB90krm+AXNKNbWMf9YycaiUTfj Wo767W0AMgHyshPQvL0OArBqiTd5X5iqMm5Og0MC0SzidOVYDiRIs2fmnEBRchD4NRja 2Z5A10VtG+Lma/Tz6n4EZgpMpnUtl9GRn0dpzDeM6EQXwLbiPt3PRpRyC+XDVH88unyu tmwg== 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=nyk3iRwUiWOF3HR8AgEI8oTD0AAO9L4Qd9ulSVgUQuc=; b=gE2GFqT/Mmornhz7D0Za3n9+VwJhnnv54s0zc54JMd/PN7fqYd8K3BJYiosBco7n86 53HaX6O3+1xDTNuUEdlR4BjmspWajzN6d/Syiw+gxP6hAit8tEUQ681fef95KzNRXajG p4CfoRjhVNaY4CSPrixHEwuIPsNV6dML3rVtjpYA4d9OqvE/Yy/Lw9wnTkFnkmrNu4HO 7+Vyl6/+i192RITn2Teyl8gebgCT5UeDdj0ZGC2/+k0CYwvxOYF3yO/xLCaFpuPowIC5 +XcA7v/w/2WjigroBCxN7Ca6dgBq/I6/saa6B7X1vl7H0RA/ki+6TwNMqVvrYaJ20OVt zY8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=daHHObEV; 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 t34si23074029plb.29.2019.08.12.05.07.44; Mon, 12 Aug 2019 05:07:44 -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=daHHObEV; 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 S1728545AbfHLMHn (ORCPT + 28 others); Mon, 12 Aug 2019 08:07:43 -0400 Received: from mail-wm1-f67.google.com ([209.85.128.67]:52118 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728445AbfHLMHi (ORCPT ); Mon, 12 Aug 2019 08:07:38 -0400 Received: by mail-wm1-f67.google.com with SMTP id 207so11932588wma.1 for ; Mon, 12 Aug 2019 05:07:37 -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=nyk3iRwUiWOF3HR8AgEI8oTD0AAO9L4Qd9ulSVgUQuc=; b=daHHObEVwiPB5m8eB3TinS4M9hhoYOX7OGD3cCnIcEdu8mEBbC2sxvbHgwNQgNQaGl e+ADZVLpFJLcl5mKHLragQdiafg85cuqpCUuGO05kZO+gqWvdMosoWdf76Lir6wDtR+G wnM/evLYE5mIEGNMDuMjreFZbxAt2EM/BzD4bWna14viPvYztIKdPE8Jjk2RtbvecAiH +vTiUF5wWddKT/m+Wal8DQpROpSVRSZ7RWDQLYKJ0cneQ7GBQEZGV/d/J3AAidyIBRzk kxtw4nWL8qMqRra9ftu6k3t/ezDcKlv0PBbJUX4418BaYieMPY6X3fasAC7Y3ddZnMCg N1ig== 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=nyk3iRwUiWOF3HR8AgEI8oTD0AAO9L4Qd9ulSVgUQuc=; b=Zn/gY2F6O+JKMZr8qPLEDhVWcjHy8stxiZ0lU+y7tfx4SUYUa+hFTxQNAjheNcLDkA R3b2sOQhUnEtLm4xgbOBsBeO43J0sd8NMOVoauvVOURvI59RsG5gN2ITbAZ1G7VSBh6t N8Nq3h6scvIPXkJBFq4LRlTYyRTsPsXAfxY1Myu0oTSveupbtW4/FKgsSf0EZOzHIVx9 caqQhaS4UHVcbf9o1G1pQsHmqsEpLQJj2/EdyVoDh1CZy1TW9aw6XjSaXrXTSFSP8iCA xpGLDL92oUehw+Hon3zods/YdNKwCjCiH3v333HVRQHEaBnbBG4UZk3ZgZazwI4f+Zga 2LOA== X-Gm-Message-State: APjAAAWu7GJbmfvbnThfkjjYD5sdJaE5Cmh6ONEKIj5C3Ez9CjS3ed2i OjJvHji/ub9iyL2nToOOdoYFoQ== X-Received: by 2002:a1c:6641:: with SMTP id a62mr26440820wmc.175.1565611656356; Mon, 12 Aug 2019 05:07:36 -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.35 (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 Cc: Jerome Brunet , Kevin Hilman , Jonas Karlman , linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Subject: [PATCH v2 7/8] drm/bridge: dw-hdmi-i2s: enable only the required i2s lanes Date: Mon, 12 Aug 2019 14:07:25 +0200 Message-Id: <20190812120726.1528-8-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 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 Reviewed-by: 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,