From patchwork Thu Jun 13 12:12:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 166687 Delivered-To: patch@linaro.org Received: by 2002:ac9:2a84:0:0:0:0:0 with SMTP id p4csp810884oca; Thu, 13 Jun 2019 08:24:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqyIMfo2jG8ysnpkd4JUccHGvYIi72HfpIksiehyVe3jWR8ILWWRibPdPh9sgS+t3dbR1iOi X-Received: by 2002:a62:e511:: with SMTP id n17mr85214318pff.181.1560439481590; Thu, 13 Jun 2019 08:24:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560439481; cv=none; d=google.com; s=arc-20160816; b=Ol4MrRTIrX7acCuUza5xmx4OaGATrGApg/r3WkS2APZCP8PJw4RRQxcIrw0I779+Si NmTKlGbDvjjvgjl86JN51hKzrmNgpPkL9sbxQhy12ja1VIdm5lU6c/nvXMpPg9m0KM81 V4IPWoMApndwDLeF/CXDl8TJPNdrfS0NxlAyvE4M0KibnqvExgSj9zU5F31BpWamg6FX j/ERxcUfTu3c5Ad+d08UjFYYNdfCGoljmWSZ8TiZpzgwQkxQKnA+w5w2keasXtkwQzs0 01Hl1RndMOQJvK27l6rHLmZYowwxJ1K/iN/bozfy9AfMSvQxM6ScBT6qxKnCLfHMw5qr vjww== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=dxPAopxGigXChNe4VdO4Ubt5YTdhDcINUQzBTzEvzKk=; b=T4fa7SsHgpffhJZj1fgccuFPXlUTP6dOHLts4y8+O6ziAgJvWC4kzjwznmVkDv3vtA YKb0qboj5J8MYOLYFUJmZ6grlwgyTIDUPxrA/mcCcYhOdduBrYWmutPKof9BihIIWH7I sjW7lW5dFy4CMzW3moA+NWf1cnwR2qDMzTiSGZ4QWSXs+HcP93Jj3ANRehUKawKvwCt6 Pb3I/ftNrmr5XK7tyZz0QjDi4PjddRGWNmuXKcPIuQR12uDJqGg2sUaLYr/Wh2UXru8s zmF8MA910uJACCEz1POx4ufRSbKWy839bElWIjFPVoZLsiZVxt4930z5v4anf+XUhtxg BbFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=1g9KtaZe; 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 j9si76590pgh.385.2019.06.13.08.24.41; Thu, 13 Jun 2019 08:24:41 -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=1g9KtaZe; 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 S1733193AbfFMPYh (ORCPT + 25 others); Thu, 13 Jun 2019 11:24:37 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:53785 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731684AbfFMMMO (ORCPT ); Thu, 13 Jun 2019 08:12:14 -0400 Received: by mail-wm1-f65.google.com with SMTP id x15so9948150wmj.3 for ; Thu, 13 Jun 2019 05:12: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:mime-version :content-transfer-encoding; bh=dxPAopxGigXChNe4VdO4Ubt5YTdhDcINUQzBTzEvzKk=; b=1g9KtaZe/+oTpytYwjZO6yBksvr6Iq1cGRxviJuU4NBlxHLTidBtC8fZ57YYsFdFl+ xtC/aJBuwSN8BisYBx12l/oSJCZy7DIfRqBrq+rpXCGdLCHTxhXFvTmCBtsk8MkI0aAH 6cChkYFKuHDiK7vinsQXX8B77oajTNHf6lWZJtc6spSEy9LQwmt38ohVGTwWglgjLY4J TI3fiUKEsldOjiU9UYzkJmmmskIlq62uhE+mgxWk7wo5ewSljqAyBDENmsZDwvEarMf1 Mm0rEg0jEZtrwu7KfJ3heI5gmwlBnVyzf4HJO+Q7c9n41FDukqeJvEKo0oefEd/bXC1n Yvgg== 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:mime-version :content-transfer-encoding; bh=dxPAopxGigXChNe4VdO4Ubt5YTdhDcINUQzBTzEvzKk=; b=a5LfHpdJcmhOT5Tq7alJ99FvHJNt37ClFVrrKySRlRBILi0tr42fhrYY1CMok6Mzsz tcWk2xdELQAr9P3rmJ3txrgc2sVtOQ9trOfwDj+nj7arIYdlWevaqvuqe5fEj/cCbZ6c rOSQfRfk85q593En9VGDfN3PTfcvdXf57bDkCHxiQIQrUW5pNC77UFRQ5aGFvZv6SF47 BpR+uux7hVy1j32Q/hasNsoUrXllxZu7NVABqHZOZgjkO+yslDvwmGS7Wd/Qn4M21Xed eSDn5aTLSmxjSLb63BK/KvYo2Bs0iZWsK3BYyxysP9GTBR3pwv27U/F/MlCHSZMbhJ+M fH+A== X-Gm-Message-State: APjAAAU/iceTEojtRpZQydy8zkf7nyTdDJsG6oSuJN8oPvkLPctWLYsH XtfWBNZcdwBiFWidPH1jh8BVHQ== X-Received: by 2002:a7b:c344:: with SMTP id l4mr3450592wmj.25.1560427931387; Thu, 13 Jun 2019 05:12:11 -0700 (PDT) Received: from boomer.local (lmontsouris-657-1-212-31.w90-63.abo.wanadoo.fr. [90.63.244.31]) by smtp.googlemail.com with ESMTPSA id f6sm2974532wrw.68.2019.06.13.05.12.10 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Thu, 13 Jun 2019 05:12:10 -0700 (PDT) From: Jerome Brunet To: Andrzej Hajda , Laurent Pinchart , David Airlie , Daniel Vetter Cc: Jerome Brunet , Kevin Hilman , linux-amlogic@lists.infradead.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH] drm: dw-hdmi-i2s: support more i2s format Date: Thu, 13 Jun 2019 14:12:07 +0200 Message-Id: <20190613121207.12185-1-jbrunet@baylibre.com> X-Mailer: git-send-email 2.20.1 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 --- Tested on the Amlogic arm64 meson-g12a-sei510 with i2s, left_j, dsp_a and dsp_b. right_j is not supported by this platform. .../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.20.1 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,