Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3075898pxk; Mon, 28 Sep 2020 07:49:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx8wAewm5wHYIoBCL4VG2KyqS78LaBxJQ5sKvTH7Yj1i26iQOuQoPSFeMGhCTtUAIS5mfSr X-Received: by 2002:a17:906:a093:: with SMTP id q19mr1889941ejy.295.1601304596348; Mon, 28 Sep 2020 07:49:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601304596; cv=none; d=google.com; s=arc-20160816; b=anvd/DKh1Xa0F1bLODNrYwaaTIlhjv5DiLNyC+WIbZt9JOtobno0puUvFT7LWZeU6r WfWPVjJeedgTpRBAtuejRdgk7JLcU1ofKbZGabsPS67jyF+XYF7neicd3gqYCe6ISYaB RIs90RnnNe/fCDiwllBFf+HS5W9Tt/PZ3HjfrqiPGBDVqqLk2DxYtse4Lj0Qwbxs0eIY rZFZ9f0B3w5u/8jJS0uSExcEvqpXvOvNY17F+NQxh+JRAKXG2V9HpaIMQ6JTX0/qXvY6 JFZvsyOwBN6l32C7U1HYq3HXtu8kB1cz2A3QJwxLc0FQ5F1VLq6G3dUlQbdq6A6uZ+ZW Ru/Q== 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; bh=r48fP1KPGucuffEJQ2NlwvZdTzb4TfoaqJY6UNpKSKE=; b=o+CLA0ZtSOEfnSRbUrpgLYM8z7fDf92LeM8S7CdWwsLVXFIixnSDbDiF7YBn9vq2UX VIZcmVm4zV705EIXnQaL32Ad3crgKS6kHeYt1fmelOXX7OZFftwSRbjWnypTcjGltY2T ZuunuxoPZDh3IX/o0BJKgf9zmmZrJxvBJT/fsvm6gthInlPmGB83xFu6oK8/Eu4wuVWI gR7e8xlWD5irS2ObFM7ONfxyYsklxsd8FP7CkNcb2dPw9oPRCMa3kvOP+dkV6hhNpoOR F7hUX0RjwQMUKNbI3w1/f0VpEPmOE0EfcF62XK8sYU7tZ1aEusHVen+i1nNzAkvRsZ3q 5zTA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p15si751976ejm.293.2020.09.28.07.49.32; Mon, 28 Sep 2020 07:49:56 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726564AbgI1OqU convert rfc822-to-8bit (ORCPT + 99 others); Mon, 28 Sep 2020 10:46:20 -0400 Received: from mail-lf1-f68.google.com ([209.85.167.68]:42355 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726420AbgI1OqU (ORCPT ); Mon, 28 Sep 2020 10:46:20 -0400 Received: by mail-lf1-f68.google.com with SMTP id b12so1571146lfp.9; Mon, 28 Sep 2020 07:46:18 -0700 (PDT) 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=KCww78yTvjpE9tUq6aOXD0YyyC+MPNJogO8+ZVoVaG0=; b=FQDJwyzBrIrRfW5PC6eBiIB808Vw4lD1hO+JOpTcg4XIe3iEaJ71HjQ8NHP5mKgZQE AmBfb+1eA5CQM8ObWrx19Hb0KqmaTHzxBrWN1oFmFjdg9qIkhwlj9AV0x6Ke8OOW+zLx 4/FovrptPhNwSdkuh8yeZ/IoeA1mmlAP+uhG5B+Xh25VlzdiaoK3KPoFvy7aOpXDqtbM H0MCvX/xTw1GKpcrWANbPSpNL+/n7x8sFgAmnl+UC7iqjTxLcKZ8jNbD8L+kTdijQ70C j4hGPnAD85TFT6f3ZcKqYAHtEup8JTAuBfrpQtAA21Nm16AoWzg/eDODBhAQfoG1yD8k d1IA== X-Gm-Message-State: AOAM53084ZkYmR0qg/CxTSBmSqIJ0D8S7rVjK7+tEdw+objsEW16aqRc ZmJaQCGncSU3g6CcJiQsVFNOydAY+cwBmg== X-Received: by 2002:ac2:4116:: with SMTP id b22mr681596lfi.224.1601304377436; Mon, 28 Sep 2020 07:46:17 -0700 (PDT) Received: from mail-lj1-f175.google.com (mail-lj1-f175.google.com. [209.85.208.175]) by smtp.gmail.com with ESMTPSA id h16sm2875171lfc.63.2020.09.28.07.46.16 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 28 Sep 2020 07:46:16 -0700 (PDT) Received: by mail-lj1-f175.google.com with SMTP id c2so1242385ljj.12; Mon, 28 Sep 2020 07:46:16 -0700 (PDT) X-Received: by 2002:a2e:760e:: with SMTP id r14mr509853ljc.331.1601304376547; Mon, 28 Sep 2020 07:46:16 -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: Chen-Yu Tsai Date: Mon, 28 Sep 2020 22:46:04 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [linux-sunxi] [PATCH v5 01/20] ASoC: sun4i-i2s: Add support for H6 I2S To: =?UTF-8?B?Q2zDqW1lbnQgUMOpcm9u?= 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: 8BIT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 28, 2020 at 10:37 PM Clément Péron wrote: > > 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ément Péron 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ément Péron > > > --- > > > 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 sun4i_i2s *i2s, > > > return 0; > > > } > > > > > > +static int sun50i_h6_i2s_set_chan_cfg(const struct sun4i_i2s *i2s, > > > + const struct snd_pcm_hw_params *params) > > > +{ > > > + unsigned int channels = params_channels(params); > > > + unsigned int slots = channels; > > > + unsigned int lrck_period; > > > + > > > + if (i2s->slots) > > > + slots = i2s->slots; > > > + > > > + /* Map the channels for playback and capture */ > > > + regmap_write(i2s->regmap, SUN50I_H6_I2S_TX_CHAN_MAP1_REG, 0x76543210); > > > + regmap_write(i2s->regmap, SUN50I_H6_I2S_RX_CHAN_MAP1_REG, 0x76543210); > > > > 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); Correct. ChenYu > 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. > > -- > You received this message because you are subscribed to the Google Groups "linux-sunxi" group. > To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe@googlegroups.com. > To view this discussion on the web, visit https://groups.google.com/d/msgid/linux-sunxi/CAJiuCcevtzX_%2B02r54q6tH0%2BbOF%3DBM%3DknnaxN%2BG3QW035F8gZQ%40mail.gmail.com.