[PATCH 2/9] ASoC: max98373-sdw: Switch to new snd_sdw_params_to_config helper

Charles Keepax ckeepax at opensource.cirrus.com
Tue Nov 22 10:46:16 CET 2022


On Mon, Nov 21, 2022 at 04:31:42PM +0000, Richard Fitzgerald wrote:
> On 21/11/2022 13:46, Charles Keepax wrote:
> >The conversation from hw_params to SoundWire config is pretty
> s/conversation/conversion
> 

lol oops thanks for that will resend to fix that up its the whole
series.

> >  	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
> >-		direction = SDW_DATA_DIR_RX;
> >  		port_config.num = 1;
> >+
> >+		if (max98373->slot) {
> >+			stream_config.ch_count = max98373->slot;
> >+			port_config.ch_mask = max98373->rx_mask;
> >+		}
> >  	} else {
> >-		direction = SDW_DATA_DIR_TX;
> >  		port_config.num = 3;
> >-	}
> >-	stream_config.frame_rate = params_rate(params);
> >-	stream_config.bps = snd_pcm_format_width(params_format(params));
> >-	stream_config.direction = direction;
> >-
> >-	if (max98373->slot && direction == SDW_DATA_DIR_RX) {
> >-		stream_config.ch_count = max98373->slot;
> >-		port_config.ch_mask = max98373->rx_mask;
> >-	} else {
> >  		/* only IV are supported by capture */
> >-		if (direction == SDW_DATA_DIR_TX)
> >-			stream_config.ch_count = 2;
> Has this special case gone missing or is it already guaranteed by the
> DAI config?
> 

This special case is still there, it is just below where you made
your next comment. All this case equates to is if direction is
TX/CAPTURE set the number of channels to 2.

> >-		else
> >-			stream_config.ch_count = params_channels(params);
> >-
> >+		stream_config.ch_count = 2;
> >  		port_config.ch_mask = GENMASK((int)stream_config.ch_count - 1, 0);
> this is already done by snd_sdw_params_to_config()

Not in this case because we just forced the channel count to 2,
so we probably need to regenerate the mask too.

Thanks,
Charles


More information about the Alsa-devel mailing list