linux-stable/drivers/soundwire
Pierre-Louis Bossart 8b20aab8cf ASoC/SoundWire: dai: expand 'stream' concept beyond SoundWire
commit e8444560b4 upstream.

The HDAudio ASoC support relies on the set_tdm_slots() helper to store
the HDaudio stream tag in the tx_mask. This only works because of the
pre-existing order in soc-pcm.c, where the hw_params() is handled for
codec_dais *before* cpu_dais. When the order is reversed, the
stream_tag is used as a mask in the codec fixup functions:

	/* fixup params based on TDM slot masks */
	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK &&
	    codec_dai->tx_mask)
		soc_pcm_codec_params_fixup(&codec_params,
					   codec_dai->tx_mask);

As a result of this confusion, the codec_params_fixup() ends-up
generating bad channel masks, depending on what stream_tag was
allocated.

We could add a flag to state that the tx_mask is really not a mask,
but it would be quite ugly to persist in overloading concepts.

Instead, this patch suggests a more generic get/set 'stream' API based
on the existing model for SoundWire. We can expand the concept to
store 'stream' opaque information that is specific to different DAI
types. In the case of HDAudio DAIs, we only need to store a stream tag
as an unsigned char pointer. The TDM rx_ and tx_masks should really
only be used to store masks.

Rename get_sdw_stream/set_sdw_stream callbacks and helpers as
get_stream/set_stream. No functionality change beyond the rename.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Acked-By: Vinod Koul <vkoul@kernel.org>
Link: https://lore.kernel.org/r/20211224021034.26635-5-yung-chuan.liao@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-01-14 10:16:28 +01:00
..
bus.c
bus.h
bus_type.c soundwire: bus_type: fix remove and shutdown support 2022-08-21 15:15:56 +02:00
cadence_master.c soundwire: cadence: Don't overwrite msg->buf during write commands 2022-10-26 13:25:53 +02:00
cadence_master.h
debugfs.c
generic_bandwidth_allocation.c
intel.c ASoC/SoundWire: dai: expand 'stream' concept beyond SoundWire 2023-01-14 10:16:28 +01:00
intel.h
intel_init.c
Kconfig
Makefile
master.c
mipi_disco.c
qcom.c ASoC/SoundWire: dai: expand 'stream' concept beyond SoundWire 2023-01-14 10:16:28 +01:00
slave.c
stream.c ASoC/SoundWire: dai: expand 'stream' concept beyond SoundWire 2023-01-14 10:16:28 +01:00
sysfs_local.h
sysfs_slave.c
sysfs_slave_dpn.c