devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chen-Yu Tsai <wens@csie.org>
To: "Clément Péron" <peron.clem@gmail.com>
Cc: Maxime Ripard <mripard@kernel.org>,
	Rob Herring <robh+dt@kernel.org>, Mark Brown <broonie@kernel.org>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
	Marcus Cooper <codekipper@gmail.com>,
	Jernej Skrabec <jernej.skrabec@siol.net>,
	Linux-ALSA <alsa-devel@alsa-project.org>,
	devicetree <devicetree@vger.kernel.org>,
	linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	linux-sunxi <linux-sunxi@googlegroups.com>
Subject: Re: [linux-sunxi] [PATCH v5 01/20] ASoC: sun4i-i2s: Add support for H6 I2S
Date: Mon, 28 Sep 2020 22:46:04 +0800	[thread overview]
Message-ID: <CAGb2v64Ath4vm+QNky2Le6ickJJ68Q8DJs8k6kqW=xh7DxmnMg@mail.gmail.com> (raw)
In-Reply-To: <CAJiuCcevtzX_+02r54q6tH0+bOF=BM=knnaxN+G3QW035F8gZQ@mail.gmail.com>

On Mon, Sep 28, 2020 at 10:37 PM Clément Péron <peron.clem@gmail.com> wrote:
>
> Hi Chen-Yu,
>
> On Mon, 28 Sep 2020 at 06:40, Chen-Yu Tsai <wens@csie.org> wrote:
> >
> > On Mon, Sep 28, 2020 at 3:29 AM Clément Péron <peron.clem@gmail.com> wrote:
> > >
> > > From: Jernej Skrabec <jernej.skrabec@siol.net>
> > >
> > > H6 I2S is very similar to that in H3, except it supports up to 16
> > > channels.
> > >
> > > Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
> > > Signed-off-by: Marcus Cooper <codekipper@gmail.com>
> > > Signed-off-by: Clément Péron <peron.clem@gmail.com>
> > > ---
> > >  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 <wens@csie.org>
> >
> > 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.

  reply	other threads:[~2020-09-28 14:46 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-27 19:28 [PATCH v5 00/20] Add Allwinner H3/H5/H6/A64 HDMI audio Clément Péron
2020-09-27 19:28 ` [PATCH v5 01/20] ASoC: sun4i-i2s: Add support for H6 I2S Clément Péron
2020-09-28  4:40   ` [linux-sunxi] " Chen-Yu Tsai
2020-09-28 14:37     ` Clément Péron
2020-09-28 14:46       ` Chen-Yu Tsai [this message]
2020-09-27 19:28 ` [PATCH v5 02/20] ASoC: sun4i-i2s: Change set_chan_cfg() params Clément Péron
2020-09-28  5:00   ` [linux-sunxi] " Chen-Yu Tsai
2020-09-28 14:48     ` Clément Péron
2020-09-27 19:28 ` [PATCH v5 03/20] ASoC: sun4i-i2s: Change get_sr() and get_wss() to be more explicit Clément Péron
2020-09-28  4:37   ` [linux-sunxi] " Chen-Yu Tsai
2020-09-28  5:02     ` Chen-Yu Tsai
2020-09-27 19:28 ` [PATCH v5 04/20] dt-bindings: ASoC: sun4i-i2s: Add H6 compatible Clément Péron
2020-09-28  5:03   ` [linux-sunxi] " Chen-Yu Tsai
2020-09-27 19:28 ` [PATCH v5 05/20] ASoC: sun4i-i2s: Set sign extend sample Clément Péron
2020-09-28  6:52   ` [linux-sunxi] " Chen-Yu Tsai
2020-09-27 19:28 ` [PATCH v5 06/20] ASoc: sun4i-i2s: Add 20 and 24 bit support Clément Péron
2020-09-28  6:51   ` [linux-sunxi] " Chen-Yu Tsai
2020-09-27 19:28 ` [PATCH v5 07/20] ASoC: sun4i-i2s: Fix sun8i volatile regs Clément Péron
2020-09-28  6:49   ` [linux-sunxi] " Chen-Yu Tsai
2020-09-27 19:29 ` [PATCH v5 08/20] ASoC: sun4i-i2s: Fix setting of FIFO modes Clément Péron
2020-09-28  6:51   ` [linux-sunxi] " Chen-Yu Tsai
2020-09-27 19:29 ` [PATCH v5 09/20] arm64: dts: allwinner: h6: Add DAI node and soundcard for HDMI Clément Péron
2020-09-28  5:32   ` [linux-sunxi] " Chen-Yu Tsai
2020-09-28  5:42     ` Chen-Yu Tsai
2020-10-02 16:01       ` Clément Péron
2020-10-02 16:24         ` Maxime Ripard
2020-10-03  9:32           ` Clément Péron
2020-09-27 19:29 ` [PATCH v5 10/20] arm64: dts: allwinner: h6: Enable HDMI sound for Beelink GS1 Clément Péron
2020-09-28  5:32   ` [linux-sunxi] " Chen-Yu Tsai
2020-09-27 19:29 ` [PATCH v5 11/20] arm: dts: sunxi: h3/h5: Add DAI node and soundcard for HDMI Clément Péron
2020-09-27 19:29 ` [PATCH v5 12/20] arm64: dts: allwinner: a64: " Clément Péron
2020-09-27 19:29 ` [PATCH v5 13/20] arm: sun8i: h3: Add HDMI audio to Orange Pi 2 Clément Péron
2020-09-27 19:29 ` [PATCH v5 14/20] arm: sun8i: h3: Add HDMI audio to Beelink X2 Clément Péron
2020-09-27 19:29 ` [PATCH v5 15/20] arm64: dts: allwinner: a64: Add HDMI audio to Pine64 Clément Péron
2020-09-27 19:29 ` [PATCH v5 16/20] arm64: dts: allwinner: Enable HDMI audio on Orange Pi PC 2 Clément Péron
2020-09-27 19:29 ` [PATCH v5 17/20] ARM: dts: sun8i-h3: Enable HDMI audio on Orange Pi PC/One Clément Péron
2020-09-27 19:29 ` [PATCH v5 18/20] arm64: dts: sun50i-h6-orangepi-3: Enable HDMI audio Clément Péron
2020-09-27 19:29 ` [PATCH v5 19/20] arm64: defconfig: Enable Allwinner i2s driver Clément Péron
2020-09-27 19:29 ` [PATCH v5 20/20] ASoC: sun4i-i2s: fix coding-style for callback definition Clément Péron
2020-09-28  6:52 ` [linux-sunxi] [PATCH v5 00/20] Add Allwinner H3/H5/H6/A64 HDMI audio Chen-Yu Tsai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAGb2v64Ath4vm+QNky2Le6ickJJ68Q8DJs8k6kqW=xh7DxmnMg@mail.gmail.com' \
    --to=wens@csie.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=codekipper@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=jernej.skrabec@siol.net \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sunxi@googlegroups.com \
    --cc=mripard@kernel.org \
    --cc=perex@perex.cz \
    --cc=peron.clem@gmail.com \
    --cc=robh+dt@kernel.org \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).