Re: [PATCH 3/4] soundwire: SDCA: add helper macro to access controls

From: Vinod Koul
Date: Wed Aug 26 2020 - 12:40:32 EST


On 26-08-20, 10:00, Pierre-Louis Bossart wrote:
>
>
> > > +/* v1.2 device - SDCA address mapping */
> >
> > Can you please add description of bits used by each field here,
> > something like we have done for DevId
>
> were you referring to something like this?
>
> * Spec definition
> * Register Bit Contents
> * DevId_0 [7:4] 47:44 sdw_version
> * DevId_0 [3:0] 43:40 unique_id
> * DevId_1 39:32 mfg_id [15:8]
> * DevId_2 31:24 mfg_id [7:0]
> * DevId_3 23:16 part_id [15:8]
> * DevId_4 15:08 part_id [7:0]
> * DevId_5 07:00 class_id

Correct

> >
> > > +#define SDW_SDCA_CTL(fun, ent, ctl, ch) (BIT(30) | \
> > > + (((fun) & 0x7) << 22) | \
> > > + (((ent) & 0x40) << 15) | \
> > > + (((ent) & 0x3f) << 7) | \
> > > + (((ctl) & 0x30) << 15) | \
> > > + (((ctl) & 0x0f) << 3) | \
> > > + (((ch) & 0x38) << 12) | \
> > > + ((ch) & 0x07))
> >
> > GENMASK() for the bitmaps here please. Also it would look very neat by
> > using FIELD_PREP() here, you can skip the bit shifts and they would be
> > done by FIELD_PREP() for you.
>
> ok.

FWIW I am testing changes to do the conversion for subsystem to use nice
stuff in bitfield.h


--
~Vinod