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: 5584331 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 200709F443 for ; Wed, 7 Jan 2015 11:55:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 524DA20274 for ; Wed, 7 Jan 2015 11:55:39 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 8D3A0201D3 for ; Wed, 7 Jan 2015 11:55:37 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id A25F4264F51; Wed, 7 Jan 2015 12:55:32 +0100 (CET) Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 84EB62617A5; Wed, 7 Jan 2015 12:53:42 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 27FE22617A5; Wed, 7 Jan 2015 12:53:41 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, NO_DNS_FOR_FROM,UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from smtp6-g21.free.fr (smtp6-g21.free.fr [212.27.42.6]) by alsa0.perex.cz (Postfix) with ESMTP id C8826261987 for ; Wed, 7 Jan 2015 12:52:47 +0100 (CET) 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 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 , Dave Airlie Subject: [alsa-devel] [PATCH v9 4/4] drm/i2c: tda998x: set cts_n according to the sample width X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.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;