Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp391632ybl; Tue, 13 Aug 2019 23:10:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqxFk5S+4Dmw8GWyskL01aTNEIvxSCEpO5SQL1sAmBTMxssy0pTx369n5QlRLGPoZQMA6jt8 X-Received: by 2002:a17:902:8d8d:: with SMTP id v13mr21236237plo.137.1565763027059; Tue, 13 Aug 2019 23:10:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565763027; cv=none; d=google.com; s=arc-20160816; b=0UXo+QoL+vo2Jqi+RKU2ataGmJpX2OYKsntCWE4JzCgLgAZLFfWmTT+1qH/v5hEn1/ 5zPMcNlt10upBY1snf2w2aIHA24/UaY7ccW7tHOw9psSr+RFWYM3zfqmSGFywGkOYWlT HGMxLyglODguruvjmr+tqrXQzT2hui0Udp0fJ4txtxSy+9F0BKmYmXo/K/k9sd6GxV+o avSpAxDQ2n8SAzUDUMqkUj1QuXrN067i/Hwo6PQkQiXnivvi7kvuLIoVI7ED5DJui9EC cjp4rd4VDwvHXL67eU1KsbsNstl8+MMqZH1xRci/gRu7wBkBr6rHDMjMCN/2suMe+cXP wjdQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=QUt25DA3nPbOAehIkkx29Wu4YEVb8BWcE2W2re+0NE8=; b=wQDtg5zk+j91rilF+9iMpcFTJ8yRXCBhwqfR5oGsSK3ls1fQFUidIe5nTJMQ5DxO3e 1mAKw8s8JBYoSUWv5uUm0XluFzWag/SfAokH07Qw4gRvOz7IXhOSKUnZnu4TM4No+lw8 nmsT+JiKEn6v2WHPuDLMUpcd2pKye1wXDxxVlXJagKvmPW5K3frz1kbcdJsw9qc7ueVU sdEW/x4I0BbyWANeSYgHHo4d7eaSZwOZ9DqQA1Z4Dwl2vOad1ta7FqtpLJ6olLrIA72k AzYad2SHEKoCCNwJuW0Z2QjfwAx20B6ptCni4afH4Uz30y1s2++7NWLpZ/7ASB8z2LIk xTiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Qzrffdve; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w3si59658391plb.35.2019.08.13.23.10.11; Tue, 13 Aug 2019 23:10:27 -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=@gmail.com header.s=20161025 header.b=Qzrffdve; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727691AbfHNGJX (ORCPT + 99 others); Wed, 14 Aug 2019 02:09:23 -0400 Received: from mail-lf1-f67.google.com ([209.85.167.67]:42517 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727662AbfHNGJV (ORCPT ); Wed, 14 Aug 2019 02:09:21 -0400 Received: by mail-lf1-f67.google.com with SMTP id s19so15789125lfb.9 for ; Tue, 13 Aug 2019 23:09:20 -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 :mime-version:content-transfer-encoding; bh=QUt25DA3nPbOAehIkkx29Wu4YEVb8BWcE2W2re+0NE8=; b=QzrffdvexAezMs4qMJYVZcFcbj6IE7U0mJndLRmd/1BqqRNboSoqBX9wbZeQcI5HoE w+8XxVS9TsjVcRzUcV/FkR/2dQI39Xd3c1UNtyEml6R/wNofjTIjHWnQHNAd91WMB9D/ O5NgoQlUDESnv1urOYAvLTImhvggWvHvzR38HBBvz0PzaWlzTyAAVyAlRNTfIut9E95D sG6xu/38nnJgWKN0H4gSncltZzd5pJ3r5OYnnK99Hg7sFkRneR5g4QmK2JxTBaWExZeU y1kR1L0VrKuQoWAS3Y51l2dWRyd7jzrx+ItAfegoXkmNpoNHZ8qS7L7tM5FB8DTtr7pK GnFQ== 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:mime-version:content-transfer-encoding; bh=QUt25DA3nPbOAehIkkx29Wu4YEVb8BWcE2W2re+0NE8=; b=W1McfQZFRL08mb8N29Q/J3WJ2NkXq5I2vGcIAlKmTy/cn5pWukoP3i6JxCrtwkQos5 24fx1Z3j29ogP5kcL5MEfgZ7lzoxiCYDFJLN5SjVbZY49AJdFF2+6nF23PkAbAZ69/oL UL9D9kTkpmMq90v0LbxrRawfyCtJAMvv/LXRUpD6OPvnIxU2b9c2sasYHYqRZc9SgDrx svBazutLHIgNzL+M3fHiZ+blfzVVY2rzR1HlRqrN4qgrVuneHHnT9c0R1tBA5UIYl6LX Nr4eRlaKyIreR5GZvgG5e67V83cYqUaR4+A+4FjFa0P24MJpswUNN951rf5RyNISmUWL ikWw== X-Gm-Message-State: APjAAAXcG6JNHdn9wBlh7pD2Z8hL8gvBcHcuUFbijthUqztspEtC9Dn0 YvH83WonWFkHiBbOq0j1XVI= X-Received: by 2002:ac2:465e:: with SMTP id s30mr25328482lfo.19.1565762959397; Tue, 13 Aug 2019 23:09:19 -0700 (PDT) Received: from localhost.localdomain (c213-102-74-69.bredband.comhem.se. [213.102.74.69]) by smtp.gmail.com with ESMTPSA id s10sm3124235ljm.35.2019.08.13.23.09.17 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 13 Aug 2019 23:09:18 -0700 (PDT) From: codekipper@gmail.com To: maxime.ripard@free-electrons.com, wens@csie.org, linux-sunxi@googlegroups.com Cc: linux-arm-kernel@lists.infradead.org, lgirdwood@gmail.com, broonie@kernel.org, linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org, be17068@iperbole.bo.it, Marcus Cooper Subject: [PATCH v5 14/15] ASoc: sun4i-i2s: Add 20, 24 and 32 bit support Date: Wed, 14 Aug 2019 08:08:53 +0200 Message-Id: <20190814060854.26345-15-codekipper@gmail.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190814060854.26345-1-codekipper@gmail.com> References: <20190814060854.26345-1-codekipper@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/sound/soc/sunxi/sun4i-i2s.c b/sound/soc/sunxi/sun4i-i2s.c index a71969167053..d3c8789f70bb 100644 --- a/sound/soc/sunxi/sun4i-i2s.c +++ b/sound/soc/sunxi/sun4i-i2s.c @@ -690,6 +690,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)); @@ -1015,6 +1020,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_LE | \ + 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 = { @@ -1022,14 +1034,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, @@ -1505,6 +1517,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) -- 2.22.0