Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3070477pxk; Mon, 28 Sep 2020 07:41:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzJnGtapjw7k8gV7ZUVzl3+EtFmVVxBLyVyoYo+WGDG0mjXLA/gPflm5w+PTURB4J1MQGRg X-Received: by 2002:aa7:d1ce:: with SMTP id g14mr2164898edp.153.1601304115865; Mon, 28 Sep 2020 07:41:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601304115; cv=none; d=google.com; s=arc-20160816; b=RDX2S/a4N+bJH1jfIddvFq2Kp2VHOyoMKWekigjgDnTqQ1r+4giOtO/3hKKeesdS4J X20xgNyk2xyftKZg2/LhFxbUUibV+lJ/SBQ4jPk59jHPSTEjGbLCKbDqcaxYSTHt5L7P UlXLkwkPye/NCRABWiKVmzXlPpCMV9Lr4i2koZgxSHliw5EHTxETJoUYDhhRsNnVCQjY CK5Uba/qytUUjZCc6IgMtItelmlV3DLfzHWsQgSclfumQO/xoqd4qJCXXCR6Bfw91cEy xRcHRbAA/e8LXvrMLmbRAAUXe7kurSFCaO4NyTVoWU6dUvU2pho/PHnBvTEXBqAavTnu oraA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=t4AbdMx+cx7XDkAMRw5fwKPY3/PE3Njw9O2Txe+X7KQ=; b=xJcCBHykPGuGKlgDgmiqNgna67LbT6xb+oTtRPbwfvJr6+gg5qrqpSyNRM4OFOcRgs PPD8LThDjuXtsRTazR7mTxCLqPIbpevvhsLltVvR2bFHU7zQarhS1N7x0R1MsnE7GD6V Y1pOQmlyU3iBvi8GW1qzugfglcHIgYF+pHJM8MQ6pfd9TPK4FOCG2vCaL6m34BjNe9r1 tB2eviiNxhJ77rS5CBljHGFFXou53liKcBte4ChhES+iOcQhliOu64sOqgGTIzyh9AXx tfiYmv99EUyxmJ11CqojOB4tLs/ROkOVZm1K0h7teVIWZ0GyxSCFSwhISDehqeOJavRw QN0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=RKnX7n81; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id j22si668278eds.357.2020.09.28.07.41.32; Mon, 28 Sep 2020 07:41:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=RKnX7n81; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1726655AbgI1Ohi (ORCPT + 99 others); Mon, 28 Sep 2020 10:37:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726650AbgI1Ohi (ORCPT ); Mon, 28 Sep 2020 10:37:38 -0400 Received: from mail-io1-xd43.google.com (mail-io1-xd43.google.com [IPv6:2607:f8b0:4864:20::d43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F12AC061755; Mon, 28 Sep 2020 07:37:38 -0700 (PDT) Received: by mail-io1-xd43.google.com with SMTP id m17so1365030ioo.1; Mon, 28 Sep 2020 07:37:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=t4AbdMx+cx7XDkAMRw5fwKPY3/PE3Njw9O2Txe+X7KQ=; b=RKnX7n81fRNP7SzOx3e5G8EXU7UK8R6fQQS/GeZPWcPNO0fHznMAlSHnQkm9nvnLrl ksK9e3gFSf/5HE6q+1+k4xGuglAUG8x97sx3OWUWZKZkB0+8VC3y+pz8aziKAxRYj0p2 DX3eEtEQPINky7M7wVu08YpNr86aBIJoIw8Qbdg5q6UCveVdStTyLkrqhJb3ZSgzz6Bw mkn7/xxOKikbGxwvlcP82/Eelx8GDoo1TZ+QrTHCpejFZtbB1SX+GfKVDGW3T/i4LHGm 3jnwLLdiq78cQmGX4gRiJlxjxXVB9GdoOocjRhBSbK4ZzkMrkOdicqNLaXfmwjr1oKI3 FwVQ== 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:content-transfer-encoding; bh=t4AbdMx+cx7XDkAMRw5fwKPY3/PE3Njw9O2Txe+X7KQ=; b=AoJnfHEzXFu6dHxHno/oeFtK0DEwlsNIzvtv2pC8HLDKcuP8NXCbmk4vguhf09ree+ JOyW4DtMf7V1iu42riqkR90X9HTB406fNPESGiCMMwZBWee481e0JVREV3LPXcfeBoNH BhkBVKnykJF9t/pfT8p4LAIOchvLKDA/vSujwZByWhJODgADmeaUGe64SNi0uUsrETf/ mfu9i3v/SHfX2cAxvMahF0+nzJlTznrSmvQF6xFeXpFasc0ZCAyiE96vLSFxcOFPwPze U818rZyQlVjWgq1mwFVYasCpK2KQaIDZFexxKx465MczZBrEu4d5xCzuO0JKGJFxjDgl gjXA== X-Gm-Message-State: AOAM533IjHHjUxuaNoc1NVir14GUL6lpSe8Bn3JjjoOz5AaFW6D+a6HX Jz7cH8JvMSh4TXJ+dA7+iXq1CVo/LuzYd9GZJZY= X-Received: by 2002:a6b:908:: with SMTP id t8mr7098983ioi.124.1601303857337; Mon, 28 Sep 2020 07:37:37 -0700 (PDT) MIME-Version: 1.0 References: <20200927192912.46323-1-peron.clem@gmail.com> <20200927192912.46323-2-peron.clem@gmail.com> In-Reply-To: From: =?UTF-8?B?Q2zDqW1lbnQgUMOpcm9u?= Date: Mon, 28 Sep 2020 16:37:26 +0200 Message-ID: Subject: Re: [linux-sunxi] [PATCH v5 01/20] ASoC: sun4i-i2s: Add support for H6 I2S To: Chen-Yu Tsai Cc: Maxime Ripard , Rob Herring , Mark Brown , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , Marcus Cooper , Jernej Skrabec , Linux-ALSA , devicetree , linux-arm-kernel , linux-kernel , linux-sunxi Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Chen-Yu, On Mon, 28 Sep 2020 at 06:40, Chen-Yu Tsai wrote: > > On Mon, Sep 28, 2020 at 3:29 AM Cl=C3=A9ment P=C3=A9ron wrote: > > > > From: Jernej Skrabec > > > > H6 I2S is very similar to that in H3, except it supports up to 16 > > channels. > > > > Signed-off-by: Jernej Skrabec > > Signed-off-by: Marcus Cooper > > Signed-off-by: Cl=C3=A9ment P=C3=A9ron > > --- > > sound/soc/sunxi/sun4i-i2s.c | 224 ++++++++++++++++++++++++++++++++++++ > > 1 file changed, 224 insertions(+) > > > > diff --git a/sound/soc/sunxi/sun4i-i2s.c b/sound/soc/sunxi/sun4i-i2s.c > > index f23ff29e7c1d..2baf6c276280 100644 > > --- a/sound/soc/sunxi/sun4i-i2s.c > > +++ b/sound/soc/sunxi/sun4i-i2s.c > > @@ -124,6 +124,21 @@ > > #define SUN8I_I2S_RX_CHAN_SEL_REG 0x54 > > #define SUN8I_I2S_RX_CHAN_MAP_REG 0x58 > > > > +/* Defines required for sun50i-h6 support */ > > +#define SUN50I_H6_I2S_TX_CHAN_SEL_OFFSET_MASK GENMASK(21, 20) > > +#define SUN50I_H6_I2S_TX_CHAN_SEL_OFFSET(offset) ((offset) << 20= ) > > +#define SUN50I_H6_I2S_TX_CHAN_SEL_MASK GENMASK(19, 16) > > +#define SUN50I_H6_I2S_TX_CHAN_SEL(chan) ((chan - 1) << = 16) > > +#define SUN50I_H6_I2S_TX_CHAN_EN_MASK GENMASK(15, 0) > > +#define SUN50I_H6_I2S_TX_CHAN_EN(num_chan) (((1 << num_chan) - 1)) > > + > > +#define SUN50I_H6_I2S_TX_CHAN_MAP0_REG 0x44 > > +#define SUN50I_H6_I2S_TX_CHAN_MAP1_REG 0x48 > > + > > +#define SUN50I_H6_I2S_RX_CHAN_SEL_REG 0x64 > > +#define SUN50I_H6_I2S_RX_CHAN_MAP0_REG 0x68 > > +#define SUN50I_H6_I2S_RX_CHAN_MAP1_REG 0x6C > > + > > struct sun4i_i2s; > > > > /** > > @@ -474,6 +489,62 @@ static int sun8i_i2s_set_chan_cfg(const struct sun= 4i_i2s *i2s, > > return 0; > > } > > > > +static int sun50i_h6_i2s_set_chan_cfg(const struct sun4i_i2s *i2s, > > + const struct snd_pcm_hw_params *p= arams) > > +{ > > + unsigned int channels =3D params_channels(params); > > + unsigned int slots =3D channels; > > + unsigned int lrck_period; > > + > > + if (i2s->slots) > > + slots =3D i2s->slots; > > + > > + /* Map the channels for playback and capture */ > > + regmap_write(i2s->regmap, SUN50I_H6_I2S_TX_CHAN_MAP1_REG, 0x765= 43210); > > + regmap_write(i2s->regmap, SUN50I_H6_I2S_RX_CHAN_MAP1_REG, 0x765= 43210); > > Nit, since it supports up to 16 channels, you might want to map all 16 of= them > now, instead of having to come back and fix it later. Thanks for the review. Do you mean there is missing MAP0 for RX/TX ? + regmap_write(i2s->regmap, SUN50I_H6_I2S_TX_CHAN_MAP0_REG, 0xFEDCBA98); regmap_write(i2s->regmap, SUN50I_H6_I2S_TX_CHAN_MAP1_REG, 0x76543210); + regmap_write(i2s->regmap, SUN50I_H6_I2S_RX_CHAN_MAP0_REG, 0xFEDCBA98); regmap_write(i2s->regmap, SUN50I_H6_I2S_RX_CHAN_MAP1_REG, 0x76543210); Regards, Clement > > Code wise, this patch is > > Reviewed-by: Chen-Yu Tsai > > I don't have a scope nor logic analyzer, so I wasn't able to participate = in the > LRCK discussion.