Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1958927imu; Sat, 22 Dec 2018 09:01:16 -0800 (PST) X-Google-Smtp-Source: ALg8bN5sDLi4Gt7U7X0g5HWYVatQQ3OK/kv4AovdqY0HPBJmmfOxtsyCQ5V9Q6+s8fifjsC3bMS+ X-Received: by 2002:a17:902:128c:: with SMTP id g12mr6808529pla.146.1545498076401; Sat, 22 Dec 2018 09:01:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545498076; cv=none; d=google.com; s=arc-20160816; b=VT47JfhfZqLd0vCz4BeurhS2+7aIDNv4hCb/1GMTy+4STUqa80iHflXzyM1QAymNU/ cPSutHW4dNMl6gR9PxxJ52xkLVkg+mjiLjlUlpUoF++EpxMT6npOo5Qr7D4DQFsBOCdi RJch/59qrbK5b0hkpyGimmtnaNWaYefrcut1hxZqo+8Uyw9ZHIrtPFVRlqGuT2AA7S6R LH0VzxJqO4KPmd5iDGVsk7dWAeKwNvNeIWWDko5DadWkK1PHQ2fxNnUhJHd4nAae3std dCZ1V4DB7t4hhnPDyJvyJrkwlJmfAdo2VRrm1rjGp+7KHroeLt8jz2k2JxRXFPOwa5vF 9eww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=ZqqCdnbZYBpsITc5EMAHVafk34rmCvV3c1syI8YgPPY=; b=wpArj7uMJAUZSg0AjdJMmWYV15MkON2pu87l93VJlLuFP48RP17/8JkLrCU7WtYV1q uyLjrmbpW76vxttd7Ir1dn5z55QzUWCFoxNCMh1EBt/LffUR6LmX/UzUsKgYRTDDVVkd Af9sbPcGM+0obn2zZD5LgrR48HRP5eqfw7i+vohkWWBswzZTnnm9NaRAy9vwlaGzTAan fF/DnbtE6gGxs0buI9hdynCAuwGEJDT3PtRnI9Er/fCaDmIlvySX+nEuwuHG06TeLd0Q 7eid6Xm/kccbYKwruyDmoVLuHHJwje3ZH0yQ+zbjspYgTZfH/xKcwugXB+IJOS1Kh/4b uXPw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i1si24078293pfj.276.2018.12.22.09.01.00; Sat, 22 Dec 2018 09:01:16 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389133AbeLUQsy (ORCPT + 99 others); Fri, 21 Dec 2018 11:48:54 -0500 Received: from mail-ed1-f67.google.com ([209.85.208.67]:40509 "EHLO mail-ed1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725868AbeLUQsy (ORCPT ); Fri, 21 Dec 2018 11:48:54 -0500 Received: by mail-ed1-f67.google.com with SMTP id g22so5174430edr.7 for ; Fri, 21 Dec 2018 08:48:52 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ZqqCdnbZYBpsITc5EMAHVafk34rmCvV3c1syI8YgPPY=; b=FG4m2GTxcy7iUPZkCxjfPGE5PqoKrA4m4XcpaIq+BhVm9fuO+IUcHalvicaQpMjzdO 2AoIJl3o8DK4TkjMv5LJKXK7A+IzEMMfZLPLVPd9/owEN0OGQc38m+BtIgLCtq0lpvhk esQyOJ40QS20vZ35jK99L97NnTHHwsyin9CVPn3G/PAYAxrAOBatqFQ4+cLGEcFGKeCW 7B4ig1QF2oh5tQfHA9CgMKmIAhRkobpXtScb4a+r68iNzWNJQZrD5bSR0yXpYYIWawGX t2pRg5Wpada9CtQLxkaKqdqR9FEjiANR1MTMT+nxcGPV3RVp5Q8c18tenpp+HNu1+XMg Z5Hw== X-Gm-Message-State: AA+aEWZC6ON2Plbbu3NQY9yZ9kX4XDJ9dC/Uo+RsrxGDQKPiklhKhP4w 6MMNXaN0+2E4LgNZC7hIKO0Lu+fgSfY= X-Received: by 2002:aa7:c0d0:: with SMTP id j16mr2851651edp.173.1545410931771; Fri, 21 Dec 2018 08:48:51 -0800 (PST) Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com. [209.85.128.44]) by smtp.gmail.com with ESMTPSA id j8sm7195825ede.55.2018.12.21.08.48.51 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 21 Dec 2018 08:48:51 -0800 (PST) Received: by mail-wm1-f44.google.com with SMTP id m22so6368041wml.3 for ; Fri, 21 Dec 2018 08:48:51 -0800 (PST) X-Received: by 2002:a1c:e58c:: with SMTP id c134mr3475663wmh.124.1545410931063; Fri, 21 Dec 2018 08:48:51 -0800 (PST) MIME-Version: 1.0 References: <20181221152110.17982-1-codekipper@gmail.com> <20181221152110.17982-4-codekipper@gmail.com> In-Reply-To: <20181221152110.17982-4-codekipper@gmail.com> From: Chen-Yu Tsai Date: Sat, 22 Dec 2018 00:48:39 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v3 3/9] ASoc: sun4i-i2s: Add 20, 24 and 32 bit support To: Code Kipper Cc: Maxime Ripard , linux-sunxi , linux-arm-kernel , Liam Girdwood , Mark Brown , linux-kernel , Linux-ALSA , "Andrea Venturi (pers)" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Dec 21, 2018 at 11:21 PM wrote: > > 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 | 41 ++++++++++++++++++++++++++++++++++--- > 1 file changed, 38 insertions(+), 3 deletions(-) > > diff --git a/sound/soc/sunxi/sun4i-i2s.c b/sound/soc/sunxi/sun4i-i2s.c > index 80bf29e0cc86..adb988ae9ac5 100644 > --- a/sound/soc/sunxi/sun4i-i2s.c > +++ b/sound/soc/sunxi/sun4i-i2s.c > @@ -399,6 +399,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)); > @@ -411,7 +416,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)); > @@ -687,6 +703,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) IIRC SNDRV_PCM_FMTBIT_S24_LE and SNDRV_PCM_FMTBIT_S32_LE with .sig_bits = 24 are different things, in regards to how the sample is aligned in a 4 byte space. Have you checked that things actually work as expected? This was something that did not work using SNDRV_PCM_FMTBIT_S24_LE on sun4i-codec. > + > +#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 = { > @@ -694,14 +717,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, > @@ -1106,6 +1129,18 @@ static int sun4i_i2s_probe(struct platform_device *pdev) > i2s->capture_dma_data.addr = res->start + SUN4I_I2S_FIFO_RX_REG; > i2s->capture_dma_data.maxburst = 8; > > + soc_dai = devm_kmemdup(&pdev->dev, &sun4i_i2s_dai, > + sizeof(*soc_dai), GFP_KERNEL); > + if (!soc_dai) { > + ret = -ENOMEM; > + goto err_pm_disable; > + } > + > + if (i2s->variant->has_fmt_set_lrck_period) { This condition deserves a comment, particularly as to why you use it in place of having a separate quirk field to represent 32 bit support. Regards ChenYu > + soc_dai->playback.formats = SUN8I_FORMATS; > + soc_dai->capture.formats = SUN8I_FORMATS; > + } > + > pm_runtime_enable(&pdev->dev); > if (!pm_runtime_enabled(&pdev->dev)) { > ret = sun4i_i2s_runtime_resume(&pdev->dev); > -- > 2.20.1 >