Skip to content

Commit 5fa59c1

Browse files
RanderWangplbossart
authored andcommitted
ASoC: codec: max98373-sdw: refine tdm support
We only use tdm_slots for playback as required by the machine driver. For the capture the number of channels is fixed to two and the tdm_slot is irrelevant. Signed-off-by: Ryan Lee <ryans.lee@maximintegrated.com> Signed-off-by: Rander Wang <rander.wang@intel.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
1 parent db39fed commit 5fa59c1

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

sound/soc/codecs/max98373-sdw.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -614,11 +614,16 @@ static int max98373_sdw_dai_hw_params(struct snd_pcm_substream *substream,
614614
stream_config.bps = snd_pcm_format_width(params_format(params));
615615
stream_config.direction = direction;
616616

617-
if (max98373->slot) {
617+
if (max98373->slot && direction == SDW_DATA_DIR_RX) {
618618
stream_config.ch_count = max98373->slot;
619619
port_config.ch_mask = max98373->rx_mask;
620620
} else {
621-
stream_config.ch_count = params_channels(params);
621+
/* only IV are supported by capture */
622+
if (direction == SDW_DATA_DIR_TX)
623+
stream_config.ch_count = 2;
624+
else
625+
stream_config.ch_count = params_channels(params);
626+
622627
port_config.ch_mask = GENMASK(stream_config.ch_count - 1, 0);
623628
}
624629

@@ -774,7 +779,8 @@ static int max98373_sdw_set_tdm_slot(struct snd_soc_dai *dai,
774779
struct max98373_priv *max98373 =
775780
snd_soc_component_get_drvdata(component);
776781

777-
if (!tx_mask && !rx_mask && !slots && !slot_width)
782+
/* tx_mask is ignored since it's irrelevant for I/V feedback */
783+
if (!rx_mask && !slots && !slot_width)
778784
max98373->tdm_mode = false;
779785
else
780786
max98373->tdm_mode = true;

0 commit comments

Comments
 (0)