[PATCH 6/9] soundwire: cadence: use FIELD_{GET|PREP}

Vinod Koul vkoul at kernel.org
Sat Aug 29 12:55:24 CEST 2020


On 28-08-20, 13:13, Pierre-Louis Bossart wrote:
> 
> > -	val = (r << CDNS_MCP_FRAME_SHAPE_ROW_OFFSET) | c;
> > +	val = FIELD_PREP(CDNS_MCP_FRAME_SHAPE_ROW_OFFSET, r) | c;
> 
> Confusion between shift and mask here.

thanks, yes I had doubts on this, folder the fix

> 
> Testing a fix now (attached), but may I suggest you use the SOF
> GitHub/Travis CI directly for any updates? You'll get an answer in 30mn for
> the CML RVP w/ SoundWire.

> >From 5d0ca63bee2c6e2456195499908ecdc8a7709238 Mon Sep 17 00:00:00 2001
> From: Pierre-Louis Bossart <pierre-louis.bossart at linux.intel.com>
> Date: Fri, 28 Aug 2020 13:04:01 -0500
> Subject: [PATCH] fixup! soundwire: cadence: use FIELD_{GET|PREP}
> 
> Fix confusion between shift and mask.
> 
> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart at linux.intel.com>
> ---
>  drivers/soundwire/cadence_master.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/soundwire/cadence_master.c b/drivers/soundwire/cadence_master.c
> index b6796aa19aa8..5dd06483c835 100644
> --- a/drivers/soundwire/cadence_master.c
> +++ b/drivers/soundwire/cadence_master.c
> @@ -58,7 +58,7 @@ MODULE_PARM_DESC(cdns_mcp_int_mask, "Cadence MCP IntMask");
>  #define CDNS_MCP_FRAME_SHAPE			0x10
>  #define CDNS_MCP_FRAME_SHAPE_INIT		0x14
>  #define CDNS_MCP_FRAME_SHAPE_COL_MASK		GENMASK(2, 0)
> -#define CDNS_MCP_FRAME_SHAPE_ROW_OFFSET		3
> +#define CDNS_MCP_FRAME_SHAPE_ROW_MASK		GENMASK(7, 3)
>  
>  #define CDNS_MCP_CONFIG_UPDATE			0x18
>  #define CDNS_MCP_CONFIG_UPDATE_BIT		BIT(0)
> @@ -1165,9 +1165,10 @@ static u32 cdns_set_initial_frame_shape(int n_rows, int n_cols)
>  	int r;
>  
>  	r = sdw_find_row_index(n_rows);
> -	c = sdw_find_col_index(n_cols) & CDNS_MCP_FRAME_SHAPE_COL_MASK;
> +	c = sdw_find_col_index(n_cols);
>  
> -	val = FIELD_PREP(CDNS_MCP_FRAME_SHAPE_ROW_OFFSET, r) | c;
> +	val = FIELD_PREP(CDNS_MCP_FRAME_SHAPE_ROW_MASK, r) |
> +		FIELD_PREP(CDNS_MCP_FRAME_SHAPE_COL_MASK, c);
>  
>  	return val;
>  }
> -- 
> 2.25.1
> 


-- 
~Vinod


More information about the Alsa-devel mailing list