lkml.org 
[lkml]   [2020]   [Sep]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [linux-sunxi] [PATCH v5 01/20] ASoC: sun4i-i2s: Add support for H6 I2S
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.

\
 
 \ /
  Last update: 2020-09-28 16:47    [W:0.048 / U:1.312 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site