Re: [PATCH v6 2/7] ASoC: sun4i-i2s: Add functions for RX and TX channel offsets

From: Code Kipper
Date: Wed Oct 16 2019 - 04:25:44 EST


On Wed, 16 Oct 2019 at 10:06, Maxime Ripard <mripard@xxxxxxxxxx> wrote:
>
> Hi,
>
> On Wed, Oct 16, 2019 at 09:07:35AM +0200, codekipper@xxxxxxxxx wrote:
> > From: Marcus Cooper <codekipper@xxxxxxxxx>
> >
> > Newer SoCs like the H6 have the channel offset bits in a different
> > position to what is on the H3. As we will eventually add multi-
> > channel support then create function calls as opposed to regmap
> > fields to add support for different devices.
> >
> > Signed-off-by: Marcus Cooper <codekipper@xxxxxxxxx>
> > ---
> > sound/soc/sunxi/sun4i-i2s.c | 31 +++++++++++++++++++++++++------
> > 1 file changed, 25 insertions(+), 6 deletions(-)
> >
> > diff --git a/sound/soc/sunxi/sun4i-i2s.c b/sound/soc/sunxi/sun4i-i2s.c
> > index f1a80973c450..875567881f30 100644
> > --- a/sound/soc/sunxi/sun4i-i2s.c
> > +++ b/sound/soc/sunxi/sun4i-i2s.c
> > @@ -157,6 +157,8 @@ struct sun4i_i2s_quirks {
> > int (*set_chan_cfg)(const struct sun4i_i2s *,
> > const struct snd_pcm_hw_params *);
> > int (*set_fmt)(struct sun4i_i2s *, unsigned int);
> > + void (*set_txchanoffset)(const struct sun4i_i2s *, int);
> > + void (*set_rxchanoffset)(const struct sun4i_i2s *);
>
> The point of removing the regmap_field was that because having a
> one-size-fits-all function with regmap_field sort of making the
> abstraction was becoming more and more of a burden to maintain.
>
> Having functions for each and every register access is exactly the
> same as using regmap_field here, and the issue we adressed is not with
> regmap_fields in itself.
>
> If the H6 has a different register layout, then so be it, create a new
> set_chan_cfg or set_fmt function for the H6.
The H3 and the H6 have a similar register layout but the issue here is
that sooner
rather than later we would want to be supporting multi-channel audio
which requires the
offset to be applied to each TX channel channel select register(8chan
PCM for HDMI
requires 4 Tx channels). Currently we're only using one.
BR,
CK
>
> Maxime