From patchwork Thu Aug 30 00:32:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Fether X-Patchwork-Id: 10584149 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D0C79180E for ; Fri, 31 Aug 2018 15:55:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BE53D2C203 for ; Fri, 31 Aug 2018 15:55:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B258C2C22E; Fri, 31 Aug 2018 15:55:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7733E2C221 for ; Fri, 31 Aug 2018 15:55:10 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 76D05267837; Fri, 31 Aug 2018 17:47:35 +0200 (CEST) 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 CCF81267922; Thu, 30 Aug 2018 02:33:09 +0200 (CEST) Received: from mail-pl1-f195.google.com (mail-pl1-f195.google.com [209.85.214.195]) by alsa0.perex.cz (Postfix) with ESMTP id 5E9F7267837 for ; Thu, 30 Aug 2018 02:33:07 +0200 (CEST) Received: by mail-pl1-f195.google.com with SMTP id j8-v6so3013132pll.12 for ; Wed, 29 Aug 2018 17:33:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mds-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=9ZthUC4a5nliPOVN+tXCFR75V5znI9gSrjFbu8BgqrM=; b=tr9yFqomsni63w/ae00Yc9WlAIju88zPG6s+ysgxSy5KpvpXF50HL6owcWiPGjVUMP U/N7qjRm7dLPwIoFKjEMFyGbOow7j5IJRzTEzcFVVNSQdO2LvLZcIKKs5iDua8zFt4l5 qC6UHjc6P3XH8qB39VXfRrYSvCNzEdycGCYRaho0H9KFa5m1UGTtOprnPSmiGbhpCuK6 Jroplb8BLTGaVhcJAOOzrxDWyrOGLBXxU3mQ4KFi2f0vsgfbBF/uKoXeujKfvrRABA6P PijiFdoqlf1fJhd2GBF98p6n4XWpxfWFev23j3zK6KmPsorSs5oQZB0A6MGu5dh5OLcy MPbw== 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; bh=9ZthUC4a5nliPOVN+tXCFR75V5znI9gSrjFbu8BgqrM=; b=FHdyK6wjEa8Cv0elyzGSpLrErWYcOd8D+gpgxkMQ9aXxwParSt46Ml0f3NMEP4V/M6 7ncfoHSnyA+WRBs2+pJ4WkVAmu70a6D73eHbp+Gjl2GqtXOaJyWnK6NEtW/8uTHGfX/w elZCvu7QTq7D23QJmvz4AbtiYZQUdqVh98DUUXuXVBO8tyhy81t/o0IyEzUd7/aLeYLW G8+gndM93Q1KKzSJuWGXNrprM8VneDbO/uuQGPbTyIL3/1hfxFrG95r92nOKpCnK2bzW NR02mhsqKSCkH46TlalOV61N2vU7+S8rIjCelcteDZJ5yM/hfd9+lZFxrkRnw3nb2qKg tIKQ== X-Gm-Message-State: APzg51BR66CcPrTpe3l3xwjNTmx2tZB3ECMPvf+l/EQ1trEpgAP8LU8I 8lwI6dgB76kW8ibxxwAL8M6YdA== X-Google-Smtp-Source: ANB0VdYLf40jtUS4qw19FJy2f0dBg/T6uqfChoYBNEiICkhSKlTzqliTGPoWaI5O3ZewibuN5yA6jw== X-Received: by 2002:a17:902:1683:: with SMTP id h3-v6mr7952425plh.201.1535589186114; Wed, 29 Aug 2018 17:33:06 -0700 (PDT) Received: from NIGHTLY-PC.mds.com ([71.177.158.100]) by smtp.gmail.com with ESMTPSA id t2-v6sm9004068pfj.7.2018.08.29.17.33.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 29 Aug 2018 17:33:05 -0700 (PDT) From: Jonathan Fether To: patch@alsa-project.org Date: Wed, 29 Aug 2018 17:32:50 -0700 Message-Id: <20180830003250.14076-2-jonf@mds.com> X-Mailer: git-send-email 2.9.0.windows.1 In-Reply-To: <20180830003250.14076-1-jonf@mds.com> References: <20180830003250.14076-1-jonf@mds.com> X-Mailman-Approved-At: Fri, 31 Aug 2018 17:47:29 +0200 Cc: alsa-devel@alsa-project.org, Jonathan Fether Subject: [alsa-devel] [PATCH] ASoC: sun4i-i2s: Add 24-bit sample width support 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 Add additional clock divider ratios for BCLK and MCLK, per the A20 datasheet. Add support for 32-bit physical sample width. Add support for 24-bit actual sample width. Change third parameter of call to sun4i_i2s_set_clk_rate() from sun4i_i2s_hw_params() to use physical sample width, which is appropriate here. Signed-off-by: Jonathan Fether --- sound/soc/sunxi/sun4i-i2s.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/sound/soc/sunxi/sun4i-i2s.c b/sound/soc/sunxi/sun4i-i2s.c index a4aa931..ba1cfae 100644 --- a/sound/soc/sunxi/sun4i-i2s.c +++ b/sound/soc/sunxi/sun4i-i2s.c @@ -207,6 +207,8 @@ struct sun4i_i2s_clk_div { { .div = 8, .val = 3 }, { .div = 12, .val = 4 }, { .div = 16, .val = 5 }, + { .div = 32, .val = 6 }, + { .div = 64, .val = 7 }, /* TODO - extend divide ratio supported by newer SoCs */ }; @@ -219,6 +221,9 @@ struct sun4i_i2s_clk_div { { .div = 12, .val = 5 }, { .div = 16, .val = 6 }, { .div = 24, .val = 7 }, + { .div = 32, .val = 8 }, + { .div = 48, .val = 9 }, + { .div = 64, .val = 10 }, /* TODO - extend divide ratio supported by newer SoCs */ }; @@ -393,6 +398,9 @@ static int sun4i_i2s_hw_params(struct snd_pcm_substream *substream, case 16: width = DMA_SLAVE_BUSWIDTH_2_BYTES; break; + case 32: + width = DMA_SLAVE_BUSWIDTH_4_BYTES; + break; default: dev_err(dai->dev, "Unsupported physical sample width: %d\n", params_physical_width(params)); @@ -405,6 +413,10 @@ static int sun4i_i2s_hw_params(struct snd_pcm_substream *substream, sr = 0; wss = 0; break; + case 24: + sr = 2; + wss = 3; + break; default: dev_err(dai->dev, "Unsupported sample width: %d\n", @@ -418,7 +430,7 @@ static int sun4i_i2s_hw_params(struct snd_pcm_substream *substream, sr + i2s->variant->fmt_offset); return sun4i_i2s_set_clk_rate(dai, params_rate(params), - params_width(params)); + params_physical_width(params)); } static int sun4i_i2s_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) @@ -720,14 +732,14 @@ static int sun4i_i2s_dai_probe(struct snd_soc_dai *dai) .channels_min = 2, .channels_max = 2, .rates = SNDRV_PCM_RATE_8000_192000, - .formats = SNDRV_PCM_FMTBIT_S16_LE, + .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE, }, .playback = { .stream_name = "Playback", .channels_min = 2, .channels_max = 2, .rates = SNDRV_PCM_RATE_8000_192000, - .formats = SNDRV_PCM_FMTBIT_S16_LE, + .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE, }, .ops = &sun4i_i2s_dai_ops, .symmetric_rates = 1,