From patchwork Mon Mar 12 15:57:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Code Kipper X-Patchwork-Id: 10276663 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A87EC602BD for ; Mon, 12 Mar 2018 15:58:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 97BBC28AF3 for ; Mon, 12 Mar 2018 15:58:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8BF6A28B14; Mon, 12 Mar 2018 15:58:55 +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=-1.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, T_DKIM_INVALID autolearn=no 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 E9E1C28AF3 for ; Mon, 12 Mar 2018 15:58:54 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 35AB12673F0; Mon, 12 Mar 2018 16:58:12 +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 9F5822673FE; Mon, 12 Mar 2018 16:58:04 +0100 (CET) Received: from mail-lf0-f68.google.com (mail-lf0-f68.google.com [209.85.215.68]) by alsa0.perex.cz (Postfix) with ESMTP id 27FFA266E63 for ; Mon, 12 Mar 2018 16:58:03 +0100 (CET) Received: by mail-lf0-f68.google.com with SMTP id m69-v6so24021182lfe.8 for ; Mon, 12 Mar 2018 08:58:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=+zyQ4Cu5WRzlNGytgHb2e7UsrFB4XbX90cuGj4U4sRg=; b=LEMNuXxK/jHsZmMi4TXwV2jB/zoyN/JyAa3aTTWXy4+KbfnzXFSTopp2tGh53Ij9Tb IdNdao/02OOMRqLnpln5F0MQchDcrv2d5JUYQx+hnEZ5oxu8+8Ai7NRkE0KNodWMU+/k GFjyjXNmjSFP71PQd5VzVeSgTaHPeTsFFmRETUzdx95s9VF5GYG9ziBdooB5xzZCVU2V kIVRlcpfZn+kIUXzr9SaJmCRcfp1nd/RNvgXKrtaiU7UDB/eGGrKkGcdFsuF68mEcEIw S4UmSelVK22skgCpJVcQHBvgMkaZWZi/E9cDl+IVX2zHdMeXRoCCMBbjCLcp1nUXMtxq 3BoQ== 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=+zyQ4Cu5WRzlNGytgHb2e7UsrFB4XbX90cuGj4U4sRg=; b=s2FoSpN4feutaWgxJZMXtXyX9R2a0+uh9N0Z83q8GtmiXvIpDORCtsQRNSxaVKb4Xl 8qt7VzaEP2USPpnkBKf9OJlVRsL5EhvcwdRmQ93Ksoy5xV8OJjJMFxV5Hobp0JziSMhK 1v56iAwUlfCILiAW4vO6LfOC8wuBbpvGN9Gyh2urp5493UTiUzbys5+iNX/ENO71kQ1X AFSr0wo4q+OXKKcJLEulDsCG3Yeh+JtM17X41EV2qn0QdKBmx9KiXL2FYV99H63ZGoE4 KOGzmsnBmNlpwcaG3xDIU5G3jCelXExi9zB+USjrFWk4ywHZFbgrA9WPbiWDQpBDkc3s zDHA== X-Gm-Message-State: AElRT7HPr7nQCo3govayrwx0F4Xuc4USPL0+VQg6cUmcM0D3lcfhnORj lapfqSOmpjQNGM5PWWrBKwk= X-Google-Smtp-Source: AG47ELvAS68VgcGi8wO7PLaOfHKOm7NXU3aucFi49gMhwyV5OlvyqGwONUtQvmocSj6zPV+BK/m/XA== X-Received: by 10.46.129.216 with SMTP id s24mr5750713ljg.2.1520870282758; Mon, 12 Mar 2018 08:58:02 -0700 (PDT) Received: from localhost.localdomain (c83-253-254-90.bredband.comhem.se. [83.253.254.90]) by smtp.gmail.com with ESMTPSA id h11-v6sm1833448lfd.88.2018.03.12.08.58.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Mar 2018 08:58:02 -0700 (PDT) From: codekipper@gmail.com To: maxime.ripard@free-electrons.com, wens@csie.org, linux-sunxi@googlegroups.com Date: Mon, 12 Mar 2018 16:57:52 +0100 Message-Id: <20180312155753.9478-6-codekipper@gmail.com> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180312155753.9478-1-codekipper@gmail.com> References: <20180312155753.9478-1-codekipper@gmail.com> Cc: alsa-devel@alsa-project.org, Marcus Cooper , lgirdwood@gmail.com, linux-kernel@vger.kernel.org, be17068@iperbole.bo.it, broonie@kernel.org, linux-arm-kernel@lists.infradead.org Subject: [alsa-devel] [PATCH v2 5/6] ASoc: sun4i-i2s: Add 20, 24 and 32 bit 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 From: Marcus Cooper Extend the functionality of the driver to include support of 20 and 24 bits per sample for the earlier SoCs. Newer SoCs can also handle 32bit samples. Signed-off-by: Marcus Cooper --- sound/soc/sunxi/sun4i-i2s.c | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/sound/soc/sunxi/sun4i-i2s.c b/sound/soc/sunxi/sun4i-i2s.c index 436480df1844..7cf4dfe440de 100644 --- a/sound/soc/sunxi/sun4i-i2s.c +++ b/sound/soc/sunxi/sun4i-i2s.c @@ -451,6 +451,11 @@ static int sun4i_i2s_hw_params(struct snd_pcm_substream *substream, case 16: width = DMA_SLAVE_BUSWIDTH_2_BYTES; break; + case 20: + case 24: + case 32: + width = DMA_SLAVE_BUSWIDTH_4_BYTES; + break; default: dev_err(dai->dev, "Unsupported physical sample width: %d\n", params_physical_width(params)); @@ -463,7 +468,18 @@ static int sun4i_i2s_hw_params(struct snd_pcm_substream *substream, sr = 0; wss = 0; break; - + case 20: + sr = 1; + wss = 1; + break; + case 24: + sr = 2; + wss = 2; + break; + case 32: + sr = 4; + wss = 4; + break; default: dev_err(dai->dev, "Unsupported sample width: %d\n", params_width(params)); @@ -766,6 +782,13 @@ static int sun4i_i2s_dai_probe(struct snd_soc_dai *dai) return 0; } +#define SUN4I_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | \ + SNDRV_PCM_FMTBIT_S20_3LE | \ + SNDRV_PCM_FMTBIT_S24_LE) + +#define SUN8I_FORMATS (SUN4I_FORMATS | \ + SNDRV_PCM_FMTBIT_S32_LE) + static struct snd_soc_dai_driver sun4i_i2s_dai = { .probe = sun4i_i2s_dai_probe, .capture = { @@ -773,14 +796,14 @@ static struct snd_soc_dai_driver sun4i_i2s_dai = { .channels_min = 2, .channels_max = 2, .rates = SNDRV_PCM_RATE_8000_192000, - .formats = SNDRV_PCM_FMTBIT_S16_LE, + .formats = SUN4I_FORMATS, }, .playback = { .stream_name = "Playback", .channels_min = 2, .channels_max = 2, .rates = SNDRV_PCM_RATE_8000_192000, - .formats = SNDRV_PCM_FMTBIT_S16_LE, + .formats = SUN4I_FORMATS, }, .ops = &sun4i_i2s_dai_ops, .symmetric_rates = 1, @@ -1170,6 +1193,11 @@ static int sun4i_i2s_probe(struct platform_device *pdev) goto err_pm_disable; } + if (i2s->variant->has_fmt_set_lrck_period) { + soc_dai->playback.formats = SUN8I_FORMATS; + soc_dai->capture.formats = SUN8I_FORMATS; + } + if (!of_property_read_u32(pdev->dev.of_node, "allwinner,playback-channels", &val)) { if (val >= 2 && val <= 8)