Received: by 10.213.65.68 with SMTP id h4csp134506imn; Mon, 12 Mar 2018 09:00:52 -0700 (PDT) X-Google-Smtp-Source: AG47ELsE77P3kRDUY/MhlpszN2WcoHehEA6/+l5euVJ9VhRDZ4kvTyEm2/gqBVrqJA+006FWcFvD X-Received: by 10.98.79.90 with SMTP id d87mr8465573pfb.41.1520870452418; Mon, 12 Mar 2018 09:00:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520870452; cv=none; d=google.com; s=arc-20160816; b=Zkkpbtd/wJvc0RauCaQppNMbzuyNyfy/vtcF/epELYxi+lpNgvXk0jd38XhreoXIfZ PeHc8VbpymSe+qjq+JJBAuKcWPjDXlJ52bWq7wZqXwc31plNoN3xkctcnTPXcC0FQOpN dqqaqYEh6M6BllOKiT/1ORZzOACqzbMUYPh5ceyvDjsx/h6oJQy7KBRoiUMqN9BFHi1w zx7jrayO8r6CqNQ4kzdSNGuSgT0a30NJZ0PfCPQkbVCVi2TbvaCYpIw37et87G8DBpgU YPgXOxb3jL3hi8WpZ6V2c3FjJU83IqEsINObeytthXc/sIbHedtE/Q/Jp0+fCUrTE6oC oZsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=+zyQ4Cu5WRzlNGytgHb2e7UsrFB4XbX90cuGj4U4sRg=; b=Elr/ce8PNpx5ejvFv4+NNhXMr62UBYY8AJFSgO9iio2ppOvO2hnJSDRr6YpcKksnPG IYCCPb55trTu5AB44JsnZPN2GBw2tFiAsVjn1Je3U/+gXYVY6D9tUQPlAC8RydEKfn2J FhP6Y3Hgh+BeDGALqQSRrhaFqX/HAfD19fuWOZc+5HCzI5B1z1sp5EmBsqgJTvYuEhjk FtnN0OSgaGGGy8Hj+7oFoJF09QK+4SkBrcyvfUCpBLJZSEaFBjFGP+Y+YDlYnjEDKmUg fBtT/Dr7lwZajCxJAAyeVEPlXQxG0QB8j0Dr9C197wgUHzwDX4qhBdrwFuXxEe/2ZCvC 3SVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=LEMNuXxK; 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 33-v6si6188569plu.426.2018.03.12.09.00.37; Mon, 12 Mar 2018 09:00:52 -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=LEMNuXxK; 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 S932752AbeCLP6f (ORCPT + 99 others); Mon, 12 Mar 2018 11:58:35 -0400 Received: from mail-lf0-f67.google.com ([209.85.215.67]:46347 "EHLO mail-lf0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932624AbeCLP6E (ORCPT ); Mon, 12 Mar 2018 11:58:04 -0400 Received: by mail-lf0-f67.google.com with SMTP id w16-v6so2934486lfc.13 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=VJMQG4fcpRGJ3x0+s5pygnFsVXK95l2TLcbZBdOUsMvnxvGk6Hbt6HDUr0uyw84HXO xscCKXFqto1ZcBcHsPuhjWjNEzzhdamHy93OrYzDvg3Mzh+BhQDXOlR136wUkrskeXL7 x+IAcbFRW8+tR4lAvCZaC4oA530ZCd2z4QzT1cf439Xt3vu7tIx+NJYVKH81eoX/eC3m km8l7K0WlEeNYdk8kqVvHYcrl9zEnEz4hS3BsUuDkqKsFuaQMkpD3BJ5mSrWsklwKtbI ni4YshzQijzo03IhjJely3iZ0O9fcNLH+4gbRMOKZOrMvxK8xX52IswE4GDSOQuwEFb1 pg6A== X-Gm-Message-State: AElRT7EWzqaMr1BiLhRh0MggAt+IIgI8rby2/vI1gogIL+3QMzn3Yy6E oxh4VXDHbZPSs6Gwyhmrgdc= 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 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 v2 5/6] ASoc: sun4i-i2s: Add 20, 24 and 32 bit support 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> 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 | 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) -- 2.16.2