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

Vinod Koul vkoul at kernel.org
Wed Aug 26 18:40:18 CEST 2020


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


More information about the Alsa-devel mailing list