From patchwork Wed Jan 7 11:01:23 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Francois Moine X-Patchwork-Id: 5584271 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 00699BF6C3 for ; Wed, 7 Jan 2015 11:52:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3B0842025B for ; Wed, 7 Jan 2015 11:52:51 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 5553C20263 for ; Wed, 7 Jan 2015 11:52:50 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AB5BB8A178; Wed, 7 Jan 2015 03:52:49 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from smtp6-g21.free.fr (smtp6-g21.free.fr [212.27.42.6]) by gabe.freedesktop.org (Postfix) with ESMTP id 3BC9A8A180 for ; Wed, 7 Jan 2015 03:52:48 -0800 (PST) Received: from localhost (unknown [IPv6:2a01:e35:2f5c:9de0:21c:dfff:fe9f:57fb]) by smtp6-g21.free.fr (Postfix) with ESMTP id 97B24822D1; Wed, 7 Jan 2015 12:51:09 +0100 (CET) X-Mailbox-Line: From 3b99496107b6653ef27b86d8cdf516a4815910cf Mon Sep 17 00:00:00 2001 Message-Id: <3b99496107b6653ef27b86d8cdf516a4815910cf.1420628786.git.moinejf@free.fr> In-Reply-To: References: From: Jean-Francois Moine Date: Wed, 7 Jan 2015 12:01:23 +0100 Subject: [PATCH v9 4/4] drm/i2c: tda998x: set cts_n according to the sample width To: Mark Brown , Russell King - ARM Linux Cc: devicetree@vger.kernel.org, alsa-devel@alsa-project.org, Andrew Jackson , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Jyri Sarha X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP With I2S input, the CTS_N predivider depends on the sample width. Signed-off-by: Jean-Francois Moine --- drivers/gpu/drm/i2c/tda998x_drv.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c b/drivers/gpu/drm/i2c/tda998x_drv.c index a26a516..8af84cd 100644 --- a/drivers/gpu/drm/i2c/tda998x_drv.c +++ b/drivers/gpu/drm/i2c/tda998x_drv.c @@ -50,6 +50,7 @@ struct tda998x_priv { wait_queue_head_t wq_edid; volatile int wq_edid_wait; struct drm_encoder *encoder; + int audio_sample_format; u8 audio_ports[2]; #ifdef WITH_CODEC @@ -671,7 +672,17 @@ tda998x_configure_audio(struct tda998x_priv *priv, reg_write(priv, REG_MUX_AP, MUX_AP_SELECT_I2S); clksel_aip = AIP_CLKSEL_AIP_I2S; clksel_fs = AIP_CLKSEL_FS_ACLK; - cts_n = CTS_N_M(3) | CTS_N_K(3); + + /* with I2S input, the CTS_N predivider depends on + * the sample width */ + switch (priv->audio_sample_format) { + case SNDRV_PCM_FORMAT_S16_LE: + cts_n = CTS_N_M(3) | CTS_N_K(1); + break; + default: + cts_n = CTS_N_M(3) | CTS_N_K(3); + break; + } break; default: @@ -778,7 +789,8 @@ static int tda998x_set_audio_input(struct device *dev, /* if same audio parameters, just enable the audio port */ if (p->audio_cfg == priv->audio_ports[port_index] && - p->audio_sample_rate == sample_rate) { + p->audio_sample_rate == sample_rate && + priv->audio_sample_format == sample_format) { reg_write(priv, REG_ENA_AP, p->audio_cfg); return 0; } @@ -787,6 +799,7 @@ static int tda998x_set_audio_input(struct device *dev, p->audio_clk_cfg = port_index == PORT_SPDIF ? 0 : 1; p->audio_cfg = priv->audio_ports[port_index]; p->audio_sample_rate = sample_rate; + priv->audio_sample_format = sample_format; tda998x_configure_audio(priv, &priv->encoder->crtc->hwmode, p); return 0; } @@ -1388,6 +1401,7 @@ static int tda998x_create(struct i2c_client *client, struct tda998x_priv *priv) priv->params.audio_frame[1] = 1; /* channels - 1 */ priv->params.audio_sample_rate = 48000; /* 48kHz */ + priv->audio_sample_format = SNDRV_PCM_FORMAT_S24_LE; priv->current_page = 0xff; priv->hdmi = client;